pump-kit 0.1.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/@pump-kit.png +0 -0
- package/README.md +24 -3
- package/dist/index.js +11 -11
- package/dist/types/ammsdk/generated/accounts/globalConfig.d.ts +1 -1
- package/dist/types/ammsdk/generated/accounts/pool.d.ts +1 -1
- package/dist/types/ammsdk/generated/instructions/buy.d.ts +1 -1
- package/dist/types/ammsdk/generated/instructions/createConfig.d.ts +1 -1
- package/dist/types/ammsdk/generated/instructions/createPool.d.ts +1 -1
- package/dist/types/ammsdk/generated/instructions/deposit.d.ts +1 -1
- package/dist/types/ammsdk/generated/instructions/disable.d.ts +1 -1
- package/dist/types/ammsdk/generated/instructions/extendAccount.d.ts +1 -1
- package/dist/types/ammsdk/generated/instructions/sell.d.ts +1 -1
- package/dist/types/ammsdk/generated/instructions/updateAdmin.d.ts +1 -1
- package/dist/types/ammsdk/generated/instructions/updateFeeConfig.d.ts +1 -1
- package/dist/types/ammsdk/generated/instructions/withdraw.d.ts +1 -1
- package/dist/types/bin/pump-kit.d.ts +2 -0
- package/dist/types/clients/amm.d.ts +2 -2
- package/dist/types/pumpsdk/generated/accounts/bondingCurve.d.ts +1 -1
- package/dist/types/pumpsdk/generated/accounts/feeConfig.d.ts +1 -1
- package/dist/types/pumpsdk/generated/accounts/global.d.ts +1 -1
- package/dist/types/pumpsdk/generated/accounts/globalVolumeAccumulator.d.ts +1 -1
- package/dist/types/pumpsdk/generated/accounts/userVolumeAccumulator.d.ts +1 -1
- package/dist/types/pumpsdk/generated/instructions/adminSetCreator.d.ts +1 -1
- package/dist/types/pumpsdk/generated/instructions/adminSetIdlAuthority.d.ts +1 -1
- package/dist/types/pumpsdk/generated/instructions/adminUpdateTokenIncentives.d.ts +1 -1
- package/dist/types/pumpsdk/generated/instructions/buy.d.ts +1 -1
- package/dist/types/pumpsdk/generated/instructions/buyExactSolIn.d.ts +1 -1
- package/dist/types/pumpsdk/generated/instructions/claimTokenIncentives.d.ts +1 -1
- package/dist/types/pumpsdk/generated/instructions/closeUserVolumeAccumulator.d.ts +1 -1
- package/dist/types/pumpsdk/generated/instructions/collectCreatorFee.d.ts +1 -1
- package/dist/types/pumpsdk/generated/instructions/create.d.ts +1 -1
- package/dist/types/pumpsdk/generated/instructions/extendAccount.d.ts +1 -1
- package/dist/types/pumpsdk/generated/instructions/initUserVolumeAccumulator.d.ts +1 -1
- package/dist/types/pumpsdk/generated/instructions/initialize.d.ts +1 -1
- package/dist/types/pumpsdk/generated/instructions/migrate.d.ts +1 -1
- package/dist/types/pumpsdk/generated/instructions/sell.d.ts +1 -1
- package/dist/types/pumpsdk/generated/instructions/setCreator.d.ts +1 -1
- package/dist/types/pumpsdk/generated/instructions/setMetaplexCreator.d.ts +1 -1
- package/dist/types/pumpsdk/generated/instructions/setParams.d.ts +1 -1
- package/dist/types/pumpsdk/generated/instructions/syncUserVolumeAccumulator.d.ts +1 -1
- package/dist/types/pumpsdk/generated/instructions/updateGlobalAuthority.d.ts +1 -1
- package/package.json +25 -7
package/dist/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
var Zq=Object.create;var{getPrototypeOf:Xq,defineProperty:tA,getOwnPropertyNames:XG,getOwnPropertyDescriptor:Pq}=Object,PG=Object.prototype.hasOwnProperty;var n0=(T,A,Q)=>{Q=T!=null?Zq(Xq(T)):{};let J=A||!T||!T.__esModule?tA(Q,"default",{value:T,enumerable:!0}):Q;for(let W of XG(T))if(!PG.call(J,W))tA(J,W,{get:()=>T[W],enumerable:!0});return J},ZG=new WeakMap,VA=(T)=>{var A=ZG.get(T),Q;if(A)return A;if(A=tA({},"__esModule",{value:!0}),T&&typeof T==="object"||typeof T==="function")XG(T).map((J)=>!PG.call(A,J)&&tA(A,J,{get:()=>T[J],enumerable:!(Q=Pq(T,J))||Q.enumerable}));return ZG.set(T,A),A},YT=(T,A)=>()=>(A||T((A={exports:{}}).exports,A),A.exports);var U4=(T,A)=>{for(var Q in A)tA(T,Q,{get:A[Q],enumerable:!0,configurable:!0,set:(J)=>A[Q]=()=>J})};var w0=(T,A)=>()=>(T&&(A=T(T=0)),A);var KG=YT((Dq)=>{Dq.byteLength=Kq;Dq.toByteArray=Hq;Dq.fromByteArray=Rq;var FT=[],ZT=[],qq=typeof Uint8Array<"u"?Uint8Array:Array,Y4="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(q8=0,Z4=Y4.length;q8<Z4;++q8)FT[q8]=Y4[q8],ZT[Y4.charCodeAt(q8)]=q8;var q8,Z4;ZT[45]=62;ZT[95]=63;function qG(T){var A=T.length;if(A%4>0)throw Error("Invalid string. Length must be a multiple of 4");var Q=T.indexOf("=");if(Q===-1)Q=A;var J=Q===A?0:4-Q%4;return[Q,J]}function Kq(T){var A=qG(T),Q=A[0],J=A[1];return(Q+J)*3/4-J}function Cq(T,A,Q){return(A+Q)*3/4-Q}function Hq(T){var A,Q=qG(T),J=Q[0],W=Q[1],$=new qq(Cq(T,J,W)),G=0,Y=W>0?J-4:J,Z;for(Z=0;Z<Y;Z+=4)A=ZT[T.charCodeAt(Z)]<<18|ZT[T.charCodeAt(Z+1)]<<12|ZT[T.charCodeAt(Z+2)]<<6|ZT[T.charCodeAt(Z+3)],$[G++]=A>>16&255,$[G++]=A>>8&255,$[G++]=A&255;if(W===2)A=ZT[T.charCodeAt(Z)]<<2|ZT[T.charCodeAt(Z+1)]>>4,$[G++]=A&255;if(W===1)A=ZT[T.charCodeAt(Z)]<<10|ZT[T.charCodeAt(Z+1)]<<4|ZT[T.charCodeAt(Z+2)]>>2,$[G++]=A>>8&255,$[G++]=A&255;return $}function Vq(T){return FT[T>>18&63]+FT[T>>12&63]+FT[T>>6&63]+FT[T&63]}function jq(T,A,Q){var J,W=[];for(var $=A;$<Q;$+=3)J=(T[$]<<16&16711680)+(T[$+1]<<8&65280)+(T[$+2]&255),W.push(Vq(J));return W.join("")}function Rq(T){var A,Q=T.length,J=Q%3,W=[],$=16383;for(var G=0,Y=Q-J;G<Y;G+=$)W.push(jq(T,G,G+$>Y?Y:G+$));if(J===1)A=T[Q-1],W.push(FT[A>>2]+FT[A<<4&63]+"==");else if(J===2)A=(T[Q-2]<<8)+T[Q-1],W.push(FT[A>>10]+FT[A>>4&63]+FT[A<<2&63]+"=");return W.join("")}});var CG=YT((Fq)=>{/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */Fq.read=function(T,A,Q,J,W){var $,G,Y=W*8-J-1,Z=(1<<Y)-1,C=Z>>1,K=-7,V=Q?W-1:0,M=Q?-1:1,z=T[A+V];V+=M,$=z&(1<<-K)-1,z>>=-K,K+=Y;for(;K>0;$=$*256+T[A+V],V+=M,K-=8);G=$&(1<<-K)-1,$>>=-K,K+=J;for(;K>0;G=G*256+T[A+V],V+=M,K-=8);if($===0)$=1-C;else if($===Z)return G?NaN:(z?-1:1)*(1/0);else G=G+Math.pow(2,J),$=$-C;return(z?-1:1)*G*Math.pow(2,$-J)};Fq.write=function(T,A,Q,J,W,$){var G,Y,Z,C=$*8-W-1,K=(1<<C)-1,V=K>>1,M=W===23?Math.pow(2,-24)-Math.pow(2,-77):0,z=J?0:$-1,N=J?1:-1,w=A<0||A===0&&1/A<0?1:0;if(A=Math.abs(A),isNaN(A)||A===1/0)Y=isNaN(A)?1:0,G=K;else{if(G=Math.floor(Math.log(A)/Math.LN2),A*(Z=Math.pow(2,-G))<1)G--,Z*=2;if(G+V>=1)A+=M/Z;else A+=M*Math.pow(2,1-V);if(A*Z>=2)G++,Z/=2;if(G+V>=K)Y=0,G=K;else if(G+V>=1)Y=(A*Z-1)*Math.pow(2,W),G=G+V;else Y=A*Math.pow(2,V-1)*Math.pow(2,W),G=0}for(;W>=8;T[Q+z]=Y&255,z+=N,Y/=256,W-=8);G=G<<W|Y,C+=W;for(;C>0;T[Q+z]=G&255,z+=N,G/=256,C-=8);T[Q+z-N]|=w*128}});var v6={};U4(v6,{transcode:()=>g5,resolveObjectURL:()=>_5,kStringMaxLength:()=>qZ,kMaxLength:()=>q2,isUtf8:()=>x5,isAscii:()=>h5,default:()=>m5,constants:()=>G5,btoa:()=>Q5,atob:()=>J5,INSPECT_MAX_BYTES:()=>PZ,File:()=>W5,Buffer:()=>E,Blob:()=>$5});function sV(T){var A=T.length;if(A%4>0)throw Error("Invalid string. Length must be a multiple of 4");var Q=T.indexOf("=");if(Q===-1)Q=A;var J=Q===A?0:4-Q%4;return[Q,J]}function tV(T,A){return(T+A)*3/4-A}function eV(T){var A,Q=sV(T),J=Q[0],W=Q[1],$=new Uint8Array(tV(J,W)),G=0,Y=W>0?J-4:J,Z;for(Z=0;Z<Y;Z+=4)A=qT[T.charCodeAt(Z)]<<18|qT[T.charCodeAt(Z+1)]<<12|qT[T.charCodeAt(Z+2)]<<6|qT[T.charCodeAt(Z+3)],$[G++]=A>>16&255,$[G++]=A>>8&255,$[G++]=A&255;if(W===2)A=qT[T.charCodeAt(Z)]<<2|qT[T.charCodeAt(Z+1)]>>4,$[G++]=A&255;if(W===1)A=qT[T.charCodeAt(Z)]<<10|qT[T.charCodeAt(Z+1)]<<4|qT[T.charCodeAt(Z+2)]>>2,$[G++]=A>>8&255,$[G++]=A&255;return $}function T5(T){return hT[T>>18&63]+hT[T>>12&63]+hT[T>>6&63]+hT[T&63]}function A5(T,A,Q){var J,W=[];for(var $=A;$<Q;$+=3)J=(T[$]<<16&16711680)+(T[$+1]<<8&65280)+(T[$+2]&255),W.push(T5(J));return W.join("")}function $Z(T){var A,Q=T.length,J=Q%3,W=[],$=16383;for(var G=0,Y=Q-J;G<Y;G+=$)W.push(A5(T,G,G+$>Y?Y:G+$));if(J===1)A=T[Q-1],W.push(hT[A>>2]+hT[A<<4&63]+"==");else if(J===2)A=(T[Q-2]<<8)+T[Q-1],W.push(hT[A>>10]+hT[A>>4&63]+hT[A<<2&63]+"=");return W.join("")}function g6(T,A,Q,J,W){var $,G,Y=W*8-J-1,Z=(1<<Y)-1,C=Z>>1,K=-7,V=Q?W-1:0,M=Q?-1:1,z=T[A+V];V+=M,$=z&(1<<-K)-1,z>>=-K,K+=Y;for(;K>0;$=$*256+T[A+V],V+=M,K-=8);G=$&(1<<-K)-1,$>>=-K,K+=J;for(;K>0;G=G*256+T[A+V],V+=M,K-=8);if($===0)$=1-C;else if($===Z)return G?NaN:(z?-1:1)*(1/0);else G=G+Math.pow(2,J),$=$-C;return(z?-1:1)*G*Math.pow(2,$-J)}function XZ(T,A,Q,J,W,$){var G,Y,Z,C=$*8-W-1,K=(1<<C)-1,V=K>>1,M=W===23?Math.pow(2,-24)-Math.pow(2,-77):0,z=J?0:$-1,N=J?1:-1,w=A<0||A===0&&1/A<0?1:0;if(A=Math.abs(A),isNaN(A)||A===1/0)Y=isNaN(A)?1:0,G=K;else{if(G=Math.floor(Math.log(A)/Math.LN2),A*(Z=Math.pow(2,-G))<1)G--,Z*=2;if(G+V>=1)A+=M/Z;else A+=M*Math.pow(2,1-V);if(A*Z>=2)G++,Z/=2;if(G+V>=K)Y=0,G=K;else if(G+V>=1)Y=(A*Z-1)*Math.pow(2,W),G=G+V;else Y=A*Math.pow(2,V-1)*Math.pow(2,W),G=0}for(;W>=8;T[Q+z]=Y&255,z+=N,Y/=256,W-=8);G=G<<W|Y,C+=W;for(;C>0;T[Q+z]=G&255,z+=N,G/=256,C-=8);T[Q+z-N]|=w*128}function oT(T){if(T>q2)throw RangeError('The value "'+T+'" is invalid for option "size"');let A=new Uint8Array(T);return Object.setPrototypeOf(A,E.prototype),A}function yJ(T,A,Q){return class extends Q{constructor(){super();Object.defineProperty(this,"message",{value:A.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${T}]`,this.stack,delete this.name}get code(){return T}set code(W){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:W,writable:!0})}toString(){return`${this.name} [${T}]: ${this.message}`}}}function E(T,A,Q){if(typeof T==="number"){if(typeof A==="string")throw TypeError('The "string" argument must be of type string. Received type number');return bJ(T)}return KZ(T,A,Q)}function KZ(T,A,Q){if(typeof T==="string")return X5(T,A);if(ArrayBuffer.isView(T))return P5(T);if(T==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T);if(gT(T,ArrayBuffer)||T&&gT(T.buffer,ArrayBuffer))return mJ(T,A,Q);if(typeof SharedArrayBuffer<"u"&&(gT(T,SharedArrayBuffer)||T&&gT(T.buffer,SharedArrayBuffer)))return mJ(T,A,Q);if(typeof T==="number")throw TypeError('The "value" argument must not be of type number. Received type number');let J=T.valueOf&&T.valueOf();if(J!=null&&J!==T)return E.from(J,A,Q);let W=q5(T);if(W)return W;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof T[Symbol.toPrimitive]==="function")return E.from(T[Symbol.toPrimitive]("string"),A,Q);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T)}function CZ(T){if(typeof T!=="number")throw TypeError('"size" argument must be of type number');else if(T<0)throw RangeError('The value "'+T+'" is invalid for option "size"')}function Z5(T,A,Q){if(CZ(T),T<=0)return oT(T);if(A!==void 0)return typeof Q==="string"?oT(T).fill(A,Q):oT(T).fill(A);return oT(T)}function bJ(T){return CZ(T),oT(T<0?0:pJ(T)|0)}function X5(T,A){if(typeof A!=="string"||A==="")A="utf8";if(!E.isEncoding(A))throw TypeError("Unknown encoding: "+A);let Q=HZ(T,A)|0,J=oT(Q),W=J.write(T,A);if(W!==Q)J=J.slice(0,W);return J}function gJ(T){let A=T.length<0?0:pJ(T.length)|0,Q=oT(A);for(let J=0;J<A;J+=1)Q[J]=T[J]&255;return Q}function P5(T){if(gT(T,Uint8Array)){let A=new Uint8Array(T);return mJ(A.buffer,A.byteOffset,A.byteLength)}return gJ(T)}function mJ(T,A,Q){if(A<0||T.byteLength<A)throw RangeError('"offset" is outside of buffer bounds');if(T.byteLength<A+(Q||0))throw RangeError('"length" is outside of buffer bounds');let J;if(A===void 0&&Q===void 0)J=new Uint8Array(T);else if(Q===void 0)J=new Uint8Array(T,A);else J=new Uint8Array(T,A,Q);return Object.setPrototypeOf(J,E.prototype),J}function q5(T){if(E.isBuffer(T)){let A=pJ(T.length)|0,Q=oT(A);if(Q.length===0)return Q;return T.copy(Q,0,0,A),Q}if(T.length!==void 0){if(typeof T.length!=="number"||Number.isNaN(T.length))return oT(0);return gJ(T)}if(T.type==="Buffer"&&Array.isArray(T.data))return gJ(T.data)}function pJ(T){if(T>=q2)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+q2.toString(16)+" bytes");return T|0}function HZ(T,A){if(E.isBuffer(T))return T.length;if(ArrayBuffer.isView(T)||gT(T,ArrayBuffer))return T.byteLength;if(typeof T!=="string")throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof T);let Q=T.length,J=arguments.length>2&&arguments[2]===!0;if(!J&&Q===0)return 0;let W=!1;for(;;)switch(A){case"ascii":case"latin1":case"binary":return Q;case"utf8":case"utf-8":return vJ(T).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Q*2;case"hex":return Q>>>1;case"base64":return NZ(T).length;default:if(W)return J?-1:vJ(T).length;A=(""+A).toLowerCase(),W=!0}}function K5(T,A,Q){let J=!1;if(A===void 0||A<0)A=0;if(A>this.length)return"";if(Q===void 0||Q>this.length)Q=this.length;if(Q<=0)return"";if(Q>>>=0,A>>>=0,Q<=A)return"";if(!T)T="utf8";while(!0)switch(T){case"hex":return F5(this,A,Q);case"utf8":case"utf-8":return jZ(this,A,Q);case"ascii":return k5(this,A,Q);case"latin1":case"binary":return z5(this,A,Q);case"base64":return D5(this,A,Q);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N5(this,A,Q);default:if(J)throw TypeError("Unknown encoding: "+T);T=(T+"").toLowerCase(),J=!0}}function a8(T,A,Q){let J=T[A];T[A]=T[Q],T[Q]=J}function VZ(T,A,Q,J,W){if(T.length===0)return-1;if(typeof Q==="string")J=Q,Q=0;else if(Q>2147483647)Q=2147483647;else if(Q<-2147483648)Q=-2147483648;if(Q=+Q,Number.isNaN(Q))Q=W?0:T.length-1;if(Q<0)Q=T.length+Q;if(Q>=T.length)if(W)return-1;else Q=T.length-1;else if(Q<0)if(W)Q=0;else return-1;if(typeof A==="string")A=E.from(A,J);if(E.isBuffer(A)){if(A.length===0)return-1;return UZ(T,A,Q,J,W)}else if(typeof A==="number"){if(A=A&255,typeof Uint8Array.prototype.indexOf==="function")if(W)return Uint8Array.prototype.indexOf.call(T,A,Q);else return Uint8Array.prototype.lastIndexOf.call(T,A,Q);return UZ(T,[A],Q,J,W)}throw TypeError("val must be string, number or Buffer")}function UZ(T,A,Q,J,W){let $=1,G=T.length,Y=A.length;if(J!==void 0){if(J=String(J).toLowerCase(),J==="ucs2"||J==="ucs-2"||J==="utf16le"||J==="utf-16le"){if(T.length<2||A.length<2)return-1;$=2,G/=2,Y/=2,Q/=2}}function Z(K,V){if($===1)return K[V];else return K.readUInt16BE(V*$)}let C;if(W){let K=-1;for(C=Q;C<G;C++)if(Z(T,C)===Z(A,K===-1?0:C-K)){if(K===-1)K=C;if(C-K+1===Y)return K*$}else{if(K!==-1)C-=C-K;K=-1}}else{if(Q+Y>G)Q=G-Y;for(C=Q;C>=0;C--){let K=!0;for(let V=0;V<Y;V++)if(Z(T,C+V)!==Z(A,V)){K=!1;break}if(K)return C}}return-1}function C5(T,A,Q,J){Q=Number(Q)||0;let W=T.length-Q;if(!J)J=W;else if(J=Number(J),J>W)J=W;let $=A.length;if(J>$/2)J=$/2;let G;for(G=0;G<J;++G){let Y=parseInt(A.substr(G*2,2),16);if(Number.isNaN(Y))return G;T[Q+G]=Y}return G}function H5(T,A,Q,J){return m6(vJ(A,T.length-Q),T,Q,J)}function V5(T,A,Q,J){return m6(w5(A),T,Q,J)}function j5(T,A,Q,J){return m6(NZ(A),T,Q,J)}function R5(T,A,Q,J){return m6(E5(A,T.length-Q),T,Q,J)}function D5(T,A,Q){if(A===0&&Q===T.length)return $Z(T);else return $Z(T.slice(A,Q))}function jZ(T,A,Q){Q=Math.min(T.length,Q);let J=[],W=A;while(W<Q){let $=T[W],G=null,Y=$>239?4:$>223?3:$>191?2:1;if(W+Y<=Q){let Z,C,K,V;switch(Y){case 1:if($<128)G=$;break;case 2:if(Z=T[W+1],(Z&192)===128){if(V=($&31)<<6|Z&63,V>127)G=V}break;case 3:if(Z=T[W+1],C=T[W+2],(Z&192)===128&&(C&192)===128){if(V=($&15)<<12|(Z&63)<<6|C&63,V>2047&&(V<55296||V>57343))G=V}break;case 4:if(Z=T[W+1],C=T[W+2],K=T[W+3],(Z&192)===128&&(C&192)===128&&(K&192)===128){if(V=($&15)<<18|(Z&63)<<12|(C&63)<<6|K&63,V>65535&&V<1114112)G=V}}}if(G===null)G=65533,Y=1;else if(G>65535)G-=65536,J.push(G>>>10&1023|55296),G=56320|G&1023;J.push(G),W+=Y}return M5(J)}function M5(T){let A=T.length;if(A<=YZ)return String.fromCharCode.apply(String,T);let Q="",J=0;while(J<A)Q+=String.fromCharCode.apply(String,T.slice(J,J+=YZ));return Q}function k5(T,A,Q){let J="";Q=Math.min(T.length,Q);for(let W=A;W<Q;++W)J+=String.fromCharCode(T[W]&127);return J}function z5(T,A,Q){let J="";Q=Math.min(T.length,Q);for(let W=A;W<Q;++W)J+=String.fromCharCode(T[W]);return J}function F5(T,A,Q){let J=T.length;if(!A||A<0)A=0;if(!Q||Q<0||Q>J)Q=J;let W="";for(let $=A;$<Q;++$)W+=O5[T[$]];return W}function N5(T,A,Q){let J=T.slice(A,Q),W="";for(let $=0;$<J.length-1;$+=2)W+=String.fromCharCode(J[$]+J[$+1]*256);return W}function z0(T,A,Q){if(T%1!==0||T<0)throw RangeError("offset is not uint");if(T+A>Q)throw RangeError("Trying to access beyond buffer length")}function a0(T,A,Q,J,W,$){if(!E.isBuffer(T))throw TypeError('"buffer" argument must be a Buffer instance');if(A>W||A<$)throw RangeError('"value" argument is out of bounds');if(Q+J>T.length)throw RangeError("Index out of range")}function RZ(T,A,Q,J,W){FZ(A,J,W,T,Q,7);let $=Number(A&BigInt(4294967295));T[Q++]=$,$=$>>8,T[Q++]=$,$=$>>8,T[Q++]=$,$=$>>8,T[Q++]=$;let G=Number(A>>BigInt(32)&BigInt(4294967295));return T[Q++]=G,G=G>>8,T[Q++]=G,G=G>>8,T[Q++]=G,G=G>>8,T[Q++]=G,Q}function DZ(T,A,Q,J,W){FZ(A,J,W,T,Q,7);let $=Number(A&BigInt(4294967295));T[Q+7]=$,$=$>>8,T[Q+6]=$,$=$>>8,T[Q+5]=$,$=$>>8,T[Q+4]=$;let G=Number(A>>BigInt(32)&BigInt(4294967295));return T[Q+3]=G,G=G>>8,T[Q+2]=G,G=G>>8,T[Q+1]=G,G=G>>8,T[Q]=G,Q+8}function MZ(T,A,Q,J,W,$){if(Q+J>T.length)throw RangeError("Index out of range");if(Q<0)throw RangeError("Index out of range")}function kZ(T,A,Q,J,W){if(A=+A,Q=Q>>>0,!W)MZ(T,A,Q,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return XZ(T,A,Q,J,23,4),Q+4}function zZ(T,A,Q,J,W){if(A=+A,Q=Q>>>0,!W)MZ(T,A,Q,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return XZ(T,A,Q,J,52,8),Q+8}function ZZ(T){let A="",Q=T.length,J=T[0]==="-"?1:0;for(;Q>=J+4;Q-=3)A=`_${T.slice(Q-3,Q)}${A}`;return`${T.slice(0,Q)}${A}`}function I5(T,A,Q){if(SA(A,"offset"),T[A]===void 0||T[A+Q]===void 0)K2(A,T.length-(Q+1))}function FZ(T,A,Q,J,W,$){if(T>Q||T<A){let G=typeof A==="bigint"?"n":"",Y;if($>3)if(A===0||A===BigInt(0))Y=`>= 0${G} and < 2${G} ** ${($+1)*8}${G}`;else Y=`>= -(2${G} ** ${($+1)*8-1}${G}) and < 2 ** ${($+1)*8-1}${G}`;else Y=`>= ${A}${G} and <= ${Q}${G}`;throw new hJ("value",Y,T)}I5(J,W,$)}function SA(T,A){if(typeof T!=="number")throw new Y5(A,"number",T)}function K2(T,A,Q){if(Math.floor(T)!==T)throw SA(T,Q),new hJ(Q||"offset","an integer",T);if(A<0)throw new U5;throw new hJ(Q||"offset",`>= ${Q?1:0} and <= ${A}`,T)}function L5(T){if(T=T.split("=")[0],T=T.trim().replace(S5,""),T.length<2)return"";while(T.length%4!==0)T=T+"=";return T}function vJ(T,A){A=A||1/0;let Q,J=T.length,W=null,$=[];for(let G=0;G<J;++G){if(Q=T.charCodeAt(G),Q>55295&&Q<57344){if(!W){if(Q>56319){if((A-=3)>-1)$.push(239,191,189);continue}else if(G+1===J){if((A-=3)>-1)$.push(239,191,189);continue}W=Q;continue}if(Q<56320){if((A-=3)>-1)$.push(239,191,189);W=Q;continue}Q=(W-55296<<10|Q-56320)+65536}else if(W){if((A-=3)>-1)$.push(239,191,189)}if(W=null,Q<128){if((A-=1)<0)break;$.push(Q)}else if(Q<2048){if((A-=2)<0)break;$.push(Q>>6|192,Q&63|128)}else if(Q<65536){if((A-=3)<0)break;$.push(Q>>12|224,Q>>6&63|128,Q&63|128)}else if(Q<1114112){if((A-=4)<0)break;$.push(Q>>18|240,Q>>12&63|128,Q>>6&63|128,Q&63|128)}else throw Error("Invalid code point")}return $}function w5(T){let A=[];for(let Q=0;Q<T.length;++Q)A.push(T.charCodeAt(Q)&255);return A}function E5(T,A){let Q,J,W,$=[];for(let G=0;G<T.length;++G){if((A-=2)<0)break;Q=T.charCodeAt(G),J=Q>>8,W=Q%256,$.push(W),$.push(J)}return $}function NZ(T){return eV(L5(T))}function m6(T,A,Q,J){let W;for(W=0;W<J;++W){if(W+Q>=A.length||W>=T.length)break;A[W+Q]=T[W]}return W}function gT(T,A){return T instanceof A||T!=null&&T.constructor!=null&&T.constructor.name!=null&&T.constructor.name===A.name}function z8(T){return typeof BigInt>"u"?B5:T}function B5(){throw Error("BigInt not supported")}function lJ(T){return()=>{throw Error(T+" is not implemented for node:buffer browser polyfill")}}var hT,qT,xJ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o8,WZ,GZ,PZ=50,q2=2147483647,qZ=536870888,Q5,J5,W5,$5,G5,U5,Y5,hJ,YZ=4096,S5,O5,_5,x5,h5=(T)=>{for(let A of T)if(A.charCodeAt(0)>127)return!1;return!0},g5,m5;var LA=w0(()=>{hT=[],qT=[];for(o8=0,WZ=xJ.length;o8<WZ;++o8)hT[o8]=xJ[o8],qT[xJ.charCodeAt(o8)]=o8;qT[45]=62;qT[95]=63;GZ=typeof Symbol==="function"&&typeof Symbol.for==="function"?Symbol.for("nodejs.util.inspect.custom"):null,Q5=globalThis.btoa,J5=globalThis.atob,W5=globalThis.File,$5=globalThis.Blob,G5={MAX_LENGTH:q2,MAX_STRING_LENGTH:qZ};U5=yJ("ERR_BUFFER_OUT_OF_BOUNDS",function(T){if(T)return`${T} is outside of buffer bounds`;return"Attempt to access memory outside buffer bounds"},RangeError),Y5=yJ("ERR_INVALID_ARG_TYPE",function(T,A){return`The "${T}" argument must be of type number. Received type ${typeof A}`},TypeError),hJ=yJ("ERR_OUT_OF_RANGE",function(T,A,Q){let J=`The value of "${T}" is out of range.`,W=Q;if(Number.isInteger(Q)&&Math.abs(Q)>4294967296)W=ZZ(String(Q));else if(typeof Q==="bigint"){if(W=String(Q),Q>BigInt(2)**BigInt(32)||Q<-(BigInt(2)**BigInt(32)))W=ZZ(W);W+="n"}return J+=` It must be ${A}. Received ${W}`,J},RangeError);Object.defineProperty(E.prototype,"parent",{enumerable:!0,get:function(){if(!E.isBuffer(this))return;return this.buffer}});Object.defineProperty(E.prototype,"offset",{enumerable:!0,get:function(){if(!E.isBuffer(this))return;return this.byteOffset}});E.poolSize=8192;E.from=function(T,A,Q){return KZ(T,A,Q)};Object.setPrototypeOf(E.prototype,Uint8Array.prototype);Object.setPrototypeOf(E,Uint8Array);E.alloc=function(T,A,Q){return Z5(T,A,Q)};E.allocUnsafe=function(T){return bJ(T)};E.allocUnsafeSlow=function(T){return bJ(T)};E.isBuffer=function(A){return A!=null&&A._isBuffer===!0&&A!==E.prototype};E.compare=function(A,Q){if(gT(A,Uint8Array))A=E.from(A,A.offset,A.byteLength);if(gT(Q,Uint8Array))Q=E.from(Q,Q.offset,Q.byteLength);if(!E.isBuffer(A)||!E.isBuffer(Q))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(A===Q)return 0;let J=A.length,W=Q.length;for(let $=0,G=Math.min(J,W);$<G;++$)if(A[$]!==Q[$]){J=A[$],W=Q[$];break}if(J<W)return-1;if(W<J)return 1;return 0};E.isEncoding=function(A){switch(String(A).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};E.concat=function(A,Q){if(!Array.isArray(A))throw TypeError('"list" argument must be an Array of Buffers');if(A.length===0)return E.alloc(0);let J;if(Q===void 0){Q=0;for(J=0;J<A.length;++J)Q+=A[J].length}let W=E.allocUnsafe(Q),$=0;for(J=0;J<A.length;++J){let G=A[J];if(gT(G,Uint8Array))if($+G.length>W.length){if(!E.isBuffer(G))G=E.from(G);G.copy(W,$)}else Uint8Array.prototype.set.call(W,G,$);else if(!E.isBuffer(G))throw TypeError('"list" argument must be an Array of Buffers');else G.copy(W,$);$+=G.length}return W};E.byteLength=HZ;E.prototype._isBuffer=!0;E.prototype.swap16=function(){let A=this.length;if(A%2!==0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let Q=0;Q<A;Q+=2)a8(this,Q,Q+1);return this};E.prototype.swap32=function(){let A=this.length;if(A%4!==0)throw RangeError("Buffer size must be a multiple of 32-bits");for(let Q=0;Q<A;Q+=4)a8(this,Q,Q+3),a8(this,Q+1,Q+2);return this};E.prototype.swap64=function(){let A=this.length;if(A%8!==0)throw RangeError("Buffer size must be a multiple of 64-bits");for(let Q=0;Q<A;Q+=8)a8(this,Q,Q+7),a8(this,Q+1,Q+6),a8(this,Q+2,Q+5),a8(this,Q+3,Q+4);return this};E.prototype.toString=function(){let A=this.length;if(A===0)return"";if(arguments.length===0)return jZ(this,0,A);return K5.apply(this,arguments)};E.prototype.toLocaleString=E.prototype.toString;E.prototype.equals=function(A){if(!E.isBuffer(A))throw TypeError("Argument must be a Buffer");if(this===A)return!0;return E.compare(this,A)===0};E.prototype.inspect=function(){let A="",Q=PZ;if(A=this.toString("hex",0,Q).replace(/(.{2})/g,"$1 ").trim(),this.length>Q)A+=" ... ";return"<Buffer "+A+">"};if(GZ)E.prototype[GZ]=E.prototype.inspect;E.prototype.compare=function(A,Q,J,W,$){if(gT(A,Uint8Array))A=E.from(A,A.offset,A.byteLength);if(!E.isBuffer(A))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof A);if(Q===void 0)Q=0;if(J===void 0)J=A?A.length:0;if(W===void 0)W=0;if($===void 0)$=this.length;if(Q<0||J>A.length||W<0||$>this.length)throw RangeError("out of range index");if(W>=$&&Q>=J)return 0;if(W>=$)return-1;if(Q>=J)return 1;if(Q>>>=0,J>>>=0,W>>>=0,$>>>=0,this===A)return 0;let G=$-W,Y=J-Q,Z=Math.min(G,Y),C=this.slice(W,$),K=A.slice(Q,J);for(let V=0;V<Z;++V)if(C[V]!==K[V]){G=C[V],Y=K[V];break}if(G<Y)return-1;if(Y<G)return 1;return 0};E.prototype.includes=function(A,Q,J){return this.indexOf(A,Q,J)!==-1};E.prototype.indexOf=function(A,Q,J){return VZ(this,A,Q,J,!0)};E.prototype.lastIndexOf=function(A,Q,J){return VZ(this,A,Q,J,!1)};E.prototype.write=function(A,Q,J,W){if(Q===void 0)W="utf8",J=this.length,Q=0;else if(J===void 0&&typeof Q==="string")W=Q,J=this.length,Q=0;else if(isFinite(Q))if(Q=Q>>>0,isFinite(J)){if(J=J>>>0,W===void 0)W="utf8"}else W=J,J=void 0;else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let $=this.length-Q;if(J===void 0||J>$)J=$;if(A.length>0&&(J<0||Q<0)||Q>this.length)throw RangeError("Attempt to write outside buffer bounds");if(!W)W="utf8";let G=!1;for(;;)switch(W){case"hex":return C5(this,A,Q,J);case"utf8":case"utf-8":return H5(this,A,Q,J);case"ascii":case"latin1":case"binary":return V5(this,A,Q,J);case"base64":return j5(this,A,Q,J);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R5(this,A,Q,J);default:if(G)throw TypeError("Unknown encoding: "+W);W=(""+W).toLowerCase(),G=!0}};E.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};E.prototype.slice=function(A,Q){let J=this.length;if(A=~~A,Q=Q===void 0?J:~~Q,A<0){if(A+=J,A<0)A=0}else if(A>J)A=J;if(Q<0){if(Q+=J,Q<0)Q=0}else if(Q>J)Q=J;if(Q<A)Q=A;let W=this.subarray(A,Q);return Object.setPrototypeOf(W,E.prototype),W};E.prototype.readUintLE=E.prototype.readUIntLE=function(A,Q,J){if(A=A>>>0,Q=Q>>>0,!J)z0(A,Q,this.length);let W=this[A],$=1,G=0;while(++G<Q&&($*=256))W+=this[A+G]*$;return W};E.prototype.readUintBE=E.prototype.readUIntBE=function(A,Q,J){if(A=A>>>0,Q=Q>>>0,!J)z0(A,Q,this.length);let W=this[A+--Q],$=1;while(Q>0&&($*=256))W+=this[A+--Q]*$;return W};E.prototype.readUint8=E.prototype.readUInt8=function(A,Q){if(A=A>>>0,!Q)z0(A,1,this.length);return this[A]};E.prototype.readUint16LE=E.prototype.readUInt16LE=function(A,Q){if(A=A>>>0,!Q)z0(A,2,this.length);return this[A]|this[A+1]<<8};E.prototype.readUint16BE=E.prototype.readUInt16BE=function(A,Q){if(A=A>>>0,!Q)z0(A,2,this.length);return this[A]<<8|this[A+1]};E.prototype.readUint32LE=E.prototype.readUInt32LE=function(A,Q){if(A=A>>>0,!Q)z0(A,4,this.length);return(this[A]|this[A+1]<<8|this[A+2]<<16)+this[A+3]*16777216};E.prototype.readUint32BE=E.prototype.readUInt32BE=function(A,Q){if(A=A>>>0,!Q)z0(A,4,this.length);return this[A]*16777216+(this[A+1]<<16|this[A+2]<<8|this[A+3])};E.prototype.readBigUInt64LE=z8(function(A){A=A>>>0,SA(A,"offset");let Q=this[A],J=this[A+7];if(Q===void 0||J===void 0)K2(A,this.length-8);let W=Q+this[++A]*256+this[++A]*65536+this[++A]*16777216,$=this[++A]+this[++A]*256+this[++A]*65536+J*16777216;return BigInt(W)+(BigInt($)<<BigInt(32))});E.prototype.readBigUInt64BE=z8(function(A){A=A>>>0,SA(A,"offset");let Q=this[A],J=this[A+7];if(Q===void 0||J===void 0)K2(A,this.length-8);let W=Q*16777216+this[++A]*65536+this[++A]*256+this[++A],$=this[++A]*16777216+this[++A]*65536+this[++A]*256+J;return(BigInt(W)<<BigInt(32))+BigInt($)});E.prototype.readIntLE=function(A,Q,J){if(A=A>>>0,Q=Q>>>0,!J)z0(A,Q,this.length);let W=this[A],$=1,G=0;while(++G<Q&&($*=256))W+=this[A+G]*$;if($*=128,W>=$)W-=Math.pow(2,8*Q);return W};E.prototype.readIntBE=function(A,Q,J){if(A=A>>>0,Q=Q>>>0,!J)z0(A,Q,this.length);let W=Q,$=1,G=this[A+--W];while(W>0&&($*=256))G+=this[A+--W]*$;if($*=128,G>=$)G-=Math.pow(2,8*Q);return G};E.prototype.readInt8=function(A,Q){if(A=A>>>0,!Q)z0(A,1,this.length);if(!(this[A]&128))return this[A];return(255-this[A]+1)*-1};E.prototype.readInt16LE=function(A,Q){if(A=A>>>0,!Q)z0(A,2,this.length);let J=this[A]|this[A+1]<<8;return J&32768?J|4294901760:J};E.prototype.readInt16BE=function(A,Q){if(A=A>>>0,!Q)z0(A,2,this.length);let J=this[A+1]|this[A]<<8;return J&32768?J|4294901760:J};E.prototype.readInt32LE=function(A,Q){if(A=A>>>0,!Q)z0(A,4,this.length);return this[A]|this[A+1]<<8|this[A+2]<<16|this[A+3]<<24};E.prototype.readInt32BE=function(A,Q){if(A=A>>>0,!Q)z0(A,4,this.length);return this[A]<<24|this[A+1]<<16|this[A+2]<<8|this[A+3]};E.prototype.readBigInt64LE=z8(function(A){A=A>>>0,SA(A,"offset");let Q=this[A],J=this[A+7];if(Q===void 0||J===void 0)K2(A,this.length-8);let W=this[A+4]+this[A+5]*256+this[A+6]*65536+(J<<24);return(BigInt(W)<<BigInt(32))+BigInt(Q+this[++A]*256+this[++A]*65536+this[++A]*16777216)});E.prototype.readBigInt64BE=z8(function(A){A=A>>>0,SA(A,"offset");let Q=this[A],J=this[A+7];if(Q===void 0||J===void 0)K2(A,this.length-8);let W=(Q<<24)+this[++A]*65536+this[++A]*256+this[++A];return(BigInt(W)<<BigInt(32))+BigInt(this[++A]*16777216+this[++A]*65536+this[++A]*256+J)});E.prototype.readFloatLE=function(A,Q){if(A=A>>>0,!Q)z0(A,4,this.length);return g6(this,A,!0,23,4)};E.prototype.readFloatBE=function(A,Q){if(A=A>>>0,!Q)z0(A,4,this.length);return g6(this,A,!1,23,4)};E.prototype.readDoubleLE=function(A,Q){if(A=A>>>0,!Q)z0(A,8,this.length);return g6(this,A,!0,52,8)};E.prototype.readDoubleBE=function(A,Q){if(A=A>>>0,!Q)z0(A,8,this.length);return g6(this,A,!1,52,8)};E.prototype.writeUintLE=E.prototype.writeUIntLE=function(A,Q,J,W){if(A=+A,Q=Q>>>0,J=J>>>0,!W){let Y=Math.pow(2,8*J)-1;a0(this,A,Q,J,Y,0)}let $=1,G=0;this[Q]=A&255;while(++G<J&&($*=256))this[Q+G]=A/$&255;return Q+J};E.prototype.writeUintBE=E.prototype.writeUIntBE=function(A,Q,J,W){if(A=+A,Q=Q>>>0,J=J>>>0,!W){let Y=Math.pow(2,8*J)-1;a0(this,A,Q,J,Y,0)}let $=J-1,G=1;this[Q+$]=A&255;while(--$>=0&&(G*=256))this[Q+$]=A/G&255;return Q+J};E.prototype.writeUint8=E.prototype.writeUInt8=function(A,Q,J){if(A=+A,Q=Q>>>0,!J)a0(this,A,Q,1,255,0);return this[Q]=A&255,Q+1};E.prototype.writeUint16LE=E.prototype.writeUInt16LE=function(A,Q,J){if(A=+A,Q=Q>>>0,!J)a0(this,A,Q,2,65535,0);return this[Q]=A&255,this[Q+1]=A>>>8,Q+2};E.prototype.writeUint16BE=E.prototype.writeUInt16BE=function(A,Q,J){if(A=+A,Q=Q>>>0,!J)a0(this,A,Q,2,65535,0);return this[Q]=A>>>8,this[Q+1]=A&255,Q+2};E.prototype.writeUint32LE=E.prototype.writeUInt32LE=function(A,Q,J){if(A=+A,Q=Q>>>0,!J)a0(this,A,Q,4,4294967295,0);return this[Q+3]=A>>>24,this[Q+2]=A>>>16,this[Q+1]=A>>>8,this[Q]=A&255,Q+4};E.prototype.writeUint32BE=E.prototype.writeUInt32BE=function(A,Q,J){if(A=+A,Q=Q>>>0,!J)a0(this,A,Q,4,4294967295,0);return this[Q]=A>>>24,this[Q+1]=A>>>16,this[Q+2]=A>>>8,this[Q+3]=A&255,Q+4};E.prototype.writeBigUInt64LE=z8(function(A,Q=0){return RZ(this,A,Q,BigInt(0),BigInt("0xffffffffffffffff"))});E.prototype.writeBigUInt64BE=z8(function(A,Q=0){return DZ(this,A,Q,BigInt(0),BigInt("0xffffffffffffffff"))});E.prototype.writeIntLE=function(A,Q,J,W){if(A=+A,Q=Q>>>0,!W){let Z=Math.pow(2,8*J-1);a0(this,A,Q,J,Z-1,-Z)}let $=0,G=1,Y=0;this[Q]=A&255;while(++$<J&&(G*=256)){if(A<0&&Y===0&&this[Q+$-1]!==0)Y=1;this[Q+$]=(A/G>>0)-Y&255}return Q+J};E.prototype.writeIntBE=function(A,Q,J,W){if(A=+A,Q=Q>>>0,!W){let Z=Math.pow(2,8*J-1);a0(this,A,Q,J,Z-1,-Z)}let $=J-1,G=1,Y=0;this[Q+$]=A&255;while(--$>=0&&(G*=256)){if(A<0&&Y===0&&this[Q+$+1]!==0)Y=1;this[Q+$]=(A/G>>0)-Y&255}return Q+J};E.prototype.writeInt8=function(A,Q,J){if(A=+A,Q=Q>>>0,!J)a0(this,A,Q,1,127,-128);if(A<0)A=255+A+1;return this[Q]=A&255,Q+1};E.prototype.writeInt16LE=function(A,Q,J){if(A=+A,Q=Q>>>0,!J)a0(this,A,Q,2,32767,-32768);return this[Q]=A&255,this[Q+1]=A>>>8,Q+2};E.prototype.writeInt16BE=function(A,Q,J){if(A=+A,Q=Q>>>0,!J)a0(this,A,Q,2,32767,-32768);return this[Q]=A>>>8,this[Q+1]=A&255,Q+2};E.prototype.writeInt32LE=function(A,Q,J){if(A=+A,Q=Q>>>0,!J)a0(this,A,Q,4,2147483647,-2147483648);return this[Q]=A&255,this[Q+1]=A>>>8,this[Q+2]=A>>>16,this[Q+3]=A>>>24,Q+4};E.prototype.writeInt32BE=function(A,Q,J){if(A=+A,Q=Q>>>0,!J)a0(this,A,Q,4,2147483647,-2147483648);if(A<0)A=4294967295+A+1;return this[Q]=A>>>24,this[Q+1]=A>>>16,this[Q+2]=A>>>8,this[Q+3]=A&255,Q+4};E.prototype.writeBigInt64LE=z8(function(A,Q=0){return RZ(this,A,Q,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});E.prototype.writeBigInt64BE=z8(function(A,Q=0){return DZ(this,A,Q,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});E.prototype.writeFloatLE=function(A,Q,J){return kZ(this,A,Q,!0,J)};E.prototype.writeFloatBE=function(A,Q,J){return kZ(this,A,Q,!1,J)};E.prototype.writeDoubleLE=function(A,Q,J){return zZ(this,A,Q,!0,J)};E.prototype.writeDoubleBE=function(A,Q,J){return zZ(this,A,Q,!1,J)};E.prototype.copy=function(A,Q,J,W){if(!E.isBuffer(A))throw TypeError("argument should be a Buffer");if(!J)J=0;if(!W&&W!==0)W=this.length;if(Q>=A.length)Q=A.length;if(!Q)Q=0;if(W>0&&W<J)W=J;if(W===J)return 0;if(A.length===0||this.length===0)return 0;if(Q<0)throw RangeError("targetStart out of bounds");if(J<0||J>=this.length)throw RangeError("Index out of range");if(W<0)throw RangeError("sourceEnd out of bounds");if(W>this.length)W=this.length;if(A.length-Q<W-J)W=A.length-Q+J;let $=W-J;if(this===A&&typeof Uint8Array.prototype.copyWithin==="function")this.copyWithin(Q,J,W);else Uint8Array.prototype.set.call(A,this.subarray(J,W),Q);return $};E.prototype.fill=function(A,Q,J,W){if(typeof A==="string"){if(typeof Q==="string")W=Q,Q=0,J=this.length;else if(typeof J==="string")W=J,J=this.length;if(W!==void 0&&typeof W!=="string")throw TypeError("encoding must be a string");if(typeof W==="string"&&!E.isEncoding(W))throw TypeError("Unknown encoding: "+W);if(A.length===1){let G=A.charCodeAt(0);if(W==="utf8"&&G<128||W==="latin1")A=G}}else if(typeof A==="number")A=A&255;else if(typeof A==="boolean")A=Number(A);if(Q<0||this.length<Q||this.length<J)throw RangeError("Out of range index");if(J<=Q)return this;if(Q=Q>>>0,J=J===void 0?this.length:J>>>0,!A)A=0;let $;if(typeof A==="number")for($=Q;$<J;++$)this[$]=A;else{let G=E.isBuffer(A)?A:E.from(A,W),Y=G.length;if(Y===0)throw TypeError('The value "'+A+'" is invalid for argument "value"');for($=0;$<J-Q;++$)this[$+Q]=G[$%Y]}return this};S5=/[^+/0-9A-Za-z-_]/g;O5=function(){let T=Array(256);for(let A=0;A<16;++A){let Q=A*16;for(let J=0;J<16;++J)T[Q+J]="0123456789abcdef"[A]+"0123456789abcdef"[J]}return T}();_5=lJ("resolveObjectURL"),x5=lJ("isUtf8"),g5=lJ("transcode"),m5=E});var KW=YT((CX,qW)=>{(function(T,A){function Q(R,U){if(!R)throw Error(U||"Assertion failed")}function J(R,U){R.super_=U;var X=function(){};X.prototype=U.prototype,R.prototype=new X,R.prototype.constructor=R}function W(R,U,X){if(W.isBN(R))return R;if(this.negative=0,this.words=null,this.length=0,this.red=null,R!==null){if(U==="le"||U==="be")X=U,U=10;this._init(R||0,U||10,X||"be")}}if(typeof T==="object")T.exports=W;else A.BN=W;W.BN=W,W.wordSize=26;var $;try{if(typeof window<"u"&&typeof window.Buffer<"u")$=window.Buffer;else $=(LA(),VA(v6)).Buffer}catch(R){}W.isBN=function(U){if(U instanceof W)return!0;return U!==null&&typeof U==="object"&&U.constructor.wordSize===W.wordSize&&Array.isArray(U.words)},W.max=function(U,X){if(U.cmp(X)>0)return U;return X},W.min=function(U,X){if(U.cmp(X)<0)return U;return X},W.prototype._init=function(U,X,q){if(typeof U==="number")return this._initNumber(U,X,q);if(typeof U==="object")return this._initArray(U,X,q);if(X==="hex")X=16;Q(X===(X|0)&&X>=2&&X<=36),U=U.toString().replace(/\s+/g,"");var H=0;if(U[0]==="-")H++,this.negative=1;if(H<U.length){if(X===16)this._parseHex(U,H,q);else if(this._parseBase(U,X,H),q==="le")this._initArray(this.toArray(),X,q)}},W.prototype._initNumber=function(U,X,q){if(U<0)this.negative=1,U=-U;if(U<67108864)this.words=[U&67108863],this.length=1;else if(U<4503599627370496)this.words=[U&67108863,U/67108864&67108863],this.length=2;else Q(U<9007199254740992),this.words=[U&67108863,U/67108864&67108863,1],this.length=3;if(q!=="le")return;this._initArray(this.toArray(),X,q)},W.prototype._initArray=function(U,X,q){if(Q(typeof U.length==="number"),U.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(U.length/3),this.words=Array(this.length);for(var H=0;H<this.length;H++)this.words[H]=0;var j,F,I=0;if(q==="be"){for(H=U.length-1,j=0;H>=0;H-=3)if(F=U[H]|U[H-1]<<8|U[H-2]<<16,this.words[j]|=F<<I&67108863,this.words[j+1]=F>>>26-I&67108863,I+=24,I>=26)I-=26,j++}else if(q==="le"){for(H=0,j=0;H<U.length;H+=3)if(F=U[H]|U[H+1]<<8|U[H+2]<<16,this.words[j]|=F<<I&67108863,this.words[j+1]=F>>>26-I&67108863,I+=24,I>=26)I-=26,j++}return this._strip()};function G(R,U){var X=R.charCodeAt(U);if(X>=48&&X<=57)return X-48;else if(X>=65&&X<=70)return X-55;else if(X>=97&&X<=102)return X-87;else Q(!1,"Invalid character in "+R)}function Y(R,U,X){var q=G(R,X);if(X-1>=U)q|=G(R,X-1)<<4;return q}W.prototype._parseHex=function(U,X,q){this.length=Math.ceil((U.length-X)/6),this.words=Array(this.length);for(var H=0;H<this.length;H++)this.words[H]=0;var j=0,F=0,I;if(q==="be")for(H=U.length-1;H>=X;H-=2)if(I=Y(U,X,H)<<j,this.words[F]|=I&67108863,j>=18)j-=18,F+=1,this.words[F]|=I>>>26;else j+=8;else{var D=U.length-X;for(H=D%2===0?X+1:X;H<U.length;H+=2)if(I=Y(U,X,H)<<j,this.words[F]|=I&67108863,j>=18)j-=18,F+=1,this.words[F]|=I>>>26;else j+=8}this._strip()};function Z(R,U,X,q){var H=0,j=0,F=Math.min(R.length,X);for(var I=U;I<F;I++){var D=R.charCodeAt(I)-48;if(H*=q,D>=49)j=D-49+10;else if(D>=17)j=D-17+10;else j=D;Q(D>=0&&j<q,"Invalid character"),H+=j}return H}W.prototype._parseBase=function(U,X,q){this.words=[0],this.length=1;for(var H=0,j=1;j<=67108863;j*=X)H++;H--,j=j/X|0;var F=U.length-q,I=F%H,D=Math.min(F,F-I)+q,P=0;for(var k=q;k<D;k+=H)if(P=Z(U,k,k+H,X),this.imuln(j),this.words[0]+P<67108864)this.words[0]+=P;else this._iaddn(P);if(I!==0){var b=1;P=Z(U,k,U.length,X);for(k=0;k<I;k++)b*=X;if(this.imuln(b),this.words[0]+P<67108864)this.words[0]+=P;else this._iaddn(P)}this._strip()},W.prototype.copy=function(U){U.words=Array(this.length);for(var X=0;X<this.length;X++)U.words[X]=this.words[X];U.length=this.length,U.negative=this.negative,U.red=this.red};function C(R,U){R.words=U.words,R.length=U.length,R.negative=U.negative,R.red=U.red}if(W.prototype._move=function(U){C(U,this)},W.prototype.clone=function(){var U=new W(null);return this.copy(U),U},W.prototype._expand=function(U){while(this.length<U)this.words[this.length++]=0;return this},W.prototype._strip=function(){while(this.length>1&&this.words[this.length-1]===0)this.length--;return this._normSign()},W.prototype._normSign=function(){if(this.length===1&&this.words[0]===0)this.negative=0;return this},typeof Symbol<"u"&&typeof Symbol.for==="function")try{W.prototype[Symbol.for("nodejs.util.inspect.custom")]=K}catch(R){W.prototype.inspect=K}else W.prototype.inspect=K;function K(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var V=["","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"],M=[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],z=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64000000,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,24300000,28629151,33554432,39135393,45435424,52521875,60466176];if(W.prototype.toString=function(U,X){U=U||10,X=X|0||1;var q;if(U===16||U==="hex"){q="";var H=0,j=0;for(var F=0;F<this.length;F++){var I=this.words[F],D=((I<<H|j)&16777215).toString(16);if(j=I>>>24-H&16777215,H+=2,H>=26)H-=26,F--;if(j!==0||F!==this.length-1)q=V[6-D.length]+D+q;else q=D+q}if(j!==0)q=j.toString(16)+q;while(q.length%X!==0)q="0"+q;if(this.negative!==0)q="-"+q;return q}if(U===(U|0)&&U>=2&&U<=36){var P=M[U],k=z[U];q="";var b=this.clone();b.negative=0;while(!b.isZero()){var n=b.modrn(k).toString(U);if(b=b.idivn(k),!b.isZero())q=V[P-n.length]+n+q;else q=n+q}if(this.isZero())q="0"+q;while(q.length%X!==0)q="0"+q;if(this.negative!==0)q="-"+q;return q}Q(!1,"Base should be between 2 and 36")},W.prototype.toNumber=function(){var U=this.words[0];if(this.length===2)U+=this.words[1]*67108864;else if(this.length===3&&this.words[2]===1)U+=4503599627370496+this.words[1]*67108864;else if(this.length>2)Q(!1,"Number can only safely store up to 53 bits");return this.negative!==0?-U:U},W.prototype.toJSON=function(){return this.toString(16,2)},$)W.prototype.toBuffer=function(U,X){return this.toArrayLike($,U,X)};W.prototype.toArray=function(U,X){return this.toArrayLike(Array,U,X)};var N=function(U,X){if(U.allocUnsafe)return U.allocUnsafe(X);return new U(X)};if(W.prototype.toArrayLike=function(U,X,q){this._strip();var H=this.byteLength(),j=q||Math.max(1,H);Q(H<=j,"byte array longer than desired length"),Q(j>0,"Requested array length <= 0");var F=N(U,j),I=X==="le"?"LE":"BE";return this["_toArrayLike"+I](F,H),F},W.prototype._toArrayLikeLE=function(U,X){var q=0,H=0;for(var j=0,F=0;j<this.length;j++){var I=this.words[j]<<F|H;if(U[q++]=I&255,q<U.length)U[q++]=I>>8&255;if(q<U.length)U[q++]=I>>16&255;if(F===6){if(q<U.length)U[q++]=I>>24&255;H=0,F=0}else H=I>>>24,F+=2}if(q<U.length){U[q++]=H;while(q<U.length)U[q++]=0}},W.prototype._toArrayLikeBE=function(U,X){var q=U.length-1,H=0;for(var j=0,F=0;j<this.length;j++){var I=this.words[j]<<F|H;if(U[q--]=I&255,q>=0)U[q--]=I>>8&255;if(q>=0)U[q--]=I>>16&255;if(F===6){if(q>=0)U[q--]=I>>24&255;H=0,F=0}else H=I>>>24,F+=2}if(q>=0){U[q--]=H;while(q>=0)U[q--]=0}},Math.clz32)W.prototype._countBits=function(U){return 32-Math.clz32(U)};else W.prototype._countBits=function(U){var X=U,q=0;if(X>=4096)q+=13,X>>>=13;if(X>=64)q+=7,X>>>=7;if(X>=8)q+=4,X>>>=4;if(X>=2)q+=2,X>>>=2;return q+X};W.prototype._zeroBits=function(U){if(U===0)return 26;var X=U,q=0;if((X&8191)===0)q+=13,X>>>=13;if((X&127)===0)q+=7,X>>>=7;if((X&15)===0)q+=4,X>>>=4;if((X&3)===0)q+=2,X>>>=2;if((X&1)===0)q++;return q},W.prototype.bitLength=function(){var U=this.words[this.length-1],X=this._countBits(U);return(this.length-1)*26+X};function w(R){var U=Array(R.bitLength());for(var X=0;X<U.length;X++){var q=X/26|0,H=X%26;U[X]=R.words[q]>>>H&1}return U}W.prototype.zeroBits=function(){if(this.isZero())return 0;var U=0;for(var X=0;X<this.length;X++){var q=this._zeroBits(this.words[X]);if(U+=q,q!==26)break}return U},W.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},W.prototype.toTwos=function(U){if(this.negative!==0)return this.abs().inotn(U).iaddn(1);return this.clone()},W.prototype.fromTwos=function(U){if(this.testn(U-1))return this.notn(U).iaddn(1).ineg();return this.clone()},W.prototype.isNeg=function(){return this.negative!==0},W.prototype.neg=function(){return this.clone().ineg()},W.prototype.ineg=function(){if(!this.isZero())this.negative^=1;return this},W.prototype.iuor=function(U){while(this.length<U.length)this.words[this.length++]=0;for(var X=0;X<U.length;X++)this.words[X]=this.words[X]|U.words[X];return this._strip()},W.prototype.ior=function(U){return Q((this.negative|U.negative)===0),this.iuor(U)},W.prototype.or=function(U){if(this.length>U.length)return this.clone().ior(U);return U.clone().ior(this)},W.prototype.uor=function(U){if(this.length>U.length)return this.clone().iuor(U);return U.clone().iuor(this)},W.prototype.iuand=function(U){var X;if(this.length>U.length)X=U;else X=this;for(var q=0;q<X.length;q++)this.words[q]=this.words[q]&U.words[q];return this.length=X.length,this._strip()},W.prototype.iand=function(U){return Q((this.negative|U.negative)===0),this.iuand(U)},W.prototype.and=function(U){if(this.length>U.length)return this.clone().iand(U);return U.clone().iand(this)},W.prototype.uand=function(U){if(this.length>U.length)return this.clone().iuand(U);return U.clone().iuand(this)},W.prototype.iuxor=function(U){var X,q;if(this.length>U.length)X=this,q=U;else X=U,q=this;for(var H=0;H<q.length;H++)this.words[H]=X.words[H]^q.words[H];if(this!==X)for(;H<X.length;H++)this.words[H]=X.words[H];return this.length=X.length,this._strip()},W.prototype.ixor=function(U){return Q((this.negative|U.negative)===0),this.iuxor(U)},W.prototype.xor=function(U){if(this.length>U.length)return this.clone().ixor(U);return U.clone().ixor(this)},W.prototype.uxor=function(U){if(this.length>U.length)return this.clone().iuxor(U);return U.clone().iuxor(this)},W.prototype.inotn=function(U){Q(typeof U==="number"&&U>=0);var X=Math.ceil(U/26)|0,q=U%26;if(this._expand(X),q>0)X--;for(var H=0;H<X;H++)this.words[H]=~this.words[H]&67108863;if(q>0)this.words[H]=~this.words[H]&67108863>>26-q;return this._strip()},W.prototype.notn=function(U){return this.clone().inotn(U)},W.prototype.setn=function(U,X){Q(typeof U==="number"&&U>=0);var q=U/26|0,H=U%26;if(this._expand(q+1),X)this.words[q]=this.words[q]|1<<H;else this.words[q]=this.words[q]&~(1<<H);return this._strip()},W.prototype.iadd=function(U){var X;if(this.negative!==0&&U.negative===0)return this.negative=0,X=this.isub(U),this.negative^=1,this._normSign();else if(this.negative===0&&U.negative!==0)return U.negative=0,X=this.isub(U),U.negative=1,X._normSign();var q,H;if(this.length>U.length)q=this,H=U;else q=U,H=this;var j=0;for(var F=0;F<H.length;F++)X=(q.words[F]|0)+(H.words[F]|0)+j,this.words[F]=X&67108863,j=X>>>26;for(;j!==0&&F<q.length;F++)X=(q.words[F]|0)+j,this.words[F]=X&67108863,j=X>>>26;if(this.length=q.length,j!==0)this.words[this.length]=j,this.length++;else if(q!==this)for(;F<q.length;F++)this.words[F]=q.words[F];return this},W.prototype.add=function(U){var X;if(U.negative!==0&&this.negative===0)return U.negative=0,X=this.sub(U),U.negative^=1,X;else if(U.negative===0&&this.negative!==0)return this.negative=0,X=U.sub(this),this.negative=1,X;if(this.length>U.length)return this.clone().iadd(U);return U.clone().iadd(this)},W.prototype.isub=function(U){if(U.negative!==0){U.negative=0;var X=this.iadd(U);return U.negative=1,X._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(U),this.negative=1,this._normSign();var q=this.cmp(U);if(q===0)return this.negative=0,this.length=1,this.words[0]=0,this;var H,j;if(q>0)H=this,j=U;else H=U,j=this;var F=0;for(var I=0;I<j.length;I++)X=(H.words[I]|0)-(j.words[I]|0)+F,F=X>>26,this.words[I]=X&67108863;for(;F!==0&&I<H.length;I++)X=(H.words[I]|0)+F,F=X>>26,this.words[I]=X&67108863;if(F===0&&I<H.length&&H!==this)for(;I<H.length;I++)this.words[I]=H.words[I];if(this.length=Math.max(this.length,I),H!==this)this.negative=1;return this._strip()},W.prototype.sub=function(U){return this.clone().isub(U)};function L(R,U,X){X.negative=U.negative^R.negative;var q=R.length+U.length|0;X.length=q,q=q-1|0;var H=R.words[0]|0,j=U.words[0]|0,F=H*j,I=F&67108863,D=F/67108864|0;X.words[0]=I;for(var P=1;P<q;P++){var k=D>>>26,b=D&67108863,n=Math.min(P,U.length-1);for(var f=Math.max(0,P-R.length+1);f<=n;f++){var T1=P-f|0;H=R.words[T1]|0,j=U.words[f]|0,F=H*j+b,k+=F/67108864|0,b=F&67108863}X.words[P]=b|0,D=k|0}if(D!==0)X.words[P]=D|0;else X.length--;return X._strip()}var O=function(U,X,q){var H=U.words,j=X.words,F=q.words,I=0,D,P,k,b=H[0]|0,n=b&8191,f=b>>>13,T1=H[1]|0,Q1=T1&8191,J1=T1>>>13,r0=H[2]|0,X1=r0&8191,C1=r0>>>13,sA=H[3]|0,w1=sA&8191,E1=sA>>>13,n$=H[4]|0,O1=n$&8191,B1=n$>>>13,i$=H[5]|0,_1=i$&8191,x1=i$>>>13,o$=H[6]|0,h1=o$&8191,g1=o$>>>13,a$=H[7]|0,m1=a$&8191,v1=a$>>>13,s$=H[8]|0,y1=s$&8191,b1=s$>>>13,t$=H[9]|0,p1=t$&8191,l1=t$>>>13,e$=j[0]|0,u1=e$&8191,d1=e$>>>13,TG=j[1]|0,c1=TG&8191,f1=TG>>>13,AG=j[2]|0,r1=AG&8191,n1=AG>>>13,QG=j[3]|0,i1=QG&8191,o1=QG>>>13,JG=j[4]|0,a1=JG&8191,s1=JG>>>13,WG=j[5]|0,t1=WG&8191,e1=WG>>>13,$G=j[6]|0,T0=$G&8191,A0=$G>>>13,GG=j[7]|0,Q0=GG&8191,J0=GG>>>13,UG=j[8]|0,W0=UG&8191,$0=UG>>>13,YG=j[9]|0,G0=YG&8191,U0=YG>>>13;q.negative=U.negative^X.negative,q.length=19,D=Math.imul(n,u1),P=Math.imul(n,d1),P=P+Math.imul(f,u1)|0,k=Math.imul(f,d1);var uQ=(I+D|0)+((P&8191)<<13)|0;I=(k+(P>>>13)|0)+(uQ>>>26)|0,uQ&=67108863,D=Math.imul(Q1,u1),P=Math.imul(Q1,d1),P=P+Math.imul(J1,u1)|0,k=Math.imul(J1,d1),D=D+Math.imul(n,c1)|0,P=P+Math.imul(n,f1)|0,P=P+Math.imul(f,c1)|0,k=k+Math.imul(f,f1)|0;var dQ=(I+D|0)+((P&8191)<<13)|0;I=(k+(P>>>13)|0)+(dQ>>>26)|0,dQ&=67108863,D=Math.imul(X1,u1),P=Math.imul(X1,d1),P=P+Math.imul(C1,u1)|0,k=Math.imul(C1,d1),D=D+Math.imul(Q1,c1)|0,P=P+Math.imul(Q1,f1)|0,P=P+Math.imul(J1,c1)|0,k=k+Math.imul(J1,f1)|0,D=D+Math.imul(n,r1)|0,P=P+Math.imul(n,n1)|0,P=P+Math.imul(f,r1)|0,k=k+Math.imul(f,n1)|0;var cQ=(I+D|0)+((P&8191)<<13)|0;I=(k+(P>>>13)|0)+(cQ>>>26)|0,cQ&=67108863,D=Math.imul(w1,u1),P=Math.imul(w1,d1),P=P+Math.imul(E1,u1)|0,k=Math.imul(E1,d1),D=D+Math.imul(X1,c1)|0,P=P+Math.imul(X1,f1)|0,P=P+Math.imul(C1,c1)|0,k=k+Math.imul(C1,f1)|0,D=D+Math.imul(Q1,r1)|0,P=P+Math.imul(Q1,n1)|0,P=P+Math.imul(J1,r1)|0,k=k+Math.imul(J1,n1)|0,D=D+Math.imul(n,i1)|0,P=P+Math.imul(n,o1)|0,P=P+Math.imul(f,i1)|0,k=k+Math.imul(f,o1)|0;var fQ=(I+D|0)+((P&8191)<<13)|0;I=(k+(P>>>13)|0)+(fQ>>>26)|0,fQ&=67108863,D=Math.imul(O1,u1),P=Math.imul(O1,d1),P=P+Math.imul(B1,u1)|0,k=Math.imul(B1,d1),D=D+Math.imul(w1,c1)|0,P=P+Math.imul(w1,f1)|0,P=P+Math.imul(E1,c1)|0,k=k+Math.imul(E1,f1)|0,D=D+Math.imul(X1,r1)|0,P=P+Math.imul(X1,n1)|0,P=P+Math.imul(C1,r1)|0,k=k+Math.imul(C1,n1)|0,D=D+Math.imul(Q1,i1)|0,P=P+Math.imul(Q1,o1)|0,P=P+Math.imul(J1,i1)|0,k=k+Math.imul(J1,o1)|0,D=D+Math.imul(n,a1)|0,P=P+Math.imul(n,s1)|0,P=P+Math.imul(f,a1)|0,k=k+Math.imul(f,s1)|0;var rQ=(I+D|0)+((P&8191)<<13)|0;I=(k+(P>>>13)|0)+(rQ>>>26)|0,rQ&=67108863,D=Math.imul(_1,u1),P=Math.imul(_1,d1),P=P+Math.imul(x1,u1)|0,k=Math.imul(x1,d1),D=D+Math.imul(O1,c1)|0,P=P+Math.imul(O1,f1)|0,P=P+Math.imul(B1,c1)|0,k=k+Math.imul(B1,f1)|0,D=D+Math.imul(w1,r1)|0,P=P+Math.imul(w1,n1)|0,P=P+Math.imul(E1,r1)|0,k=k+Math.imul(E1,n1)|0,D=D+Math.imul(X1,i1)|0,P=P+Math.imul(X1,o1)|0,P=P+Math.imul(C1,i1)|0,k=k+Math.imul(C1,o1)|0,D=D+Math.imul(Q1,a1)|0,P=P+Math.imul(Q1,s1)|0,P=P+Math.imul(J1,a1)|0,k=k+Math.imul(J1,s1)|0,D=D+Math.imul(n,t1)|0,P=P+Math.imul(n,e1)|0,P=P+Math.imul(f,t1)|0,k=k+Math.imul(f,e1)|0;var nQ=(I+D|0)+((P&8191)<<13)|0;I=(k+(P>>>13)|0)+(nQ>>>26)|0,nQ&=67108863,D=Math.imul(h1,u1),P=Math.imul(h1,d1),P=P+Math.imul(g1,u1)|0,k=Math.imul(g1,d1),D=D+Math.imul(_1,c1)|0,P=P+Math.imul(_1,f1)|0,P=P+Math.imul(x1,c1)|0,k=k+Math.imul(x1,f1)|0,D=D+Math.imul(O1,r1)|0,P=P+Math.imul(O1,n1)|0,P=P+Math.imul(B1,r1)|0,k=k+Math.imul(B1,n1)|0,D=D+Math.imul(w1,i1)|0,P=P+Math.imul(w1,o1)|0,P=P+Math.imul(E1,i1)|0,k=k+Math.imul(E1,o1)|0,D=D+Math.imul(X1,a1)|0,P=P+Math.imul(X1,s1)|0,P=P+Math.imul(C1,a1)|0,k=k+Math.imul(C1,s1)|0,D=D+Math.imul(Q1,t1)|0,P=P+Math.imul(Q1,e1)|0,P=P+Math.imul(J1,t1)|0,k=k+Math.imul(J1,e1)|0,D=D+Math.imul(n,T0)|0,P=P+Math.imul(n,A0)|0,P=P+Math.imul(f,T0)|0,k=k+Math.imul(f,A0)|0;var iQ=(I+D|0)+((P&8191)<<13)|0;I=(k+(P>>>13)|0)+(iQ>>>26)|0,iQ&=67108863,D=Math.imul(m1,u1),P=Math.imul(m1,d1),P=P+Math.imul(v1,u1)|0,k=Math.imul(v1,d1),D=D+Math.imul(h1,c1)|0,P=P+Math.imul(h1,f1)|0,P=P+Math.imul(g1,c1)|0,k=k+Math.imul(g1,f1)|0,D=D+Math.imul(_1,r1)|0,P=P+Math.imul(_1,n1)|0,P=P+Math.imul(x1,r1)|0,k=k+Math.imul(x1,n1)|0,D=D+Math.imul(O1,i1)|0,P=P+Math.imul(O1,o1)|0,P=P+Math.imul(B1,i1)|0,k=k+Math.imul(B1,o1)|0,D=D+Math.imul(w1,a1)|0,P=P+Math.imul(w1,s1)|0,P=P+Math.imul(E1,a1)|0,k=k+Math.imul(E1,s1)|0,D=D+Math.imul(X1,t1)|0,P=P+Math.imul(X1,e1)|0,P=P+Math.imul(C1,t1)|0,k=k+Math.imul(C1,e1)|0,D=D+Math.imul(Q1,T0)|0,P=P+Math.imul(Q1,A0)|0,P=P+Math.imul(J1,T0)|0,k=k+Math.imul(J1,A0)|0,D=D+Math.imul(n,Q0)|0,P=P+Math.imul(n,J0)|0,P=P+Math.imul(f,Q0)|0,k=k+Math.imul(f,J0)|0;var oQ=(I+D|0)+((P&8191)<<13)|0;I=(k+(P>>>13)|0)+(oQ>>>26)|0,oQ&=67108863,D=Math.imul(y1,u1),P=Math.imul(y1,d1),P=P+Math.imul(b1,u1)|0,k=Math.imul(b1,d1),D=D+Math.imul(m1,c1)|0,P=P+Math.imul(m1,f1)|0,P=P+Math.imul(v1,c1)|0,k=k+Math.imul(v1,f1)|0,D=D+Math.imul(h1,r1)|0,P=P+Math.imul(h1,n1)|0,P=P+Math.imul(g1,r1)|0,k=k+Math.imul(g1,n1)|0,D=D+Math.imul(_1,i1)|0,P=P+Math.imul(_1,o1)|0,P=P+Math.imul(x1,i1)|0,k=k+Math.imul(x1,o1)|0,D=D+Math.imul(O1,a1)|0,P=P+Math.imul(O1,s1)|0,P=P+Math.imul(B1,a1)|0,k=k+Math.imul(B1,s1)|0,D=D+Math.imul(w1,t1)|0,P=P+Math.imul(w1,e1)|0,P=P+Math.imul(E1,t1)|0,k=k+Math.imul(E1,e1)|0,D=D+Math.imul(X1,T0)|0,P=P+Math.imul(X1,A0)|0,P=P+Math.imul(C1,T0)|0,k=k+Math.imul(C1,A0)|0,D=D+Math.imul(Q1,Q0)|0,P=P+Math.imul(Q1,J0)|0,P=P+Math.imul(J1,Q0)|0,k=k+Math.imul(J1,J0)|0,D=D+Math.imul(n,W0)|0,P=P+Math.imul(n,$0)|0,P=P+Math.imul(f,W0)|0,k=k+Math.imul(f,$0)|0;var aQ=(I+D|0)+((P&8191)<<13)|0;I=(k+(P>>>13)|0)+(aQ>>>26)|0,aQ&=67108863,D=Math.imul(p1,u1),P=Math.imul(p1,d1),P=P+Math.imul(l1,u1)|0,k=Math.imul(l1,d1),D=D+Math.imul(y1,c1)|0,P=P+Math.imul(y1,f1)|0,P=P+Math.imul(b1,c1)|0,k=k+Math.imul(b1,f1)|0,D=D+Math.imul(m1,r1)|0,P=P+Math.imul(m1,n1)|0,P=P+Math.imul(v1,r1)|0,k=k+Math.imul(v1,n1)|0,D=D+Math.imul(h1,i1)|0,P=P+Math.imul(h1,o1)|0,P=P+Math.imul(g1,i1)|0,k=k+Math.imul(g1,o1)|0,D=D+Math.imul(_1,a1)|0,P=P+Math.imul(_1,s1)|0,P=P+Math.imul(x1,a1)|0,k=k+Math.imul(x1,s1)|0,D=D+Math.imul(O1,t1)|0,P=P+Math.imul(O1,e1)|0,P=P+Math.imul(B1,t1)|0,k=k+Math.imul(B1,e1)|0,D=D+Math.imul(w1,T0)|0,P=P+Math.imul(w1,A0)|0,P=P+Math.imul(E1,T0)|0,k=k+Math.imul(E1,A0)|0,D=D+Math.imul(X1,Q0)|0,P=P+Math.imul(X1,J0)|0,P=P+Math.imul(C1,Q0)|0,k=k+Math.imul(C1,J0)|0,D=D+Math.imul(Q1,W0)|0,P=P+Math.imul(Q1,$0)|0,P=P+Math.imul(J1,W0)|0,k=k+Math.imul(J1,$0)|0,D=D+Math.imul(n,G0)|0,P=P+Math.imul(n,U0)|0,P=P+Math.imul(f,G0)|0,k=k+Math.imul(f,U0)|0;var sQ=(I+D|0)+((P&8191)<<13)|0;I=(k+(P>>>13)|0)+(sQ>>>26)|0,sQ&=67108863,D=Math.imul(p1,c1),P=Math.imul(p1,f1),P=P+Math.imul(l1,c1)|0,k=Math.imul(l1,f1),D=D+Math.imul(y1,r1)|0,P=P+Math.imul(y1,n1)|0,P=P+Math.imul(b1,r1)|0,k=k+Math.imul(b1,n1)|0,D=D+Math.imul(m1,i1)|0,P=P+Math.imul(m1,o1)|0,P=P+Math.imul(v1,i1)|0,k=k+Math.imul(v1,o1)|0,D=D+Math.imul(h1,a1)|0,P=P+Math.imul(h1,s1)|0,P=P+Math.imul(g1,a1)|0,k=k+Math.imul(g1,s1)|0,D=D+Math.imul(_1,t1)|0,P=P+Math.imul(_1,e1)|0,P=P+Math.imul(x1,t1)|0,k=k+Math.imul(x1,e1)|0,D=D+Math.imul(O1,T0)|0,P=P+Math.imul(O1,A0)|0,P=P+Math.imul(B1,T0)|0,k=k+Math.imul(B1,A0)|0,D=D+Math.imul(w1,Q0)|0,P=P+Math.imul(w1,J0)|0,P=P+Math.imul(E1,Q0)|0,k=k+Math.imul(E1,J0)|0,D=D+Math.imul(X1,W0)|0,P=P+Math.imul(X1,$0)|0,P=P+Math.imul(C1,W0)|0,k=k+Math.imul(C1,$0)|0,D=D+Math.imul(Q1,G0)|0,P=P+Math.imul(Q1,U0)|0,P=P+Math.imul(J1,G0)|0,k=k+Math.imul(J1,U0)|0;var tQ=(I+D|0)+((P&8191)<<13)|0;I=(k+(P>>>13)|0)+(tQ>>>26)|0,tQ&=67108863,D=Math.imul(p1,r1),P=Math.imul(p1,n1),P=P+Math.imul(l1,r1)|0,k=Math.imul(l1,n1),D=D+Math.imul(y1,i1)|0,P=P+Math.imul(y1,o1)|0,P=P+Math.imul(b1,i1)|0,k=k+Math.imul(b1,o1)|0,D=D+Math.imul(m1,a1)|0,P=P+Math.imul(m1,s1)|0,P=P+Math.imul(v1,a1)|0,k=k+Math.imul(v1,s1)|0,D=D+Math.imul(h1,t1)|0,P=P+Math.imul(h1,e1)|0,P=P+Math.imul(g1,t1)|0,k=k+Math.imul(g1,e1)|0,D=D+Math.imul(_1,T0)|0,P=P+Math.imul(_1,A0)|0,P=P+Math.imul(x1,T0)|0,k=k+Math.imul(x1,A0)|0,D=D+Math.imul(O1,Q0)|0,P=P+Math.imul(O1,J0)|0,P=P+Math.imul(B1,Q0)|0,k=k+Math.imul(B1,J0)|0,D=D+Math.imul(w1,W0)|0,P=P+Math.imul(w1,$0)|0,P=P+Math.imul(E1,W0)|0,k=k+Math.imul(E1,$0)|0,D=D+Math.imul(X1,G0)|0,P=P+Math.imul(X1,U0)|0,P=P+Math.imul(C1,G0)|0,k=k+Math.imul(C1,U0)|0;var eQ=(I+D|0)+((P&8191)<<13)|0;I=(k+(P>>>13)|0)+(eQ>>>26)|0,eQ&=67108863,D=Math.imul(p1,i1),P=Math.imul(p1,o1),P=P+Math.imul(l1,i1)|0,k=Math.imul(l1,o1),D=D+Math.imul(y1,a1)|0,P=P+Math.imul(y1,s1)|0,P=P+Math.imul(b1,a1)|0,k=k+Math.imul(b1,s1)|0,D=D+Math.imul(m1,t1)|0,P=P+Math.imul(m1,e1)|0,P=P+Math.imul(v1,t1)|0,k=k+Math.imul(v1,e1)|0,D=D+Math.imul(h1,T0)|0,P=P+Math.imul(h1,A0)|0,P=P+Math.imul(g1,T0)|0,k=k+Math.imul(g1,A0)|0,D=D+Math.imul(_1,Q0)|0,P=P+Math.imul(_1,J0)|0,P=P+Math.imul(x1,Q0)|0,k=k+Math.imul(x1,J0)|0,D=D+Math.imul(O1,W0)|0,P=P+Math.imul(O1,$0)|0,P=P+Math.imul(B1,W0)|0,k=k+Math.imul(B1,$0)|0,D=D+Math.imul(w1,G0)|0,P=P+Math.imul(w1,U0)|0,P=P+Math.imul(E1,G0)|0,k=k+Math.imul(E1,U0)|0;var T4=(I+D|0)+((P&8191)<<13)|0;I=(k+(P>>>13)|0)+(T4>>>26)|0,T4&=67108863,D=Math.imul(p1,a1),P=Math.imul(p1,s1),P=P+Math.imul(l1,a1)|0,k=Math.imul(l1,s1),D=D+Math.imul(y1,t1)|0,P=P+Math.imul(y1,e1)|0,P=P+Math.imul(b1,t1)|0,k=k+Math.imul(b1,e1)|0,D=D+Math.imul(m1,T0)|0,P=P+Math.imul(m1,A0)|0,P=P+Math.imul(v1,T0)|0,k=k+Math.imul(v1,A0)|0,D=D+Math.imul(h1,Q0)|0,P=P+Math.imul(h1,J0)|0,P=P+Math.imul(g1,Q0)|0,k=k+Math.imul(g1,J0)|0,D=D+Math.imul(_1,W0)|0,P=P+Math.imul(_1,$0)|0,P=P+Math.imul(x1,W0)|0,k=k+Math.imul(x1,$0)|0,D=D+Math.imul(O1,G0)|0,P=P+Math.imul(O1,U0)|0,P=P+Math.imul(B1,G0)|0,k=k+Math.imul(B1,U0)|0;var A4=(I+D|0)+((P&8191)<<13)|0;I=(k+(P>>>13)|0)+(A4>>>26)|0,A4&=67108863,D=Math.imul(p1,t1),P=Math.imul(p1,e1),P=P+Math.imul(l1,t1)|0,k=Math.imul(l1,e1),D=D+Math.imul(y1,T0)|0,P=P+Math.imul(y1,A0)|0,P=P+Math.imul(b1,T0)|0,k=k+Math.imul(b1,A0)|0,D=D+Math.imul(m1,Q0)|0,P=P+Math.imul(m1,J0)|0,P=P+Math.imul(v1,Q0)|0,k=k+Math.imul(v1,J0)|0,D=D+Math.imul(h1,W0)|0,P=P+Math.imul(h1,$0)|0,P=P+Math.imul(g1,W0)|0,k=k+Math.imul(g1,$0)|0,D=D+Math.imul(_1,G0)|0,P=P+Math.imul(_1,U0)|0,P=P+Math.imul(x1,G0)|0,k=k+Math.imul(x1,U0)|0;var Q4=(I+D|0)+((P&8191)<<13)|0;I=(k+(P>>>13)|0)+(Q4>>>26)|0,Q4&=67108863,D=Math.imul(p1,T0),P=Math.imul(p1,A0),P=P+Math.imul(l1,T0)|0,k=Math.imul(l1,A0),D=D+Math.imul(y1,Q0)|0,P=P+Math.imul(y1,J0)|0,P=P+Math.imul(b1,Q0)|0,k=k+Math.imul(b1,J0)|0,D=D+Math.imul(m1,W0)|0,P=P+Math.imul(m1,$0)|0,P=P+Math.imul(v1,W0)|0,k=k+Math.imul(v1,$0)|0,D=D+Math.imul(h1,G0)|0,P=P+Math.imul(h1,U0)|0,P=P+Math.imul(g1,G0)|0,k=k+Math.imul(g1,U0)|0;var J4=(I+D|0)+((P&8191)<<13)|0;I=(k+(P>>>13)|0)+(J4>>>26)|0,J4&=67108863,D=Math.imul(p1,Q0),P=Math.imul(p1,J0),P=P+Math.imul(l1,Q0)|0,k=Math.imul(l1,J0),D=D+Math.imul(y1,W0)|0,P=P+Math.imul(y1,$0)|0,P=P+Math.imul(b1,W0)|0,k=k+Math.imul(b1,$0)|0,D=D+Math.imul(m1,G0)|0,P=P+Math.imul(m1,U0)|0,P=P+Math.imul(v1,G0)|0,k=k+Math.imul(v1,U0)|0;var W4=(I+D|0)+((P&8191)<<13)|0;I=(k+(P>>>13)|0)+(W4>>>26)|0,W4&=67108863,D=Math.imul(p1,W0),P=Math.imul(p1,$0),P=P+Math.imul(l1,W0)|0,k=Math.imul(l1,$0),D=D+Math.imul(y1,G0)|0,P=P+Math.imul(y1,U0)|0,P=P+Math.imul(b1,G0)|0,k=k+Math.imul(b1,U0)|0;var $4=(I+D|0)+((P&8191)<<13)|0;I=(k+(P>>>13)|0)+($4>>>26)|0,$4&=67108863,D=Math.imul(p1,G0),P=Math.imul(p1,U0),P=P+Math.imul(l1,G0)|0,k=Math.imul(l1,U0);var G4=(I+D|0)+((P&8191)<<13)|0;if(I=(k+(P>>>13)|0)+(G4>>>26)|0,G4&=67108863,F[0]=uQ,F[1]=dQ,F[2]=cQ,F[3]=fQ,F[4]=rQ,F[5]=nQ,F[6]=iQ,F[7]=oQ,F[8]=aQ,F[9]=sQ,F[10]=tQ,F[11]=eQ,F[12]=T4,F[13]=A4,F[14]=Q4,F[15]=J4,F[16]=W4,F[17]=$4,F[18]=G4,I!==0)F[19]=I,q.length++;return q};if(!Math.imul)O=L;function g(R,U,X){X.negative=U.negative^R.negative,X.length=R.length+U.length;var q=0,H=0;for(var j=0;j<X.length-1;j++){var F=H;H=0;var I=q&67108863,D=Math.min(j,U.length-1);for(var P=Math.max(0,j-R.length+1);P<=D;P++){var k=j-P,b=R.words[k]|0,n=U.words[P]|0,f=b*n,T1=f&67108863;F=F+(f/67108864|0)|0,T1=T1+I|0,I=T1&67108863,F=F+(T1>>>26)|0,H+=F>>>26,F&=67108863}X.words[j]=I,q=F,F=H}if(q!==0)X.words[j]=q;else X.length--;return X._strip()}function v(R,U,X){return g(R,U,X)}W.prototype.mulTo=function(U,X){var q,H=this.length+U.length;if(this.length===10&&U.length===10)q=O(this,U,X);else if(H<63)q=L(this,U,X);else if(H<1024)q=g(this,U,X);else q=v(this,U,X);return q};function p(R,U){this.x=R,this.y=U}p.prototype.makeRBT=function(U){var X=Array(U),q=W.prototype._countBits(U)-1;for(var H=0;H<U;H++)X[H]=this.revBin(H,q,U);return X},p.prototype.revBin=function(U,X,q){if(U===0||U===q-1)return U;var H=0;for(var j=0;j<X;j++)H|=(U&1)<<X-j-1,U>>=1;return H},p.prototype.permute=function(U,X,q,H,j,F){for(var I=0;I<F;I++)H[I]=X[U[I]],j[I]=q[U[I]]},p.prototype.transform=function(U,X,q,H,j,F){this.permute(F,U,X,q,H,j);for(var I=1;I<j;I<<=1){var D=I<<1,P=Math.cos(2*Math.PI/D),k=Math.sin(2*Math.PI/D);for(var b=0;b<j;b+=D){var n=P,f=k;for(var T1=0;T1<I;T1++){var Q1=q[b+T1],J1=H[b+T1],r0=q[b+T1+I],X1=H[b+T1+I],C1=n*r0-f*X1;if(X1=n*X1+f*r0,r0=C1,q[b+T1]=Q1+r0,H[b+T1]=J1+X1,q[b+T1+I]=Q1-r0,H[b+T1+I]=J1-X1,T1!==D)C1=P*n-k*f,f=P*f+k*n,n=C1}}}},p.prototype.guessLen13b=function(U,X){var q=Math.max(X,U)|1,H=q&1,j=0;for(q=q/2|0;q;q=q>>>1)j++;return 1<<j+1+H},p.prototype.conjugate=function(U,X,q){if(q<=1)return;for(var H=0;H<q/2;H++){var j=U[H];U[H]=U[q-H-1],U[q-H-1]=j,j=X[H],X[H]=-X[q-H-1],X[q-H-1]=-j}},p.prototype.normalize13b=function(U,X){var q=0;for(var H=0;H<X/2;H++){var j=Math.round(U[2*H+1]/X)*8192+Math.round(U[2*H]/X)+q;if(U[H]=j&67108863,j<67108864)q=0;else q=j/67108864|0}return U},p.prototype.convert13b=function(U,X,q,H){var j=0;for(var F=0;F<X;F++)j=j+(U[F]|0),q[2*F]=j&8191,j=j>>>13,q[2*F+1]=j&8191,j=j>>>13;for(F=2*X;F<H;++F)q[F]=0;Q(j===0),Q((j&-8192)===0)},p.prototype.stub=function(U){var X=Array(U);for(var q=0;q<U;q++)X[q]=0;return X},p.prototype.mulp=function(U,X,q){var H=2*this.guessLen13b(U.length,X.length),j=this.makeRBT(H),F=this.stub(H),I=Array(H),D=Array(H),P=Array(H),k=Array(H),b=Array(H),n=Array(H),f=q.words;f.length=H,this.convert13b(U.words,U.length,I,H),this.convert13b(X.words,X.length,k,H),this.transform(I,F,D,P,H,j),this.transform(k,F,b,n,H,j);for(var T1=0;T1<H;T1++){var Q1=D[T1]*b[T1]-P[T1]*n[T1];P[T1]=D[T1]*n[T1]+P[T1]*b[T1],D[T1]=Q1}return this.conjugate(D,P,H),this.transform(D,P,f,F,H,j),this.conjugate(f,F,H),this.normalize13b(f,H),q.negative=U.negative^X.negative,q.length=U.length+X.length,q._strip()},W.prototype.mul=function(U){var X=new W(null);return X.words=Array(this.length+U.length),this.mulTo(U,X)},W.prototype.mulf=function(U){var X=new W(null);return X.words=Array(this.length+U.length),v(this,U,X)},W.prototype.imul=function(U){return this.clone().mulTo(U,this)},W.prototype.imuln=function(U){var X=U<0;if(X)U=-U;Q(typeof U==="number"),Q(U<67108864);var q=0;for(var H=0;H<this.length;H++){var j=(this.words[H]|0)*U,F=(j&67108863)+(q&67108863);q>>=26,q+=j/67108864|0,q+=F>>>26,this.words[H]=F&67108863}if(q!==0)this.words[H]=q,this.length++;return this.length=U===0?1:this.length,X?this.ineg():this},W.prototype.muln=function(U){return this.clone().imuln(U)},W.prototype.sqr=function(){return this.mul(this)},W.prototype.isqr=function(){return this.imul(this.clone())},W.prototype.pow=function(U){var X=w(U);if(X.length===0)return new W(1);var q=this;for(var H=0;H<X.length;H++,q=q.sqr())if(X[H]!==0)break;if(++H<X.length)for(var j=q.sqr();H<X.length;H++,j=j.sqr()){if(X[H]===0)continue;q=q.mul(j)}return q},W.prototype.iushln=function(U){Q(typeof U==="number"&&U>=0);var X=U%26,q=(U-X)/26,H=67108863>>>26-X<<26-X,j;if(X!==0){var F=0;for(j=0;j<this.length;j++){var I=this.words[j]&H,D=(this.words[j]|0)-I<<X;this.words[j]=D|F,F=I>>>26-X}if(F)this.words[j]=F,this.length++}if(q!==0){for(j=this.length-1;j>=0;j--)this.words[j+q]=this.words[j];for(j=0;j<q;j++)this.words[j]=0;this.length+=q}return this._strip()},W.prototype.ishln=function(U){return Q(this.negative===0),this.iushln(U)},W.prototype.iushrn=function(U,X,q){Q(typeof U==="number"&&U>=0);var H;if(X)H=(X-X%26)/26;else H=0;var j=U%26,F=Math.min((U-j)/26,this.length),I=67108863^67108863>>>j<<j,D=q;if(H-=F,H=Math.max(0,H),D){for(var P=0;P<F;P++)D.words[P]=this.words[P];D.length=F}if(F===0);else if(this.length>F){this.length-=F;for(P=0;P<this.length;P++)this.words[P]=this.words[P+F]}else this.words[0]=0,this.length=1;var k=0;for(P=this.length-1;P>=0&&(k!==0||P>=H);P--){var b=this.words[P]|0;this.words[P]=k<<26-j|b>>>j,k=b&I}if(D&&k!==0)D.words[D.length++]=k;if(this.length===0)this.words[0]=0,this.length=1;return this._strip()},W.prototype.ishrn=function(U,X,q){return Q(this.negative===0),this.iushrn(U,X,q)},W.prototype.shln=function(U){return this.clone().ishln(U)},W.prototype.ushln=function(U){return this.clone().iushln(U)},W.prototype.shrn=function(U){return this.clone().ishrn(U)},W.prototype.ushrn=function(U){return this.clone().iushrn(U)},W.prototype.testn=function(U){Q(typeof U==="number"&&U>=0);var X=U%26,q=(U-X)/26,H=1<<X;if(this.length<=q)return!1;var j=this.words[q];return!!(j&H)},W.prototype.imaskn=function(U){Q(typeof U==="number"&&U>=0);var X=U%26,q=(U-X)/26;if(Q(this.negative===0,"imaskn works only with positive numbers"),this.length<=q)return this;if(X!==0)q++;if(this.length=Math.min(q,this.length),X!==0){var H=67108863^67108863>>>X<<X;this.words[this.length-1]&=H}return this._strip()},W.prototype.maskn=function(U){return this.clone().imaskn(U)},W.prototype.iaddn=function(U){if(Q(typeof U==="number"),Q(U<67108864),U<0)return this.isubn(-U);if(this.negative!==0){if(this.length===1&&(this.words[0]|0)<=U)return this.words[0]=U-(this.words[0]|0),this.negative=0,this;return this.negative=0,this.isubn(U),this.negative=1,this}return this._iaddn(U)},W.prototype._iaddn=function(U){this.words[0]+=U;for(var X=0;X<this.length&&this.words[X]>=67108864;X++)if(this.words[X]-=67108864,X===this.length-1)this.words[X+1]=1;else this.words[X+1]++;return this.length=Math.max(this.length,X+1),this},W.prototype.isubn=function(U){if(Q(typeof U==="number"),Q(U<67108864),U<0)return this.iaddn(-U);if(this.negative!==0)return this.negative=0,this.iaddn(U),this.negative=1,this;if(this.words[0]-=U,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var X=0;X<this.length&&this.words[X]<0;X++)this.words[X]+=67108864,this.words[X+1]-=1;return this._strip()},W.prototype.addn=function(U){return this.clone().iaddn(U)},W.prototype.subn=function(U){return this.clone().isubn(U)},W.prototype.iabs=function(){return this.negative=0,this},W.prototype.abs=function(){return this.clone().iabs()},W.prototype._ishlnsubmul=function(U,X,q){var H=U.length+q,j;this._expand(H);var F,I=0;for(j=0;j<U.length;j++){F=(this.words[j+q]|0)+I;var D=(U.words[j]|0)*X;F-=D&67108863,I=(F>>26)-(D/67108864|0),this.words[j+q]=F&67108863}for(;j<this.length-q;j++)F=(this.words[j+q]|0)+I,I=F>>26,this.words[j+q]=F&67108863;if(I===0)return this._strip();Q(I===-1),I=0;for(j=0;j<this.length;j++)F=-(this.words[j]|0)+I,I=F>>26,this.words[j]=F&67108863;return this.negative=1,this._strip()},W.prototype._wordDiv=function(U,X){var q=this.length-U.length,H=this.clone(),j=U,F=j.words[j.length-1]|0,I=this._countBits(F);if(q=26-I,q!==0)j=j.ushln(q),H.iushln(q),F=j.words[j.length-1]|0;var D=H.length-j.length,P;if(X!=="mod"){P=new W(null),P.length=D+1,P.words=Array(P.length);for(var k=0;k<P.length;k++)P.words[k]=0}var b=H.clone()._ishlnsubmul(j,1,D);if(b.negative===0){if(H=b,P)P.words[D]=1}for(var n=D-1;n>=0;n--){var f=(H.words[j.length+n]|0)*67108864+(H.words[j.length+n-1]|0);f=Math.min(f/F|0,67108863),H._ishlnsubmul(j,f,n);while(H.negative!==0)if(f--,H.negative=0,H._ishlnsubmul(j,1,n),!H.isZero())H.negative^=1;if(P)P.words[n]=f}if(P)P._strip();if(H._strip(),X!=="div"&&q!==0)H.iushrn(q);return{div:P||null,mod:H}},W.prototype.divmod=function(U,X,q){if(Q(!U.isZero()),this.isZero())return{div:new W(0),mod:new W(0)};var H,j,F;if(this.negative!==0&&U.negative===0){if(F=this.neg().divmod(U,X),X!=="mod")H=F.div.neg();if(X!=="div"){if(j=F.mod.neg(),q&&j.negative!==0)j.iadd(U)}return{div:H,mod:j}}if(this.negative===0&&U.negative!==0){if(F=this.divmod(U.neg(),X),X!=="mod")H=F.div.neg();return{div:H,mod:F.mod}}if((this.negative&U.negative)!==0){if(F=this.neg().divmod(U.neg(),X),X!=="div"){if(j=F.mod.neg(),q&&j.negative!==0)j.isub(U)}return{div:F.div,mod:j}}if(U.length>this.length||this.cmp(U)<0)return{div:new W(0),mod:this};if(U.length===1){if(X==="div")return{div:this.divn(U.words[0]),mod:null};if(X==="mod")return{div:null,mod:new W(this.modrn(U.words[0]))};return{div:this.divn(U.words[0]),mod:new W(this.modrn(U.words[0]))}}return this._wordDiv(U,X)},W.prototype.div=function(U){return this.divmod(U,"div",!1).div},W.prototype.mod=function(U){return this.divmod(U,"mod",!1).mod},W.prototype.umod=function(U){return this.divmod(U,"mod",!0).mod},W.prototype.divRound=function(U){var X=this.divmod(U);if(X.mod.isZero())return X.div;var q=X.div.negative!==0?X.mod.isub(U):X.mod,H=U.ushrn(1),j=U.andln(1),F=q.cmp(H);if(F<0||j===1&&F===0)return X.div;return X.div.negative!==0?X.div.isubn(1):X.div.iaddn(1)},W.prototype.modrn=function(U){var X=U<0;if(X)U=-U;Q(U<=67108863);var q=67108864%U,H=0;for(var j=this.length-1;j>=0;j--)H=(q*H+(this.words[j]|0))%U;return X?-H:H},W.prototype.modn=function(U){return this.modrn(U)},W.prototype.idivn=function(U){var X=U<0;if(X)U=-U;Q(U<=67108863);var q=0;for(var H=this.length-1;H>=0;H--){var j=(this.words[H]|0)+q*67108864;this.words[H]=j/U|0,q=j%U}return this._strip(),X?this.ineg():this},W.prototype.divn=function(U){return this.clone().idivn(U)},W.prototype.egcd=function(U){Q(U.negative===0),Q(!U.isZero());var X=this,q=U.clone();if(X.negative!==0)X=X.umod(U);else X=X.clone();var H=new W(1),j=new W(0),F=new W(0),I=new W(1),D=0;while(X.isEven()&&q.isEven())X.iushrn(1),q.iushrn(1),++D;var P=q.clone(),k=X.clone();while(!X.isZero()){for(var b=0,n=1;(X.words[0]&n)===0&&b<26;++b,n<<=1);if(b>0){X.iushrn(b);while(b-- >0){if(H.isOdd()||j.isOdd())H.iadd(P),j.isub(k);H.iushrn(1),j.iushrn(1)}}for(var f=0,T1=1;(q.words[0]&T1)===0&&f<26;++f,T1<<=1);if(f>0){q.iushrn(f);while(f-- >0){if(F.isOdd()||I.isOdd())F.iadd(P),I.isub(k);F.iushrn(1),I.iushrn(1)}}if(X.cmp(q)>=0)X.isub(q),H.isub(F),j.isub(I);else q.isub(X),F.isub(H),I.isub(j)}return{a:F,b:I,gcd:q.iushln(D)}},W.prototype._invmp=function(U){Q(U.negative===0),Q(!U.isZero());var X=this,q=U.clone();if(X.negative!==0)X=X.umod(U);else X=X.clone();var H=new W(1),j=new W(0),F=q.clone();while(X.cmpn(1)>0&&q.cmpn(1)>0){for(var I=0,D=1;(X.words[0]&D)===0&&I<26;++I,D<<=1);if(I>0){X.iushrn(I);while(I-- >0){if(H.isOdd())H.iadd(F);H.iushrn(1)}}for(var P=0,k=1;(q.words[0]&k)===0&&P<26;++P,k<<=1);if(P>0){q.iushrn(P);while(P-- >0){if(j.isOdd())j.iadd(F);j.iushrn(1)}}if(X.cmp(q)>=0)X.isub(q),H.isub(j);else q.isub(X),j.isub(H)}var b;if(X.cmpn(1)===0)b=H;else b=j;if(b.cmpn(0)<0)b.iadd(U);return b},W.prototype.gcd=function(U){if(this.isZero())return U.abs();if(U.isZero())return this.abs();var X=this.clone(),q=U.clone();X.negative=0,q.negative=0;for(var H=0;X.isEven()&&q.isEven();H++)X.iushrn(1),q.iushrn(1);do{while(X.isEven())X.iushrn(1);while(q.isEven())q.iushrn(1);var j=X.cmp(q);if(j<0){var F=X;X=q,q=F}else if(j===0||q.cmpn(1)===0)break;X.isub(q)}while(!0);return q.iushln(H)},W.prototype.invm=function(U){return this.egcd(U).a.umod(U)},W.prototype.isEven=function(){return(this.words[0]&1)===0},W.prototype.isOdd=function(){return(this.words[0]&1)===1},W.prototype.andln=function(U){return this.words[0]&U},W.prototype.bincn=function(U){Q(typeof U==="number");var X=U%26,q=(U-X)/26,H=1<<X;if(this.length<=q)return this._expand(q+1),this.words[q]|=H,this;var j=H;for(var F=q;j!==0&&F<this.length;F++){var I=this.words[F]|0;I+=j,j=I>>>26,I&=67108863,this.words[F]=I}if(j!==0)this.words[F]=j,this.length++;return this},W.prototype.isZero=function(){return this.length===1&&this.words[0]===0},W.prototype.cmpn=function(U){var X=U<0;if(this.negative!==0&&!X)return-1;if(this.negative===0&&X)return 1;this._strip();var q;if(this.length>1)q=1;else{if(X)U=-U;Q(U<=67108863,"Number is too big");var H=this.words[0]|0;q=H===U?0:H<U?-1:1}if(this.negative!==0)return-q|0;return q},W.prototype.cmp=function(U){if(this.negative!==0&&U.negative===0)return-1;if(this.negative===0&&U.negative!==0)return 1;var X=this.ucmp(U);if(this.negative!==0)return-X|0;return X},W.prototype.ucmp=function(U){if(this.length>U.length)return 1;if(this.length<U.length)return-1;var X=0;for(var q=this.length-1;q>=0;q--){var H=this.words[q]|0,j=U.words[q]|0;if(H===j)continue;if(H<j)X=-1;else if(H>j)X=1;break}return X},W.prototype.gtn=function(U){return this.cmpn(U)===1},W.prototype.gt=function(U){return this.cmp(U)===1},W.prototype.gten=function(U){return this.cmpn(U)>=0},W.prototype.gte=function(U){return this.cmp(U)>=0},W.prototype.ltn=function(U){return this.cmpn(U)===-1},W.prototype.lt=function(U){return this.cmp(U)===-1},W.prototype.lten=function(U){return this.cmpn(U)<=0},W.prototype.lte=function(U){return this.cmp(U)<=0},W.prototype.eqn=function(U){return this.cmpn(U)===0},W.prototype.eq=function(U){return this.cmp(U)===0},W.red=function(U){return new i(U)},W.prototype.toRed=function(U){return Q(!this.red,"Already a number in reduction context"),Q(this.negative===0,"red works only with positives"),U.convertTo(this)._forceRed(U)},W.prototype.fromRed=function(){return Q(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},W.prototype._forceRed=function(U){return this.red=U,this},W.prototype.forceRed=function(U){return Q(!this.red,"Already a number in reduction context"),this._forceRed(U)},W.prototype.redAdd=function(U){return Q(this.red,"redAdd works only with red numbers"),this.red.add(this,U)},W.prototype.redIAdd=function(U){return Q(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,U)},W.prototype.redSub=function(U){return Q(this.red,"redSub works only with red numbers"),this.red.sub(this,U)},W.prototype.redISub=function(U){return Q(this.red,"redISub works only with red numbers"),this.red.isub(this,U)},W.prototype.redShl=function(U){return Q(this.red,"redShl works only with red numbers"),this.red.shl(this,U)},W.prototype.redMul=function(U){return Q(this.red,"redMul works only with red numbers"),this.red._verify2(this,U),this.red.mul(this,U)},W.prototype.redIMul=function(U){return Q(this.red,"redMul works only with red numbers"),this.red._verify2(this,U),this.red.imul(this,U)},W.prototype.redSqr=function(){return Q(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},W.prototype.redISqr=function(){return Q(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},W.prototype.redSqrt=function(){return Q(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},W.prototype.redInvm=function(){return Q(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},W.prototype.redNeg=function(){return Q(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},W.prototype.redPow=function(U){return Q(this.red&&!U.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,U)};var d={k256:null,p224:null,p192:null,p25519:null};function c(R,U){this.name=R,this.p=new W(U,16),this.n=this.p.bitLength(),this.k=new W(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}c.prototype._tmp=function(){var U=new W(null);return U.words=Array(Math.ceil(this.n/13)),U},c.prototype.ireduce=function(U){var X=U,q;do this.split(X,this.tmp),X=this.imulK(X),X=X.iadd(this.tmp),q=X.bitLength();while(q>this.n);var H=q<this.n?-1:X.ucmp(this.p);if(H===0)X.words[0]=0,X.length=1;else if(H>0)X.isub(this.p);else if(X.strip!==void 0)X.strip();else X._strip();return X},c.prototype.split=function(U,X){U.iushrn(this.n,0,X)},c.prototype.imulK=function(U){return U.imul(this.k)};function r(){c.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}J(r,c),r.prototype.split=function(U,X){var q=4194303,H=Math.min(U.length,9);for(var j=0;j<H;j++)X.words[j]=U.words[j];if(X.length=H,U.length<=9){U.words[0]=0,U.length=1;return}var F=U.words[9];X.words[X.length++]=F&q;for(j=10;j<U.length;j++){var I=U.words[j]|0;U.words[j-10]=(I&q)<<4|F>>>22,F=I}if(F>>>=22,U.words[j-10]=F,F===0&&U.length>10)U.length-=10;else U.length-=9},r.prototype.imulK=function(U){U.words[U.length]=0,U.words[U.length+1]=0,U.length+=2;var X=0;for(var q=0;q<U.length;q++){var H=U.words[q]|0;X+=H*977,U.words[q]=X&67108863,X=H*64+(X/67108864|0)}if(U.words[U.length-1]===0){if(U.length--,U.words[U.length-1]===0)U.length--}return U};function u(){c.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}J(u,c);function h(){c.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}J(h,c);function o(){c.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}J(o,c),o.prototype.imulK=function(U){var X=0;for(var q=0;q<U.length;q++){var H=(U.words[q]|0)*19+X,j=H&67108863;H>>>=26,U.words[q]=j,X=H}if(X!==0)U.words[U.length++]=X;return U},W._prime=function(U){if(d[U])return d[U];var X;if(U==="k256")X=new r;else if(U==="p224")X=new u;else if(U==="p192")X=new h;else if(U==="p25519")X=new o;else throw Error("Unknown prime "+U);return d[U]=X,X};function i(R){if(typeof R==="string"){var U=W._prime(R);this.m=U.p,this.prime=U}else Q(R.gtn(1),"modulus must be greater than 1"),this.m=R,this.prime=null}i.prototype._verify1=function(U){Q(U.negative===0,"red works only with positives"),Q(U.red,"red works only with red numbers")},i.prototype._verify2=function(U,X){Q((U.negative|X.negative)===0,"red works only with positives"),Q(U.red&&U.red===X.red,"red works only with red numbers")},i.prototype.imod=function(U){if(this.prime)return this.prime.ireduce(U)._forceRed(this);return C(U,U.umod(this.m)._forceRed(this)),U},i.prototype.neg=function(U){if(U.isZero())return U.clone();return this.m.sub(U)._forceRed(this)},i.prototype.add=function(U,X){this._verify2(U,X);var q=U.add(X);if(q.cmp(this.m)>=0)q.isub(this.m);return q._forceRed(this)},i.prototype.iadd=function(U,X){this._verify2(U,X);var q=U.iadd(X);if(q.cmp(this.m)>=0)q.isub(this.m);return q},i.prototype.sub=function(U,X){this._verify2(U,X);var q=U.sub(X);if(q.cmpn(0)<0)q.iadd(this.m);return q._forceRed(this)},i.prototype.isub=function(U,X){this._verify2(U,X);var q=U.isub(X);if(q.cmpn(0)<0)q.iadd(this.m);return q},i.prototype.shl=function(U,X){return this._verify1(U),this.imod(U.ushln(X))},i.prototype.imul=function(U,X){return this._verify2(U,X),this.imod(U.imul(X))},i.prototype.mul=function(U,X){return this._verify2(U,X),this.imod(U.mul(X))},i.prototype.isqr=function(U){return this.imul(U,U.clone())},i.prototype.sqr=function(U){return this.mul(U,U)},i.prototype.sqrt=function(U){if(U.isZero())return U.clone();var X=this.m.andln(3);if(Q(X%2===1),X===3){var q=this.m.add(new W(1)).iushrn(2);return this.pow(U,q)}var H=this.m.subn(1),j=0;while(!H.isZero()&&H.andln(1)===0)j++,H.iushrn(1);Q(!H.isZero());var F=new W(1).toRed(this),I=F.redNeg(),D=this.m.subn(1).iushrn(1),P=this.m.bitLength();P=new W(2*P*P).toRed(this);while(this.pow(P,D).cmp(I)!==0)P.redIAdd(I);var k=this.pow(P,H),b=this.pow(U,H.addn(1).iushrn(1)),n=this.pow(U,H),f=j;while(n.cmp(F)!==0){var T1=n;for(var Q1=0;T1.cmp(F)!==0;Q1++)T1=T1.redSqr();Q(Q1<f);var J1=this.pow(k,new W(1).iushln(f-Q1-1));b=b.redMul(J1),k=J1.redSqr(),n=n.redMul(k),f=Q1}return b},i.prototype.invm=function(U){var X=U._invmp(this.m);if(X.negative!==0)return X.negative=0,this.imod(X).redNeg();else return this.imod(X)},i.prototype.pow=function(U,X){if(X.isZero())return new W(1).toRed(this);if(X.cmpn(1)===0)return U.clone();var q=4,H=Array(1<<q);H[0]=new W(1).toRed(this),H[1]=U;for(var j=2;j<H.length;j++)H[j]=this.mul(H[j-1],U);var F=H[0],I=0,D=0,P=X.bitLength()%26;if(P===0)P=26;for(j=X.length-1;j>=0;j--){var k=X.words[j];for(var b=P-1;b>=0;b--){var n=k>>b&1;if(F!==H[0])F=this.sqr(F);if(n===0&&I===0){D=0;continue}if(I<<=1,I|=n,D++,D!==q&&(j!==0||b!==0))continue;F=this.mul(F,H[I]),D=0,I=0}P=26}return F},i.prototype.convertTo=function(U){var X=U.umod(this.m);return X===U?X.clone():X},i.prototype.convertFrom=function(U){var X=U.clone();return X.red=null,X},W.mont=function(U){return new x(U)};function x(R){if(i.call(this,R),this.shift=this.m.bitLength(),this.shift%26!==0)this.shift+=26-this.shift%26;this.r=new W(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)}J(x,i),x.prototype.convertTo=function(U){return this.imod(U.ushln(this.shift))},x.prototype.convertFrom=function(U){var X=this.imod(U.mul(this.rinv));return X.red=null,X},x.prototype.imul=function(U,X){if(U.isZero()||X.isZero())return U.words[0]=0,U.length=1,U;var q=U.imul(X),H=q.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),j=q.isub(H).iushrn(this.shift),F=j;if(j.cmp(this.m)>=0)F=j.isub(this.m);else if(j.cmpn(0)<0)F=j.iadd(this.m);return F._forceRed(this)},x.prototype.mul=function(U,X){if(U.isZero()||X.isZero())return new W(0)._forceRed(this);var q=U.mul(X),H=q.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),j=q.isub(H).iushrn(this.shift),F=j;if(j.cmp(this.m)>=0)F=j.isub(this.m);else if(j.cmpn(0)<0)F=j.iadd(this.m);return F._forceRed(this)},x.prototype.invm=function(U){var X=this.imod(U._invmp(this.m).mul(this.r2));return X._forceRed(this)}})(typeof qW>"u"||qW,CX)});var jX=YT((CW,VX)=>{/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var o6=(LA(),VA(v6)),vT=o6.Buffer;function HX(T,A){for(var Q in T)A[Q]=T[Q]}if(vT.from&&vT.alloc&&vT.allocUnsafe&&vT.allocUnsafeSlow)VX.exports=o6;else HX(o6,CW),CW.Buffer=$A;function $A(T,A,Q){return vT(T,A,Q)}$A.prototype=Object.create(vT.prototype);HX(vT,$A);$A.from=function(T,A,Q){if(typeof T==="number")throw TypeError("Argument must not be a number");return vT(T,A,Q)};$A.alloc=function(T,A,Q){if(typeof T!=="number")throw TypeError("Argument must be a number");var J=vT(T);if(A!==void 0)if(typeof Q==="string")J.fill(A,Q);else J.fill(A);else J.fill(0);return J};$A.allocUnsafe=function(T){if(typeof T!=="number")throw TypeError("Argument must be a number");return vT(T)};$A.allocUnsafeSlow=function(T){if(typeof T!=="number")throw TypeError("Argument must be a number");return o6.SlowBuffer(T)}});var DX=YT((G_,RX)=>{var a6=jX().Buffer;function kj(T){if(T.length>=255)throw TypeError("Alphabet too long");var A=new Uint8Array(256);for(var Q=0;Q<A.length;Q++)A[Q]=255;for(var J=0;J<T.length;J++){var W=T.charAt(J),$=W.charCodeAt(0);if(A[$]!==255)throw TypeError(W+" is ambiguous");A[$]=J}var G=T.length,Y=T.charAt(0),Z=Math.log(G)/Math.log(256),C=Math.log(256)/Math.log(G);function K(z){if(Array.isArray(z)||z instanceof Uint8Array)z=a6.from(z);if(!a6.isBuffer(z))throw TypeError("Expected Buffer");if(z.length===0)return"";var N=0,w=0,L=0,O=z.length;while(L!==O&&z[L]===0)L++,N++;var g=(O-L)*C+1>>>0,v=new Uint8Array(g);while(L!==O){var p=z[L],d=0;for(var c=g-1;(p!==0||d<w)&&c!==-1;c--,d++)p+=256*v[c]>>>0,v[c]=p%G>>>0,p=p/G>>>0;if(p!==0)throw Error("Non-zero carry");w=d,L++}var r=g-w;while(r!==g&&v[r]===0)r++;var u=Y.repeat(N);for(;r<g;++r)u+=T.charAt(v[r]);return u}function V(z){if(typeof z!=="string")throw TypeError("Expected String");if(z.length===0)return a6.alloc(0);var N=0,w=0,L=0;while(z[N]===Y)w++,N++;var O=(z.length-N)*Z+1>>>0,g=new Uint8Array(O);while(N<z.length){var v=z.charCodeAt(N);if(v>255)return;var p=A[v];if(p===255)return;var d=0;for(var c=O-1;(p!==0||d<L)&&c!==-1;c--,d++)p+=G*g[c]>>>0,g[c]=p%256>>>0,p=p/256>>>0;if(p!==0)throw Error("Non-zero carry");L=d,N++}var r=O-L;while(r!==O&&g[r]===0)r++;var u=a6.allocUnsafe(w+(O-r));u.fill(0,0,w);var h=w;while(r!==O)u[h++]=g[r++];return u}function M(z){var N=V(z);if(N)return N;throw Error("Non-base"+G+" character")}return{encode:K,decodeUnsafe:V,decode:M}}RX.exports=kj});var HW=YT((U_,MX)=>{var zj=DX(),Fj="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";MX.exports=zj(Fj)});var kX={};U4(kX,{TextEncoder:()=>TQ,TextDecoder:()=>e6});function $8(T,A,Q){return A<=T&&T<=Q}function AQ(T){if(T===void 0)return{};if(T===Object(T))return T;throw TypeError("Could not convert argument to dictionary")}function Nj(T){var A=String(T),Q=A.length,J=0,W=[];while(J<Q){var $=A.charCodeAt(J);if($<55296||$>57343)W.push($);else if(56320<=$&&$<=57343)W.push(65533);else if(55296<=$&&$<=56319)if(J===Q-1)W.push(65533);else{var G=T.charCodeAt(J+1);if(56320<=G&&G<=57343){var Y=$&1023,Z=G&1023;W.push(65536+(Y<<10)+Z),J+=1}else W.push(65533)}J+=1}return W}function Ij(T){var A="";for(var Q=0;Q<T.length;++Q){var J=T[Q];if(J<=65535)A+=String.fromCharCode(J);else J-=65536,A+=String.fromCharCode((J>>10)+55296,(J&1023)+56320)}return A}function RW(T){this.tokens=[].slice.call(T)}function jW(T,A){if(T)throw TypeError("Decoder error");return A||65533}function Sj(){}function Lj(){}function e6(T,A){if(!(this instanceof e6))return new e6(T,A);if(T=T!==void 0?String(T).toLowerCase():t6,T!==t6)throw Error("Encoding not supported. Only utf-8 is supported");A=AQ(A),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=Boolean(A.fatal),this._ignoreBOM=Boolean(A.ignoreBOM),Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}function TQ(T,A){if(!(this instanceof TQ))return new TQ(T,A);if(T=T!==void 0?String(T).toLowerCase():t6,T!==t6)throw Error("Encoding not supported. Only utf-8 is supported");A=AQ(A),this._streaming=!1,this._encoder=null,this._options={fatal:Boolean(A.fatal)},Object.defineProperty(this,"encoding",{value:"utf-8"})}function wj(T){var A=T.fatal,Q=0,J=0,W=0,$=128,G=191;this.handler=function(Y,Z){if(Z===s6&&W!==0)return W=0,jW(A);if(Z===s6)return hA;if(W===0){if($8(Z,0,127))return Z;if($8(Z,194,223))W=1,Q=Z-192;else if($8(Z,224,239)){if(Z===224)$=160;if(Z===237)G=159;W=2,Q=Z-224}else if($8(Z,240,244)){if(Z===240)$=144;if(Z===244)G=143;W=3,Q=Z-240}else return jW(A);return Q=Q<<6*W,null}if(!$8(Z,$,G))return Q=W=J=0,$=128,G=191,Y.prepend(Z),jW(A);if($=128,G=191,J+=1,Q+=Z-128<<6*(W-J),J!==W)return null;var C=Q;return Q=W=J=0,C}}function Ej(T){var A=T.fatal;this.handler=function(Q,J){if(J===s6)return hA;if($8(J,0,127))return J;var W,$;if($8(J,128,2047))W=1,$=192;else if($8(J,2048,65535))W=2,$=224;else if($8(J,65536,1114111))W=3,$=240;var G=[(J>>6*W)+$];while(W>0){var Y=J>>6*(W-1);G.push(128|Y&63),W-=1}return G}}var s6=-1,hA=-1,t6="utf-8";var zX=w0(()=>{RW.prototype={endOfStream:function(){return!this.tokens.length},read:function(){if(!this.tokens.length)return s6;return this.tokens.shift()},prepend:function(T){if(Array.isArray(T)){var A=T;while(A.length)this.tokens.unshift(A.pop())}else this.tokens.unshift(T)},push:function(T){if(Array.isArray(T)){var A=T;while(A.length)this.tokens.push(A.shift())}else this.tokens.push(T)}};Sj.prototype={handler:function(T,A){}};Lj.prototype={handler:function(T,A){}};e6.prototype={decode:function(A,Q){var J;if(typeof A==="object"&&A instanceof ArrayBuffer)J=new Uint8Array(A);else if(typeof A==="object"&&"buffer"in A&&A.buffer instanceof ArrayBuffer)J=new Uint8Array(A.buffer,A.byteOffset,A.byteLength);else J=new Uint8Array(0);if(Q=AQ(Q),!this._streaming)this._decoder=new wj({fatal:this._fatal}),this._BOMseen=!1;this._streaming=Boolean(Q.stream);var W=new RW(J),$=[],G;while(!W.endOfStream()){if(G=this._decoder.handler(W,W.read()),G===hA)break;if(G===null)continue;if(Array.isArray(G))$.push.apply($,G);else $.push(G)}if(!this._streaming){do{if(G=this._decoder.handler(W,W.read()),G===hA)break;if(G===null)continue;if(Array.isArray(G))$.push.apply($,G);else $.push(G)}while(!W.endOfStream());this._decoder=null}if($.length){if(["utf-8"].indexOf(this.encoding)!==-1&&!this._ignoreBOM&&!this._BOMseen)if($[0]===65279)this._BOMseen=!0,$.shift();else this._BOMseen=!0}return Ij($)}};TQ.prototype={encode:function(A,Q){if(A=A?String(A):"",Q=AQ(Q),!this._streaming)this._encoder=new Ej(this._options);this._streaming=Boolean(Q.stream);var J=[],W=new RW(Nj(A)),$;while(!W.endOfStream()){if($=this._encoder.handler(W,W.read()),$===hA)break;if(Array.isArray($))J.push.apply(J,$);else J.push($)}if(!this._streaming){while(!0){if($=this._encoder.handler(W,W.read()),$===hA)break;if(Array.isArray($))J.push.apply(J,$);else J.push($)}this._encoder=null}return new Uint8Array(J)}}});var LX=YT((K1)=>{var Oj=K1&&K1.__createBinding||(Object.create?function(T,A,Q,J){if(J===void 0)J=Q;Object.defineProperty(T,J,{enumerable:!0,get:function(){return A[Q]}})}:function(T,A,Q,J){if(J===void 0)J=Q;T[J]=A[Q]}),Bj=K1&&K1.__setModuleDefault||(Object.create?function(T,A){Object.defineProperty(T,"default",{enumerable:!0,value:A})}:function(T,A){T.default=A}),yT=K1&&K1.__decorate||function(T,A,Q,J){var W=arguments.length,$=W<3?A:J===null?J=Object.getOwnPropertyDescriptor(A,Q):J,G;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")$=Reflect.decorate(T,A,Q,J);else for(var Y=T.length-1;Y>=0;Y--)if(G=T[Y])$=(W<3?G($):W>3?G(A,Q,$):G(A,Q))||$;return W>3&&$&&Object.defineProperty(A,Q,$),$},_j=K1&&K1.__importStar||function(T){if(T&&T.__esModule)return T;var A={};if(T!=null){for(var Q in T)if(Q!=="default"&&Object.hasOwnProperty.call(T,Q))Oj(A,T,Q)}return Bj(A,T),A},FX=K1&&K1.__importDefault||function(T){return T&&T.__esModule?T:{default:T}};Object.defineProperty(K1,"__esModule",{value:!0});K1.deserializeUnchecked=K1.deserialize=K1.serialize=K1.BinaryReader=K1.BinaryWriter=K1.BorshError=K1.baseDecode=K1.baseEncode=void 0;var B8=FX(KW()),NX=FX(HW()),xj=_j((zX(),VA(kX))),hj=typeof TextDecoder!=="function"?xj.TextDecoder:TextDecoder,gj=new hj("utf-8",{fatal:!0});function mj(T){if(typeof T==="string")T=Buffer.from(T,"utf8");return NX.default.encode(Buffer.from(T))}K1.baseEncode=mj;function vj(T){return Buffer.from(NX.default.decode(T))}K1.baseDecode=vj;var DW=1024;class B0 extends Error{constructor(T){super(T);this.fieldPath=[],this.originalMessage=T}addToFieldPath(T){this.fieldPath.splice(0,0,T),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}K1.BorshError=B0;class MW{constructor(){this.buf=Buffer.alloc(DW),this.length=0}maybeResize(){if(this.buf.length<16+this.length)this.buf=Buffer.concat([this.buf,Buffer.alloc(DW)])}writeU8(T){this.maybeResize(),this.buf.writeUInt8(T,this.length),this.length+=1}writeU16(T){this.maybeResize(),this.buf.writeUInt16LE(T,this.length),this.length+=2}writeU32(T){this.maybeResize(),this.buf.writeUInt32LE(T,this.length),this.length+=4}writeU64(T){this.maybeResize(),this.writeBuffer(Buffer.from(new B8.default(T).toArray("le",8)))}writeU128(T){this.maybeResize(),this.writeBuffer(Buffer.from(new B8.default(T).toArray("le",16)))}writeU256(T){this.maybeResize(),this.writeBuffer(Buffer.from(new B8.default(T).toArray("le",32)))}writeU512(T){this.maybeResize(),this.writeBuffer(Buffer.from(new B8.default(T).toArray("le",64)))}writeBuffer(T){this.buf=Buffer.concat([Buffer.from(this.buf.subarray(0,this.length)),T,Buffer.alloc(DW)]),this.length+=T.length}writeString(T){this.maybeResize();let A=Buffer.from(T,"utf8");this.writeU32(A.length),this.writeBuffer(A)}writeFixedArray(T){this.writeBuffer(Buffer.from(T))}writeArray(T,A){this.maybeResize(),this.writeU32(T.length);for(let Q of T)this.maybeResize(),A(Q)}toArray(){return this.buf.subarray(0,this.length)}}K1.BinaryWriter=MW;function bT(T,A,Q){let J=Q.value;Q.value=function(...W){try{return J.apply(this,W)}catch($){if($ instanceof RangeError){let G=$.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(G)>=0)throw new B0("Reached the end of buffer when deserializing")}throw $}}}class t0{constructor(T){this.buf=T,this.offset=0}readU8(){let T=this.buf.readUInt8(this.offset);return this.offset+=1,T}readU16(){let T=this.buf.readUInt16LE(this.offset);return this.offset+=2,T}readU32(){let T=this.buf.readUInt32LE(this.offset);return this.offset+=4,T}readU64(){let T=this.readBuffer(8);return new B8.default(T,"le")}readU128(){let T=this.readBuffer(16);return new B8.default(T,"le")}readU256(){let T=this.readBuffer(32);return new B8.default(T,"le")}readU512(){let T=this.readBuffer(64);return new B8.default(T,"le")}readBuffer(T){if(this.offset+T>this.buf.length)throw new B0(`Expected buffer length ${T} isn't within bounds`);let A=this.buf.slice(this.offset,this.offset+T);return this.offset+=T,A}readString(){let T=this.readU32(),A=this.readBuffer(T);try{return gj.decode(A)}catch(Q){throw new B0(`Error decoding UTF-8 string: ${Q}`)}}readFixedArray(T){return new Uint8Array(this.readBuffer(T))}readArray(T){let A=this.readU32(),Q=Array();for(let J=0;J<A;++J)Q.push(T());return Q}}yT([bT],t0.prototype,"readU8",null);yT([bT],t0.prototype,"readU16",null);yT([bT],t0.prototype,"readU32",null);yT([bT],t0.prototype,"readU64",null);yT([bT],t0.prototype,"readU128",null);yT([bT],t0.prototype,"readU256",null);yT([bT],t0.prototype,"readU512",null);yT([bT],t0.prototype,"readString",null);yT([bT],t0.prototype,"readFixedArray",null);yT([bT],t0.prototype,"readArray",null);K1.BinaryReader=t0;function IX(T){return T.charAt(0).toUpperCase()+T.slice(1)}function GA(T,A,Q,J,W){try{if(typeof J==="string")W[`write${IX(J)}`](Q);else if(J instanceof Array)if(typeof J[0]==="number"){if(Q.length!==J[0])throw new B0(`Expecting byte array of length ${J[0]}, but got ${Q.length} bytes`);W.writeFixedArray(Q)}else if(J.length===2&&typeof J[1]==="number"){if(Q.length!==J[1])throw new B0(`Expecting byte array of length ${J[1]}, but got ${Q.length} bytes`);for(let $=0;$<J[1];$++)GA(T,null,Q[$],J[0],W)}else W.writeArray(Q,($)=>{GA(T,A,$,J[0],W)});else if(J.kind!==void 0)switch(J.kind){case"option":{if(Q===null||Q===void 0)W.writeU8(0);else W.writeU8(1),GA(T,A,Q,J.type,W);break}case"map":{W.writeU32(Q.size),Q.forEach(($,G)=>{GA(T,A,G,J.key,W),GA(T,A,$,J.value,W)});break}default:throw new B0(`FieldType ${J} unrecognized`)}else SX(T,Q,W)}catch($){if($ instanceof B0)$.addToFieldPath(A);throw $}}function SX(T,A,Q){if(typeof A.borshSerialize==="function"){A.borshSerialize(Q);return}let J=T.get(A.constructor);if(!J)throw new B0(`Class ${A.constructor.name} is missing in schema`);if(J.kind==="struct")J.fields.map(([W,$])=>{GA(T,W,A[W],$,Q)});else if(J.kind==="enum"){let W=A[J.field];for(let $=0;$<J.values.length;++$){let[G,Y]=J.values[$];if(G===W){Q.writeU8($),GA(T,G,A[G],Y,Q);break}}}else throw new B0(`Unexpected schema kind: ${J.kind} for ${A.constructor.name}`)}function yj(T,A,Q=MW){let J=new Q;return SX(T,A,J),J.toArray()}K1.serialize=yj;function UA(T,A,Q,J){try{if(typeof Q==="string")return J[`read${IX(Q)}`]();if(Q instanceof Array)if(typeof Q[0]==="number")return J.readFixedArray(Q[0]);else if(typeof Q[1]==="number"){let W=[];for(let $=0;$<Q[1];$++)W.push(UA(T,null,Q[0],J));return W}else return J.readArray(()=>UA(T,A,Q[0],J));if(Q.kind==="option"){if(J.readU8())return UA(T,A,Q.type,J);return}if(Q.kind==="map"){let W=new Map,$=J.readU32();for(let G=0;G<$;G++){let Y=UA(T,A,Q.key,J),Z=UA(T,A,Q.value,J);W.set(Y,Z)}return W}return kW(T,Q,J)}catch(W){if(W instanceof B0)W.addToFieldPath(A);throw W}}function kW(T,A,Q){if(typeof A.borshDeserialize==="function")return A.borshDeserialize(Q);let J=T.get(A);if(!J)throw new B0(`Class ${A.name} is missing in schema`);if(J.kind==="struct"){let W={};for(let[$,G]of T.get(A).fields)W[$]=UA(T,$,G,Q);return new A(W)}if(J.kind==="enum"){let W=Q.readU8();if(W>=J.values.length)throw new B0(`Enum index: ${W} is out of range`);let[$,G]=J.values[W],Y=UA(T,$,G,Q);return new A({[$]:Y})}throw new B0(`Unexpected schema kind: ${J.kind} for ${A.constructor.name}`)}function bj(T,A,Q,J=t0){let W=new J(Q),$=kW(T,A,W);if(W.offset<Q.length)throw new B0(`Unexpected ${Q.length-W.offset} bytes after deserialized data`);return $}K1.deserialize=bj;function pj(T,A,Q,J=t0){let W=new J(Q);return kW(T,A,W)}K1.deserializeUnchecked=pj});var G8=YT((wX)=>{Object.defineProperty(wX,"__esModule",{value:!0});wX.s16=wX.s8=wX.nu64be=wX.u48be=wX.u40be=wX.u32be=wX.u24be=wX.u16be=wX.nu64=wX.u48=wX.u40=wX.u32=wX.u24=wX.u16=wX.u8=wX.offset=wX.greedy=wX.Constant=wX.UTF8=wX.CString=wX.Blob=wX.Boolean=wX.BitField=wX.BitStructure=wX.VariantLayout=wX.Union=wX.UnionLayoutDiscriminator=wX.UnionDiscriminator=wX.Structure=wX.Sequence=wX.DoubleBE=wX.Double=wX.FloatBE=wX.Float=wX.NearInt64BE=wX.NearInt64=wX.NearUInt64BE=wX.NearUInt64=wX.IntBE=wX.Int=wX.UIntBE=wX.UInt=wX.OffsetLayout=wX.GreedyCount=wX.ExternalLayout=wX.bindConstructorLayout=wX.nameWithProperty=wX.Layout=wX.uint8ArrayToBuffer=wX.checkUint8Array=void 0;wX.constant=wX.utf8=wX.cstr=wX.blob=wX.unionLayoutDiscriminator=wX.union=wX.seq=wX.bits=wX.struct=wX.f64be=wX.f64=wX.f32be=wX.f32=wX.ns64be=wX.s48be=wX.s40be=wX.s32be=wX.s24be=wX.s16be=wX.ns64=wX.s48=wX.s40=wX.s32=wX.s24=void 0;var FW=(LA(),VA(v6));function mA(T){if(!(T instanceof Uint8Array))throw TypeError("b must be a Uint8Array")}wX.checkUint8Array=mA;function U1(T){return mA(T),FW.Buffer.from(T.buffer,T.byteOffset,T.length)}wX.uint8ArrayToBuffer=U1;class P1{constructor(T,A){if(!Number.isInteger(T))throw TypeError("span must be an integer");this.span=T,this.property=A}makeDestinationObject(){return{}}getSpan(T,A){if(0>this.span)throw RangeError("indeterminate span");return this.span}replicate(T){let A=Object.create(this.constructor.prototype);return Object.assign(A,this),A.property=T,A}fromArray(T){return}}wX.Layout=P1;function NW(T,A){if(A.property)return T+"["+A.property+"]";return T}wX.nameWithProperty=NW;function lj(T,A){if(typeof T!=="function")throw TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(T,"layout_"))throw Error("Class is already bound to a layout");if(!(A&&A instanceof P1))throw TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(A,"boundConstructor_"))throw Error("layout is already bound to a constructor");T.layout_=A,A.boundConstructor_=T,A.makeDestinationObject=()=>new T,Object.defineProperty(T.prototype,"encode",{value(Q,J){return A.encode(this,Q,J)},writable:!0}),Object.defineProperty(T,"decode",{value(Q,J){return A.decode(Q,J)},writable:!0})}wX.bindConstructorLayout=lj;class c0 extends P1{isCount(){throw Error("ExternalLayout is abstract")}}wX.ExternalLayout=c0;class IW extends c0{constructor(T=1,A){if(!Number.isInteger(T)||0>=T)throw TypeError("elementSpan must be a (positive) integer");super(-1,A);this.elementSpan=T}isCount(){return!0}decode(T,A=0){mA(T);let Q=T.length-A;return Math.floor(Q/this.elementSpan)}encode(T,A,Q){return 0}}wX.GreedyCount=IW;class QQ extends c0{constructor(T,A=0,Q){if(!(T instanceof P1))throw TypeError("layout must be a Layout");if(!Number.isInteger(A))throw TypeError("offset must be integer or undefined");super(T.span,Q||T.property);this.layout=T,this.offset=A}isCount(){return this.layout instanceof UT||this.layout instanceof HT}decode(T,A=0){return this.layout.decode(T,A+this.offset)}encode(T,A,Q=0){return this.layout.encode(T,A,Q+this.offset)}}wX.OffsetLayout=QQ;class UT extends P1{constructor(T,A){super(T,A);if(6<this.span)throw RangeError("span must not exceed 6 bytes")}decode(T,A=0){return U1(T).readUIntLE(A,this.span)}encode(T,A,Q=0){return U1(A).writeUIntLE(T,Q,this.span),this.span}}wX.UInt=UT;class HT extends P1{constructor(T,A){super(T,A);if(6<this.span)throw RangeError("span must not exceed 6 bytes")}decode(T,A=0){return U1(T).readUIntBE(A,this.span)}encode(T,A,Q=0){return U1(A).writeUIntBE(T,Q,this.span),this.span}}wX.UIntBE=HT;class _8 extends P1{constructor(T,A){super(T,A);if(6<this.span)throw RangeError("span must not exceed 6 bytes")}decode(T,A=0){return U1(T).readIntLE(A,this.span)}encode(T,A,Q=0){return U1(A).writeIntLE(T,Q,this.span),this.span}}wX.Int=_8;class YA extends P1{constructor(T,A){super(T,A);if(6<this.span)throw RangeError("span must not exceed 6 bytes")}decode(T,A=0){return U1(T).readIntBE(A,this.span)}encode(T,A,Q=0){return U1(A).writeIntBE(T,Q,this.span),this.span}}wX.IntBE=YA;var zW=Math.pow(2,32);function JQ(T){let A=Math.floor(T/zW),Q=T-A*zW;return{hi32:A,lo32:Q}}function WQ(T,A){return T*zW+A}class SW extends P1{constructor(T){super(8,T)}decode(T,A=0){let Q=U1(T),J=Q.readUInt32LE(A),W=Q.readUInt32LE(A+4);return WQ(W,J)}encode(T,A,Q=0){let J=JQ(T),W=U1(A);return W.writeUInt32LE(J.lo32,Q),W.writeUInt32LE(J.hi32,Q+4),8}}wX.NearUInt64=SW;class LW extends P1{constructor(T){super(8,T)}decode(T,A=0){let Q=U1(T),J=Q.readUInt32BE(A),W=Q.readUInt32BE(A+4);return WQ(J,W)}encode(T,A,Q=0){let J=JQ(T),W=U1(A);return W.writeUInt32BE(J.hi32,Q),W.writeUInt32BE(J.lo32,Q+4),8}}wX.NearUInt64BE=LW;class wW extends P1{constructor(T){super(8,T)}decode(T,A=0){let Q=U1(T),J=Q.readUInt32LE(A),W=Q.readInt32LE(A+4);return WQ(W,J)}encode(T,A,Q=0){let J=JQ(T),W=U1(A);return W.writeUInt32LE(J.lo32,Q),W.writeInt32LE(J.hi32,Q+4),8}}wX.NearInt64=wW;class EW extends P1{constructor(T){super(8,T)}decode(T,A=0){let Q=U1(T),J=Q.readInt32BE(A),W=Q.readUInt32BE(A+4);return WQ(J,W)}encode(T,A,Q=0){let J=JQ(T),W=U1(A);return W.writeInt32BE(J.hi32,Q),W.writeUInt32BE(J.lo32,Q+4),8}}wX.NearInt64BE=EW;class OW extends P1{constructor(T){super(4,T)}decode(T,A=0){return U1(T).readFloatLE(A)}encode(T,A,Q=0){return U1(A).writeFloatLE(T,Q),4}}wX.Float=OW;class BW extends P1{constructor(T){super(4,T)}decode(T,A=0){return U1(T).readFloatBE(A)}encode(T,A,Q=0){return U1(A).writeFloatBE(T,Q),4}}wX.FloatBE=BW;class _W extends P1{constructor(T){super(8,T)}decode(T,A=0){return U1(T).readDoubleLE(A)}encode(T,A,Q=0){return U1(A).writeDoubleLE(T,Q),8}}wX.Double=_W;class xW extends P1{constructor(T){super(8,T)}decode(T,A=0){return U1(T).readDoubleBE(A)}encode(T,A,Q=0){return U1(A).writeDoubleBE(T,Q),8}}wX.DoubleBE=xW;class hW extends P1{constructor(T,A,Q){if(!(T instanceof P1))throw TypeError("elementLayout must be a Layout");if(!(A instanceof c0&&A.isCount()||Number.isInteger(A)&&0<=A))throw TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let J=-1;if(!(A instanceof c0)&&0<T.span)J=A*T.span;super(J,Q);this.elementLayout=T,this.count=A}getSpan(T,A=0){if(0<=this.span)return this.span;let Q=0,J=this.count;if(J instanceof c0)J=J.decode(T,A);if(0<this.elementLayout.span)Q=J*this.elementLayout.span;else{let W=0;while(W<J)Q+=this.elementLayout.getSpan(T,A+Q),++W}return Q}decode(T,A=0){let Q=[],J=0,W=this.count;if(W instanceof c0)W=W.decode(T,A);while(J<W)Q.push(this.elementLayout.decode(T,A)),A+=this.elementLayout.getSpan(T,A),J+=1;return Q}encode(T,A,Q=0){let J=this.elementLayout,W=T.reduce(($,G)=>{return $+J.encode(G,A,Q+$)},0);if(this.count instanceof c0)this.count.encode(T.length,A,Q);return W}}wX.Sequence=hW;class gW extends P1{constructor(T,A,Q){if(!(Array.isArray(T)&&T.reduce((W,$)=>W&&$ instanceof P1,!0)))throw TypeError("fields must be array of Layout instances");if(typeof A==="boolean"&&Q===void 0)Q=A,A=void 0;for(let W of T)if(0>W.span&&W.property===void 0)throw Error("fields cannot contain unnamed variable-length layout");let J=-1;try{J=T.reduce((W,$)=>W+$.getSpan(),0)}catch(W){}super(J,A);this.fields=T,this.decodePrefixes=!!Q}getSpan(T,A=0){if(0<=this.span)return this.span;let Q=0;try{Q=this.fields.reduce((J,W)=>{let $=W.getSpan(T,A);return A+=$,J+$},0)}catch(J){throw RangeError("indeterminate span")}return Q}decode(T,A=0){mA(T);let Q=this.makeDestinationObject();for(let J of this.fields){if(J.property!==void 0)Q[J.property]=J.decode(T,A);if(A+=J.getSpan(T,A),this.decodePrefixes&&T.length===A)break}return Q}encode(T,A,Q=0){let J=Q,W=0,$=0;for(let G of this.fields){let Y=G.span;if($=0<Y?Y:0,G.property!==void 0){let Z=T[G.property];if(Z!==void 0){if($=G.encode(Z,A,Q),0>Y)Y=G.getSpan(A,Q)}}W=Q,Q+=Y}return W+$-J}fromArray(T){let A=this.makeDestinationObject();for(let Q of this.fields)if(Q.property!==void 0&&0<T.length)A[Q.property]=T.shift();return A}layoutFor(T){if(typeof T!=="string")throw TypeError("property must be string");for(let A of this.fields)if(A.property===T)return A;return}offsetOf(T){if(typeof T!=="string")throw TypeError("property must be string");let A=0;for(let Q of this.fields){if(Q.property===T)return A;if(0>Q.span)A=-1;else if(0<=A)A+=Q.span}return}}wX.Structure=gW;class $Q{constructor(T){this.property=T}decode(T,A){throw Error("UnionDiscriminator is abstract")}encode(T,A,Q){throw Error("UnionDiscriminator is abstract")}}wX.UnionDiscriminator=$Q;class F2 extends $Q{constructor(T,A){if(!(T instanceof c0&&T.isCount()))throw TypeError("layout must be an unsigned integer ExternalLayout");super(A||T.property||"variant");this.layout=T}decode(T,A){return this.layout.decode(T,A)}encode(T,A,Q){return this.layout.encode(T,A,Q)}}wX.UnionLayoutDiscriminator=F2;class GQ extends P1{constructor(T,A,Q){let J;if(T instanceof UT||T instanceof HT)J=new F2(new QQ(T));else if(T instanceof c0&&T.isCount())J=new F2(T);else if(!(T instanceof $Q))throw TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");else J=T;if(A===void 0)A=null;if(!(A===null||A instanceof P1))throw TypeError("defaultLayout must be null or a Layout");if(A!==null){if(0>A.span)throw Error("defaultLayout must have constant span");if(A.property===void 0)A=A.replicate("content")}let W=-1;if(A){if(W=A.span,0<=W&&(T instanceof UT||T instanceof HT))W+=J.layout.span}super(W,Q);this.discriminator=J,this.usesPrefixDiscriminator=T instanceof UT||T instanceof HT,this.defaultLayout=A,this.registry={};let $=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(G){return $(G)},this.configGetSourceVariant=function(G){$=G.bind(this)}}getSpan(T,A=0){if(0<=this.span)return this.span;let Q=this.getVariant(T,A);if(!Q)throw Error("unable to determine span for unrecognized variant");return Q.getSpan(T,A)}defaultGetSourceVariant(T){if(Object.prototype.hasOwnProperty.call(T,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(T,this.defaultLayout.property))return;let A=this.registry[T[this.discriminator.property]];if(A&&(!A.layout||A.property&&Object.prototype.hasOwnProperty.call(T,A.property)))return A}else for(let A in this.registry){let Q=this.registry[A];if(Q.property&&Object.prototype.hasOwnProperty.call(T,Q.property))return Q}throw Error("unable to infer src variant")}decode(T,A=0){let Q,J=this.discriminator,W=J.decode(T,A),$=this.registry[W];if($===void 0){let G=this.defaultLayout,Y=0;if(this.usesPrefixDiscriminator)Y=J.layout.span;Q=this.makeDestinationObject(),Q[J.property]=W,Q[G.property]=G.decode(T,A+Y)}else Q=$.decode(T,A);return Q}encode(T,A,Q=0){let J=this.getSourceVariant(T);if(J===void 0){let W=this.discriminator,$=this.defaultLayout,G=0;if(this.usesPrefixDiscriminator)G=W.layout.span;return W.encode(T[W.property],A,Q),G+$.encode(T[$.property],A,Q+G)}return J.encode(T,A,Q)}addVariant(T,A,Q){let J=new mW(this,T,A,Q);return this.registry[T]=J,J}getVariant(T,A=0){let Q;if(T instanceof Uint8Array)Q=this.discriminator.decode(T,A);else Q=T;return this.registry[Q]}}wX.Union=GQ;class mW extends P1{constructor(T,A,Q,J){if(!(T instanceof GQ))throw TypeError("union must be a Union");if(!Number.isInteger(A)||0>A)throw TypeError("variant must be a (non-negative) integer");if(typeof Q==="string"&&J===void 0)J=Q,Q=null;if(Q){if(!(Q instanceof P1))throw TypeError("layout must be a Layout");if(T.defaultLayout!==null&&0<=Q.span&&Q.span>T.defaultLayout.span)throw Error("variant span exceeds span of containing union");if(typeof J!=="string")throw TypeError("variant must have a String property")}let W=T.span;if(0>T.span){if(W=Q?Q.span:0,0<=W&&T.usesPrefixDiscriminator)W+=T.discriminator.layout.span}super(W,J);this.union=T,this.variant=A,this.layout=Q||null}getSpan(T,A=0){if(0<=this.span)return this.span;let Q=0;if(this.union.usesPrefixDiscriminator)Q=this.union.discriminator.layout.span;let J=0;if(this.layout)J=this.layout.getSpan(T,A+Q);return Q+J}decode(T,A=0){let Q=this.makeDestinationObject();if(this!==this.union.getVariant(T,A))throw Error("variant mismatch");let J=0;if(this.union.usesPrefixDiscriminator)J=this.union.discriminator.layout.span;if(this.layout)Q[this.property]=this.layout.decode(T,A+J);else if(this.property)Q[this.property]=!0;else if(this.union.usesPrefixDiscriminator)Q[this.union.discriminator.property]=this.variant;return Q}encode(T,A,Q=0){let J=0;if(this.union.usesPrefixDiscriminator)J=this.union.discriminator.layout.span;if(this.layout&&!Object.prototype.hasOwnProperty.call(T,this.property))throw TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,A,Q);let W=J;if(this.layout){if(this.layout.encode(T[this.property],A,Q+J),W+=this.layout.getSpan(A,Q+J),0<=this.union.span&&W>this.union.span)throw Error("encoded variant overruns containing union")}return W}fromArray(T){if(this.layout)return this.layout.fromArray(T);return}}wX.VariantLayout=mW;function gA(T){if(0>T)T+=4294967296;return T}class UQ extends P1{constructor(T,A,Q){if(!(T instanceof UT||T instanceof HT))throw TypeError("word must be a UInt or UIntBE layout");if(typeof A==="string"&&Q===void 0)Q=A,A=!1;if(4<T.span)throw RangeError("word cannot exceed 32 bits");super(T.span,Q);this.word=T,this.msb=!!A,this.fields=[];let J=0;this._packedSetValue=function(W){return J=gA(W),this},this._packedGetValue=function(){return J}}decode(T,A=0){let Q=this.makeDestinationObject(),J=this.word.decode(T,A);this._packedSetValue(J);for(let W of this.fields)if(W.property!==void 0)Q[W.property]=W.decode(T);return Q}encode(T,A,Q=0){let J=this.word.decode(A,Q);this._packedSetValue(J);for(let W of this.fields)if(W.property!==void 0){let $=T[W.property];if($!==void 0)W.encode($)}return this.word.encode(this._packedGetValue(),A,Q)}addField(T,A){let Q=new YQ(this,T,A);return this.fields.push(Q),Q}addBoolean(T){let A=new vW(this,T);return this.fields.push(A),A}fieldFor(T){if(typeof T!=="string")throw TypeError("property must be string");for(let A of this.fields)if(A.property===T)return A;return}}wX.BitStructure=UQ;class YQ{constructor(T,A,Q){if(!(T instanceof UQ))throw TypeError("container must be a BitStructure");if(!Number.isInteger(A)||0>=A)throw TypeError("bits must be positive integer");let J=8*T.span,W=T.fields.reduce(($,G)=>$+G.bits,0);if(A+W>J)throw Error("bits too long for span remainder ("+(J-W)+" of "+J+" remain)");if(this.container=T,this.bits=A,this.valueMask=(1<<A)-1,A===32)this.valueMask=4294967295;if(this.start=W,this.container.msb)this.start=J-W-A;this.wordMask=gA(this.valueMask<<this.start),this.property=Q}decode(T,A){let Q=this.container._packedGetValue();return gA(Q&this.wordMask)>>>this.start}encode(T){if(typeof T!=="number"||!Number.isInteger(T)||T!==gA(T&this.valueMask))throw TypeError(NW("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);let A=this.container._packedGetValue(),Q=gA(T<<this.start);this.container._packedSetValue(gA(A&~this.wordMask)|Q)}}wX.BitField=YQ;class vW extends YQ{constructor(T,A){super(T,1,A)}decode(T,A){return!!super.decode(T,A)}encode(T){if(typeof T==="boolean")T=+T;super.encode(T)}}wX.Boolean=vW;class yW extends P1{constructor(T,A){if(!(T instanceof c0&&T.isCount()||Number.isInteger(T)&&0<=T))throw TypeError("length must be positive integer or an unsigned integer ExternalLayout");let Q=-1;if(!(T instanceof c0))Q=T;super(Q,A);this.length=T}getSpan(T,A){let Q=this.span;if(0>Q)Q=this.length.decode(T,A);return Q}decode(T,A=0){let Q=this.span;if(0>Q)Q=this.length.decode(T,A);return U1(T).slice(A,A+Q)}encode(T,A,Q){let J=this.length;if(this.length instanceof c0)J=T.length;if(!(T instanceof Uint8Array&&J===T.length))throw TypeError(NW("Blob.encode",this)+" requires (length "+J+") Uint8Array as src");if(Q+J>A.length)throw RangeError("encoding overruns Uint8Array");let W=U1(T);if(U1(A).write(W.toString("hex"),Q,J,"hex"),this.length instanceof c0)this.length.encode(J,A,Q);return J}}wX.Blob=yW;class bW extends P1{constructor(T){super(-1,T)}getSpan(T,A=0){mA(T);let Q=A;while(Q<T.length&&T[Q]!==0)Q+=1;return 1+Q-A}decode(T,A=0){let Q=this.getSpan(T,A);return U1(T).slice(A,A+Q-1).toString("utf-8")}encode(T,A,Q=0){if(typeof T!=="string")T=String(T);let J=FW.Buffer.from(T,"utf8"),W=J.length;if(Q+W>A.length)throw RangeError("encoding overruns Buffer");let $=U1(A);return J.copy($,Q),$[Q+W]=0,W+1}}wX.CString=bW;class pW extends P1{constructor(T,A){if(typeof T==="string"&&A===void 0)A=T,T=void 0;if(T===void 0)T=-1;else if(!Number.isInteger(T))throw TypeError("maxSpan must be an integer");super(-1,A);this.maxSpan=T}getSpan(T,A=0){return mA(T),T.length-A}decode(T,A=0){let Q=this.getSpan(T,A);if(0<=this.maxSpan&&this.maxSpan<Q)throw RangeError("text length exceeds maxSpan");return U1(T).slice(A,A+Q).toString("utf-8")}encode(T,A,Q=0){if(typeof T!=="string")T=String(T);let J=FW.Buffer.from(T,"utf8"),W=J.length;if(0<=this.maxSpan&&this.maxSpan<W)throw RangeError("text length exceeds maxSpan");if(Q+W>A.length)throw RangeError("encoding overruns Buffer");return J.copy(U1(A),Q),W}}wX.UTF8=pW;class lW extends P1{constructor(T,A){super(0,A);this.value=T}decode(T,A){return this.value}encode(T,A,Q){return 0}}wX.Constant=lW;wX.greedy=(T,A)=>new IW(T,A);wX.offset=(T,A,Q)=>new QQ(T,A,Q);wX.u8=(T)=>new UT(1,T);wX.u16=(T)=>new UT(2,T);wX.u24=(T)=>new UT(3,T);wX.u32=(T)=>new UT(4,T);wX.u40=(T)=>new UT(5,T);wX.u48=(T)=>new UT(6,T);wX.nu64=(T)=>new SW(T);wX.u16be=(T)=>new HT(2,T);wX.u24be=(T)=>new HT(3,T);wX.u32be=(T)=>new HT(4,T);wX.u40be=(T)=>new HT(5,T);wX.u48be=(T)=>new HT(6,T);wX.nu64be=(T)=>new LW(T);wX.s8=(T)=>new _8(1,T);wX.s16=(T)=>new _8(2,T);wX.s24=(T)=>new _8(3,T);wX.s32=(T)=>new _8(4,T);wX.s40=(T)=>new _8(5,T);wX.s48=(T)=>new _8(6,T);wX.ns64=(T)=>new wW(T);wX.s16be=(T)=>new YA(2,T);wX.s24be=(T)=>new YA(3,T);wX.s32be=(T)=>new YA(4,T);wX.s40be=(T)=>new YA(5,T);wX.s48be=(T)=>new YA(6,T);wX.ns64be=(T)=>new EW(T);wX.f32=(T)=>new OW(T);wX.f32be=(T)=>new BW(T);wX.f64=(T)=>new _W(T);wX.f64be=(T)=>new xW(T);wX.struct=(T,A,Q)=>new gW(T,A,Q);wX.bits=(T,A,Q)=>new UQ(T,A,Q);wX.seq=(T,A,Q)=>new hW(T,A,Q);wX.union=(T,A,Q)=>new GQ(T,A,Q);wX.unionLayoutDiscriminator=(T,A)=>new F2(T,A);wX.blob=(T,A)=>new yW(T,A);wX.cstr=(T)=>new bW(T);wX.utf8=(T,A)=>new pW(T,A);wX.constant=(T,A)=>new lW(T,A)});function S2(){if(!qQ){if(qQ=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues==="function"&&msCrypto.getRandomValues.bind(msCrypto),!qQ)throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported")}return qQ(DF)}var qQ,DF;var sW=w0(()=>{DF=new Uint8Array(16)});var oX;var aX=w0(()=>{oX=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i});function MF(T){return typeof T==="string"&&oX.test(T)}var h8;var L2=w0(()=>{aX();h8=MF});function kF(T){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,Q=(L0[T[A+0]]+L0[T[A+1]]+L0[T[A+2]]+L0[T[A+3]]+"-"+L0[T[A+4]]+L0[T[A+5]]+"-"+L0[T[A+6]]+L0[T[A+7]]+"-"+L0[T[A+8]]+L0[T[A+9]]+"-"+L0[T[A+10]]+L0[T[A+11]]+L0[T[A+12]]+L0[T[A+13]]+L0[T[A+14]]+L0[T[A+15]]).toLowerCase();if(!h8(Q))throw TypeError("Stringified UUID is invalid");return Q}var L0,w2,g8;var E2=w0(()=>{L2();L0=[];for(w2=0;w2<256;++w2)L0.push((w2+256).toString(16).substr(1));g8=kF});function zF(T,A,Q){var J=A&&Q||0,W=A||Array(16);T=T||{};var $=T.node||sX,G=T.clockseq!==void 0?T.clockseq:tW;if($==null||G==null){var Y=T.random||(T.rng||S2)();if($==null)$=sX=[Y[0]|1,Y[1],Y[2],Y[3],Y[4],Y[5]];if(G==null)G=tW=(Y[6]<<8|Y[7])&16383}var Z=T.msecs!==void 0?T.msecs:Date.now(),C=T.nsecs!==void 0?T.nsecs:T$+1,K=Z-eW+(C-T$)/1e4;if(K<0&&T.clockseq===void 0)G=G+1&16383;if((K<0||Z>eW)&&T.nsecs===void 0)C=0;if(C>=1e4)throw Error("uuid.v1(): Can't create more than 10M uuids/sec");eW=Z,T$=C,tW=G,Z+=12219292800000;var V=((Z&268435455)*1e4+C)%4294967296;W[J++]=V>>>24&255,W[J++]=V>>>16&255,W[J++]=V>>>8&255,W[J++]=V&255;var M=Z/4294967296*1e4&268435455;W[J++]=M>>>8&255,W[J++]=M&255,W[J++]=M>>>24&15|16,W[J++]=M>>>16&255,W[J++]=G>>>8|128,W[J++]=G&255;for(var z=0;z<6;++z)W[J+z]=$[z];return A||g8(W)}var sX,tW,eW=0,T$=0,tX;var eX=w0(()=>{sW();E2();tX=zF});function FF(T){if(!h8(T))throw TypeError("Invalid UUID");var A,Q=new Uint8Array(16);return Q[0]=(A=parseInt(T.slice(0,8),16))>>>24,Q[1]=A>>>16&255,Q[2]=A>>>8&255,Q[3]=A&255,Q[4]=(A=parseInt(T.slice(9,13),16))>>>8,Q[5]=A&255,Q[6]=(A=parseInt(T.slice(14,18),16))>>>8,Q[7]=A&255,Q[8]=(A=parseInt(T.slice(19,23),16))>>>8,Q[9]=A&255,Q[10]=(A=parseInt(T.slice(24,36),16))/1099511627776&255,Q[11]=A/4294967296&255,Q[12]=A>>>24&255,Q[13]=A>>>16&255,Q[14]=A>>>8&255,Q[15]=A&255,Q}var KQ;var A$=w0(()=>{L2();KQ=FF});function NF(T){T=unescape(encodeURIComponent(T));var A=[];for(var Q=0;Q<T.length;++Q)A.push(T.charCodeAt(Q));return A}function O2(T,A,Q){function J(W,$,G,Y){if(typeof W==="string")W=NF(W);if(typeof $==="string")$=KQ($);if($.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var Z=new Uint8Array(16+W.length);if(Z.set($),Z.set(W,$.length),Z=Q(Z),Z[6]=Z[6]&15|A,Z[8]=Z[8]&63|128,G){Y=Y||0;for(var C=0;C<16;++C)G[Y+C]=Z[C];return G}return g8(Z)}try{J.name=T}catch(W){}return J.DNS=IF,J.URL=SF,J}var IF="6ba7b810-9dad-11d1-80b4-00c04fd430c8",SF="6ba7b811-9dad-11d1-80b4-00c04fd430c8";var Q$=w0(()=>{E2();A$()});function LF(T){if(typeof T==="string"){var A=unescape(encodeURIComponent(T));T=new Uint8Array(A.length);for(var Q=0;Q<A.length;++Q)T[Q]=A.charCodeAt(Q)}return wF(EF(OF(T),T.length*8))}function wF(T){var A=[],Q=T.length*32,J="0123456789abcdef";for(var W=0;W<Q;W+=8){var $=T[W>>5]>>>W%32&255,G=parseInt(J.charAt($>>>4&15)+J.charAt($&15),16);A.push(G)}return A}function T9(T){return(T+64>>>9<<4)+14+1}function EF(T,A){T[A>>5]|=128<<A%32,T[T9(A)-1]=A;var Q=1732584193,J=-271733879,W=-1732584194,$=271733878;for(var G=0;G<T.length;G+=16){var Y=Q,Z=J,C=W,K=$;Q=x0(Q,J,W,$,T[G],7,-680876936),$=x0($,Q,J,W,T[G+1],12,-389564586),W=x0(W,$,Q,J,T[G+2],17,606105819),J=x0(J,W,$,Q,T[G+3],22,-1044525330),Q=x0(Q,J,W,$,T[G+4],7,-176418897),$=x0($,Q,J,W,T[G+5],12,1200080426),W=x0(W,$,Q,J,T[G+6],17,-1473231341),J=x0(J,W,$,Q,T[G+7],22,-45705983),Q=x0(Q,J,W,$,T[G+8],7,1770035416),$=x0($,Q,J,W,T[G+9],12,-1958414417),W=x0(W,$,Q,J,T[G+10],17,-42063),J=x0(J,W,$,Q,T[G+11],22,-1990404162),Q=x0(Q,J,W,$,T[G+12],7,1804603682),$=x0($,Q,J,W,T[G+13],12,-40341101),W=x0(W,$,Q,J,T[G+14],17,-1502002290),J=x0(J,W,$,Q,T[G+15],22,1236535329),Q=h0(Q,J,W,$,T[G+1],5,-165796510),$=h0($,Q,J,W,T[G+6],9,-1069501632),W=h0(W,$,Q,J,T[G+11],14,643717713),J=h0(J,W,$,Q,T[G],20,-373897302),Q=h0(Q,J,W,$,T[G+5],5,-701558691),$=h0($,Q,J,W,T[G+10],9,38016083),W=h0(W,$,Q,J,T[G+15],14,-660478335),J=h0(J,W,$,Q,T[G+4],20,-405537848),Q=h0(Q,J,W,$,T[G+9],5,568446438),$=h0($,Q,J,W,T[G+14],9,-1019803690),W=h0(W,$,Q,J,T[G+3],14,-187363961),J=h0(J,W,$,Q,T[G+8],20,1163531501),Q=h0(Q,J,W,$,T[G+13],5,-1444681467),$=h0($,Q,J,W,T[G+2],9,-51403784),W=h0(W,$,Q,J,T[G+7],14,1735328473),J=h0(J,W,$,Q,T[G+12],20,-1926607734),Q=g0(Q,J,W,$,T[G+5],4,-378558),$=g0($,Q,J,W,T[G+8],11,-2022574463),W=g0(W,$,Q,J,T[G+11],16,1839030562),J=g0(J,W,$,Q,T[G+14],23,-35309556),Q=g0(Q,J,W,$,T[G+1],4,-1530992060),$=g0($,Q,J,W,T[G+4],11,1272893353),W=g0(W,$,Q,J,T[G+7],16,-155497632),J=g0(J,W,$,Q,T[G+10],23,-1094730640),Q=g0(Q,J,W,$,T[G+13],4,681279174),$=g0($,Q,J,W,T[G],11,-358537222),W=g0(W,$,Q,J,T[G+3],16,-722521979),J=g0(J,W,$,Q,T[G+6],23,76029189),Q=g0(Q,J,W,$,T[G+9],4,-640364487),$=g0($,Q,J,W,T[G+12],11,-421815835),W=g0(W,$,Q,J,T[G+15],16,530742520),J=g0(J,W,$,Q,T[G+2],23,-995338651),Q=m0(Q,J,W,$,T[G],6,-198630844),$=m0($,Q,J,W,T[G+7],10,1126891415),W=m0(W,$,Q,J,T[G+14],15,-1416354905),J=m0(J,W,$,Q,T[G+5],21,-57434055),Q=m0(Q,J,W,$,T[G+12],6,1700485571),$=m0($,Q,J,W,T[G+3],10,-1894986606),W=m0(W,$,Q,J,T[G+10],15,-1051523),J=m0(J,W,$,Q,T[G+1],21,-2054922799),Q=m0(Q,J,W,$,T[G+8],6,1873313359),$=m0($,Q,J,W,T[G+15],10,-30611744),W=m0(W,$,Q,J,T[G+6],15,-1560198380),J=m0(J,W,$,Q,T[G+13],21,1309151649),Q=m0(Q,J,W,$,T[G+4],6,-145523070),$=m0($,Q,J,W,T[G+11],10,-1120210379),W=m0(W,$,Q,J,T[G+2],15,718787259),J=m0(J,W,$,Q,T[G+9],21,-343485551),Q=m8(Q,Y),J=m8(J,Z),W=m8(W,C),$=m8($,K)}return[Q,J,W,$]}function OF(T){if(T.length===0)return[];var A=T.length*8,Q=new Uint32Array(T9(A));for(var J=0;J<A;J+=8)Q[J>>5]|=(T[J/8]&255)<<J%32;return Q}function m8(T,A){var Q=(T&65535)+(A&65535),J=(T>>16)+(A>>16)+(Q>>16);return J<<16|Q&65535}function BF(T,A){return T<<A|T>>>32-A}function CQ(T,A,Q,J,W,$){return m8(BF(m8(m8(A,T),m8(J,$)),W),Q)}function x0(T,A,Q,J,W,$,G){return CQ(A&Q|~A&J,T,A,W,$,G)}function h0(T,A,Q,J,W,$,G){return CQ(A&J|Q&~J,T,A,W,$,G)}function g0(T,A,Q,J,W,$,G){return CQ(A^Q^J,T,A,W,$,G)}function m0(T,A,Q,J,W,$,G){return CQ(Q^(A|~J),T,A,W,$,G)}var A9;var Q9=w0(()=>{A9=LF});var _F,J9;var W9=w0(()=>{Q$();Q9();_F=O2("v3",48,A9),J9=_F});function xF(T,A,Q){T=T||{};var J=T.random||(T.rng||S2)();if(J[6]=J[6]&15|64,J[8]=J[8]&63|128,A){Q=Q||0;for(var W=0;W<16;++W)A[Q+W]=J[W];return A}return g8(J)}var $9;var G9=w0(()=>{sW();E2();$9=xF});function hF(T,A,Q,J){switch(T){case 0:return A&Q^~A&J;case 1:return A^Q^J;case 2:return A&Q^A&J^Q&J;case 3:return A^Q^J}}function J$(T,A){return T<<A|T>>>32-A}function gF(T){var A=[1518500249,1859775393,2400959708,3395469782],Q=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof T==="string"){var J=unescape(encodeURIComponent(T));T=[];for(var W=0;W<J.length;++W)T.push(J.charCodeAt(W))}else if(!Array.isArray(T))T=Array.prototype.slice.call(T);T.push(128);var $=T.length/4+2,G=Math.ceil($/16),Y=Array(G);for(var Z=0;Z<G;++Z){var C=new Uint32Array(16);for(var K=0;K<16;++K)C[K]=T[Z*64+K*4]<<24|T[Z*64+K*4+1]<<16|T[Z*64+K*4+2]<<8|T[Z*64+K*4+3];Y[Z]=C}Y[G-1][14]=(T.length-1)*8/Math.pow(2,32),Y[G-1][14]=Math.floor(Y[G-1][14]),Y[G-1][15]=(T.length-1)*8&4294967295;for(var V=0;V<G;++V){var M=new Uint32Array(80);for(var z=0;z<16;++z)M[z]=Y[V][z];for(var N=16;N<80;++N)M[N]=J$(M[N-3]^M[N-8]^M[N-14]^M[N-16],1);var w=Q[0],L=Q[1],O=Q[2],g=Q[3],v=Q[4];for(var p=0;p<80;++p){var d=Math.floor(p/20),c=J$(w,5)+hF(d,L,O,g)+v+A[d]+M[p]>>>0;v=g,g=O,O=J$(L,30)>>>0,L=w,w=c}Q[0]=Q[0]+w>>>0,Q[1]=Q[1]+L>>>0,Q[2]=Q[2]+O>>>0,Q[3]=Q[3]+g>>>0,Q[4]=Q[4]+v>>>0}return[Q[0]>>24&255,Q[0]>>16&255,Q[0]>>8&255,Q[0]&255,Q[1]>>24&255,Q[1]>>16&255,Q[1]>>8&255,Q[1]&255,Q[2]>>24&255,Q[2]>>16&255,Q[2]>>8&255,Q[2]&255,Q[3]>>24&255,Q[3]>>16&255,Q[3]>>8&255,Q[3]&255,Q[4]>>24&255,Q[4]>>16&255,Q[4]>>8&255,Q[4]&255]}var U9;var Y9=w0(()=>{U9=gF});var mF,Z9;var X9=w0(()=>{Q$();Y9();mF=O2("v5",80,U9),Z9=mF});var P9="00000000-0000-0000-0000-000000000000";function yF(T){if(!h8(T))throw TypeError("Invalid UUID");return parseInt(T.substr(14,1),16)}var q9;var K9=w0(()=>{L2();q9=yF});var W$={};U4(W$,{version:()=>q9,validate:()=>h8,v5:()=>Z9,v4:()=>$9,v3:()=>J9,v1:()=>tX,stringify:()=>g8,parse:()=>KQ,NIL:()=>P9});var $$=w0(()=>{eX();W9();G9();X9();K9();L2();E2();A$()});var H9=YT(($x,C9)=>{var bF=($$(),VA(W$)).v4,pF=function(T,A,Q,J){if(typeof T!=="string")throw TypeError(T+" must be a string");J=J||{};let W=typeof J.version==="number"?J.version:2;if(W!==1&&W!==2)throw TypeError(W+" must be 1 or 2");let $={method:T};if(W===2)$.jsonrpc="2.0";if(A){if(typeof A!=="object"&&!Array.isArray(A))throw TypeError(A+" must be an object, array or omitted");$.params=A}if(typeof Q>"u"){let G=typeof J.generator==="function"?J.generator:function(){return bF()};$.id=G($,J)}else if(W===2&&Q===null){if(J.notificationIdNull)$.id=null}else $.id=Q;return $};C9.exports=pF});var j9=YT((Gx,V9)=>{var lF=($$(),VA(W$)).v4,uF=H9(),B2=function(T,A){if(!(this instanceof B2))return new B2(T,A);if(!A)A={};this.options={reviver:typeof A.reviver<"u"?A.reviver:null,replacer:typeof A.replacer<"u"?A.replacer:null,generator:typeof A.generator<"u"?A.generator:function(){return lF()},version:typeof A.version<"u"?A.version:2,notificationIdNull:typeof A.notificationIdNull==="boolean"?A.notificationIdNull:!1},this.callServer=T};V9.exports=B2;B2.prototype.request=function(T,A,Q,J){let W=this,$=null,G=Array.isArray(T)&&typeof A==="function";if(this.options.version===1&&G)throw TypeError("JSON-RPC 1.0 does not support batching");if(G||!G&&T&&typeof T==="object"&&typeof A==="function")J=A,$=T;else{if(typeof Q==="function")J=Q,Q=void 0;let C=typeof J==="function";try{$=uF(T,A,Q,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(K){if(C)return J(K);throw K}if(!C)return $}let Z;try{Z=JSON.stringify($,this.options.replacer)}catch(C){return J(C)}return this.callServer(Z,function(C,K){W._parseResponse(C,K,J)}),$};B2.prototype._parseResponse=function(T,A,Q){if(T){Q(T);return}if(!A)return Q();let J;try{J=JSON.parse(A,this.options.reviver)}catch(W){return Q(W)}if(Q.length===3)if(Array.isArray(J)){let W=function(G){return typeof G.error<"u"},$=function(G){return!W(G)};return Q(null,J.filter(W),J.filter($))}else return Q(null,J.error,J.result);Q(null,J)}});var D9=YT((Ux,G$)=>{var dF=Object.prototype.hasOwnProperty,f0="~";function _2(){}if(Object.create){if(_2.prototype=Object.create(null),!new _2().__proto__)f0=!1}function cF(T,A,Q){this.fn=T,this.context=A,this.once=Q||!1}function R9(T,A,Q,J,W){if(typeof Q!=="function")throw TypeError("The listener must be a function");var $=new cF(Q,J||T,W),G=f0?f0+A:A;if(!T._events[G])T._events[G]=$,T._eventsCount++;else if(!T._events[G].fn)T._events[G].push($);else T._events[G]=[T._events[G],$];return T}function HQ(T,A){if(--T._eventsCount===0)T._events=new _2;else delete T._events[A]}function v0(){this._events=new _2,this._eventsCount=0}v0.prototype.eventNames=function(){var A=[],Q,J;if(this._eventsCount===0)return A;for(J in Q=this._events)if(dF.call(Q,J))A.push(f0?J.slice(1):J);if(Object.getOwnPropertySymbols)return A.concat(Object.getOwnPropertySymbols(Q));return A};v0.prototype.listeners=function(A){var Q=f0?f0+A:A,J=this._events[Q];if(!J)return[];if(J.fn)return[J.fn];for(var W=0,$=J.length,G=Array($);W<$;W++)G[W]=J[W].fn;return G};v0.prototype.listenerCount=function(A){var Q=f0?f0+A:A,J=this._events[Q];if(!J)return 0;if(J.fn)return 1;return J.length};v0.prototype.emit=function(A,Q,J,W,$,G){var Y=f0?f0+A:A;if(!this._events[Y])return!1;var Z=this._events[Y],C=arguments.length,K,V;if(Z.fn){if(Z.once)this.removeListener(A,Z.fn,void 0,!0);switch(C){case 1:return Z.fn.call(Z.context),!0;case 2:return Z.fn.call(Z.context,Q),!0;case 3:return Z.fn.call(Z.context,Q,J),!0;case 4:return Z.fn.call(Z.context,Q,J,W),!0;case 5:return Z.fn.call(Z.context,Q,J,W,$),!0;case 6:return Z.fn.call(Z.context,Q,J,W,$,G),!0}for(V=1,K=Array(C-1);V<C;V++)K[V-1]=arguments[V];Z.fn.apply(Z.context,K)}else{var M=Z.length,z;for(V=0;V<M;V++){if(Z[V].once)this.removeListener(A,Z[V].fn,void 0,!0);switch(C){case 1:Z[V].fn.call(Z[V].context);break;case 2:Z[V].fn.call(Z[V].context,Q);break;case 3:Z[V].fn.call(Z[V].context,Q,J);break;case 4:Z[V].fn.call(Z[V].context,Q,J,W);break;default:if(!K)for(z=1,K=Array(C-1);z<C;z++)K[z-1]=arguments[z];Z[V].fn.apply(Z[V].context,K)}}}return!0};v0.prototype.on=function(A,Q,J){return R9(this,A,Q,J,!1)};v0.prototype.once=function(A,Q,J){return R9(this,A,Q,J,!0)};v0.prototype.removeListener=function(A,Q,J,W){var $=f0?f0+A:A;if(!this._events[$])return this;if(!Q)return HQ(this,$),this;var G=this._events[$];if(G.fn){if(G.fn===Q&&(!W||G.once)&&(!J||G.context===J))HQ(this,$)}else{for(var Y=0,Z=[],C=G.length;Y<C;Y++)if(G[Y].fn!==Q||W&&!G[Y].once||J&&G[Y].context!==J)Z.push(G[Y]);if(Z.length)this._events[$]=Z.length===1?Z[0]:Z;else HQ(this,$)}return this};v0.prototype.removeAllListeners=function(A){var Q;if(A){if(Q=f0?f0+A:A,this._events[Q])HQ(this,Q)}else this._events=new _2,this._eventsCount=0;return this};v0.prototype.off=v0.prototype.removeListener;v0.prototype.addListener=v0.prototype.on;v0.prefixed=f0;v0.EventEmitter=v0;if(typeof G$<"u")G$.exports=v0});var RP=YT((jP)=>{Object.defineProperty(jP,"__esModule",{value:!0});var wQ;function AI(T){{let A=Buffer.from(T);A.reverse();let Q=A.toString("hex");if(Q.length===0)return BigInt(0);return BigInt(`0x${Q}`)}return wQ.toBigInt(T,!1)}jP.toBigIntLE=AI;function QI(T){{let A=T.toString("hex");if(A.length===0)return BigInt(0);return BigInt(`0x${A}`)}return wQ.toBigInt(T,!0)}jP.toBigIntBE=QI;function JI(T,A){{let Q=T.toString(16),J=Buffer.from(Q.padStart(A*2,"0").slice(0,A*2),"hex");return J.reverse(),J}return wQ.fromBigInt(T,Buffer.allocUnsafe(A),!1)}jP.toBufferLE=JI;function WI(T,A){{let Q=T.toString(16);return Buffer.from(Q.padStart(A*2,"0").slice(0,A*2),"hex")}return wQ.fromBigInt(T,Buffer.allocUnsafe(A),!0)}jP.toBufferBE=WI});/*!
|
|
1
|
+
var jq=Object.create;var{getPrototypeOf:Rq,defineProperty:A2,getOwnPropertyNames:KG,getOwnPropertyDescriptor:Dq}=Object,CG=Object.prototype.hasOwnProperty;var n0=(T,A,Q)=>{Q=T!=null?jq(Rq(T)):{};let J=A||!T||!T.__esModule?A2(Q,"default",{value:T,enumerable:!0}):Q;for(let $ of KG(T))if(!CG.call(J,$))A2(J,$,{get:()=>T[$],enumerable:!0});return J},qG=new WeakMap,VA=(T)=>{var A=qG.get(T),Q;if(A)return A;if(A=A2({},"__esModule",{value:!0}),T&&typeof T==="object"||typeof T==="function")KG(T).map((J)=>!CG.call(A,J)&&A2(A,J,{get:()=>T[J],enumerable:!(Q=Dq(T,J))||Q.enumerable}));return qG.set(T,A),A},ZT=(T,A)=>()=>(A||T((A={exports:{}}).exports,A),A.exports);var P4=(T,A)=>{for(var Q in A)A2(T,Q,{get:A[Q],enumerable:!0,configurable:!0,set:(J)=>A[Q]=()=>J})};var w0=(T,A)=>()=>(T&&(A=T(T=0)),A);var VG=ZT((Lq)=>{Lq.byteLength=kq;Lq.toByteArray=Fq;Lq.fromByteArray=Sq;var NT=[],XT=[],Mq=typeof Uint8Array<"u"?Uint8Array:Array,q4="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(q8=0,K4=q4.length;q8<K4;++q8)NT[q8]=q4[q8],XT[q4.charCodeAt(q8)]=q8;var q8,K4;XT[45]=62;XT[95]=63;function HG(T){var A=T.length;if(A%4>0)throw Error("Invalid string. Length must be a multiple of 4");var Q=T.indexOf("=");if(Q===-1)Q=A;var J=Q===A?0:4-Q%4;return[Q,J]}function kq(T){var A=HG(T),Q=A[0],J=A[1];return(Q+J)*3/4-J}function zq(T,A,Q){return(A+Q)*3/4-Q}function Fq(T){var A,Q=HG(T),J=Q[0],$=Q[1],W=new Mq(zq(T,J,$)),G=0,Y=$>0?J-4:J,Z;for(Z=0;Z<Y;Z+=4)A=XT[T.charCodeAt(Z)]<<18|XT[T.charCodeAt(Z+1)]<<12|XT[T.charCodeAt(Z+2)]<<6|XT[T.charCodeAt(Z+3)],W[G++]=A>>16&255,W[G++]=A>>8&255,W[G++]=A&255;if($===2)A=XT[T.charCodeAt(Z)]<<2|XT[T.charCodeAt(Z+1)]>>4,W[G++]=A&255;if($===1)A=XT[T.charCodeAt(Z)]<<10|XT[T.charCodeAt(Z+1)]<<4|XT[T.charCodeAt(Z+2)]>>2,W[G++]=A>>8&255,W[G++]=A&255;return W}function Nq(T){return NT[T>>18&63]+NT[T>>12&63]+NT[T>>6&63]+NT[T&63]}function Iq(T,A,Q){var J,$=[];for(var W=A;W<Q;W+=3)J=(T[W]<<16&16711680)+(T[W+1]<<8&65280)+(T[W+2]&255),$.push(Nq(J));return $.join("")}function Sq(T){var A,Q=T.length,J=Q%3,$=[],W=16383;for(var G=0,Y=Q-J;G<Y;G+=W)$.push(Iq(T,G,G+W>Y?Y:G+W));if(J===1)A=T[Q-1],$.push(NT[A>>2]+NT[A<<4&63]+"==");else if(J===2)A=(T[Q-2]<<8)+T[Q-1],$.push(NT[A>>10]+NT[A>>4&63]+NT[A<<2&63]+"=");return $.join("")}});var jG=ZT((Bq)=>{/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */Bq.read=function(T,A,Q,J,$){var W,G,Y=$*8-J-1,Z=(1<<Y)-1,C=Z>>1,K=-7,j=Q?$-1:0,M=Q?-1:1,z=T[A+j];j+=M,W=z&(1<<-K)-1,z>>=-K,K+=Y;for(;K>0;W=W*256+T[A+j],j+=M,K-=8);G=W&(1<<-K)-1,W>>=-K,K+=J;for(;K>0;G=G*256+T[A+j],j+=M,K-=8);if(W===0)W=1-C;else if(W===Z)return G?NaN:(z?-1:1)*(1/0);else G=G+Math.pow(2,J),W=W-C;return(z?-1:1)*G*Math.pow(2,W-J)};Bq.write=function(T,A,Q,J,$,W){var G,Y,Z,C=W*8-$-1,K=(1<<C)-1,j=K>>1,M=$===23?Math.pow(2,-24)-Math.pow(2,-77):0,z=J?0:W-1,N=J?1:-1,E=A<0||A===0&&1/A<0?1:0;if(A=Math.abs(A),isNaN(A)||A===1/0)Y=isNaN(A)?1:0,G=K;else{if(G=Math.floor(Math.log(A)/Math.LN2),A*(Z=Math.pow(2,-G))<1)G--,Z*=2;if(G+j>=1)A+=M/Z;else A+=M*Math.pow(2,1-j);if(A*Z>=2)G++,Z/=2;if(G+j>=K)Y=0,G=K;else if(G+j>=1)Y=(A*Z-1)*Math.pow(2,$),G=G+j;else Y=A*Math.pow(2,j-1)*Math.pow(2,$),G=0}for(;$>=8;T[Q+z]=Y&255,z+=N,Y/=256,$-=8);G=G<<$|Y,C+=$;for(;C>0;T[Q+z]=G&255,z+=N,G/=256,C-=8);T[Q+z-N]|=E*128}});var l6={};P4(l6,{transcode:()=>Lj,resolveObjectURL:()=>Nj,kStringMaxLength:()=>MZ,kMaxLength:()=>V2,isUtf8:()=>Ij,isAscii:()=>Sj,default:()=>wj,constants:()=>t5,btoa:()=>i5,atob:()=>o5,INSPECT_MAX_BYTES:()=>DZ,File:()=>a5,Buffer:()=>w,Blob:()=>s5});function d5(T){var A=T.length;if(A%4>0)throw Error("Invalid string. Length must be a multiple of 4");var Q=T.indexOf("=");if(Q===-1)Q=A;var J=Q===A?0:4-Q%4;return[Q,J]}function c5(T,A){return(T+A)*3/4-A}function f5(T){var A,Q=d5(T),J=Q[0],$=Q[1],W=new Uint8Array(c5(J,$)),G=0,Y=$>0?J-4:J,Z;for(Z=0;Z<Y;Z+=4)A=KT[T.charCodeAt(Z)]<<18|KT[T.charCodeAt(Z+1)]<<12|KT[T.charCodeAt(Z+2)]<<6|KT[T.charCodeAt(Z+3)],W[G++]=A>>16&255,W[G++]=A>>8&255,W[G++]=A&255;if($===2)A=KT[T.charCodeAt(Z)]<<2|KT[T.charCodeAt(Z+1)]>>4,W[G++]=A&255;if($===1)A=KT[T.charCodeAt(Z)]<<10|KT[T.charCodeAt(Z+1)]<<4|KT[T.charCodeAt(Z+2)]>>2,W[G++]=A>>8&255,W[G++]=A&255;return W}function r5(T){return hT[T>>18&63]+hT[T>>12&63]+hT[T>>6&63]+hT[T&63]}function n5(T,A,Q){var J,$=[];for(var W=A;W<Q;W+=3)J=(T[W]<<16&16711680)+(T[W+1]<<8&65280)+(T[W+2]&255),$.push(r5(J));return $.join("")}function KZ(T){var A,Q=T.length,J=Q%3,$=[],W=16383;for(var G=0,Y=Q-J;G<Y;G+=W)$.push(n5(T,G,G+W>Y?Y:G+W));if(J===1)A=T[Q-1],$.push(hT[A>>2]+hT[A<<4&63]+"==");else if(J===2)A=(T[Q-2]<<8)+T[Q-1],$.push(hT[A>>10]+hT[A>>4&63]+hT[A<<2&63]+"=");return $.join("")}function b6(T,A,Q,J,$){var W,G,Y=$*8-J-1,Z=(1<<Y)-1,C=Z>>1,K=-7,j=Q?$-1:0,M=Q?-1:1,z=T[A+j];j+=M,W=z&(1<<-K)-1,z>>=-K,K+=Y;for(;K>0;W=W*256+T[A+j],j+=M,K-=8);G=W&(1<<-K)-1,W>>=-K,K+=J;for(;K>0;G=G*256+T[A+j],j+=M,K-=8);if(W===0)W=1-C;else if(W===Z)return G?NaN:(z?-1:1)*(1/0);else G=G+Math.pow(2,J),W=W-C;return(z?-1:1)*G*Math.pow(2,W-J)}function RZ(T,A,Q,J,$,W){var G,Y,Z,C=W*8-$-1,K=(1<<C)-1,j=K>>1,M=$===23?Math.pow(2,-24)-Math.pow(2,-77):0,z=J?0:W-1,N=J?1:-1,E=A<0||A===0&&1/A<0?1:0;if(A=Math.abs(A),isNaN(A)||A===1/0)Y=isNaN(A)?1:0,G=K;else{if(G=Math.floor(Math.log(A)/Math.LN2),A*(Z=Math.pow(2,-G))<1)G--,Z*=2;if(G+j>=1)A+=M/Z;else A+=M*Math.pow(2,1-j);if(A*Z>=2)G++,Z/=2;if(G+j>=K)Y=0,G=K;else if(G+j>=1)Y=(A*Z-1)*Math.pow(2,$),G=G+j;else Y=A*Math.pow(2,j-1)*Math.pow(2,$),G=0}for(;$>=8;T[Q+z]=Y&255,z+=N,Y/=256,$-=8);G=G<<$|Y,C+=$;for(;C>0;T[Q+z]=G&255,z+=N,G/=256,C-=8);T[Q+z-N]|=E*128}function oT(T){if(T>V2)throw RangeError('The value "'+T+'" is invalid for option "size"');let A=new Uint8Array(T);return Object.setPrototypeOf(A,w.prototype),A}function lJ(T,A,Q){return class extends Q{constructor(){super();Object.defineProperty(this,"message",{value:A.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${T}]`,this.stack,delete this.name}get code(){return T}set code(J){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:J,writable:!0})}toString(){return`${this.name} [${T}]: ${this.message}`}}}function w(T,A,Q){if(typeof T==="number"){if(typeof A==="string")throw TypeError('The "string" argument must be of type string. Received type number');return uJ(T)}return kZ(T,A,Q)}function kZ(T,A,Q){if(typeof T==="string")return Qj(T,A);if(ArrayBuffer.isView(T))return Jj(T);if(T==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T);if(gT(T,ArrayBuffer)||T&&gT(T.buffer,ArrayBuffer))return bJ(T,A,Q);if(typeof SharedArrayBuffer<"u"&&(gT(T,SharedArrayBuffer)||T&&gT(T.buffer,SharedArrayBuffer)))return bJ(T,A,Q);if(typeof T==="number")throw TypeError('The "value" argument must not be of type number. Received type number');let J=T.valueOf&&T.valueOf();if(J!=null&&J!==T)return w.from(J,A,Q);let $=$j(T);if($)return $;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof T[Symbol.toPrimitive]==="function")return w.from(T[Symbol.toPrimitive]("string"),A,Q);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T)}function zZ(T){if(typeof T!=="number")throw TypeError('"size" argument must be of type number');else if(T<0)throw RangeError('The value "'+T+'" is invalid for option "size"')}function Aj(T,A,Q){if(zZ(T),T<=0)return oT(T);if(A!==void 0)return typeof Q==="string"?oT(T).fill(A,Q):oT(T).fill(A);return oT(T)}function uJ(T){return zZ(T),oT(T<0?0:dJ(T)|0)}function Qj(T,A){if(typeof A!=="string"||A==="")A="utf8";if(!w.isEncoding(A))throw TypeError("Unknown encoding: "+A);let Q=FZ(T,A)|0,J=oT(Q),$=J.write(T,A);if($!==Q)J=J.slice(0,$);return J}function yJ(T){let A=T.length<0?0:dJ(T.length)|0,Q=oT(A);for(let J=0;J<A;J+=1)Q[J]=T[J]&255;return Q}function Jj(T){if(gT(T,Uint8Array)){let A=new Uint8Array(T);return bJ(A.buffer,A.byteOffset,A.byteLength)}return yJ(T)}function bJ(T,A,Q){if(A<0||T.byteLength<A)throw RangeError('"offset" is outside of buffer bounds');if(T.byteLength<A+(Q||0))throw RangeError('"length" is outside of buffer bounds');let J;if(A===void 0&&Q===void 0)J=new Uint8Array(T);else if(Q===void 0)J=new Uint8Array(T,A);else J=new Uint8Array(T,A,Q);return Object.setPrototypeOf(J,w.prototype),J}function $j(T){if(w.isBuffer(T)){let A=dJ(T.length)|0,Q=oT(A);if(Q.length===0)return Q;return T.copy(Q,0,0,A),Q}if(T.length!==void 0){if(typeof T.length!=="number"||Number.isNaN(T.length))return oT(0);return yJ(T)}if(T.type==="Buffer"&&Array.isArray(T.data))return yJ(T.data)}function dJ(T){if(T>=V2)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+V2.toString(16)+" bytes");return T|0}function FZ(T,A){if(w.isBuffer(T))return T.length;if(ArrayBuffer.isView(T)||gT(T,ArrayBuffer))return T.byteLength;if(typeof T!=="string")throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof T);let Q=T.length,J=arguments.length>2&&arguments[2]===!0;if(!J&&Q===0)return 0;let $=!1;for(;;)switch(A){case"ascii":case"latin1":case"binary":return Q;case"utf8":case"utf-8":return pJ(T).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Q*2;case"hex":return Q>>>1;case"base64":return _Z(T).length;default:if($)return J?-1:pJ(T).length;A=(""+A).toLowerCase(),$=!0}}function Wj(T,A,Q){let J=!1;if(A===void 0||A<0)A=0;if(A>this.length)return"";if(Q===void 0||Q>this.length)Q=this.length;if(Q<=0)return"";if(Q>>>=0,A>>>=0,Q<=A)return"";if(!T)T="utf8";while(!0)switch(T){case"hex":return Hj(this,A,Q);case"utf8":case"utf-8":return IZ(this,A,Q);case"ascii":return Kj(this,A,Q);case"latin1":case"binary":return Cj(this,A,Q);case"base64":return Pj(this,A,Q);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Vj(this,A,Q);default:if(J)throw TypeError("Unknown encoding: "+T);T=(T+"").toLowerCase(),J=!0}}function a8(T,A,Q){let J=T[A];T[A]=T[Q],T[Q]=J}function NZ(T,A,Q,J,$){if(T.length===0)return-1;if(typeof Q==="string")J=Q,Q=0;else if(Q>2147483647)Q=2147483647;else if(Q<-2147483648)Q=-2147483648;if(Q=+Q,Number.isNaN(Q))Q=$?0:T.length-1;if(Q<0)Q=T.length+Q;if(Q>=T.length)if($)return-1;else Q=T.length-1;else if(Q<0)if($)Q=0;else return-1;if(typeof A==="string")A=w.from(A,J);if(w.isBuffer(A)){if(A.length===0)return-1;return HZ(T,A,Q,J,$)}else if(typeof A==="number"){if(A=A&255,typeof Uint8Array.prototype.indexOf==="function")if($)return Uint8Array.prototype.indexOf.call(T,A,Q);else return Uint8Array.prototype.lastIndexOf.call(T,A,Q);return HZ(T,[A],Q,J,$)}throw TypeError("val must be string, number or Buffer")}function HZ(T,A,Q,J,$){let W=1,G=T.length,Y=A.length;if(J!==void 0){if(J=String(J).toLowerCase(),J==="ucs2"||J==="ucs-2"||J==="utf16le"||J==="utf-16le"){if(T.length<2||A.length<2)return-1;W=2,G/=2,Y/=2,Q/=2}}function Z(K,j){if(W===1)return K[j];else return K.readUInt16BE(j*W)}let C;if($){let K=-1;for(C=Q;C<G;C++)if(Z(T,C)===Z(A,K===-1?0:C-K)){if(K===-1)K=C;if(C-K+1===Y)return K*W}else{if(K!==-1)C-=C-K;K=-1}}else{if(Q+Y>G)Q=G-Y;for(C=Q;C>=0;C--){let K=!0;for(let j=0;j<Y;j++)if(Z(T,C+j)!==Z(A,j)){K=!1;break}if(K)return C}}return-1}function Gj(T,A,Q,J){Q=Number(Q)||0;let $=T.length-Q;if(!J)J=$;else if(J=Number(J),J>$)J=$;let W=A.length;if(J>W/2)J=W/2;let G;for(G=0;G<J;++G){let Y=parseInt(A.substr(G*2,2),16);if(Number.isNaN(Y))return G;T[Q+G]=Y}return G}function Uj(T,A,Q,J){return p6(pJ(A,T.length-Q),T,Q,J)}function Yj(T,A,Q,J){return p6(Mj(A),T,Q,J)}function Zj(T,A,Q,J){return p6(_Z(A),T,Q,J)}function Xj(T,A,Q,J){return p6(kj(A,T.length-Q),T,Q,J)}function Pj(T,A,Q){if(A===0&&Q===T.length)return KZ(T);else return KZ(T.slice(A,Q))}function IZ(T,A,Q){Q=Math.min(T.length,Q);let J=[],$=A;while($<Q){let W=T[$],G=null,Y=W>239?4:W>223?3:W>191?2:1;if($+Y<=Q){let Z,C,K,j;switch(Y){case 1:if(W<128)G=W;break;case 2:if(Z=T[$+1],(Z&192)===128){if(j=(W&31)<<6|Z&63,j>127)G=j}break;case 3:if(Z=T[$+1],C=T[$+2],(Z&192)===128&&(C&192)===128){if(j=(W&15)<<12|(Z&63)<<6|C&63,j>2047&&(j<55296||j>57343))G=j}break;case 4:if(Z=T[$+1],C=T[$+2],K=T[$+3],(Z&192)===128&&(C&192)===128&&(K&192)===128){if(j=(W&15)<<18|(Z&63)<<12|(C&63)<<6|K&63,j>65535&&j<1114112)G=j}}}if(G===null)G=65533,Y=1;else if(G>65535)G-=65536,J.push(G>>>10&1023|55296),G=56320|G&1023;J.push(G),$+=Y}return qj(J)}function qj(T){let A=T.length;if(A<=VZ)return String.fromCharCode.apply(String,T);let Q="",J=0;while(J<A)Q+=String.fromCharCode.apply(String,T.slice(J,J+=VZ));return Q}function Kj(T,A,Q){let J="";Q=Math.min(T.length,Q);for(let $=A;$<Q;++$)J+=String.fromCharCode(T[$]&127);return J}function Cj(T,A,Q){let J="";Q=Math.min(T.length,Q);for(let $=A;$<Q;++$)J+=String.fromCharCode(T[$]);return J}function Hj(T,A,Q){let J=T.length;if(!A||A<0)A=0;if(!Q||Q<0||Q>J)Q=J;let $="";for(let W=A;W<Q;++W)$+=zj[T[W]];return $}function Vj(T,A,Q){let J=T.slice(A,Q),$="";for(let W=0;W<J.length-1;W+=2)$+=String.fromCharCode(J[W]+J[W+1]*256);return $}function z0(T,A,Q){if(T%1!==0||T<0)throw RangeError("offset is not uint");if(T+A>Q)throw RangeError("Trying to access beyond buffer length")}function s0(T,A,Q,J,$,W){if(!w.isBuffer(T))throw TypeError('"buffer" argument must be a Buffer instance');if(A>$||A<W)throw RangeError('"value" argument is out of bounds');if(Q+J>T.length)throw RangeError("Index out of range")}function SZ(T,A,Q,J,$){BZ(A,J,$,T,Q,7);let W=Number(A&BigInt(4294967295));T[Q++]=W,W=W>>8,T[Q++]=W,W=W>>8,T[Q++]=W,W=W>>8,T[Q++]=W;let G=Number(A>>BigInt(32)&BigInt(4294967295));return T[Q++]=G,G=G>>8,T[Q++]=G,G=G>>8,T[Q++]=G,G=G>>8,T[Q++]=G,Q}function LZ(T,A,Q,J,$){BZ(A,J,$,T,Q,7);let W=Number(A&BigInt(4294967295));T[Q+7]=W,W=W>>8,T[Q+6]=W,W=W>>8,T[Q+5]=W,W=W>>8,T[Q+4]=W;let G=Number(A>>BigInt(32)&BigInt(4294967295));return T[Q+3]=G,G=G>>8,T[Q+2]=G,G=G>>8,T[Q+1]=G,G=G>>8,T[Q]=G,Q+8}function wZ(T,A,Q,J,$,W){if(Q+J>T.length)throw RangeError("Index out of range");if(Q<0)throw RangeError("Index out of range")}function EZ(T,A,Q,J,$){if(A=+A,Q=Q>>>0,!$)wZ(T,A,Q,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return RZ(T,A,Q,J,23,4),Q+4}function OZ(T,A,Q,J,$){if(A=+A,Q=Q>>>0,!$)wZ(T,A,Q,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return RZ(T,A,Q,J,52,8),Q+8}function jZ(T){let A="",Q=T.length,J=T[0]==="-"?1:0;for(;Q>=J+4;Q-=3)A=`_${T.slice(Q-3,Q)}${A}`;return`${T.slice(0,Q)}${A}`}function jj(T,A,Q){if(EA(A,"offset"),T[A]===void 0||T[A+Q]===void 0)j2(A,T.length-(Q+1))}function BZ(T,A,Q,J,$,W){if(T>Q||T<A){let G=typeof A==="bigint"?"n":"",Y;if(W>3)if(A===0||A===BigInt(0))Y=`>= 0${G} and < 2${G} ** ${(W+1)*8}${G}`;else Y=`>= -(2${G} ** ${(W+1)*8-1}${G}) and < 2 ** ${(W+1)*8-1}${G}`;else Y=`>= ${A}${G} and <= ${Q}${G}`;throw new vJ("value",Y,T)}jj(J,$,W)}function EA(T,A){if(typeof T!=="number")throw new Tj(A,"number",T)}function j2(T,A,Q){if(Math.floor(T)!==T)throw EA(T,Q),new vJ(Q||"offset","an integer",T);if(A<0)throw new e5;throw new vJ(Q||"offset",`>= ${Q?1:0} and <= ${A}`,T)}function Dj(T){if(T=T.split("=")[0],T=T.trim().replace(Rj,""),T.length<2)return"";while(T.length%4!==0)T=T+"=";return T}function pJ(T,A){A=A||1/0;let Q,J=T.length,$=null,W=[];for(let G=0;G<J;++G){if(Q=T.charCodeAt(G),Q>55295&&Q<57344){if(!$){if(Q>56319){if((A-=3)>-1)W.push(239,191,189);continue}else if(G+1===J){if((A-=3)>-1)W.push(239,191,189);continue}$=Q;continue}if(Q<56320){if((A-=3)>-1)W.push(239,191,189);$=Q;continue}Q=($-55296<<10|Q-56320)+65536}else if($){if((A-=3)>-1)W.push(239,191,189)}if($=null,Q<128){if((A-=1)<0)break;W.push(Q)}else if(Q<2048){if((A-=2)<0)break;W.push(Q>>6|192,Q&63|128)}else if(Q<65536){if((A-=3)<0)break;W.push(Q>>12|224,Q>>6&63|128,Q&63|128)}else if(Q<1114112){if((A-=4)<0)break;W.push(Q>>18|240,Q>>12&63|128,Q>>6&63|128,Q&63|128)}else throw Error("Invalid code point")}return W}function Mj(T){let A=[];for(let Q=0;Q<T.length;++Q)A.push(T.charCodeAt(Q)&255);return A}function kj(T,A){let Q,J,$,W=[];for(let G=0;G<T.length;++G){if((A-=2)<0)break;Q=T.charCodeAt(G),J=Q>>8,$=Q%256,W.push($),W.push(J)}return W}function _Z(T){return f5(Dj(T))}function p6(T,A,Q,J){let $;for($=0;$<J;++$){if($+Q>=A.length||$>=T.length)break;A[$+Q]=T[$]}return $}function gT(T,A){return T instanceof A||T!=null&&T.constructor!=null&&T.constructor.name!=null&&T.constructor.name===A.name}function z8(T){return typeof BigInt>"u"?Fj:T}function Fj(){throw Error("BigInt not supported")}function cJ(T){return()=>{throw Error(T+" is not implemented for node:buffer browser polyfill")}}var hT,KT,mJ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o8,qZ,CZ,DZ=50,V2=2147483647,MZ=536870888,i5,o5,a5,s5,t5,e5,Tj,vJ,VZ=4096,Rj,zj,Nj,Ij,Sj=(T)=>{for(let A of T)if(A.charCodeAt(0)>127)return!1;return!0},Lj,wj;var OA=w0(()=>{hT=[],KT=[];for(o8=0,qZ=mJ.length;o8<qZ;++o8)hT[o8]=mJ[o8],KT[mJ.charCodeAt(o8)]=o8;KT[45]=62;KT[95]=63;CZ=typeof Symbol==="function"&&typeof Symbol.for==="function"?Symbol.for("nodejs.util.inspect.custom"):null,i5=globalThis.btoa,o5=globalThis.atob,a5=globalThis.File,s5=globalThis.Blob,t5={MAX_LENGTH:V2,MAX_STRING_LENGTH:MZ};e5=lJ("ERR_BUFFER_OUT_OF_BOUNDS",function(T){if(T)return`${T} is outside of buffer bounds`;return"Attempt to access memory outside buffer bounds"},RangeError),Tj=lJ("ERR_INVALID_ARG_TYPE",function(T,A){return`The "${T}" argument must be of type number. Received type ${typeof A}`},TypeError),vJ=lJ("ERR_OUT_OF_RANGE",function(T,A,Q){let J=`The value of "${T}" is out of range.`,$=Q;if(Number.isInteger(Q)&&Math.abs(Q)>4294967296)$=jZ(String(Q));else if(typeof Q==="bigint"){if($=String(Q),Q>BigInt(2)**BigInt(32)||Q<-(BigInt(2)**BigInt(32)))$=jZ($);$+="n"}return J+=` It must be ${A}. Received ${$}`,J},RangeError);Object.defineProperty(w.prototype,"parent",{enumerable:!0,get:function(){if(!w.isBuffer(this))return;return this.buffer}});Object.defineProperty(w.prototype,"offset",{enumerable:!0,get:function(){if(!w.isBuffer(this))return;return this.byteOffset}});w.poolSize=8192;w.from=function(T,A,Q){return kZ(T,A,Q)};Object.setPrototypeOf(w.prototype,Uint8Array.prototype);Object.setPrototypeOf(w,Uint8Array);w.alloc=function(T,A,Q){return Aj(T,A,Q)};w.allocUnsafe=function(T){return uJ(T)};w.allocUnsafeSlow=function(T){return uJ(T)};w.isBuffer=function(T){return T!=null&&T._isBuffer===!0&&T!==w.prototype};w.compare=function(T,A){if(gT(T,Uint8Array))T=w.from(T,T.offset,T.byteLength);if(gT(A,Uint8Array))A=w.from(A,A.offset,A.byteLength);if(!w.isBuffer(T)||!w.isBuffer(A))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(T===A)return 0;let Q=T.length,J=A.length;for(let $=0,W=Math.min(Q,J);$<W;++$)if(T[$]!==A[$]){Q=T[$],J=A[$];break}if(Q<J)return-1;if(J<Q)return 1;return 0};w.isEncoding=function(T){switch(String(T).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};w.concat=function(T,A){if(!Array.isArray(T))throw TypeError('"list" argument must be an Array of Buffers');if(T.length===0)return w.alloc(0);let Q;if(A===void 0){A=0;for(Q=0;Q<T.length;++Q)A+=T[Q].length}let J=w.allocUnsafe(A),$=0;for(Q=0;Q<T.length;++Q){let W=T[Q];if(gT(W,Uint8Array))if($+W.length>J.length){if(!w.isBuffer(W))W=w.from(W);W.copy(J,$)}else Uint8Array.prototype.set.call(J,W,$);else if(!w.isBuffer(W))throw TypeError('"list" argument must be an Array of Buffers');else W.copy(J,$);$+=W.length}return J};w.byteLength=FZ;w.prototype._isBuffer=!0;w.prototype.swap16=function(){let T=this.length;if(T%2!==0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let A=0;A<T;A+=2)a8(this,A,A+1);return this};w.prototype.swap32=function(){let T=this.length;if(T%4!==0)throw RangeError("Buffer size must be a multiple of 32-bits");for(let A=0;A<T;A+=4)a8(this,A,A+3),a8(this,A+1,A+2);return this};w.prototype.swap64=function(){let T=this.length;if(T%8!==0)throw RangeError("Buffer size must be a multiple of 64-bits");for(let A=0;A<T;A+=8)a8(this,A,A+7),a8(this,A+1,A+6),a8(this,A+2,A+5),a8(this,A+3,A+4);return this};w.prototype.toString=function(){let T=this.length;if(T===0)return"";if(arguments.length===0)return IZ(this,0,T);return Wj.apply(this,arguments)};w.prototype.toLocaleString=w.prototype.toString;w.prototype.equals=function(T){if(!w.isBuffer(T))throw TypeError("Argument must be a Buffer");if(this===T)return!0;return w.compare(this,T)===0};w.prototype.inspect=function(){let T="",A=DZ;if(T=this.toString("hex",0,A).replace(/(.{2})/g,"$1 ").trim(),this.length>A)T+=" ... ";return"<Buffer "+T+">"};if(CZ)w.prototype[CZ]=w.prototype.inspect;w.prototype.compare=function(T,A,Q,J,$){if(gT(T,Uint8Array))T=w.from(T,T.offset,T.byteLength);if(!w.isBuffer(T))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof T);if(A===void 0)A=0;if(Q===void 0)Q=T?T.length:0;if(J===void 0)J=0;if($===void 0)$=this.length;if(A<0||Q>T.length||J<0||$>this.length)throw RangeError("out of range index");if(J>=$&&A>=Q)return 0;if(J>=$)return-1;if(A>=Q)return 1;if(A>>>=0,Q>>>=0,J>>>=0,$>>>=0,this===T)return 0;let W=$-J,G=Q-A,Y=Math.min(W,G),Z=this.slice(J,$),C=T.slice(A,Q);for(let K=0;K<Y;++K)if(Z[K]!==C[K]){W=Z[K],G=C[K];break}if(W<G)return-1;if(G<W)return 1;return 0};w.prototype.includes=function(T,A,Q){return this.indexOf(T,A,Q)!==-1};w.prototype.indexOf=function(T,A,Q){return NZ(this,T,A,Q,!0)};w.prototype.lastIndexOf=function(T,A,Q){return NZ(this,T,A,Q,!1)};w.prototype.write=function(T,A,Q,J){if(A===void 0)J="utf8",Q=this.length,A=0;else if(Q===void 0&&typeof A==="string")J=A,Q=this.length,A=0;else if(isFinite(A))if(A=A>>>0,isFinite(Q)){if(Q=Q>>>0,J===void 0)J="utf8"}else J=Q,Q=void 0;else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let $=this.length-A;if(Q===void 0||Q>$)Q=$;if(T.length>0&&(Q<0||A<0)||A>this.length)throw RangeError("Attempt to write outside buffer bounds");if(!J)J="utf8";let W=!1;for(;;)switch(J){case"hex":return Gj(this,T,A,Q);case"utf8":case"utf-8":return Uj(this,T,A,Q);case"ascii":case"latin1":case"binary":return Yj(this,T,A,Q);case"base64":return Zj(this,T,A,Q);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Xj(this,T,A,Q);default:if(W)throw TypeError("Unknown encoding: "+J);J=(""+J).toLowerCase(),W=!0}};w.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};w.prototype.slice=function(T,A){let Q=this.length;if(T=~~T,A=A===void 0?Q:~~A,T<0){if(T+=Q,T<0)T=0}else if(T>Q)T=Q;if(A<0){if(A+=Q,A<0)A=0}else if(A>Q)A=Q;if(A<T)A=T;let J=this.subarray(T,A);return Object.setPrototypeOf(J,w.prototype),J};w.prototype.readUintLE=w.prototype.readUIntLE=function(T,A,Q){if(T=T>>>0,A=A>>>0,!Q)z0(T,A,this.length);let J=this[T],$=1,W=0;while(++W<A&&($*=256))J+=this[T+W]*$;return J};w.prototype.readUintBE=w.prototype.readUIntBE=function(T,A,Q){if(T=T>>>0,A=A>>>0,!Q)z0(T,A,this.length);let J=this[T+--A],$=1;while(A>0&&($*=256))J+=this[T+--A]*$;return J};w.prototype.readUint8=w.prototype.readUInt8=function(T,A){if(T=T>>>0,!A)z0(T,1,this.length);return this[T]};w.prototype.readUint16LE=w.prototype.readUInt16LE=function(T,A){if(T=T>>>0,!A)z0(T,2,this.length);return this[T]|this[T+1]<<8};w.prototype.readUint16BE=w.prototype.readUInt16BE=function(T,A){if(T=T>>>0,!A)z0(T,2,this.length);return this[T]<<8|this[T+1]};w.prototype.readUint32LE=w.prototype.readUInt32LE=function(T,A){if(T=T>>>0,!A)z0(T,4,this.length);return(this[T]|this[T+1]<<8|this[T+2]<<16)+this[T+3]*16777216};w.prototype.readUint32BE=w.prototype.readUInt32BE=function(T,A){if(T=T>>>0,!A)z0(T,4,this.length);return this[T]*16777216+(this[T+1]<<16|this[T+2]<<8|this[T+3])};w.prototype.readBigUInt64LE=z8(function(T){T=T>>>0,EA(T,"offset");let A=this[T],Q=this[T+7];if(A===void 0||Q===void 0)j2(T,this.length-8);let J=A+this[++T]*256+this[++T]*65536+this[++T]*16777216,$=this[++T]+this[++T]*256+this[++T]*65536+Q*16777216;return BigInt(J)+(BigInt($)<<BigInt(32))});w.prototype.readBigUInt64BE=z8(function(T){T=T>>>0,EA(T,"offset");let A=this[T],Q=this[T+7];if(A===void 0||Q===void 0)j2(T,this.length-8);let J=A*16777216+this[++T]*65536+this[++T]*256+this[++T],$=this[++T]*16777216+this[++T]*65536+this[++T]*256+Q;return(BigInt(J)<<BigInt(32))+BigInt($)});w.prototype.readIntLE=function(T,A,Q){if(T=T>>>0,A=A>>>0,!Q)z0(T,A,this.length);let J=this[T],$=1,W=0;while(++W<A&&($*=256))J+=this[T+W]*$;if($*=128,J>=$)J-=Math.pow(2,8*A);return J};w.prototype.readIntBE=function(T,A,Q){if(T=T>>>0,A=A>>>0,!Q)z0(T,A,this.length);let J=A,$=1,W=this[T+--J];while(J>0&&($*=256))W+=this[T+--J]*$;if($*=128,W>=$)W-=Math.pow(2,8*A);return W};w.prototype.readInt8=function(T,A){if(T=T>>>0,!A)z0(T,1,this.length);if(!(this[T]&128))return this[T];return(255-this[T]+1)*-1};w.prototype.readInt16LE=function(T,A){if(T=T>>>0,!A)z0(T,2,this.length);let Q=this[T]|this[T+1]<<8;return Q&32768?Q|4294901760:Q};w.prototype.readInt16BE=function(T,A){if(T=T>>>0,!A)z0(T,2,this.length);let Q=this[T+1]|this[T]<<8;return Q&32768?Q|4294901760:Q};w.prototype.readInt32LE=function(T,A){if(T=T>>>0,!A)z0(T,4,this.length);return this[T]|this[T+1]<<8|this[T+2]<<16|this[T+3]<<24};w.prototype.readInt32BE=function(T,A){if(T=T>>>0,!A)z0(T,4,this.length);return this[T]<<24|this[T+1]<<16|this[T+2]<<8|this[T+3]};w.prototype.readBigInt64LE=z8(function(T){T=T>>>0,EA(T,"offset");let A=this[T],Q=this[T+7];if(A===void 0||Q===void 0)j2(T,this.length-8);let J=this[T+4]+this[T+5]*256+this[T+6]*65536+(Q<<24);return(BigInt(J)<<BigInt(32))+BigInt(A+this[++T]*256+this[++T]*65536+this[++T]*16777216)});w.prototype.readBigInt64BE=z8(function(T){T=T>>>0,EA(T,"offset");let A=this[T],Q=this[T+7];if(A===void 0||Q===void 0)j2(T,this.length-8);let J=(A<<24)+this[++T]*65536+this[++T]*256+this[++T];return(BigInt(J)<<BigInt(32))+BigInt(this[++T]*16777216+this[++T]*65536+this[++T]*256+Q)});w.prototype.readFloatLE=function(T,A){if(T=T>>>0,!A)z0(T,4,this.length);return b6(this,T,!0,23,4)};w.prototype.readFloatBE=function(T,A){if(T=T>>>0,!A)z0(T,4,this.length);return b6(this,T,!1,23,4)};w.prototype.readDoubleLE=function(T,A){if(T=T>>>0,!A)z0(T,8,this.length);return b6(this,T,!0,52,8)};w.prototype.readDoubleBE=function(T,A){if(T=T>>>0,!A)z0(T,8,this.length);return b6(this,T,!1,52,8)};w.prototype.writeUintLE=w.prototype.writeUIntLE=function(T,A,Q,J){if(T=+T,A=A>>>0,Q=Q>>>0,!J){let G=Math.pow(2,8*Q)-1;s0(this,T,A,Q,G,0)}let $=1,W=0;this[A]=T&255;while(++W<Q&&($*=256))this[A+W]=T/$&255;return A+Q};w.prototype.writeUintBE=w.prototype.writeUIntBE=function(T,A,Q,J){if(T=+T,A=A>>>0,Q=Q>>>0,!J){let G=Math.pow(2,8*Q)-1;s0(this,T,A,Q,G,0)}let $=Q-1,W=1;this[A+$]=T&255;while(--$>=0&&(W*=256))this[A+$]=T/W&255;return A+Q};w.prototype.writeUint8=w.prototype.writeUInt8=function(T,A,Q){if(T=+T,A=A>>>0,!Q)s0(this,T,A,1,255,0);return this[A]=T&255,A+1};w.prototype.writeUint16LE=w.prototype.writeUInt16LE=function(T,A,Q){if(T=+T,A=A>>>0,!Q)s0(this,T,A,2,65535,0);return this[A]=T&255,this[A+1]=T>>>8,A+2};w.prototype.writeUint16BE=w.prototype.writeUInt16BE=function(T,A,Q){if(T=+T,A=A>>>0,!Q)s0(this,T,A,2,65535,0);return this[A]=T>>>8,this[A+1]=T&255,A+2};w.prototype.writeUint32LE=w.prototype.writeUInt32LE=function(T,A,Q){if(T=+T,A=A>>>0,!Q)s0(this,T,A,4,4294967295,0);return this[A+3]=T>>>24,this[A+2]=T>>>16,this[A+1]=T>>>8,this[A]=T&255,A+4};w.prototype.writeUint32BE=w.prototype.writeUInt32BE=function(T,A,Q){if(T=+T,A=A>>>0,!Q)s0(this,T,A,4,4294967295,0);return this[A]=T>>>24,this[A+1]=T>>>16,this[A+2]=T>>>8,this[A+3]=T&255,A+4};w.prototype.writeBigUInt64LE=z8(function(T,A=0){return SZ(this,T,A,BigInt(0),BigInt("0xffffffffffffffff"))});w.prototype.writeBigUInt64BE=z8(function(T,A=0){return LZ(this,T,A,BigInt(0),BigInt("0xffffffffffffffff"))});w.prototype.writeIntLE=function(T,A,Q,J){if(T=+T,A=A>>>0,!J){let Y=Math.pow(2,8*Q-1);s0(this,T,A,Q,Y-1,-Y)}let $=0,W=1,G=0;this[A]=T&255;while(++$<Q&&(W*=256)){if(T<0&&G===0&&this[A+$-1]!==0)G=1;this[A+$]=(T/W>>0)-G&255}return A+Q};w.prototype.writeIntBE=function(T,A,Q,J){if(T=+T,A=A>>>0,!J){let Y=Math.pow(2,8*Q-1);s0(this,T,A,Q,Y-1,-Y)}let $=Q-1,W=1,G=0;this[A+$]=T&255;while(--$>=0&&(W*=256)){if(T<0&&G===0&&this[A+$+1]!==0)G=1;this[A+$]=(T/W>>0)-G&255}return A+Q};w.prototype.writeInt8=function(T,A,Q){if(T=+T,A=A>>>0,!Q)s0(this,T,A,1,127,-128);if(T<0)T=255+T+1;return this[A]=T&255,A+1};w.prototype.writeInt16LE=function(T,A,Q){if(T=+T,A=A>>>0,!Q)s0(this,T,A,2,32767,-32768);return this[A]=T&255,this[A+1]=T>>>8,A+2};w.prototype.writeInt16BE=function(T,A,Q){if(T=+T,A=A>>>0,!Q)s0(this,T,A,2,32767,-32768);return this[A]=T>>>8,this[A+1]=T&255,A+2};w.prototype.writeInt32LE=function(T,A,Q){if(T=+T,A=A>>>0,!Q)s0(this,T,A,4,2147483647,-2147483648);return this[A]=T&255,this[A+1]=T>>>8,this[A+2]=T>>>16,this[A+3]=T>>>24,A+4};w.prototype.writeInt32BE=function(T,A,Q){if(T=+T,A=A>>>0,!Q)s0(this,T,A,4,2147483647,-2147483648);if(T<0)T=4294967295+T+1;return this[A]=T>>>24,this[A+1]=T>>>16,this[A+2]=T>>>8,this[A+3]=T&255,A+4};w.prototype.writeBigInt64LE=z8(function(T,A=0){return SZ(this,T,A,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});w.prototype.writeBigInt64BE=z8(function(T,A=0){return LZ(this,T,A,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});w.prototype.writeFloatLE=function(T,A,Q){return EZ(this,T,A,!0,Q)};w.prototype.writeFloatBE=function(T,A,Q){return EZ(this,T,A,!1,Q)};w.prototype.writeDoubleLE=function(T,A,Q){return OZ(this,T,A,!0,Q)};w.prototype.writeDoubleBE=function(T,A,Q){return OZ(this,T,A,!1,Q)};w.prototype.copy=function(T,A,Q,J){if(!w.isBuffer(T))throw TypeError("argument should be a Buffer");if(!Q)Q=0;if(!J&&J!==0)J=this.length;if(A>=T.length)A=T.length;if(!A)A=0;if(J>0&&J<Q)J=Q;if(J===Q)return 0;if(T.length===0||this.length===0)return 0;if(A<0)throw RangeError("targetStart out of bounds");if(Q<0||Q>=this.length)throw RangeError("Index out of range");if(J<0)throw RangeError("sourceEnd out of bounds");if(J>this.length)J=this.length;if(T.length-A<J-Q)J=T.length-A+Q;let $=J-Q;if(this===T&&typeof Uint8Array.prototype.copyWithin==="function")this.copyWithin(A,Q,J);else Uint8Array.prototype.set.call(T,this.subarray(Q,J),A);return $};w.prototype.fill=function(T,A,Q,J){if(typeof T==="string"){if(typeof A==="string")J=A,A=0,Q=this.length;else if(typeof Q==="string")J=Q,Q=this.length;if(J!==void 0&&typeof J!=="string")throw TypeError("encoding must be a string");if(typeof J==="string"&&!w.isEncoding(J))throw TypeError("Unknown encoding: "+J);if(T.length===1){let W=T.charCodeAt(0);if(J==="utf8"&&W<128||J==="latin1")T=W}}else if(typeof T==="number")T=T&255;else if(typeof T==="boolean")T=Number(T);if(A<0||this.length<A||this.length<Q)throw RangeError("Out of range index");if(Q<=A)return this;if(A=A>>>0,Q=Q===void 0?this.length:Q>>>0,!T)T=0;let $;if(typeof T==="number")for($=A;$<Q;++$)this[$]=T;else{let W=w.isBuffer(T)?T:w.from(T,J),G=W.length;if(G===0)throw TypeError('The value "'+T+'" is invalid for argument "value"');for($=0;$<Q-A;++$)this[$+A]=W[$%G]}return this};Rj=/[^+/0-9A-Za-z-_]/g;zj=function(){let T=Array(256);for(let A=0;A<16;++A){let Q=A*16;for(let J=0;J<16;++J)T[Q+J]="0123456789abcdef"[A]+"0123456789abcdef"[J]}return T}();Nj=cJ("resolveObjectURL"),Ij=cJ("isUtf8"),Lj=cJ("transcode"),wj=w});var V$=ZT((z9,H$)=>{(function(T,A){function Q(R,U){if(!R)throw Error(U||"Assertion failed")}function J(R,U){R.super_=U;var X=function(){};X.prototype=U.prototype,R.prototype=new X,R.prototype.constructor=R}function $(R,U,X){if($.isBN(R))return R;if(this.negative=0,this.words=null,this.length=0,this.red=null,R!==null){if(U==="le"||U==="be")X=U,U=10;this._init(R||0,U||10,X||"be")}}if(typeof T==="object")T.exports=$;else A.BN=$;$.BN=$,$.wordSize=26;var W;try{if(typeof window<"u"&&typeof window.Buffer<"u")W=window.Buffer;else W=(OA(),VA(l6)).Buffer}catch(R){}$.isBN=function(U){if(U instanceof $)return!0;return U!==null&&typeof U==="object"&&U.constructor.wordSize===$.wordSize&&Array.isArray(U.words)},$.max=function(U,X){if(U.cmp(X)>0)return U;return X},$.min=function(U,X){if(U.cmp(X)<0)return U;return X},$.prototype._init=function(U,X,q){if(typeof U==="number")return this._initNumber(U,X,q);if(typeof U==="object")return this._initArray(U,X,q);if(X==="hex")X=16;Q(X===(X|0)&&X>=2&&X<=36),U=U.toString().replace(/\s+/g,"");var H=0;if(U[0]==="-")H++,this.negative=1;if(H<U.length){if(X===16)this._parseHex(U,H,q);else if(this._parseBase(U,X,H),q==="le")this._initArray(this.toArray(),X,q)}},$.prototype._initNumber=function(U,X,q){if(U<0)this.negative=1,U=-U;if(U<67108864)this.words=[U&67108863],this.length=1;else if(U<4503599627370496)this.words=[U&67108863,U/67108864&67108863],this.length=2;else Q(U<9007199254740992),this.words=[U&67108863,U/67108864&67108863,1],this.length=3;if(q!=="le")return;this._initArray(this.toArray(),X,q)},$.prototype._initArray=function(U,X,q){if(Q(typeof U.length==="number"),U.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(U.length/3),this.words=Array(this.length);for(var H=0;H<this.length;H++)this.words[H]=0;var V,F,I=0;if(q==="be"){for(H=U.length-1,V=0;H>=0;H-=3)if(F=U[H]|U[H-1]<<8|U[H-2]<<16,this.words[V]|=F<<I&67108863,this.words[V+1]=F>>>26-I&67108863,I+=24,I>=26)I-=26,V++}else if(q==="le"){for(H=0,V=0;H<U.length;H+=3)if(F=U[H]|U[H+1]<<8|U[H+2]<<16,this.words[V]|=F<<I&67108863,this.words[V+1]=F>>>26-I&67108863,I+=24,I>=26)I-=26,V++}return this._strip()};function G(R,U){var X=R.charCodeAt(U);if(X>=48&&X<=57)return X-48;else if(X>=65&&X<=70)return X-55;else if(X>=97&&X<=102)return X-87;else Q(!1,"Invalid character in "+R)}function Y(R,U,X){var q=G(R,X);if(X-1>=U)q|=G(R,X-1)<<4;return q}$.prototype._parseHex=function(U,X,q){this.length=Math.ceil((U.length-X)/6),this.words=Array(this.length);for(var H=0;H<this.length;H++)this.words[H]=0;var V=0,F=0,I;if(q==="be")for(H=U.length-1;H>=X;H-=2)if(I=Y(U,X,H)<<V,this.words[F]|=I&67108863,V>=18)V-=18,F+=1,this.words[F]|=I>>>26;else V+=8;else{var D=U.length-X;for(H=D%2===0?X+1:X;H<U.length;H+=2)if(I=Y(U,X,H)<<V,this.words[F]|=I&67108863,V>=18)V-=18,F+=1,this.words[F]|=I>>>26;else V+=8}this._strip()};function Z(R,U,X,q){var H=0,V=0,F=Math.min(R.length,X);for(var I=U;I<F;I++){var D=R.charCodeAt(I)-48;if(H*=q,D>=49)V=D-49+10;else if(D>=17)V=D-17+10;else V=D;Q(D>=0&&V<q,"Invalid character"),H+=V}return H}$.prototype._parseBase=function(U,X,q){this.words=[0],this.length=1;for(var H=0,V=1;V<=67108863;V*=X)H++;H--,V=V/X|0;var F=U.length-q,I=F%H,D=Math.min(F,F-I)+q,P=0;for(var k=q;k<D;k+=H)if(P=Z(U,k,k+H,X),this.imuln(V),this.words[0]+P<67108864)this.words[0]+=P;else this._iaddn(P);if(I!==0){var b=1;P=Z(U,k,U.length,X);for(k=0;k<I;k++)b*=X;if(this.imuln(b),this.words[0]+P<67108864)this.words[0]+=P;else this._iaddn(P)}this._strip()},$.prototype.copy=function(U){U.words=Array(this.length);for(var X=0;X<this.length;X++)U.words[X]=this.words[X];U.length=this.length,U.negative=this.negative,U.red=this.red};function C(R,U){R.words=U.words,R.length=U.length,R.negative=U.negative,R.red=U.red}if($.prototype._move=function(U){C(U,this)},$.prototype.clone=function(){var U=new $(null);return this.copy(U),U},$.prototype._expand=function(U){while(this.length<U)this.words[this.length++]=0;return this},$.prototype._strip=function(){while(this.length>1&&this.words[this.length-1]===0)this.length--;return this._normSign()},$.prototype._normSign=function(){if(this.length===1&&this.words[0]===0)this.negative=0;return this},typeof Symbol<"u"&&typeof Symbol.for==="function")try{$.prototype[Symbol.for("nodejs.util.inspect.custom")]=K}catch(R){$.prototype.inspect=K}else $.prototype.inspect=K;function K(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var j=["","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"],M=[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],z=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64000000,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,24300000,28629151,33554432,39135393,45435424,52521875,60466176];if($.prototype.toString=function(U,X){U=U||10,X=X|0||1;var q;if(U===16||U==="hex"){q="";var H=0,V=0;for(var F=0;F<this.length;F++){var I=this.words[F],D=((I<<H|V)&16777215).toString(16);if(V=I>>>24-H&16777215,H+=2,H>=26)H-=26,F--;if(V!==0||F!==this.length-1)q=j[6-D.length]+D+q;else q=D+q}if(V!==0)q=V.toString(16)+q;while(q.length%X!==0)q="0"+q;if(this.negative!==0)q="-"+q;return q}if(U===(U|0)&&U>=2&&U<=36){var P=M[U],k=z[U];q="";var b=this.clone();b.negative=0;while(!b.isZero()){var r=b.modrn(k).toString(U);if(b=b.idivn(k),!b.isZero())q=j[P-r.length]+r+q;else q=r+q}if(this.isZero())q="0"+q;while(q.length%X!==0)q="0"+q;if(this.negative!==0)q="-"+q;return q}Q(!1,"Base should be between 2 and 36")},$.prototype.toNumber=function(){var U=this.words[0];if(this.length===2)U+=this.words[1]*67108864;else if(this.length===3&&this.words[2]===1)U+=4503599627370496+this.words[1]*67108864;else if(this.length>2)Q(!1,"Number can only safely store up to 53 bits");return this.negative!==0?-U:U},$.prototype.toJSON=function(){return this.toString(16,2)},W)$.prototype.toBuffer=function(U,X){return this.toArrayLike(W,U,X)};$.prototype.toArray=function(U,X){return this.toArrayLike(Array,U,X)};var N=function(U,X){if(U.allocUnsafe)return U.allocUnsafe(X);return new U(X)};if($.prototype.toArrayLike=function(U,X,q){this._strip();var H=this.byteLength(),V=q||Math.max(1,H);Q(H<=V,"byte array longer than desired length"),Q(V>0,"Requested array length <= 0");var F=N(U,V),I=X==="le"?"LE":"BE";return this["_toArrayLike"+I](F,H),F},$.prototype._toArrayLikeLE=function(U,X){var q=0,H=0;for(var V=0,F=0;V<this.length;V++){var I=this.words[V]<<F|H;if(U[q++]=I&255,q<U.length)U[q++]=I>>8&255;if(q<U.length)U[q++]=I>>16&255;if(F===6){if(q<U.length)U[q++]=I>>24&255;H=0,F=0}else H=I>>>24,F+=2}if(q<U.length){U[q++]=H;while(q<U.length)U[q++]=0}},$.prototype._toArrayLikeBE=function(U,X){var q=U.length-1,H=0;for(var V=0,F=0;V<this.length;V++){var I=this.words[V]<<F|H;if(U[q--]=I&255,q>=0)U[q--]=I>>8&255;if(q>=0)U[q--]=I>>16&255;if(F===6){if(q>=0)U[q--]=I>>24&255;H=0,F=0}else H=I>>>24,F+=2}if(q>=0){U[q--]=H;while(q>=0)U[q--]=0}},Math.clz32)$.prototype._countBits=function(U){return 32-Math.clz32(U)};else $.prototype._countBits=function(U){var X=U,q=0;if(X>=4096)q+=13,X>>>=13;if(X>=64)q+=7,X>>>=7;if(X>=8)q+=4,X>>>=4;if(X>=2)q+=2,X>>>=2;return q+X};$.prototype._zeroBits=function(U){if(U===0)return 26;var X=U,q=0;if((X&8191)===0)q+=13,X>>>=13;if((X&127)===0)q+=7,X>>>=7;if((X&15)===0)q+=4,X>>>=4;if((X&3)===0)q+=2,X>>>=2;if((X&1)===0)q++;return q},$.prototype.bitLength=function(){var U=this.words[this.length-1],X=this._countBits(U);return(this.length-1)*26+X};function E(R){var U=Array(R.bitLength());for(var X=0;X<U.length;X++){var q=X/26|0,H=X%26;U[X]=R.words[q]>>>H&1}return U}$.prototype.zeroBits=function(){if(this.isZero())return 0;var U=0;for(var X=0;X<this.length;X++){var q=this._zeroBits(this.words[X]);if(U+=q,q!==26)break}return U},$.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},$.prototype.toTwos=function(U){if(this.negative!==0)return this.abs().inotn(U).iaddn(1);return this.clone()},$.prototype.fromTwos=function(U){if(this.testn(U-1))return this.notn(U).iaddn(1).ineg();return this.clone()},$.prototype.isNeg=function(){return this.negative!==0},$.prototype.neg=function(){return this.clone().ineg()},$.prototype.ineg=function(){if(!this.isZero())this.negative^=1;return this},$.prototype.iuor=function(U){while(this.length<U.length)this.words[this.length++]=0;for(var X=0;X<U.length;X++)this.words[X]=this.words[X]|U.words[X];return this._strip()},$.prototype.ior=function(U){return Q((this.negative|U.negative)===0),this.iuor(U)},$.prototype.or=function(U){if(this.length>U.length)return this.clone().ior(U);return U.clone().ior(this)},$.prototype.uor=function(U){if(this.length>U.length)return this.clone().iuor(U);return U.clone().iuor(this)},$.prototype.iuand=function(U){var X;if(this.length>U.length)X=U;else X=this;for(var q=0;q<X.length;q++)this.words[q]=this.words[q]&U.words[q];return this.length=X.length,this._strip()},$.prototype.iand=function(U){return Q((this.negative|U.negative)===0),this.iuand(U)},$.prototype.and=function(U){if(this.length>U.length)return this.clone().iand(U);return U.clone().iand(this)},$.prototype.uand=function(U){if(this.length>U.length)return this.clone().iuand(U);return U.clone().iuand(this)},$.prototype.iuxor=function(U){var X,q;if(this.length>U.length)X=this,q=U;else X=U,q=this;for(var H=0;H<q.length;H++)this.words[H]=X.words[H]^q.words[H];if(this!==X)for(;H<X.length;H++)this.words[H]=X.words[H];return this.length=X.length,this._strip()},$.prototype.ixor=function(U){return Q((this.negative|U.negative)===0),this.iuxor(U)},$.prototype.xor=function(U){if(this.length>U.length)return this.clone().ixor(U);return U.clone().ixor(this)},$.prototype.uxor=function(U){if(this.length>U.length)return this.clone().iuxor(U);return U.clone().iuxor(this)},$.prototype.inotn=function(U){Q(typeof U==="number"&&U>=0);var X=Math.ceil(U/26)|0,q=U%26;if(this._expand(X),q>0)X--;for(var H=0;H<X;H++)this.words[H]=~this.words[H]&67108863;if(q>0)this.words[H]=~this.words[H]&67108863>>26-q;return this._strip()},$.prototype.notn=function(U){return this.clone().inotn(U)},$.prototype.setn=function(U,X){Q(typeof U==="number"&&U>=0);var q=U/26|0,H=U%26;if(this._expand(q+1),X)this.words[q]=this.words[q]|1<<H;else this.words[q]=this.words[q]&~(1<<H);return this._strip()},$.prototype.iadd=function(U){var X;if(this.negative!==0&&U.negative===0)return this.negative=0,X=this.isub(U),this.negative^=1,this._normSign();else if(this.negative===0&&U.negative!==0)return U.negative=0,X=this.isub(U),U.negative=1,X._normSign();var q,H;if(this.length>U.length)q=this,H=U;else q=U,H=this;var V=0;for(var F=0;F<H.length;F++)X=(q.words[F]|0)+(H.words[F]|0)+V,this.words[F]=X&67108863,V=X>>>26;for(;V!==0&&F<q.length;F++)X=(q.words[F]|0)+V,this.words[F]=X&67108863,V=X>>>26;if(this.length=q.length,V!==0)this.words[this.length]=V,this.length++;else if(q!==this)for(;F<q.length;F++)this.words[F]=q.words[F];return this},$.prototype.add=function(U){var X;if(U.negative!==0&&this.negative===0)return U.negative=0,X=this.sub(U),U.negative^=1,X;else if(U.negative===0&&this.negative!==0)return this.negative=0,X=U.sub(this),this.negative=1,X;if(this.length>U.length)return this.clone().iadd(U);return U.clone().iadd(this)},$.prototype.isub=function(U){if(U.negative!==0){U.negative=0;var X=this.iadd(U);return U.negative=1,X._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(U),this.negative=1,this._normSign();var q=this.cmp(U);if(q===0)return this.negative=0,this.length=1,this.words[0]=0,this;var H,V;if(q>0)H=this,V=U;else H=U,V=this;var F=0;for(var I=0;I<V.length;I++)X=(H.words[I]|0)-(V.words[I]|0)+F,F=X>>26,this.words[I]=X&67108863;for(;F!==0&&I<H.length;I++)X=(H.words[I]|0)+F,F=X>>26,this.words[I]=X&67108863;if(F===0&&I<H.length&&H!==this)for(;I<H.length;I++)this.words[I]=H.words[I];if(this.length=Math.max(this.length,I),H!==this)this.negative=1;return this._strip()},$.prototype.sub=function(U){return this.clone().isub(U)};function L(R,U,X){X.negative=U.negative^R.negative;var q=R.length+U.length|0;X.length=q,q=q-1|0;var H=R.words[0]|0,V=U.words[0]|0,F=H*V,I=F&67108863,D=F/67108864|0;X.words[0]=I;for(var P=1;P<q;P++){var k=D>>>26,b=D&67108863,r=Math.min(P,U.length-1);for(var f=Math.max(0,P-R.length+1);f<=r;f++){var T1=P-f|0;H=R.words[T1]|0,V=U.words[f]|0,F=H*V+b,k+=F/67108864|0,b=F&67108863}X.words[P]=b|0,D=k|0}if(D!==0)X.words[P]=D|0;else X.length--;return X._strip()}var O=function(U,X,q){var H=U.words,V=X.words,F=q.words,I=0,D,P,k,b=H[0]|0,r=b&8191,f=b>>>13,T1=H[1]|0,Q1=T1&8191,J1=T1>>>13,r0=H[2]|0,X1=r0&8191,C1=r0>>>13,T2=H[3]|0,w1=T2&8191,E1=T2>>>13,aW=H[4]|0,O1=aW&8191,B1=aW>>>13,sW=H[5]|0,_1=sW&8191,x1=sW>>>13,tW=H[6]|0,h1=tW&8191,g1=tW>>>13,eW=H[7]|0,m1=eW&8191,v1=eW>>>13,TG=H[8]|0,y1=TG&8191,b1=TG>>>13,AG=H[9]|0,p1=AG&8191,l1=AG>>>13,QG=V[0]|0,u1=QG&8191,d1=QG>>>13,JG=V[1]|0,c1=JG&8191,f1=JG>>>13,$G=V[2]|0,r1=$G&8191,n1=$G>>>13,WG=V[3]|0,i1=WG&8191,o1=WG>>>13,GG=V[4]|0,a1=GG&8191,s1=GG>>>13,UG=V[5]|0,t1=UG&8191,e1=UG>>>13,YG=V[6]|0,T0=YG&8191,A0=YG>>>13,ZG=V[7]|0,Q0=ZG&8191,J0=ZG>>>13,XG=V[8]|0,$0=XG&8191,W0=XG>>>13,PG=V[9]|0,G0=PG&8191,U0=PG>>>13;q.negative=U.negative^X.negative,q.length=19,D=Math.imul(r,u1),P=Math.imul(r,d1),P=P+Math.imul(f,u1)|0,k=Math.imul(f,d1);var rQ=(I+D|0)+((P&8191)<<13)|0;I=(k+(P>>>13)|0)+(rQ>>>26)|0,rQ&=67108863,D=Math.imul(Q1,u1),P=Math.imul(Q1,d1),P=P+Math.imul(J1,u1)|0,k=Math.imul(J1,d1),D=D+Math.imul(r,c1)|0,P=P+Math.imul(r,f1)|0,P=P+Math.imul(f,c1)|0,k=k+Math.imul(f,f1)|0;var nQ=(I+D|0)+((P&8191)<<13)|0;I=(k+(P>>>13)|0)+(nQ>>>26)|0,nQ&=67108863,D=Math.imul(X1,u1),P=Math.imul(X1,d1),P=P+Math.imul(C1,u1)|0,k=Math.imul(C1,d1),D=D+Math.imul(Q1,c1)|0,P=P+Math.imul(Q1,f1)|0,P=P+Math.imul(J1,c1)|0,k=k+Math.imul(J1,f1)|0,D=D+Math.imul(r,r1)|0,P=P+Math.imul(r,n1)|0,P=P+Math.imul(f,r1)|0,k=k+Math.imul(f,n1)|0;var iQ=(I+D|0)+((P&8191)<<13)|0;I=(k+(P>>>13)|0)+(iQ>>>26)|0,iQ&=67108863,D=Math.imul(w1,u1),P=Math.imul(w1,d1),P=P+Math.imul(E1,u1)|0,k=Math.imul(E1,d1),D=D+Math.imul(X1,c1)|0,P=P+Math.imul(X1,f1)|0,P=P+Math.imul(C1,c1)|0,k=k+Math.imul(C1,f1)|0,D=D+Math.imul(Q1,r1)|0,P=P+Math.imul(Q1,n1)|0,P=P+Math.imul(J1,r1)|0,k=k+Math.imul(J1,n1)|0,D=D+Math.imul(r,i1)|0,P=P+Math.imul(r,o1)|0,P=P+Math.imul(f,i1)|0,k=k+Math.imul(f,o1)|0;var oQ=(I+D|0)+((P&8191)<<13)|0;I=(k+(P>>>13)|0)+(oQ>>>26)|0,oQ&=67108863,D=Math.imul(O1,u1),P=Math.imul(O1,d1),P=P+Math.imul(B1,u1)|0,k=Math.imul(B1,d1),D=D+Math.imul(w1,c1)|0,P=P+Math.imul(w1,f1)|0,P=P+Math.imul(E1,c1)|0,k=k+Math.imul(E1,f1)|0,D=D+Math.imul(X1,r1)|0,P=P+Math.imul(X1,n1)|0,P=P+Math.imul(C1,r1)|0,k=k+Math.imul(C1,n1)|0,D=D+Math.imul(Q1,i1)|0,P=P+Math.imul(Q1,o1)|0,P=P+Math.imul(J1,i1)|0,k=k+Math.imul(J1,o1)|0,D=D+Math.imul(r,a1)|0,P=P+Math.imul(r,s1)|0,P=P+Math.imul(f,a1)|0,k=k+Math.imul(f,s1)|0;var aQ=(I+D|0)+((P&8191)<<13)|0;I=(k+(P>>>13)|0)+(aQ>>>26)|0,aQ&=67108863,D=Math.imul(_1,u1),P=Math.imul(_1,d1),P=P+Math.imul(x1,u1)|0,k=Math.imul(x1,d1),D=D+Math.imul(O1,c1)|0,P=P+Math.imul(O1,f1)|0,P=P+Math.imul(B1,c1)|0,k=k+Math.imul(B1,f1)|0,D=D+Math.imul(w1,r1)|0,P=P+Math.imul(w1,n1)|0,P=P+Math.imul(E1,r1)|0,k=k+Math.imul(E1,n1)|0,D=D+Math.imul(X1,i1)|0,P=P+Math.imul(X1,o1)|0,P=P+Math.imul(C1,i1)|0,k=k+Math.imul(C1,o1)|0,D=D+Math.imul(Q1,a1)|0,P=P+Math.imul(Q1,s1)|0,P=P+Math.imul(J1,a1)|0,k=k+Math.imul(J1,s1)|0,D=D+Math.imul(r,t1)|0,P=P+Math.imul(r,e1)|0,P=P+Math.imul(f,t1)|0,k=k+Math.imul(f,e1)|0;var sQ=(I+D|0)+((P&8191)<<13)|0;I=(k+(P>>>13)|0)+(sQ>>>26)|0,sQ&=67108863,D=Math.imul(h1,u1),P=Math.imul(h1,d1),P=P+Math.imul(g1,u1)|0,k=Math.imul(g1,d1),D=D+Math.imul(_1,c1)|0,P=P+Math.imul(_1,f1)|0,P=P+Math.imul(x1,c1)|0,k=k+Math.imul(x1,f1)|0,D=D+Math.imul(O1,r1)|0,P=P+Math.imul(O1,n1)|0,P=P+Math.imul(B1,r1)|0,k=k+Math.imul(B1,n1)|0,D=D+Math.imul(w1,i1)|0,P=P+Math.imul(w1,o1)|0,P=P+Math.imul(E1,i1)|0,k=k+Math.imul(E1,o1)|0,D=D+Math.imul(X1,a1)|0,P=P+Math.imul(X1,s1)|0,P=P+Math.imul(C1,a1)|0,k=k+Math.imul(C1,s1)|0,D=D+Math.imul(Q1,t1)|0,P=P+Math.imul(Q1,e1)|0,P=P+Math.imul(J1,t1)|0,k=k+Math.imul(J1,e1)|0,D=D+Math.imul(r,T0)|0,P=P+Math.imul(r,A0)|0,P=P+Math.imul(f,T0)|0,k=k+Math.imul(f,A0)|0;var tQ=(I+D|0)+((P&8191)<<13)|0;I=(k+(P>>>13)|0)+(tQ>>>26)|0,tQ&=67108863,D=Math.imul(m1,u1),P=Math.imul(m1,d1),P=P+Math.imul(v1,u1)|0,k=Math.imul(v1,d1),D=D+Math.imul(h1,c1)|0,P=P+Math.imul(h1,f1)|0,P=P+Math.imul(g1,c1)|0,k=k+Math.imul(g1,f1)|0,D=D+Math.imul(_1,r1)|0,P=P+Math.imul(_1,n1)|0,P=P+Math.imul(x1,r1)|0,k=k+Math.imul(x1,n1)|0,D=D+Math.imul(O1,i1)|0,P=P+Math.imul(O1,o1)|0,P=P+Math.imul(B1,i1)|0,k=k+Math.imul(B1,o1)|0,D=D+Math.imul(w1,a1)|0,P=P+Math.imul(w1,s1)|0,P=P+Math.imul(E1,a1)|0,k=k+Math.imul(E1,s1)|0,D=D+Math.imul(X1,t1)|0,P=P+Math.imul(X1,e1)|0,P=P+Math.imul(C1,t1)|0,k=k+Math.imul(C1,e1)|0,D=D+Math.imul(Q1,T0)|0,P=P+Math.imul(Q1,A0)|0,P=P+Math.imul(J1,T0)|0,k=k+Math.imul(J1,A0)|0,D=D+Math.imul(r,Q0)|0,P=P+Math.imul(r,J0)|0,P=P+Math.imul(f,Q0)|0,k=k+Math.imul(f,J0)|0;var eQ=(I+D|0)+((P&8191)<<13)|0;I=(k+(P>>>13)|0)+(eQ>>>26)|0,eQ&=67108863,D=Math.imul(y1,u1),P=Math.imul(y1,d1),P=P+Math.imul(b1,u1)|0,k=Math.imul(b1,d1),D=D+Math.imul(m1,c1)|0,P=P+Math.imul(m1,f1)|0,P=P+Math.imul(v1,c1)|0,k=k+Math.imul(v1,f1)|0,D=D+Math.imul(h1,r1)|0,P=P+Math.imul(h1,n1)|0,P=P+Math.imul(g1,r1)|0,k=k+Math.imul(g1,n1)|0,D=D+Math.imul(_1,i1)|0,P=P+Math.imul(_1,o1)|0,P=P+Math.imul(x1,i1)|0,k=k+Math.imul(x1,o1)|0,D=D+Math.imul(O1,a1)|0,P=P+Math.imul(O1,s1)|0,P=P+Math.imul(B1,a1)|0,k=k+Math.imul(B1,s1)|0,D=D+Math.imul(w1,t1)|0,P=P+Math.imul(w1,e1)|0,P=P+Math.imul(E1,t1)|0,k=k+Math.imul(E1,e1)|0,D=D+Math.imul(X1,T0)|0,P=P+Math.imul(X1,A0)|0,P=P+Math.imul(C1,T0)|0,k=k+Math.imul(C1,A0)|0,D=D+Math.imul(Q1,Q0)|0,P=P+Math.imul(Q1,J0)|0,P=P+Math.imul(J1,Q0)|0,k=k+Math.imul(J1,J0)|0,D=D+Math.imul(r,$0)|0,P=P+Math.imul(r,W0)|0,P=P+Math.imul(f,$0)|0,k=k+Math.imul(f,W0)|0;var T4=(I+D|0)+((P&8191)<<13)|0;I=(k+(P>>>13)|0)+(T4>>>26)|0,T4&=67108863,D=Math.imul(p1,u1),P=Math.imul(p1,d1),P=P+Math.imul(l1,u1)|0,k=Math.imul(l1,d1),D=D+Math.imul(y1,c1)|0,P=P+Math.imul(y1,f1)|0,P=P+Math.imul(b1,c1)|0,k=k+Math.imul(b1,f1)|0,D=D+Math.imul(m1,r1)|0,P=P+Math.imul(m1,n1)|0,P=P+Math.imul(v1,r1)|0,k=k+Math.imul(v1,n1)|0,D=D+Math.imul(h1,i1)|0,P=P+Math.imul(h1,o1)|0,P=P+Math.imul(g1,i1)|0,k=k+Math.imul(g1,o1)|0,D=D+Math.imul(_1,a1)|0,P=P+Math.imul(_1,s1)|0,P=P+Math.imul(x1,a1)|0,k=k+Math.imul(x1,s1)|0,D=D+Math.imul(O1,t1)|0,P=P+Math.imul(O1,e1)|0,P=P+Math.imul(B1,t1)|0,k=k+Math.imul(B1,e1)|0,D=D+Math.imul(w1,T0)|0,P=P+Math.imul(w1,A0)|0,P=P+Math.imul(E1,T0)|0,k=k+Math.imul(E1,A0)|0,D=D+Math.imul(X1,Q0)|0,P=P+Math.imul(X1,J0)|0,P=P+Math.imul(C1,Q0)|0,k=k+Math.imul(C1,J0)|0,D=D+Math.imul(Q1,$0)|0,P=P+Math.imul(Q1,W0)|0,P=P+Math.imul(J1,$0)|0,k=k+Math.imul(J1,W0)|0,D=D+Math.imul(r,G0)|0,P=P+Math.imul(r,U0)|0,P=P+Math.imul(f,G0)|0,k=k+Math.imul(f,U0)|0;var A4=(I+D|0)+((P&8191)<<13)|0;I=(k+(P>>>13)|0)+(A4>>>26)|0,A4&=67108863,D=Math.imul(p1,c1),P=Math.imul(p1,f1),P=P+Math.imul(l1,c1)|0,k=Math.imul(l1,f1),D=D+Math.imul(y1,r1)|0,P=P+Math.imul(y1,n1)|0,P=P+Math.imul(b1,r1)|0,k=k+Math.imul(b1,n1)|0,D=D+Math.imul(m1,i1)|0,P=P+Math.imul(m1,o1)|0,P=P+Math.imul(v1,i1)|0,k=k+Math.imul(v1,o1)|0,D=D+Math.imul(h1,a1)|0,P=P+Math.imul(h1,s1)|0,P=P+Math.imul(g1,a1)|0,k=k+Math.imul(g1,s1)|0,D=D+Math.imul(_1,t1)|0,P=P+Math.imul(_1,e1)|0,P=P+Math.imul(x1,t1)|0,k=k+Math.imul(x1,e1)|0,D=D+Math.imul(O1,T0)|0,P=P+Math.imul(O1,A0)|0,P=P+Math.imul(B1,T0)|0,k=k+Math.imul(B1,A0)|0,D=D+Math.imul(w1,Q0)|0,P=P+Math.imul(w1,J0)|0,P=P+Math.imul(E1,Q0)|0,k=k+Math.imul(E1,J0)|0,D=D+Math.imul(X1,$0)|0,P=P+Math.imul(X1,W0)|0,P=P+Math.imul(C1,$0)|0,k=k+Math.imul(C1,W0)|0,D=D+Math.imul(Q1,G0)|0,P=P+Math.imul(Q1,U0)|0,P=P+Math.imul(J1,G0)|0,k=k+Math.imul(J1,U0)|0;var Q4=(I+D|0)+((P&8191)<<13)|0;I=(k+(P>>>13)|0)+(Q4>>>26)|0,Q4&=67108863,D=Math.imul(p1,r1),P=Math.imul(p1,n1),P=P+Math.imul(l1,r1)|0,k=Math.imul(l1,n1),D=D+Math.imul(y1,i1)|0,P=P+Math.imul(y1,o1)|0,P=P+Math.imul(b1,i1)|0,k=k+Math.imul(b1,o1)|0,D=D+Math.imul(m1,a1)|0,P=P+Math.imul(m1,s1)|0,P=P+Math.imul(v1,a1)|0,k=k+Math.imul(v1,s1)|0,D=D+Math.imul(h1,t1)|0,P=P+Math.imul(h1,e1)|0,P=P+Math.imul(g1,t1)|0,k=k+Math.imul(g1,e1)|0,D=D+Math.imul(_1,T0)|0,P=P+Math.imul(_1,A0)|0,P=P+Math.imul(x1,T0)|0,k=k+Math.imul(x1,A0)|0,D=D+Math.imul(O1,Q0)|0,P=P+Math.imul(O1,J0)|0,P=P+Math.imul(B1,Q0)|0,k=k+Math.imul(B1,J0)|0,D=D+Math.imul(w1,$0)|0,P=P+Math.imul(w1,W0)|0,P=P+Math.imul(E1,$0)|0,k=k+Math.imul(E1,W0)|0,D=D+Math.imul(X1,G0)|0,P=P+Math.imul(X1,U0)|0,P=P+Math.imul(C1,G0)|0,k=k+Math.imul(C1,U0)|0;var J4=(I+D|0)+((P&8191)<<13)|0;I=(k+(P>>>13)|0)+(J4>>>26)|0,J4&=67108863,D=Math.imul(p1,i1),P=Math.imul(p1,o1),P=P+Math.imul(l1,i1)|0,k=Math.imul(l1,o1),D=D+Math.imul(y1,a1)|0,P=P+Math.imul(y1,s1)|0,P=P+Math.imul(b1,a1)|0,k=k+Math.imul(b1,s1)|0,D=D+Math.imul(m1,t1)|0,P=P+Math.imul(m1,e1)|0,P=P+Math.imul(v1,t1)|0,k=k+Math.imul(v1,e1)|0,D=D+Math.imul(h1,T0)|0,P=P+Math.imul(h1,A0)|0,P=P+Math.imul(g1,T0)|0,k=k+Math.imul(g1,A0)|0,D=D+Math.imul(_1,Q0)|0,P=P+Math.imul(_1,J0)|0,P=P+Math.imul(x1,Q0)|0,k=k+Math.imul(x1,J0)|0,D=D+Math.imul(O1,$0)|0,P=P+Math.imul(O1,W0)|0,P=P+Math.imul(B1,$0)|0,k=k+Math.imul(B1,W0)|0,D=D+Math.imul(w1,G0)|0,P=P+Math.imul(w1,U0)|0,P=P+Math.imul(E1,G0)|0,k=k+Math.imul(E1,U0)|0;var $4=(I+D|0)+((P&8191)<<13)|0;I=(k+(P>>>13)|0)+($4>>>26)|0,$4&=67108863,D=Math.imul(p1,a1),P=Math.imul(p1,s1),P=P+Math.imul(l1,a1)|0,k=Math.imul(l1,s1),D=D+Math.imul(y1,t1)|0,P=P+Math.imul(y1,e1)|0,P=P+Math.imul(b1,t1)|0,k=k+Math.imul(b1,e1)|0,D=D+Math.imul(m1,T0)|0,P=P+Math.imul(m1,A0)|0,P=P+Math.imul(v1,T0)|0,k=k+Math.imul(v1,A0)|0,D=D+Math.imul(h1,Q0)|0,P=P+Math.imul(h1,J0)|0,P=P+Math.imul(g1,Q0)|0,k=k+Math.imul(g1,J0)|0,D=D+Math.imul(_1,$0)|0,P=P+Math.imul(_1,W0)|0,P=P+Math.imul(x1,$0)|0,k=k+Math.imul(x1,W0)|0,D=D+Math.imul(O1,G0)|0,P=P+Math.imul(O1,U0)|0,P=P+Math.imul(B1,G0)|0,k=k+Math.imul(B1,U0)|0;var W4=(I+D|0)+((P&8191)<<13)|0;I=(k+(P>>>13)|0)+(W4>>>26)|0,W4&=67108863,D=Math.imul(p1,t1),P=Math.imul(p1,e1),P=P+Math.imul(l1,t1)|0,k=Math.imul(l1,e1),D=D+Math.imul(y1,T0)|0,P=P+Math.imul(y1,A0)|0,P=P+Math.imul(b1,T0)|0,k=k+Math.imul(b1,A0)|0,D=D+Math.imul(m1,Q0)|0,P=P+Math.imul(m1,J0)|0,P=P+Math.imul(v1,Q0)|0,k=k+Math.imul(v1,J0)|0,D=D+Math.imul(h1,$0)|0,P=P+Math.imul(h1,W0)|0,P=P+Math.imul(g1,$0)|0,k=k+Math.imul(g1,W0)|0,D=D+Math.imul(_1,G0)|0,P=P+Math.imul(_1,U0)|0,P=P+Math.imul(x1,G0)|0,k=k+Math.imul(x1,U0)|0;var G4=(I+D|0)+((P&8191)<<13)|0;I=(k+(P>>>13)|0)+(G4>>>26)|0,G4&=67108863,D=Math.imul(p1,T0),P=Math.imul(p1,A0),P=P+Math.imul(l1,T0)|0,k=Math.imul(l1,A0),D=D+Math.imul(y1,Q0)|0,P=P+Math.imul(y1,J0)|0,P=P+Math.imul(b1,Q0)|0,k=k+Math.imul(b1,J0)|0,D=D+Math.imul(m1,$0)|0,P=P+Math.imul(m1,W0)|0,P=P+Math.imul(v1,$0)|0,k=k+Math.imul(v1,W0)|0,D=D+Math.imul(h1,G0)|0,P=P+Math.imul(h1,U0)|0,P=P+Math.imul(g1,G0)|0,k=k+Math.imul(g1,U0)|0;var U4=(I+D|0)+((P&8191)<<13)|0;I=(k+(P>>>13)|0)+(U4>>>26)|0,U4&=67108863,D=Math.imul(p1,Q0),P=Math.imul(p1,J0),P=P+Math.imul(l1,Q0)|0,k=Math.imul(l1,J0),D=D+Math.imul(y1,$0)|0,P=P+Math.imul(y1,W0)|0,P=P+Math.imul(b1,$0)|0,k=k+Math.imul(b1,W0)|0,D=D+Math.imul(m1,G0)|0,P=P+Math.imul(m1,U0)|0,P=P+Math.imul(v1,G0)|0,k=k+Math.imul(v1,U0)|0;var Y4=(I+D|0)+((P&8191)<<13)|0;I=(k+(P>>>13)|0)+(Y4>>>26)|0,Y4&=67108863,D=Math.imul(p1,$0),P=Math.imul(p1,W0),P=P+Math.imul(l1,$0)|0,k=Math.imul(l1,W0),D=D+Math.imul(y1,G0)|0,P=P+Math.imul(y1,U0)|0,P=P+Math.imul(b1,G0)|0,k=k+Math.imul(b1,U0)|0;var Z4=(I+D|0)+((P&8191)<<13)|0;I=(k+(P>>>13)|0)+(Z4>>>26)|0,Z4&=67108863,D=Math.imul(p1,G0),P=Math.imul(p1,U0),P=P+Math.imul(l1,G0)|0,k=Math.imul(l1,U0);var X4=(I+D|0)+((P&8191)<<13)|0;if(I=(k+(P>>>13)|0)+(X4>>>26)|0,X4&=67108863,F[0]=rQ,F[1]=nQ,F[2]=iQ,F[3]=oQ,F[4]=aQ,F[5]=sQ,F[6]=tQ,F[7]=eQ,F[8]=T4,F[9]=A4,F[10]=Q4,F[11]=J4,F[12]=$4,F[13]=W4,F[14]=G4,F[15]=U4,F[16]=Y4,F[17]=Z4,F[18]=X4,I!==0)F[19]=I,q.length++;return q};if(!Math.imul)O=L;function g(R,U,X){X.negative=U.negative^R.negative,X.length=R.length+U.length;var q=0,H=0;for(var V=0;V<X.length-1;V++){var F=H;H=0;var I=q&67108863,D=Math.min(V,U.length-1);for(var P=Math.max(0,V-R.length+1);P<=D;P++){var k=V-P,b=R.words[k]|0,r=U.words[P]|0,f=b*r,T1=f&67108863;F=F+(f/67108864|0)|0,T1=T1+I|0,I=T1&67108863,F=F+(T1>>>26)|0,H+=F>>>26,F&=67108863}X.words[V]=I,q=F,F=H}if(q!==0)X.words[V]=q;else X.length--;return X._strip()}function v(R,U,X){return g(R,U,X)}$.prototype.mulTo=function(U,X){var q,H=this.length+U.length;if(this.length===10&&U.length===10)q=O(this,U,X);else if(H<63)q=L(this,U,X);else if(H<1024)q=g(this,U,X);else q=v(this,U,X);return q};function p(R,U){this.x=R,this.y=U}p.prototype.makeRBT=function(U){var X=Array(U),q=$.prototype._countBits(U)-1;for(var H=0;H<U;H++)X[H]=this.revBin(H,q,U);return X},p.prototype.revBin=function(U,X,q){if(U===0||U===q-1)return U;var H=0;for(var V=0;V<X;V++)H|=(U&1)<<X-V-1,U>>=1;return H},p.prototype.permute=function(U,X,q,H,V,F){for(var I=0;I<F;I++)H[I]=X[U[I]],V[I]=q[U[I]]},p.prototype.transform=function(U,X,q,H,V,F){this.permute(F,U,X,q,H,V);for(var I=1;I<V;I<<=1){var D=I<<1,P=Math.cos(2*Math.PI/D),k=Math.sin(2*Math.PI/D);for(var b=0;b<V;b+=D){var r=P,f=k;for(var T1=0;T1<I;T1++){var Q1=q[b+T1],J1=H[b+T1],r0=q[b+T1+I],X1=H[b+T1+I],C1=r*r0-f*X1;if(X1=r*X1+f*r0,r0=C1,q[b+T1]=Q1+r0,H[b+T1]=J1+X1,q[b+T1+I]=Q1-r0,H[b+T1+I]=J1-X1,T1!==D)C1=P*r-k*f,f=P*f+k*r,r=C1}}}},p.prototype.guessLen13b=function(U,X){var q=Math.max(X,U)|1,H=q&1,V=0;for(q=q/2|0;q;q=q>>>1)V++;return 1<<V+1+H},p.prototype.conjugate=function(U,X,q){if(q<=1)return;for(var H=0;H<q/2;H++){var V=U[H];U[H]=U[q-H-1],U[q-H-1]=V,V=X[H],X[H]=-X[q-H-1],X[q-H-1]=-V}},p.prototype.normalize13b=function(U,X){var q=0;for(var H=0;H<X/2;H++){var V=Math.round(U[2*H+1]/X)*8192+Math.round(U[2*H]/X)+q;if(U[H]=V&67108863,V<67108864)q=0;else q=V/67108864|0}return U},p.prototype.convert13b=function(U,X,q,H){var V=0;for(var F=0;F<X;F++)V=V+(U[F]|0),q[2*F]=V&8191,V=V>>>13,q[2*F+1]=V&8191,V=V>>>13;for(F=2*X;F<H;++F)q[F]=0;Q(V===0),Q((V&-8192)===0)},p.prototype.stub=function(U){var X=Array(U);for(var q=0;q<U;q++)X[q]=0;return X},p.prototype.mulp=function(U,X,q){var H=2*this.guessLen13b(U.length,X.length),V=this.makeRBT(H),F=this.stub(H),I=Array(H),D=Array(H),P=Array(H),k=Array(H),b=Array(H),r=Array(H),f=q.words;f.length=H,this.convert13b(U.words,U.length,I,H),this.convert13b(X.words,X.length,k,H),this.transform(I,F,D,P,H,V),this.transform(k,F,b,r,H,V);for(var T1=0;T1<H;T1++){var Q1=D[T1]*b[T1]-P[T1]*r[T1];P[T1]=D[T1]*r[T1]+P[T1]*b[T1],D[T1]=Q1}return this.conjugate(D,P,H),this.transform(D,P,f,F,H,V),this.conjugate(f,F,H),this.normalize13b(f,H),q.negative=U.negative^X.negative,q.length=U.length+X.length,q._strip()},$.prototype.mul=function(U){var X=new $(null);return X.words=Array(this.length+U.length),this.mulTo(U,X)},$.prototype.mulf=function(U){var X=new $(null);return X.words=Array(this.length+U.length),v(this,U,X)},$.prototype.imul=function(U){return this.clone().mulTo(U,this)},$.prototype.imuln=function(U){var X=U<0;if(X)U=-U;Q(typeof U==="number"),Q(U<67108864);var q=0;for(var H=0;H<this.length;H++){var V=(this.words[H]|0)*U,F=(V&67108863)+(q&67108863);q>>=26,q+=V/67108864|0,q+=F>>>26,this.words[H]=F&67108863}if(q!==0)this.words[H]=q,this.length++;return this.length=U===0?1:this.length,X?this.ineg():this},$.prototype.muln=function(U){return this.clone().imuln(U)},$.prototype.sqr=function(){return this.mul(this)},$.prototype.isqr=function(){return this.imul(this.clone())},$.prototype.pow=function(U){var X=E(U);if(X.length===0)return new $(1);var q=this;for(var H=0;H<X.length;H++,q=q.sqr())if(X[H]!==0)break;if(++H<X.length)for(var V=q.sqr();H<X.length;H++,V=V.sqr()){if(X[H]===0)continue;q=q.mul(V)}return q},$.prototype.iushln=function(U){Q(typeof U==="number"&&U>=0);var X=U%26,q=(U-X)/26,H=67108863>>>26-X<<26-X,V;if(X!==0){var F=0;for(V=0;V<this.length;V++){var I=this.words[V]&H,D=(this.words[V]|0)-I<<X;this.words[V]=D|F,F=I>>>26-X}if(F)this.words[V]=F,this.length++}if(q!==0){for(V=this.length-1;V>=0;V--)this.words[V+q]=this.words[V];for(V=0;V<q;V++)this.words[V]=0;this.length+=q}return this._strip()},$.prototype.ishln=function(U){return Q(this.negative===0),this.iushln(U)},$.prototype.iushrn=function(U,X,q){Q(typeof U==="number"&&U>=0);var H;if(X)H=(X-X%26)/26;else H=0;var V=U%26,F=Math.min((U-V)/26,this.length),I=67108863^67108863>>>V<<V,D=q;if(H-=F,H=Math.max(0,H),D){for(var P=0;P<F;P++)D.words[P]=this.words[P];D.length=F}if(F===0);else if(this.length>F){this.length-=F;for(P=0;P<this.length;P++)this.words[P]=this.words[P+F]}else this.words[0]=0,this.length=1;var k=0;for(P=this.length-1;P>=0&&(k!==0||P>=H);P--){var b=this.words[P]|0;this.words[P]=k<<26-V|b>>>V,k=b&I}if(D&&k!==0)D.words[D.length++]=k;if(this.length===0)this.words[0]=0,this.length=1;return this._strip()},$.prototype.ishrn=function(U,X,q){return Q(this.negative===0),this.iushrn(U,X,q)},$.prototype.shln=function(U){return this.clone().ishln(U)},$.prototype.ushln=function(U){return this.clone().iushln(U)},$.prototype.shrn=function(U){return this.clone().ishrn(U)},$.prototype.ushrn=function(U){return this.clone().iushrn(U)},$.prototype.testn=function(U){Q(typeof U==="number"&&U>=0);var X=U%26,q=(U-X)/26,H=1<<X;if(this.length<=q)return!1;var V=this.words[q];return!!(V&H)},$.prototype.imaskn=function(U){Q(typeof U==="number"&&U>=0);var X=U%26,q=(U-X)/26;if(Q(this.negative===0,"imaskn works only with positive numbers"),this.length<=q)return this;if(X!==0)q++;if(this.length=Math.min(q,this.length),X!==0){var H=67108863^67108863>>>X<<X;this.words[this.length-1]&=H}return this._strip()},$.prototype.maskn=function(U){return this.clone().imaskn(U)},$.prototype.iaddn=function(U){if(Q(typeof U==="number"),Q(U<67108864),U<0)return this.isubn(-U);if(this.negative!==0){if(this.length===1&&(this.words[0]|0)<=U)return this.words[0]=U-(this.words[0]|0),this.negative=0,this;return this.negative=0,this.isubn(U),this.negative=1,this}return this._iaddn(U)},$.prototype._iaddn=function(U){this.words[0]+=U;for(var X=0;X<this.length&&this.words[X]>=67108864;X++)if(this.words[X]-=67108864,X===this.length-1)this.words[X+1]=1;else this.words[X+1]++;return this.length=Math.max(this.length,X+1),this},$.prototype.isubn=function(U){if(Q(typeof U==="number"),Q(U<67108864),U<0)return this.iaddn(-U);if(this.negative!==0)return this.negative=0,this.iaddn(U),this.negative=1,this;if(this.words[0]-=U,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var X=0;X<this.length&&this.words[X]<0;X++)this.words[X]+=67108864,this.words[X+1]-=1;return this._strip()},$.prototype.addn=function(U){return this.clone().iaddn(U)},$.prototype.subn=function(U){return this.clone().isubn(U)},$.prototype.iabs=function(){return this.negative=0,this},$.prototype.abs=function(){return this.clone().iabs()},$.prototype._ishlnsubmul=function(U,X,q){var H=U.length+q,V;this._expand(H);var F,I=0;for(V=0;V<U.length;V++){F=(this.words[V+q]|0)+I;var D=(U.words[V]|0)*X;F-=D&67108863,I=(F>>26)-(D/67108864|0),this.words[V+q]=F&67108863}for(;V<this.length-q;V++)F=(this.words[V+q]|0)+I,I=F>>26,this.words[V+q]=F&67108863;if(I===0)return this._strip();Q(I===-1),I=0;for(V=0;V<this.length;V++)F=-(this.words[V]|0)+I,I=F>>26,this.words[V]=F&67108863;return this.negative=1,this._strip()},$.prototype._wordDiv=function(U,X){var q=this.length-U.length,H=this.clone(),V=U,F=V.words[V.length-1]|0,I=this._countBits(F);if(q=26-I,q!==0)V=V.ushln(q),H.iushln(q),F=V.words[V.length-1]|0;var D=H.length-V.length,P;if(X!=="mod"){P=new $(null),P.length=D+1,P.words=Array(P.length);for(var k=0;k<P.length;k++)P.words[k]=0}var b=H.clone()._ishlnsubmul(V,1,D);if(b.negative===0){if(H=b,P)P.words[D]=1}for(var r=D-1;r>=0;r--){var f=(H.words[V.length+r]|0)*67108864+(H.words[V.length+r-1]|0);f=Math.min(f/F|0,67108863),H._ishlnsubmul(V,f,r);while(H.negative!==0)if(f--,H.negative=0,H._ishlnsubmul(V,1,r),!H.isZero())H.negative^=1;if(P)P.words[r]=f}if(P)P._strip();if(H._strip(),X!=="div"&&q!==0)H.iushrn(q);return{div:P||null,mod:H}},$.prototype.divmod=function(U,X,q){if(Q(!U.isZero()),this.isZero())return{div:new $(0),mod:new $(0)};var H,V,F;if(this.negative!==0&&U.negative===0){if(F=this.neg().divmod(U,X),X!=="mod")H=F.div.neg();if(X!=="div"){if(V=F.mod.neg(),q&&V.negative!==0)V.iadd(U)}return{div:H,mod:V}}if(this.negative===0&&U.negative!==0){if(F=this.divmod(U.neg(),X),X!=="mod")H=F.div.neg();return{div:H,mod:F.mod}}if((this.negative&U.negative)!==0){if(F=this.neg().divmod(U.neg(),X),X!=="div"){if(V=F.mod.neg(),q&&V.negative!==0)V.isub(U)}return{div:F.div,mod:V}}if(U.length>this.length||this.cmp(U)<0)return{div:new $(0),mod:this};if(U.length===1){if(X==="div")return{div:this.divn(U.words[0]),mod:null};if(X==="mod")return{div:null,mod:new $(this.modrn(U.words[0]))};return{div:this.divn(U.words[0]),mod:new $(this.modrn(U.words[0]))}}return this._wordDiv(U,X)},$.prototype.div=function(U){return this.divmod(U,"div",!1).div},$.prototype.mod=function(U){return this.divmod(U,"mod",!1).mod},$.prototype.umod=function(U){return this.divmod(U,"mod",!0).mod},$.prototype.divRound=function(U){var X=this.divmod(U);if(X.mod.isZero())return X.div;var q=X.div.negative!==0?X.mod.isub(U):X.mod,H=U.ushrn(1),V=U.andln(1),F=q.cmp(H);if(F<0||V===1&&F===0)return X.div;return X.div.negative!==0?X.div.isubn(1):X.div.iaddn(1)},$.prototype.modrn=function(U){var X=U<0;if(X)U=-U;Q(U<=67108863);var q=67108864%U,H=0;for(var V=this.length-1;V>=0;V--)H=(q*H+(this.words[V]|0))%U;return X?-H:H},$.prototype.modn=function(U){return this.modrn(U)},$.prototype.idivn=function(U){var X=U<0;if(X)U=-U;Q(U<=67108863);var q=0;for(var H=this.length-1;H>=0;H--){var V=(this.words[H]|0)+q*67108864;this.words[H]=V/U|0,q=V%U}return this._strip(),X?this.ineg():this},$.prototype.divn=function(U){return this.clone().idivn(U)},$.prototype.egcd=function(U){Q(U.negative===0),Q(!U.isZero());var X=this,q=U.clone();if(X.negative!==0)X=X.umod(U);else X=X.clone();var H=new $(1),V=new $(0),F=new $(0),I=new $(1),D=0;while(X.isEven()&&q.isEven())X.iushrn(1),q.iushrn(1),++D;var P=q.clone(),k=X.clone();while(!X.isZero()){for(var b=0,r=1;(X.words[0]&r)===0&&b<26;++b,r<<=1);if(b>0){X.iushrn(b);while(b-- >0){if(H.isOdd()||V.isOdd())H.iadd(P),V.isub(k);H.iushrn(1),V.iushrn(1)}}for(var f=0,T1=1;(q.words[0]&T1)===0&&f<26;++f,T1<<=1);if(f>0){q.iushrn(f);while(f-- >0){if(F.isOdd()||I.isOdd())F.iadd(P),I.isub(k);F.iushrn(1),I.iushrn(1)}}if(X.cmp(q)>=0)X.isub(q),H.isub(F),V.isub(I);else q.isub(X),F.isub(H),I.isub(V)}return{a:F,b:I,gcd:q.iushln(D)}},$.prototype._invmp=function(U){Q(U.negative===0),Q(!U.isZero());var X=this,q=U.clone();if(X.negative!==0)X=X.umod(U);else X=X.clone();var H=new $(1),V=new $(0),F=q.clone();while(X.cmpn(1)>0&&q.cmpn(1)>0){for(var I=0,D=1;(X.words[0]&D)===0&&I<26;++I,D<<=1);if(I>0){X.iushrn(I);while(I-- >0){if(H.isOdd())H.iadd(F);H.iushrn(1)}}for(var P=0,k=1;(q.words[0]&k)===0&&P<26;++P,k<<=1);if(P>0){q.iushrn(P);while(P-- >0){if(V.isOdd())V.iadd(F);V.iushrn(1)}}if(X.cmp(q)>=0)X.isub(q),H.isub(V);else q.isub(X),V.isub(H)}var b;if(X.cmpn(1)===0)b=H;else b=V;if(b.cmpn(0)<0)b.iadd(U);return b},$.prototype.gcd=function(U){if(this.isZero())return U.abs();if(U.isZero())return this.abs();var X=this.clone(),q=U.clone();X.negative=0,q.negative=0;for(var H=0;X.isEven()&&q.isEven();H++)X.iushrn(1),q.iushrn(1);do{while(X.isEven())X.iushrn(1);while(q.isEven())q.iushrn(1);var V=X.cmp(q);if(V<0){var F=X;X=q,q=F}else if(V===0||q.cmpn(1)===0)break;X.isub(q)}while(!0);return q.iushln(H)},$.prototype.invm=function(U){return this.egcd(U).a.umod(U)},$.prototype.isEven=function(){return(this.words[0]&1)===0},$.prototype.isOdd=function(){return(this.words[0]&1)===1},$.prototype.andln=function(U){return this.words[0]&U},$.prototype.bincn=function(U){Q(typeof U==="number");var X=U%26,q=(U-X)/26,H=1<<X;if(this.length<=q)return this._expand(q+1),this.words[q]|=H,this;var V=H;for(var F=q;V!==0&&F<this.length;F++){var I=this.words[F]|0;I+=V,V=I>>>26,I&=67108863,this.words[F]=I}if(V!==0)this.words[F]=V,this.length++;return this},$.prototype.isZero=function(){return this.length===1&&this.words[0]===0},$.prototype.cmpn=function(U){var X=U<0;if(this.negative!==0&&!X)return-1;if(this.negative===0&&X)return 1;this._strip();var q;if(this.length>1)q=1;else{if(X)U=-U;Q(U<=67108863,"Number is too big");var H=this.words[0]|0;q=H===U?0:H<U?-1:1}if(this.negative!==0)return-q|0;return q},$.prototype.cmp=function(U){if(this.negative!==0&&U.negative===0)return-1;if(this.negative===0&&U.negative!==0)return 1;var X=this.ucmp(U);if(this.negative!==0)return-X|0;return X},$.prototype.ucmp=function(U){if(this.length>U.length)return 1;if(this.length<U.length)return-1;var X=0;for(var q=this.length-1;q>=0;q--){var H=this.words[q]|0,V=U.words[q]|0;if(H===V)continue;if(H<V)X=-1;else if(H>V)X=1;break}return X},$.prototype.gtn=function(U){return this.cmpn(U)===1},$.prototype.gt=function(U){return this.cmp(U)===1},$.prototype.gten=function(U){return this.cmpn(U)>=0},$.prototype.gte=function(U){return this.cmp(U)>=0},$.prototype.ltn=function(U){return this.cmpn(U)===-1},$.prototype.lt=function(U){return this.cmp(U)===-1},$.prototype.lten=function(U){return this.cmpn(U)<=0},$.prototype.lte=function(U){return this.cmp(U)<=0},$.prototype.eqn=function(U){return this.cmpn(U)===0},$.prototype.eq=function(U){return this.cmp(U)===0},$.red=function(U){return new n(U)},$.prototype.toRed=function(U){return Q(!this.red,"Already a number in reduction context"),Q(this.negative===0,"red works only with positives"),U.convertTo(this)._forceRed(U)},$.prototype.fromRed=function(){return Q(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},$.prototype._forceRed=function(U){return this.red=U,this},$.prototype.forceRed=function(U){return Q(!this.red,"Already a number in reduction context"),this._forceRed(U)},$.prototype.redAdd=function(U){return Q(this.red,"redAdd works only with red numbers"),this.red.add(this,U)},$.prototype.redIAdd=function(U){return Q(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,U)},$.prototype.redSub=function(U){return Q(this.red,"redSub works only with red numbers"),this.red.sub(this,U)},$.prototype.redISub=function(U){return Q(this.red,"redISub works only with red numbers"),this.red.isub(this,U)},$.prototype.redShl=function(U){return Q(this.red,"redShl works only with red numbers"),this.red.shl(this,U)},$.prototype.redMul=function(U){return Q(this.red,"redMul works only with red numbers"),this.red._verify2(this,U),this.red.mul(this,U)},$.prototype.redIMul=function(U){return Q(this.red,"redMul works only with red numbers"),this.red._verify2(this,U),this.red.imul(this,U)},$.prototype.redSqr=function(){return Q(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},$.prototype.redISqr=function(){return Q(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},$.prototype.redSqrt=function(){return Q(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},$.prototype.redInvm=function(){return Q(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},$.prototype.redNeg=function(){return Q(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},$.prototype.redPow=function(U){return Q(this.red&&!U.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,U)};var c={k256:null,p224:null,p192:null,p25519:null};function u(R,U){this.name=R,this.p=new $(U,16),this.n=this.p.bitLength(),this.k=new $(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}u.prototype._tmp=function(){var U=new $(null);return U.words=Array(Math.ceil(this.n/13)),U},u.prototype.ireduce=function(U){var X=U,q;do this.split(X,this.tmp),X=this.imulK(X),X=X.iadd(this.tmp),q=X.bitLength();while(q>this.n);var H=q<this.n?-1:X.ucmp(this.p);if(H===0)X.words[0]=0,X.length=1;else if(H>0)X.isub(this.p);else if(X.strip!==void 0)X.strip();else X._strip();return X},u.prototype.split=function(U,X){U.iushrn(this.n,0,X)},u.prototype.imulK=function(U){return U.imul(this.k)};function i(){u.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}J(i,u),i.prototype.split=function(U,X){var q=4194303,H=Math.min(U.length,9);for(var V=0;V<H;V++)X.words[V]=U.words[V];if(X.length=H,U.length<=9){U.words[0]=0,U.length=1;return}var F=U.words[9];X.words[X.length++]=F&q;for(V=10;V<U.length;V++){var I=U.words[V]|0;U.words[V-10]=(I&q)<<4|F>>>22,F=I}if(F>>>=22,U.words[V-10]=F,F===0&&U.length>10)U.length-=10;else U.length-=9},i.prototype.imulK=function(U){U.words[U.length]=0,U.words[U.length+1]=0,U.length+=2;var X=0;for(var q=0;q<U.length;q++){var H=U.words[q]|0;X+=H*977,U.words[q]=X&67108863,X=H*64+(X/67108864|0)}if(U.words[U.length-1]===0){if(U.length--,U.words[U.length-1]===0)U.length--}return U};function d(){u.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}J(d,u);function h(){u.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}J(h,u);function o(){u.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}J(o,u),o.prototype.imulK=function(U){var X=0;for(var q=0;q<U.length;q++){var H=(U.words[q]|0)*19+X,V=H&67108863;H>>>=26,U.words[q]=V,X=H}if(X!==0)U.words[U.length++]=X;return U},$._prime=function(U){if(c[U])return c[U];var X;if(U==="k256")X=new i;else if(U==="p224")X=new d;else if(U==="p192")X=new h;else if(U==="p25519")X=new o;else throw Error("Unknown prime "+U);return c[U]=X,X};function n(R){if(typeof R==="string"){var U=$._prime(R);this.m=U.p,this.prime=U}else Q(R.gtn(1),"modulus must be greater than 1"),this.m=R,this.prime=null}n.prototype._verify1=function(U){Q(U.negative===0,"red works only with positives"),Q(U.red,"red works only with red numbers")},n.prototype._verify2=function(U,X){Q((U.negative|X.negative)===0,"red works only with positives"),Q(U.red&&U.red===X.red,"red works only with red numbers")},n.prototype.imod=function(U){if(this.prime)return this.prime.ireduce(U)._forceRed(this);return C(U,U.umod(this.m)._forceRed(this)),U},n.prototype.neg=function(U){if(U.isZero())return U.clone();return this.m.sub(U)._forceRed(this)},n.prototype.add=function(U,X){this._verify2(U,X);var q=U.add(X);if(q.cmp(this.m)>=0)q.isub(this.m);return q._forceRed(this)},n.prototype.iadd=function(U,X){this._verify2(U,X);var q=U.iadd(X);if(q.cmp(this.m)>=0)q.isub(this.m);return q},n.prototype.sub=function(U,X){this._verify2(U,X);var q=U.sub(X);if(q.cmpn(0)<0)q.iadd(this.m);return q._forceRed(this)},n.prototype.isub=function(U,X){this._verify2(U,X);var q=U.isub(X);if(q.cmpn(0)<0)q.iadd(this.m);return q},n.prototype.shl=function(U,X){return this._verify1(U),this.imod(U.ushln(X))},n.prototype.imul=function(U,X){return this._verify2(U,X),this.imod(U.imul(X))},n.prototype.mul=function(U,X){return this._verify2(U,X),this.imod(U.mul(X))},n.prototype.isqr=function(U){return this.imul(U,U.clone())},n.prototype.sqr=function(U){return this.mul(U,U)},n.prototype.sqrt=function(U){if(U.isZero())return U.clone();var X=this.m.andln(3);if(Q(X%2===1),X===3){var q=this.m.add(new $(1)).iushrn(2);return this.pow(U,q)}var H=this.m.subn(1),V=0;while(!H.isZero()&&H.andln(1)===0)V++,H.iushrn(1);Q(!H.isZero());var F=new $(1).toRed(this),I=F.redNeg(),D=this.m.subn(1).iushrn(1),P=this.m.bitLength();P=new $(2*P*P).toRed(this);while(this.pow(P,D).cmp(I)!==0)P.redIAdd(I);var k=this.pow(P,H),b=this.pow(U,H.addn(1).iushrn(1)),r=this.pow(U,H),f=V;while(r.cmp(F)!==0){var T1=r;for(var Q1=0;T1.cmp(F)!==0;Q1++)T1=T1.redSqr();Q(Q1<f);var J1=this.pow(k,new $(1).iushln(f-Q1-1));b=b.redMul(J1),k=J1.redSqr(),r=r.redMul(k),f=Q1}return b},n.prototype.invm=function(U){var X=U._invmp(this.m);if(X.negative!==0)return X.negative=0,this.imod(X).redNeg();else return this.imod(X)},n.prototype.pow=function(U,X){if(X.isZero())return new $(1).toRed(this);if(X.cmpn(1)===0)return U.clone();var q=4,H=Array(1<<q);H[0]=new $(1).toRed(this),H[1]=U;for(var V=2;V<H.length;V++)H[V]=this.mul(H[V-1],U);var F=H[0],I=0,D=0,P=X.bitLength()%26;if(P===0)P=26;for(V=X.length-1;V>=0;V--){var k=X.words[V];for(var b=P-1;b>=0;b--){var r=k>>b&1;if(F!==H[0])F=this.sqr(F);if(r===0&&I===0){D=0;continue}if(I<<=1,I|=r,D++,D!==q&&(V!==0||b!==0))continue;F=this.mul(F,H[I]),D=0,I=0}P=26}return F},n.prototype.convertTo=function(U){var X=U.umod(this.m);return X===U?X.clone():X},n.prototype.convertFrom=function(U){var X=U.clone();return X.red=null,X},$.mont=function(U){return new x(U)};function x(R){if(n.call(this,R),this.shift=this.m.bitLength(),this.shift%26!==0)this.shift+=26-this.shift%26;this.r=new $(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)}J(x,n),x.prototype.convertTo=function(U){return this.imod(U.ushln(this.shift))},x.prototype.convertFrom=function(U){var X=this.imod(U.mul(this.rinv));return X.red=null,X},x.prototype.imul=function(U,X){if(U.isZero()||X.isZero())return U.words[0]=0,U.length=1,U;var q=U.imul(X),H=q.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),V=q.isub(H).iushrn(this.shift),F=V;if(V.cmp(this.m)>=0)F=V.isub(this.m);else if(V.cmpn(0)<0)F=V.iadd(this.m);return F._forceRed(this)},x.prototype.mul=function(U,X){if(U.isZero()||X.isZero())return new $(0)._forceRed(this);var q=U.mul(X),H=q.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),V=q.isub(H).iushrn(this.shift),F=V;if(V.cmp(this.m)>=0)F=V.isub(this.m);else if(V.cmpn(0)<0)F=V.iadd(this.m);return F._forceRed(this)},x.prototype.invm=function(U){var X=this.imod(U._invmp(this.m).mul(this.r2));return X._forceRed(this)}})(typeof H$>"u"||H$,z9)});var I9=ZT((j$,N9)=>{/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var e6=(OA(),VA(l6)),vT=e6.Buffer;function F9(T,A){for(var Q in T)A[Q]=T[Q]}if(vT.from&&vT.alloc&&vT.allocUnsafe&&vT.allocUnsafeSlow)N9.exports=e6;else F9(e6,j$),j$.Buffer=WA;function WA(T,A,Q){return vT(T,A,Q)}WA.prototype=Object.create(vT.prototype);F9(vT,WA);WA.from=function(T,A,Q){if(typeof T==="number")throw TypeError("Argument must not be a number");return vT(T,A,Q)};WA.alloc=function(T,A,Q){if(typeof T!=="number")throw TypeError("Argument must be a number");var J=vT(T);if(A!==void 0)if(typeof Q==="string")J.fill(A,Q);else J.fill(A);else J.fill(0);return J};WA.allocUnsafe=function(T){if(typeof T!=="number")throw TypeError("Argument must be a number");return vT(T)};WA.allocUnsafeSlow=function(T){if(typeof T!=="number")throw TypeError("Argument must be a number");return e6.SlowBuffer(T)}});var L9=ZT((Gx,S9)=>{var TQ=I9().Buffer;function KR(T){if(T.length>=255)throw TypeError("Alphabet too long");var A=new Uint8Array(256);for(var Q=0;Q<A.length;Q++)A[Q]=255;for(var J=0;J<T.length;J++){var $=T.charAt(J),W=$.charCodeAt(0);if(A[W]!==255)throw TypeError($+" is ambiguous");A[W]=J}var G=T.length,Y=T.charAt(0),Z=Math.log(G)/Math.log(256),C=Math.log(256)/Math.log(G);function K(z){if(Array.isArray(z)||z instanceof Uint8Array)z=TQ.from(z);if(!TQ.isBuffer(z))throw TypeError("Expected Buffer");if(z.length===0)return"";var N=0,E=0,L=0,O=z.length;while(L!==O&&z[L]===0)L++,N++;var g=(O-L)*C+1>>>0,v=new Uint8Array(g);while(L!==O){var p=z[L],c=0;for(var u=g-1;(p!==0||c<E)&&u!==-1;u--,c++)p+=256*v[u]>>>0,v[u]=p%G>>>0,p=p/G>>>0;if(p!==0)throw Error("Non-zero carry");E=c,L++}var i=g-E;while(i!==g&&v[i]===0)i++;var d=Y.repeat(N);for(;i<g;++i)d+=T.charAt(v[i]);return d}function j(z){if(typeof z!=="string")throw TypeError("Expected String");if(z.length===0)return TQ.alloc(0);var N=0,E=0,L=0;while(z[N]===Y)E++,N++;var O=(z.length-N)*Z+1>>>0,g=new Uint8Array(O);while(N<z.length){var v=z.charCodeAt(N);if(v>255)return;var p=A[v];if(p===255)return;var c=0;for(var u=O-1;(p!==0||c<L)&&u!==-1;u--,c++)p+=G*g[u]>>>0,g[u]=p%256>>>0,p=p/256>>>0;if(p!==0)throw Error("Non-zero carry");L=c,N++}var i=O-L;while(i!==O&&g[i]===0)i++;var d=TQ.allocUnsafe(E+(O-i));d.fill(0,0,E);var h=E;while(i!==O)d[h++]=g[i++];return d}function M(z){var N=j(z);if(N)return N;throw Error("Non-base"+G+" character")}return{encode:K,decodeUnsafe:j,decode:M}}S9.exports=KR});var R$=ZT((Ux,w9)=>{var CR=L9(),HR="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";w9.exports=CR(HR)});var E9={};P4(E9,{TextEncoder:()=>$Q,TextDecoder:()=>JQ});function W8(T,A,Q){return A<=T&&T<=Q}function WQ(T){if(T===void 0)return{};if(T===Object(T))return T;throw TypeError("Could not convert argument to dictionary")}function VR(T){var A=String(T),Q=A.length,J=0,$=[];while(J<Q){var W=A.charCodeAt(J);if(W<55296||W>57343)$.push(W);else if(56320<=W&&W<=57343)$.push(65533);else if(55296<=W&&W<=56319)if(J===Q-1)$.push(65533);else{var G=T.charCodeAt(J+1);if(56320<=G&&G<=57343){var Y=W&1023,Z=G&1023;$.push(65536+(Y<<10)+Z),J+=1}else $.push(65533)}J+=1}return $}function jR(T){var A="";for(var Q=0;Q<T.length;++Q){var J=T[Q];if(J<=65535)A+=String.fromCharCode(J);else J-=65536,A+=String.fromCharCode((J>>10)+55296,(J&1023)+56320)}return A}function k$(T){this.tokens=[].slice.call(T)}function M$(T,A){if(T)throw TypeError("Decoder error");return A||65533}function RR(){}function DR(){}function JQ(T,A){if(!(this instanceof JQ))return new JQ(T,A);if(T=T!==void 0?String(T).toLowerCase():QQ,T!==QQ)throw Error("Encoding not supported. Only utf-8 is supported");A=WQ(A),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=Boolean(A.fatal),this._ignoreBOM=Boolean(A.ignoreBOM),Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}function $Q(T,A){if(!(this instanceof $Q))return new $Q(T,A);if(T=T!==void 0?String(T).toLowerCase():QQ,T!==QQ)throw Error("Encoding not supported. Only utf-8 is supported");A=WQ(A),this._streaming=!1,this._encoder=null,this._options={fatal:Boolean(A.fatal)},Object.defineProperty(this,"encoding",{value:"utf-8"})}function MR(T){var A=T.fatal,Q=0,J=0,$=0,W=128,G=191;this.handler=function(Y,Z){if(Z===AQ&&$!==0)return $=0,M$(A);if(Z===AQ)return vA;if($===0){if(W8(Z,0,127))return Z;if(W8(Z,194,223))$=1,Q=Z-192;else if(W8(Z,224,239)){if(Z===224)W=160;if(Z===237)G=159;$=2,Q=Z-224}else if(W8(Z,240,244)){if(Z===240)W=144;if(Z===244)G=143;$=3,Q=Z-240}else return M$(A);return Q=Q<<6*$,null}if(!W8(Z,W,G))return Q=$=J=0,W=128,G=191,Y.prepend(Z),M$(A);if(W=128,G=191,J+=1,Q+=Z-128<<6*($-J),J!==$)return null;var C=Q;return Q=$=J=0,C}}function kR(T){var A=T.fatal;this.handler=function(Q,J){if(J===AQ)return vA;if(W8(J,0,127))return J;var $,W;if(W8(J,128,2047))$=1,W=192;else if(W8(J,2048,65535))$=2,W=224;else if(W8(J,65536,1114111))$=3,W=240;var G=[(J>>6*$)+W];while($>0){var Y=J>>6*($-1);G.push(128|Y&63),$-=1}return G}}var AQ=-1,vA=-1,QQ="utf-8";var O9=w0(()=>{k$.prototype={endOfStream:function(){return!this.tokens.length},read:function(){if(!this.tokens.length)return AQ;return this.tokens.shift()},prepend:function(T){if(Array.isArray(T)){var A=T;while(A.length)this.tokens.unshift(A.pop())}else this.tokens.unshift(T)},push:function(T){if(Array.isArray(T)){var A=T;while(A.length)this.tokens.push(A.shift())}else this.tokens.push(T)}};RR.prototype={handler:function(T,A){}};DR.prototype={handler:function(T,A){}};JQ.prototype={decode:function(A,Q){var J;if(typeof A==="object"&&A instanceof ArrayBuffer)J=new Uint8Array(A);else if(typeof A==="object"&&"buffer"in A&&A.buffer instanceof ArrayBuffer)J=new Uint8Array(A.buffer,A.byteOffset,A.byteLength);else J=new Uint8Array(0);if(Q=WQ(Q),!this._streaming)this._decoder=new MR({fatal:this._fatal}),this._BOMseen=!1;this._streaming=Boolean(Q.stream);var $=new k$(J),W=[],G;while(!$.endOfStream()){if(G=this._decoder.handler($,$.read()),G===vA)break;if(G===null)continue;if(Array.isArray(G))W.push.apply(W,G);else W.push(G)}if(!this._streaming){do{if(G=this._decoder.handler($,$.read()),G===vA)break;if(G===null)continue;if(Array.isArray(G))W.push.apply(W,G);else W.push(G)}while(!$.endOfStream());this._decoder=null}if(W.length){if(["utf-8"].indexOf(this.encoding)!==-1&&!this._ignoreBOM&&!this._BOMseen)if(W[0]===65279)this._BOMseen=!0,W.shift();else this._BOMseen=!0}return jR(W)}};$Q.prototype={encode:function(A,Q){if(A=A?String(A):"",Q=WQ(Q),!this._streaming)this._encoder=new kR(this._options);this._streaming=Boolean(Q.stream);var J=[],$=new k$(VR(A)),W;while(!$.endOfStream()){if(W=this._encoder.handler($,$.read()),W===vA)break;if(Array.isArray(W))J.push.apply(J,W);else J.push(W)}if(!this._streaming){while(!0){if(W=this._encoder.handler($,$.read()),W===vA)break;if(Array.isArray(W))J.push.apply(J,W);else J.push(W)}this._encoder=null}return new Uint8Array(J)}}});var g9=ZT((K1)=>{var zR=K1&&K1.__createBinding||(Object.create?function(T,A,Q,J){if(J===void 0)J=Q;Object.defineProperty(T,J,{enumerable:!0,get:function(){return A[Q]}})}:function(T,A,Q,J){if(J===void 0)J=Q;T[J]=A[Q]}),FR=K1&&K1.__setModuleDefault||(Object.create?function(T,A){Object.defineProperty(T,"default",{enumerable:!0,value:A})}:function(T,A){T.default=A}),yT=K1&&K1.__decorate||function(T,A,Q,J){var $=arguments.length,W=$<3?A:J===null?J=Object.getOwnPropertyDescriptor(A,Q):J,G;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")W=Reflect.decorate(T,A,Q,J);else for(var Y=T.length-1;Y>=0;Y--)if(G=T[Y])W=($<3?G(W):$>3?G(A,Q,W):G(A,Q))||W;return $>3&&W&&Object.defineProperty(A,Q,W),W},NR=K1&&K1.__importStar||function(T){if(T&&T.__esModule)return T;var A={};if(T!=null){for(var Q in T)if(Q!=="default"&&Object.hasOwnProperty.call(T,Q))zR(A,T,Q)}return FR(A,T),A},B9=K1&&K1.__importDefault||function(T){return T&&T.__esModule?T:{default:T}};Object.defineProperty(K1,"__esModule",{value:!0});K1.deserializeUnchecked=K1.deserialize=K1.serialize=K1.BinaryReader=K1.BinaryWriter=K1.BorshError=K1.baseDecode=K1.baseEncode=void 0;var B8=B9(V$()),_9=B9(R$()),IR=NR((O9(),VA(E9))),SR=typeof TextDecoder!=="function"?IR.TextDecoder:TextDecoder,LR=new SR("utf-8",{fatal:!0});function wR(T){if(typeof T==="string")T=Buffer.from(T,"utf8");return _9.default.encode(Buffer.from(T))}K1.baseEncode=wR;function ER(T){return Buffer.from(_9.default.decode(T))}K1.baseDecode=ER;var z$=1024;class B0 extends Error{constructor(T){super(T);this.fieldPath=[],this.originalMessage=T}addToFieldPath(T){this.fieldPath.splice(0,0,T),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}K1.BorshError=B0;class F${constructor(){this.buf=Buffer.alloc(z$),this.length=0}maybeResize(){if(this.buf.length<16+this.length)this.buf=Buffer.concat([this.buf,Buffer.alloc(z$)])}writeU8(T){this.maybeResize(),this.buf.writeUInt8(T,this.length),this.length+=1}writeU16(T){this.maybeResize(),this.buf.writeUInt16LE(T,this.length),this.length+=2}writeU32(T){this.maybeResize(),this.buf.writeUInt32LE(T,this.length),this.length+=4}writeU64(T){this.maybeResize(),this.writeBuffer(Buffer.from(new B8.default(T).toArray("le",8)))}writeU128(T){this.maybeResize(),this.writeBuffer(Buffer.from(new B8.default(T).toArray("le",16)))}writeU256(T){this.maybeResize(),this.writeBuffer(Buffer.from(new B8.default(T).toArray("le",32)))}writeU512(T){this.maybeResize(),this.writeBuffer(Buffer.from(new B8.default(T).toArray("le",64)))}writeBuffer(T){this.buf=Buffer.concat([Buffer.from(this.buf.subarray(0,this.length)),T,Buffer.alloc(z$)]),this.length+=T.length}writeString(T){this.maybeResize();let A=Buffer.from(T,"utf8");this.writeU32(A.length),this.writeBuffer(A)}writeFixedArray(T){this.writeBuffer(Buffer.from(T))}writeArray(T,A){this.maybeResize(),this.writeU32(T.length);for(let Q of T)this.maybeResize(),A(Q)}toArray(){return this.buf.subarray(0,this.length)}}K1.BinaryWriter=F$;function bT(T,A,Q){let J=Q.value;Q.value=function(...$){try{return J.apply(this,$)}catch(W){if(W instanceof RangeError){let G=W.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(G)>=0)throw new B0("Reached the end of buffer when deserializing")}throw W}}}class e0{constructor(T){this.buf=T,this.offset=0}readU8(){let T=this.buf.readUInt8(this.offset);return this.offset+=1,T}readU16(){let T=this.buf.readUInt16LE(this.offset);return this.offset+=2,T}readU32(){let T=this.buf.readUInt32LE(this.offset);return this.offset+=4,T}readU64(){let T=this.readBuffer(8);return new B8.default(T,"le")}readU128(){let T=this.readBuffer(16);return new B8.default(T,"le")}readU256(){let T=this.readBuffer(32);return new B8.default(T,"le")}readU512(){let T=this.readBuffer(64);return new B8.default(T,"le")}readBuffer(T){if(this.offset+T>this.buf.length)throw new B0(`Expected buffer length ${T} isn't within bounds`);let A=this.buf.slice(this.offset,this.offset+T);return this.offset+=T,A}readString(){let T=this.readU32(),A=this.readBuffer(T);try{return LR.decode(A)}catch(Q){throw new B0(`Error decoding UTF-8 string: ${Q}`)}}readFixedArray(T){return new Uint8Array(this.readBuffer(T))}readArray(T){let A=this.readU32(),Q=Array();for(let J=0;J<A;++J)Q.push(T());return Q}}yT([bT],e0.prototype,"readU8",null);yT([bT],e0.prototype,"readU16",null);yT([bT],e0.prototype,"readU32",null);yT([bT],e0.prototype,"readU64",null);yT([bT],e0.prototype,"readU128",null);yT([bT],e0.prototype,"readU256",null);yT([bT],e0.prototype,"readU512",null);yT([bT],e0.prototype,"readString",null);yT([bT],e0.prototype,"readFixedArray",null);yT([bT],e0.prototype,"readArray",null);K1.BinaryReader=e0;function x9(T){return T.charAt(0).toUpperCase()+T.slice(1)}function GA(T,A,Q,J,$){try{if(typeof J==="string")$[`write${x9(J)}`](Q);else if(J instanceof Array)if(typeof J[0]==="number"){if(Q.length!==J[0])throw new B0(`Expecting byte array of length ${J[0]}, but got ${Q.length} bytes`);$.writeFixedArray(Q)}else if(J.length===2&&typeof J[1]==="number"){if(Q.length!==J[1])throw new B0(`Expecting byte array of length ${J[1]}, but got ${Q.length} bytes`);for(let W=0;W<J[1];W++)GA(T,null,Q[W],J[0],$)}else $.writeArray(Q,(W)=>{GA(T,A,W,J[0],$)});else if(J.kind!==void 0)switch(J.kind){case"option":{if(Q===null||Q===void 0)$.writeU8(0);else $.writeU8(1),GA(T,A,Q,J.type,$);break}case"map":{$.writeU32(Q.size),Q.forEach((W,G)=>{GA(T,A,G,J.key,$),GA(T,A,W,J.value,$)});break}default:throw new B0(`FieldType ${J} unrecognized`)}else h9(T,Q,$)}catch(W){if(W instanceof B0)W.addToFieldPath(A);throw W}}function h9(T,A,Q){if(typeof A.borshSerialize==="function"){A.borshSerialize(Q);return}let J=T.get(A.constructor);if(!J)throw new B0(`Class ${A.constructor.name} is missing in schema`);if(J.kind==="struct")J.fields.map(([$,W])=>{GA(T,$,A[$],W,Q)});else if(J.kind==="enum"){let $=A[J.field];for(let W=0;W<J.values.length;++W){let[G,Y]=J.values[W];if(G===$){Q.writeU8(W),GA(T,G,A[G],Y,Q);break}}}else throw new B0(`Unexpected schema kind: ${J.kind} for ${A.constructor.name}`)}function OR(T,A,Q=F$){let J=new Q;return h9(T,A,J),J.toArray()}K1.serialize=OR;function UA(T,A,Q,J){try{if(typeof Q==="string")return J[`read${x9(Q)}`]();if(Q instanceof Array)if(typeof Q[0]==="number")return J.readFixedArray(Q[0]);else if(typeof Q[1]==="number"){let $=[];for(let W=0;W<Q[1];W++)$.push(UA(T,null,Q[0],J));return $}else return J.readArray(()=>UA(T,A,Q[0],J));if(Q.kind==="option"){if(J.readU8())return UA(T,A,Q.type,J);return}if(Q.kind==="map"){let $=new Map,W=J.readU32();for(let G=0;G<W;G++){let Y=UA(T,A,Q.key,J),Z=UA(T,A,Q.value,J);$.set(Y,Z)}return $}return N$(T,Q,J)}catch($){if($ instanceof B0)$.addToFieldPath(A);throw $}}function N$(T,A,Q){if(typeof A.borshDeserialize==="function")return A.borshDeserialize(Q);let J=T.get(A);if(!J)throw new B0(`Class ${A.name} is missing in schema`);if(J.kind==="struct"){let $={};for(let[W,G]of T.get(A).fields)$[W]=UA(T,W,G,Q);return new A($)}if(J.kind==="enum"){let $=Q.readU8();if($>=J.values.length)throw new B0(`Enum index: ${$} is out of range`);let[W,G]=J.values[$],Y=UA(T,W,G,Q);return new A({[W]:Y})}throw new B0(`Unexpected schema kind: ${J.kind} for ${A.constructor.name}`)}function BR(T,A,Q,J=e0){let $=new J(Q),W=N$(T,A,$);if($.offset<Q.length)throw new B0(`Unexpected ${Q.length-$.offset} bytes after deserialized data`);return W}K1.deserialize=BR;function _R(T,A,Q,J=e0){let $=new J(Q);return N$(T,A,$)}K1.deserializeUnchecked=_R});var G8=ZT((m9)=>{Object.defineProperty(m9,"__esModule",{value:!0});m9.s16=m9.s8=m9.nu64be=m9.u48be=m9.u40be=m9.u32be=m9.u24be=m9.u16be=m9.nu64=m9.u48=m9.u40=m9.u32=m9.u24=m9.u16=m9.u8=m9.offset=m9.greedy=m9.Constant=m9.UTF8=m9.CString=m9.Blob=m9.Boolean=m9.BitField=m9.BitStructure=m9.VariantLayout=m9.Union=m9.UnionLayoutDiscriminator=m9.UnionDiscriminator=m9.Structure=m9.Sequence=m9.DoubleBE=m9.Double=m9.FloatBE=m9.Float=m9.NearInt64BE=m9.NearInt64=m9.NearUInt64BE=m9.NearUInt64=m9.IntBE=m9.Int=m9.UIntBE=m9.UInt=m9.OffsetLayout=m9.GreedyCount=m9.ExternalLayout=m9.bindConstructorLayout=m9.nameWithProperty=m9.Layout=m9.uint8ArrayToBuffer=m9.checkUint8Array=void 0;m9.constant=m9.utf8=m9.cstr=m9.blob=m9.unionLayoutDiscriminator=m9.union=m9.seq=m9.bits=m9.struct=m9.f64be=m9.f64=m9.f32be=m9.f32=m9.ns64be=m9.s48be=m9.s40be=m9.s32be=m9.s24be=m9.s16be=m9.ns64=m9.s48=m9.s40=m9.s32=m9.s24=void 0;var S$=(OA(),VA(l6));function bA(T){if(!(T instanceof Uint8Array))throw TypeError("b must be a Uint8Array")}m9.checkUint8Array=bA;function U1(T){return bA(T),S$.Buffer.from(T.buffer,T.byteOffset,T.length)}m9.uint8ArrayToBuffer=U1;class P1{constructor(T,A){if(!Number.isInteger(T))throw TypeError("span must be an integer");this.span=T,this.property=A}makeDestinationObject(){return{}}getSpan(T,A){if(0>this.span)throw RangeError("indeterminate span");return this.span}replicate(T){let A=Object.create(this.constructor.prototype);return Object.assign(A,this),A.property=T,A}fromArray(T){return}}m9.Layout=P1;function L$(T,A){if(A.property)return T+"["+A.property+"]";return T}m9.nameWithProperty=L$;function xR(T,A){if(typeof T!=="function")throw TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(T,"layout_"))throw Error("Class is already bound to a layout");if(!(A&&A instanceof P1))throw TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(A,"boundConstructor_"))throw Error("layout is already bound to a constructor");T.layout_=A,A.boundConstructor_=T,A.makeDestinationObject=()=>new T,Object.defineProperty(T.prototype,"encode",{value(Q,J){return A.encode(this,Q,J)},writable:!0}),Object.defineProperty(T,"decode",{value(Q,J){return A.decode(Q,J)},writable:!0})}m9.bindConstructorLayout=xR;class c0 extends P1{isCount(){throw Error("ExternalLayout is abstract")}}m9.ExternalLayout=c0;class w$ extends c0{constructor(T=1,A){if(!Number.isInteger(T)||0>=T)throw TypeError("elementSpan must be a (positive) integer");super(-1,A);this.elementSpan=T}isCount(){return!0}decode(T,A=0){bA(T);let Q=T.length-A;return Math.floor(Q/this.elementSpan)}encode(T,A,Q){return 0}}m9.GreedyCount=w$;class GQ extends c0{constructor(T,A=0,Q){if(!(T instanceof P1))throw TypeError("layout must be a Layout");if(!Number.isInteger(A))throw TypeError("offset must be integer or undefined");super(T.span,Q||T.property);this.layout=T,this.offset=A}isCount(){return this.layout instanceof YT||this.layout instanceof VT}decode(T,A=0){return this.layout.decode(T,A+this.offset)}encode(T,A,Q=0){return this.layout.encode(T,A,Q+this.offset)}}m9.OffsetLayout=GQ;class YT extends P1{constructor(T,A){super(T,A);if(6<this.span)throw RangeError("span must not exceed 6 bytes")}decode(T,A=0){return U1(T).readUIntLE(A,this.span)}encode(T,A,Q=0){return U1(A).writeUIntLE(T,Q,this.span),this.span}}m9.UInt=YT;class VT extends P1{constructor(T,A){super(T,A);if(6<this.span)throw RangeError("span must not exceed 6 bytes")}decode(T,A=0){return U1(T).readUIntBE(A,this.span)}encode(T,A,Q=0){return U1(A).writeUIntBE(T,Q,this.span),this.span}}m9.UIntBE=VT;class _8 extends P1{constructor(T,A){super(T,A);if(6<this.span)throw RangeError("span must not exceed 6 bytes")}decode(T,A=0){return U1(T).readIntLE(A,this.span)}encode(T,A,Q=0){return U1(A).writeIntLE(T,Q,this.span),this.span}}m9.Int=_8;class YA extends P1{constructor(T,A){super(T,A);if(6<this.span)throw RangeError("span must not exceed 6 bytes")}decode(T,A=0){return U1(T).readIntBE(A,this.span)}encode(T,A,Q=0){return U1(A).writeIntBE(T,Q,this.span),this.span}}m9.IntBE=YA;var I$=Math.pow(2,32);function UQ(T){let A=Math.floor(T/I$),Q=T-A*I$;return{hi32:A,lo32:Q}}function YQ(T,A){return T*I$+A}class E$ extends P1{constructor(T){super(8,T)}decode(T,A=0){let Q=U1(T),J=Q.readUInt32LE(A),$=Q.readUInt32LE(A+4);return YQ($,J)}encode(T,A,Q=0){let J=UQ(T),$=U1(A);return $.writeUInt32LE(J.lo32,Q),$.writeUInt32LE(J.hi32,Q+4),8}}m9.NearUInt64=E$;class O$ extends P1{constructor(T){super(8,T)}decode(T,A=0){let Q=U1(T),J=Q.readUInt32BE(A),$=Q.readUInt32BE(A+4);return YQ(J,$)}encode(T,A,Q=0){let J=UQ(T),$=U1(A);return $.writeUInt32BE(J.hi32,Q),$.writeUInt32BE(J.lo32,Q+4),8}}m9.NearUInt64BE=O$;class B$ extends P1{constructor(T){super(8,T)}decode(T,A=0){let Q=U1(T),J=Q.readUInt32LE(A),$=Q.readInt32LE(A+4);return YQ($,J)}encode(T,A,Q=0){let J=UQ(T),$=U1(A);return $.writeUInt32LE(J.lo32,Q),$.writeInt32LE(J.hi32,Q+4),8}}m9.NearInt64=B$;class _$ extends P1{constructor(T){super(8,T)}decode(T,A=0){let Q=U1(T),J=Q.readInt32BE(A),$=Q.readUInt32BE(A+4);return YQ(J,$)}encode(T,A,Q=0){let J=UQ(T),$=U1(A);return $.writeInt32BE(J.hi32,Q),$.writeUInt32BE(J.lo32,Q+4),8}}m9.NearInt64BE=_$;class x$ extends P1{constructor(T){super(4,T)}decode(T,A=0){return U1(T).readFloatLE(A)}encode(T,A,Q=0){return U1(A).writeFloatLE(T,Q),4}}m9.Float=x$;class h$ extends P1{constructor(T){super(4,T)}decode(T,A=0){return U1(T).readFloatBE(A)}encode(T,A,Q=0){return U1(A).writeFloatBE(T,Q),4}}m9.FloatBE=h$;class g$ extends P1{constructor(T){super(8,T)}decode(T,A=0){return U1(T).readDoubleLE(A)}encode(T,A,Q=0){return U1(A).writeDoubleLE(T,Q),8}}m9.Double=g$;class m$ extends P1{constructor(T){super(8,T)}decode(T,A=0){return U1(T).readDoubleBE(A)}encode(T,A,Q=0){return U1(A).writeDoubleBE(T,Q),8}}m9.DoubleBE=m$;class v$ extends P1{constructor(T,A,Q){if(!(T instanceof P1))throw TypeError("elementLayout must be a Layout");if(!(A instanceof c0&&A.isCount()||Number.isInteger(A)&&0<=A))throw TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let J=-1;if(!(A instanceof c0)&&0<T.span)J=A*T.span;super(J,Q);this.elementLayout=T,this.count=A}getSpan(T,A=0){if(0<=this.span)return this.span;let Q=0,J=this.count;if(J instanceof c0)J=J.decode(T,A);if(0<this.elementLayout.span)Q=J*this.elementLayout.span;else{let $=0;while($<J)Q+=this.elementLayout.getSpan(T,A+Q),++$}return Q}decode(T,A=0){let Q=[],J=0,$=this.count;if($ instanceof c0)$=$.decode(T,A);while(J<$)Q.push(this.elementLayout.decode(T,A)),A+=this.elementLayout.getSpan(T,A),J+=1;return Q}encode(T,A,Q=0){let J=this.elementLayout,$=T.reduce((W,G)=>{return W+J.encode(G,A,Q+W)},0);if(this.count instanceof c0)this.count.encode(T.length,A,Q);return $}}m9.Sequence=v$;class y$ extends P1{constructor(T,A,Q){if(!(Array.isArray(T)&&T.reduce(($,W)=>$&&W instanceof P1,!0)))throw TypeError("fields must be array of Layout instances");if(typeof A==="boolean"&&Q===void 0)Q=A,A=void 0;for(let $ of T)if(0>$.span&&$.property===void 0)throw Error("fields cannot contain unnamed variable-length layout");let J=-1;try{J=T.reduce(($,W)=>$+W.getSpan(),0)}catch($){}super(J,A);this.fields=T,this.decodePrefixes=!!Q}getSpan(T,A=0){if(0<=this.span)return this.span;let Q=0;try{Q=this.fields.reduce((J,$)=>{let W=$.getSpan(T,A);return A+=W,J+W},0)}catch(J){throw RangeError("indeterminate span")}return Q}decode(T,A=0){bA(T);let Q=this.makeDestinationObject();for(let J of this.fields){if(J.property!==void 0)Q[J.property]=J.decode(T,A);if(A+=J.getSpan(T,A),this.decodePrefixes&&T.length===A)break}return Q}encode(T,A,Q=0){let J=Q,$=0,W=0;for(let G of this.fields){let Y=G.span;if(W=0<Y?Y:0,G.property!==void 0){let Z=T[G.property];if(Z!==void 0){if(W=G.encode(Z,A,Q),0>Y)Y=G.getSpan(A,Q)}}$=Q,Q+=Y}return $+W-J}fromArray(T){let A=this.makeDestinationObject();for(let Q of this.fields)if(Q.property!==void 0&&0<T.length)A[Q.property]=T.shift();return A}layoutFor(T){if(typeof T!=="string")throw TypeError("property must be string");for(let A of this.fields)if(A.property===T)return A;return}offsetOf(T){if(typeof T!=="string")throw TypeError("property must be string");let A=0;for(let Q of this.fields){if(Q.property===T)return A;if(0>Q.span)A=-1;else if(0<=A)A+=Q.span}return}}m9.Structure=y$;class ZQ{constructor(T){this.property=T}decode(T,A){throw Error("UnionDiscriminator is abstract")}encode(T,A,Q){throw Error("UnionDiscriminator is abstract")}}m9.UnionDiscriminator=ZQ;class L2 extends ZQ{constructor(T,A){if(!(T instanceof c0&&T.isCount()))throw TypeError("layout must be an unsigned integer ExternalLayout");super(A||T.property||"variant");this.layout=T}decode(T,A){return this.layout.decode(T,A)}encode(T,A,Q){return this.layout.encode(T,A,Q)}}m9.UnionLayoutDiscriminator=L2;class XQ extends P1{constructor(T,A,Q){let J;if(T instanceof YT||T instanceof VT)J=new L2(new GQ(T));else if(T instanceof c0&&T.isCount())J=new L2(T);else if(!(T instanceof ZQ))throw TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");else J=T;if(A===void 0)A=null;if(!(A===null||A instanceof P1))throw TypeError("defaultLayout must be null or a Layout");if(A!==null){if(0>A.span)throw Error("defaultLayout must have constant span");if(A.property===void 0)A=A.replicate("content")}let $=-1;if(A){if($=A.span,0<=$&&(T instanceof YT||T instanceof VT))$+=J.layout.span}super($,Q);this.discriminator=J,this.usesPrefixDiscriminator=T instanceof YT||T instanceof VT,this.defaultLayout=A,this.registry={};let W=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(G){return W(G)},this.configGetSourceVariant=function(G){W=G.bind(this)}}getSpan(T,A=0){if(0<=this.span)return this.span;let Q=this.getVariant(T,A);if(!Q)throw Error("unable to determine span for unrecognized variant");return Q.getSpan(T,A)}defaultGetSourceVariant(T){if(Object.prototype.hasOwnProperty.call(T,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(T,this.defaultLayout.property))return;let A=this.registry[T[this.discriminator.property]];if(A&&(!A.layout||A.property&&Object.prototype.hasOwnProperty.call(T,A.property)))return A}else for(let A in this.registry){let Q=this.registry[A];if(Q.property&&Object.prototype.hasOwnProperty.call(T,Q.property))return Q}throw Error("unable to infer src variant")}decode(T,A=0){let Q,J=this.discriminator,$=J.decode(T,A),W=this.registry[$];if(W===void 0){let G=this.defaultLayout,Y=0;if(this.usesPrefixDiscriminator)Y=J.layout.span;Q=this.makeDestinationObject(),Q[J.property]=$,Q[G.property]=G.decode(T,A+Y)}else Q=W.decode(T,A);return Q}encode(T,A,Q=0){let J=this.getSourceVariant(T);if(J===void 0){let $=this.discriminator,W=this.defaultLayout,G=0;if(this.usesPrefixDiscriminator)G=$.layout.span;return $.encode(T[$.property],A,Q),G+W.encode(T[W.property],A,Q+G)}return J.encode(T,A,Q)}addVariant(T,A,Q){let J=new b$(this,T,A,Q);return this.registry[T]=J,J}getVariant(T,A=0){let Q;if(T instanceof Uint8Array)Q=this.discriminator.decode(T,A);else Q=T;return this.registry[Q]}}m9.Union=XQ;class b$ extends P1{constructor(T,A,Q,J){if(!(T instanceof XQ))throw TypeError("union must be a Union");if(!Number.isInteger(A)||0>A)throw TypeError("variant must be a (non-negative) integer");if(typeof Q==="string"&&J===void 0)J=Q,Q=null;if(Q){if(!(Q instanceof P1))throw TypeError("layout must be a Layout");if(T.defaultLayout!==null&&0<=Q.span&&Q.span>T.defaultLayout.span)throw Error("variant span exceeds span of containing union");if(typeof J!=="string")throw TypeError("variant must have a String property")}let $=T.span;if(0>T.span){if($=Q?Q.span:0,0<=$&&T.usesPrefixDiscriminator)$+=T.discriminator.layout.span}super($,J);this.union=T,this.variant=A,this.layout=Q||null}getSpan(T,A=0){if(0<=this.span)return this.span;let Q=0;if(this.union.usesPrefixDiscriminator)Q=this.union.discriminator.layout.span;let J=0;if(this.layout)J=this.layout.getSpan(T,A+Q);return Q+J}decode(T,A=0){let Q=this.makeDestinationObject();if(this!==this.union.getVariant(T,A))throw Error("variant mismatch");let J=0;if(this.union.usesPrefixDiscriminator)J=this.union.discriminator.layout.span;if(this.layout)Q[this.property]=this.layout.decode(T,A+J);else if(this.property)Q[this.property]=!0;else if(this.union.usesPrefixDiscriminator)Q[this.union.discriminator.property]=this.variant;return Q}encode(T,A,Q=0){let J=0;if(this.union.usesPrefixDiscriminator)J=this.union.discriminator.layout.span;if(this.layout&&!Object.prototype.hasOwnProperty.call(T,this.property))throw TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,A,Q);let $=J;if(this.layout){if(this.layout.encode(T[this.property],A,Q+J),$+=this.layout.getSpan(A,Q+J),0<=this.union.span&&$>this.union.span)throw Error("encoded variant overruns containing union")}return $}fromArray(T){if(this.layout)return this.layout.fromArray(T);return}}m9.VariantLayout=b$;function yA(T){if(0>T)T+=4294967296;return T}class PQ extends P1{constructor(T,A,Q){if(!(T instanceof YT||T instanceof VT))throw TypeError("word must be a UInt or UIntBE layout");if(typeof A==="string"&&Q===void 0)Q=A,A=!1;if(4<T.span)throw RangeError("word cannot exceed 32 bits");super(T.span,Q);this.word=T,this.msb=!!A,this.fields=[];let J=0;this._packedSetValue=function($){return J=yA($),this},this._packedGetValue=function(){return J}}decode(T,A=0){let Q=this.makeDestinationObject(),J=this.word.decode(T,A);this._packedSetValue(J);for(let $ of this.fields)if($.property!==void 0)Q[$.property]=$.decode(T);return Q}encode(T,A,Q=0){let J=this.word.decode(A,Q);this._packedSetValue(J);for(let $ of this.fields)if($.property!==void 0){let W=T[$.property];if(W!==void 0)$.encode(W)}return this.word.encode(this._packedGetValue(),A,Q)}addField(T,A){let Q=new qQ(this,T,A);return this.fields.push(Q),Q}addBoolean(T){let A=new p$(this,T);return this.fields.push(A),A}fieldFor(T){if(typeof T!=="string")throw TypeError("property must be string");for(let A of this.fields)if(A.property===T)return A;return}}m9.BitStructure=PQ;class qQ{constructor(T,A,Q){if(!(T instanceof PQ))throw TypeError("container must be a BitStructure");if(!Number.isInteger(A)||0>=A)throw TypeError("bits must be positive integer");let J=8*T.span,$=T.fields.reduce((W,G)=>W+G.bits,0);if(A+$>J)throw Error("bits too long for span remainder ("+(J-$)+" of "+J+" remain)");if(this.container=T,this.bits=A,this.valueMask=(1<<A)-1,A===32)this.valueMask=4294967295;if(this.start=$,this.container.msb)this.start=J-$-A;this.wordMask=yA(this.valueMask<<this.start),this.property=Q}decode(T,A){let Q=this.container._packedGetValue();return yA(Q&this.wordMask)>>>this.start}encode(T){if(typeof T!=="number"||!Number.isInteger(T)||T!==yA(T&this.valueMask))throw TypeError(L$("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);let A=this.container._packedGetValue(),Q=yA(T<<this.start);this.container._packedSetValue(yA(A&~this.wordMask)|Q)}}m9.BitField=qQ;class p$ extends qQ{constructor(T,A){super(T,1,A)}decode(T,A){return!!super.decode(T,A)}encode(T){if(typeof T==="boolean")T=+T;super.encode(T)}}m9.Boolean=p$;class l$ extends P1{constructor(T,A){if(!(T instanceof c0&&T.isCount()||Number.isInteger(T)&&0<=T))throw TypeError("length must be positive integer or an unsigned integer ExternalLayout");let Q=-1;if(!(T instanceof c0))Q=T;super(Q,A);this.length=T}getSpan(T,A){let Q=this.span;if(0>Q)Q=this.length.decode(T,A);return Q}decode(T,A=0){let Q=this.span;if(0>Q)Q=this.length.decode(T,A);return U1(T).slice(A,A+Q)}encode(T,A,Q){let J=this.length;if(this.length instanceof c0)J=T.length;if(!(T instanceof Uint8Array&&J===T.length))throw TypeError(L$("Blob.encode",this)+" requires (length "+J+") Uint8Array as src");if(Q+J>A.length)throw RangeError("encoding overruns Uint8Array");let $=U1(T);if(U1(A).write($.toString("hex"),Q,J,"hex"),this.length instanceof c0)this.length.encode(J,A,Q);return J}}m9.Blob=l$;class u$ extends P1{constructor(T){super(-1,T)}getSpan(T,A=0){bA(T);let Q=A;while(Q<T.length&&T[Q]!==0)Q+=1;return 1+Q-A}decode(T,A=0){let Q=this.getSpan(T,A);return U1(T).slice(A,A+Q-1).toString("utf-8")}encode(T,A,Q=0){if(typeof T!=="string")T=String(T);let J=S$.Buffer.from(T,"utf8"),$=J.length;if(Q+$>A.length)throw RangeError("encoding overruns Buffer");let W=U1(A);return J.copy(W,Q),W[Q+$]=0,$+1}}m9.CString=u$;class d$ extends P1{constructor(T,A){if(typeof T==="string"&&A===void 0)A=T,T=void 0;if(T===void 0)T=-1;else if(!Number.isInteger(T))throw TypeError("maxSpan must be an integer");super(-1,A);this.maxSpan=T}getSpan(T,A=0){return bA(T),T.length-A}decode(T,A=0){let Q=this.getSpan(T,A);if(0<=this.maxSpan&&this.maxSpan<Q)throw RangeError("text length exceeds maxSpan");return U1(T).slice(A,A+Q).toString("utf-8")}encode(T,A,Q=0){if(typeof T!=="string")T=String(T);let J=S$.Buffer.from(T,"utf8"),$=J.length;if(0<=this.maxSpan&&this.maxSpan<$)throw RangeError("text length exceeds maxSpan");if(Q+$>A.length)throw RangeError("encoding overruns Buffer");return J.copy(U1(A),Q),$}}m9.UTF8=d$;class c$ extends P1{constructor(T,A){super(0,A);this.value=T}decode(T,A){return this.value}encode(T,A,Q){return 0}}m9.Constant=c$;m9.greedy=(T,A)=>new w$(T,A);m9.offset=(T,A,Q)=>new GQ(T,A,Q);m9.u8=(T)=>new YT(1,T);m9.u16=(T)=>new YT(2,T);m9.u24=(T)=>new YT(3,T);m9.u32=(T)=>new YT(4,T);m9.u40=(T)=>new YT(5,T);m9.u48=(T)=>new YT(6,T);m9.nu64=(T)=>new E$(T);m9.u16be=(T)=>new VT(2,T);m9.u24be=(T)=>new VT(3,T);m9.u32be=(T)=>new VT(4,T);m9.u40be=(T)=>new VT(5,T);m9.u48be=(T)=>new VT(6,T);m9.nu64be=(T)=>new O$(T);m9.s8=(T)=>new _8(1,T);m9.s16=(T)=>new _8(2,T);m9.s24=(T)=>new _8(3,T);m9.s32=(T)=>new _8(4,T);m9.s40=(T)=>new _8(5,T);m9.s48=(T)=>new _8(6,T);m9.ns64=(T)=>new B$(T);m9.s16be=(T)=>new YA(2,T);m9.s24be=(T)=>new YA(3,T);m9.s32be=(T)=>new YA(4,T);m9.s40be=(T)=>new YA(5,T);m9.s48be=(T)=>new YA(6,T);m9.ns64be=(T)=>new _$(T);m9.f32=(T)=>new x$(T);m9.f32be=(T)=>new h$(T);m9.f64=(T)=>new g$(T);m9.f64be=(T)=>new m$(T);m9.struct=(T,A,Q)=>new y$(T,A,Q);m9.bits=(T,A,Q)=>new PQ(T,A,Q);m9.seq=(T,A,Q)=>new v$(T,A,Q);m9.union=(T,A,Q)=>new XQ(T,A,Q);m9.unionLayoutDiscriminator=(T,A)=>new L2(T,A);m9.blob=(T,A)=>new l$(T,A);m9.cstr=(T)=>new u$(T);m9.utf8=(T,A)=>new d$(T,A);m9.constant=(T,A)=>new c$(T,A)});function O2(){if(!VQ){if(VQ=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues==="function"&&msCrypto.getRandomValues.bind(msCrypto),!VQ)throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported")}return VQ(PN)}var VQ,PN;var TW=w0(()=>{PN=new Uint8Array(16)});var JX;var $X=w0(()=>{JX=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i});function qN(T){return typeof T==="string"&&JX.test(T)}var h8;var B2=w0(()=>{$X();h8=qN});function KN(T){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,Q=(L0[T[A+0]]+L0[T[A+1]]+L0[T[A+2]]+L0[T[A+3]]+"-"+L0[T[A+4]]+L0[T[A+5]]+"-"+L0[T[A+6]]+L0[T[A+7]]+"-"+L0[T[A+8]]+L0[T[A+9]]+"-"+L0[T[A+10]]+L0[T[A+11]]+L0[T[A+12]]+L0[T[A+13]]+L0[T[A+14]]+L0[T[A+15]]).toLowerCase();if(!h8(Q))throw TypeError("Stringified UUID is invalid");return Q}var L0,_2,g8;var x2=w0(()=>{B2();L0=[];for(_2=0;_2<256;++_2)L0.push((_2+256).toString(16).substr(1));g8=KN});function CN(T,A,Q){var J=A&&Q||0,$=A||Array(16);T=T||{};var W=T.node||WX,G=T.clockseq!==void 0?T.clockseq:AW;if(W==null||G==null){var Y=T.random||(T.rng||O2)();if(W==null)W=WX=[Y[0]|1,Y[1],Y[2],Y[3],Y[4],Y[5]];if(G==null)G=AW=(Y[6]<<8|Y[7])&16383}var Z=T.msecs!==void 0?T.msecs:Date.now(),C=T.nsecs!==void 0?T.nsecs:JW+1,K=Z-QW+(C-JW)/1e4;if(K<0&&T.clockseq===void 0)G=G+1&16383;if((K<0||Z>QW)&&T.nsecs===void 0)C=0;if(C>=1e4)throw Error("uuid.v1(): Can't create more than 10M uuids/sec");QW=Z,JW=C,AW=G,Z+=12219292800000;var j=((Z&268435455)*1e4+C)%4294967296;$[J++]=j>>>24&255,$[J++]=j>>>16&255,$[J++]=j>>>8&255,$[J++]=j&255;var M=Z/4294967296*1e4&268435455;$[J++]=M>>>8&255,$[J++]=M&255,$[J++]=M>>>24&15|16,$[J++]=M>>>16&255,$[J++]=G>>>8|128,$[J++]=G&255;for(var z=0;z<6;++z)$[J+z]=W[z];return A||g8($)}var WX,AW,QW=0,JW=0,GX;var UX=w0(()=>{TW();x2();GX=CN});function HN(T){if(!h8(T))throw TypeError("Invalid UUID");var A,Q=new Uint8Array(16);return Q[0]=(A=parseInt(T.slice(0,8),16))>>>24,Q[1]=A>>>16&255,Q[2]=A>>>8&255,Q[3]=A&255,Q[4]=(A=parseInt(T.slice(9,13),16))>>>8,Q[5]=A&255,Q[6]=(A=parseInt(T.slice(14,18),16))>>>8,Q[7]=A&255,Q[8]=(A=parseInt(T.slice(19,23),16))>>>8,Q[9]=A&255,Q[10]=(A=parseInt(T.slice(24,36),16))/1099511627776&255,Q[11]=A/4294967296&255,Q[12]=A>>>24&255,Q[13]=A>>>16&255,Q[14]=A>>>8&255,Q[15]=A&255,Q}var jQ;var $W=w0(()=>{B2();jQ=HN});function VN(T){T=unescape(encodeURIComponent(T));var A=[];for(var Q=0;Q<T.length;++Q)A.push(T.charCodeAt(Q));return A}function h2(T,A,Q){function J($,W,G,Y){if(typeof $==="string")$=VN($);if(typeof W==="string")W=jQ(W);if(W.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var Z=new Uint8Array(16+$.length);if(Z.set(W),Z.set($,W.length),Z=Q(Z),Z[6]=Z[6]&15|A,Z[8]=Z[8]&63|128,G){Y=Y||0;for(var C=0;C<16;++C)G[Y+C]=Z[C];return G}return g8(Z)}try{J.name=T}catch($){}return J.DNS=jN,J.URL=RN,J}var jN="6ba7b810-9dad-11d1-80b4-00c04fd430c8",RN="6ba7b811-9dad-11d1-80b4-00c04fd430c8";var WW=w0(()=>{x2();$W()});function DN(T){if(typeof T==="string"){var A=unescape(encodeURIComponent(T));T=new Uint8Array(A.length);for(var Q=0;Q<A.length;++Q)T[Q]=A.charCodeAt(Q)}return MN(kN(zN(T),T.length*8))}function MN(T){var A=[],Q=T.length*32,J="0123456789abcdef";for(var $=0;$<Q;$+=8){var W=T[$>>5]>>>$%32&255,G=parseInt(J.charAt(W>>>4&15)+J.charAt(W&15),16);A.push(G)}return A}function YX(T){return(T+64>>>9<<4)+14+1}function kN(T,A){T[A>>5]|=128<<A%32,T[YX(A)-1]=A;var Q=1732584193,J=-271733879,$=-1732584194,W=271733878;for(var G=0;G<T.length;G+=16){var Y=Q,Z=J,C=$,K=W;Q=x0(Q,J,$,W,T[G],7,-680876936),W=x0(W,Q,J,$,T[G+1],12,-389564586),$=x0($,W,Q,J,T[G+2],17,606105819),J=x0(J,$,W,Q,T[G+3],22,-1044525330),Q=x0(Q,J,$,W,T[G+4],7,-176418897),W=x0(W,Q,J,$,T[G+5],12,1200080426),$=x0($,W,Q,J,T[G+6],17,-1473231341),J=x0(J,$,W,Q,T[G+7],22,-45705983),Q=x0(Q,J,$,W,T[G+8],7,1770035416),W=x0(W,Q,J,$,T[G+9],12,-1958414417),$=x0($,W,Q,J,T[G+10],17,-42063),J=x0(J,$,W,Q,T[G+11],22,-1990404162),Q=x0(Q,J,$,W,T[G+12],7,1804603682),W=x0(W,Q,J,$,T[G+13],12,-40341101),$=x0($,W,Q,J,T[G+14],17,-1502002290),J=x0(J,$,W,Q,T[G+15],22,1236535329),Q=h0(Q,J,$,W,T[G+1],5,-165796510),W=h0(W,Q,J,$,T[G+6],9,-1069501632),$=h0($,W,Q,J,T[G+11],14,643717713),J=h0(J,$,W,Q,T[G],20,-373897302),Q=h0(Q,J,$,W,T[G+5],5,-701558691),W=h0(W,Q,J,$,T[G+10],9,38016083),$=h0($,W,Q,J,T[G+15],14,-660478335),J=h0(J,$,W,Q,T[G+4],20,-405537848),Q=h0(Q,J,$,W,T[G+9],5,568446438),W=h0(W,Q,J,$,T[G+14],9,-1019803690),$=h0($,W,Q,J,T[G+3],14,-187363961),J=h0(J,$,W,Q,T[G+8],20,1163531501),Q=h0(Q,J,$,W,T[G+13],5,-1444681467),W=h0(W,Q,J,$,T[G+2],9,-51403784),$=h0($,W,Q,J,T[G+7],14,1735328473),J=h0(J,$,W,Q,T[G+12],20,-1926607734),Q=g0(Q,J,$,W,T[G+5],4,-378558),W=g0(W,Q,J,$,T[G+8],11,-2022574463),$=g0($,W,Q,J,T[G+11],16,1839030562),J=g0(J,$,W,Q,T[G+14],23,-35309556),Q=g0(Q,J,$,W,T[G+1],4,-1530992060),W=g0(W,Q,J,$,T[G+4],11,1272893353),$=g0($,W,Q,J,T[G+7],16,-155497632),J=g0(J,$,W,Q,T[G+10],23,-1094730640),Q=g0(Q,J,$,W,T[G+13],4,681279174),W=g0(W,Q,J,$,T[G],11,-358537222),$=g0($,W,Q,J,T[G+3],16,-722521979),J=g0(J,$,W,Q,T[G+6],23,76029189),Q=g0(Q,J,$,W,T[G+9],4,-640364487),W=g0(W,Q,J,$,T[G+12],11,-421815835),$=g0($,W,Q,J,T[G+15],16,530742520),J=g0(J,$,W,Q,T[G+2],23,-995338651),Q=m0(Q,J,$,W,T[G],6,-198630844),W=m0(W,Q,J,$,T[G+7],10,1126891415),$=m0($,W,Q,J,T[G+14],15,-1416354905),J=m0(J,$,W,Q,T[G+5],21,-57434055),Q=m0(Q,J,$,W,T[G+12],6,1700485571),W=m0(W,Q,J,$,T[G+3],10,-1894986606),$=m0($,W,Q,J,T[G+10],15,-1051523),J=m0(J,$,W,Q,T[G+1],21,-2054922799),Q=m0(Q,J,$,W,T[G+8],6,1873313359),W=m0(W,Q,J,$,T[G+15],10,-30611744),$=m0($,W,Q,J,T[G+6],15,-1560198380),J=m0(J,$,W,Q,T[G+13],21,1309151649),Q=m0(Q,J,$,W,T[G+4],6,-145523070),W=m0(W,Q,J,$,T[G+11],10,-1120210379),$=m0($,W,Q,J,T[G+2],15,718787259),J=m0(J,$,W,Q,T[G+9],21,-343485551),Q=m8(Q,Y),J=m8(J,Z),$=m8($,C),W=m8(W,K)}return[Q,J,$,W]}function zN(T){if(T.length===0)return[];var A=T.length*8,Q=new Uint32Array(YX(A));for(var J=0;J<A;J+=8)Q[J>>5]|=(T[J/8]&255)<<J%32;return Q}function m8(T,A){var Q=(T&65535)+(A&65535),J=(T>>16)+(A>>16)+(Q>>16);return J<<16|Q&65535}function FN(T,A){return T<<A|T>>>32-A}function RQ(T,A,Q,J,$,W){return m8(FN(m8(m8(A,T),m8(J,W)),$),Q)}function x0(T,A,Q,J,$,W,G){return RQ(A&Q|~A&J,T,A,$,W,G)}function h0(T,A,Q,J,$,W,G){return RQ(A&J|Q&~J,T,A,$,W,G)}function g0(T,A,Q,J,$,W,G){return RQ(A^Q^J,T,A,$,W,G)}function m0(T,A,Q,J,$,W,G){return RQ(Q^(A|~J),T,A,$,W,G)}var ZX;var XX=w0(()=>{ZX=DN});var NN,PX;var qX=w0(()=>{WW();XX();NN=h2("v3",48,ZX),PX=NN});function IN(T,A,Q){T=T||{};var J=T.random||(T.rng||O2)();if(J[6]=J[6]&15|64,J[8]=J[8]&63|128,A){Q=Q||0;for(var $=0;$<16;++$)A[Q+$]=J[$];return A}return g8(J)}var KX;var CX=w0(()=>{TW();x2();KX=IN});function SN(T,A,Q,J){switch(T){case 0:return A&Q^~A&J;case 1:return A^Q^J;case 2:return A&Q^A&J^Q&J;case 3:return A^Q^J}}function GW(T,A){return T<<A|T>>>32-A}function LN(T){var A=[1518500249,1859775393,2400959708,3395469782],Q=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof T==="string"){var J=unescape(encodeURIComponent(T));T=[];for(var $=0;$<J.length;++$)T.push(J.charCodeAt($))}else if(!Array.isArray(T))T=Array.prototype.slice.call(T);T.push(128);var W=T.length/4+2,G=Math.ceil(W/16),Y=Array(G);for(var Z=0;Z<G;++Z){var C=new Uint32Array(16);for(var K=0;K<16;++K)C[K]=T[Z*64+K*4]<<24|T[Z*64+K*4+1]<<16|T[Z*64+K*4+2]<<8|T[Z*64+K*4+3];Y[Z]=C}Y[G-1][14]=(T.length-1)*8/Math.pow(2,32),Y[G-1][14]=Math.floor(Y[G-1][14]),Y[G-1][15]=(T.length-1)*8&4294967295;for(var j=0;j<G;++j){var M=new Uint32Array(80);for(var z=0;z<16;++z)M[z]=Y[j][z];for(var N=16;N<80;++N)M[N]=GW(M[N-3]^M[N-8]^M[N-14]^M[N-16],1);var E=Q[0],L=Q[1],O=Q[2],g=Q[3],v=Q[4];for(var p=0;p<80;++p){var c=Math.floor(p/20),u=GW(E,5)+SN(c,L,O,g)+v+A[c]+M[p]>>>0;v=g,g=O,O=GW(L,30)>>>0,L=E,E=u}Q[0]=Q[0]+E>>>0,Q[1]=Q[1]+L>>>0,Q[2]=Q[2]+O>>>0,Q[3]=Q[3]+g>>>0,Q[4]=Q[4]+v>>>0}return[Q[0]>>24&255,Q[0]>>16&255,Q[0]>>8&255,Q[0]&255,Q[1]>>24&255,Q[1]>>16&255,Q[1]>>8&255,Q[1]&255,Q[2]>>24&255,Q[2]>>16&255,Q[2]>>8&255,Q[2]&255,Q[3]>>24&255,Q[3]>>16&255,Q[3]>>8&255,Q[3]&255,Q[4]>>24&255,Q[4]>>16&255,Q[4]>>8&255,Q[4]&255]}var HX;var VX=w0(()=>{HX=LN});var wN,jX;var RX=w0(()=>{WW();VX();wN=h2("v5",80,HX),jX=wN});var DX="00000000-0000-0000-0000-000000000000";function ON(T){if(!h8(T))throw TypeError("Invalid UUID");return parseInt(T.substr(14,1),16)}var MX;var kX=w0(()=>{B2();MX=ON});var UW={};P4(UW,{version:()=>MX,validate:()=>h8,v5:()=>jX,v4:()=>KX,v3:()=>PX,v1:()=>GX,stringify:()=>g8,parse:()=>jQ,NIL:()=>DX});var YW=w0(()=>{UX();qX();CX();RX();kX();B2();x2();$W()});var FX=ZT((Wh,zX)=>{var BN=(YW(),VA(UW)).v4,_N=function(T,A,Q,J){if(typeof T!=="string")throw TypeError(T+" must be a string");J=J||{};let $=typeof J.version==="number"?J.version:2;if($!==1&&$!==2)throw TypeError($+" must be 1 or 2");let W={method:T};if($===2)W.jsonrpc="2.0";if(A){if(typeof A!=="object"&&!Array.isArray(A))throw TypeError(A+" must be an object, array or omitted");W.params=A}if(typeof Q>"u"){let G=typeof J.generator==="function"?J.generator:function(){return BN()};W.id=G(W,J)}else if($===2&&Q===null){if(J.notificationIdNull)W.id=null}else W.id=Q;return W};zX.exports=_N});var IX=ZT((Gh,NX)=>{var xN=(YW(),VA(UW)).v4,hN=FX(),g2=function(T,A){if(!(this instanceof g2))return new g2(T,A);if(!A)A={};this.options={reviver:typeof A.reviver<"u"?A.reviver:null,replacer:typeof A.replacer<"u"?A.replacer:null,generator:typeof A.generator<"u"?A.generator:function(){return xN()},version:typeof A.version<"u"?A.version:2,notificationIdNull:typeof A.notificationIdNull==="boolean"?A.notificationIdNull:!1},this.callServer=T};NX.exports=g2;g2.prototype.request=function(T,A,Q,J){let $=this,W=null,G=Array.isArray(T)&&typeof A==="function";if(this.options.version===1&&G)throw TypeError("JSON-RPC 1.0 does not support batching");if(G||!G&&T&&typeof T==="object"&&typeof A==="function")J=A,W=T;else{if(typeof Q==="function")J=Q,Q=void 0;let C=typeof J==="function";try{W=hN(T,A,Q,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(K){if(C)return J(K);throw K}if(!C)return W}let Z;try{Z=JSON.stringify(W,this.options.replacer)}catch(C){return J(C)}return this.callServer(Z,function(C,K){$._parseResponse(C,K,J)}),W};g2.prototype._parseResponse=function(T,A,Q){if(T){Q(T);return}if(!A)return Q();let J;try{J=JSON.parse(A,this.options.reviver)}catch($){return Q($)}if(Q.length===3)if(Array.isArray(J)){let $=function(G){return typeof G.error<"u"},W=function(G){return!$(G)};return Q(null,J.filter($),J.filter(W))}else return Q(null,J.error,J.result);Q(null,J)}});var LX=ZT((Uh,ZW)=>{var gN=Object.prototype.hasOwnProperty,f0="~";function m2(){}if(Object.create){if(m2.prototype=Object.create(null),!new m2().__proto__)f0=!1}function mN(T,A,Q){this.fn=T,this.context=A,this.once=Q||!1}function SX(T,A,Q,J,$){if(typeof Q!=="function")throw TypeError("The listener must be a function");var W=new mN(Q,J||T,$),G=f0?f0+A:A;if(!T._events[G])T._events[G]=W,T._eventsCount++;else if(!T._events[G].fn)T._events[G].push(W);else T._events[G]=[T._events[G],W];return T}function DQ(T,A){if(--T._eventsCount===0)T._events=new m2;else delete T._events[A]}function v0(){this._events=new m2,this._eventsCount=0}v0.prototype.eventNames=function(){var A=[],Q,J;if(this._eventsCount===0)return A;for(J in Q=this._events)if(gN.call(Q,J))A.push(f0?J.slice(1):J);if(Object.getOwnPropertySymbols)return A.concat(Object.getOwnPropertySymbols(Q));return A};v0.prototype.listeners=function(A){var Q=f0?f0+A:A,J=this._events[Q];if(!J)return[];if(J.fn)return[J.fn];for(var $=0,W=J.length,G=Array(W);$<W;$++)G[$]=J[$].fn;return G};v0.prototype.listenerCount=function(A){var Q=f0?f0+A:A,J=this._events[Q];if(!J)return 0;if(J.fn)return 1;return J.length};v0.prototype.emit=function(A,Q,J,$,W,G){var Y=f0?f0+A:A;if(!this._events[Y])return!1;var Z=this._events[Y],C=arguments.length,K,j;if(Z.fn){if(Z.once)this.removeListener(A,Z.fn,void 0,!0);switch(C){case 1:return Z.fn.call(Z.context),!0;case 2:return Z.fn.call(Z.context,Q),!0;case 3:return Z.fn.call(Z.context,Q,J),!0;case 4:return Z.fn.call(Z.context,Q,J,$),!0;case 5:return Z.fn.call(Z.context,Q,J,$,W),!0;case 6:return Z.fn.call(Z.context,Q,J,$,W,G),!0}for(j=1,K=Array(C-1);j<C;j++)K[j-1]=arguments[j];Z.fn.apply(Z.context,K)}else{var M=Z.length,z;for(j=0;j<M;j++){if(Z[j].once)this.removeListener(A,Z[j].fn,void 0,!0);switch(C){case 1:Z[j].fn.call(Z[j].context);break;case 2:Z[j].fn.call(Z[j].context,Q);break;case 3:Z[j].fn.call(Z[j].context,Q,J);break;case 4:Z[j].fn.call(Z[j].context,Q,J,$);break;default:if(!K)for(z=1,K=Array(C-1);z<C;z++)K[z-1]=arguments[z];Z[j].fn.apply(Z[j].context,K)}}}return!0};v0.prototype.on=function(A,Q,J){return SX(this,A,Q,J,!1)};v0.prototype.once=function(A,Q,J){return SX(this,A,Q,J,!0)};v0.prototype.removeListener=function(A,Q,J,$){var W=f0?f0+A:A;if(!this._events[W])return this;if(!Q)return DQ(this,W),this;var G=this._events[W];if(G.fn){if(G.fn===Q&&(!$||G.once)&&(!J||G.context===J))DQ(this,W)}else{for(var Y=0,Z=[],C=G.length;Y<C;Y++)if(G[Y].fn!==Q||$&&!G[Y].once||J&&G[Y].context!==J)Z.push(G[Y]);if(Z.length)this._events[W]=Z.length===1?Z[0]:Z;else DQ(this,W)}return this};v0.prototype.removeAllListeners=function(A){var Q;if(A){if(Q=f0?f0+A:A,this._events[Q])DQ(this,Q)}else this._events=new m2,this._eventsCount=0;return this};v0.prototype.off=v0.prototype.removeListener;v0.prototype.addListener=v0.prototype.on;v0.prefixed=f0;v0.EventEmitter=v0;if(typeof ZW<"u")ZW.exports=v0});var SP=ZT((IP)=>{Object.defineProperty(IP,"__esModule",{value:!0});var _Q;function nI(T){{let A=Buffer.from(T);A.reverse();let Q=A.toString("hex");if(Q.length===0)return BigInt(0);return BigInt(`0x${Q}`)}return _Q.toBigInt(T,!1)}IP.toBigIntLE=nI;function iI(T){{let A=T.toString("hex");if(A.length===0)return BigInt(0);return BigInt(`0x${A}`)}return _Q.toBigInt(T,!0)}IP.toBigIntBE=iI;function oI(T,A){{let Q=T.toString(16),J=Buffer.from(Q.padStart(A*2,"0").slice(0,A*2),"hex");return J.reverse(),J}return _Q.fromBigInt(T,Buffer.allocUnsafe(A),!1)}IP.toBufferLE=oI;function aI(T,A){{let Q=T.toString(16);return Buffer.from(Q.padStart(A*2,"0").slice(0,A*2),"hex")}return _Q.fromBigInt(T,Buffer.allocUnsafe(A),!0)}IP.toBufferBE=aI});/*!
|
|
2
2
|
* The buffer module from node.js, for the browser.
|
|
3
3
|
*
|
|
4
4
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
5
5
|
* @license MIT
|
|
6
|
-
*/var X4=KG(),RA=CG(),HG=typeof Symbol==="function"&&typeof Symbol.for==="function"?Symbol.for("nodejs.util.inspect.custom"):null;var D4=m;var BG=50;var P4=2147483647;m.TYPED_ARRAY_SUPPORT=Sq();if(!m.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error==="function")console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function Sq(){try{let T=new Uint8Array(1),A={foo:function(){return 42}};return Object.setPrototypeOf(A,Uint8Array.prototype),Object.setPrototypeOf(T,A),T.foo()===42}catch(T){return!1}}Object.defineProperty(m.prototype,"parent",{enumerable:!0,get:function(){if(!m.isBuffer(this))return;return this.buffer}});Object.defineProperty(m.prototype,"offset",{enumerable:!0,get:function(){if(!m.isBuffer(this))return;return this.byteOffset}});function dT(T){if(T>P4)throw RangeError('The value "'+T+'" is invalid for option "size"');let A=new Uint8Array(T);return Object.setPrototypeOf(A,m.prototype),A}function m(T,A,Q){if(typeof T==="number"){if(typeof A==="string")throw TypeError('The "string" argument must be of type string. Received type number');return H4(T)}return DG(T,A,Q)}m.poolSize=8192;function DG(T,A,Q){if(typeof T==="string")return wq(T,A);if(ArrayBuffer.isView(T))return Eq(T);if(T==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T);if(NT(T,ArrayBuffer)||T&&NT(T.buffer,ArrayBuffer))return K4(T,A,Q);if(typeof SharedArrayBuffer<"u"&&(NT(T,SharedArrayBuffer)||T&&NT(T.buffer,SharedArrayBuffer)))return K4(T,A,Q);if(typeof T==="number")throw TypeError('The "value" argument must not be of type number. Received type number');let J=T.valueOf&&T.valueOf();if(J!=null&&J!==T)return m.from(J,A,Q);let W=Oq(T);if(W)return W;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof T[Symbol.toPrimitive]==="function")return m.from(T[Symbol.toPrimitive]("string"),A,Q);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T)}m.from=function(T,A,Q){return DG(T,A,Q)};Object.setPrototypeOf(m.prototype,Uint8Array.prototype);Object.setPrototypeOf(m,Uint8Array);function MG(T){if(typeof T!=="number")throw TypeError('"size" argument must be of type number');else if(T<0)throw RangeError('The value "'+T+'" is invalid for option "size"')}function Lq(T,A,Q){if(MG(T),T<=0)return dT(T);if(A!==void 0)return typeof Q==="string"?dT(T).fill(A,Q):dT(T).fill(A);return dT(T)}m.alloc=function(T,A,Q){return Lq(T,A,Q)};function H4(T){return MG(T),dT(T<0?0:V4(T)|0)}m.allocUnsafe=function(T){return H4(T)};m.allocUnsafeSlow=function(T){return H4(T)};function wq(T,A){if(typeof A!=="string"||A==="")A="utf8";if(!m.isEncoding(A))throw TypeError("Unknown encoding: "+A);let Q=kG(T,A)|0,J=dT(Q),W=J.write(T,A);if(W!==Q)J=J.slice(0,W);return J}function q4(T){let A=T.length<0?0:V4(T.length)|0,Q=dT(A);for(let J=0;J<A;J+=1)Q[J]=T[J]&255;return Q}function Eq(T){if(NT(T,Uint8Array)){let A=new Uint8Array(T);return K4(A.buffer,A.byteOffset,A.byteLength)}return q4(T)}function K4(T,A,Q){if(A<0||T.byteLength<A)throw RangeError('"offset" is outside of buffer bounds');if(T.byteLength<A+(Q||0))throw RangeError('"length" is outside of buffer bounds');let J;if(A===void 0&&Q===void 0)J=new Uint8Array(T);else if(Q===void 0)J=new Uint8Array(T,A);else J=new Uint8Array(T,A,Q);return Object.setPrototypeOf(J,m.prototype),J}function Oq(T){if(m.isBuffer(T)){let A=V4(T.length)|0,Q=dT(A);if(Q.length===0)return Q;return T.copy(Q,0,0,A),Q}if(T.length!==void 0){if(typeof T.length!=="number"||R4(T.length))return dT(0);return q4(T)}if(T.type==="Buffer"&&Array.isArray(T.data))return q4(T.data)}function V4(T){if(T>=P4)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+P4.toString(16)+" bytes");return T|0}m.isBuffer=function(A){return A!=null&&A._isBuffer===!0&&A!==m.prototype};m.compare=function(A,Q){if(NT(A,Uint8Array))A=m.from(A,A.offset,A.byteLength);if(NT(Q,Uint8Array))Q=m.from(Q,Q.offset,Q.byteLength);if(!m.isBuffer(A)||!m.isBuffer(Q))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(A===Q)return 0;let J=A.length,W=Q.length;for(let $=0,G=Math.min(J,W);$<G;++$)if(A[$]!==Q[$]){J=A[$],W=Q[$];break}if(J<W)return-1;if(W<J)return 1;return 0};m.isEncoding=function(A){switch(String(A).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};m.concat=function(A,Q){if(!Array.isArray(A))throw TypeError('"list" argument must be an Array of Buffers');if(A.length===0)return m.alloc(0);let J;if(Q===void 0){Q=0;for(J=0;J<A.length;++J)Q+=A[J].length}let W=m.allocUnsafe(Q),$=0;for(J=0;J<A.length;++J){let G=A[J];if(NT(G,Uint8Array))if($+G.length>W.length){if(!m.isBuffer(G))G=m.from(G);G.copy(W,$)}else Uint8Array.prototype.set.call(W,G,$);else if(!m.isBuffer(G))throw TypeError('"list" argument must be an Array of Buffers');else G.copy(W,$);$+=G.length}return W};function kG(T,A){if(m.isBuffer(T))return T.length;if(ArrayBuffer.isView(T)||NT(T,ArrayBuffer))return T.byteLength;if(typeof T!=="string")throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof T);let Q=T.length,J=arguments.length>2&&arguments[2]===!0;if(!J&&Q===0)return 0;let W=!1;for(;;)switch(A){case"ascii":case"latin1":case"binary":return Q;case"utf8":case"utf-8":return C4(T).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Q*2;case"hex":return Q>>>1;case"base64":return OG(T).length;default:if(W)return J?-1:C4(T).length;A=(""+A).toLowerCase(),W=!0}}m.byteLength=kG;function Bq(T,A,Q){let J=!1;if(A===void 0||A<0)A=0;if(A>this.length)return"";if(Q===void 0||Q>this.length)Q=this.length;if(Q<=0)return"";if(Q>>>=0,A>>>=0,Q<=A)return"";if(!T)T="utf8";while(!0)switch(T){case"hex":return lq(this,A,Q);case"utf8":case"utf-8":return FG(this,A,Q);case"ascii":return bq(this,A,Q);case"latin1":case"binary":return pq(this,A,Q);case"base64":return vq(this,A,Q);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return uq(this,A,Q);default:if(J)throw TypeError("Unknown encoding: "+T);T=(T+"").toLowerCase(),J=!0}}m.prototype._isBuffer=!0;function p8(T,A,Q){let J=T[A];T[A]=T[Q],T[Q]=J}m.prototype.swap16=function(){let A=this.length;if(A%2!==0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let Q=0;Q<A;Q+=2)p8(this,Q,Q+1);return this};m.prototype.swap32=function(){let A=this.length;if(A%4!==0)throw RangeError("Buffer size must be a multiple of 32-bits");for(let Q=0;Q<A;Q+=4)p8(this,Q,Q+3),p8(this,Q+1,Q+2);return this};m.prototype.swap64=function(){let A=this.length;if(A%8!==0)throw RangeError("Buffer size must be a multiple of 64-bits");for(let Q=0;Q<A;Q+=8)p8(this,Q,Q+7),p8(this,Q+1,Q+6),p8(this,Q+2,Q+5),p8(this,Q+3,Q+4);return this};m.prototype.toString=function(){let A=this.length;if(A===0)return"";if(arguments.length===0)return FG(this,0,A);return Bq.apply(this,arguments)};m.prototype.toLocaleString=m.prototype.toString;m.prototype.equals=function(A){if(!m.isBuffer(A))throw TypeError("Argument must be a Buffer");if(this===A)return!0;return m.compare(this,A)===0};m.prototype.inspect=function(){let A="",Q=BG;if(A=this.toString("hex",0,Q).replace(/(.{2})/g,"$1 ").trim(),this.length>Q)A+=" ... ";return"<Buffer "+A+">"};if(HG)m.prototype[HG]=m.prototype.inspect;m.prototype.compare=function(A,Q,J,W,$){if(NT(A,Uint8Array))A=m.from(A,A.offset,A.byteLength);if(!m.isBuffer(A))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof A);if(Q===void 0)Q=0;if(J===void 0)J=A?A.length:0;if(W===void 0)W=0;if($===void 0)$=this.length;if(Q<0||J>A.length||W<0||$>this.length)throw RangeError("out of range index");if(W>=$&&Q>=J)return 0;if(W>=$)return-1;if(Q>=J)return 1;if(Q>>>=0,J>>>=0,W>>>=0,$>>>=0,this===A)return 0;let G=$-W,Y=J-Q,Z=Math.min(G,Y),C=this.slice(W,$),K=A.slice(Q,J);for(let V=0;V<Z;++V)if(C[V]!==K[V]){G=C[V],Y=K[V];break}if(G<Y)return-1;if(Y<G)return 1;return 0};function zG(T,A,Q,J,W){if(T.length===0)return-1;if(typeof Q==="string")J=Q,Q=0;else if(Q>2147483647)Q=2147483647;else if(Q<-2147483648)Q=-2147483648;if(Q=+Q,R4(Q))Q=W?0:T.length-1;if(Q<0)Q=T.length+Q;if(Q>=T.length)if(W)return-1;else Q=T.length-1;else if(Q<0)if(W)Q=0;else return-1;if(typeof A==="string")A=m.from(A,J);if(m.isBuffer(A)){if(A.length===0)return-1;return VG(T,A,Q,J,W)}else if(typeof A==="number"){if(A=A&255,typeof Uint8Array.prototype.indexOf==="function")if(W)return Uint8Array.prototype.indexOf.call(T,A,Q);else return Uint8Array.prototype.lastIndexOf.call(T,A,Q);return VG(T,[A],Q,J,W)}throw TypeError("val must be string, number or Buffer")}function VG(T,A,Q,J,W){let $=1,G=T.length,Y=A.length;if(J!==void 0){if(J=String(J).toLowerCase(),J==="ucs2"||J==="ucs-2"||J==="utf16le"||J==="utf-16le"){if(T.length<2||A.length<2)return-1;$=2,G/=2,Y/=2,Q/=2}}function Z(K,V){if($===1)return K[V];else return K.readUInt16BE(V*$)}let C;if(W){let K=-1;for(C=Q;C<G;C++)if(Z(T,C)===Z(A,K===-1?0:C-K)){if(K===-1)K=C;if(C-K+1===Y)return K*$}else{if(K!==-1)C-=C-K;K=-1}}else{if(Q+Y>G)Q=G-Y;for(C=Q;C>=0;C--){let K=!0;for(let V=0;V<Y;V++)if(Z(T,C+V)!==Z(A,V)){K=!1;break}if(K)return C}}return-1}m.prototype.includes=function(A,Q,J){return this.indexOf(A,Q,J)!==-1};m.prototype.indexOf=function(A,Q,J){return zG(this,A,Q,J,!0)};m.prototype.lastIndexOf=function(A,Q,J){return zG(this,A,Q,J,!1)};function _q(T,A,Q,J){Q=Number(Q)||0;let W=T.length-Q;if(!J)J=W;else if(J=Number(J),J>W)J=W;let $=A.length;if(J>$/2)J=$/2;let G;for(G=0;G<J;++G){let Y=parseInt(A.substr(G*2,2),16);if(R4(Y))return G;T[Q+G]=Y}return G}function xq(T,A,Q,J){return n2(C4(A,T.length-Q),T,Q,J)}function hq(T,A,Q,J){return n2(rq(A),T,Q,J)}function gq(T,A,Q,J){return n2(OG(A),T,Q,J)}function mq(T,A,Q,J){return n2(nq(A,T.length-Q),T,Q,J)}m.prototype.write=function(A,Q,J,W){if(Q===void 0)W="utf8",J=this.length,Q=0;else if(J===void 0&&typeof Q==="string")W=Q,J=this.length,Q=0;else if(isFinite(Q))if(Q=Q>>>0,isFinite(J)){if(J=J>>>0,W===void 0)W="utf8"}else W=J,J=void 0;else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let $=this.length-Q;if(J===void 0||J>$)J=$;if(A.length>0&&(J<0||Q<0)||Q>this.length)throw RangeError("Attempt to write outside buffer bounds");if(!W)W="utf8";let G=!1;for(;;)switch(W){case"hex":return _q(this,A,Q,J);case"utf8":case"utf-8":return xq(this,A,Q,J);case"ascii":case"latin1":case"binary":return hq(this,A,Q,J);case"base64":return gq(this,A,Q,J);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return mq(this,A,Q,J);default:if(G)throw TypeError("Unknown encoding: "+W);W=(""+W).toLowerCase(),G=!0}};m.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function vq(T,A,Q){if(A===0&&Q===T.length)return X4.fromByteArray(T);else return X4.fromByteArray(T.slice(A,Q))}function FG(T,A,Q){Q=Math.min(T.length,Q);let J=[],W=A;while(W<Q){let $=T[W],G=null,Y=$>239?4:$>223?3:$>191?2:1;if(W+Y<=Q){let Z,C,K,V;switch(Y){case 1:if($<128)G=$;break;case 2:if(Z=T[W+1],(Z&192)===128){if(V=($&31)<<6|Z&63,V>127)G=V}break;case 3:if(Z=T[W+1],C=T[W+2],(Z&192)===128&&(C&192)===128){if(V=($&15)<<12|(Z&63)<<6|C&63,V>2047&&(V<55296||V>57343))G=V}break;case 4:if(Z=T[W+1],C=T[W+2],K=T[W+3],(Z&192)===128&&(C&192)===128&&(K&192)===128){if(V=($&15)<<18|(Z&63)<<12|(C&63)<<6|K&63,V>65535&&V<1114112)G=V}}}if(G===null)G=65533,Y=1;else if(G>65535)G-=65536,J.push(G>>>10&1023|55296),G=56320|G&1023;J.push(G),W+=Y}return yq(J)}var jG=4096;function yq(T){let A=T.length;if(A<=jG)return String.fromCharCode.apply(String,T);let Q="",J=0;while(J<A)Q+=String.fromCharCode.apply(String,T.slice(J,J+=jG));return Q}function bq(T,A,Q){let J="";Q=Math.min(T.length,Q);for(let W=A;W<Q;++W)J+=String.fromCharCode(T[W]&127);return J}function pq(T,A,Q){let J="";Q=Math.min(T.length,Q);for(let W=A;W<Q;++W)J+=String.fromCharCode(T[W]);return J}function lq(T,A,Q){let J=T.length;if(!A||A<0)A=0;if(!Q||Q<0||Q>J)Q=J;let W="";for(let $=A;$<Q;++$)W+=iq[T[$]];return W}function uq(T,A,Q){let J=T.slice(A,Q),W="";for(let $=0;$<J.length-1;$+=2)W+=String.fromCharCode(J[$]+J[$+1]*256);return W}m.prototype.slice=function(A,Q){let J=this.length;if(A=~~A,Q=Q===void 0?J:~~Q,A<0){if(A+=J,A<0)A=0}else if(A>J)A=J;if(Q<0){if(Q+=J,Q<0)Q=0}else if(Q>J)Q=J;if(Q<A)Q=A;let W=this.subarray(A,Q);return Object.setPrototypeOf(W,m.prototype),W};function D0(T,A,Q){if(T%1!==0||T<0)throw RangeError("offset is not uint");if(T+A>Q)throw RangeError("Trying to access beyond buffer length")}m.prototype.readUintLE=m.prototype.readUIntLE=function(A,Q,J){if(A=A>>>0,Q=Q>>>0,!J)D0(A,Q,this.length);let W=this[A],$=1,G=0;while(++G<Q&&($*=256))W+=this[A+G]*$;return W};m.prototype.readUintBE=m.prototype.readUIntBE=function(A,Q,J){if(A=A>>>0,Q=Q>>>0,!J)D0(A,Q,this.length);let W=this[A+--Q],$=1;while(Q>0&&($*=256))W+=this[A+--Q]*$;return W};m.prototype.readUint8=m.prototype.readUInt8=function(A,Q){if(A=A>>>0,!Q)D0(A,1,this.length);return this[A]};m.prototype.readUint16LE=m.prototype.readUInt16LE=function(A,Q){if(A=A>>>0,!Q)D0(A,2,this.length);return this[A]|this[A+1]<<8};m.prototype.readUint16BE=m.prototype.readUInt16BE=function(A,Q){if(A=A>>>0,!Q)D0(A,2,this.length);return this[A]<<8|this[A+1]};m.prototype.readUint32LE=m.prototype.readUInt32LE=function(A,Q){if(A=A>>>0,!Q)D0(A,4,this.length);return(this[A]|this[A+1]<<8|this[A+2]<<16)+this[A+3]*16777216};m.prototype.readUint32BE=m.prototype.readUInt32BE=function(A,Q){if(A=A>>>0,!Q)D0(A,4,this.length);return this[A]*16777216+(this[A+1]<<16|this[A+2]<<8|this[A+3])};m.prototype.readBigUInt64LE=K8(function(A){A=A>>>0,DA(A,"offset");let Q=this[A],J=this[A+7];if(Q===void 0||J===void 0)eA(A,this.length-8);let W=Q+this[++A]*256+this[++A]*65536+this[++A]*16777216,$=this[++A]+this[++A]*256+this[++A]*65536+J*16777216;return BigInt(W)+(BigInt($)<<BigInt(32))});m.prototype.readBigUInt64BE=K8(function(A){A=A>>>0,DA(A,"offset");let Q=this[A],J=this[A+7];if(Q===void 0||J===void 0)eA(A,this.length-8);let W=Q*16777216+this[++A]*65536+this[++A]*256+this[++A],$=this[++A]*16777216+this[++A]*65536+this[++A]*256+J;return(BigInt(W)<<BigInt(32))+BigInt($)});m.prototype.readIntLE=function(A,Q,J){if(A=A>>>0,Q=Q>>>0,!J)D0(A,Q,this.length);let W=this[A],$=1,G=0;while(++G<Q&&($*=256))W+=this[A+G]*$;if($*=128,W>=$)W-=Math.pow(2,8*Q);return W};m.prototype.readIntBE=function(A,Q,J){if(A=A>>>0,Q=Q>>>0,!J)D0(A,Q,this.length);let W=Q,$=1,G=this[A+--W];while(W>0&&($*=256))G+=this[A+--W]*$;if($*=128,G>=$)G-=Math.pow(2,8*Q);return G};m.prototype.readInt8=function(A,Q){if(A=A>>>0,!Q)D0(A,1,this.length);if(!(this[A]&128))return this[A];return(255-this[A]+1)*-1};m.prototype.readInt16LE=function(A,Q){if(A=A>>>0,!Q)D0(A,2,this.length);let J=this[A]|this[A+1]<<8;return J&32768?J|4294901760:J};m.prototype.readInt16BE=function(A,Q){if(A=A>>>0,!Q)D0(A,2,this.length);let J=this[A+1]|this[A]<<8;return J&32768?J|4294901760:J};m.prototype.readInt32LE=function(A,Q){if(A=A>>>0,!Q)D0(A,4,this.length);return this[A]|this[A+1]<<8|this[A+2]<<16|this[A+3]<<24};m.prototype.readInt32BE=function(A,Q){if(A=A>>>0,!Q)D0(A,4,this.length);return this[A]<<24|this[A+1]<<16|this[A+2]<<8|this[A+3]};m.prototype.readBigInt64LE=K8(function(A){A=A>>>0,DA(A,"offset");let Q=this[A],J=this[A+7];if(Q===void 0||J===void 0)eA(A,this.length-8);let W=this[A+4]+this[A+5]*256+this[A+6]*65536+(J<<24);return(BigInt(W)<<BigInt(32))+BigInt(Q+this[++A]*256+this[++A]*65536+this[++A]*16777216)});m.prototype.readBigInt64BE=K8(function(A){A=A>>>0,DA(A,"offset");let Q=this[A],J=this[A+7];if(Q===void 0||J===void 0)eA(A,this.length-8);let W=(Q<<24)+this[++A]*65536+this[++A]*256+this[++A];return(BigInt(W)<<BigInt(32))+BigInt(this[++A]*16777216+this[++A]*65536+this[++A]*256+J)});m.prototype.readFloatLE=function(A,Q){if(A=A>>>0,!Q)D0(A,4,this.length);return RA.read(this,A,!0,23,4)};m.prototype.readFloatBE=function(A,Q){if(A=A>>>0,!Q)D0(A,4,this.length);return RA.read(this,A,!1,23,4)};m.prototype.readDoubleLE=function(A,Q){if(A=A>>>0,!Q)D0(A,8,this.length);return RA.read(this,A,!0,52,8)};m.prototype.readDoubleBE=function(A,Q){if(A=A>>>0,!Q)D0(A,8,this.length);return RA.read(this,A,!1,52,8)};function i0(T,A,Q,J,W,$){if(!m.isBuffer(T))throw TypeError('"buffer" argument must be a Buffer instance');if(A>W||A<$)throw RangeError('"value" argument is out of bounds');if(Q+J>T.length)throw RangeError("Index out of range")}m.prototype.writeUintLE=m.prototype.writeUIntLE=function(A,Q,J,W){if(A=+A,Q=Q>>>0,J=J>>>0,!W){let Y=Math.pow(2,8*J)-1;i0(this,A,Q,J,Y,0)}let $=1,G=0;this[Q]=A&255;while(++G<J&&($*=256))this[Q+G]=A/$&255;return Q+J};m.prototype.writeUintBE=m.prototype.writeUIntBE=function(A,Q,J,W){if(A=+A,Q=Q>>>0,J=J>>>0,!W){let Y=Math.pow(2,8*J)-1;i0(this,A,Q,J,Y,0)}let $=J-1,G=1;this[Q+$]=A&255;while(--$>=0&&(G*=256))this[Q+$]=A/G&255;return Q+J};m.prototype.writeUint8=m.prototype.writeUInt8=function(A,Q,J){if(A=+A,Q=Q>>>0,!J)i0(this,A,Q,1,255,0);return this[Q]=A&255,Q+1};m.prototype.writeUint16LE=m.prototype.writeUInt16LE=function(A,Q,J){if(A=+A,Q=Q>>>0,!J)i0(this,A,Q,2,65535,0);return this[Q]=A&255,this[Q+1]=A>>>8,Q+2};m.prototype.writeUint16BE=m.prototype.writeUInt16BE=function(A,Q,J){if(A=+A,Q=Q>>>0,!J)i0(this,A,Q,2,65535,0);return this[Q]=A>>>8,this[Q+1]=A&255,Q+2};m.prototype.writeUint32LE=m.prototype.writeUInt32LE=function(A,Q,J){if(A=+A,Q=Q>>>0,!J)i0(this,A,Q,4,4294967295,0);return this[Q+3]=A>>>24,this[Q+2]=A>>>16,this[Q+1]=A>>>8,this[Q]=A&255,Q+4};m.prototype.writeUint32BE=m.prototype.writeUInt32BE=function(A,Q,J){if(A=+A,Q=Q>>>0,!J)i0(this,A,Q,4,4294967295,0);return this[Q]=A>>>24,this[Q+1]=A>>>16,this[Q+2]=A>>>8,this[Q+3]=A&255,Q+4};function NG(T,A,Q,J,W){EG(A,J,W,T,Q,7);let $=Number(A&BigInt(4294967295));T[Q++]=$,$=$>>8,T[Q++]=$,$=$>>8,T[Q++]=$,$=$>>8,T[Q++]=$;let G=Number(A>>BigInt(32)&BigInt(4294967295));return T[Q++]=G,G=G>>8,T[Q++]=G,G=G>>8,T[Q++]=G,G=G>>8,T[Q++]=G,Q}function IG(T,A,Q,J,W){EG(A,J,W,T,Q,7);let $=Number(A&BigInt(4294967295));T[Q+7]=$,$=$>>8,T[Q+6]=$,$=$>>8,T[Q+5]=$,$=$>>8,T[Q+4]=$;let G=Number(A>>BigInt(32)&BigInt(4294967295));return T[Q+3]=G,G=G>>8,T[Q+2]=G,G=G>>8,T[Q+1]=G,G=G>>8,T[Q]=G,Q+8}m.prototype.writeBigUInt64LE=K8(function(A,Q=0){return NG(this,A,Q,BigInt(0),BigInt("0xffffffffffffffff"))});m.prototype.writeBigUInt64BE=K8(function(A,Q=0){return IG(this,A,Q,BigInt(0),BigInt("0xffffffffffffffff"))});m.prototype.writeIntLE=function(A,Q,J,W){if(A=+A,Q=Q>>>0,!W){let Z=Math.pow(2,8*J-1);i0(this,A,Q,J,Z-1,-Z)}let $=0,G=1,Y=0;this[Q]=A&255;while(++$<J&&(G*=256)){if(A<0&&Y===0&&this[Q+$-1]!==0)Y=1;this[Q+$]=(A/G>>0)-Y&255}return Q+J};m.prototype.writeIntBE=function(A,Q,J,W){if(A=+A,Q=Q>>>0,!W){let Z=Math.pow(2,8*J-1);i0(this,A,Q,J,Z-1,-Z)}let $=J-1,G=1,Y=0;this[Q+$]=A&255;while(--$>=0&&(G*=256)){if(A<0&&Y===0&&this[Q+$+1]!==0)Y=1;this[Q+$]=(A/G>>0)-Y&255}return Q+J};m.prototype.writeInt8=function(A,Q,J){if(A=+A,Q=Q>>>0,!J)i0(this,A,Q,1,127,-128);if(A<0)A=255+A+1;return this[Q]=A&255,Q+1};m.prototype.writeInt16LE=function(A,Q,J){if(A=+A,Q=Q>>>0,!J)i0(this,A,Q,2,32767,-32768);return this[Q]=A&255,this[Q+1]=A>>>8,Q+2};m.prototype.writeInt16BE=function(A,Q,J){if(A=+A,Q=Q>>>0,!J)i0(this,A,Q,2,32767,-32768);return this[Q]=A>>>8,this[Q+1]=A&255,Q+2};m.prototype.writeInt32LE=function(A,Q,J){if(A=+A,Q=Q>>>0,!J)i0(this,A,Q,4,2147483647,-2147483648);return this[Q]=A&255,this[Q+1]=A>>>8,this[Q+2]=A>>>16,this[Q+3]=A>>>24,Q+4};m.prototype.writeInt32BE=function(A,Q,J){if(A=+A,Q=Q>>>0,!J)i0(this,A,Q,4,2147483647,-2147483648);if(A<0)A=4294967295+A+1;return this[Q]=A>>>24,this[Q+1]=A>>>16,this[Q+2]=A>>>8,this[Q+3]=A&255,Q+4};m.prototype.writeBigInt64LE=K8(function(A,Q=0){return NG(this,A,Q,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});m.prototype.writeBigInt64BE=K8(function(A,Q=0){return IG(this,A,Q,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function SG(T,A,Q,J,W,$){if(Q+J>T.length)throw RangeError("Index out of range");if(Q<0)throw RangeError("Index out of range")}function LG(T,A,Q,J,W){if(A=+A,Q=Q>>>0,!W)SG(T,A,Q,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return RA.write(T,A,Q,J,23,4),Q+4}m.prototype.writeFloatLE=function(A,Q,J){return LG(this,A,Q,!0,J)};m.prototype.writeFloatBE=function(A,Q,J){return LG(this,A,Q,!1,J)};function wG(T,A,Q,J,W){if(A=+A,Q=Q>>>0,!W)SG(T,A,Q,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return RA.write(T,A,Q,J,52,8),Q+8}m.prototype.writeDoubleLE=function(A,Q,J){return wG(this,A,Q,!0,J)};m.prototype.writeDoubleBE=function(A,Q,J){return wG(this,A,Q,!1,J)};m.prototype.copy=function(A,Q,J,W){if(!m.isBuffer(A))throw TypeError("argument should be a Buffer");if(!J)J=0;if(!W&&W!==0)W=this.length;if(Q>=A.length)Q=A.length;if(!Q)Q=0;if(W>0&&W<J)W=J;if(W===J)return 0;if(A.length===0||this.length===0)return 0;if(Q<0)throw RangeError("targetStart out of bounds");if(J<0||J>=this.length)throw RangeError("Index out of range");if(W<0)throw RangeError("sourceEnd out of bounds");if(W>this.length)W=this.length;if(A.length-Q<W-J)W=A.length-Q+J;let $=W-J;if(this===A&&typeof Uint8Array.prototype.copyWithin==="function")this.copyWithin(Q,J,W);else Uint8Array.prototype.set.call(A,this.subarray(J,W),Q);return $};m.prototype.fill=function(A,Q,J,W){if(typeof A==="string"){if(typeof Q==="string")W=Q,Q=0,J=this.length;else if(typeof J==="string")W=J,J=this.length;if(W!==void 0&&typeof W!=="string")throw TypeError("encoding must be a string");if(typeof W==="string"&&!m.isEncoding(W))throw TypeError("Unknown encoding: "+W);if(A.length===1){let G=A.charCodeAt(0);if(W==="utf8"&&G<128||W==="latin1")A=G}}else if(typeof A==="number")A=A&255;else if(typeof A==="boolean")A=Number(A);if(Q<0||this.length<Q||this.length<J)throw RangeError("Out of range index");if(J<=Q)return this;if(Q=Q>>>0,J=J===void 0?this.length:J>>>0,!A)A=0;let $;if(typeof A==="number")for($=Q;$<J;++$)this[$]=A;else{let G=m.isBuffer(A)?A:m.from(A,W),Y=G.length;if(Y===0)throw TypeError('The value "'+A+'" is invalid for argument "value"');for($=0;$<J-Q;++$)this[$+Q]=G[$%Y]}return this};var jA={};function j4(T,A,Q){jA[T]=class extends Q{constructor(){super();Object.defineProperty(this,"message",{value:A.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${T}]`,this.stack,delete this.name}get code(){return T}set code(W){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:W,writable:!0})}toString(){return`${this.name} [${T}]: ${this.message}`}}}j4("ERR_BUFFER_OUT_OF_BOUNDS",function(T){if(T)return`${T} is outside of buffer bounds`;return"Attempt to access memory outside buffer bounds"},RangeError);j4("ERR_INVALID_ARG_TYPE",function(T,A){return`The "${T}" argument must be of type number. Received type ${typeof A}`},TypeError);j4("ERR_OUT_OF_RANGE",function(T,A,Q){let J=`The value of "${T}" is out of range.`,W=Q;if(Number.isInteger(Q)&&Math.abs(Q)>4294967296)W=RG(String(Q));else if(typeof Q==="bigint"){if(W=String(Q),Q>BigInt(2)**BigInt(32)||Q<-(BigInt(2)**BigInt(32)))W=RG(W);W+="n"}return J+=` It must be ${A}. Received ${W}`,J},RangeError);function RG(T){let A="",Q=T.length,J=T[0]==="-"?1:0;for(;Q>=J+4;Q-=3)A=`_${T.slice(Q-3,Q)}${A}`;return`${T.slice(0,Q)}${A}`}function dq(T,A,Q){if(DA(A,"offset"),T[A]===void 0||T[A+Q]===void 0)eA(A,T.length-(Q+1))}function EG(T,A,Q,J,W,$){if(T>Q||T<A){let G=typeof A==="bigint"?"n":"",Y;if($>3)if(A===0||A===BigInt(0))Y=`>= 0${G} and < 2${G} ** ${($+1)*8}${G}`;else Y=`>= -(2${G} ** ${($+1)*8-1}${G}) and < 2 ** ${($+1)*8-1}${G}`;else Y=`>= ${A}${G} and <= ${Q}${G}`;throw new jA.ERR_OUT_OF_RANGE("value",Y,T)}dq(J,W,$)}function DA(T,A){if(typeof T!=="number")throw new jA.ERR_INVALID_ARG_TYPE(A,"number",T)}function eA(T,A,Q){if(Math.floor(T)!==T)throw DA(T,Q),new jA.ERR_OUT_OF_RANGE(Q||"offset","an integer",T);if(A<0)throw new jA.ERR_BUFFER_OUT_OF_BOUNDS;throw new jA.ERR_OUT_OF_RANGE(Q||"offset",`>= ${Q?1:0} and <= ${A}`,T)}var cq=/[^+/0-9A-Za-z-_]/g;function fq(T){if(T=T.split("=")[0],T=T.trim().replace(cq,""),T.length<2)return"";while(T.length%4!==0)T=T+"=";return T}function C4(T,A){A=A||1/0;let Q,J=T.length,W=null,$=[];for(let G=0;G<J;++G){if(Q=T.charCodeAt(G),Q>55295&&Q<57344){if(!W){if(Q>56319){if((A-=3)>-1)$.push(239,191,189);continue}else if(G+1===J){if((A-=3)>-1)$.push(239,191,189);continue}W=Q;continue}if(Q<56320){if((A-=3)>-1)$.push(239,191,189);W=Q;continue}Q=(W-55296<<10|Q-56320)+65536}else if(W){if((A-=3)>-1)$.push(239,191,189)}if(W=null,Q<128){if((A-=1)<0)break;$.push(Q)}else if(Q<2048){if((A-=2)<0)break;$.push(Q>>6|192,Q&63|128)}else if(Q<65536){if((A-=3)<0)break;$.push(Q>>12|224,Q>>6&63|128,Q&63|128)}else if(Q<1114112){if((A-=4)<0)break;$.push(Q>>18|240,Q>>12&63|128,Q>>6&63|128,Q&63|128)}else throw Error("Invalid code point")}return $}function rq(T){let A=[];for(let Q=0;Q<T.length;++Q)A.push(T.charCodeAt(Q)&255);return A}function nq(T,A){let Q,J,W,$=[];for(let G=0;G<T.length;++G){if((A-=2)<0)break;Q=T.charCodeAt(G),J=Q>>8,W=Q%256,$.push(W),$.push(J)}return $}function OG(T){return X4.toByteArray(fq(T))}function n2(T,A,Q,J){let W;for(W=0;W<J;++W){if(W+Q>=A.length||W>=T.length)break;A[W+Q]=T[W]}return W}function NT(T,A){return T instanceof A||T!=null&&T.constructor!=null&&T.constructor.name!=null&&T.constructor.name===A.name}function R4(T){return T!==T}var iq=function(){let A=Array(256);for(let Q=0;Q<16;++Q){let J=Q*16;for(let W=0;W<16;++W)A[J+W]="0123456789abcdef"[Q]+"0123456789abcdef"[W]}return A}();function K8(T){return typeof BigInt>"u"?oq:T}function oq(){throw Error("BigInt not supported")}if(typeof globalThis.Buffer>"u")globalThis.Buffer=D4;var M4=1,_G=2,xG=3,hG=4,gG=5,mG=6,vG=7,yG=8,bG=9,aq=10,sq=-32700,tq=-32603,eq=-32602,TK=-32601,AK=-32600,QK=-32019,JK=-32018,WK=-32017,$K=-32016,GK=-32015,UK=-32014,YK=-32013,ZK=-32012,XK=-32011,PK=-32010,qK=-32009,KK=-32008,CK=-32007,HK=-32006,VK=-32005,jK=-32004,RK=-32003,DK=-32002,MK=-32001,i2=2800000,o2=2800001,kK=2800002,k4=2800003,pG=2800004,lG=2800005,z4=2800006,F4=2800007,a2=2800008,N4=2800009,uG=2800010,dG=2800011,I4=3230000,cG=32300001,S4=3230002,fG=3230003,rG=3230004,L4=3610000,w4=3610001,E4=3610002,O4=3610003,B4=3610004,_4=3610005,nG=3610006,zK=3610007,iG=3611000,FK=3704000,NK=3704001,IK=3704002,SK=3704003,LK=3704004,wK=4128000,EK=4128001,OK=4128002,oG=4615000,BK=4615001,_K=4615002,xK=4615003,hK=4615004,gK=4615005,mK=4615006,vK=4615007,yK=4615008,bK=4615009,pK=4615010,lK=4615011,uK=4615012,dK=4615013,cK=4615014,fK=4615015,rK=4615016,nK=4615017,iK=4615018,oK=4615019,aK=4615020,sK=4615021,tK=4615022,eK=4615023,TC=4615024,AC=4615025,aG=4615026,QC=4615027,JC=4615028,WC=4615029,$C=4615030,GC=4615031,UC=4615032,YC=4615033,ZC=4615034,XC=4615035,PC=4615036,qC=4615037,KC=4615038,CC=4615039,HC=4615040,VC=4615041,jC=4615042,RC=4615043,DC=4615044,MC=4615045,kC=4615046,zC=4615047,FC=4615048,NC=4615049,IC=4615050,SC=4615051,LC=4615052,wC=4615053,EC=4615054,x4=5508000,sG=5508001,tG=5508002,eG=5508003,TU=5508004,AU=5508005,QU=5508006,JU=5508007,WU=5508008,$U=5508009,GU=5508010,OC=5508011,h4=5663000,s2=5663001,g4=5663002,m4=5663003,v4=5663004,UU=5663005,YU=5663006,ZU=5663007,XU=5663008,y4=5663009,BC=5663010,_C=5663011,b4=5663012,xC=5663013,hC=5663014,p4=5663015,l4=5663016,PU=5663017,gC=5663018,mC=5663019,qU=5663020,u4=5663021,KU=5663022,CU=7050000,vC=7050001,yC=7050002,bC=7050003,pC=7050004,lC=7050005,uC=7050006,dC=7050007,cC=7050008,fC=7050009,rC=7050010,nC=7050011,iC=7050012,oC=7050013,aC=7050014,sC=7050015,tC=7050016,eC=7050017,TH=7050018,AH=7050019,QH=7050020,JH=7050021,WH=7050022,$H=7050023,GH=7050024,UH=7050025,YH=7050026,ZH=7050027,XH=7050028,PH=7050029,HU=7050030,VU=7050031,qH=7050032,KH=7050033,CH=7050034,jU=7050035,HH=7050036,VH=7618000,jH=7618001,RH=7618002,DH=7618003,t2=8078000,T2=8078001,d4=8078002,c4=8078003,e2=8078004,T6=8078005,A6=8078006,l8=8078007,Q6=8078008,J6=8078009,W6=8078010,u8=8078011,C8=8078012,f4=8078013,r4=8078014,$6=8078015,G6=8078016,A2=8078017,U6=8078018,MH=8078019,n4=8078020,i4=8078021,Y6=8078022,o4=8078023,kH=8100000,zH=8100001,FH=8100002,NH=8100003,IH=8190000,SH=8190001,LH=8190002,wH=8190003,EH=8190004,OH=9900000,BH=9900001,_H=9900002,a4=9900003,xH=9900004,hH=9900005,gH=9900006;var mH={[I4]:"Account not found at address: $address",[rG]:"Not all accounts were decoded. Encoded accounts found at addresses: $addresses.",[fG]:"Expected decoded account at address: $address",[S4]:"Failed to decode account data at address: $address",[cG]:"Accounts not found at addresses: $addresses",[N4]:"Unable to find a viable program address bump seed.",[kK]:"$putativeAddress is not a base58-encoded address.",[i2]:"Expected base58 encoded address to decode to a byte array of length 32. Actual length: $actualLength.",[k4]:"The `CryptoKey` must be an `Ed25519` public key.",[dG]:"$putativeOffCurveAddress is not a base58-encoded off-curve address.",[a2]:"Invalid seeds; point must fall off the Ed25519 curve.",[pG]:"Expected given program derived address to have the following format: [Address, ProgramDerivedAddressBump].",[z4]:"A maximum of $maxSeeds seeds, including the bump seed, may be supplied when creating an address. Received: $actual.",[F4]:"The seed at index $index with length $actual exceeds the maximum length of $maxSeedLength bytes.",[lG]:"Expected program derived address bump to be in the range [0, 255], got: $bump.",[uG]:"Program address cannot end with PDA marker.",[o2]:"Expected base58-encoded address string of length in the range [32, 44]. Actual length: $actualLength.",[hG]:"Expected base58-encoded blockash string of length in the range [32, 44]. Actual length: $actualLength.",[M4]:"The network has progressed past the last block for which this transaction could have been committed.",[t2]:"Codec [$codecDescription] cannot decode empty byte arrays.",[Y6]:"Enum codec cannot use lexical values [$stringValues] as discriminators. Either remove all lexical values or set `useValuesAsDiscriminators` to `false`.",[n4]:"Sentinel [$hexSentinel] must not be present in encoded bytes [$hexEncodedBytes].",[T6]:"Encoder and decoder must have the same fixed size, got [$encoderFixedSize] and [$decoderFixedSize].",[A6]:"Encoder and decoder must have the same max size, got [$encoderMaxSize] and [$decoderMaxSize].",[e2]:"Encoder and decoder must either both be fixed-size or variable-size.",[Q6]:"Enum discriminator out of range. Expected a number in [$formattedValidDiscriminators], got $discriminator.",[d4]:"Expected a fixed-size codec, got a variable-size one.",[f4]:"Codec [$codecDescription] expected a positive byte length, got $bytesLength.",[c4]:"Expected a variable-size codec, got a fixed-size one.",[MH]:"Codec [$codecDescription] expected zero-value [$hexZeroValue] to have the same size as the provided fixed-size item [$expectedSize bytes].",[T2]:"Codec [$codecDescription] expected $expected bytes, got $bytesLength.",[U6]:"Expected byte array constant [$hexConstant] to be present in data [$hexData] at offset [$offset].",[J6]:"Invalid discriminated union variant. Expected one of [$variants], got $value.",[W6]:"Invalid enum variant. Expected one of [$stringValues] or a number in [$formattedNumericalValues], got $variant.",[$6]:"Invalid literal union variant. Expected one of [$variants], got $value.",[l8]:"Expected [$codecDescription] to have $expected items, got $actual.",[C8]:"Invalid value $value for base $base with alphabet $alphabet.",[G6]:"Literal union discriminator out of range. Expected a number between $minRange and $maxRange, got $discriminator.",[u8]:"Codec [$codecDescription] expected number to be in the range [$min, $max], got $value.",[r4]:"Codec [$codecDescription] expected offset to be in the range [0, $bytesLength], got $offset.",[i4]:"Expected sentinel [$hexSentinel] to be present in decoded bytes [$hexDecodedBytes].",[A2]:"Union variant out of range. Expected an index between $minRange and $maxRange, got $variant.",[o4]:"This decoder expected a byte array of exactly $expectedLength bytes, but $numExcessBytes unexpected excess bytes remained after decoding. Are you sure that you have chosen the correct decoder for this data?",[iG]:"No random values implementation could be found.",[bK]:"instruction requires an uninitialized account",[eK]:"instruction tries to borrow reference for an account which is already borrowed",[TC]:"instruction left account with an outstanding borrowed reference",[sK]:"program other than the account's owner changed the size of the account data",[gK]:"account data too small for instruction",[tK]:"instruction expected an executable account",[kC]:"An account does not have enough lamports to be rent-exempt",[FC]:"Program arithmetic overflowed",[MC]:"Failed to serialize or deserialize account data: $encodedData",[EC]:"Builtin programs must consume compute units",[UC]:"Cross-program invocation call depth too deep",[KC]:"Computational budget exceeded",[aG]:"custom program error: #$code",[nK]:"instruction contains duplicate accounts",[AC]:"instruction modifications of multiply-passed account differ",[$C]:"executable accounts must be rent exempt",[JC]:"instruction changed executable accounts data",[WC]:"instruction changed the balance of an executable account",[iK]:"instruction changed executable bit of an account",[cK]:"instruction modified data of an account it does not own",[dK]:"instruction spent from the balance of an account it does not own",[BK]:"generic instruction error",[IC]:"Provided owner is not allowed",[RC]:"Account is immutable",[DC]:"Incorrect authority provided",[vK]:"incorrect program id for instruction",[mK]:"insufficient funds for instruction",[hK]:"invalid account data for instruction",[zC]:"Invalid account owner",[_K]:"invalid program argument",[QC]:"program returned invalid error code",[xK]:"invalid instruction data",[qC]:"Failed to reallocate account data",[PC]:"Provided seeds do not result in a valid address",[SC]:"Accounts data allocations exceeded the maximum allowed per transaction",[LC]:"Max accounts exceeded",[wC]:"Max instruction trace length exceeded",[XC]:"Length of the seed is too long for address generation",[YC]:"An account required by the instruction is missing",[yK]:"missing required signature for instruction",[uK]:"instruction illegally modified the program id of an account",[aK]:"insufficient account keys for instruction",[CC]:"Cross-program invocation with unauthorized signer or writable account",[HC]:"Failed to create program execution environment",[jC]:"Program failed to compile",[VC]:"Program failed to complete",[rK]:"instruction modified data of a read-only account",[fK]:"instruction changed the balance of a read-only account",[ZC]:"Cross-program invocation reentrancy not allowed for this instruction",[oK]:"instruction modified rent epoch of an account",[lK]:"sum of account balances before and after instruction do not match",[pK]:"instruction requires an initialized account",[oG]:"",[GC]:"Unsupported program id",[NC]:"Unsupported sysvar",[hH]:"Invalid instruction plan kind: $kind.",[RH]:"The provided instruction plan is empty.",[DH]:"The provided transaction plan failed to execute. See the `transactionPlanResult` attribute and the `cause` error for more details.",[VH]:"The provided message has insufficient capacity to accommodate the next instruction(s) in this plan. Expected at least $numBytesRequired free byte(s), got $numFreeBytes byte(s).",[gH]:"Invalid transaction plan kind: $kind.",[jH]:"No more instructions to pack; the message packer has completed the instruction plan.",[wK]:"The instruction does not have any accounts.",[EK]:"The instruction does not have any data.",[OK]:"Expected instruction to have progress address $expectedProgramAddress, got $actualProgramAddress.",[gG]:"Expected base58 encoded blockhash to decode to a byte array of length 32. Actual length: $actualLength.",[_G]:"The nonce `$expectedNonceValue` is no longer valid. It has advanced to `$actualNonceValue`",[_H]:"Invariant violation: Found no abortable iterable cache entry for key `$cacheKey`. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[xH]:"Invariant violation: This data publisher does not publish to the channel named `$channelName`. Supported channels include $supportedChannelNames.",[BH]:"Invariant violation: WebSocket message iterator state is corrupt; iterated without first resolving existing message promise. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[OH]:"Invariant violation: WebSocket message iterator is missing state storage. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[a4]:"Invariant violation: Switch statement non-exhaustive. Received unexpected value `$unexpectedValue`. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[tq]:"JSON-RPC error: Internal JSON-RPC error ($__serverMessage)",[eq]:"JSON-RPC error: Invalid method parameter(s) ($__serverMessage)",[AK]:"JSON-RPC error: The JSON sent is not a valid `Request` object ($__serverMessage)",[TK]:"JSON-RPC error: The method does not exist / is not available ($__serverMessage)",[sq]:"JSON-RPC error: An error occurred on the server while parsing the JSON text ($__serverMessage)",[ZK]:"$__serverMessage",[MK]:"$__serverMessage",[jK]:"$__serverMessage",[UK]:"$__serverMessage",[WK]:"Epoch rewards period still active at slot $slot",[PK]:"$__serverMessage",[qK]:"$__serverMessage",[QK]:"Failed to query long-term storage; please try again",[$K]:"Minimum context slot has not been reached",[VK]:"Node is unhealthy; behind by $numSlotsBehind slots",[KK]:"No snapshot",[DK]:"Transaction simulation failed",[JK]:"Rewards cannot be found because slot $slot is not the epoch boundary. This may be due to gap in the queried node's local ledger or long-term storage",[CK]:"$__serverMessage",[XK]:"Transaction history is not available from this node",[HK]:"$__serverMessage",[YK]:"Transaction signature length mismatch",[RK]:"Transaction signature verification failure",[GK]:"$__serverMessage",[FK]:"Key pair bytes must be of length 64, got $byteLength.",[NK]:"Expected private key bytes with length 32. Actual length: $actualLength.",[IK]:"Expected base58-encoded signature to decode to a byte array of length 64. Actual length: $actualLength.",[LK]:"The provided private key does not match the provided public key.",[SK]:"Expected base58-encoded signature string of length in the range [64, 88]. Actual length: $actualLength.",[mG]:"Lamports value must be in the range [0, 2e64-1]",[vG]:"`$value` cannot be parsed as a `BigInt`",[aq]:"$message",[yG]:"`$value` cannot be parsed as a `Number`",[xG]:"No nonce account could be found at address `$nonceAccountAddress`",[IH]:"The notification name must end in 'Notifications' and the API must supply a subscription plan creator function for the notification '$notificationName'.",[LH]:"WebSocket was closed before payload could be added to the send buffer",[wH]:"WebSocket connection closed",[EH]:"WebSocket failed to connect",[SH]:"Failed to obtain a subscription id from the server",[NH]:"Could not find an API plan for RPC method: `$method`",[kH]:"The $argumentLabel argument to the `$methodName` RPC method$optionalPathLabel was `$value`. This number is unsafe for use with the Solana JSON-RPC because it exceeds `Number.MAX_SAFE_INTEGER`.",[FH]:"HTTP error ($statusCode): $message",[zH]:"HTTP header(s) forbidden: $headers. Learn more at https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name.",[x4]:"Multiple distinct signers were identified for address `$address`. Please ensure that you are using the same signer instance for each address.",[sG]:"The provided value does not implement the `KeyPairSigner` interface",[eG]:"The provided value does not implement the `MessageModifyingSigner` interface",[TU]:"The provided value does not implement the `MessagePartialSigner` interface",[tG]:"The provided value does not implement any of the `MessageSigner` interfaces",[QU]:"The provided value does not implement the `TransactionModifyingSigner` interface",[JU]:"The provided value does not implement the `TransactionPartialSigner` interface",[WU]:"The provided value does not implement the `TransactionSendingSigner` interface",[AU]:"The provided value does not implement any of the `TransactionSigner` interfaces",[$U]:"More than one `TransactionSendingSigner` was identified.",[GU]:"No `TransactionSendingSigner` was identified. Please provide a valid `TransactionWithSingleSendingSigner` transaction.",[OC]:"Wallet account signers do not support signing multiple messages/transactions in a single operation",[zK]:"Cannot export a non-extractable key.",[w4]:"No digest implementation could be found.",[L4]:"Cryptographic operations are only allowed in secure browser contexts. Read more here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts.",[E4]:`This runtime does not support the generation of Ed25519 key pairs.
|
|
6
|
+
*/var C4=VG(),RA=jG(),RG=typeof Symbol==="function"&&typeof Symbol.for==="function"?Symbol.for("nodejs.util.inspect.custom"):null;var F4=m;var hG=50;var H4=2147483647;m.TYPED_ARRAY_SUPPORT=hq();if(!m.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error==="function")console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function hq(){try{let T=new Uint8Array(1),A={foo:function(){return 42}};return Object.setPrototypeOf(A,Uint8Array.prototype),Object.setPrototypeOf(T,A),T.foo()===42}catch(T){return!1}}Object.defineProperty(m.prototype,"parent",{enumerable:!0,get:function(){if(!m.isBuffer(this))return;return this.buffer}});Object.defineProperty(m.prototype,"offset",{enumerable:!0,get:function(){if(!m.isBuffer(this))return;return this.byteOffset}});function dT(T){if(T>H4)throw RangeError('The value "'+T+'" is invalid for option "size"');let A=new Uint8Array(T);return Object.setPrototypeOf(A,m.prototype),A}function m(T,A,Q){if(typeof T==="number"){if(typeof A==="string")throw TypeError('The "string" argument must be of type string. Received type number');return D4(T)}return zG(T,A,Q)}m.poolSize=8192;function zG(T,A,Q){if(typeof T==="string")return mq(T,A);if(ArrayBuffer.isView(T))return vq(T);if(T==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T);if(IT(T,ArrayBuffer)||T&&IT(T.buffer,ArrayBuffer))return j4(T,A,Q);if(typeof SharedArrayBuffer<"u"&&(IT(T,SharedArrayBuffer)||T&&IT(T.buffer,SharedArrayBuffer)))return j4(T,A,Q);if(typeof T==="number")throw TypeError('The "value" argument must not be of type number. Received type number');let J=T.valueOf&&T.valueOf();if(J!=null&&J!==T)return m.from(J,A,Q);let $=yq(T);if($)return $;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof T[Symbol.toPrimitive]==="function")return m.from(T[Symbol.toPrimitive]("string"),A,Q);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T)}m.from=function(T,A,Q){return zG(T,A,Q)};Object.setPrototypeOf(m.prototype,Uint8Array.prototype);Object.setPrototypeOf(m,Uint8Array);function FG(T){if(typeof T!=="number")throw TypeError('"size" argument must be of type number');else if(T<0)throw RangeError('The value "'+T+'" is invalid for option "size"')}function gq(T,A,Q){if(FG(T),T<=0)return dT(T);if(A!==void 0)return typeof Q==="string"?dT(T).fill(A,Q):dT(T).fill(A);return dT(T)}m.alloc=function(T,A,Q){return gq(T,A,Q)};function D4(T){return FG(T),dT(T<0?0:M4(T)|0)}m.allocUnsafe=function(T){return D4(T)};m.allocUnsafeSlow=function(T){return D4(T)};function mq(T,A){if(typeof A!=="string"||A==="")A="utf8";if(!m.isEncoding(A))throw TypeError("Unknown encoding: "+A);let Q=NG(T,A)|0,J=dT(Q),$=J.write(T,A);if($!==Q)J=J.slice(0,$);return J}function V4(T){let A=T.length<0?0:M4(T.length)|0,Q=dT(A);for(let J=0;J<A;J+=1)Q[J]=T[J]&255;return Q}function vq(T){if(IT(T,Uint8Array)){let A=new Uint8Array(T);return j4(A.buffer,A.byteOffset,A.byteLength)}return V4(T)}function j4(T,A,Q){if(A<0||T.byteLength<A)throw RangeError('"offset" is outside of buffer bounds');if(T.byteLength<A+(Q||0))throw RangeError('"length" is outside of buffer bounds');let J;if(A===void 0&&Q===void 0)J=new Uint8Array(T);else if(Q===void 0)J=new Uint8Array(T,A);else J=new Uint8Array(T,A,Q);return Object.setPrototypeOf(J,m.prototype),J}function yq(T){if(m.isBuffer(T)){let A=M4(T.length)|0,Q=dT(A);if(Q.length===0)return Q;return T.copy(Q,0,0,A),Q}if(T.length!==void 0){if(typeof T.length!=="number"||z4(T.length))return dT(0);return V4(T)}if(T.type==="Buffer"&&Array.isArray(T.data))return V4(T.data)}function M4(T){if(T>=H4)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+H4.toString(16)+" bytes");return T|0}m.isBuffer=function(A){return A!=null&&A._isBuffer===!0&&A!==m.prototype};m.compare=function(A,Q){if(IT(A,Uint8Array))A=m.from(A,A.offset,A.byteLength);if(IT(Q,Uint8Array))Q=m.from(Q,Q.offset,Q.byteLength);if(!m.isBuffer(A)||!m.isBuffer(Q))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(A===Q)return 0;let J=A.length,$=Q.length;for(let W=0,G=Math.min(J,$);W<G;++W)if(A[W]!==Q[W]){J=A[W],$=Q[W];break}if(J<$)return-1;if($<J)return 1;return 0};m.isEncoding=function(A){switch(String(A).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};m.concat=function(A,Q){if(!Array.isArray(A))throw TypeError('"list" argument must be an Array of Buffers');if(A.length===0)return m.alloc(0);let J;if(Q===void 0){Q=0;for(J=0;J<A.length;++J)Q+=A[J].length}let $=m.allocUnsafe(Q),W=0;for(J=0;J<A.length;++J){let G=A[J];if(IT(G,Uint8Array))if(W+G.length>$.length){if(!m.isBuffer(G))G=m.from(G);G.copy($,W)}else Uint8Array.prototype.set.call($,G,W);else if(!m.isBuffer(G))throw TypeError('"list" argument must be an Array of Buffers');else G.copy($,W);W+=G.length}return $};function NG(T,A){if(m.isBuffer(T))return T.length;if(ArrayBuffer.isView(T)||IT(T,ArrayBuffer))return T.byteLength;if(typeof T!=="string")throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof T);let Q=T.length,J=arguments.length>2&&arguments[2]===!0;if(!J&&Q===0)return 0;let $=!1;for(;;)switch(A){case"ascii":case"latin1":case"binary":return Q;case"utf8":case"utf-8":return R4(T).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Q*2;case"hex":return Q>>>1;case"base64":return xG(T).length;default:if($)return J?-1:R4(T).length;A=(""+A).toLowerCase(),$=!0}}m.byteLength=NG;function bq(T,A,Q){let J=!1;if(A===void 0||A<0)A=0;if(A>this.length)return"";if(Q===void 0||Q>this.length)Q=this.length;if(Q<=0)return"";if(Q>>>=0,A>>>=0,Q<=A)return"";if(!T)T="utf8";while(!0)switch(T){case"hex":return oq(this,A,Q);case"utf8":case"utf-8":return SG(this,A,Q);case"ascii":return nq(this,A,Q);case"latin1":case"binary":return iq(this,A,Q);case"base64":return fq(this,A,Q);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return aq(this,A,Q);default:if(J)throw TypeError("Unknown encoding: "+T);T=(T+"").toLowerCase(),J=!0}}m.prototype._isBuffer=!0;function p8(T,A,Q){let J=T[A];T[A]=T[Q],T[Q]=J}m.prototype.swap16=function(){let A=this.length;if(A%2!==0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let Q=0;Q<A;Q+=2)p8(this,Q,Q+1);return this};m.prototype.swap32=function(){let A=this.length;if(A%4!==0)throw RangeError("Buffer size must be a multiple of 32-bits");for(let Q=0;Q<A;Q+=4)p8(this,Q,Q+3),p8(this,Q+1,Q+2);return this};m.prototype.swap64=function(){let A=this.length;if(A%8!==0)throw RangeError("Buffer size must be a multiple of 64-bits");for(let Q=0;Q<A;Q+=8)p8(this,Q,Q+7),p8(this,Q+1,Q+6),p8(this,Q+2,Q+5),p8(this,Q+3,Q+4);return this};m.prototype.toString=function(){let A=this.length;if(A===0)return"";if(arguments.length===0)return SG(this,0,A);return bq.apply(this,arguments)};m.prototype.toLocaleString=m.prototype.toString;m.prototype.equals=function(A){if(!m.isBuffer(A))throw TypeError("Argument must be a Buffer");if(this===A)return!0;return m.compare(this,A)===0};m.prototype.inspect=function(){let A="",Q=hG;if(A=this.toString("hex",0,Q).replace(/(.{2})/g,"$1 ").trim(),this.length>Q)A+=" ... ";return"<Buffer "+A+">"};if(RG)m.prototype[RG]=m.prototype.inspect;m.prototype.compare=function(A,Q,J,$,W){if(IT(A,Uint8Array))A=m.from(A,A.offset,A.byteLength);if(!m.isBuffer(A))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof A);if(Q===void 0)Q=0;if(J===void 0)J=A?A.length:0;if($===void 0)$=0;if(W===void 0)W=this.length;if(Q<0||J>A.length||$<0||W>this.length)throw RangeError("out of range index");if($>=W&&Q>=J)return 0;if($>=W)return-1;if(Q>=J)return 1;if(Q>>>=0,J>>>=0,$>>>=0,W>>>=0,this===A)return 0;let G=W-$,Y=J-Q,Z=Math.min(G,Y),C=this.slice($,W),K=A.slice(Q,J);for(let j=0;j<Z;++j)if(C[j]!==K[j]){G=C[j],Y=K[j];break}if(G<Y)return-1;if(Y<G)return 1;return 0};function IG(T,A,Q,J,$){if(T.length===0)return-1;if(typeof Q==="string")J=Q,Q=0;else if(Q>2147483647)Q=2147483647;else if(Q<-2147483648)Q=-2147483648;if(Q=+Q,z4(Q))Q=$?0:T.length-1;if(Q<0)Q=T.length+Q;if(Q>=T.length)if($)return-1;else Q=T.length-1;else if(Q<0)if($)Q=0;else return-1;if(typeof A==="string")A=m.from(A,J);if(m.isBuffer(A)){if(A.length===0)return-1;return DG(T,A,Q,J,$)}else if(typeof A==="number"){if(A=A&255,typeof Uint8Array.prototype.indexOf==="function")if($)return Uint8Array.prototype.indexOf.call(T,A,Q);else return Uint8Array.prototype.lastIndexOf.call(T,A,Q);return DG(T,[A],Q,J,$)}throw TypeError("val must be string, number or Buffer")}function DG(T,A,Q,J,$){let W=1,G=T.length,Y=A.length;if(J!==void 0){if(J=String(J).toLowerCase(),J==="ucs2"||J==="ucs-2"||J==="utf16le"||J==="utf-16le"){if(T.length<2||A.length<2)return-1;W=2,G/=2,Y/=2,Q/=2}}function Z(K,j){if(W===1)return K[j];else return K.readUInt16BE(j*W)}let C;if($){let K=-1;for(C=Q;C<G;C++)if(Z(T,C)===Z(A,K===-1?0:C-K)){if(K===-1)K=C;if(C-K+1===Y)return K*W}else{if(K!==-1)C-=C-K;K=-1}}else{if(Q+Y>G)Q=G-Y;for(C=Q;C>=0;C--){let K=!0;for(let j=0;j<Y;j++)if(Z(T,C+j)!==Z(A,j)){K=!1;break}if(K)return C}}return-1}m.prototype.includes=function(A,Q,J){return this.indexOf(A,Q,J)!==-1};m.prototype.indexOf=function(A,Q,J){return IG(this,A,Q,J,!0)};m.prototype.lastIndexOf=function(A,Q,J){return IG(this,A,Q,J,!1)};function pq(T,A,Q,J){Q=Number(Q)||0;let $=T.length-Q;if(!J)J=$;else if(J=Number(J),J>$)J=$;let W=A.length;if(J>W/2)J=W/2;let G;for(G=0;G<J;++G){let Y=parseInt(A.substr(G*2,2),16);if(z4(Y))return G;T[Q+G]=Y}return G}function lq(T,A,Q,J){return s2(R4(A,T.length-Q),T,Q,J)}function uq(T,A,Q,J){return s2(TK(A),T,Q,J)}function dq(T,A,Q,J){return s2(xG(A),T,Q,J)}function cq(T,A,Q,J){return s2(AK(A,T.length-Q),T,Q,J)}m.prototype.write=function(A,Q,J,$){if(Q===void 0)$="utf8",J=this.length,Q=0;else if(J===void 0&&typeof Q==="string")$=Q,J=this.length,Q=0;else if(isFinite(Q))if(Q=Q>>>0,isFinite(J)){if(J=J>>>0,$===void 0)$="utf8"}else $=J,J=void 0;else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let W=this.length-Q;if(J===void 0||J>W)J=W;if(A.length>0&&(J<0||Q<0)||Q>this.length)throw RangeError("Attempt to write outside buffer bounds");if(!$)$="utf8";let G=!1;for(;;)switch($){case"hex":return pq(this,A,Q,J);case"utf8":case"utf-8":return lq(this,A,Q,J);case"ascii":case"latin1":case"binary":return uq(this,A,Q,J);case"base64":return dq(this,A,Q,J);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return cq(this,A,Q,J);default:if(G)throw TypeError("Unknown encoding: "+$);$=(""+$).toLowerCase(),G=!0}};m.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function fq(T,A,Q){if(A===0&&Q===T.length)return C4.fromByteArray(T);else return C4.fromByteArray(T.slice(A,Q))}function SG(T,A,Q){Q=Math.min(T.length,Q);let J=[],$=A;while($<Q){let W=T[$],G=null,Y=W>239?4:W>223?3:W>191?2:1;if($+Y<=Q){let Z,C,K,j;switch(Y){case 1:if(W<128)G=W;break;case 2:if(Z=T[$+1],(Z&192)===128){if(j=(W&31)<<6|Z&63,j>127)G=j}break;case 3:if(Z=T[$+1],C=T[$+2],(Z&192)===128&&(C&192)===128){if(j=(W&15)<<12|(Z&63)<<6|C&63,j>2047&&(j<55296||j>57343))G=j}break;case 4:if(Z=T[$+1],C=T[$+2],K=T[$+3],(Z&192)===128&&(C&192)===128&&(K&192)===128){if(j=(W&15)<<18|(Z&63)<<12|(C&63)<<6|K&63,j>65535&&j<1114112)G=j}}}if(G===null)G=65533,Y=1;else if(G>65535)G-=65536,J.push(G>>>10&1023|55296),G=56320|G&1023;J.push(G),$+=Y}return rq(J)}var MG=4096;function rq(T){let A=T.length;if(A<=MG)return String.fromCharCode.apply(String,T);let Q="",J=0;while(J<A)Q+=String.fromCharCode.apply(String,T.slice(J,J+=MG));return Q}function nq(T,A,Q){let J="";Q=Math.min(T.length,Q);for(let $=A;$<Q;++$)J+=String.fromCharCode(T[$]&127);return J}function iq(T,A,Q){let J="";Q=Math.min(T.length,Q);for(let $=A;$<Q;++$)J+=String.fromCharCode(T[$]);return J}function oq(T,A,Q){let J=T.length;if(!A||A<0)A=0;if(!Q||Q<0||Q>J)Q=J;let $="";for(let W=A;W<Q;++W)$+=QK[T[W]];return $}function aq(T,A,Q){let J=T.slice(A,Q),$="";for(let W=0;W<J.length-1;W+=2)$+=String.fromCharCode(J[W]+J[W+1]*256);return $}m.prototype.slice=function(A,Q){let J=this.length;if(A=~~A,Q=Q===void 0?J:~~Q,A<0){if(A+=J,A<0)A=0}else if(A>J)A=J;if(Q<0){if(Q+=J,Q<0)Q=0}else if(Q>J)Q=J;if(Q<A)Q=A;let $=this.subarray(A,Q);return Object.setPrototypeOf($,m.prototype),$};function D0(T,A,Q){if(T%1!==0||T<0)throw RangeError("offset is not uint");if(T+A>Q)throw RangeError("Trying to access beyond buffer length")}m.prototype.readUintLE=m.prototype.readUIntLE=function(A,Q,J){if(A=A>>>0,Q=Q>>>0,!J)D0(A,Q,this.length);let $=this[A],W=1,G=0;while(++G<Q&&(W*=256))$+=this[A+G]*W;return $};m.prototype.readUintBE=m.prototype.readUIntBE=function(A,Q,J){if(A=A>>>0,Q=Q>>>0,!J)D0(A,Q,this.length);let $=this[A+--Q],W=1;while(Q>0&&(W*=256))$+=this[A+--Q]*W;return $};m.prototype.readUint8=m.prototype.readUInt8=function(A,Q){if(A=A>>>0,!Q)D0(A,1,this.length);return this[A]};m.prototype.readUint16LE=m.prototype.readUInt16LE=function(A,Q){if(A=A>>>0,!Q)D0(A,2,this.length);return this[A]|this[A+1]<<8};m.prototype.readUint16BE=m.prototype.readUInt16BE=function(A,Q){if(A=A>>>0,!Q)D0(A,2,this.length);return this[A]<<8|this[A+1]};m.prototype.readUint32LE=m.prototype.readUInt32LE=function(A,Q){if(A=A>>>0,!Q)D0(A,4,this.length);return(this[A]|this[A+1]<<8|this[A+2]<<16)+this[A+3]*16777216};m.prototype.readUint32BE=m.prototype.readUInt32BE=function(A,Q){if(A=A>>>0,!Q)D0(A,4,this.length);return this[A]*16777216+(this[A+1]<<16|this[A+2]<<8|this[A+3])};m.prototype.readBigUInt64LE=K8(function(A){A=A>>>0,DA(A,"offset");let Q=this[A],J=this[A+7];if(Q===void 0||J===void 0)Q2(A,this.length-8);let $=Q+this[++A]*256+this[++A]*65536+this[++A]*16777216,W=this[++A]+this[++A]*256+this[++A]*65536+J*16777216;return BigInt($)+(BigInt(W)<<BigInt(32))});m.prototype.readBigUInt64BE=K8(function(A){A=A>>>0,DA(A,"offset");let Q=this[A],J=this[A+7];if(Q===void 0||J===void 0)Q2(A,this.length-8);let $=Q*16777216+this[++A]*65536+this[++A]*256+this[++A],W=this[++A]*16777216+this[++A]*65536+this[++A]*256+J;return(BigInt($)<<BigInt(32))+BigInt(W)});m.prototype.readIntLE=function(A,Q,J){if(A=A>>>0,Q=Q>>>0,!J)D0(A,Q,this.length);let $=this[A],W=1,G=0;while(++G<Q&&(W*=256))$+=this[A+G]*W;if(W*=128,$>=W)$-=Math.pow(2,8*Q);return $};m.prototype.readIntBE=function(A,Q,J){if(A=A>>>0,Q=Q>>>0,!J)D0(A,Q,this.length);let $=Q,W=1,G=this[A+--$];while($>0&&(W*=256))G+=this[A+--$]*W;if(W*=128,G>=W)G-=Math.pow(2,8*Q);return G};m.prototype.readInt8=function(A,Q){if(A=A>>>0,!Q)D0(A,1,this.length);if(!(this[A]&128))return this[A];return(255-this[A]+1)*-1};m.prototype.readInt16LE=function(A,Q){if(A=A>>>0,!Q)D0(A,2,this.length);let J=this[A]|this[A+1]<<8;return J&32768?J|4294901760:J};m.prototype.readInt16BE=function(A,Q){if(A=A>>>0,!Q)D0(A,2,this.length);let J=this[A+1]|this[A]<<8;return J&32768?J|4294901760:J};m.prototype.readInt32LE=function(A,Q){if(A=A>>>0,!Q)D0(A,4,this.length);return this[A]|this[A+1]<<8|this[A+2]<<16|this[A+3]<<24};m.prototype.readInt32BE=function(A,Q){if(A=A>>>0,!Q)D0(A,4,this.length);return this[A]<<24|this[A+1]<<16|this[A+2]<<8|this[A+3]};m.prototype.readBigInt64LE=K8(function(A){A=A>>>0,DA(A,"offset");let Q=this[A],J=this[A+7];if(Q===void 0||J===void 0)Q2(A,this.length-8);let $=this[A+4]+this[A+5]*256+this[A+6]*65536+(J<<24);return(BigInt($)<<BigInt(32))+BigInt(Q+this[++A]*256+this[++A]*65536+this[++A]*16777216)});m.prototype.readBigInt64BE=K8(function(A){A=A>>>0,DA(A,"offset");let Q=this[A],J=this[A+7];if(Q===void 0||J===void 0)Q2(A,this.length-8);let $=(Q<<24)+this[++A]*65536+this[++A]*256+this[++A];return(BigInt($)<<BigInt(32))+BigInt(this[++A]*16777216+this[++A]*65536+this[++A]*256+J)});m.prototype.readFloatLE=function(A,Q){if(A=A>>>0,!Q)D0(A,4,this.length);return RA.read(this,A,!0,23,4)};m.prototype.readFloatBE=function(A,Q){if(A=A>>>0,!Q)D0(A,4,this.length);return RA.read(this,A,!1,23,4)};m.prototype.readDoubleLE=function(A,Q){if(A=A>>>0,!Q)D0(A,8,this.length);return RA.read(this,A,!0,52,8)};m.prototype.readDoubleBE=function(A,Q){if(A=A>>>0,!Q)D0(A,8,this.length);return RA.read(this,A,!1,52,8)};function i0(T,A,Q,J,$,W){if(!m.isBuffer(T))throw TypeError('"buffer" argument must be a Buffer instance');if(A>$||A<W)throw RangeError('"value" argument is out of bounds');if(Q+J>T.length)throw RangeError("Index out of range")}m.prototype.writeUintLE=m.prototype.writeUIntLE=function(A,Q,J,$){if(A=+A,Q=Q>>>0,J=J>>>0,!$){let Y=Math.pow(2,8*J)-1;i0(this,A,Q,J,Y,0)}let W=1,G=0;this[Q]=A&255;while(++G<J&&(W*=256))this[Q+G]=A/W&255;return Q+J};m.prototype.writeUintBE=m.prototype.writeUIntBE=function(A,Q,J,$){if(A=+A,Q=Q>>>0,J=J>>>0,!$){let Y=Math.pow(2,8*J)-1;i0(this,A,Q,J,Y,0)}let W=J-1,G=1;this[Q+W]=A&255;while(--W>=0&&(G*=256))this[Q+W]=A/G&255;return Q+J};m.prototype.writeUint8=m.prototype.writeUInt8=function(A,Q,J){if(A=+A,Q=Q>>>0,!J)i0(this,A,Q,1,255,0);return this[Q]=A&255,Q+1};m.prototype.writeUint16LE=m.prototype.writeUInt16LE=function(A,Q,J){if(A=+A,Q=Q>>>0,!J)i0(this,A,Q,2,65535,0);return this[Q]=A&255,this[Q+1]=A>>>8,Q+2};m.prototype.writeUint16BE=m.prototype.writeUInt16BE=function(A,Q,J){if(A=+A,Q=Q>>>0,!J)i0(this,A,Q,2,65535,0);return this[Q]=A>>>8,this[Q+1]=A&255,Q+2};m.prototype.writeUint32LE=m.prototype.writeUInt32LE=function(A,Q,J){if(A=+A,Q=Q>>>0,!J)i0(this,A,Q,4,4294967295,0);return this[Q+3]=A>>>24,this[Q+2]=A>>>16,this[Q+1]=A>>>8,this[Q]=A&255,Q+4};m.prototype.writeUint32BE=m.prototype.writeUInt32BE=function(A,Q,J){if(A=+A,Q=Q>>>0,!J)i0(this,A,Q,4,4294967295,0);return this[Q]=A>>>24,this[Q+1]=A>>>16,this[Q+2]=A>>>8,this[Q+3]=A&255,Q+4};function LG(T,A,Q,J,$){_G(A,J,$,T,Q,7);let W=Number(A&BigInt(4294967295));T[Q++]=W,W=W>>8,T[Q++]=W,W=W>>8,T[Q++]=W,W=W>>8,T[Q++]=W;let G=Number(A>>BigInt(32)&BigInt(4294967295));return T[Q++]=G,G=G>>8,T[Q++]=G,G=G>>8,T[Q++]=G,G=G>>8,T[Q++]=G,Q}function wG(T,A,Q,J,$){_G(A,J,$,T,Q,7);let W=Number(A&BigInt(4294967295));T[Q+7]=W,W=W>>8,T[Q+6]=W,W=W>>8,T[Q+5]=W,W=W>>8,T[Q+4]=W;let G=Number(A>>BigInt(32)&BigInt(4294967295));return T[Q+3]=G,G=G>>8,T[Q+2]=G,G=G>>8,T[Q+1]=G,G=G>>8,T[Q]=G,Q+8}m.prototype.writeBigUInt64LE=K8(function(A,Q=0){return LG(this,A,Q,BigInt(0),BigInt("0xffffffffffffffff"))});m.prototype.writeBigUInt64BE=K8(function(A,Q=0){return wG(this,A,Q,BigInt(0),BigInt("0xffffffffffffffff"))});m.prototype.writeIntLE=function(A,Q,J,$){if(A=+A,Q=Q>>>0,!$){let Z=Math.pow(2,8*J-1);i0(this,A,Q,J,Z-1,-Z)}let W=0,G=1,Y=0;this[Q]=A&255;while(++W<J&&(G*=256)){if(A<0&&Y===0&&this[Q+W-1]!==0)Y=1;this[Q+W]=(A/G>>0)-Y&255}return Q+J};m.prototype.writeIntBE=function(A,Q,J,$){if(A=+A,Q=Q>>>0,!$){let Z=Math.pow(2,8*J-1);i0(this,A,Q,J,Z-1,-Z)}let W=J-1,G=1,Y=0;this[Q+W]=A&255;while(--W>=0&&(G*=256)){if(A<0&&Y===0&&this[Q+W+1]!==0)Y=1;this[Q+W]=(A/G>>0)-Y&255}return Q+J};m.prototype.writeInt8=function(A,Q,J){if(A=+A,Q=Q>>>0,!J)i0(this,A,Q,1,127,-128);if(A<0)A=255+A+1;return this[Q]=A&255,Q+1};m.prototype.writeInt16LE=function(A,Q,J){if(A=+A,Q=Q>>>0,!J)i0(this,A,Q,2,32767,-32768);return this[Q]=A&255,this[Q+1]=A>>>8,Q+2};m.prototype.writeInt16BE=function(A,Q,J){if(A=+A,Q=Q>>>0,!J)i0(this,A,Q,2,32767,-32768);return this[Q]=A>>>8,this[Q+1]=A&255,Q+2};m.prototype.writeInt32LE=function(A,Q,J){if(A=+A,Q=Q>>>0,!J)i0(this,A,Q,4,2147483647,-2147483648);return this[Q]=A&255,this[Q+1]=A>>>8,this[Q+2]=A>>>16,this[Q+3]=A>>>24,Q+4};m.prototype.writeInt32BE=function(A,Q,J){if(A=+A,Q=Q>>>0,!J)i0(this,A,Q,4,2147483647,-2147483648);if(A<0)A=4294967295+A+1;return this[Q]=A>>>24,this[Q+1]=A>>>16,this[Q+2]=A>>>8,this[Q+3]=A&255,Q+4};m.prototype.writeBigInt64LE=K8(function(A,Q=0){return LG(this,A,Q,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});m.prototype.writeBigInt64BE=K8(function(A,Q=0){return wG(this,A,Q,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function EG(T,A,Q,J,$,W){if(Q+J>T.length)throw RangeError("Index out of range");if(Q<0)throw RangeError("Index out of range")}function OG(T,A,Q,J,$){if(A=+A,Q=Q>>>0,!$)EG(T,A,Q,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return RA.write(T,A,Q,J,23,4),Q+4}m.prototype.writeFloatLE=function(A,Q,J){return OG(this,A,Q,!0,J)};m.prototype.writeFloatBE=function(A,Q,J){return OG(this,A,Q,!1,J)};function BG(T,A,Q,J,$){if(A=+A,Q=Q>>>0,!$)EG(T,A,Q,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return RA.write(T,A,Q,J,52,8),Q+8}m.prototype.writeDoubleLE=function(A,Q,J){return BG(this,A,Q,!0,J)};m.prototype.writeDoubleBE=function(A,Q,J){return BG(this,A,Q,!1,J)};m.prototype.copy=function(A,Q,J,$){if(!m.isBuffer(A))throw TypeError("argument should be a Buffer");if(!J)J=0;if(!$&&$!==0)$=this.length;if(Q>=A.length)Q=A.length;if(!Q)Q=0;if($>0&&$<J)$=J;if($===J)return 0;if(A.length===0||this.length===0)return 0;if(Q<0)throw RangeError("targetStart out of bounds");if(J<0||J>=this.length)throw RangeError("Index out of range");if($<0)throw RangeError("sourceEnd out of bounds");if($>this.length)$=this.length;if(A.length-Q<$-J)$=A.length-Q+J;let W=$-J;if(this===A&&typeof Uint8Array.prototype.copyWithin==="function")this.copyWithin(Q,J,$);else Uint8Array.prototype.set.call(A,this.subarray(J,$),Q);return W};m.prototype.fill=function(A,Q,J,$){if(typeof A==="string"){if(typeof Q==="string")$=Q,Q=0,J=this.length;else if(typeof J==="string")$=J,J=this.length;if($!==void 0&&typeof $!=="string")throw TypeError("encoding must be a string");if(typeof $==="string"&&!m.isEncoding($))throw TypeError("Unknown encoding: "+$);if(A.length===1){let G=A.charCodeAt(0);if($==="utf8"&&G<128||$==="latin1")A=G}}else if(typeof A==="number")A=A&255;else if(typeof A==="boolean")A=Number(A);if(Q<0||this.length<Q||this.length<J)throw RangeError("Out of range index");if(J<=Q)return this;if(Q=Q>>>0,J=J===void 0?this.length:J>>>0,!A)A=0;let W;if(typeof A==="number")for(W=Q;W<J;++W)this[W]=A;else{let G=m.isBuffer(A)?A:m.from(A,$),Y=G.length;if(Y===0)throw TypeError('The value "'+A+'" is invalid for argument "value"');for(W=0;W<J-Q;++W)this[W+Q]=G[W%Y]}return this};var jA={};function k4(T,A,Q){jA[T]=class extends Q{constructor(){super();Object.defineProperty(this,"message",{value:A.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${T}]`,this.stack,delete this.name}get code(){return T}set code($){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:$,writable:!0})}toString(){return`${this.name} [${T}]: ${this.message}`}}}k4("ERR_BUFFER_OUT_OF_BOUNDS",function(T){if(T)return`${T} is outside of buffer bounds`;return"Attempt to access memory outside buffer bounds"},RangeError);k4("ERR_INVALID_ARG_TYPE",function(T,A){return`The "${T}" argument must be of type number. Received type ${typeof A}`},TypeError);k4("ERR_OUT_OF_RANGE",function(T,A,Q){let J=`The value of "${T}" is out of range.`,$=Q;if(Number.isInteger(Q)&&Math.abs(Q)>4294967296)$=kG(String(Q));else if(typeof Q==="bigint"){if($=String(Q),Q>BigInt(2)**BigInt(32)||Q<-(BigInt(2)**BigInt(32)))$=kG($);$+="n"}return J+=` It must be ${A}. Received ${$}`,J},RangeError);function kG(T){let A="",Q=T.length,J=T[0]==="-"?1:0;for(;Q>=J+4;Q-=3)A=`_${T.slice(Q-3,Q)}${A}`;return`${T.slice(0,Q)}${A}`}function sq(T,A,Q){if(DA(A,"offset"),T[A]===void 0||T[A+Q]===void 0)Q2(A,T.length-(Q+1))}function _G(T,A,Q,J,$,W){if(T>Q||T<A){let G=typeof A==="bigint"?"n":"",Y;if(W>3)if(A===0||A===BigInt(0))Y=`>= 0${G} and < 2${G} ** ${(W+1)*8}${G}`;else Y=`>= -(2${G} ** ${(W+1)*8-1}${G}) and < 2 ** ${(W+1)*8-1}${G}`;else Y=`>= ${A}${G} and <= ${Q}${G}`;throw new jA.ERR_OUT_OF_RANGE("value",Y,T)}sq(J,$,W)}function DA(T,A){if(typeof T!=="number")throw new jA.ERR_INVALID_ARG_TYPE(A,"number",T)}function Q2(T,A,Q){if(Math.floor(T)!==T)throw DA(T,Q),new jA.ERR_OUT_OF_RANGE(Q||"offset","an integer",T);if(A<0)throw new jA.ERR_BUFFER_OUT_OF_BOUNDS;throw new jA.ERR_OUT_OF_RANGE(Q||"offset",`>= ${Q?1:0} and <= ${A}`,T)}var tq=/[^+/0-9A-Za-z-_]/g;function eq(T){if(T=T.split("=")[0],T=T.trim().replace(tq,""),T.length<2)return"";while(T.length%4!==0)T=T+"=";return T}function R4(T,A){A=A||1/0;let Q,J=T.length,$=null,W=[];for(let G=0;G<J;++G){if(Q=T.charCodeAt(G),Q>55295&&Q<57344){if(!$){if(Q>56319){if((A-=3)>-1)W.push(239,191,189);continue}else if(G+1===J){if((A-=3)>-1)W.push(239,191,189);continue}$=Q;continue}if(Q<56320){if((A-=3)>-1)W.push(239,191,189);$=Q;continue}Q=($-55296<<10|Q-56320)+65536}else if($){if((A-=3)>-1)W.push(239,191,189)}if($=null,Q<128){if((A-=1)<0)break;W.push(Q)}else if(Q<2048){if((A-=2)<0)break;W.push(Q>>6|192,Q&63|128)}else if(Q<65536){if((A-=3)<0)break;W.push(Q>>12|224,Q>>6&63|128,Q&63|128)}else if(Q<1114112){if((A-=4)<0)break;W.push(Q>>18|240,Q>>12&63|128,Q>>6&63|128,Q&63|128)}else throw Error("Invalid code point")}return W}function TK(T){let A=[];for(let Q=0;Q<T.length;++Q)A.push(T.charCodeAt(Q)&255);return A}function AK(T,A){let Q,J,$,W=[];for(let G=0;G<T.length;++G){if((A-=2)<0)break;Q=T.charCodeAt(G),J=Q>>8,$=Q%256,W.push($),W.push(J)}return W}function xG(T){return C4.toByteArray(eq(T))}function s2(T,A,Q,J){let $;for($=0;$<J;++$){if($+Q>=A.length||$>=T.length)break;A[$+Q]=T[$]}return $}function IT(T,A){return T instanceof A||T!=null&&T.constructor!=null&&T.constructor.name!=null&&T.constructor.name===A.name}function z4(T){return T!==T}var QK=function(){let A=Array(256);for(let Q=0;Q<16;++Q){let J=Q*16;for(let $=0;$<16;++$)A[J+$]="0123456789abcdef"[Q]+"0123456789abcdef"[$]}return A}();function K8(T){return typeof BigInt>"u"?JK:T}function JK(){throw Error("BigInt not supported")}if(typeof globalThis.Buffer>"u")globalThis.Buffer=F4;var N4=1,gG=2,mG=3,vG=4,yG=5,bG=6,pG=7,lG=8,uG=9,$K=10,WK=-32700,GK=-32603,UK=-32602,YK=-32601,ZK=-32600,XK=-32019,PK=-32018,qK=-32017,KK=-32016,CK=-32015,HK=-32014,VK=-32013,jK=-32012,RK=-32011,DK=-32010,MK=-32009,kK=-32008,zK=-32007,FK=-32006,NK=-32005,IK=-32004,SK=-32003,LK=-32002,wK=-32001,t2=2800000,e2=2800001,EK=2800002,I4=2800003,dG=2800004,cG=2800005,S4=2800006,L4=2800007,T6=2800008,w4=2800009,fG=2800010,rG=2800011,E4=3230000,nG=32300001,O4=3230002,iG=3230003,oG=3230004,B4=3610000,_4=3610001,x4=3610002,h4=3610003,g4=3610004,m4=3610005,aG=3610006,OK=3610007,sG=3611000,BK=3704000,_K=3704001,xK=3704002,hK=3704003,gK=3704004,mK=4128000,vK=4128001,yK=4128002,tG=4615000,bK=4615001,pK=4615002,lK=4615003,uK=4615004,dK=4615005,cK=4615006,fK=4615007,rK=4615008,nK=4615009,iK=4615010,oK=4615011,aK=4615012,sK=4615013,tK=4615014,eK=4615015,TC=4615016,AC=4615017,QC=4615018,JC=4615019,$C=4615020,WC=4615021,GC=4615022,UC=4615023,YC=4615024,ZC=4615025,eG=4615026,XC=4615027,PC=4615028,qC=4615029,KC=4615030,CC=4615031,HC=4615032,VC=4615033,jC=4615034,RC=4615035,DC=4615036,MC=4615037,kC=4615038,zC=4615039,FC=4615040,NC=4615041,IC=4615042,SC=4615043,LC=4615044,wC=4615045,EC=4615046,OC=4615047,BC=4615048,_C=4615049,xC=4615050,hC=4615051,gC=4615052,mC=4615053,vC=4615054,v4=5508000,TU=5508001,AU=5508002,QU=5508003,JU=5508004,$U=5508005,WU=5508006,GU=5508007,UU=5508008,YU=5508009,ZU=5508010,yC=5508011,bC=5607000,pC=5607001,lC=5607002,uC=5607003,dC=5607004,cC=5607005,fC=5607006,rC=5607007,nC=5607008,iC=5607009,oC=5607010,aC=5607011,sC=5607012,tC=5607013,eC=5607014,TH=5607015,AH=5607016,QH=5607017,y4=5663000,A6=5663001,b4=5663002,p4=5663003,l4=5663004,XU=5663005,PU=5663006,qU=5663007,KU=5663008,u4=5663009,JH=5663010,$H=5663011,d4=5663012,WH=5663013,GH=5663014,c4=5663015,f4=5663016,CU=5663017,UH=5663018,YH=5663019,HU=5663020,J2=5663021,VU=5663022,r4=5663023,jU=7050000,ZH=7050001,XH=7050002,PH=7050003,qH=7050004,KH=7050005,CH=7050006,HH=7050007,VH=7050008,jH=7050009,RH=7050010,DH=7050011,MH=7050012,kH=7050013,zH=7050014,FH=7050015,NH=7050016,IH=7050017,SH=7050018,LH=7050019,wH=7050020,EH=7050021,OH=7050022,BH=7050023,_H=7050024,xH=7050025,hH=7050026,gH=7050027,mH=7050028,vH=7050029,RU=7050030,DU=7050031,yH=7050032,bH=7050033,pH=7050034,MU=7050035,lH=7050036,uH=7618000,dH=7618001,cH=7618002,fH=7618003,rH=7618004,nH=7618005,iH=7618006,oH=7618007,aH=7618008,sH=7618009,Q6=8078000,$2=8078001,n4=8078002,i4=8078003,J6=8078004,$6=8078005,W6=8078006,l8=8078007,G6=8078008,U6=8078009,Y6=8078010,u8=8078011,C8=8078012,o4=8078013,a4=8078014,Z6=8078015,X6=8078016,MA=8078017,P6=8078018,tH=8078019,s4=8078020,t4=8078021,q6=8078022,e4=8078023,eH=8100000,T7=8100001,A7=8100002,Q7=8100003,J7=8190000,$7=8190001,W7=8190002,G7=8190003,U7=8190004,Y7=8500000,Z7=8500001,X7=8500002,P7=8500003,q7=8500004,K7=8500005,C7=8500006,H7=9900000,V7=9900001,j7=9900002,TJ=9900003,R7=9900004,D7=9900005,M7=9900006;var k7={[E4]:"Account not found at address: $address",[oG]:"Not all accounts were decoded. Encoded accounts found at addresses: $addresses.",[iG]:"Expected decoded account at address: $address",[O4]:"Failed to decode account data at address: $address",[nG]:"Accounts not found at addresses: $addresses",[w4]:"Unable to find a viable program address bump seed.",[EK]:"$putativeAddress is not a base58-encoded address.",[t2]:"Expected base58 encoded address to decode to a byte array of length 32. Actual length: $actualLength.",[I4]:"The `CryptoKey` must be an `Ed25519` public key.",[rG]:"$putativeOffCurveAddress is not a base58-encoded off-curve address.",[T6]:"Invalid seeds; point must fall off the Ed25519 curve.",[dG]:"Expected given program derived address to have the following format: [Address, ProgramDerivedAddressBump].",[S4]:"A maximum of $maxSeeds seeds, including the bump seed, may be supplied when creating an address. Received: $actual.",[L4]:"The seed at index $index with length $actual exceeds the maximum length of $maxSeedLength bytes.",[cG]:"Expected program derived address bump to be in the range [0, 255], got: $bump.",[fG]:"Program address cannot end with PDA marker.",[e2]:"Expected base58-encoded address string of length in the range [32, 44]. Actual length: $actualLength.",[vG]:"Expected base58-encoded blockash string of length in the range [32, 44]. Actual length: $actualLength.",[N4]:"The network has progressed past the last block for which this transaction could have been committed.",[Q6]:"Codec [$codecDescription] cannot decode empty byte arrays.",[q6]:"Enum codec cannot use lexical values [$stringValues] as discriminators. Either remove all lexical values or set `useValuesAsDiscriminators` to `false`.",[s4]:"Sentinel [$hexSentinel] must not be present in encoded bytes [$hexEncodedBytes].",[$6]:"Encoder and decoder must have the same fixed size, got [$encoderFixedSize] and [$decoderFixedSize].",[W6]:"Encoder and decoder must have the same max size, got [$encoderMaxSize] and [$decoderMaxSize].",[J6]:"Encoder and decoder must either both be fixed-size or variable-size.",[G6]:"Enum discriminator out of range. Expected a number in [$formattedValidDiscriminators], got $discriminator.",[n4]:"Expected a fixed-size codec, got a variable-size one.",[o4]:"Codec [$codecDescription] expected a positive byte length, got $bytesLength.",[i4]:"Expected a variable-size codec, got a fixed-size one.",[tH]:"Codec [$codecDescription] expected zero-value [$hexZeroValue] to have the same size as the provided fixed-size item [$expectedSize bytes].",[$2]:"Codec [$codecDescription] expected $expected bytes, got $bytesLength.",[P6]:"Expected byte array constant [$hexConstant] to be present in data [$hexData] at offset [$offset].",[U6]:"Invalid discriminated union variant. Expected one of [$variants], got $value.",[Y6]:"Invalid enum variant. Expected one of [$stringValues] or a number in [$formattedNumericalValues], got $variant.",[Z6]:"Invalid literal union variant. Expected one of [$variants], got $value.",[l8]:"Expected [$codecDescription] to have $expected items, got $actual.",[C8]:"Invalid value $value for base $base with alphabet $alphabet.",[X6]:"Literal union discriminator out of range. Expected a number between $minRange and $maxRange, got $discriminator.",[u8]:"Codec [$codecDescription] expected number to be in the range [$min, $max], got $value.",[a4]:"Codec [$codecDescription] expected offset to be in the range [0, $bytesLength], got $offset.",[t4]:"Expected sentinel [$hexSentinel] to be present in decoded bytes [$hexDecodedBytes].",[MA]:"Union variant out of range. Expected an index between $minRange and $maxRange, got $variant.",[e4]:"This decoder expected a byte array of exactly $expectedLength bytes, but $numExcessBytes unexpected excess bytes remained after decoding. Are you sure that you have chosen the correct decoder for this data?",[sG]:"No random values implementation could be found.",[nK]:"instruction requires an uninitialized account",[UC]:"instruction tries to borrow reference for an account which is already borrowed",[YC]:"instruction left account with an outstanding borrowed reference",[WC]:"program other than the account's owner changed the size of the account data",[dK]:"account data too small for instruction",[GC]:"instruction expected an executable account",[EC]:"An account does not have enough lamports to be rent-exempt",[BC]:"Program arithmetic overflowed",[wC]:"Failed to serialize or deserialize account data: $encodedData",[vC]:"Builtin programs must consume compute units",[HC]:"Cross-program invocation call depth too deep",[kC]:"Computational budget exceeded",[eG]:"custom program error: #$code",[AC]:"instruction contains duplicate accounts",[ZC]:"instruction modifications of multiply-passed account differ",[KC]:"executable accounts must be rent exempt",[PC]:"instruction changed executable accounts data",[qC]:"instruction changed the balance of an executable account",[QC]:"instruction changed executable bit of an account",[tK]:"instruction modified data of an account it does not own",[sK]:"instruction spent from the balance of an account it does not own",[bK]:"generic instruction error",[xC]:"Provided owner is not allowed",[SC]:"Account is immutable",[LC]:"Incorrect authority provided",[fK]:"incorrect program id for instruction",[cK]:"insufficient funds for instruction",[uK]:"invalid account data for instruction",[OC]:"Invalid account owner",[pK]:"invalid program argument",[XC]:"program returned invalid error code",[lK]:"invalid instruction data",[MC]:"Failed to reallocate account data",[DC]:"Provided seeds do not result in a valid address",[hC]:"Accounts data allocations exceeded the maximum allowed per transaction",[gC]:"Max accounts exceeded",[mC]:"Max instruction trace length exceeded",[RC]:"Length of the seed is too long for address generation",[VC]:"An account required by the instruction is missing",[rK]:"missing required signature for instruction",[aK]:"instruction illegally modified the program id of an account",[$C]:"insufficient account keys for instruction",[zC]:"Cross-program invocation with unauthorized signer or writable account",[FC]:"Failed to create program execution environment",[IC]:"Program failed to compile",[NC]:"Program failed to complete",[TC]:"instruction modified data of a read-only account",[eK]:"instruction changed the balance of a read-only account",[jC]:"Cross-program invocation reentrancy not allowed for this instruction",[JC]:"instruction modified rent epoch of an account",[oK]:"sum of account balances before and after instruction do not match",[iK]:"instruction requires an initialized account",[tG]:"",[CC]:"Unsupported program id",[_C]:"Unsupported sysvar",[D7]:"Invalid instruction plan kind: $kind.",[cH]:"The provided instruction plan is empty.",[nH]:"No failed transaction plan result was found in the provided transaction plan result.",[rH]:"This transaction plan executor does not support non-divisible sequential plans. To support them, you may create your own executor such that multi-transaction atomicity is preserved — e.g. by targetting RPCs that support transaction bundles.",[fH]:"The provided transaction plan failed to execute. See the `transactionPlanResult` attribute for more details. Note that the `cause` property is deprecated, and a future version will not set it.",[uH]:"The provided message has insufficient capacity to accommodate the next instruction(s) in this plan. Expected at least $numBytesRequired free byte(s), got $numFreeBytes byte(s).",[M7]:"Invalid transaction plan kind: $kind.",[dH]:"No more instructions to pack; the message packer has completed the instruction plan.",[iH]:"Unexpected instruction plan. Expected $expectedKind plan, got $actualKind plan.",[oH]:"Unexpected transaction plan. Expected $expectedKind plan, got $actualKind plan.",[aH]:"Unexpected transaction plan result. Expected $expectedKind plan, got $actualKind plan.",[sH]:"Expected a successful transaction plan result. I.e. there is at least one failed or cancelled transaction in the plan.",[mK]:"The instruction does not have any accounts.",[vK]:"The instruction does not have any data.",[yK]:"Expected instruction to have progress address $expectedProgramAddress, got $actualProgramAddress.",[yG]:"Expected base58 encoded blockhash to decode to a byte array of length 32. Actual length: $actualLength.",[gG]:"The nonce `$expectedNonceValue` is no longer valid. It has advanced to `$actualNonceValue`",[j7]:"Invariant violation: Found no abortable iterable cache entry for key `$cacheKey`. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[R7]:"Invariant violation: This data publisher does not publish to the channel named `$channelName`. Supported channels include $supportedChannelNames.",[V7]:"Invariant violation: WebSocket message iterator state is corrupt; iterated without first resolving existing message promise. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[H7]:"Invariant violation: WebSocket message iterator is missing state storage. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[TJ]:"Invariant violation: Switch statement non-exhaustive. Received unexpected value `$unexpectedValue`. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[GK]:"JSON-RPC error: Internal JSON-RPC error ($__serverMessage)",[UK]:"JSON-RPC error: Invalid method parameter(s) ($__serverMessage)",[ZK]:"JSON-RPC error: The JSON sent is not a valid `Request` object ($__serverMessage)",[YK]:"JSON-RPC error: The method does not exist / is not available ($__serverMessage)",[WK]:"JSON-RPC error: An error occurred on the server while parsing the JSON text ($__serverMessage)",[jK]:"$__serverMessage",[wK]:"$__serverMessage",[IK]:"$__serverMessage",[HK]:"$__serverMessage",[qK]:"Epoch rewards period still active at slot $slot",[DK]:"$__serverMessage",[MK]:"$__serverMessage",[XK]:"Failed to query long-term storage; please try again",[KK]:"Minimum context slot has not been reached",[NK]:"Node is unhealthy; behind by $numSlotsBehind slots",[kK]:"No snapshot",[LK]:"Transaction simulation failed",[PK]:"Rewards cannot be found because slot $slot is not the epoch boundary. This may be due to gap in the queried node's local ledger or long-term storage",[zK]:"$__serverMessage",[RK]:"Transaction history is not available from this node",[FK]:"$__serverMessage",[VK]:"Transaction signature length mismatch",[SK]:"Transaction signature verification failure",[CK]:"$__serverMessage",[BK]:"Key pair bytes must be of length 64, got $byteLength.",[_K]:"Expected private key bytes with length 32. Actual length: $actualLength.",[xK]:"Expected base58-encoded signature to decode to a byte array of length 64. Actual length: $actualLength.",[gK]:"The provided private key does not match the provided public key.",[hK]:"Expected base58-encoded signature string of length in the range [64, 88]. Actual length: $actualLength.",[bG]:"Lamports value must be in the range [0, 2e64-1]",[pG]:"`$value` cannot be parsed as a `BigInt`",[$K]:"$message",[lG]:"`$value` cannot be parsed as a `Number`",[mG]:"No nonce account could be found at address `$nonceAccountAddress`",[uC]:"Expected base58 encoded application domain to decode to a byte array of length 32. Actual length: $actualLength.",[tC]:"Attempted to sign an offchain message with an address that is not a signer for it",[lC]:"Expected base58-encoded application domain string of length in the range [32, 44]. Actual length: $actualLength.",[sC]:"The signer addresses in this offchain message envelope do not match the list of required signers in the message preamble. These unexpected signers were present in the envelope: `[$unexpectedSigners]`. These required signers were missing from the envelope `[$missingSigners]`.",[bC]:"The message body provided has a byte-length of $actualBytes. The maximum allowable byte-length is $maxBytes",[rC]:"Expected message format $expectedMessageFormat, got $actualMessageFormat",[nC]:"The message length specified in the message preamble is $specifiedLength bytes. The actual length of the message is $actualLength bytes.",[iC]:"Offchain message content must be non-empty",[cC]:"Offchain message must specify the address of at least one required signer",[oC]:"Offchain message envelope must reserve space for at least one signature",[dC]:"The offchain message preamble specifies $numRequiredSignatures required signature(s), got $signaturesLength.",[TH]:"The signatories of this offchain message must be listed in lexicographical order",[AH]:"An address must be listed no more than once among the signatories of an offchain message",[aC]:"Offchain message is missing signatures for addresses: $addresses.",[QH]:"Offchain message signature verification failed. Signature mismatch for required signatories [$signatoriesWithInvalidSignatures]. Missing signatures for signatories [$signatoriesWithMissingSignatures]",[pC]:"The message body provided contains characters whose codes fall outside the allowed range. In order to ensure clear-signing compatiblity with hardware wallets, the message may only contain line feeds and characters in the range [\\x20-\\x7e].",[eC]:"Expected offchain message version $expectedVersion. Got $actualVersion.",[fC]:"This version of Kit does not support decoding offchain messages with version $unsupportedVersion. The current max supported version is 0.",[C7]:"The provided account could not be identified as an account from the $programName program.",[X7]:"The provided instruction could not be identified as an instruction from the $programName program.",[Y7]:"The provided instruction is missing some accounts. Expected at least $expectedAccountMetas account(s), got $actualAccountMetas.",[q7]:"Expected resolved instruction input '$inputName' to be non-null.",[P7]:"Expected resolved instruction input '$inputName' to be of type `$expectedType`.",[K7]:"Unrecognized account type '$accountType' for the $programName program.",[Z7]:"Unrecognized instruction type '$instructionType' for the $programName program.",[J7]:"The notification name must end in 'Notifications' and the API must supply a subscription plan creator function for the notification '$notificationName'.",[W7]:"WebSocket was closed before payload could be added to the send buffer",[G7]:"WebSocket connection closed",[U7]:"WebSocket failed to connect",[$7]:"Failed to obtain a subscription id from the server",[Q7]:"Could not find an API plan for RPC method: `$method`",[eH]:"The $argumentLabel argument to the `$methodName` RPC method$optionalPathLabel was `$value`. This number is unsafe for use with the Solana JSON-RPC because it exceeds `Number.MAX_SAFE_INTEGER`.",[A7]:"HTTP error ($statusCode): $message",[T7]:"HTTP header(s) forbidden: $headers. Learn more at https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name.",[v4]:"Multiple distinct signers were identified for address `$address`. Please ensure that you are using the same signer instance for each address.",[TU]:"The provided value does not implement the `KeyPairSigner` interface",[QU]:"The provided value does not implement the `MessageModifyingSigner` interface",[JU]:"The provided value does not implement the `MessagePartialSigner` interface",[AU]:"The provided value does not implement any of the `MessageSigner` interfaces",[WU]:"The provided value does not implement the `TransactionModifyingSigner` interface",[GU]:"The provided value does not implement the `TransactionPartialSigner` interface",[UU]:"The provided value does not implement the `TransactionSendingSigner` interface",[$U]:"The provided value does not implement any of the `TransactionSigner` interfaces",[YU]:"More than one `TransactionSendingSigner` was identified.",[ZU]:"No `TransactionSendingSigner` was identified. Please provide a valid `TransactionWithSingleSendingSigner` transaction.",[yC]:"Wallet account signers do not support signing multiple messages/transactions in a single operation",[OK]:"Cannot export a non-extractable key.",[_4]:"No digest implementation could be found.",[B4]:"Cryptographic operations are only allowed in secure browser contexts. Read more here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts.",[x4]:`This runtime does not support the generation of Ed25519 key pairs.
|
|
7
7
|
|
|
8
8
|
Install @solana/webcrypto-ed25519-polyfill and call its \`install\` function before generating keys in environments that do not support Ed25519.
|
|
9
9
|
|
|
10
|
-
For a list of runtimes that currently support Ed25519 operations, visit https://github.com/WICG/webcrypto-secure-curves/issues/20.`,[O4]:"No signature verification implementation could be found.",[B4]:"No key generation implementation could be found.",[_4]:"No signing implementation could be found.",[nG]:"No key export implementation could be found.",[bG]:"Timestamp value must be in the range [-(2n ** 63n), (2n ** 63n) - 1]. `$value` given",[tC]:"Transaction processing left an account with an outstanding borrowed reference",[vC]:"Account in use",[yC]:"Account loaded twice",[bC]:"Attempt to debit an account but found no record of a prior credit.",[$H]:"Transaction loads an address table account that doesn't exist",[dC]:"This transaction has already been processed",[cC]:"Blockhash not found",[fC]:"Loader call chain is too deep",[sC]:"Transactions are currently disabled due to cluster maintenance",[HU]:"Transaction contains a duplicate instruction ($index) that is not allowed",[lC]:"Insufficient funds for fee",[VU]:"Transaction results in an account ($accountIndex) with insufficient funds for rent",[uC]:"This account may not be used to pay transaction fees",[nC]:"Transaction contains an invalid account reference",[UH]:"Transaction loads an address table account with invalid data",[YH]:"Transaction address table lookup uses an invalid index",[GH]:"Transaction loads an address table account with an invalid owner",[KH]:"LoadedAccountsDataSizeLimit set for transaction must be greater than 0.",[oC]:"This program may not be used for executing instructions",[ZH]:"Transaction leaves an account with a lower balance than rent-exempt minimum",[AH]:"Transaction loads a writable account that cannot be written",[qH]:"Transaction exceeded max loaded accounts data size cap",[rC]:"Transaction requires a fee but has no signature present",[pC]:"Attempt to load a program that does not exist",[jU]:"Execution of the program referenced by account at index $accountIndex is temporarily restricted.",[CH]:"ResanitizationNeeded",[aC]:"Transaction failed to sanitize accounts offsets correctly",[iC]:"Transaction did not pass signature verification",[WH]:"Transaction locked too many accounts",[HH]:"Sum of account balances before and after transaction do not match",[CU]:"The transaction failed with the error `$errorName`",[TH]:"Transaction version is unsupported",[JH]:"Transaction would exceed account data limit within the block",[PH]:"Transaction would exceed total account data limit",[QH]:"Transaction would exceed max account limit within the block",[eC]:"Transaction would exceed max Block Cost Limit",[XH]:"Transaction would exceed max Vote Cost Limit",[p4]:"Attempted to sign a transaction with an address that is not a signer for it",[BC]:"Transaction is missing an address at index: $index.",[l4]:"Transaction has no expected signers therefore it cannot be encoded",[qU]:"Transaction size $transactionSize exceeds limit of $transactionSizeLimit bytes",[g4]:"Transaction does not have a blockhash lifetime",[m4]:"Transaction is not a durable nonce transaction",[UU]:"Contents of these address lookup tables unknown: $lookupTableAddresses",[YU]:"Lookup of address at index $highestRequestedIndex failed for lookup table `$lookupTableAddress`. Highest known index is $highestKnownIndex. The lookup table may have been extended since its contents were retrieved",[XU]:"No fee payer set in CompiledTransaction",[ZU]:"Could not find program address at index $index",[gC]:"Failed to estimate the compute unit consumption for this transaction message. This is likely because simulating the transaction failed. Inspect the `cause` property of this error to learn more",[mC]:"Transaction failed when it was simulated in order to estimate the compute unit consumption. The compute unit estimate provided is for a transaction that failed when simulated and may not be representative of the compute units this transaction would consume if successful. Inspect the `cause` property of this error to learn more",[_C]:"Transaction is missing a fee payer.",[b4]:"Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer.",[hC]:"Transaction first instruction is not advance nonce account instruction.",[xC]:"Transaction with no instructions cannot be durable nonce transaction.",[h4]:"This transaction includes an address (`$programAddress`) which is both invoked and set as the fee payer. Program addresses may not pay fees",[s2]:"This transaction includes an address (`$programAddress`) which is both invoked and marked writable. Program addresses may not be writable",[PU]:"The transaction message expected the transaction to have $numRequiredSignatures signatures, got $signaturesLength.",[y4]:"Transaction is missing signatures for addresses: $addresses.",[v4]:"Transaction version must be in the range [0, 127]. `$actualVersion` given",[u4]:"This version of Kit does not support decoding transactions with version $unsupportedVersion. The current max supported version is 0.",[KU]:"The transaction has a durable nonce lifetime (with nonce `$nonce`), but the nonce account address is in a lookup table. The lifetime constraint cannot be constructed without fetching the lookup tables for the transaction."},cT="i",IT="t";function vH(T,A={}){let Q=mH[T];if(Q.length===0)return"";let J;function W(G){if(J[IT]===2){let Y=Q.slice(J[cT]+1,G);$.push(Y in A?`${A[Y]}`:`$${Y}`)}else if(J[IT]===1)$.push(Q.slice(J[cT],G))}let $=[];return Q.split("").forEach((G,Y)=>{if(Y===0){J={[cT]:0,[IT]:Q[0]==="\\"?0:Q[0]==="$"?2:1};return}let Z;switch(J[IT]){case 0:Z={[cT]:Y,[IT]:1};break;case 1:if(G==="\\")Z={[cT]:Y,[IT]:0};else if(G==="$")Z={[cT]:Y,[IT]:2};break;case 2:if(G==="\\")Z={[cT]:Y,[IT]:0};else if(G==="$")Z={[cT]:Y,[IT]:2};else if(!G.match(/\w/))Z={[cT]:Y,[IT]:1};break}if(Z){if(J!==Z)W(Y);J=Z}}),W(),$.join("")}function yH(T,A={}){return vH(T,A)}function s4(T,A){if(T instanceof Error&&T.name==="SolanaError"){if(A!==void 0)return T.context.__code===A;return!0}return!1}var e=class extends Error{cause=this.cause;context;constructor(...[T,A]){let Q,J;if(A)Object.entries(Object.getOwnPropertyDescriptors(A)).forEach(([$,G])=>{if($==="cause")J={cause:G.value};else{if(Q===void 0)Q={};Object.defineProperty(Q,$,G)}});let W=yH(T,Q);super(W,J);this.context=Q===void 0?{}:Q,this.context.__code=T,this.name="SolanaError"}};function bH(...T){if("captureStackTrace"in Error&&typeof Error.captureStackTrace==="function")Error.captureStackTrace(...T)}function RU({errorCodeBaseOffset:T,getErrorContext:A,orderedErrorNames:Q,rpcEnumError:J},W){let $,G;if(typeof J==="string")$=J;else $=Object.keys(J)[0],G=J[$];let Y=Q.indexOf($),Z=T+Y,C=A(Z,$,G),K=new e(Z,C);return bH(K,W),K}var pH=["GenericError","InvalidArgument","InvalidInstructionData","InvalidAccountData","AccountDataTooSmall","InsufficientFunds","IncorrectProgramId","MissingRequiredSignature","AccountAlreadyInitialized","UninitializedAccount","UnbalancedInstruction","ModifiedProgramId","ExternalAccountLamportSpend","ExternalAccountDataModified","ReadonlyLamportChange","ReadonlyDataModified","DuplicateAccountIndex","ExecutableModified","RentEpochModified","NotEnoughAccountKeys","AccountDataSizeChanged","AccountNotExecutable","AccountBorrowFailed","AccountBorrowOutstanding","DuplicateAccountOutOfSync","Custom","InvalidError","ExecutableDataModified","ExecutableLamportChange","ExecutableAccountNotRentExempt","UnsupportedProgramId","CallDepth","MissingAccount","ReentrancyNotAllowed","MaxSeedLengthExceeded","InvalidSeeds","InvalidRealloc","ComputationalBudgetExceeded","PrivilegeEscalation","ProgramEnvironmentSetupFailure","ProgramFailedToComplete","ProgramFailedToCompile","Immutable","IncorrectAuthority","BorshIoError","AccountNotRentExempt","InvalidAccountOwner","ArithmeticOverflow","UnsupportedSysvar","IllegalOwner","MaxAccountsDataAllocationsExceeded","MaxAccountsExceeded","MaxInstructionTraceLengthExceeded","BuiltinProgramsMustConsumeComputeUnits"];function DU(T,A){let Q=Number(T);return RU({errorCodeBaseOffset:4615001,getErrorContext(J,W,$){if(J===oG)return{errorName:W,index:Q,...$!==void 0?{instructionErrorContext:$}:null};else if(J===aG)return{code:Number($),index:Q};return{index:Q}},orderedErrorNames:pH,rpcEnumError:A},DU)}var lH=["AccountInUse","AccountLoadedTwice","AccountNotFound","ProgramAccountNotFound","InsufficientFundsForFee","InvalidAccountForFee","AlreadyProcessed","BlockhashNotFound","CallChainTooDeep","MissingSignatureForFee","InvalidAccountIndex","SignatureFailure","InvalidProgramForExecution","SanitizeFailure","ClusterMaintenance","AccountBorrowOutstanding","WouldExceedMaxBlockCostLimit","UnsupportedVersion","InvalidWritableAccount","WouldExceedMaxAccountCostLimit","WouldExceedAccountDataBlockLimit","TooManyAccountLocks","AddressLookupTableNotFound","InvalidAddressLookupTableOwner","InvalidAddressLookupTableData","InvalidAddressLookupTableIndex","InvalidRentPayingAccount","WouldExceedMaxVoteCostLimit","WouldExceedAccountDataTotalLimit","DuplicateInstruction","InsufficientFundsForRent","MaxLoadedAccountsDataSizeExceeded","InvalidLoadedAccountsDataSizeLimit","ResanitizationNeeded","ProgramExecutionTemporarilyRestricted","UnbalancedTransaction"];function Z6(T){if(typeof T==="object"&&"InstructionError"in T)return DU(...T.InstructionError);return RU({errorCodeBaseOffset:7050001,getErrorContext(A,Q,J){if(A===CU)return{errorName:Q,...J!==void 0?{transactionErrorContext:J}:null};else if(A===HU)return{index:Number(J)};else if(A===VU||A===jU)return{accountIndex:Number(J.account_index)}},orderedErrorNames:lH,rpcEnumError:T},Z6)}function uH(T,A){return"fixedSize"in A?A.fixedSize:A.getSizeFromValue(T)}function MU(T){return Object.freeze({...T,encode:(A)=>{let Q=new Uint8Array(uH(A,T));return T.write(A,Q,0),Q}})}var kU="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",zU=()=>{return MU({getSizeFromValue:(T)=>{try{return atob(T).length}catch{throw new e(C8,{alphabet:kU,base:64,value:T})}},write(T,A,Q){try{let J=atob(T).split("").map((W)=>W.charCodeAt(0));return A.set(J,Q),J.length+Q}catch{throw new e(C8,{alphabet:kU,base:64,value:T})}}})};var{TextDecoder:zS,TextEncoder:FS}=globalThis;function H8(T,A){try{if("exists"in T&&!T.exists)return T;return Object.freeze({...T,data:A.decode(T.data)})}catch{throw new e(S4,{address:T.address})}}function dH(T,A){if(!A)return Object.freeze({address:T,exists:!1});let Q=zU().encode(A.data[0]);return Object.freeze({...cH(A),address:T,data:Q,exists:!0})}function cH(T){return Object.freeze({executable:T.executable,lamports:T.lamports,programAddress:T.owner,space:T.space})}async function V8(T,A,Q={}){let{abortSignal:J,...W}=Q,$=await T.getAccountInfo(A,{...W,encoding:"base64"}).send({abortSignal:J});return dH(A,$.value)}function j8(T){if(!T.exists)throw new e(I4,{address:T.address})}function fH(T,A){if(T.length>=A)return T;let Q=new Uint8Array(A).fill(0);return Q.set(T),Q}var rH=(T,A)=>fH(T.length<=A?T:T.slice(0,A),A);function nH(T,A){return"fixedSize"in A?A.fixedSize:A.getSizeFromValue(T)}function X6(T){return Object.freeze({...T,encode:(A)=>{let Q=new Uint8Array(nH(A,T));return T.write(A,Q,0),Q}})}function t4(T){return Object.freeze({...T,decode:(A,Q=0)=>T.read(A,Q)[0]})}function R8(T){return"fixedSize"in T&&typeof T.fixedSize==="number"}function iH(T){return!R8(T)}function e4(T,A){if(R8(T)!==R8(A))throw new e(e2);if(R8(T)&&R8(A)&&T.fixedSize!==A.fixedSize)throw new e(T6,{decoderFixedSize:A.fixedSize,encoderFixedSize:T.fixedSize});if(!R8(T)&&!R8(A)&&T.maxSize!==A.maxSize)throw new e(A6,{decoderMaxSize:A.maxSize,encoderMaxSize:T.maxSize});return{...A,...T,decode:A.decode,encode:T.encode,read:A.read,write:T.write}}function oH(T,A,Q,J=0){let W=Q.length-J;if(W<A)throw new e(T2,{bytesLength:W,codecDescription:T,expected:A})}function FU(T,A){return X6({fixedSize:A,write:(Q,J,W)=>{let $=T.encode(Q),G=$.length>A?$.slice(0,A):$;return J.set(G,W),W+A}})}function NU(T,A){return t4({fixedSize:A,read:(Q,J)=>{if(oH("fixCodecSize",A,Q,J),J>0||Q.length>A)Q=Q.slice(J,J+A);if(R8(T))Q=rH(Q,T.fixedSize);let[W]=T.read(Q,0);return[W,J+A]}})}function IU(T,A){return X6({...iH(T)?{...T,getSizeFromValue:(Q)=>T.getSizeFromValue(A(Q))}:T,write:(Q,J,W)=>T.write(A(Q),J,W)})}function aH(T,A,Q=A){if(!A.match(new RegExp(`^[${T}]*$`)))throw new e(C8,{alphabet:T,base:T.length,value:Q})}var sH=(T)=>{return X6({getSizeFromValue:(A)=>{let[Q,J]=SU(A,T[0]);if(!J)return A.length;let W=LU(J,T);return Q.length+Math.ceil(W.toString(16).length/2)},write(A,Q,J){if(aH(T,A),A==="")return J;let[W,$]=SU(A,T[0]);if(!$)return Q.set(new Uint8Array(W.length).fill(0),J),J+W.length;let G=LU($,T),Y=[];while(G>0n)Y.unshift(Number(G%256n)),G/=256n;let Z=[...Array(W.length).fill(0),...Y];return Q.set(Z,J),J+Z.length}})},tH=(T)=>{return t4({read(A,Q){let J=Q===0?A:A.slice(Q);if(J.length===0)return["",0];let W=J.findIndex((Z)=>Z!==0);W=W===-1?J.length:W;let $=T[0].repeat(W);if(W===J.length)return[$,A.length];let G=J.slice(W).reduce((Z,C)=>Z*256n+BigInt(C),0n),Y=eH(G,T);return[$+Y,A.length]}})};function SU(T,A){let[Q,J]=T.split(new RegExp(`((?!${A}).*)`));return[Q,J]}function LU(T,A){let Q=BigInt(A.length),J=0n;for(let W of T)J*=Q,J+=BigInt(A.indexOf(W));return J}function eH(T,A){let Q=BigInt(A.length),J=[];while(T>0n)J.unshift(A[Number(T%Q)]),T/=Q;return J.join("")}var wU="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",EU=()=>sH(wU),OU=()=>tH(wU);var{TextDecoder:xS,TextEncoder:hS}=globalThis;function P6(){if(!globalThis.isSecureContext)throw new e(L4)}var d8;async function T7(T){if(d8===void 0)d8=new Promise((A)=>{T.generateKey("Ed25519",!1,["sign","verify"]).then(()=>{A(d8=!0)}).catch(()=>{A(d8=!1)})});if(typeof d8==="boolean")return d8;else return await d8}function BU(){if(P6(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.digest!=="function")throw new e(w4)}async function _U(){if(P6(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.generateKey!=="function")throw new e(B4);if(!await T7(globalThis.crypto.subtle))throw new e(E4)}function TJ(){if(P6(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.exportKey!=="function")throw new e(O4)}function xU(){if(P6(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.sign!=="function")throw new e(_4)}var AJ,QJ;function JJ(){if(!AJ)AJ=EU();return AJ}function A7(){if(!QJ)QJ=OU();return QJ}function q6(T){if(T.length<32||T.length>44)return!1;let A=JJ();try{return A.encode(T).byteLength===32}catch{return!1}}function WJ(T){if(T.length<32||T.length>44)throw new e(o2,{actualLength:T.length});let J=JJ().encode(T).byteLength;if(J!==32)throw new e(i2,{actualLength:J})}function _(T){return WJ(T),T}function C0(){return IU(FU(JJ(),32),(T)=>_(T))}function Y0(){return NU(A7(),32)}function Q7(){return e4(C0(),Y0())}function K6(){return new Intl.Collator("en",{caseFirst:"lower",ignorePunctuation:!1,localeMatcher:"best fit",numeric:!1,sensitivity:"variant",usage:"sort"}).compare}var J7=37095705934669439343138083508754565189542113879843219016388785533085940283555n,y0=57896044618658097711785492504343953926634992332820282019728792003956564819949n,hU=19681161376707505956807079304988542015446066515923890162744021073123829784752n;function XT(T){let A=T%y0;return A>=0n?A:y0+A}function ST(T,A){let Q=T;while(A-- >0n)Q*=Q,Q%=y0;return Q}function W7(T){let Q=T*T%y0*T%y0,J=ST(Q,2n)*Q%y0,W=ST(J,1n)*T%y0,$=ST(W,5n)*W%y0,G=ST($,10n)*$%y0,Y=ST(G,20n)*G%y0,Z=ST(Y,40n)*Y%y0,C=ST(Z,80n)*Z%y0,K=ST(C,80n)*Z%y0,V=ST(K,10n)*$%y0;return ST(V,2n)*T%y0}function $7(T,A){let Q=XT(A*A*A),J=XT(Q*Q*A),W=W7(T*J),$=XT(T*Q*W),G=XT(A*$*$),Y=$,Z=XT($*hU),C=G===T,K=G===XT(-T),V=G===XT(-T*hU);if(C)$=Y;if(K||V)$=Z;if((XT($)&1n)===1n)$=XT(-$);if(!C&&!K)return null;return $}function G7(T,A){let Q=XT(T*T),J=XT(Q-1n),W=XT(J7*Q+1n),$=$7(J,W);if($===null)return!1;let G=(A&128)!==0;if($===0n&&G)return!1;return!0}function U7(T){let A=T.toString(16);if(A.length===1)return`0${A}`;else return A}function Y7(T){let Q=`0x${T.reduce((J,W,$)=>`${U7($===31?W&-129:W)}${J}`,"")}`;return BigInt(Q)}function Z7(T){if(T.byteLength!==32)return!1;let A=Y7(T);return G7(A,T[31])}var gU=32,mU=16,X7=[80,114,111,103,114,97,109,68,101,114,105,118,101,100,65,100,100,114,101,115,115];async function P7({programAddress:T,seeds:A}){if(BU(),A.length>mU)throw new e(z4,{actual:A.length,maxSeeds:mU});let Q,J=A.reduce((Z,C,K)=>{let V=typeof C==="string"?(Q||=new TextEncoder).encode(C):C;if(V.byteLength>gU)throw new e(F4,{actual:V.byteLength,index:K,maxSeedLength:gU});return Z.push(...V),Z},[]),W=Q7(),$=W.encode(T),G=await crypto.subtle.digest("SHA-256",new Uint8Array([...J,...$,...X7])),Y=new Uint8Array(G);if(Z7(Y))throw new e(a2);return W.decode(Y)}async function R1({programAddress:T,seeds:A}){let Q=255;while(Q>0)try{return[await P7({programAddress:T,seeds:[...A,new Uint8Array([Q])]}),Q]}catch(J){if(s4(J,a2))Q--;else throw J}throw new e(N4)}async function C6(T){if(TJ(),T.type!=="public"||T.algorithm.name!=="Ed25519")throw new e(k4);let A=await crypto.subtle.exportKey("raw",T);return Y0().decode(new Uint8Array(A))}function q7(T,A){if(T.length>=A)return T;let Q=new Uint8Array(A).fill(0);return Q.set(T),Q}var K7=(T,A)=>q7(T.length<=A?T:T.slice(0,A),A);function MA(T,A){return"fixedSize"in A?A.fixedSize:A.getSizeFromValue(T)}function PT(T){return Object.freeze({...T,encode:(A)=>{let Q=new Uint8Array(MA(A,T));return T.write(A,Q,0),Q}})}function rT(T){return Object.freeze({...T,decode:(A,Q=0)=>T.read(A,Q)[0]})}function fT(T){return"fixedSize"in T&&typeof T.fixedSize==="number"}function C7(T){return!fT(T)}function vU(T,A,Q=0){if(A.length-Q<=0)throw new e(t2,{codecDescription:T})}function H6(T,A,Q,J=0){let W=Q.length-J;if(W<A)throw new e(T2,{bytesLength:W,codecDescription:T,expected:A})}function V6(T,A){let Q=(G,Y,Z)=>{let C=T.encode(G);return Z=A.write(C.length,Y,Z),Y.set(C,Z),Z+C.length};if(fT(A)&&fT(T))return PT({...T,fixedSize:A.fixedSize+T.fixedSize,write:Q});let J=fT(A)?A.fixedSize:A.maxSize??null,W=fT(T)?T.fixedSize:T.maxSize??null,$=J!==null&&W!==null?J+W:null;return PT({...T,...$!==null?{maxSize:$}:{},getSizeFromValue:(G)=>{let Y=MA(G,T);return MA(Y,A)+Y},write:Q})}function H0(T,A){return PT({fixedSize:A,write:(Q,J,W)=>{let $=T.encode(Q),G=$.length>A?$.slice(0,A):$;return J.set(G,W),W+A}})}function E0(T,A){return rT({fixedSize:A,read:(Q,J)=>{if(H6("fixCodecSize",A,Q,J),J>0||Q.length>A)Q=Q.slice(J,J+A);if(fT(T))Q=K7(Q,T.fixedSize);let[W]=T.read(Q,0);return[W,J+A]}})}function Z0(T,A){return PT({...C7(T)?{...T,getSizeFromValue:(Q)=>T.getSizeFromValue(A(Q))}:T,write:(Q,J,W)=>T.write(A(Q),J,W)})}function yU(T,A){return rT({...T,read:(Q,J)=>{let[W,$]=T.read(Q,J);return[A(W,Q,J),$]}})}function H7(T,A,Q,J){if(J<A||J>Q)throw new e(u8,{codecDescription:T,max:Q,min:A,value:J})}function bU(T){return T?.endian===1?!1:!0}function $J(T){return PT({fixedSize:T.size,write(A,Q,J){if(T.range)H7(T.name,T.range[0],T.range[1],A);let W=new ArrayBuffer(T.size);return T.set(new DataView(W),A,bU(T.config)),Q.set(new Uint8Array(W),J),J+T.size}})}function Q2(T){return rT({fixedSize:T.size,read(A,Q=0){vU(T.name,A,Q),H6(T.name,T.size,A,Q);let J=new DataView(V7(A,Q,T.size));return[T.get(J,bU(T.config)),Q+T.size]}})}function V7(T,A,Q){let J=T.byteOffset+(A??0),W=Q??T.byteLength;return T.buffer.slice(J,J+W)}var pU=(T={})=>Q2({config:T,get:(A,Q)=>{let J=Q?8:0,W=Q?0:8,$=A.getBigUint64(J,Q),G=A.getBigUint64(W,Q);return($<<64n)+G},name:"u128",size:16});var lU=(T={})=>Q2({config:T,get:(A,Q)=>A.getUint16(0,Q),name:"u16",size:2});var J2=(T={})=>$J({config:T,name:"u32",range:[0,Number("0xffffffff")],set:(A,Q,J)=>A.setUint32(0,Number(Q),J),size:4}),GJ=(T={})=>Q2({config:T,get:(A,Q)=>A.getUint32(0,Q),name:"u32",size:4});var D1=(T={})=>$J({config:T,name:"u64",range:[0n,BigInt("0xffffffffffffffff")],set:(A,Q,J)=>A.setBigUint64(0,BigInt(Q),J),size:8}),L1=(T={})=>Q2({config:T,get:(A,Q)=>A.getBigUint64(0,Q),name:"u64",size:8});var W2=()=>$J({name:"u8",range:[0,Number("0xff")],set:(T,A)=>T.setUint8(0,Number(A)),size:1}),D8=()=>Q2({get:(T)=>T.getUint8(0),name:"u8",size:1});function j7(T,A,Q){if(A!==Q)throw new e(l8,{actual:Q,codecDescription:T,expected:A})}function kA(T){return T.reduce((A,Q)=>A===null||Q===null?null:A+Q,0)}function j6(T){return fT(T)?T.fixedSize:null}function R6(T){return fT(T)?T.fixedSize:T.maxSize??null}function D6(T,A={}){let Q=A.size??GJ(),J=j6(T),W=uU(Q,J),$=uU(Q,R6(T))??void 0;return rT({...W!==null?{fixedSize:W}:{maxSize:$},read:(G,Y)=>{let Z=[];if(typeof Q==="object"&&G.slice(Y).length===0)return[Z,Y];if(Q==="remainder"){while(Y<G.length){let[V,M]=T.read(G,Y);Y=M,Z.push(V)}return[Z,Y]}let[C,K]=typeof Q==="number"?[Q,Y]:Q.read(G,Y);Y=K;for(let V=0;V<C;V+=1){let[M,z]=T.read(G,Y);Y=z,Z.push(M)}return[Z,Y]}})}function uU(T,A){if(typeof T!=="number")return null;if(T===0)return 0;return A===null?null:A*T}function UJ(T={}){return Z0(T.size??W2(),(A)=>A?1:0)}function YJ(T={}){return yU(T.size??D8(),(A)=>Number(A)===1)}function M0(){return PT({getSizeFromValue:(T)=>T.length,write:(T,A,Q)=>{return A.set(T,Q),Q+T.length}})}function b0(){return rT({read:(T,A)=>{let Q=T.slice(A);return[Q,A+Q.length]}})}function dU(T){let A=kA(T.map(j6)),Q=kA(T.map(R6))??void 0;return PT({...A===null?{getSizeFromValue:(J)=>T.map((W,$)=>MA(J[$],W)).reduce((W,$)=>W+$,0),maxSize:Q}:{fixedSize:A},write:(J,W,$)=>{return j7("tuple",T.length,J.length),T.forEach((G,Y)=>{$=G.write(J[Y],W,$)}),$}})}function X0(T){let A=T.map(([,W])=>W),Q=kA(A.map(j6)),J=kA(A.map(R6))??void 0;return PT({...Q===null?{getSizeFromValue:(W)=>T.map(([$,G])=>MA(W[$],G)).reduce(($,G)=>$+G,0),maxSize:J}:{fixedSize:Q},write:(W,$,G)=>{return T.forEach(([Y,Z])=>{G=Z.write(W[Y],$,G)}),G}})}function V0(T){let A=T.map(([,W])=>W),Q=kA(A.map(j6)),J=kA(A.map(R6))??void 0;return rT({...Q===null?{maxSize:J}:{fixedSize:Q},read:(W,$)=>{let G={};return T.forEach(([Y,Z])=>{let[C,K]=Z.read(W,$);$=K,G[Y]=C}),[G,$]}})}var{TextDecoder:A3,TextEncoder:cU}=globalThis,M6=()=>{let T;return PT({getSizeFromValue:(A)=>(T||=new cU).encode(A).length,write:(A,Q,J)=>{let W=(T||=new cU).encode(A);return Q.set(W,J),J+W.length}})};var W1=((T)=>{return T[T.WRITABLE_SIGNER=3]="WRITABLE_SIGNER",T[T.READONLY_SIGNER=2]="READONLY_SIGNER",T[T.WRITABLE=1]="WRITABLE",T[T.READONLY=0]="READONLY",T})(W1||{}),R7=2,D7=1;function nT(T){return T>=2}function zA(T){return(T&D7)!==0}function ZJ(T,A){return T|A}function k6(T){return T|R7}function rU(T){return q6(T)}function fU(T){switch(T){case"finalized":return 2;case"confirmed":return 1;case"processed":return 0;default:throw new e(a4,{unexpectedValue:T})}}function z6(T,A){if(T===A)return 0;return fU(T)<fU(A)?-1:1}var G3=-9223372036854775808n;function M8(T,A){return"fixedSize"in A?A.fixedSize:A.getSizeFromValue(T)}function k0(T){return Object.freeze({...T,encode:(A)=>{let Q=new Uint8Array(M8(A,T));return T.write(A,Q,0),Q}})}function LT(T){return"fixedSize"in T&&typeof T.fixedSize==="number"}function M7(T){return!LT(T)}function nU(T,A){let Q=(G,Y,Z)=>{let C=T.encode(G);return Z=A.write(C.length,Y,Z),Y.set(C,Z),Z+C.length};if(LT(A)&<(T))return k0({...T,fixedSize:A.fixedSize+T.fixedSize,write:Q});let J=LT(A)?A.fixedSize:A.maxSize??null,W=LT(T)?T.fixedSize:T.maxSize??null,$=J!==null&&W!==null?J+W:null;return k0({...T,...$!==null?{maxSize:$}:{},getSizeFromValue:(G)=>{let Y=M8(G,T);return M8(Y,A)+Y},write:Q})}function XJ(T,A){return k0({fixedSize:A,write:(Q,J,W)=>{let $=T.encode(Q),G=$.length>A?$.slice(0,A):$;return J.set(G,W),W+A}})}function F6(T,A){return k0({...M7(T)?{...T,getSizeFromValue:(Q)=>T.getSizeFromValue(A(Q))}:T,write:(Q,J,W)=>T.write(A(Q),J,W)})}function aU(T,A,Q,J){if(J<A||J>Q)throw new e(u8,{codecDescription:T,max:Q,min:A,value:J})}function z7(T){return T?.endian===1?!1:!0}function sU(T){return k0({fixedSize:T.size,write(A,Q,J){if(T.range)aU(T.name,T.range[0],T.range[1],A);let W=new ArrayBuffer(T.size);return T.set(new DataView(W),A,z7(T.config)),Q.set(new Uint8Array(W),J),J+T.size}})}var c8=()=>k0({getSizeFromValue:(T)=>{if(T<=127)return 1;if(T<=16383)return 2;return 3},maxSize:3,write:(T,A,Q)=>{aU("shortU16",0,65535,T);let J=[0];for(let W=0;;W+=1){let $=Number(T)>>W*7;if($===0)break;let G=127&$;if(J[W]=G,W>0)J[W-1]|=128}return A.set(J,Q),Q+J.length}});var tU=(T={})=>sU({config:T,name:"u32",range:[0,Number("0xffffffff")],set:(A,Q,J)=>A.setUint32(0,Number(Q),J),size:4});var FA=()=>sU({name:"u8",range:[0,Number("0xff")],set:(T,A)=>T.setUint8(0,Number(A)),size:1});function S7(T,A,Q){if(A!==Q)throw new e(l8,{actual:Q,codecDescription:T,expected:A})}function L7(T){return T.reduce((A,Q)=>A===null||Q===null?null:Math.max(A,Q),0)}function eU(T){return T.reduce((A,Q)=>A===null||Q===null?null:A+Q,0)}function QY(T){return LT(T)?T.fixedSize:null}function PJ(T){return LT(T)?T.fixedSize:T.maxSize??null}function NA(T,A={}){let Q=A.size??tU(),J=TY(Q,QY(T)),W=TY(Q,PJ(T))??void 0;return k0({...J!==null?{fixedSize:J}:{getSizeFromValue:($)=>{return(typeof Q==="object"?M8($.length,Q):0)+[...$].reduce((Y,Z)=>Y+M8(Z,T),0)},maxSize:W},write:($,G,Y)=>{if(typeof Q==="number")S7("array",Q,$.length);if(typeof Q==="object")Y=Q.write($.length,G,Y);return $.forEach((Z)=>{Y=T.write(Z,G,Y)}),Y}})}function TY(T,A){if(typeof T!=="number")return null;if(T===0)return 0;return A===null?null:A*T}function JY(){return k0({getSizeFromValue:(T)=>T.length,write:(T,A,Q)=>{return A.set(T,Q),Q+T.length}})}function WY(T){return k0({fixedSize:T.length,write:(A,Q,J)=>{return Q.set(T,J),J+T.length}})}function $Y(T,A){let Q=w7(T),J=($,G,Y)=>{let Z=A($);return AY(T,Z),T[Z].write($,G,Y)};if(Q!==null)return k0({fixedSize:Q,write:J});let W=E7(T);return k0({...W!==null?{maxSize:W}:{},getSizeFromValue:($)=>{let G=A($);return AY(T,G),M8($,T[G])},write:J})}function AY(T,A){if(typeof T[A]>"u")throw new e(A2,{maxRange:T.length-1,minRange:0,variant:A})}function w7(T){if(T.length===0)return 0;if(!LT(T[0]))return null;let A=T[0].fixedSize;return T.every((J)=>LT(J)&&J.fixedSize===A)?A:null}function E7(T){return L7(T.map((A)=>PJ(A)))}function IA(T){let A=T.map(([,W])=>W),Q=eU(A.map(QY)),J=eU(A.map(PJ))??void 0;return k0({...Q===null?{getSizeFromValue:(W)=>T.map(([$,G])=>M8(W[$],G)).reduce(($,G)=>$+G,0),maxSize:J}:{fixedSize:Q},write:(W,$,G)=>{return T.forEach(([Y,Z])=>{G=Z.write(W[Y],$,G)}),G}})}function PY(T){return"lifetimeConstraint"in T&&typeof T.lifetimeConstraint.blockhash==="string"&&typeof T.lifetimeConstraint.lastValidBlockHeight==="bigint"&&rU(T.lifetimeConstraint.blockhash)}function qY(T,A){if("lifetimeConstraint"in A&&A.lifetimeConstraint&&"blockhash"in A.lifetimeConstraint&&A.lifetimeConstraint.blockhash===T.blockhash&&A.lifetimeConstraint.lastValidBlockHeight===T.lastValidBlockHeight)return A;return Object.freeze({...A,lifetimeConstraint:Object.freeze(T)})}function O7(T,A,Q=A){if(!A.match(new RegExp(`^[${T}]*$`)))throw new e(C8,{alphabet:T,base:T.length,value:Q})}var B7=(T)=>{return k0({getSizeFromValue:(A)=>{let[Q,J]=GY(A,T[0]);if(!J)return A.length;let W=UY(J,T);return Q.length+Math.ceil(W.toString(16).length/2)},write(A,Q,J){if(O7(T,A),A==="")return J;let[W,$]=GY(A,T[0]);if(!$)return Q.set(new Uint8Array(W.length).fill(0),J),J+W.length;let G=UY($,T),Y=[];while(G>0n)Y.unshift(Number(G%256n)),G/=256n;let Z=[...Array(W.length).fill(0),...Y];return Q.set(Z,J),J+Z.length}})};function GY(T,A){let[Q,J]=T.split(new RegExp(`((?!${A}).*)`));return[Q,J]}function UY(T,A){let Q=BigInt(A.length),J=0n;for(let W of T)J*=Q,J+=BigInt(A.indexOf(W));return J}var _7="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",x7=()=>B7(_7);var qJ;function h7(){if(!qJ){let T=NA(FA(),{size:c8()});qJ=IA([["lookupTableAddress",C0()],["writableIndexes",T],["readonlyIndexes",T]])}return qJ}var KJ;function CJ(){if(!KJ)KJ=FA();return KJ}function g7(){return IA([["numSignerAccounts",CJ()],["numReadonlySignerAccounts",CJ()],["numReadonlyNonSignerAccounts",CJ()]])}var HJ;function m7(){if(!HJ)HJ=F6(IA([["programAddressIndex",FA()],["accountIndices",NA(FA(),{size:c8()})],["data",nU(JY(),c8())]]),(T)=>{if(T.accountIndices!==void 0&&T.data!==void 0)return T;return{...T,accountIndices:T.accountIndices??[],data:T.data??new Uint8Array(0)}});return HJ}var v7=0,y7=128;function b7(){return k0({getSizeFromValue:(T)=>T==="legacy"?0:1,maxSize:1,write:(T,A,Q)=>{if(T==="legacy")return Q;if(T<0||T>127)throw new e(v4,{actualVersion:T});if(T>v7)throw new e(u4,{unsupportedVersion:T});return A.set([T|y7],Q),Q+1}})}function YY(){return IA(KY())}function ZY(){return F6(IA([...KY(),["addressTableLookups",p7()]]),(T)=>{if(T.version==="legacy")return T;return{...T,addressTableLookups:T.addressTableLookups??[]}})}function KY(){let T=$Y([WY(new Uint8Array(32)),XJ(x7(),32)],(A)=>A===void 0?0:1);return[["version",b7()],["header",g7()],["staticAccounts",NA(C0(),{size:c8()})],["lifetimeToken",T],["instructions",NA(m7(),{size:c8()})]]}function p7(){return NA(h7(),{size:c8()})}function CY(){return k0({getSizeFromValue:(T)=>{if(T.version==="legacy")return YY().getSizeFromValue(T);else return ZY().getSizeFromValue(T)},write:(T,A,Q)=>{if(T.version==="legacy")return YY().write(T,A,Q);else return ZY().write(T,A,Q)}})}function XY(T,A,Q){T[A]=Q(T[A]??{role:W1.READONLY})}var P0=Symbol("AddressMapTypeProperty");function l7(T,A){let Q={[T]:{[P0]:0,role:W1.WRITABLE_SIGNER}},J=new Set;for(let W of A){XY(Q,W.programAddress,(G)=>{if(J.add(W.programAddress),P0 in G){if(zA(G.role))switch(G[P0]){case 0:throw new e(h4,{programAddress:W.programAddress});default:throw new e(s2,{programAddress:W.programAddress})}if(G[P0]===2)return G}return{[P0]:2,role:W1.READONLY}});let $;if(!W.accounts)continue;for(let G of W.accounts)XY(Q,G.address,(Y)=>{let{address:Z,...C}=G;if(P0 in Y)switch(Y[P0]){case 0:return Y;case 1:{let K=ZJ(Y.role,C.role);if("lookupTableAddress"in C){if(Y.lookupTableAddress!==C.lookupTableAddress&&($||=K6())(C.lookupTableAddress,Y.lookupTableAddress)<0)return{[P0]:1,...C,role:K}}else if(nT(C.role))return{[P0]:2,role:K};if(Y.role!==K)return{...Y,role:K};else return Y}case 2:{let K=ZJ(Y.role,C.role);if(J.has(G.address)){if(zA(C.role))throw new e(s2,{programAddress:G.address});if(Y.role!==K)return{...Y,role:K};else return Y}else if("lookupTableAddress"in C&&!nT(Y.role))return{...C,[P0]:1,role:K};else if(Y.role!==K)return{...Y,role:K};else return Y}}if("lookupTableAddress"in C)return{...C,[P0]:1};else return{...C,[P0]:2}})}return Q}function u7(T){let A;return Object.entries(T).sort(([J,W],[$,G])=>{if(W[P0]!==G[P0]){if(W[P0]===0)return-1;else if(G[P0]===0)return 1;else if(W[P0]===2)return-1;else if(G[P0]===2)return 1}let Y=nT(W.role);if(Y!==nT(G.role))return Y?-1:1;let Z=zA(W.role);if(Z!==zA(G.role))return Z?-1:1;if(A||=K6(),W[P0]===1&&G[P0]===1&&W.lookupTableAddress!==G.lookupTableAddress)return A(W.lookupTableAddress,G.lookupTableAddress);else return A(J,$)}).map(([J,W])=>({address:J,...W}))}function d7(T){let A={};for(let Q of T){if(!("lookupTableAddress"in Q))continue;let J=A[Q.lookupTableAddress]||={readonlyIndexes:[],writableIndexes:[]};if(Q.role===W1.WRITABLE)J.writableIndexes.push(Q.addressIndex);else J.readonlyIndexes.push(Q.addressIndex)}return Object.keys(A).sort(K6()).map((Q)=>({lookupTableAddress:Q,...A[Q]}))}function c7(T){let A=0,Q=0,J=0;for(let W of T){if("lookupTableAddress"in W)break;let $=zA(W.role);if(nT(W.role)){if(J++,!$)Q++}else if(!$)A++}return{numReadonlyNonSignerAccounts:A,numReadonlySignerAccounts:Q,numSignerAccounts:J}}function f7(T){let A={};for(let[Q,J]of T.entries())A[J.address]=Q;return A}function r7(T,A){let Q=f7(A);return T.map(({accounts:J,data:W,programAddress:$})=>{return{programAddressIndex:Q[$],...J?{accountIndices:J.map(({address:G})=>Q[G])}:null,...W?{data:W}:null}})}function n7(T){if("nonce"in T)return T.nonce;return T.blockhash}function i7(T){let A=T.findIndex((J)=>("lookupTableAddress"in J));return(A===-1?T:T.slice(0,A)).map(({address:J})=>J)}function HY(T){let A=l7(T.feePayer.address,T.instructions),Q=u7(A),J=T.lifetimeConstraint;return{...T.version!=="legacy"?{addressTableLookups:d7(Q)}:null,...J?{lifetimeToken:n7(J)}:null,header:c7(Q),instructions:r7(T.instructions,Q),staticAccounts:i7(Q),version:T.version}}function VY(T){return Object.freeze({instructions:Object.freeze([]),version:T.version})}var o7="SysvarRecentB1ockHashes11111111111111111111",a7="11111111111111111111111111111111";function s7(T){return T.programAddress===a7&&T.data!=null&&t7(T.data)&&T.accounts?.length===3&&T.accounts[0].address!=null&&T.accounts[0].role===W1.WRITABLE&&T.accounts[1].address===o7&&T.accounts[1].role===W1.READONLY&&T.accounts[2].address!=null&&nT(T.accounts[2].role)}function t7(T){return T.byteLength===4&&T[0]===4&&T[1]===0&&T[2]===0&&T[3]===0}function jY(T){return"lifetimeConstraint"in T&&typeof T.lifetimeConstraint.nonce==="string"&&T.instructions[0]!=null&&s7(T.instructions[0])}function RY(T,A){if("feePayer"in A&&T===A.feePayer?.address&&e7(A.feePayer))return A;let Q={...A,feePayer:Object.freeze({address:T})};return Object.freeze(Q),Q}function e7(T){return!!T&&"address"in T&&typeof T.address==="string"&&Object.keys(T).length===1}function DY(T,A){return TV([T],A)}function TV(T,A){return Object.freeze({...A,instructions:Object.freeze([...A.instructions,...T])})}function $2(T,A){return"fixedSize"in A?A.fixedSize:A.getSizeFromValue(T)}function wT(T){return Object.freeze({...T,encode:(A)=>{let Q=new Uint8Array($2(A,T));return T.write(A,Q,0),Q}})}function G2(T){return Object.freeze({...T,decode:(A,Q=0)=>T.read(A,Q)[0]})}function N6(T){return"fixedSize"in T&&typeof T.fixedSize==="number"}function AV(T){return!N6(T)}function VJ(T,A){return wT({fixedSize:A,write:(Q,J,W)=>{let $=T.encode(Q),G=$.length>A?$.slice(0,A):$;return J.set(G,W),W+A}})}function jJ(T,A){return wT({...AV(T)?{...T,getSizeFromValue:(Q)=>T.getSizeFromValue(A(Q))}:T,write:(Q,J,W)=>T.write(A(Q),J,W)})}function MY(T,A,Q,J){if(J<A||J>Q)throw new e(u8,{codecDescription:T,max:Q,min:A,value:J})}function JV(T){return T?.endian===1?!1:!0}function WV(T){return wT({fixedSize:T.size,write(A,Q,J){if(T.range)MY(T.name,T.range[0],T.range[1],A);let W=new ArrayBuffer(T.size);return T.set(new DataView(W),A,JV(T.config)),Q.set(new Uint8Array(W),J),J+T.size}})}var kY=()=>wT({getSizeFromValue:(T)=>{if(T<=127)return 1;if(T<=16383)return 2;return 3},maxSize:3,write:(T,A,Q)=>{MY("shortU16",0,65535,T);let J=[0];for(let W=0;;W+=1){let $=Number(T)>>W*7;if($===0)break;let G=127&$;if(J[W]=G,W>0)J[W-1]|=128}return A.set(J,Q),Q+J.length}});var zY=(T={})=>WV({config:T,name:"u32",range:[0,Number("0xffffffff")],set:(A,Q,J)=>A.setUint32(0,Number(Q),J),size:4});function YV(T,A,Q){if(A!==Q)throw new e(l8,{actual:Q,codecDescription:T,expected:A})}function FY(T){return T.reduce((A,Q)=>A===null||Q===null?null:A+Q,0)}function IY(T){return N6(T)?T.fixedSize:null}function SY(T){return N6(T)?T.fixedSize:T.maxSize??null}function LY(T,A={}){let Q=A.size??zY(),J=NY(Q,IY(T)),W=NY(Q,SY(T))??void 0;return wT({...J!==null?{fixedSize:J}:{getSizeFromValue:($)=>{return(typeof Q==="object"?$2($.length,Q):0)+[...$].reduce((Y,Z)=>Y+$2(Z,T),0)},maxSize:W},write:($,G,Y)=>{if(typeof Q==="number")YV("array",Q,$.length);if(typeof Q==="object")Y=Q.write($.length,G,Y);return $.forEach((Z)=>{Y=T.write(Z,G,Y)}),Y}})}function NY(T,A){if(typeof T!=="number")return null;if(T===0)return 0;return A===null?null:A*T}function DJ(){return wT({getSizeFromValue:(T)=>T.length,write:(T,A,Q)=>{return A.set(T,Q),Q+T.length}})}function wY(T){let A=T.map(([,W])=>W),Q=FY(A.map(IY)),J=FY(A.map(SY))??void 0;return wT({...Q===null?{getSizeFromValue:(W)=>T.map(([$,G])=>$2(W[$],G)).reduce(($,G)=>$+G,0),maxSize:J}:{fixedSize:Q},write:(W,$,G)=>{return T.forEach(([Y,Z])=>{G=Z.write(W[Y],$,G)}),G}})}var ZV=(T)=>{return G2({read(A,Q){let J=Q===0?A:A.slice(Q);if(J.length===0)return["",0];let W=J.findIndex((Z)=>Z!==0);W=W===-1?J.length:W;let $=T[0].repeat(W);if(W===J.length)return[$,A.length];let G=J.slice(W).reduce((Z,C)=>Z*256n+BigInt(C),0n),Y=XV(G,T);return[$+Y,A.length]}})};function XV(T,A){let Q=BigInt(A.length),J=[];while(T>0n)J.unshift(A[Number(T%Q)]),T/=Q;return J.join("")}var PV="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";var EY=()=>ZV(PV);var OY=()=>{return G2({read(T,A=0){let Q=T.slice(A);return[btoa(String.fromCharCode(...Q)),T.length]}})};var{TextDecoder:n3,TextEncoder:i3}=globalThis;var BY=Object.freeze({name:"Ed25519"});async function I6(T,A){xU();let Q=await crypto.subtle.sign(BY,T,A);return new Uint8Array(Q)}async function _Y(){return await _U(),await crypto.subtle.generateKey(BY,!1,["sign","verify"])}function qV(T){let A=Object.values(T);if(A.length===0)throw new e(l4);return A.map((Q)=>{if(!Q)return new Uint8Array(64).fill(0);return Q})}function KV(){return jJ(LY(VJ(DJ(),64),{size:kY()}),qV)}function CV(){return wY([["signatures",KV()],["messageBytes",DJ()]])}function xY(T){let A=HY(T),Q=CY().encode(A),J=A.staticAccounts.slice(0,A.header.numSignerAccounts),W={};for(let G of J)W[G]=null;let $;if(PY(T))$={blockhash:T.lifetimeConstraint.blockhash,lastValidBlockHeight:T.lifetimeConstraint.lastValidBlockHeight};else if(jY(T))$={nonce:T.lifetimeConstraint.nonce,nonceAccountAddress:T.instructions[0].accounts[0].address};return Object.freeze({...$?{lifetimeConstraint:$}:void 0,messageBytes:Q,signatures:Object.freeze(W)})}var MJ;function S6(T){if(!MJ)MJ=EY();let A=Object.values(T.signatures)[0];if(!A)throw new e(b4);return MJ.decode(A)}function HV(T,A){return T.length===A.length&&T.every((Q,J)=>Q===A[J])}async function hY(T,A){let Q,J;if(await Promise.all(T.map(async(W)=>{let $=await C6(W.publicKey),G=A.signatures[$];if(G===void 0){J||=new Set,J.add($);return}if(J)return;let Y=await I6(W.privateKey,A.messageBytes);if(G!==null&&HV(Y,G))return;Q||={},Q[$]=Y})),J&&J.size>0){let W=Object.keys(A.signatures);throw new e(p4,{expectedAddresses:W,unexpectedAddresses:[...J]})}if(!Q)return A;return Object.freeze({...A,signatures:Object.freeze({...A.signatures,...Q})})}function gY(T){let A=[];if(Object.entries(T.signatures).forEach(([Q,J])=>{if(!J)A.push(Q)}),A.length>0)throw new e(y4,{addresses:A})}function L6(T){let A=CV().encode(T);return OY().decode(A)}var VV=1280,jV=48,HL=VV-jV;function mY(T){return T!==null&&(typeof T==="object"||typeof T==="function")}function RV(T){let A=new Set,Q={deferreds:A,settled:!1};return Promise.resolve(T).then((J)=>{for(let{resolve:W}of A)W(J);A.clear(),Q.settled=!0},(J)=>{for(let{reject:W}of A)W(J);A.clear(),Q.settled=!0}),Q}var kJ=new WeakMap;async function zJ(T){let A;return await new Promise((J,W)=>{A={reject:W,resolve:J};for(let $ of T){if(!mY($)){Promise.resolve($).then(J,W);continue}let G=kJ.get($);if(G===void 0)G=RV($),G.deferreds.add(A),kJ.set($,G);else if(G.settled)Promise.resolve($).then(J,W);else G.deferreds.add(A)}}).finally(()=>{for(let J of T)if(mY(J))kJ.get(J).deferreds.delete(A)})}function w6(T){let A={};return T.forEach((Q)=>{if(!A[Q.address])A[Q.address]=Q;else if(A[Q.address]!==Q)throw new e(x4,{address:Q.address})}),Object.values(A)}function E6(T){return"modifyAndSignTransactions"in T&&typeof T.modifyAndSignTransactions==="function"}function U2(T){return"signTransactions"in T&&typeof T.signTransactions==="function"}function vY(T){return"signAndSendTransactions"in T&&typeof T.signAndSendTransactions==="function"}function ET(T){return U2(T)||E6(T)||vY(T)}function DV(T){return w6((T.accounts??[]).flatMap((A)=>("signer"in A)?A.signer:[]))}function MV(T){return w6([...T.feePayer&&ET(T.feePayer)?[T.feePayer]:[],...T.instructions.flatMap(DV)])}function kV(T,A){if(!A.accounts||A.accounts.length===0)return A;let Q=new Map(w6(T).map((J)=>[J.address,J]));return Object.freeze({...A,accounts:A.accounts.map((J)=>{let W=Q.get(J.address);if(!nT(J.role)||"signer"in J||!W)return J;return Object.freeze({...J,signer:W})})})}function yY(T,A){let Q=zV(A)?T.find((J)=>J.address===A.feePayer.address):void 0;if(!Q&&A.instructions.length===0)return A;return Object.freeze({...A,...Q?{feePayer:Q}:null,instructions:A.instructions.map((J)=>kV(T,J))})}function zV(T){return!!T&&"feePayer"in T&&!!T.feePayer&&typeof T.feePayer.address==="string"&&!ET(T.feePayer)}function bY(T,A){Object.freeze(T);let Q={...A,feePayer:T};return Object.freeze(Q),Q}async function FV(T){let A=await C6(T.publicKey);return Object.freeze({address:A,keyPair:T,signMessages:(J)=>Promise.all(J.map(async(W)=>Object.freeze({[A]:await I6(T.privateKey,W.content)}))),signTransactions:(J)=>Promise.all(J.map(async(W)=>{let $=await hY([T],W);return Object.freeze({[A]:$.signatures[A]})}))})}async function pY(){return await FV(await _Y())}async function NV(T,A){let{partialSigners:Q,modifyingSigners:J}=IV(w6(MV(T).filter(ET)),{identifySendingSigner:!1});return await wV(T,J,Q,A)}async function FJ(T,A){let Q=await NV(T,A);return gY(Q),Q}function IV(T,A={}){let J=A.identifySendingSigner??!0?SV(T):null,W=T.filter((Y)=>Y!==J&&(E6(Y)||U2(Y))),$=LV(W),G=W.filter(U2).filter((Y)=>!$.includes(Y));return Object.freeze({modifyingSigners:$,partialSigners:G,sendingSigner:J})}function SV(T){let A=T.filter(vY);if(A.length===0)return null;let Q=A.filter((J)=>!E6(J)&&!U2(J));if(Q.length>0)return Q[0];return A[0]}function LV(T){let A=T.filter(E6);if(A.length===0)return[];let Q=A.filter((J)=>!U2(J));if(Q.length>0)return Q;return[A[0]]}async function wV(T,A=[],Q=[],J){let W=xY(T),$=await A.reduce(async(Y,Z)=>{J?.abortSignal?.throwIfAborted();let[C]=await Z.modifyAndSignTransactions([await Y],J);return Object.freeze(C)},Promise.resolve(W));J?.abortSignal?.throwIfAborted();let G=await Promise.all(Q.map(async(Y)=>{let[Z]=await Y.signTransactions([$],J);return Z}));return Object.freeze({...$,signatures:Object.freeze(G.reduce((Y,Z)=>{return{...Y,...Z}},$.signatures??{}))})}var IL=globalThis.TextEncoder;var NJ=globalThis.AbortController;function lY({rpc:T,rpcSubscriptions:A}){return async function({abortSignal:J,commitment:W,lastValidBlockHeight:$}){J.throwIfAborted();let G=new NJ,Y=()=>{G.abort()};J.addEventListener("abort",Y,{signal:G.signal});async function Z(){let{absoluteSlot:C,blockHeight:K}=await T.getEpochInfo({commitment:W}).send({abortSignal:G.signal});return{blockHeight:K,differenceBetweenSlotHeightAndBlockHeight:C-K}}try{let[C,{blockHeight:K,differenceBetweenSlotHeightAndBlockHeight:V}]=await Promise.all([A.slotNotifications().subscribe({abortSignal:G.signal}),Z()]);J.throwIfAborted();let M=K;if(M<=$){let z=V;for await(let N of C){let{slot:w}=N;if(w-z>$){let{blockHeight:L,differenceBetweenSlotHeightAndBlockHeight:O}=await Z();if(M=L,M>$)break;else z=O}}}throw J.throwIfAborted(),new e(M4,{currentBlockHeight:M,lastValidBlockHeight:$})}finally{G.abort()}}}function uY({rpc:T,rpcSubscriptions:A}){return async function({abortSignal:J,commitment:W,signature:$}){let G=new NJ;function Y(){G.abort()}J.addEventListener("abort",Y,{signal:G.signal});let Z=await A.signatureNotifications($,{commitment:W}).subscribe({abortSignal:G.signal}),C=(async()=>{for await(let V of Z)if(V.value.err)throw Z6(V.value.err);else return})(),K=(async()=>{let{value:V}=await T.getSignatureStatuses([$]).send({abortSignal:G.signal}),M=V[0];if(M?.confirmationStatus&&z6(M.confirmationStatus,W)>=0)return;else if(M?.err)throw Z6(M.err);else await new Promise(()=>{})})();try{return await zJ([C,K])}finally{G.abort()}}}async function EV(T,A,Q){let{abortSignal:J,commitment:W,getRecentSignatureConfirmationPromise:$}=A;J?.throwIfAborted();let G=new NJ;if(J){let Y=()=>{G.abort()};J.addEventListener("abort",Y,{signal:G.signal})}try{let Y=Q({...A,abortSignal:G.signal});return await zJ([$({abortSignal:G.signal,commitment:W,signature:T}),...Y])}finally{G.abort()}}async function dY(T){await EV(S6(T.transaction),T,function({abortSignal:Q,commitment:J,getBlockHeightExceedencePromise:W,transaction:$}){return[W({abortSignal:Q,commitment:J,lastValidBlockHeight:$.lifetimeConstraint.lastValidBlockHeight})]})}function OV(T,A){if(!A?.preflightCommitment&&z6(T,"finalized")<0)return{...A,preflightCommitment:T};return A}async function BV({abortSignal:T,commitment:A,rpc:Q,transaction:J,...W}){let $=L6(J);return await Q.sendTransaction($,{...OV(A,W),encoding:"base64"}).send({abortSignal:T})}async function _V({abortSignal:T,commitment:A,confirmRecentTransaction:Q,rpc:J,transaction:W,...$}){let G=await BV({...$,abortSignal:T,commitment:A,rpc:J,transaction:W});return await Q({abortSignal:T,commitment:A,transaction:W}),G}function cY({rpc:T,rpcSubscriptions:A}){let Q=lY({rpc:T,rpcSubscriptions:A}),J=uY({rpc:T,rpcSubscriptions:A});async function W($){await dY({...$,getBlockHeightExceedencePromise:Q,getRecentSignatureConfirmationPromise:J})}return async function(G,Y){await _V({...Y,confirmRecentTransaction:W,rpc:T,transaction:G})}}var fY="confirmed";function xV(T){fY=T}function M1(){return fY}var o0="6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P",q0="pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA",f8="11111111111111111111111111111111",j0="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",Y2="TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb",Z2="ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";var OT="pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ";var IJ=C0(),rY=Z2;async function H1({owner:T,mint:A,tokenProgram:Q=j0,associatedTokenProgram:J=rY}){return await R1({programAddress:_(J),seeds:[IJ.encode(_(T)),IJ.encode(_(Q)),IJ.encode(_(A))]})}async function nY(T){return await H1({...T,tokenProgram:T.tokenProgram??Y2,associatedTokenProgram:T.associatedTokenProgram??rY})}var r8=new TextEncoder,O6=C0();async function B6(){let[T]=await R1({programAddress:_(o0),seeds:[r8.encode("global")]});return T}async function BT(T){let[A]=await R1({programAddress:_(o0),seeds:[r8.encode("bonding-curve"),O6.encode(_(T))]});return A}async function _6(T,A){let[Q]=await H1({owner:_(T),mint:_(A),tokenProgram:_(j0)});return Q}async function SJ(T){let[A]=await R1({programAddress:_(o0),seeds:[r8.encode("creator-vault"),O6.encode(_(T))]});return A}async function iY(){let[T]=await R1({programAddress:_(o0),seeds:[r8.encode("global_volume_accumulator")]});return T}async function oY(T){let[A]=await R1({programAddress:_(o0),seeds:[r8.encode("user_volume_accumulator"),O6.encode(_(T))]});return A}async function x6(){let[T]=await R1({programAddress:_(o0),seeds:[r8.encode("__event_authority")]});return T}async function X2(){let[T]=await R1({programAddress:_(OT),seeds:[r8.encode("fee_config"),O6.encode(_(o0))]});return T}var F1="6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P";function p0(T){if(!T)throw Error("Expected a Address.");if(typeof T==="object"&&"address"in T)return T.address;if(Array.isArray(T))return T[0];return T}function N1(T,A){return(Q)=>{if(!Q.value){if(A==="omitted")return;return Object.freeze({address:T,role:W1.READONLY})}let J=Q.isWritable?W1.WRITABLE:W1.READONLY;return Object.freeze({address:p0(Q.value),role:aY(Q.value)?k6(J):J,...aY(Q.value)?{signer:Q.value}:{}})}}function aY(T){return!!T&&typeof T==="object"&&"address"in T&&ET(T)}var Rw=new Uint8Array([69,25,171,142,57,239,13,4]);var zw=new Uint8Array([8,217,96,231,144,104,192,5]);var Sw=new Uint8Array([209,11,115,87,213,23,124,204]);function h6(){return V0([["lpFeeBps",L1()],["protocolFeeBps",L1()],["creatorFeeBps",L1()]])}function sY(){return V0([["marketCapLamportsThreshold",pU()],["fees",h6()]])}function LJ(){return dU([UJ()])}var vV=new Uint8Array([102,6,61,18,1,218,235,234]);function yV(){return Z0(X0([["discriminator",H0(M0(),8)],["amount",D1()],["maxSolCost",D1()],["trackVolume",LJ()]]),(T)=>({...T,discriminator:vV}))}function tY(T,A){let Q=A?.programAddress??F1,W={global:{value:T.global??null,isWritable:!1},feeRecipient:{value:T.feeRecipient??null,isWritable:!0},mint:{value:T.mint??null,isWritable:!1},bondingCurve:{value:T.bondingCurve??null,isWritable:!0},associatedBondingCurve:{value:T.associatedBondingCurve??null,isWritable:!0},associatedUser:{value:T.associatedUser??null,isWritable:!0},user:{value:T.user??null,isWritable:!0},systemProgram:{value:T.systemProgram??null,isWritable:!1},tokenProgram:{value:T.tokenProgram??null,isWritable:!1},creatorVault:{value:T.creatorVault??null,isWritable:!0},eventAuthority:{value:T.eventAuthority??null,isWritable:!1},program:{value:T.program??null,isWritable:!1},globalVolumeAccumulator:{value:T.globalVolumeAccumulator??null,isWritable:!0},userVolumeAccumulator:{value:T.userVolumeAccumulator??null,isWritable:!0},feeConfig:{value:T.feeConfig??null,isWritable:!1},feeProgram:{value:T.feeProgram??null,isWritable:!1}},$={...T};if(!W.systemProgram.value)W.systemProgram.value="11111111111111111111111111111111";if(!W.tokenProgram.value)W.tokenProgram.value="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";if(!W.program.value)W.program.value="6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P";if(!W.feeProgram.value)W.feeProgram.value="pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ";let G=N1(Q,"programId");return Object.freeze({accounts:[G(W.global),G(W.feeRecipient),G(W.mint),G(W.bondingCurve),G(W.associatedBondingCurve),G(W.associatedUser),G(W.user),G(W.systemProgram),G(W.tokenProgram),G(W.creatorVault),G(W.eventAuthority),G(W.program),G(W.globalVolumeAccumulator),G(W.userVolumeAccumulator),G(W.feeConfig),G(W.feeProgram)],data:yV().encode($),programAddress:Q})}var EE=new Uint8Array([56,252,116,8,158,223,205,95]);var xE=new Uint8Array([16,4,71,28,204,1,40,27]);var vE=new Uint8Array([249,69,164,218,150,103,84,138]);var lE=new Uint8Array([20,22,86,123,198,28,219,132]);var bV=new Uint8Array([24,30,200,40,5,28,7,119]);function pV(){return Z0(X0([["discriminator",H0(M0(),8)],["name",V6(M6(),J2())],["symbol",V6(M6(),J2())],["uri",V6(M6(),J2())],["creator",C0()]]),(T)=>({...T,discriminator:bV}))}function eY(T,A){let Q=A?.programAddress??F1,W={mint:{value:T.mint??null,isWritable:!0},mintAuthority:{value:T.mintAuthority??null,isWritable:!1},bondingCurve:{value:T.bondingCurve??null,isWritable:!0},associatedBondingCurve:{value:T.associatedBondingCurve??null,isWritable:!0},global:{value:T.global??null,isWritable:!1},mplTokenMetadata:{value:T.mplTokenMetadata??null,isWritable:!1},metadata:{value:T.metadata??null,isWritable:!0},user:{value:T.user??null,isWritable:!0},systemProgram:{value:T.systemProgram??null,isWritable:!1},tokenProgram:{value:T.tokenProgram??null,isWritable:!1},associatedTokenProgram:{value:T.associatedTokenProgram??null,isWritable:!1},rent:{value:T.rent??null,isWritable:!1},eventAuthority:{value:T.eventAuthority??null,isWritable:!1},program:{value:T.program??null,isWritable:!1}},$={...T};if(!W.mplTokenMetadata.value)W.mplTokenMetadata.value="metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s";if(!W.systemProgram.value)W.systemProgram.value="11111111111111111111111111111111";if(!W.tokenProgram.value)W.tokenProgram.value="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";if(!W.associatedTokenProgram.value)W.associatedTokenProgram.value="ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";if(!W.rent.value)W.rent.value="SysvarRent111111111111111111111111111111111";let G=N1(Q,"programId");return Object.freeze({accounts:[G(W.mint),G(W.mintAuthority),G(W.bondingCurve),G(W.associatedBondingCurve),G(W.global),G(W.mplTokenMetadata),G(W.metadata),G(W.user),G(W.systemProgram),G(W.tokenProgram),G(W.associatedTokenProgram),G(W.rent),G(W.eventAuthority),G(W.program)],data:pV().encode($),programAddress:Q})}var sE=new Uint8Array([234,102,194,203,150,72,62,229]);var AO=new Uint8Array([175,175,109,31,13,152,155,237]);var $O=new Uint8Array([94,6,202,115,255,96,232,183]);var ZO=new Uint8Array([155,234,231,146,236,158,162,30]);var lV=new Uint8Array([51,230,133,164,1,127,131,173]);function uV(){return Z0(X0([["discriminator",H0(M0(),8)],["amount",D1()],["minSolOutput",D1()]]),(T)=>({...T,discriminator:lV}))}function TZ(T,A){let Q=A?.programAddress??F1,W={global:{value:T.global??null,isWritable:!1},feeRecipient:{value:T.feeRecipient??null,isWritable:!0},mint:{value:T.mint??null,isWritable:!1},bondingCurve:{value:T.bondingCurve??null,isWritable:!0},associatedBondingCurve:{value:T.associatedBondingCurve??null,isWritable:!0},associatedUser:{value:T.associatedUser??null,isWritable:!0},user:{value:T.user??null,isWritable:!0},systemProgram:{value:T.systemProgram??null,isWritable:!1},creatorVault:{value:T.creatorVault??null,isWritable:!0},tokenProgram:{value:T.tokenProgram??null,isWritable:!1},eventAuthority:{value:T.eventAuthority??null,isWritable:!1},program:{value:T.program??null,isWritable:!1},feeConfig:{value:T.feeConfig??null,isWritable:!1},feeProgram:{value:T.feeProgram??null,isWritable:!1}},$={...T};if(!W.systemProgram.value)W.systemProgram.value="11111111111111111111111111111111";if(!W.tokenProgram.value)W.tokenProgram.value="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";if(!W.program.value)W.program.value="6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P";if(!W.feeProgram.value)W.feeProgram.value="pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ";let G=N1(Q,"programId");return Object.freeze({accounts:[G(W.global),G(W.feeRecipient),G(W.mint),G(W.bondingCurve),G(W.associatedBondingCurve),G(W.associatedUser),G(W.user),G(W.systemProgram),G(W.creatorVault),G(W.tokenProgram),G(W.eventAuthority),G(W.program),G(W.feeConfig),G(W.feeProgram)],data:uV().encode($),programAddress:Q})}var jO=new Uint8Array([254,148,255,112,207,142,170,165]);var kO=new Uint8Array([138,96,174,217,48,85,197,246]);var IO=new Uint8Array([27,234,178,52,147,2,187,141]);var EO=new Uint8Array([86,31,192,87,163,87,79,238]);var xO=new Uint8Array([227,181,74,196,208,21,97,213]);var QB=new Uint8Array([23,183,248,55,96,216,172,96]);function dV(){return V0([["discriminator",E0(b0(),8)],["virtualTokenReserves",L1()],["virtualSolReserves",L1()],["realTokenReserves",L1()],["realSolReserves",L1()],["tokenTotalSupply",L1()],["complete",YJ()],["creator",Y0()]])}function cV(T){return H8(T,dV())}async function k8(T,A,Q){let J=await fV(T,A,Q);return j8(J),J}async function fV(T,A,Q){let J=await V8(T,A,Q);return cV(J)}async function P2(T){let{user:A,mint:Q,tokenAmount:J,maxSolCostLamports:W,feeRecipient:$,trackVolume:G=!0,bondingCurveCreator:Y,rpc:Z,commitment:C=M1()}=T,K=_(Q),V=A.address,M=await BT(K),z=X2(),N=B6(),w=x6(),L=iY(),O=oY(V),g=_6(M,K),v=H1({owner:V,mint:K,tokenProgram:_(j0)}),p=await QZ({bondingCurve:M,providedCreator:Y,rpc:Z,commitment:C}),[d,c,[r],u,h,o,i,x]=await Promise.all([N,g,v,SJ(p),w,L,O,z]);return tY({global:d,feeRecipient:_($),mint:K,bondingCurve:M,associatedBondingCurve:c,associatedUser:r,user:A,systemProgram:_(f8),tokenProgram:_(j0),creatorVault:u,eventAuthority:h,program:_(o0),globalVolumeAccumulator:o,userVolumeAccumulator:i,feeConfig:x,feeProgram:_(OT),amount:J,maxSolCost:W,trackVolume:[G]})}async function OJ(T){let{user:A,mint:Q,tokenAmount:J,minSolOutputLamports:W,feeRecipient:$,bondingCurveCreator:G,rpc:Y,commitment:Z=M1()}=T,C=_(Q),K=A.address,V=await BT(C),M=B6(),z=_6(V,C),N=H1({owner:K,mint:C,tokenProgram:_(j0)}),w=X2(),L=x6(),O=await QZ({bondingCurve:V,providedCreator:G,rpc:Y,commitment:Z}),[g,v,[p],d,c,r]=await Promise.all([M,z,N,SJ(O),L,w]);return TZ({global:g,feeRecipient:_($),mint:C,bondingCurve:V,associatedBondingCurve:v,associatedUser:p,user:A,systemProgram:_(f8),creatorVault:d,tokenProgram:_(j0),eventAuthority:c,program:_(o0),feeConfig:r,feeProgram:_(OT),amount:J,minSolOutput:W})}async function AZ(T){let{user:A,mint:Q,mintAuthority:J,name:W,symbol:$,uri:G,creator:Y}=T,Z=Q.address,C=Y?_(Y):A.address,K=await B6(),V=await BT(Z),M=await _6(V,Z),[z]=await R1({programAddress:_("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),seeds:[new TextEncoder().encode("metadata"),_("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),Z]}),N=await x6();return eY({mint:Q,mintAuthority:_(J),bondingCurve:V,associatedBondingCurve:M,global:K,mplTokenMetadata:_("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),metadata:z,user:A,systemProgram:_(f8),tokenProgram:_(j0),associatedTokenProgram:_("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"),rent:_("SysvarRent111111111111111111111111111111111"),eventAuthority:N,program:_(o0),name:W,symbol:$,uri:G,creator:C})}async function QZ(T){let{bondingCurve:A,providedCreator:Q,rpc:J,commitment:W}=T;if(Q)return _(Q);try{return(await k8(J,A,{commitment:W})).data.creator}catch($){throw Error("Unable to resolve bonding curve creator. Provide `bondingCurveCreator` or configure an RPC endpoint with access to the bonding curve account.",{cause:$})}}var _T="CebN5WGQ4jvEPvsVU4EoHEpgzq1VV7AbicfhtW4xC9iM";var JT=50,iT=(T,A=50)=>T+T*BigInt(A)/10000n,n8=(T,A=50)=>T-T*BigInt(A)/10000n;function WT(T){if(T<0)throw Error("Slippage cannot be negative");if(T>1e4)throw Error("Slippage cannot exceed 100%")}function rV(T){if(T<0||T>100)throw Error("Percent must be between 0 and 100");return Math.round(T*100)}function nV(T){return T/100}var iV=1000000000n;function xT(T){if(!Number.isFinite(T)||T<0)throw Error("SOL value must be a non-negative finite number");return BigInt(Math.round(T*Number(iV)))}function i8(T,A){if(!Number.isInteger(A)||A<0)throw Error("Token decimals must be a non-negative integer");let Q=BigInt(10)**BigInt(A);return BigInt(Math.round(T*10**A))}async function oV(T){let{user:A,mint:Q,tokenAmount:J,estimatedSolCostSol:W,slippageBps:$=JT,feeRecipient:G=_T,bondingCurveCreator:Y,trackVolume:Z=!0,rpc:C,commitment:K=M1()}=T;if(WT($),J<=0n)throw Error("Token amount must be positive");if(!Number.isFinite(W)||W<=0)throw Error("Estimated SOL cost must be a positive number");let V=xT(W),M=iT(V,$);return await P2({user:A,mint:Q,tokenAmount:J,maxSolCostLamports:M,feeRecipient:G,trackVolume:Z,bondingCurveCreator:Y,rpc:C,commitment:K})}async function BJ(T){let{user:A,mint:Q,tokenAmount:J,maxSolCostSol:W,maxSolCostLamports:$,feeRecipient:G=_T,trackVolume:Y=!0,bondingCurveCreator:Z,rpc:C,commitment:K=M1()}=T;if(J<=0n)throw Error("Token amount must be positive");let V=null;if($!==void 0){if($<=0n)throw Error("Max SOL cost lamports must be positive");V=$}else if(W!==void 0){if(!Number.isFinite(W)||W<=0)throw Error("Max SOL cost must be a positive number");V=xT(W)}if(V===null)throw Error("Provide either maxSolCostLamports or maxSolCostSol when calling buySimple");return await P2({user:A,mint:Q,tokenAmount:J,maxSolCostLamports:V,feeRecipient:G,trackVolume:Y,bondingCurveCreator:Z,rpc:C,commitment:K})}var JZ=6;async function aV(T){let{user:A,mint:Q,tokenAmount:J,estimatedSolOutSol:W,slippageBps:$=JT,feeRecipient:G=_T,bondingCurveCreator:Y,rpc:Z,commitment:C}=T;if(WT($),!Number.isFinite(J)||J<=0)throw Error("Token amount must be a positive number");if(!Number.isFinite(W)||W<0)throw Error("Estimated SOL output cannot be negative");let K=i8(J,JZ),V=xT(W),M=n8(V,$);return await OJ({user:A,mint:Q,tokenAmount:K,minSolOutputLamports:M,feeRecipient:G,bondingCurveCreator:Y,rpc:Z,commitment:C})}async function _J(T){let{user:A,mint:Q,tokenAmount:J,tokenAmountRaw:W,minSolOutputSol:$,minSolOutputLamports:G,feeRecipient:Y=_T,bondingCurveCreator:Z,rpc:C,commitment:K}=T,V=null;if(W!==void 0){if(W<=0n)throw Error("Token amount lamports must be positive");V=W}else if(J!==void 0){if(!Number.isFinite(J)||J<=0)throw Error("Token amount must be a positive number");V=i8(J,JZ)}if(V===null)throw Error("Provide either tokenAmountRaw or tokenAmount when calling sellSimple");let M=null;if(G!==void 0){if(G<0n)throw Error("Min SOL output lamports cannot be negative");M=G}else if($!==void 0){if(!Number.isFinite($)||$<0)throw Error("Min SOL output cannot be negative");M=xT($)}if(M===null)throw Error("Provide either minSolOutputLamports or minSolOutputSol when calling sellSimple");return await OJ({user:A,mint:Q,tokenAmount:V,minSolOutputLamports:M,feeRecipient:Y,bondingCurveCreator:Z,rpc:C,commitment:K})}LA();var s8=typeof globalThis==="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function sT(T){return T instanceof Uint8Array||ArrayBuffer.isView(T)&&T.constructor.name==="Uint8Array"}function F8(T){if(!Number.isSafeInteger(T)||T<0)throw Error("positive integer expected, got "+T)}function I0(T,...A){if(!sT(T))throw Error("Uint8Array expected");if(A.length>0&&!A.includes(T.length))throw Error("Uint8Array expected of length "+A+", got length="+T.length)}function y6(T){if(typeof T!=="function"||typeof T.create!=="function")throw Error("Hash should be wrapped by utils.createHasher");F8(T.outputLen),F8(T.blockLen)}function tT(T,A=!0){if(T.destroyed)throw Error("Hash instance has been destroyed");if(A&&T.finished)throw Error("Hash#digest() has already been called")}function b6(T,A){I0(T);let Q=A.outputLen;if(T.length<Q)throw Error("digestInto() expects output buffer of length at least "+Q)}function SZ(T){return new Uint32Array(T.buffer,T.byteOffset,Math.floor(T.byteLength/4))}function KT(...T){for(let A=0;A<T.length;A++)T[A].fill(0)}function p6(T){return new DataView(T.buffer,T.byteOffset,T.byteLength)}function RT(T,A){return T<<32-A|T>>>A}var v5=(()=>new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68)();function y5(T){return T<<24&4278190080|T<<8&16711680|T>>>8&65280|T>>>24&255}function b5(T){for(let A=0;A<T.length;A++)T[A]=y5(T[A]);return T}var uJ=v5?(T)=>T:b5,LZ=(()=>typeof Uint8Array.from([]).toHex==="function"&&typeof Uint8Array.fromHex==="function")(),p5=Array.from({length:256},(T,A)=>A.toString(16).padStart(2,"0"));function CT(T){if(I0(T),LZ)return T.toHex();let A="";for(let Q=0;Q<T.length;Q++)A+=p5[T[Q]];return A}var aT={_0:48,_9:57,A:65,F:70,a:97,f:102};function IZ(T){if(T>=aT._0&&T<=aT._9)return T-aT._0;if(T>=aT.A&&T<=aT.F)return T-(aT.A-10);if(T>=aT.a&&T<=aT.f)return T-(aT.a-10);return}function t8(T){if(typeof T!=="string")throw Error("hex string expected, got "+typeof T);if(LZ)return Uint8Array.fromHex(T);let A=T.length,Q=A/2;if(A%2)throw Error("hex string expected, got unpadded hex of length "+A);let J=new Uint8Array(Q);for(let W=0,$=0;W<Q;W++,$+=2){let G=IZ(T.charCodeAt($)),Y=IZ(T.charCodeAt($+1));if(G===void 0||Y===void 0){let Z=T[$]+T[$+1];throw Error('hex string expected, got non-hex character "'+Z+'" at index '+$)}J[W]=G*16+Y}return J}function dJ(T){if(typeof T!=="string")throw Error("string expected");return new Uint8Array(new TextEncoder().encode(T))}function e8(T){if(typeof T==="string")T=dJ(T);return I0(T),T}function l0(...T){let A=0;for(let J=0;J<T.length;J++){let W=T[J];I0(W),A+=W.length}let Q=new Uint8Array(A);for(let J=0,W=0;J<T.length;J++){let $=T[J];Q.set($,W),W+=$.length}return Q}class TA{}function C2(T){let A=(J)=>T().update(e8(J)).digest(),Q=T();return A.outputLen=Q.outputLen,A.blockLen=Q.blockLen,A.create=()=>T(),A}function wA(T=32){if(s8&&typeof s8.getRandomValues==="function")return s8.getRandomValues(new Uint8Array(T));if(s8&&typeof s8.randomBytes==="function")return Uint8Array.from(s8.randomBytes(T));throw Error("crypto.getRandomValues must be defined")}function l5(T,A,Q,J){if(typeof T.setBigUint64==="function")return T.setBigUint64(A,Q,J);let W=BigInt(32),$=BigInt(4294967295),G=Number(Q>>W&$),Y=Number(Q&$),Z=J?4:0,C=J?0:4;T.setUint32(A+Z,G,J),T.setUint32(A+C,Y,J)}function wZ(T,A,Q){return T&A^~T&Q}function EZ(T,A,Q){return T&A^T&Q^A&Q}class l6 extends TA{constructor(T,A,Q,J){super();this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=T,this.outputLen=A,this.padOffset=Q,this.isLE=J,this.buffer=new Uint8Array(T),this.view=p6(this.buffer)}update(T){tT(this),T=e8(T),I0(T);let{view:A,buffer:Q,blockLen:J}=this,W=T.length;for(let $=0;$<W;){let G=Math.min(J-this.pos,W-$);if(G===J){let Y=p6(T);for(;J<=W-$;$+=J)this.process(Y,$);continue}if(Q.set(T.subarray($,$+G),this.pos),this.pos+=G,$+=G,this.pos===J)this.process(A,0),this.pos=0}return this.length+=T.length,this.roundClean(),this}digestInto(T){tT(this),b6(T,this),this.finished=!0;let{buffer:A,view:Q,blockLen:J,isLE:W}=this,{pos:$}=this;if(A[$++]=128,KT(this.buffer.subarray($)),this.padOffset>J-$)this.process(Q,0),$=0;for(let K=$;K<J;K++)A[K]=0;l5(Q,J-8,BigInt(this.length*8),W),this.process(Q,0);let G=p6(T),Y=this.outputLen;if(Y%4)throw Error("_sha2: outputLen should be aligned to 32bit");let Z=Y/4,C=this.get();if(Z>C.length)throw Error("_sha2: outputLen bigger than state");for(let K=0;K<Z;K++)G.setUint32(4*K,C[K],W)}digest(){let{buffer:T,outputLen:A}=this;this.digestInto(T);let Q=T.slice(0,A);return this.destroy(),Q}_cloneInto(T){T||(T=new this.constructor),T.set(...this.get());let{blockLen:A,buffer:Q,length:J,finished:W,destroyed:$,pos:G}=this;if(T.destroyed=$,T.finished=W,T.length=J,T.pos=G,J%A)T.buffer.set(Q);return T}clone(){return this._cloneInto()}}var eT=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);var S0=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]);var u6=BigInt(4294967295),OZ=BigInt(32);function u5(T,A=!1){if(A)return{h:Number(T&u6),l:Number(T>>OZ&u6)};return{h:Number(T>>OZ&u6)|0,l:Number(T&u6)|0}}function d6(T,A=!1){let Q=T.length,J=new Uint32Array(Q),W=new Uint32Array(Q);for(let $=0;$<Q;$++){let{h:G,l:Y}=u5(T[$],A);[J[$],W[$]]=[G,Y]}return[J,W]}var cJ=(T,A,Q)=>T>>>Q,fJ=(T,A,Q)=>T<<32-Q|A>>>Q,AA=(T,A,Q)=>T>>>Q|A<<32-Q,QA=(T,A,Q)=>T<<32-Q|A>>>Q,H2=(T,A,Q)=>T<<64-Q|A>>>Q-32,V2=(T,A,Q)=>T>>>Q-32|A<<64-Q;var BZ=(T,A,Q)=>T<<Q|A>>>32-Q,_Z=(T,A,Q)=>A<<Q|T>>>32-Q,xZ=(T,A,Q)=>A<<Q-32|T>>>64-Q,hZ=(T,A,Q)=>T<<Q-32|A>>>64-Q;function mT(T,A,Q,J){let W=(A>>>0)+(J>>>0);return{h:T+Q+(W/4294967296|0)|0,l:W|0}}var gZ=(T,A,Q)=>(T>>>0)+(A>>>0)+(Q>>>0),mZ=(T,A,Q,J)=>A+Q+J+(T/4294967296|0)|0,vZ=(T,A,Q,J)=>(T>>>0)+(A>>>0)+(Q>>>0)+(J>>>0),yZ=(T,A,Q,J,W)=>A+Q+J+W+(T/4294967296|0)|0,bZ=(T,A,Q,J,W)=>(T>>>0)+(A>>>0)+(Q>>>0)+(J>>>0)+(W>>>0),pZ=(T,A,Q,J,W,$)=>A+Q+J+W+$+(T/4294967296|0)|0;var c5=Uint32Array.from([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]),N8=new Uint32Array(64);class rJ extends l6{constructor(T=32){super(64,T,8,!1);this.A=eT[0]|0,this.B=eT[1]|0,this.C=eT[2]|0,this.D=eT[3]|0,this.E=eT[4]|0,this.F=eT[5]|0,this.G=eT[6]|0,this.H=eT[7]|0}get(){let{A:T,B:A,C:Q,D:J,E:W,F:$,G,H:Y}=this;return[T,A,Q,J,W,$,G,Y]}set(T,A,Q,J,W,$,G,Y){this.A=T|0,this.B=A|0,this.C=Q|0,this.D=J|0,this.E=W|0,this.F=$|0,this.G=G|0,this.H=Y|0}process(T,A){for(let K=0;K<16;K++,A+=4)N8[K]=T.getUint32(A,!1);for(let K=16;K<64;K++){let V=N8[K-15],M=N8[K-2],z=RT(V,7)^RT(V,18)^V>>>3,N=RT(M,17)^RT(M,19)^M>>>10;N8[K]=N+N8[K-7]+z+N8[K-16]|0}let{A:Q,B:J,C:W,D:$,E:G,F:Y,G:Z,H:C}=this;for(let K=0;K<64;K++){let V=RT(G,6)^RT(G,11)^RT(G,25),M=C+V+wZ(G,Y,Z)+c5[K]+N8[K]|0,N=(RT(Q,2)^RT(Q,13)^RT(Q,22))+EZ(Q,J,W)|0;C=Z,Z=Y,Y=G,G=$+M|0,$=W,W=J,J=Q,Q=M+N|0}Q=Q+this.A|0,J=J+this.B|0,W=W+this.C|0,$=$+this.D|0,G=G+this.E|0,Y=Y+this.F|0,Z=Z+this.G|0,C=C+this.H|0,this.set(Q,J,W,$,G,Y,Z,C)}roundClean(){KT(N8)}destroy(){this.set(0,0,0,0,0,0,0,0),KT(this.buffer)}}var lZ=(()=>d6(["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))))(),f5=(()=>lZ[0])(),r5=(()=>lZ[1])(),I8=new Uint32Array(80),S8=new Uint32Array(80);class uZ extends l6{constructor(T=64){super(128,T,16,!1);this.Ah=S0[0]|0,this.Al=S0[1]|0,this.Bh=S0[2]|0,this.Bl=S0[3]|0,this.Ch=S0[4]|0,this.Cl=S0[5]|0,this.Dh=S0[6]|0,this.Dl=S0[7]|0,this.Eh=S0[8]|0,this.El=S0[9]|0,this.Fh=S0[10]|0,this.Fl=S0[11]|0,this.Gh=S0[12]|0,this.Gl=S0[13]|0,this.Hh=S0[14]|0,this.Hl=S0[15]|0}get(){let{Ah:T,Al:A,Bh:Q,Bl:J,Ch:W,Cl:$,Dh:G,Dl:Y,Eh:Z,El:C,Fh:K,Fl:V,Gh:M,Gl:z,Hh:N,Hl:w}=this;return[T,A,Q,J,W,$,G,Y,Z,C,K,V,M,z,N,w]}set(T,A,Q,J,W,$,G,Y,Z,C,K,V,M,z,N,w){this.Ah=T|0,this.Al=A|0,this.Bh=Q|0,this.Bl=J|0,this.Ch=W|0,this.Cl=$|0,this.Dh=G|0,this.Dl=Y|0,this.Eh=Z|0,this.El=C|0,this.Fh=K|0,this.Fl=V|0,this.Gh=M|0,this.Gl=z|0,this.Hh=N|0,this.Hl=w|0}process(T,A){for(let g=0;g<16;g++,A+=4)I8[g]=T.getUint32(A),S8[g]=T.getUint32(A+=4);for(let g=16;g<80;g++){let v=I8[g-15]|0,p=S8[g-15]|0,d=AA(v,p,1)^AA(v,p,8)^cJ(v,p,7),c=QA(v,p,1)^QA(v,p,8)^fJ(v,p,7),r=I8[g-2]|0,u=S8[g-2]|0,h=AA(r,u,19)^H2(r,u,61)^cJ(r,u,6),o=QA(r,u,19)^V2(r,u,61)^fJ(r,u,6),i=vZ(c,o,S8[g-7],S8[g-16]),x=yZ(i,d,h,I8[g-7],I8[g-16]);I8[g]=x|0,S8[g]=i|0}let{Ah:Q,Al:J,Bh:W,Bl:$,Ch:G,Cl:Y,Dh:Z,Dl:C,Eh:K,El:V,Fh:M,Fl:z,Gh:N,Gl:w,Hh:L,Hl:O}=this;for(let g=0;g<80;g++){let v=AA(K,V,14)^AA(K,V,18)^H2(K,V,41),p=QA(K,V,14)^QA(K,V,18)^V2(K,V,41),d=K&M^~K&N,c=V&z^~V&w,r=bZ(O,p,c,r5[g],S8[g]),u=pZ(r,L,v,d,f5[g],I8[g]),h=r|0,o=AA(Q,J,28)^H2(Q,J,34)^H2(Q,J,39),i=QA(Q,J,28)^V2(Q,J,34)^V2(Q,J,39),x=Q&W^Q&G^W&G,R=J&$^J&Y^$&Y;L=N|0,O=w|0,N=M|0,w=z|0,M=K|0,z=V|0,{h:K,l:V}=mT(Z|0,C|0,u|0,h|0),Z=G|0,C=Y|0,G=W|0,Y=$|0,W=Q|0,$=J|0;let U=gZ(h,i,R);Q=mZ(U,u,o,x),J=U|0}({h:Q,l:J}=mT(this.Ah|0,this.Al|0,Q|0,J|0)),{h:W,l:$}=mT(this.Bh|0,this.Bl|0,W|0,$|0),{h:G,l:Y}=mT(this.Ch|0,this.Cl|0,G|0,Y|0),{h:Z,l:C}=mT(this.Dh|0,this.Dl|0,Z|0,C|0),{h:K,l:V}=mT(this.Eh|0,this.El|0,K|0,V|0),{h:M,l:z}=mT(this.Fh|0,this.Fl|0,M|0,z|0),{h:N,l:w}=mT(this.Gh|0,this.Gl|0,N|0,w|0),{h:L,l:O}=mT(this.Hh|0,this.Hl|0,L|0,O|0),this.set(Q,J,W,$,G,Y,Z,C,K,V,M,z,N,w,L,O)}roundClean(){KT(I8,S8)}destroy(){KT(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}var c6=C2(()=>new rJ);var dZ=C2(()=>new uZ);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var oJ=BigInt(0),iJ=BigInt(1);function T8(T,A=""){if(typeof T!=="boolean"){let Q=A&&`"${A}"`;throw Error(Q+"expected boolean, got type="+typeof T)}return T}function $T(T,A,Q=""){let J=sT(T),W=T?.length,$=A!==void 0;if(!J||$&&W!==A){let G=Q&&`"${Q}" `,Y=$?` of length ${A}`:"",Z=J?`length=${W}`:`type=${typeof T}`;throw Error(G+"expected Uint8Array"+Y+", got "+Z)}return T}function j2(T){let A=T.toString(16);return A.length&1?"0"+A:A}function cZ(T){if(typeof T!=="string")throw Error("hex string expected, got "+typeof T);return T===""?oJ:BigInt("0x"+T)}function EA(T){return cZ(CT(T))}function A8(T){return I0(T),cZ(CT(Uint8Array.from(T).reverse()))}function f6(T,A){return t8(T.toString(16).padStart(A*2,"0"))}function aJ(T,A){return f6(T,A).reverse()}function q1(T,A,Q){let J;if(typeof A==="string")try{J=t8(A)}catch($){throw Error(T+" must be hex string or Uint8Array, cause: "+$)}else if(sT(A))J=Uint8Array.from(A);else throw Error(T+" must be hex string or Uint8Array");let W=J.length;if(typeof Q==="number"&&W!==Q)throw Error(T+" of length "+Q+" expected, got "+W);return J}function fZ(T,A){if(T.length!==A.length)return!1;let Q=0;for(let J=0;J<T.length;J++)Q|=T[J]^A[J];return Q===0}function sJ(T){return Uint8Array.from(T)}var nJ=(T)=>typeof T==="bigint"&&oJ<=T;function rZ(T,A,Q){return nJ(T)&&nJ(A)&&nJ(Q)&&A<=T&&T<Q}function R2(T,A,Q,J){if(!rZ(A,Q,J))throw Error("expected valid "+T+": "+Q+" <= n < "+J+", got "+A)}function r6(T){let A;for(A=0;T>oJ;T>>=iJ,A+=1);return A}var L8=(T)=>(iJ<<BigInt(T))-iJ;function nZ(T,A,Q){if(typeof T!=="number"||T<2)throw Error("hashLen must be a number");if(typeof A!=="number"||A<2)throw Error("qByteLen must be a number");if(typeof Q!=="function")throw Error("hmacFn must be a function");let J=(z)=>new Uint8Array(z),W=(z)=>Uint8Array.of(z),$=J(T),G=J(T),Y=0,Z=()=>{$.fill(1),G.fill(0),Y=0},C=(...z)=>Q(G,$,...z),K=(z=J(0))=>{if(G=C(W(0),z),$=C(),z.length===0)return;G=C(W(1),z),$=C()},V=()=>{if(Y++>=1000)throw Error("drbg: tried 1000 values");let z=0,N=[];while(z<A){$=C();let w=$.slice();N.push(w),z+=$.length}return l0(...N)};return(z,N)=>{Z(),K(z);let w=void 0;while(!(w=N(V())))K();return Z(),w}}function w8(T,A,Q={}){if(!T||typeof T!=="object")throw Error("expected valid options object");function J(W,$,G){let Y=T[W];if(G&&Y===void 0)return;let Z=typeof Y;if(Z!==$||Y===null)throw Error(`param "${W}" is invalid: expected ${$}, got ${Z}`)}Object.entries(A).forEach(([W,$])=>J(W,$,!1)),Object.entries(Q).forEach(([W,$])=>J(W,$,!0))}var tJ=()=>{throw Error("not implemented")};function OA(T){let A=new WeakMap;return(Q,...J)=>{let W=A.get(Q);if(W!==void 0)return W;let $=T(Q,...J);return A.set(Q,$),$}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var u0=BigInt(0),F0=BigInt(1),JA=BigInt(2),aZ=BigInt(3),sZ=BigInt(4),tZ=BigInt(5),n5=BigInt(7),eZ=BigInt(8),i5=BigInt(9),TX=BigInt(16);function I1(T,A){let Q=T%A;return Q>=u0?Q:A+Q}function k1(T,A,Q){let J=T;while(A-- >u0)J*=J,J%=Q;return J}function iZ(T,A){if(T===u0)throw Error("invert: expected non-zero number");if(A<=u0)throw Error("invert: expected positive modulus, got "+A);let Q=I1(T,A),J=A,W=u0,$=F0,G=F0,Y=u0;while(Q!==u0){let C=J/Q,K=J%Q,V=W-G*C,M=$-Y*C;J=Q,Q=K,W=G,$=Y,G=V,Y=M}if(J!==F0)throw Error("invert: does not exist");return I1(W,A)}function eJ(T,A,Q){if(!T.eql(T.sqr(A),Q))throw Error("Cannot find square root")}function AX(T,A){let Q=(T.ORDER+F0)/sZ,J=T.pow(A,Q);return eJ(T,J,A),J}function o5(T,A){let Q=(T.ORDER-tZ)/eZ,J=T.mul(A,JA),W=T.pow(J,Q),$=T.mul(A,W),G=T.mul(T.mul($,JA),W),Y=T.mul($,T.sub(G,T.ONE));return eJ(T,Y,A),Y}function a5(T){let A=GT(T),Q=QX(T),J=Q(A,A.neg(A.ONE)),W=Q(A,J),$=Q(A,A.neg(J)),G=(T+n5)/TX;return(Y,Z)=>{let C=Y.pow(Z,G),K=Y.mul(C,J),V=Y.mul(C,W),M=Y.mul(C,$),z=Y.eql(Y.sqr(K),Z),N=Y.eql(Y.sqr(V),Z);C=Y.cmov(C,K,z),K=Y.cmov(M,V,N);let w=Y.eql(Y.sqr(K),Z),L=Y.cmov(C,K,w);return eJ(Y,L,Z),L}}function QX(T){if(T<aZ)throw Error("sqrt is not defined for small field");let A=T-F0,Q=0;while(A%JA===u0)A/=JA,Q++;let J=JA,W=GT(T);while(oZ(W,J)===1)if(J++>1000)throw Error("Cannot find square root: probably non-prime P");if(Q===1)return AX;let $=W.pow(J,A),G=(A+F0)/JA;return function(Z,C){if(Z.is0(C))return C;if(oZ(Z,C)!==1)throw Error("Cannot find square root");let K=Q,V=Z.mul(Z.ONE,$),M=Z.pow(C,A),z=Z.pow(C,G);while(!Z.eql(M,Z.ONE)){if(Z.is0(M))return Z.ZERO;let N=1,w=Z.sqr(M);while(!Z.eql(w,Z.ONE))if(N++,w=Z.sqr(w),N===K)throw Error("Cannot find square root");let L=F0<<BigInt(K-N-1),O=Z.pow(V,L);K=N,V=Z.sqr(O),M=Z.mul(M,V),z=Z.mul(z,O)}return z}}function s5(T){if(T%sZ===aZ)return AX;if(T%eZ===tZ)return o5;if(T%TX===i5)return a5(T);return QX(T)}var Q8=(T,A)=>(I1(T,A)&F0)===F0,t5=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function TW(T){let A={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},Q=t5.reduce((J,W)=>{return J[W]="function",J},A);return w8(T,Q),T}function e5(T,A,Q){if(Q<u0)throw Error("invalid exponent, negatives unsupported");if(Q===u0)return T.ONE;if(Q===F0)return A;let J=T.ONE,W=A;while(Q>u0){if(Q&F0)J=T.mul(J,W);W=T.sqr(W),Q>>=F0}return J}function D2(T,A,Q=!1){let J=Array(A.length).fill(Q?T.ZERO:void 0),W=A.reduce((G,Y,Z)=>{if(T.is0(Y))return G;return J[Z]=G,T.mul(G,Y)},T.ONE),$=T.inv(W);return A.reduceRight((G,Y,Z)=>{if(T.is0(Y))return G;return J[Z]=T.mul(G,J[Z]),T.mul(G,Y)},$),J}function oZ(T,A){let Q=(T.ORDER-F0)/JA,J=T.pow(A,Q),W=T.eql(J,T.ONE),$=T.eql(J,T.ZERO),G=T.eql(J,T.neg(T.ONE));if(!W&&!$&&!G)throw Error("invalid Legendre symbol result");return W?1:$?0:-1}function n6(T,A){if(A!==void 0)F8(A);let Q=A!==void 0?A:T.toString(2).length,J=Math.ceil(Q/8);return{nBitLength:Q,nByteLength:J}}function GT(T,A,Q=!1,J={}){if(T<=u0)throw Error("invalid field: expected ORDER > 0, got "+T);let W=void 0,$=void 0,G=!1,Y=void 0;if(typeof A==="object"&&A!=null){if(J.sqrt||Q)throw Error("cannot specify opts in two arguments");let M=A;if(M.BITS)W=M.BITS;if(M.sqrt)$=M.sqrt;if(typeof M.isLE==="boolean")Q=M.isLE;if(typeof M.modFromBytes==="boolean")G=M.modFromBytes;Y=M.allowedLengths}else{if(typeof A==="number")W=A;if(J.sqrt)$=J.sqrt}let{nBitLength:Z,nByteLength:C}=n6(T,W);if(C>2048)throw Error("invalid field: expected ORDER of <= 2048 bytes");let K,V=Object.freeze({ORDER:T,isLE:Q,BITS:Z,BYTES:C,MASK:L8(Z),ZERO:u0,ONE:F0,allowedLengths:Y,create:(M)=>I1(M,T),isValid:(M)=>{if(typeof M!=="bigint")throw Error("invalid field element: expected bigint, got "+typeof M);return u0<=M&&M<T},is0:(M)=>M===u0,isValidNot0:(M)=>!V.is0(M)&&V.isValid(M),isOdd:(M)=>(M&F0)===F0,neg:(M)=>I1(-M,T),eql:(M,z)=>M===z,sqr:(M)=>I1(M*M,T),add:(M,z)=>I1(M+z,T),sub:(M,z)=>I1(M-z,T),mul:(M,z)=>I1(M*z,T),pow:(M,z)=>e5(V,M,z),div:(M,z)=>I1(M*iZ(z,T),T),sqrN:(M)=>M*M,addN:(M,z)=>M+z,subN:(M,z)=>M-z,mulN:(M,z)=>M*z,inv:(M)=>iZ(M,T),sqrt:$||((M)=>{if(!K)K=s5(T);return K(V,M)}),toBytes:(M)=>Q?aJ(M,C):f6(M,C),fromBytes:(M,z=!0)=>{if(Y){if(!Y.includes(M.length)||M.length>C)throw Error("Field.fromBytes: expected "+Y+" bytes, got "+M.length);let w=new Uint8Array(C);w.set(M,Q?0:w.length-M.length),M=w}if(M.length!==C)throw Error("Field.fromBytes: expected "+C+" bytes, got "+M.length);let N=Q?A8(M):EA(M);if(G)N=I1(N,T);if(!z){if(!V.isValid(N))throw Error("invalid field element: outside of range 0..ORDER")}return N},invertBatch:(M)=>D2(V,M),cmov:(M,z,N)=>N?z:M});return Object.freeze(V)}function JX(T){if(typeof T!=="bigint")throw Error("field order must be bigint");let A=T.toString(2).length;return Math.ceil(A/8)}function AW(T){let A=JX(T);return A+Math.ceil(A/2)}function QW(T,A,Q=!1){let J=T.length,W=JX(A),$=AW(A);if(J<16||J<$||J>1024)throw Error("expected "+$+"-1024 bytes of input, got "+J);let G=Q?A8(T):EA(T),Y=I1(G,A-F0)+F0;return Q?aJ(Y,W):f6(Y,W)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var BA=BigInt(0),WA=BigInt(1);function M2(T,A){let Q=A.negate();return T?Q:A}function J8(T,A){let Q=D2(T.Fp,A.map((J)=>J.Z));return A.map((J,W)=>T.fromAffine(J.toAffine(Q[W])))}function UX(T,A){if(!Number.isSafeInteger(T)||T<=0||T>A)throw Error("invalid window size, expected [1.."+A+"], got W="+T)}function JW(T,A){UX(T,A);let Q=Math.ceil(A/T)+1,J=2**(T-1),W=2**T,$=L8(T),G=BigInt(T);return{windows:Q,windowSize:J,mask:$,maxNumber:W,shiftBy:G}}function WX(T,A,Q){let{windowSize:J,mask:W,maxNumber:$,shiftBy:G}=Q,Y=Number(T&W),Z=T>>G;if(Y>J)Y-=$,Z+=WA;let C=A*J,K=C+Math.abs(Y)-1,V=Y===0,M=Y<0,z=A%2!==0;return{nextN:Z,offset:K,isZero:V,isNeg:M,isNegF:z,offsetF:C}}function Tj(T,A){if(!Array.isArray(T))throw Error("array expected");T.forEach((Q,J)=>{if(!(Q instanceof A))throw Error("invalid point at index "+J)})}function Aj(T,A){if(!Array.isArray(T))throw Error("array of scalars expected");T.forEach((Q,J)=>{if(!A.isValid(Q))throw Error("invalid scalar at index "+J)})}var WW=new WeakMap,YX=new WeakMap;function $W(T){return YX.get(T)||1}function $X(T){if(T!==BA)throw Error("invalid wNAF")}class k2{constructor(T,A){this.BASE=T.BASE,this.ZERO=T.ZERO,this.Fn=T.Fn,this.bits=A}_unsafeLadder(T,A,Q=this.ZERO){let J=T;while(A>BA){if(A&WA)Q=Q.add(J);J=J.double(),A>>=WA}return Q}precomputeWindow(T,A){let{windows:Q,windowSize:J}=JW(A,this.bits),W=[],$=T,G=$;for(let Y=0;Y<Q;Y++){G=$,W.push(G);for(let Z=1;Z<J;Z++)G=G.add($),W.push(G);$=G.double()}return W}wNAF(T,A,Q){if(!this.Fn.isValid(Q))throw Error("invalid scalar");let J=this.ZERO,W=this.BASE,$=JW(T,this.bits);for(let G=0;G<$.windows;G++){let{nextN:Y,offset:Z,isZero:C,isNeg:K,isNegF:V,offsetF:M}=WX(Q,G,$);if(Q=Y,C)W=W.add(M2(V,A[M]));else J=J.add(M2(K,A[Z]))}return $X(Q),{p:J,f:W}}wNAFUnsafe(T,A,Q,J=this.ZERO){let W=JW(T,this.bits);for(let $=0;$<W.windows;$++){if(Q===BA)break;let{nextN:G,offset:Y,isZero:Z,isNeg:C}=WX(Q,$,W);if(Q=G,Z)continue;else{let K=A[Y];J=J.add(C?K.negate():K)}}return $X(Q),J}getPrecomputes(T,A,Q){let J=WW.get(A);if(!J){if(J=this.precomputeWindow(A,T),T!==1){if(typeof Q==="function")J=Q(J);WW.set(A,J)}}return J}cached(T,A,Q){let J=$W(T);return this.wNAF(J,this.getPrecomputes(J,T,Q),A)}unsafe(T,A,Q,J){let W=$W(T);if(W===1)return this._unsafeLadder(T,A,J);return this.wNAFUnsafe(W,this.getPrecomputes(W,T,Q),A,J)}createCache(T,A){UX(A,this.bits),YX.set(T,A),WW.delete(T)}hasCache(T){return $W(T)!==1}}function ZX(T,A,Q,J){let W=A,$=T.ZERO,G=T.ZERO;while(Q>BA||J>BA){if(Q&WA)$=$.add(W);if(J&WA)G=G.add(W);W=W.double(),Q>>=WA,J>>=WA}return{p1:$,p2:G}}function _A(T,A,Q,J){Tj(Q,T),Aj(J,A);let W=Q.length,$=J.length;if(W!==$)throw Error("arrays of points and scalars must have equal length");let G=T.ZERO,Y=r6(BigInt(W)),Z=1;if(Y>12)Z=Y-3;else if(Y>4)Z=Y-2;else if(Y>0)Z=2;let C=L8(Z),K=Array(Number(C)+1).fill(G),V=Math.floor((A.BITS-1)/Z)*Z,M=G;for(let z=V;z>=0;z-=Z){K.fill(G);for(let w=0;w<$;w++){let L=J[w],O=Number(L>>BigInt(z)&C);K[O]=K[O].add(Q[w])}let N=G;for(let w=K.length-1,L=G;w>0;w--)L=L.add(K[w]),N=N.add(L);if(M=M.add(N),z!==0)for(let w=0;w<Z;w++)M=M.double()}return M}function GX(T,A,Q){if(A){if(A.ORDER!==T)throw Error("Field.ORDER must match order: Fp == p, Fn == n");return TW(A),A}else return GT(T,{isLE:Q})}function i6(T,A,Q={},J){if(J===void 0)J=T==="edwards";if(!A||typeof A!=="object")throw Error(`expected valid ${T} CURVE object`);for(let Z of["p","n","h"]){let C=A[Z];if(!(typeof C==="bigint"&&C>BA))throw Error(`CURVE.${Z} must be positive bigint`)}let W=GX(A.p,Q.Fp,J),$=GX(A.n,Q.Fn,J),Y=["Gx","Gy","a",T==="weierstrass"?"b":"d"];for(let Z of Y)if(!W.isValid(A[Z]))throw Error(`CURVE.${Z} must be valid field element of CURVE.Fp`);return A=Object.freeze(Object.assign({},A)),{CURVE:A,Fp:W,Fn:$}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var E8=BigInt(0),N0=BigInt(1),GW=BigInt(2),Qj=BigInt(8);function Jj(T,A,Q,J){let W=T.sqr(Q),$=T.sqr(J),G=T.add(T.mul(A.a,W),$),Y=T.add(T.ONE,T.mul(A.d,T.mul(W,$)));return T.eql(G,Y)}function Wj(T,A={}){let Q=i6("edwards",T,A,A.FpFnLE),{Fp:J,Fn:W}=Q,$=Q.CURVE,{h:G}=$;w8(A,{},{uvRatio:"function"});let Y=GW<<BigInt(W.BYTES*8)-N0,Z=(L)=>J.create(L),C=A.uvRatio||((L,O)=>{try{return{isValid:!0,value:J.sqrt(J.div(L,O))}}catch(g){return{isValid:!1,value:E8}}});if(!Jj(J,$,$.Gx,$.Gy))throw Error("bad curve params: generator point");function K(L,O,g=!1){let v=g?N0:E8;return R2("coordinate "+L,O,v,Y),O}function V(L){if(!(L instanceof N))throw Error("ExtendedPoint expected")}let M=OA((L,O)=>{let{X:g,Y:v,Z:p}=L,d=L.is0();if(O==null)O=d?Qj:J.inv(p);let c=Z(g*O),r=Z(v*O),u=J.mul(p,O);if(d)return{x:E8,y:N0};if(u!==N0)throw Error("invZ was invalid");return{x:c,y:r}}),z=OA((L)=>{let{a:O,d:g}=$;if(L.is0())throw Error("bad point: ZERO");let{X:v,Y:p,Z:d,T:c}=L,r=Z(v*v),u=Z(p*p),h=Z(d*d),o=Z(h*h),i=Z(r*O),x=Z(h*Z(i+u)),R=Z(o+Z(g*Z(r*u)));if(x!==R)throw Error("bad point: equation left != right (1)");let U=Z(v*p),X=Z(d*c);if(U!==X)throw Error("bad point: equation left != right (2)");return!0});class N{constructor(L,O,g,v){this.X=K("x",L),this.Y=K("y",O),this.Z=K("z",g,!0),this.T=K("t",v),Object.freeze(this)}static CURVE(){return $}static fromAffine(L){if(L instanceof N)throw Error("extended point not allowed");let{x:O,y:g}=L||{};return K("x",O),K("y",g),new N(O,g,N0,Z(O*g))}static fromBytes(L,O=!1){let g=J.BYTES,{a:v,d:p}=$;L=sJ($T(L,g,"point")),T8(O,"zip215");let d=sJ(L),c=L[g-1];d[g-1]=c&-129;let r=A8(d),u=O?Y:J.ORDER;R2("point.y",r,E8,u);let h=Z(r*r),o=Z(h-N0),i=Z(p*h-v),{isValid:x,value:R}=C(o,i);if(!x)throw Error("bad point: invalid y coordinate");let U=(R&N0)===N0,X=(c&128)!==0;if(!O&&R===E8&&X)throw Error("bad point: x=0 and x_0=1");if(X!==U)R=Z(-R);return N.fromAffine({x:R,y:r})}static fromHex(L,O=!1){return N.fromBytes(q1("point",L),O)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(L=8,O=!0){if(w.createCache(this,L),!O)this.multiply(GW);return this}assertValidity(){z(this)}equals(L){V(L);let{X:O,Y:g,Z:v}=this,{X:p,Y:d,Z:c}=L,r=Z(O*c),u=Z(p*v),h=Z(g*c),o=Z(d*v);return r===u&&h===o}is0(){return this.equals(N.ZERO)}negate(){return new N(Z(-this.X),this.Y,this.Z,Z(-this.T))}double(){let{a:L}=$,{X:O,Y:g,Z:v}=this,p=Z(O*O),d=Z(g*g),c=Z(GW*Z(v*v)),r=Z(L*p),u=O+g,h=Z(Z(u*u)-p-d),o=r+d,i=o-c,x=r-d,R=Z(h*i),U=Z(o*x),X=Z(h*x),q=Z(i*o);return new N(R,U,q,X)}add(L){V(L);let{a:O,d:g}=$,{X:v,Y:p,Z:d,T:c}=this,{X:r,Y:u,Z:h,T:o}=L,i=Z(v*r),x=Z(p*u),R=Z(c*g*o),U=Z(d*h),X=Z((v+p)*(r+u)-i-x),q=U-R,H=U+R,j=Z(x-O*i),F=Z(X*q),I=Z(H*j),D=Z(X*j),P=Z(q*H);return new N(F,I,P,D)}subtract(L){return this.add(L.negate())}multiply(L){if(!W.isValidNot0(L))throw Error("invalid scalar: expected 1 <= sc < curve.n");let{p:O,f:g}=w.cached(this,L,(v)=>J8(N,v));return J8(N,[O,g])[0]}multiplyUnsafe(L,O=N.ZERO){if(!W.isValid(L))throw Error("invalid scalar: expected 0 <= sc < curve.n");if(L===E8)return N.ZERO;if(this.is0()||L===N0)return this;return w.unsafe(this,L,(g)=>J8(N,g),O)}isSmallOrder(){return this.multiplyUnsafe(G).is0()}isTorsionFree(){return w.unsafe(this,$.n).is0()}toAffine(L){return M(this,L)}clearCofactor(){if(G===N0)return this;return this.multiplyUnsafe(G)}toBytes(){let{x:L,y:O}=this.toAffine(),g=J.toBytes(O);return g[g.length-1]|=L&N0?128:0,g}toHex(){return CT(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get ex(){return this.X}get ey(){return this.Y}get ez(){return this.Z}get et(){return this.T}static normalizeZ(L){return J8(N,L)}static msm(L,O){return _A(N,W,L,O)}_setWindowSize(L){this.precompute(L)}toRawBytes(){return this.toBytes()}}N.BASE=new N($.Gx,$.Gy,N0,Z($.Gx*$.Gy)),N.ZERO=new N(E8,N0,N0,E8),N.Fp=J,N.Fn=W;let w=new k2(N,W.BITS);return N.BASE.precompute(8),N}class UW{constructor(T){this.ep=T}static fromBytes(T){tJ()}static fromHex(T){tJ()}get x(){return this.toAffine().x}get y(){return this.toAffine().y}clearCofactor(){return this}assertValidity(){this.ep.assertValidity()}toAffine(T){return this.ep.toAffine(T)}toHex(){return CT(this.toBytes())}toString(){return this.toHex()}isTorsionFree(){return!0}isSmallOrder(){return!1}add(T){return this.assertSame(T),this.init(this.ep.add(T.ep))}subtract(T){return this.assertSame(T),this.init(this.ep.subtract(T.ep))}multiply(T){return this.init(this.ep.multiply(T))}multiplyUnsafe(T){return this.init(this.ep.multiplyUnsafe(T))}double(){return this.init(this.ep.double())}negate(){return this.init(this.ep.negate())}precompute(T,A){return this.init(this.ep.precompute(T,A))}toRawBytes(){return this.toBytes()}}function $j(T,A,Q={}){if(typeof A!=="function")throw Error('"hash" function param is required');w8(Q,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});let{prehash:J}=Q,{BASE:W,Fp:$,Fn:G}=T,Y=Q.randomBytes||wA,Z=Q.adjustScalarBytes||((h)=>h),C=Q.domain||((h,o,i)=>{if(T8(i,"phflag"),o.length||i)throw Error("Contexts/pre-hash are not supported");return h});function K(h){return G.create(A8(h))}function V(h){let o=v.secretKey;h=q1("private key",h,o);let i=q1("hashed private key",A(h),2*o),x=Z(i.slice(0,o)),R=i.slice(o,2*o),U=K(x);return{head:x,prefix:R,scalar:U}}function M(h){let{head:o,prefix:i,scalar:x}=V(h),R=W.multiply(x),U=R.toBytes();return{head:o,prefix:i,scalar:x,point:R,pointBytes:U}}function z(h){return M(h).pointBytes}function N(h=Uint8Array.of(),...o){let i=l0(...o);return K(A(C(i,q1("context",h),!!J)))}function w(h,o,i={}){if(h=q1("message",h),J)h=J(h);let{prefix:x,scalar:R,pointBytes:U}=M(o),X=N(i.context,x,h),q=W.multiply(X).toBytes(),H=N(i.context,q,U,h),j=G.create(X+H*R);if(!G.isValid(j))throw Error("sign failed: invalid s");let F=l0(q,G.toBytes(j));return $T(F,v.signature,"result")}let L={zip215:!0};function O(h,o,i,x=L){let{context:R,zip215:U}=x,X=v.signature;if(h=q1("signature",h,X),o=q1("message",o),i=q1("publicKey",i,v.publicKey),U!==void 0)T8(U,"zip215");if(J)o=J(o);let q=X/2,H=h.subarray(0,q),j=A8(h.subarray(q,X)),F,I,D;try{F=T.fromBytes(i,U),I=T.fromBytes(H,U),D=W.multiplyUnsafe(j)}catch(b){return!1}if(!U&&F.isSmallOrder())return!1;let P=N(R,I.toBytes(),F.toBytes(),o);return I.add(F.multiplyUnsafe(P)).subtract(D).clearCofactor().is0()}let g=$.BYTES,v={secretKey:g,publicKey:g,signature:2*g,seed:g};function p(h=Y(v.seed)){return $T(h,v.seed,"seed")}function d(h){let o=u.randomSecretKey(h);return{secretKey:o,publicKey:z(o)}}function c(h){return sT(h)&&h.length===G.BYTES}function r(h,o){try{return!!T.fromBytes(h,o)}catch(i){return!1}}let u={getExtendedPublicKey:M,randomSecretKey:p,isValidSecretKey:c,isValidPublicKey:r,toMontgomery(h){let{y:o}=T.fromBytes(h),i=v.publicKey,x=i===32;if(!x&&i!==57)throw Error("only defined for 25519 and 448");let R=x?$.div(N0+o,N0-o):$.div(o-N0,o+N0);return $.toBytes(R)},toMontgomerySecret(h){let o=v.secretKey;$T(h,o);let i=A(h.subarray(0,o));return Z(i).subarray(0,o)},randomPrivateKey:p,precompute(h=8,o=T.BASE){return o.precompute(h,!1)}};return Object.freeze({keygen:d,getPublicKey:z,sign:w,verify:O,utils:u,Point:T,lengths:v})}function Gj(T){let A={a:T.a,d:T.d,p:T.Fp.ORDER,n:T.n,h:T.h,Gx:T.Gx,Gy:T.Gy},Q=T.Fp,J=GT(A.n,T.nBitLength,!0),W={Fp:Q,Fn:J,uvRatio:T.uvRatio},$={randomBytes:T.randomBytes,adjustScalarBytes:T.adjustScalarBytes,domain:T.domain,prehash:T.prehash,mapToCurve:T.mapToCurve};return{CURVE:A,curveOpts:W,hash:T.hash,eddsaOpts:$}}function Uj(T,A){let Q=A.Point;return Object.assign({},A,{ExtendedPoint:Q,CURVE:T,nBitLength:Q.Fn.BITS,nByteLength:Q.Fn.BYTES})}function XX(T){let{CURVE:A,curveOpts:Q,hash:J,eddsaOpts:W}=Gj(T),$=Wj(A,Q),G=$j($,J,W);return Uj(T,G)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var Yj=BigInt(0),W8=BigInt(1),PX=BigInt(2),W_=BigInt(3),Zj=BigInt(5),Xj=BigInt(8),xA=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),z2=(()=>({p:xA,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:Xj,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")}))();function Pj(T){let A=BigInt(10),Q=BigInt(20),J=BigInt(40),W=BigInt(80),$=xA,Y=T*T%$*T%$,Z=k1(Y,PX,$)*Y%$,C=k1(Z,W8,$)*T%$,K=k1(C,Zj,$)*C%$,V=k1(K,A,$)*K%$,M=k1(V,Q,$)*V%$,z=k1(M,J,$)*M%$,N=k1(z,W,$)*z%$,w=k1(N,W,$)*z%$,L=k1(w,A,$)*K%$;return{pow_p_5_8:k1(L,PX,$)*T%$,b2:Y}}function qj(T){return T[0]&=248,T[31]&=127,T[31]|=64,T}var YW=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function PW(T,A){let Q=xA,J=I1(A*A*A,Q),W=I1(J*J*A,Q),$=Pj(T*W).pow_p_5_8,G=I1(T*J*$,Q),Y=I1(A*G*G,Q),Z=G,C=I1(G*YW,Q),K=Y===T,V=Y===I1(-T,Q),M=Y===I1(-T*YW,Q);if(K)G=Z;if(V||M)G=C;if(Q8(G,Q))G=I1(-G,Q);return{isValid:K||V,value:G}}var O8=(()=>GT(z2.p,{isLE:!0}))(),Kj=(()=>GT(z2.n,{isLE:!0}))(),Cj=(()=>({...z2,Fp:O8,hash:dZ,adjustScalarBytes:qj,uvRatio:PW}))(),s0=(()=>XX(Cj))();var ZW=YW,Hj=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),Vj=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),jj=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),Rj=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),qX=(T)=>PW(W8,T),Dj=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),XW=(T)=>s0.Point.Fp.create(A8(T)&Dj);function KX(T){let{d:A}=z2,Q=xA,J=(O)=>O8.create(O),W=J(ZW*T*T),$=J((W+W8)*jj),G=BigInt(-1),Y=J((G-A*W)*J(W+A)),{isValid:Z,value:C}=PW($,Y),K=J(C*T);if(!Q8(K,Q))K=J(-K);if(!Z)C=K;if(!Z)G=W;let V=J(G*(W-W8)*Rj-Y),M=C*C,z=J((C+C)*Y),N=J(V*Hj),w=J(W8-M),L=J(W8+M);return new s0.Point(J(z*L),J(w*N),J(N*L),J(z*w))}function Mj(T){I0(T,64);let A=XW(T.subarray(0,32)),Q=KX(A),J=XW(T.subarray(32,64)),W=KX(J);return new d0(Q.add(W))}class d0 extends UW{constructor(T){super(T)}static fromAffine(T){return new d0(s0.Point.fromAffine(T))}assertSame(T){if(!(T instanceof d0))throw Error("RistrettoPoint expected")}init(T){return new d0(T)}static hashToCurve(T){return Mj(q1("ristrettoHash",T,64))}static fromBytes(T){I0(T,32);let{a:A,d:Q}=z2,J=xA,W=(v)=>O8.create(v),$=XW(T);if(!fZ(O8.toBytes($),T)||Q8($,J))throw Error("invalid ristretto255 encoding 1");let G=W($*$),Y=W(W8+A*G),Z=W(W8-A*G),C=W(Y*Y),K=W(Z*Z),V=W(A*Q*C-K),{isValid:M,value:z}=qX(W(V*K)),N=W(z*Z),w=W(z*N*V),L=W(($+$)*N);if(Q8(L,J))L=W(-L);let O=W(Y*w),g=W(L*O);if(!M||Q8(g,J)||O===Yj)throw Error("invalid ristretto255 encoding 2");return new d0(new s0.Point(L,O,W8,g))}static fromHex(T){return d0.fromBytes(q1("ristrettoHex",T,32))}static msm(T,A){return _A(d0,s0.Point.Fn,T,A)}toBytes(){let{X:T,Y:A,Z:Q,T:J}=this.ep,W=xA,$=(w)=>O8.create(w),G=$($(Q+A)*$(Q-A)),Y=$(T*A),Z=$(Y*Y),{value:C}=qX($(G*Z)),K=$(C*G),V=$(C*Y),M=$(K*V*J),z;if(Q8(J*M,W)){let w=$(A*ZW),L=$(T*ZW);T=w,A=L,z=$(K*Vj)}else z=V;if(Q8(T*M,W))A=$(-A);let N=$((Q-A)*z);if(Q8(N,W))N=$(-N);return O8.toBytes(N)}equals(T){this.assertSame(T);let{X:A,Y:Q}=this.ep,{X:J,Y:W}=T.ep,$=(Z)=>O8.create(Z),G=$(A*W)===$(Q*J),Y=$(Q*W)===$(A*J);return G||Y}is0(){return this.equals(d0.ZERO)}}d0.BASE=(()=>new d0(s0.Point.BASE))();d0.ZERO=(()=>new d0(s0.Point.ZERO))();d0.Fp=(()=>O8)();d0.Fn=(()=>Kj)();var D$=n0(KW(),1),e0=n0(HW(),1);var VW=c6;var cA=n0(LX(),1),S=n0(G8(),1),n9=n0(G8(),1);var GD=1,UD=2,YD=3,ZD=4,XD=5,PD=6,qD=7,KD=8,CD=9,HD=10,VD=-32700,jD=-32603,RD=-32602,DD=-32601,MD=-32600,kD=-32016,zD=-32015,FD=-32014,ND=-32013,ID=-32012,SD=-32011,LD=-32010,wD=-32009,ED=-32008,OD=-32007,BD=-32006,_D=-32005,xD=-32004,hD=-32003,gD=-32002,mD=-32001,vD=2800000,yD=2800001,bD=2800002,pD=2800003,lD=2800004,uD=2800005,dD=2800006,cD=2800007,fD=2800008,rD=2800009,nD=2800010,iD=2800011,oD=3230000,aD=32300001,sD=3230002,tD=3230003,eD=3230004,TM=3610000,AM=3610001,QM=3610002,JM=3610003,WM=3610004,$M=3610005,GM=3610006,UM=3610007,YM=3611000,ZM=3704000,XM=3704001,PM=3704002,qM=3704003,KM=3704004,CM=4128000,HM=4128001,VM=4128002,jM=4615000,RM=4615001,DM=4615002,MM=4615003,kM=4615004,zM=4615005,FM=4615006,NM=4615007,IM=4615008,SM=4615009,LM=4615010,wM=4615011,EM=4615012,OM=4615013,BM=4615014,_M=4615015,xM=4615016,hM=4615017,gM=4615018,mM=4615019,vM=4615020,yM=4615021,bM=4615022,pM=4615023,lM=4615024,uM=4615025,dM=4615026,cM=4615027,fM=4615028,rM=4615029,nM=4615030,iM=4615031,oM=4615032,aM=4615033,sM=4615034,tM=4615035,eM=4615036,Tk=4615037,Ak=4615038,Qk=4615039,Jk=4615040,Wk=4615041,$k=4615042,Gk=4615043,Uk=4615044,Yk=4615045,Zk=4615046,Xk=4615047,Pk=4615048,qk=4615049,Kk=4615050,Ck=4615051,Hk=4615052,Vk=4615053,jk=4615054,Rk=5508000,Dk=5508001,Mk=5508002,kk=5508003,zk=5508004,Fk=5508005,Nk=5508006,Ik=5508007,Sk=5508008,Lk=5508009,wk=5508010,Ek=5508011,Ok=5663000,Bk=5663001,_k=5663002,xk=5663003,hk=5663004,gk=5663005,mk=5663006,vk=5663007,yk=5663008,bk=5663009,pk=5663010,lk=5663011,uk=5663012,dk=5663013,ck=5663014,fk=5663015,rk=5663016,nk=5663017,ik=5663018,ok=5663019,ak=5663020,sk=7050000,tk=7050001,ek=7050002,Tz=7050003,Az=7050004,Qz=7050005,Jz=7050006,Wz=7050007,$z=7050008,Gz=7050009,Uz=7050010,Yz=7050011,Zz=7050012,Xz=7050013,Pz=7050014,qz=7050015,Kz=7050016,Cz=7050017,Hz=7050018,Vz=7050019,jz=7050020,Rz=7050021,Dz=7050022,Mz=7050023,kz=7050024,zz=7050025,Fz=7050026,Nz=7050027,Iz=7050028,Sz=7050029,Lz=7050030,wz=7050031,Ez=7050032,Oz=7050033,Bz=7050034,_z=7050035,xz=7050036,uW=8078000,dW=8078001,BX=8078002,_X=8078003,cW=8078004,fW=8078005,rW=8078006,hz=8078007,gz=8078008,mz=8078009,vz=8078010,nW=8078011,yz=8078012,xX=8078013,hX=8078014,bz=8078015,pz=8078016,lz=8078017,uz=8078018,dz=8078019,gX=8078020,mX=8078021,cz=8078022,fz=8100000,rz=8100001,nz=8100002,iz=8100003,oz=8190000,az=8190001,sz=8190002,tz=8190003,ez=8190004,TF=9900000,AF=9900001,QF=9900002,JF=9900003,WF=9900004;var $F={[oD]:"Account not found at address: $address",[eD]:"Not all accounts were decoded. Encoded accounts found at addresses: $addresses.",[tD]:"Expected decoded account at address: $address",[sD]:"Failed to decode account data at address: $address",[aD]:"Accounts not found at addresses: $addresses",[rD]:"Unable to find a viable program address bump seed.",[bD]:"$putativeAddress is not a base58-encoded address.",[vD]:"Expected base58 encoded address to decode to a byte array of length 32. Actual length: $actualLength.",[pD]:"The `CryptoKey` must be an `Ed25519` public key.",[iD]:"$putativeOffCurveAddress is not a base58-encoded off-curve address.",[fD]:"Invalid seeds; point must fall off the Ed25519 curve.",[lD]:"Expected given program derived address to have the following format: [Address, ProgramDerivedAddressBump].",[dD]:"A maximum of $maxSeeds seeds, including the bump seed, may be supplied when creating an address. Received: $actual.",[cD]:"The seed at index $index with length $actual exceeds the maximum length of $maxSeedLength bytes.",[uD]:"Expected program derived address bump to be in the range [0, 255], got: $bump.",[nD]:"Program address cannot end with PDA marker.",[yD]:"Expected base58-encoded address string of length in the range [32, 44]. Actual length: $actualLength.",[ZD]:"Expected base58-encoded blockash string of length in the range [32, 44]. Actual length: $actualLength.",[GD]:"The network has progressed past the last block for which this transaction could have been committed.",[uW]:"Codec [$codecDescription] cannot decode empty byte arrays.",[cz]:"Enum codec cannot use lexical values [$stringValues] as discriminators. Either remove all lexical values or set `useValuesAsDiscriminators` to `false`.",[gX]:"Sentinel [$hexSentinel] must not be present in encoded bytes [$hexEncodedBytes].",[fW]:"Encoder and decoder must have the same fixed size, got [$encoderFixedSize] and [$decoderFixedSize].",[rW]:"Encoder and decoder must have the same max size, got [$encoderMaxSize] and [$decoderMaxSize].",[cW]:"Encoder and decoder must either both be fixed-size or variable-size.",[gz]:"Enum discriminator out of range. Expected a number in [$formattedValidDiscriminators], got $discriminator.",[BX]:"Expected a fixed-size codec, got a variable-size one.",[xX]:"Codec [$codecDescription] expected a positive byte length, got $bytesLength.",[_X]:"Expected a variable-size codec, got a fixed-size one.",[dz]:"Codec [$codecDescription] expected zero-value [$hexZeroValue] to have the same size as the provided fixed-size item [$expectedSize bytes].",[dW]:"Codec [$codecDescription] expected $expected bytes, got $bytesLength.",[uz]:"Expected byte array constant [$hexConstant] to be present in data [$hexData] at offset [$offset].",[mz]:"Invalid discriminated union variant. Expected one of [$variants], got $value.",[vz]:"Invalid enum variant. Expected one of [$stringValues] or a number in [$formattedNumericalValues], got $variant.",[bz]:"Invalid literal union variant. Expected one of [$variants], got $value.",[hz]:"Expected [$codecDescription] to have $expected items, got $actual.",[yz]:"Invalid value $value for base $base with alphabet $alphabet.",[pz]:"Literal union discriminator out of range. Expected a number between $minRange and $maxRange, got $discriminator.",[nW]:"Codec [$codecDescription] expected number to be in the range [$min, $max], got $value.",[hX]:"Codec [$codecDescription] expected offset to be in the range [0, $bytesLength], got $offset.",[mX]:"Expected sentinel [$hexSentinel] to be present in decoded bytes [$hexDecodedBytes].",[lz]:"Union variant out of range. Expected an index between $minRange and $maxRange, got $variant.",[YM]:"No random values implementation could be found.",[SM]:"instruction requires an uninitialized account",[pM]:"instruction tries to borrow reference for an account which is already borrowed",[lM]:"instruction left account with an outstanding borrowed reference",[yM]:"program other than the account's owner changed the size of the account data",[zM]:"account data too small for instruction",[bM]:"instruction expected an executable account",[Zk]:"An account does not have enough lamports to be rent-exempt",[Pk]:"Program arithmetic overflowed",[Yk]:"Failed to serialize or deserialize account data: $encodedData",[jk]:"Builtin programs must consume compute units",[oM]:"Cross-program invocation call depth too deep",[Ak]:"Computational budget exceeded",[dM]:"custom program error: #$code",[hM]:"instruction contains duplicate accounts",[uM]:"instruction modifications of multiply-passed account differ",[nM]:"executable accounts must be rent exempt",[fM]:"instruction changed executable accounts data",[rM]:"instruction changed the balance of an executable account",[gM]:"instruction changed executable bit of an account",[BM]:"instruction modified data of an account it does not own",[OM]:"instruction spent from the balance of an account it does not own",[RM]:"generic instruction error",[Kk]:"Provided owner is not allowed",[Gk]:"Account is immutable",[Uk]:"Incorrect authority provided",[NM]:"incorrect program id for instruction",[FM]:"insufficient funds for instruction",[kM]:"invalid account data for instruction",[Xk]:"Invalid account owner",[DM]:"invalid program argument",[cM]:"program returned invalid error code",[MM]:"invalid instruction data",[Tk]:"Failed to reallocate account data",[eM]:"Provided seeds do not result in a valid address",[Ck]:"Accounts data allocations exceeded the maximum allowed per transaction",[Hk]:"Max accounts exceeded",[Vk]:"Max instruction trace length exceeded",[tM]:"Length of the seed is too long for address generation",[aM]:"An account required by the instruction is missing",[IM]:"missing required signature for instruction",[EM]:"instruction illegally modified the program id of an account",[vM]:"insufficient account keys for instruction",[Qk]:"Cross-program invocation with unauthorized signer or writable account",[Jk]:"Failed to create program execution environment",[$k]:"Program failed to compile",[Wk]:"Program failed to complete",[xM]:"instruction modified data of a read-only account",[_M]:"instruction changed the balance of a read-only account",[sM]:"Cross-program invocation reentrancy not allowed for this instruction",[mM]:"instruction modified rent epoch of an account",[wM]:"sum of account balances before and after instruction do not match",[LM]:"instruction requires an initialized account",[jM]:"",[iM]:"Unsupported program id",[qk]:"Unsupported sysvar",[CM]:"The instruction does not have any accounts.",[HM]:"The instruction does not have any data.",[VM]:"Expected instruction to have progress address $expectedProgramAddress, got $actualProgramAddress.",[XD]:"Expected base58 encoded blockhash to decode to a byte array of length 32. Actual length: $actualLength.",[UD]:"The nonce `$expectedNonceValue` is no longer valid. It has advanced to `$actualNonceValue`",[QF]:"Invariant violation: Found no abortable iterable cache entry for key `$cacheKey`. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[WF]:"Invariant violation: This data publisher does not publish to the channel named `$channelName`. Supported channels include $supportedChannelNames.",[AF]:"Invariant violation: WebSocket message iterator state is corrupt; iterated without first resolving existing message promise. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[TF]:"Invariant violation: WebSocket message iterator is missing state storage. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[JF]:"Invariant violation: Switch statement non-exhaustive. Received unexpected value `$unexpectedValue`. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[jD]:"JSON-RPC error: Internal JSON-RPC error ($__serverMessage)",[RD]:"JSON-RPC error: Invalid method parameter(s) ($__serverMessage)",[MD]:"JSON-RPC error: The JSON sent is not a valid `Request` object ($__serverMessage)",[DD]:"JSON-RPC error: The method does not exist / is not available ($__serverMessage)",[VD]:"JSON-RPC error: An error occurred on the server while parsing the JSON text ($__serverMessage)",[ID]:"$__serverMessage",[mD]:"$__serverMessage",[xD]:"$__serverMessage",[FD]:"$__serverMessage",[LD]:"$__serverMessage",[wD]:"$__serverMessage",[kD]:"Minimum context slot has not been reached",[_D]:"Node is unhealthy; behind by $numSlotsBehind slots",[ED]:"No snapshot",[gD]:"Transaction simulation failed",[OD]:"$__serverMessage",[SD]:"Transaction history is not available from this node",[BD]:"$__serverMessage",[ND]:"Transaction signature length mismatch",[hD]:"Transaction signature verification failure",[zD]:"$__serverMessage",[ZM]:"Key pair bytes must be of length 64, got $byteLength.",[XM]:"Expected private key bytes with length 32. Actual length: $actualLength.",[PM]:"Expected base58-encoded signature to decode to a byte array of length 64. Actual length: $actualLength.",[KM]:"The provided private key does not match the provided public key.",[qM]:"Expected base58-encoded signature string of length in the range [64, 88]. Actual length: $actualLength.",[PD]:"Lamports value must be in the range [0, 2e64-1]",[qD]:"`$value` cannot be parsed as a `BigInt`",[HD]:"$message",[KD]:"`$value` cannot be parsed as a `Number`",[YD]:"No nonce account could be found at address `$nonceAccountAddress`",[oz]:"The notification name must end in 'Notifications' and the API must supply a subscription plan creator function for the notification '$notificationName'.",[sz]:"WebSocket was closed before payload could be added to the send buffer",[tz]:"WebSocket connection closed",[ez]:"WebSocket failed to connect",[az]:"Failed to obtain a subscription id from the server",[iz]:"Could not find an API plan for RPC method: `$method`",[fz]:"The $argumentLabel argument to the `$methodName` RPC method$optionalPathLabel was `$value`. This number is unsafe for use with the Solana JSON-RPC because it exceeds `Number.MAX_SAFE_INTEGER`.",[nz]:"HTTP error ($statusCode): $message",[rz]:"HTTP header(s) forbidden: $headers. Learn more at https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name.",[Rk]:"Multiple distinct signers were identified for address `$address`. Please ensure that you are using the same signer instance for each address.",[Dk]:"The provided value does not implement the `KeyPairSigner` interface",[kk]:"The provided value does not implement the `MessageModifyingSigner` interface",[zk]:"The provided value does not implement the `MessagePartialSigner` interface",[Mk]:"The provided value does not implement any of the `MessageSigner` interfaces",[Nk]:"The provided value does not implement the `TransactionModifyingSigner` interface",[Ik]:"The provided value does not implement the `TransactionPartialSigner` interface",[Sk]:"The provided value does not implement the `TransactionSendingSigner` interface",[Fk]:"The provided value does not implement any of the `TransactionSigner` interfaces",[Lk]:"More than one `TransactionSendingSigner` was identified.",[wk]:"No `TransactionSendingSigner` was identified. Please provide a valid `TransactionWithSingleSendingSigner` transaction.",[Ek]:"Wallet account signers do not support signing multiple messages/transactions in a single operation",[UM]:"Cannot export a non-extractable key.",[AM]:"No digest implementation could be found.",[TM]:"Cryptographic operations are only allowed in secure browser contexts. Read more here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts.",[QM]:`This runtime does not support the generation of Ed25519 key pairs.
|
|
10
|
+
For a list of runtimes that currently support Ed25519 operations, visit https://github.com/WICG/webcrypto-secure-curves/issues/20.`,[h4]:"No signature verification implementation could be found.",[g4]:"No key generation implementation could be found.",[m4]:"No signing implementation could be found.",[aG]:"No key export implementation could be found.",[uG]:"Timestamp value must be in the range [-(2n ** 63n), (2n ** 63n) - 1]. `$value` given",[NH]:"Transaction processing left an account with an outstanding borrowed reference",[ZH]:"Account in use",[XH]:"Account loaded twice",[PH]:"Attempt to debit an account but found no record of a prior credit.",[BH]:"Transaction loads an address table account that doesn't exist",[HH]:"This transaction has already been processed",[VH]:"Blockhash not found",[jH]:"Loader call chain is too deep",[FH]:"Transactions are currently disabled due to cluster maintenance",[RU]:"Transaction contains a duplicate instruction ($index) that is not allowed",[KH]:"Insufficient funds for fee",[DU]:"Transaction results in an account ($accountIndex) with insufficient funds for rent",[CH]:"This account may not be used to pay transaction fees",[DH]:"Transaction contains an invalid account reference",[xH]:"Transaction loads an address table account with invalid data",[hH]:"Transaction address table lookup uses an invalid index",[_H]:"Transaction loads an address table account with an invalid owner",[bH]:"LoadedAccountsDataSizeLimit set for transaction must be greater than 0.",[kH]:"This program may not be used for executing instructions",[gH]:"Transaction leaves an account with a lower balance than rent-exempt minimum",[LH]:"Transaction loads a writable account that cannot be written",[yH]:"Transaction exceeded max loaded accounts data size cap",[RH]:"Transaction requires a fee but has no signature present",[qH]:"Attempt to load a program that does not exist",[MU]:"Execution of the program referenced by account at index $accountIndex is temporarily restricted.",[pH]:"ResanitizationNeeded",[zH]:"Transaction failed to sanitize accounts offsets correctly",[MH]:"Transaction did not pass signature verification",[OH]:"Transaction locked too many accounts",[lH]:"Sum of account balances before and after transaction do not match",[jU]:"The transaction failed with the error `$errorName`",[SH]:"Transaction version is unsupported",[EH]:"Transaction would exceed account data limit within the block",[vH]:"Transaction would exceed total account data limit",[wH]:"Transaction would exceed max account limit within the block",[IH]:"Transaction would exceed max Block Cost Limit",[mH]:"Transaction would exceed max Vote Cost Limit",[c4]:"Attempted to sign a transaction with an address that is not a signer for it",[JH]:"Transaction is missing an address at index: $index.",[f4]:"Transaction has no expected signers therefore it cannot be encoded",[HU]:"Transaction size $transactionSize exceeds limit of $transactionSizeLimit bytes",[b4]:"Transaction does not have a blockhash lifetime",[p4]:"Transaction is not a durable nonce transaction",[XU]:"Contents of these address lookup tables unknown: $lookupTableAddresses",[PU]:"Lookup of address at index $highestRequestedIndex failed for lookup table `$lookupTableAddress`. Highest known index is $highestKnownIndex. The lookup table may have been extended since its contents were retrieved",[KU]:"No fee payer set in CompiledTransaction",[qU]:"Could not find program address at index $index",[UH]:"Failed to estimate the compute unit consumption for this transaction message. This is likely because simulating the transaction failed. Inspect the `cause` property of this error to learn more",[YH]:"Transaction failed when it was simulated in order to estimate the compute unit consumption. The compute unit estimate provided is for a transaction that failed when simulated and may not be representative of the compute units this transaction would consume if successful. Inspect the `cause` property of this error to learn more",[$H]:"Transaction is missing a fee payer.",[d4]:"Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer.",[GH]:"Transaction first instruction is not advance nonce account instruction.",[WH]:"Transaction with no instructions cannot be durable nonce transaction.",[y4]:"This transaction includes an address (`$programAddress`) which is both invoked and set as the fee payer. Program addresses may not pay fees",[A6]:"This transaction includes an address (`$programAddress`) which is both invoked and marked writable. Program addresses may not be writable",[CU]:"The transaction message expected the transaction to have $numRequiredSignatures signatures, got $signaturesLength.",[u4]:"Transaction is missing signatures for addresses: $addresses.",[l4]:"Transaction version must be in the range [0, 127]. `$actualVersion` given",[J2]:"This version of Kit does not support decoding transactions with version $unsupportedVersion. The current max supported version is 0.",[VU]:"The transaction has a durable nonce lifetime (with nonce `$nonce`), but the nonce account address is in a lookup table. The lifetime constraint cannot be constructed without fetching the lookup tables for the transaction.",[r4]:"Transaction message bytes are malformed: $messageBytes"},cT="i",ST="t";function z7(T,A={}){let Q=k7[T];if(Q.length===0)return"";let J;function $(G){if(J[ST]===2){let Y=Q.slice(J[cT]+1,G);W.push(Y in A?`${A[Y]}`:`$${Y}`)}else if(J[ST]===1)W.push(Q.slice(J[cT],G))}let W=[];return Q.split("").forEach((G,Y)=>{if(Y===0){J={[cT]:0,[ST]:Q[0]==="\\"?0:Q[0]==="$"?2:1};return}let Z;switch(J[ST]){case 0:Z={[cT]:Y,[ST]:1};break;case 1:if(G==="\\")Z={[cT]:Y,[ST]:0};else if(G==="$")Z={[cT]:Y,[ST]:2};break;case 2:if(G==="\\")Z={[cT]:Y,[ST]:0};else if(G==="$")Z={[cT]:Y,[ST]:2};else if(!G.match(/\w/))Z={[cT]:Y,[ST]:1};break}if(Z){if(J!==Z)$(Y);J=Z}}),$(),W.join("")}function F7(T,A={}){return z7(T,A)}function AJ(T,A){if(T instanceof Error&&T.name==="SolanaError"){if(A!==void 0)return T.context.__code===A;return!0}return!1}var e=class extends Error{cause=this.cause;context;constructor(...[T,A]){let Q,J;if(A)Object.entries(Object.getOwnPropertyDescriptors(A)).forEach(([W,G])=>{if(W==="cause")J={cause:G.value};else{if(Q===void 0)Q={__code:T};Object.defineProperty(Q,W,G)}});let $=F7(T,Q);super($,J);this.context=Object.freeze(Q===void 0?{__code:T}:Q),this.name="SolanaError"}};function N7(...T){if("captureStackTrace"in Error&&typeof Error.captureStackTrace==="function")Error.captureStackTrace(...T)}function kU({errorCodeBaseOffset:T,getErrorContext:A,orderedErrorNames:Q,rpcEnumError:J},$){let W,G;if(typeof J==="string")W=J;else W=Object.keys(J)[0],G=J[W];let Y=Q.indexOf(W),Z=T+Y,C=A(Z,W,G),K=new e(Z,C);return N7(K,$),K}var I7=["GenericError","InvalidArgument","InvalidInstructionData","InvalidAccountData","AccountDataTooSmall","InsufficientFunds","IncorrectProgramId","MissingRequiredSignature","AccountAlreadyInitialized","UninitializedAccount","UnbalancedInstruction","ModifiedProgramId","ExternalAccountLamportSpend","ExternalAccountDataModified","ReadonlyLamportChange","ReadonlyDataModified","DuplicateAccountIndex","ExecutableModified","RentEpochModified","NotEnoughAccountKeys","AccountDataSizeChanged","AccountNotExecutable","AccountBorrowFailed","AccountBorrowOutstanding","DuplicateAccountOutOfSync","Custom","InvalidError","ExecutableDataModified","ExecutableLamportChange","ExecutableAccountNotRentExempt","UnsupportedProgramId","CallDepth","MissingAccount","ReentrancyNotAllowed","MaxSeedLengthExceeded","InvalidSeeds","InvalidRealloc","ComputationalBudgetExceeded","PrivilegeEscalation","ProgramEnvironmentSetupFailure","ProgramFailedToComplete","ProgramFailedToCompile","Immutable","IncorrectAuthority","BorshIoError","AccountNotRentExempt","InvalidAccountOwner","ArithmeticOverflow","UnsupportedSysvar","IllegalOwner","MaxAccountsDataAllocationsExceeded","MaxAccountsExceeded","MaxInstructionTraceLengthExceeded","BuiltinProgramsMustConsumeComputeUnits"];function zU(T,A){let Q=Number(T);return kU({errorCodeBaseOffset:4615001,getErrorContext(J,$,W){if(J===tG)return{errorName:$,index:Q,...W!==void 0?{instructionErrorContext:W}:null};else if(J===eG)return{code:Number(W),index:Q};return{index:Q}},orderedErrorNames:I7,rpcEnumError:A},zU)}var S7=["AccountInUse","AccountLoadedTwice","AccountNotFound","ProgramAccountNotFound","InsufficientFundsForFee","InvalidAccountForFee","AlreadyProcessed","BlockhashNotFound","CallChainTooDeep","MissingSignatureForFee","InvalidAccountIndex","SignatureFailure","InvalidProgramForExecution","SanitizeFailure","ClusterMaintenance","AccountBorrowOutstanding","WouldExceedMaxBlockCostLimit","UnsupportedVersion","InvalidWritableAccount","WouldExceedMaxAccountCostLimit","WouldExceedAccountDataBlockLimit","TooManyAccountLocks","AddressLookupTableNotFound","InvalidAddressLookupTableOwner","InvalidAddressLookupTableData","InvalidAddressLookupTableIndex","InvalidRentPayingAccount","WouldExceedMaxVoteCostLimit","WouldExceedAccountDataTotalLimit","DuplicateInstruction","InsufficientFundsForRent","MaxLoadedAccountsDataSizeExceeded","InvalidLoadedAccountsDataSizeLimit","ResanitizationNeeded","ProgramExecutionTemporarilyRestricted","UnbalancedTransaction"];function K6(T){if(typeof T==="object"&&"InstructionError"in T)return zU(...T.InstructionError);return kU({errorCodeBaseOffset:7050001,getErrorContext(A,Q,J){if(A===jU)return{errorName:Q,...J!==void 0?{transactionErrorContext:J}:null};else if(A===RU)return{index:Number(J)};else if(A===DU||A===MU)return{accountIndex:Number(J.account_index)}},orderedErrorNames:S7,rpcEnumError:T},K6)}function L7(T,A){return"fixedSize"in A?A.fixedSize:A.getSizeFromValue(T)}function FU(T){return Object.freeze({...T,encode:(A)=>{let Q=new Uint8Array(L7(A,T));return T.write(A,Q,0),Q}})}var NU="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",IU=()=>{return FU({getSizeFromValue:(T)=>{try{return atob(T).length}catch{throw new e(C8,{alphabet:NU,base:64,value:T})}},write(T,A,Q){try{let J=atob(T).split("").map(($)=>$.charCodeAt(0));return A.set(J,Q),J.length+Q}catch{throw new e(C8,{alphabet:NU,base:64,value:T})}}})};var{TextDecoder:C3,TextEncoder:H3}=globalThis;function H8(T,A){try{if("exists"in T&&!T.exists)return T;return Object.freeze({...T,data:A.decode(T.data)})}catch{throw new e(O4,{address:T.address})}}function w7(T,A){if(!A)return Object.freeze({address:T,exists:!1});let Q=IU().encode(A.data[0]);return Object.freeze({...E7(A),address:T,data:Q,exists:!0})}function E7(T){return Object.freeze({executable:T.executable,lamports:T.lamports,programAddress:T.owner,space:T.space})}async function V8(T,A,Q={}){let{abortSignal:J,...$}=Q,W=await T.getAccountInfo(A,{...$,encoding:"base64"}).send({abortSignal:J});return w7(A,W.value)}function j8(T){if(!T.exists)throw new e(E4,{address:T.address})}function O7(T,A){if(T.length>=A)return T;let Q=new Uint8Array(A).fill(0);return Q.set(T),Q}var B7=(T,A)=>O7(T.length<=A?T:T.slice(0,A),A);function _7(T,A){return"fixedSize"in A?A.fixedSize:A.getSizeFromValue(T)}function C6(T){return Object.freeze({...T,encode:(A)=>{let Q=new Uint8Array(_7(A,T));return T.write(A,Q,0),Q}})}function QJ(T){return Object.freeze({...T,decode:(A,Q=0)=>T.read(A,Q)[0]})}function R8(T){return"fixedSize"in T&&typeof T.fixedSize==="number"}function x7(T){return!R8(T)}function JJ(T,A){if(R8(T)!==R8(A))throw new e(J6);if(R8(T)&&R8(A)&&T.fixedSize!==A.fixedSize)throw new e($6,{decoderFixedSize:A.fixedSize,encoderFixedSize:T.fixedSize});if(!R8(T)&&!R8(A)&&T.maxSize!==A.maxSize)throw new e(W6,{decoderMaxSize:A.maxSize,encoderMaxSize:T.maxSize});return{...A,...T,decode:A.decode,encode:T.encode,read:A.read,write:T.write}}function h7(T,A,Q,J=0){let $=Q.length-J;if($<A)throw new e($2,{bytesLength:$,codecDescription:T,expected:A})}function SU(T,A){return C6({fixedSize:A,write:(Q,J,$)=>{let W=T.encode(Q),G=W.length>A?W.slice(0,A):W;return J.set(G,$),$+A}})}function LU(T,A){return QJ({fixedSize:A,read:(Q,J)=>{if(h7("fixCodecSize",A,Q,J),J>0||Q.length>A)Q=Q.slice(J,J+A);if(R8(T))Q=B7(Q,T.fixedSize);let[$]=T.read(Q,0);return[$,J+A]}})}function wU(T,A){return C6({...x7(T)?{...T,getSizeFromValue:(Q)=>T.getSizeFromValue(A(Q))}:T,write:(Q,J,$)=>T.write(A(Q),J,$)})}function g7(T,A,Q=A){if(!A.match(new RegExp(`^[${T}]*$`)))throw new e(C8,{alphabet:T,base:T.length,value:Q})}var m7=(T)=>{return C6({getSizeFromValue:(A)=>{let[Q,J]=EU(A,T[0]);if(!J)return A.length;let $=OU(J,T);return Q.length+Math.ceil($.toString(16).length/2)},write(A,Q,J){if(g7(T,A),A==="")return J;let[$,W]=EU(A,T[0]);if(!W)return Q.set(new Uint8Array($.length).fill(0),J),J+$.length;let G=OU(W,T),Y=[];while(G>0n)Y.unshift(Number(G%256n)),G/=256n;let Z=[...Array($.length).fill(0),...Y];return Q.set(Z,J),J+Z.length}})},v7=(T)=>{return QJ({read(A,Q){let J=Q===0?A:A.slice(Q);if(J.length===0)return["",0];let $=J.findIndex((Z)=>Z!==0);$=$===-1?J.length:$;let W=T[0].repeat($);if($===J.length)return[W,A.length];let G=J.slice($).reduce((Z,C)=>Z*256n+BigInt(C),0n),Y=y7(G,T);return[W+Y,A.length]}})};function EU(T,A){let[Q,J]=T.split(new RegExp(`((?!${A}).*)`));return[Q,J]}function OU(T,A){let Q=BigInt(A.length),J=0n;for(let $ of T)J*=Q,J+=BigInt(A.indexOf($));return J}function y7(T,A){let Q=BigInt(A.length),J=[];while(T>0n)J.unshift(A[Number(T%Q)]),T/=Q;return J.join("")}var BU="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",_U=()=>m7(BU),xU=()=>v7(BU);var{TextDecoder:I3,TextEncoder:S3}=globalThis;function H6(){if(!globalThis.isSecureContext)throw new e(B4)}var d8;async function b7(T){if(d8===void 0)d8=new Promise((A)=>{T.generateKey("Ed25519",!1,["sign","verify"]).then(()=>{A(d8=!0)}).catch(()=>{A(d8=!1)})});if(typeof d8==="boolean")return d8;else return await d8}function hU(){if(H6(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.digest!=="function")throw new e(_4)}async function gU(){if(H6(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.generateKey!=="function")throw new e(g4);if(!await b7(globalThis.crypto.subtle))throw new e(x4)}function $J(){if(H6(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.exportKey!=="function")throw new e(h4)}function mU(){if(H6(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.sign!=="function")throw new e(m4)}var WJ,GJ;function UJ(){if(!WJ)WJ=_U();return WJ}function p7(){if(!GJ)GJ=xU();return GJ}function V6(T){if(T.length<32||T.length>44)return!1;let A=UJ();try{return A.encode(T).byteLength===32}catch{return!1}}function YJ(T){if(T.length<32||T.length>44)throw new e(e2,{actualLength:T.length});let J=UJ().encode(T).byteLength;if(J!==32)throw new e(t2,{actualLength:J})}function _(T){return YJ(T),T}function C0(){return wU(SU(UJ(),32),(T)=>_(T))}function Y0(){return LU(p7(),32)}function l7(){return JJ(C0(),Y0())}function j6(){return new Intl.Collator("en",{caseFirst:"lower",ignorePunctuation:!1,localeMatcher:"best fit",numeric:!1,sensitivity:"variant",usage:"sort"}).compare}var u7=37095705934669439343138083508754565189542113879843219016388785533085940283555n,y0=57896044618658097711785492504343953926634992332820282019728792003956564819949n,vU=19681161376707505956807079304988542015446066515923890162744021073123829784752n;function PT(T){let A=T%y0;return A>=0n?A:y0+A}function LT(T,A){let Q=T;while(A-- >0n)Q*=Q,Q%=y0;return Q}function d7(T){let Q=T*T%y0*T%y0,J=LT(Q,2n)*Q%y0,$=LT(J,1n)*T%y0,W=LT($,5n)*$%y0,G=LT(W,10n)*W%y0,Y=LT(G,20n)*G%y0,Z=LT(Y,40n)*Y%y0,C=LT(Z,80n)*Z%y0,K=LT(C,80n)*Z%y0,j=LT(K,10n)*W%y0;return LT(j,2n)*T%y0}function c7(T,A){let Q=PT(A*A*A),J=PT(Q*Q*A),$=d7(T*J),W=PT(T*Q*$),G=PT(A*W*W),Y=W,Z=PT(W*vU),C=G===T,K=G===PT(-T),j=G===PT(-T*vU);if(C)W=Y;if(K||j)W=Z;if((PT(W)&1n)===1n)W=PT(-W);if(!C&&!K)return null;return W}function f7(T,A){let Q=PT(T*T),J=PT(Q-1n),$=PT(u7*Q+1n),W=c7(J,$);if(W===null)return!1;let G=(A&128)!==0;if(W===0n&&G)return!1;return!0}function r7(T){let A=T.toString(16);if(A.length===1)return`0${A}`;else return A}function n7(T){let Q=`0x${T.reduce((J,$,W)=>`${r7(W===31?$&-129:$)}${J}`,"")}`;return BigInt(Q)}function i7(T){if(T.byteLength!==32)return!1;let A=n7(T);return f7(A,T[31])}var yU=32,bU=16,o7=[80,114,111,103,114,97,109,68,101,114,105,118,101,100,65,100,100,114,101,115,115];async function a7({programAddress:T,seeds:A}){if(hU(),A.length>bU)throw new e(S4,{actual:A.length,maxSeeds:bU});let Q,J=A.reduce((Z,C,K)=>{let j=typeof C==="string"?(Q||=new TextEncoder).encode(C):C;if(j.byteLength>yU)throw new e(L4,{actual:j.byteLength,index:K,maxSeedLength:yU});return Z.push(...j),Z},[]),$=l7(),W=$.encode(T),G=await crypto.subtle.digest("SHA-256",new Uint8Array([...J,...W,...o7])),Y=new Uint8Array(G);if(i7(Y))throw new e(T6);return $.decode(Y)}async function R1({programAddress:T,seeds:A}){let Q=255;while(Q>0)try{return[await a7({programAddress:T,seeds:[...A,new Uint8Array([Q])]}),Q]}catch(J){if(AJ(J,T6))Q--;else throw J}throw new e(w4)}async function R6(T){if($J(),T.type!=="public"||T.algorithm.name!=="Ed25519")throw new e(I4);let A=await crypto.subtle.exportKey("raw",T);return Y0().decode(new Uint8Array(A))}function s7(T,A){if(T.length>=A)return T;let Q=new Uint8Array(A).fill(0);return Q.set(T),Q}var t7=(T,A)=>s7(T.length<=A?T:T.slice(0,A),A);function kA(T,A){return"fixedSize"in A?A.fixedSize:A.getSizeFromValue(T)}function qT(T){return Object.freeze({...T,encode:(A)=>{let Q=new Uint8Array(kA(A,T));return T.write(A,Q,0),Q}})}function rT(T){return Object.freeze({...T,decode:(A,Q=0)=>T.read(A,Q)[0]})}function fT(T){return"fixedSize"in T&&typeof T.fixedSize==="number"}function e7(T){return!fT(T)}function pU(T,A,Q=0){if(A.length-Q<=0)throw new e(Q6,{codecDescription:T})}function D6(T,A,Q,J=0){let $=Q.length-J;if($<A)throw new e($2,{bytesLength:$,codecDescription:T,expected:A})}function M6(T,A){let Q=(G,Y,Z)=>{let C=T.encode(G);return Z=A.write(C.length,Y,Z),Y.set(C,Z),Z+C.length};if(fT(A)&&fT(T))return qT({...T,fixedSize:A.fixedSize+T.fixedSize,write:Q});let J=fT(A)?A.fixedSize:A.maxSize??null,$=fT(T)?T.fixedSize:T.maxSize??null,W=J!==null&&$!==null?J+$:null;return qT({...T,...W!==null?{maxSize:W}:{},getSizeFromValue:(G)=>{let Y=kA(G,T);return kA(Y,A)+Y},write:Q})}function lU(T,A,Q){let J=T.byteOffset+(A??0),$=Q??T.byteLength,W;if(typeof SharedArrayBuffer>"u")W=T.buffer;else if(T.buffer instanceof SharedArrayBuffer)W=new ArrayBuffer(T.length),new Uint8Array(W).set(new Uint8Array(T));else W=T.buffer;return(J===0||J===-T.byteLength)&&$===T.byteLength?W:W.slice(J,J+$)}function H0(T,A){return qT({fixedSize:A,write:(Q,J,$)=>{let W=T.encode(Q),G=W.length>A?W.slice(0,A):W;return J.set(G,$),$+A}})}function E0(T,A){return rT({fixedSize:A,read:(Q,J)=>{if(D6("fixCodecSize",A,Q,J),J>0||Q.length>A)Q=Q.slice(J,J+A);if(fT(T))Q=t7(Q,T.fixedSize);let[$]=T.read(Q,0);return[$,J+A]}})}function Z0(T,A){return qT({...e7(T)?{...T,getSizeFromValue:(Q)=>T.getSizeFromValue(A(Q))}:T,write:(Q,J,$)=>T.write(A(Q),J,$)})}function uU(T,A){return rT({...T,read:(Q,J)=>{let[$,W]=T.read(Q,J);return[A($,Q,J),W]}})}function TV(T,A,Q,J){if(J<A||J>Q)throw new e(u8,{codecDescription:T,max:Q,min:A,value:J})}function dU(T){return T?.endian===1?!1:!0}function ZJ(T){return qT({fixedSize:T.size,write(A,Q,J){if(T.range)TV(T.name,T.range[0],T.range[1],A);let $=new ArrayBuffer(T.size);return T.set(new DataView($),A,dU(T.config)),Q.set(new Uint8Array($),J),J+T.size}})}function W2(T){return rT({fixedSize:T.size,read(A,Q=0){pU(T.name,A,Q),D6(T.name,T.size,A,Q);let J=new DataView(lU(A,Q,T.size));return[T.get(J,dU(T.config)),Q+T.size]}})}var cU=(T={})=>W2({config:T,get:(A,Q)=>{let J=Q?8:0,$=Q?0:8,W=A.getBigUint64(J,Q),G=A.getBigUint64($,Q);return(W<<64n)+G},name:"u128",size:16});var fU=(T={})=>W2({config:T,get:(A,Q)=>A.getUint16(0,Q),name:"u16",size:2});var G2=(T={})=>ZJ({config:T,name:"u32",range:[0,Number("0xffffffff")],set:(A,Q,J)=>A.setUint32(0,Number(Q),J),size:4}),XJ=(T={})=>W2({config:T,get:(A,Q)=>A.getUint32(0,Q),name:"u32",size:4});var D1=(T={})=>ZJ({config:T,name:"u64",range:[0n,BigInt("0xffffffffffffffff")],set:(A,Q,J)=>A.setBigUint64(0,BigInt(Q),J),size:8}),L1=(T={})=>W2({config:T,get:(A,Q)=>A.getBigUint64(0,Q),name:"u64",size:8});var U2=()=>ZJ({name:"u8",range:[0,Number("0xff")],set:(T,A)=>T.setUint8(0,Number(A)),size:1}),D8=()=>W2({get:(T)=>T.getUint8(0),name:"u8",size:1});function AV(T,A,Q){if(A!==Q)throw new e(l8,{actual:Q,codecDescription:T,expected:A})}function zA(T){return T.reduce((A,Q)=>A===null||Q===null?null:A+Q,0)}function k6(T){return fT(T)?T.fixedSize:null}function z6(T){return fT(T)?T.fixedSize:T.maxSize??null}function F6(T,A={}){let Q=A.size??XJ(),J=k6(T),$=rU(Q,J),W=rU(Q,z6(T))??void 0;return rT({...$!==null?{fixedSize:$}:{maxSize:W},read:(G,Y)=>{let Z=[];if(typeof Q==="object"&&G.slice(Y).length===0)return[Z,Y];if(Q==="remainder"){while(Y<G.length){let[j,M]=T.read(G,Y);Y=M,Z.push(j)}return[Z,Y]}let[C,K]=typeof Q==="number"?[Q,Y]:Q.read(G,Y);Y=K;for(let j=0;j<C;j+=1){let[M,z]=T.read(G,Y);Y=z,Z.push(M)}return[Z,Y]}})}function rU(T,A){if(typeof T!=="number")return null;if(T===0)return 0;return A===null?null:A*T}function PJ(T={}){return Z0(T.size??U2(),(A)=>A?1:0)}function qJ(T={}){return uU(T.size??D8(),(A)=>Number(A)===1)}function M0(){return qT({getSizeFromValue:(T)=>T.length,write:(T,A,Q)=>{return A.set(T,Q),Q+T.length}})}function b0(){return rT({read:(T,A)=>{let Q=T.slice(A);return[Q,A+Q.length]}})}function nU(T,A){let Q=zA(T.map(k6)),J=zA(T.map(z6))??void 0;return qT({...Q===null?{getSizeFromValue:($)=>T.map((W,G)=>kA($[G],W)).reduce((W,G)=>W+G,0),maxSize:J}:{fixedSize:Q},write:($,W,G)=>{return AV(A?.description??"tuple",T.length,$.length),T.forEach((Y,Z)=>{G=Y.write($[Z],W,G)}),G}})}function X0(T){let A=T.map(([,$])=>$),Q=zA(A.map(k6)),J=zA(A.map(z6))??void 0;return qT({...Q===null?{getSizeFromValue:($)=>T.map(([W,G])=>kA($[W],G)).reduce((W,G)=>W+G,0),maxSize:J}:{fixedSize:Q},write:($,W,G)=>{return T.forEach(([Y,Z])=>{G=Z.write($[Y],W,G)}),G}})}function V0(T){let A=T.map(([,$])=>$),Q=zA(A.map(k6)),J=zA(A.map(z6))??void 0;return rT({...Q===null?{maxSize:J}:{fixedSize:Q},read:($,W)=>{let G={};return T.forEach(([Y,Z])=>{let[C,K]=Z.read($,W);W=K,G[Y]=C}),[G,W]}})}var{TextDecoder:i3,TextEncoder:iU}=globalThis,N6=()=>{let T;return qT({getSizeFromValue:(A)=>(T||=new iU).encode(A).length,write:(A,Q,J)=>{let $=(T||=new iU).encode(A);return Q.set($,J),J+$.length}})};var $1=((T)=>{return T[T.WRITABLE_SIGNER=3]="WRITABLE_SIGNER",T[T.READONLY_SIGNER=2]="READONLY_SIGNER",T[T.WRITABLE=1]="WRITABLE",T[T.READONLY=0]="READONLY",T})($1||{}),QV=2,JV=1;function nT(T){return T>=2}function FA(T){return(T&JV)!==0}function KJ(T,A){return T|A}function I6(T){return T|QV}function aU(T){return V6(T)}function oU(T){switch(T){case"finalized":return 2;case"confirmed":return 1;case"processed":return 0;default:throw new e(TJ,{unexpectedValue:T})}}function S6(T,A){if(T===A)return 0;return oU(T)<oU(A)?-1:1}var e3=-9223372036854775808n;function M8(T,A){return"fixedSize"in A?A.fixedSize:A.getSizeFromValue(T)}function k0(T){return Object.freeze({...T,encode:(A)=>{let Q=new Uint8Array(M8(A,T));return T.write(A,Q,0),Q}})}function wT(T){return"fixedSize"in T&&typeof T.fixedSize==="number"}function $V(T){return!wT(T)}function sU(T,A){let Q=(G,Y,Z)=>{let C=T.encode(G);return Z=A.write(C.length,Y,Z),Y.set(C,Z),Z+C.length};if(wT(A)&&wT(T))return k0({...T,fixedSize:A.fixedSize+T.fixedSize,write:Q});let J=wT(A)?A.fixedSize:A.maxSize??null,$=wT(T)?T.fixedSize:T.maxSize??null,W=J!==null&&$!==null?J+$:null;return k0({...T,...W!==null?{maxSize:W}:{},getSizeFromValue:(G)=>{let Y=M8(G,T);return M8(Y,A)+Y},write:Q})}function CJ(T,A){return k0({fixedSize:A,write:(Q,J,$)=>{let W=T.encode(Q),G=W.length>A?W.slice(0,A):W;return J.set(G,$),$+A}})}function L6(T,A){return k0({...$V(T)?{...T,getSizeFromValue:(Q)=>T.getSizeFromValue(A(Q))}:T,write:(Q,J,$)=>T.write(A(Q),J,$)})}function TY(T,A,Q,J){if(J<A||J>Q)throw new e(u8,{codecDescription:T,max:Q,min:A,value:J})}function GV(T){return T?.endian===1?!1:!0}function AY(T){return k0({fixedSize:T.size,write(A,Q,J){if(T.range)TY(T.name,T.range[0],T.range[1],A);let $=new ArrayBuffer(T.size);return T.set(new DataView($),A,GV(T.config)),Q.set(new Uint8Array($),J),J+T.size}})}var c8=()=>k0({getSizeFromValue:(T)=>{if(T<=127)return 1;if(T<=16383)return 2;return 3},maxSize:3,write:(T,A,Q)=>{TY("shortU16",0,65535,T);let J=[0];for(let $=0;;$+=1){let W=Number(T)>>$*7;if(W===0)break;let G=127&W;if(J[$]=G,$>0)J[$-1]|=128}return A.set(J,Q),Q+J.length}});var QY=(T={})=>AY({config:T,name:"u32",range:[0,Number("0xffffffff")],set:(A,Q,J)=>A.setUint32(0,Number(Q),J),size:4});var NA=()=>AY({name:"u8",range:[0,Number("0xff")],set:(T,A)=>T.setUint8(0,Number(A)),size:1});function XV(T,A,Q){if(A!==Q)throw new e(l8,{actual:Q,codecDescription:T,expected:A})}function PV(T){return T.reduce((A,Q)=>A===null||Q===null?null:Math.max(A,Q),0)}function JY(T){return T.reduce((A,Q)=>A===null||Q===null?null:A+Q,0)}function GY(T){return wT(T)?T.fixedSize:null}function HJ(T){return wT(T)?T.fixedSize:T.maxSize??null}function IA(T,A={}){let Q=A.size??QY(),J=$Y(Q,GY(T)),$=$Y(Q,HJ(T))??void 0;return k0({...J!==null?{fixedSize:J}:{getSizeFromValue:(W)=>{return(typeof Q==="object"?M8(W.length,Q):0)+[...W].reduce((Y,Z)=>Y+M8(Z,T),0)},maxSize:$},write:(W,G,Y)=>{if(typeof Q==="number")XV(A.description??"array",Q,W.length);if(typeof Q==="object")Y=Q.write(W.length,G,Y);return W.forEach((Z)=>{Y=T.write(Z,G,Y)}),Y}})}function $Y(T,A){if(typeof T!=="number")return null;if(T===0)return 0;return A===null?null:A*T}function UY(){return k0({getSizeFromValue:(T)=>T.length,write:(T,A,Q)=>{return A.set(T,Q),Q+T.length}})}function YY(T){return k0({fixedSize:T.length,write:(A,Q,J)=>{return Q.set(T,J),J+T.length}})}function ZY(T,A){let Q=qV(T),J=(W,G,Y)=>{let Z=A(W);return WY(T,Z),T[Z].write(W,G,Y)};if(Q!==null)return k0({fixedSize:Q,write:J});let $=KV(T);return k0({...$!==null?{maxSize:$}:{},getSizeFromValue:(W)=>{let G=A(W);return WY(T,G),M8(W,T[G])},write:J})}function WY(T,A){if(typeof T[A]>"u")throw new e(MA,{maxRange:T.length-1,minRange:0,variant:A})}function qV(T){if(T.length===0)return 0;if(!wT(T[0]))return null;let A=T[0].fixedSize;return T.every((J)=>wT(J)&&J.fixedSize===A)?A:null}function KV(T){return PV(T.map((A)=>HJ(A)))}function SA(T){let A=T.map(([,$])=>$),Q=JY(A.map(GY)),J=JY(A.map(HJ))??void 0;return k0({...Q===null?{getSizeFromValue:($)=>T.map(([W,G])=>M8($[W],G)).reduce((W,G)=>W+G,0),maxSize:J}:{fixedSize:Q},write:($,W,G)=>{return T.forEach(([Y,Z])=>{G=Z.write($[Y],W,G)}),G}})}function HY(T){return"lifetimeConstraint"in T&&typeof T.lifetimeConstraint.blockhash==="string"&&typeof T.lifetimeConstraint.lastValidBlockHeight==="bigint"&&aU(T.lifetimeConstraint.blockhash)}function VY(T,A){if("lifetimeConstraint"in A&&A.lifetimeConstraint&&"blockhash"in A.lifetimeConstraint&&A.lifetimeConstraint.blockhash===T.blockhash&&A.lifetimeConstraint.lastValidBlockHeight===T.lastValidBlockHeight)return A;return Object.freeze({...A,lifetimeConstraint:Object.freeze(T)})}function CV(T,A,Q=A){if(!A.match(new RegExp(`^[${T}]*$`)))throw new e(C8,{alphabet:T,base:T.length,value:Q})}var HV=(T)=>{return k0({getSizeFromValue:(A)=>{let[Q,J]=XY(A,T[0]);if(!J)return A.length;let $=PY(J,T);return Q.length+Math.ceil($.toString(16).length/2)},write(A,Q,J){if(CV(T,A),A==="")return J;let[$,W]=XY(A,T[0]);if(!W)return Q.set(new Uint8Array($.length).fill(0),J),J+$.length;let G=PY(W,T),Y=[];while(G>0n)Y.unshift(Number(G%256n)),G/=256n;let Z=[...Array($.length).fill(0),...Y];return Q.set(Z,J),J+Z.length}})};function XY(T,A){let[Q,J]=T.split(new RegExp(`((?!${A}).*)`));return[Q,J]}function PY(T,A){let Q=BigInt(A.length),J=0n;for(let $ of T)J*=Q,J+=BigInt(A.indexOf($));return J}var VV="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",jV=()=>HV(VV);var VJ;function RV(){if(!VJ){let T=IA(NA(),{size:c8()});VJ=SA([["lookupTableAddress",C0()],["writableIndexes",T],["readonlyIndexes",T]])}return VJ}var jJ;function RJ(){if(!jJ)jJ=NA();return jJ}function DV(){return SA([["numSignerAccounts",RJ()],["numReadonlySignerAccounts",RJ()],["numReadonlyNonSignerAccounts",RJ()]])}var DJ;function MV(){if(!DJ)DJ=L6(SA([["programAddressIndex",NA()],["accountIndices",IA(NA(),{size:c8()})],["data",sU(UY(),c8())]]),(T)=>{if(T.accountIndices!==void 0&&T.data!==void 0)return T;return{...T,accountIndices:T.accountIndices??[],data:T.data??new Uint8Array(0)}});return DJ}var kV=0,zV=128;function FV(){return k0({getSizeFromValue:(T)=>T==="legacy"?0:1,maxSize:1,write:(T,A,Q)=>{if(T==="legacy")return Q;if(T<0||T>127)throw new e(l4,{actualVersion:T});if(T>kV)throw new e(J2,{unsupportedVersion:T});return A.set([T|zV],Q),Q+1}})}function qY(){return SA(jY())}function KY(){return L6(SA([...jY(),["addressTableLookups",NV()]]),(T)=>{if(T.version==="legacy")return T;return{...T,addressTableLookups:T.addressTableLookups??[]}})}function jY(){let T=ZY([YY(new Uint8Array(32)),CJ(jV(),32)],(A)=>A===void 0?0:1);return[["version",FV()],["header",DV()],["staticAccounts",IA(C0(),{size:c8()})],["lifetimeToken",T],["instructions",IA(MV(),{size:c8()})]]}function NV(){return IA(RV(),{size:c8()})}function RY(){return k0({getSizeFromValue:(T)=>{if(T.version==="legacy")return qY().getSizeFromValue(T);else return KY().getSizeFromValue(T)},write:(T,A,Q)=>{if(T.version==="legacy")return qY().write(T,A,Q);else return KY().write(T,A,Q)}})}function CY(T,A,Q){T[A]=Q(T[A]??{role:$1.READONLY})}var P0=Symbol("AddressMapTypeProperty");function IV(T,A){let Q={[T]:{[P0]:0,role:$1.WRITABLE_SIGNER}},J=new Set;for(let $ of A){CY(Q,$.programAddress,(G)=>{if(J.add($.programAddress),P0 in G){if(FA(G.role))switch(G[P0]){case 0:throw new e(y4,{programAddress:$.programAddress});default:throw new e(A6,{programAddress:$.programAddress})}if(G[P0]===2)return G}return{[P0]:2,role:$1.READONLY}});let W;if(!$.accounts)continue;for(let G of $.accounts)CY(Q,G.address,(Y)=>{let{address:Z,...C}=G;if(P0 in Y)switch(Y[P0]){case 0:return Y;case 1:{let K=KJ(Y.role,C.role);if("lookupTableAddress"in C){if(Y.lookupTableAddress!==C.lookupTableAddress&&(W||=j6())(C.lookupTableAddress,Y.lookupTableAddress)<0)return{[P0]:1,...C,role:K}}else if(nT(C.role))return{[P0]:2,role:K};if(Y.role!==K)return{...Y,role:K};else return Y}case 2:{let K=KJ(Y.role,C.role);if(J.has(G.address)){if(FA(C.role))throw new e(A6,{programAddress:G.address});if(Y.role!==K)return{...Y,role:K};else return Y}else if("lookupTableAddress"in C&&!nT(Y.role))return{...C,[P0]:1,role:K};else if(Y.role!==K)return{...Y,role:K};else return Y}}if("lookupTableAddress"in C)return{...C,[P0]:1};else return{...C,[P0]:2}})}return Q}function SV(T){let A;return Object.entries(T).sort(([J,$],[W,G])=>{if($[P0]!==G[P0]){if($[P0]===0)return-1;else if(G[P0]===0)return 1;else if($[P0]===2)return-1;else if(G[P0]===2)return 1}let Y=nT($.role);if(Y!==nT(G.role))return Y?-1:1;let Z=FA($.role);if(Z!==FA(G.role))return Z?-1:1;if(A||=j6(),$[P0]===1&&G[P0]===1&&$.lookupTableAddress!==G.lookupTableAddress)return A($.lookupTableAddress,G.lookupTableAddress);else return A(J,W)}).map(([J,$])=>({address:J,...$}))}function LV(T){let A={};for(let Q of T){if(!("lookupTableAddress"in Q))continue;let J=A[Q.lookupTableAddress]||={readonlyIndexes:[],writableIndexes:[]};if(Q.role===$1.WRITABLE)J.writableIndexes.push(Q.addressIndex);else J.readonlyIndexes.push(Q.addressIndex)}return Object.keys(A).sort(j6()).map((Q)=>({lookupTableAddress:Q,...A[Q]}))}function wV(T){let A=0,Q=0,J=0;for(let $ of T){if("lookupTableAddress"in $)break;let W=FA($.role);if(nT($.role)){if(J++,!W)Q++}else if(!W)A++}return{numReadonlyNonSignerAccounts:A,numReadonlySignerAccounts:Q,numSignerAccounts:J}}function EV(T){let A={};for(let[Q,J]of T.entries())A[J.address]=Q;return A}function OV(T,A){let Q=EV(A);return T.map(({accounts:J,data:$,programAddress:W})=>{return{programAddressIndex:Q[W],...J?{accountIndices:J.map(({address:G})=>Q[G])}:null,...$?{data:$}:null}})}function BV(T){if("nonce"in T)return T.nonce;return T.blockhash}function _V(T){let A=T.findIndex((J)=>("lookupTableAddress"in J));return(A===-1?T:T.slice(0,A)).map(({address:J})=>J)}function DY(T){let A=IV(T.feePayer.address,T.instructions),Q=SV(A),J=T.lifetimeConstraint;return{...T.version!=="legacy"?{addressTableLookups:LV(Q)}:null,...J?{lifetimeToken:BV(J)}:null,header:wV(Q),instructions:OV(T.instructions,Q),staticAccounts:_V(Q),version:T.version}}function MY(T){return Object.freeze({instructions:Object.freeze([]),version:T.version})}var xV="SysvarRecentB1ockHashes11111111111111111111",hV="11111111111111111111111111111111";function gV(T){return T.programAddress===hV&&T.data!=null&&mV(T.data)&&T.accounts?.length===3&&T.accounts[0].address!=null&&T.accounts[0].role===$1.WRITABLE&&T.accounts[1].address===xV&&T.accounts[1].role===$1.READONLY&&T.accounts[2].address!=null&&nT(T.accounts[2].role)}function mV(T){return T.byteLength===4&&T[0]===4&&T[1]===0&&T[2]===0&&T[3]===0}function kY(T){return"lifetimeConstraint"in T&&typeof T.lifetimeConstraint.nonce==="string"&&T.instructions[0]!=null&&gV(T.instructions[0])}function zY(T,A){if("feePayer"in A&&T===A.feePayer?.address&&vV(A.feePayer))return A;let Q={...A,feePayer:Object.freeze({address:T})};return Object.freeze(Q),Q}function vV(T){return!!T&&"address"in T&&typeof T.address==="string"&&Object.keys(T).length===1}function FY(T,A){return yV([T],A)}function yV(T,A){return Object.freeze({...A,instructions:Object.freeze([...A.instructions,...T])})}function NY(T,A){return T.length===A.length&&T.every((Q,J)=>Q===A[J])}function LA(T,A){return"fixedSize"in A?A.fixedSize:A.getSizeFromValue(T)}function o0(T){return Object.freeze({...T,encode:(A)=>{let Q=new Uint8Array(LA(A,T));return T.write(A,Q,0),Q}})}function Y2(T){return Object.freeze({...T,decode:(A,Q=0)=>T.read(A,Q)[0]})}function wA(T){return"fixedSize"in T&&typeof T.fixedSize==="number"}function bV(T){return!wA(T)}function w6(T,A){return o0({fixedSize:A,write:(Q,J,$)=>{let W=T.encode(Q),G=W.length>A?W.slice(0,A):W;return J.set(G,$),$+A}})}function E6(T,A){return o0({...bV(T)?{...T,getSizeFromValue:(Q)=>T.getSizeFromValue(A(Q))}:T,write:(Q,J,$)=>T.write(A(Q),J,$)})}function IY(T,A,Q,J){if(J<A||J>Q)throw new e(u8,{codecDescription:T,max:Q,min:A,value:J})}function lV(T){return T?.endian===1?!1:!0}function uV(T){return o0({fixedSize:T.size,write(A,Q,J){if(T.range)IY(T.name,T.range[0],T.range[1],A);let $=new ArrayBuffer(T.size);return T.set(new DataView($),A,lV(T.config)),Q.set(new Uint8Array($),J),J+T.size}})}var SY=()=>o0({getSizeFromValue:(T)=>{if(T<=127)return 1;if(T<=16383)return 2;return 3},maxSize:3,write:(T,A,Q)=>{IY("shortU16",0,65535,T);let J=[0];for(let $=0;;$+=1){let W=Number(T)>>$*7;if(W===0)break;let G=127&W;if(J[$]=G,$>0)J[$-1]|=128}return A.set(J,Q),Q+J.length}});var LY=(T={})=>uV({config:T,name:"u32",range:[0,Number("0xffffffff")],set:(A,Q,J)=>A.setUint32(0,Number(Q),J),size:4});function rV(T,A,Q){if(A!==Q)throw new e(l8,{actual:Q,codecDescription:T,expected:A})}function nV(T){return T.reduce((A,Q)=>A===null||Q===null?null:Math.max(A,Q),0)}function wY(T){return T.reduce((A,Q)=>A===null||Q===null?null:A+Q,0)}function BY(T){return wA(T)?T.fixedSize:null}function kJ(T){return wA(T)?T.fixedSize:T.maxSize??null}function zJ(T,A={}){let Q=A.size??LY(),J=EY(Q,BY(T)),$=EY(Q,kJ(T))??void 0;return o0({...J!==null?{fixedSize:J}:{getSizeFromValue:(W)=>{return(typeof Q==="object"?LA(W.length,Q):0)+[...W].reduce((Y,Z)=>Y+LA(Z,T),0)},maxSize:$},write:(W,G,Y)=>{if(typeof Q==="number")rV(A.description??"array",Q,W.length);if(typeof Q==="object")Y=Q.write(W.length,G,Y);return W.forEach((Z)=>{Y=T.write(Z,G,Y)}),Y}})}function EY(T,A){if(typeof T!=="number")return null;if(T===0)return 0;return A===null?null:A*T}function Z2(){return o0({getSizeFromValue:(T)=>T.length,write:(T,A,Q)=>{return A.set(T,Q),Q+T.length}})}function iV(T,A){let Q=oV(T),J=(W,G,Y)=>{let Z=A(W);return OY(T,Z),T[Z].write(W,G,Y)};if(Q!==null)return o0({fixedSize:Q,write:J});let $=aV(T);return o0({...$!==null?{maxSize:$}:{},getSizeFromValue:(W)=>{let G=A(W);return OY(T,G),LA(W,T[G])},write:J})}function OY(T,A){if(typeof T[A]>"u")throw new e(MA,{maxRange:T.length-1,minRange:0,variant:A})}function oV(T){if(T.length===0)return 0;if(!wA(T[0]))return null;let A=T[0].fixedSize;return T.every((J)=>wA(J)&&J.fixedSize===A)?A:null}function aV(T){return nV(T.map((A)=>kJ(A)))}function _Y(T,A,Q){return iV([A,Q],(J)=>T(J)?0:1)}function xY(T){let A=T.map(([,$])=>$),Q=wY(A.map(BY)),J=wY(A.map(kJ))??void 0;return o0({...Q===null?{getSizeFromValue:($)=>T.map(([W,G])=>LA($[W],G)).reduce((W,G)=>W+G,0),maxSize:J}:{fixedSize:Q},write:($,W,G)=>{return T.forEach(([Y,Z])=>{G=Z.write($[Y],W,G)}),G}})}var sV=(T)=>{return Y2({read(A,Q){let J=Q===0?A:A.slice(Q);if(J.length===0)return["",0];let $=J.findIndex((Z)=>Z!==0);$=$===-1?J.length:$;let W=T[0].repeat($);if($===J.length)return[W,A.length];let G=J.slice($).reduce((Z,C)=>Z*256n+BigInt(C),0n),Y=tV(G,T);return[W+Y,A.length]}})};function tV(T,A){let Q=BigInt(A.length),J=[];while(T>0n)J.unshift(A[Number(T%Q)]),T/=Q;return J.join("")}var eV="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";var hY=()=>sV(eV);var gY=()=>{return Y2({read(T,A=0){let Q=T.slice(A);return[btoa(String.fromCharCode(...Q)),T.length]}})};var{TextDecoder:uL,TextEncoder:dL}=globalThis;function mY(T,A,Q){let J=T.byteOffset+(A??0),$=Q??T.byteLength,W;if(typeof SharedArrayBuffer>"u")W=T.buffer;else if(T.buffer instanceof SharedArrayBuffer)W=new ArrayBuffer(T.length),new Uint8Array(W).set(new Uint8Array(T));else W=T.buffer;return(J===0||J===-T.byteLength)&&$===T.byteLength?W:W.slice(J,J+$)}var vY=Object.freeze({name:"Ed25519"});async function O6(T,A){mU();let Q=await crypto.subtle.sign(vY,T,mY(A));return new Uint8Array(Q)}async function yY(){return await gU(),await crypto.subtle.generateKey(vY,!1,["sign","verify"])}function pY(T){let A=Object.values(T);if(A.length===0)throw new e(f4);return A.map((Q)=>{if(!Q)return new Uint8Array(64).fill(0);return Q})}function T5(){return E6(zJ(w6(Z2(),64),{size:SY()}),pY)}function A5(T){return E6(zJ(w6(Z2(),64),{description:"signatures",size:T}),pY)}var Q5=128,J5=127;function $5(T){let A=T[0];if((A&Q5)===0)return"signaturesFirst";let Q=A&J5;if(Q===0)return"signaturesFirst";if(Q===1)return"messageFirst";throw new e(J2,{unsupportedVersion:Q})}function W5(){return _Y((T)=>$5(T.messageBytes)==="signaturesFirst",G5(),U5())}function G5(){return xY([["signatures",T5()],["messageBytes",Z2()]])}function bY(T){if(T.length<2)throw new e(r4,{messageBytes:T});return T[1]}function U5(){let T=Z2();return o0({getSizeFromValue:(A)=>{let Q=bY(A.messageBytes);return A.messageBytes.length+Q*64},write:(A,Q,J)=>{J=T.write(A.messageBytes,Q,J);let $=bY(A.messageBytes);return J=A5($).write(A.signatures,Q,J),J}})}function lY(T){let A=DY(T),Q=RY().encode(A),J=A.staticAccounts.slice(0,A.header.numSignerAccounts),$={};for(let G of J)$[G]=null;let W;if(HY(T))W={blockhash:T.lifetimeConstraint.blockhash,lastValidBlockHeight:T.lifetimeConstraint.lastValidBlockHeight};else if(kY(T))W={nonce:T.lifetimeConstraint.nonce,nonceAccountAddress:T.instructions[0].accounts[0].address};return Object.freeze({...W?{lifetimeConstraint:W}:void 0,messageBytes:Q,signatures:Object.freeze($)})}var FJ;function X2(T){if(!FJ)FJ=hY();let A=Object.values(T.signatures)[0];if(!A)throw new e(d4);return FJ.decode(A)}async function uY(T,A){let Q,J;if(await Promise.all(T.map(async($)=>{let W=await R6($.publicKey),G=A.signatures[W];if(G===void 0){J||=new Set,J.add(W);return}if(J)return;let Y=await O6($.privateKey,A.messageBytes);if(G!==null&&NY(Y,G))return;Q||={},Q[W]=Y})),J&&J.size>0){let $=Object.keys(A.signatures);throw new e(c4,{expectedAddresses:$,unexpectedAddresses:[...J]})}if(!Q)return A;return Object.freeze({...A,signatures:Object.freeze({...A.signatures,...Q})})}function dY(T){let A=[];if(Object.entries(T.signatures).forEach(([Q,J])=>{if(!J)A.push(Q)}),A.length>0)throw new e(u4,{addresses:A})}function B6(T){let A=W5().encode(T);return gY().decode(A)}var Y5=1280,Z5=48,qw=Y5-Z5;function cY(T){return T!==null&&(typeof T==="object"||typeof T==="function")}function X5(T){let A=new Set,Q={deferreds:A,settled:!1};return Promise.resolve(T).then((J)=>{for(let{resolve:$}of A)$(J);A.clear(),Q.settled=!0},(J)=>{for(let{reject:$}of A)$(J);A.clear(),Q.settled=!0}),Q}var NJ=new WeakMap;async function IJ(T){let A;return await new Promise((J,$)=>{A={reject:$,resolve:J};for(let W of T){if(!cY(W)){Promise.resolve(W).then(J,$);continue}let G=NJ.get(W);if(G===void 0)G=X5(W),G.deferreds.add(A),NJ.set(W,G);else if(G.settled)Promise.resolve(W).then(J,$);else G.deferreds.add(A)}}).finally(()=>{for(let J of T)if(cY(J))NJ.get(J).deferreds.delete(A)})}function _6(T){let A={};return T.forEach((Q)=>{if(!A[Q.address])A[Q.address]=Q;else if(A[Q.address]!==Q)throw new e(v4,{address:Q.address})}),Object.values(A)}function x6(T){return"modifyAndSignTransactions"in T&&typeof T.modifyAndSignTransactions==="function"}function P2(T){return"signTransactions"in T&&typeof T.signTransactions==="function"}function fY(T){return"signAndSendTransactions"in T&&typeof T.signAndSendTransactions==="function"}function ET(T){return P2(T)||x6(T)||fY(T)}function P5(T){return _6((T.accounts??[]).flatMap((A)=>("signer"in A)?A.signer:[]))}function q5(T){return _6([...T.feePayer&&ET(T.feePayer)?[T.feePayer]:[],...T.instructions.flatMap(P5)])}function K5(T,A){if(!A.accounts||A.accounts.length===0)return A;let Q=new Map(_6(T).map((J)=>[J.address,J]));return Object.freeze({...A,accounts:A.accounts.map((J)=>{let $=Q.get(J.address);if(!nT(J.role)||"signer"in J||!$)return J;return Object.freeze({...J,signer:$})})})}function rY(T,A){let Q=C5(A)?T.find((J)=>J.address===A.feePayer.address):void 0;if(!Q&&A.instructions.length===0)return A;return Object.freeze({...A,...Q?{feePayer:Q}:null,instructions:A.instructions.map((J)=>K5(T,J))})}function C5(T){return!!T&&"feePayer"in T&&!!T.feePayer&&typeof T.feePayer.address==="string"&&!ET(T.feePayer)}function nY(T,A){Object.freeze(T);let Q={...A,feePayer:T};return Object.freeze(Q),Q}async function H5(T){let A=await R6(T.publicKey);return Object.freeze({address:A,keyPair:T,signMessages:(J)=>Promise.all(J.map(async($)=>Object.freeze({[A]:await O6(T.privateKey,$.content)}))),signTransactions:(J)=>Promise.all(J.map(async($)=>{let W=await uY([T],$);return Object.freeze({[A]:W.signatures[A]})}))})}async function iY(){return await H5(await yY())}async function V5(T,A){let{partialSigners:Q,modifyingSigners:J}=j5(_6(q5(T).filter(ET)),{identifySendingSigner:!1});return await M5(T,J,Q,A)}async function SJ(T,A){let Q=await V5(T,A);return dY(Q),Q}function j5(T,A={}){let J=A.identifySendingSigner??!0?R5(T):null,$=T.filter((Y)=>Y!==J&&(x6(Y)||P2(Y))),W=D5($),G=$.filter(P2).filter((Y)=>!W.includes(Y));return Object.freeze({modifyingSigners:W,partialSigners:G,sendingSigner:J})}function R5(T){let A=T.filter(fY);if(A.length===0)return null;let Q=A.filter((J)=>!x6(J)&&!P2(J));if(Q.length>0)return Q[0];return A[0]}function D5(T){let A=T.filter(x6);if(A.length===0)return[];let Q=A.filter((J)=>!P2(J));if(Q.length>0)return Q;return[A[0]]}async function M5(T,A=[],Q=[],J){let $=lY(T),W=await A.reduce(async(Y,Z)=>{J?.abortSignal?.throwIfAborted();let[C]=await Z.modifyAndSignTransactions([await Y],J);return Object.freeze(C)},Promise.resolve($));J?.abortSignal?.throwIfAborted();let G=await Promise.all(Q.map(async(Y)=>{let[Z]=await Y.signTransactions([W],J);return Z}));return Object.freeze({...W,signatures:Object.freeze(G.reduce((Y,Z)=>{return{...Y,...Z}},W.signatures??{}))})}var zw=globalThis.TextEncoder;var LJ=globalThis.AbortController;function oY({rpc:T,rpcSubscriptions:A}){return async function({abortSignal:J,commitment:$,lastValidBlockHeight:W}){J.throwIfAborted();let G=new LJ,Y=()=>{G.abort()};J.addEventListener("abort",Y,{signal:G.signal});async function Z(){let{absoluteSlot:C,blockHeight:K}=await T.getEpochInfo({commitment:$}).send({abortSignal:G.signal});return{blockHeight:K,differenceBetweenSlotHeightAndBlockHeight:C-K}}try{let[C,{blockHeight:K,differenceBetweenSlotHeightAndBlockHeight:j}]=await Promise.all([A.slotNotifications().subscribe({abortSignal:G.signal}),Z()]);J.throwIfAborted();let M=K;if(M<=W){let z=j;for await(let N of C){let{slot:E}=N;if(E-z>W){let{blockHeight:L,differenceBetweenSlotHeightAndBlockHeight:O}=await Z();if(M=L,M>W)break;else z=O}}}throw J.throwIfAborted(),new e(N4,{currentBlockHeight:M,lastValidBlockHeight:W})}finally{G.abort()}}}function aY({rpc:T,rpcSubscriptions:A}){return async function({abortSignal:J,commitment:$,signature:W}){let G=new LJ;function Y(){G.abort()}J.addEventListener("abort",Y,{signal:G.signal});let Z=await A.signatureNotifications(W,{commitment:$}).subscribe({abortSignal:G.signal}),C=(async()=>{for await(let j of Z)if(j.value.err)throw K6(j.value.err);else return})(),K=(async()=>{let{value:j}=await T.getSignatureStatuses([W]).send({abortSignal:G.signal}),M=j[0];if(M?.err)throw K6(M.err);else if(M?.confirmationStatus&&S6(M.confirmationStatus,$)>=0)return;else await new Promise(()=>{})})();try{return await IJ([C,K])}finally{G.abort()}}}async function k5(T,A,Q){let{abortSignal:J,commitment:$,getRecentSignatureConfirmationPromise:W}=A;J?.throwIfAborted();let G=new LJ;if(J){let Y=()=>{G.abort()};J.addEventListener("abort",Y,{signal:G.signal})}try{let Y=Q({...A,abortSignal:G.signal});return await IJ([W({abortSignal:G.signal,commitment:$,signature:T}),...Y])}finally{G.abort()}}async function sY(T){await k5(X2(T.transaction),T,function({abortSignal:Q,commitment:J,getBlockHeightExceedencePromise:$,transaction:W}){return[$({abortSignal:Q,commitment:J,lastValidBlockHeight:W.lifetimeConstraint.lastValidBlockHeight})]})}function z5(T,A){if(!A?.preflightCommitment&&S6(T,"finalized")<0)return{...A,preflightCommitment:T};return A}async function F5({abortSignal:T,commitment:A,rpc:Q,transaction:J,...$}){let W=B6(J);return await Q.sendTransaction(W,{...z5(A,$),encoding:"base64"}).send({abortSignal:T})}async function N5({abortSignal:T,commitment:A,confirmRecentTransaction:Q,rpc:J,transaction:$,...W}){let G=await F5({...W,abortSignal:T,commitment:A,rpc:J,transaction:$});return await Q({abortSignal:T,commitment:A,transaction:$}),G}function tY({rpc:T,rpcSubscriptions:A}){let Q=oY({rpc:T,rpcSubscriptions:A}),J=aY({rpc:T,rpcSubscriptions:A});async function $(W){await sY({...W,getBlockHeightExceedencePromise:Q,getRecentSignatureConfirmationPromise:J})}return async function(G,Y){await N5({...Y,confirmRecentTransaction:$,rpc:T,transaction:G})}}var eY="confirmed";function I5(T){eY=T}function M1(){return eY}var a0="6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P",q0="pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA",f8="11111111111111111111111111111111",j0="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",q2="TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb",K2="ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";var OT="pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ";var wJ=C0(),TZ=K2;async function H1({owner:T,mint:A,tokenProgram:Q=j0,associatedTokenProgram:J=TZ}){return await R1({programAddress:_(J),seeds:[wJ.encode(_(T)),wJ.encode(_(Q)),wJ.encode(_(A))]})}async function AZ(T){return await H1({...T,tokenProgram:T.tokenProgram??q2,associatedTokenProgram:T.associatedTokenProgram??TZ})}var r8=new TextEncoder,h6=C0();async function g6(){let[T]=await R1({programAddress:_(a0),seeds:[r8.encode("global")]});return T}async function BT(T){let[A]=await R1({programAddress:_(a0),seeds:[r8.encode("bonding-curve"),h6.encode(_(T))]});return A}async function m6(T,A){let[Q]=await H1({owner:_(T),mint:_(A),tokenProgram:_(j0)});return Q}async function EJ(T){let[A]=await R1({programAddress:_(a0),seeds:[r8.encode("creator-vault"),h6.encode(_(T))]});return A}async function QZ(){let[T]=await R1({programAddress:_(a0),seeds:[r8.encode("global_volume_accumulator")]});return T}async function JZ(T){let[A]=await R1({programAddress:_(a0),seeds:[r8.encode("user_volume_accumulator"),h6.encode(_(T))]});return A}async function v6(){let[T]=await R1({programAddress:_(a0),seeds:[r8.encode("__event_authority")]});return T}async function C2(){let[T]=await R1({programAddress:_(OT),seeds:[r8.encode("fee_config"),h6.encode(_(a0))]});return T}var F1="6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P";function p0(T){if(!T)throw Error("Expected a Address.");if(typeof T==="object"&&"address"in T)return T.address;if(Array.isArray(T))return T[0];return T}function N1(T,A){return(Q)=>{if(!Q.value){if(A==="omitted")return;return Object.freeze({address:T,role:$1.READONLY})}let J=Q.isWritable?$1.WRITABLE:$1.READONLY;return Object.freeze({address:p0(Q.value),role:$Z(Q.value)?I6(J):J,...$Z(Q.value)?{signer:Q.value}:{}})}}function $Z(T){return!!T&&typeof T==="object"&&"address"in T&&ET(T)}var jE=new Uint8Array([69,25,171,142,57,239,13,4]);var kE=new Uint8Array([8,217,96,231,144,104,192,5]);var IE=new Uint8Array([209,11,115,87,213,23,124,204]);function y6(){return V0([["lpFeeBps",L1()],["protocolFeeBps",L1()],["creatorFeeBps",L1()]])}function WZ(){return V0([["marketCapLamportsThreshold",cU()],["fees",y6()]])}function OJ(){return nU([PJ()])}var E5=new Uint8Array([102,6,61,18,1,218,235,234]);function O5(){return Z0(X0([["discriminator",H0(M0(),8)],["amount",D1()],["maxSolCost",D1()],["trackVolume",OJ()]]),(T)=>({...T,discriminator:E5}))}function GZ(T,A){let Q=A?.programAddress??F1,$={global:{value:T.global??null,isWritable:!1},feeRecipient:{value:T.feeRecipient??null,isWritable:!0},mint:{value:T.mint??null,isWritable:!1},bondingCurve:{value:T.bondingCurve??null,isWritable:!0},associatedBondingCurve:{value:T.associatedBondingCurve??null,isWritable:!0},associatedUser:{value:T.associatedUser??null,isWritable:!0},user:{value:T.user??null,isWritable:!0},systemProgram:{value:T.systemProgram??null,isWritable:!1},tokenProgram:{value:T.tokenProgram??null,isWritable:!1},creatorVault:{value:T.creatorVault??null,isWritable:!0},eventAuthority:{value:T.eventAuthority??null,isWritable:!1},program:{value:T.program??null,isWritable:!1},globalVolumeAccumulator:{value:T.globalVolumeAccumulator??null,isWritable:!0},userVolumeAccumulator:{value:T.userVolumeAccumulator??null,isWritable:!0},feeConfig:{value:T.feeConfig??null,isWritable:!1},feeProgram:{value:T.feeProgram??null,isWritable:!1}},W={...T};if(!$.systemProgram.value)$.systemProgram.value="11111111111111111111111111111111";if(!$.tokenProgram.value)$.tokenProgram.value="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";if(!$.program.value)$.program.value="6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P";if(!$.feeProgram.value)$.feeProgram.value="pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ";let G=N1(Q,"programId");return Object.freeze({accounts:[G($.global),G($.feeRecipient),G($.mint),G($.bondingCurve),G($.associatedBondingCurve),G($.associatedUser),G($.user),G($.systemProgram),G($.tokenProgram),G($.creatorVault),G($.eventAuthority),G($.program),G($.globalVolumeAccumulator),G($.userVolumeAccumulator),G($.feeConfig),G($.feeProgram)],data:O5().encode(W),programAddress:Q})}var wO=new Uint8Array([56,252,116,8,158,223,205,95]);var _O=new Uint8Array([16,4,71,28,204,1,40,27]);var mO=new Uint8Array([249,69,164,218,150,103,84,138]);var pO=new Uint8Array([20,22,86,123,198,28,219,132]);var B5=new Uint8Array([24,30,200,40,5,28,7,119]);function _5(){return Z0(X0([["discriminator",H0(M0(),8)],["name",M6(N6(),G2())],["symbol",M6(N6(),G2())],["uri",M6(N6(),G2())],["creator",C0()]]),(T)=>({...T,discriminator:B5}))}function UZ(T,A){let Q=A?.programAddress??F1,$={mint:{value:T.mint??null,isWritable:!0},mintAuthority:{value:T.mintAuthority??null,isWritable:!1},bondingCurve:{value:T.bondingCurve??null,isWritable:!0},associatedBondingCurve:{value:T.associatedBondingCurve??null,isWritable:!0},global:{value:T.global??null,isWritable:!1},mplTokenMetadata:{value:T.mplTokenMetadata??null,isWritable:!1},metadata:{value:T.metadata??null,isWritable:!0},user:{value:T.user??null,isWritable:!0},systemProgram:{value:T.systemProgram??null,isWritable:!1},tokenProgram:{value:T.tokenProgram??null,isWritable:!1},associatedTokenProgram:{value:T.associatedTokenProgram??null,isWritable:!1},rent:{value:T.rent??null,isWritable:!1},eventAuthority:{value:T.eventAuthority??null,isWritable:!1},program:{value:T.program??null,isWritable:!1}},W={...T};if(!$.mplTokenMetadata.value)$.mplTokenMetadata.value="metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s";if(!$.systemProgram.value)$.systemProgram.value="11111111111111111111111111111111";if(!$.tokenProgram.value)$.tokenProgram.value="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";if(!$.associatedTokenProgram.value)$.associatedTokenProgram.value="ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";if(!$.rent.value)$.rent.value="SysvarRent111111111111111111111111111111111";let G=N1(Q,"programId");return Object.freeze({accounts:[G($.mint),G($.mintAuthority),G($.bondingCurve),G($.associatedBondingCurve),G($.global),G($.mplTokenMetadata),G($.metadata),G($.user),G($.systemProgram),G($.tokenProgram),G($.associatedTokenProgram),G($.rent),G($.eventAuthority),G($.program)],data:_5().encode(W),programAddress:Q})}var aO=new Uint8Array([234,102,194,203,150,72,62,229]);var TB=new Uint8Array([175,175,109,31,13,152,155,237]);var $B=new Uint8Array([94,6,202,115,255,96,232,183]);var YB=new Uint8Array([155,234,231,146,236,158,162,30]);var x5=new Uint8Array([51,230,133,164,1,127,131,173]);function h5(){return Z0(X0([["discriminator",H0(M0(),8)],["amount",D1()],["minSolOutput",D1()]]),(T)=>({...T,discriminator:x5}))}function YZ(T,A){let Q=A?.programAddress??F1,$={global:{value:T.global??null,isWritable:!1},feeRecipient:{value:T.feeRecipient??null,isWritable:!0},mint:{value:T.mint??null,isWritable:!1},bondingCurve:{value:T.bondingCurve??null,isWritable:!0},associatedBondingCurve:{value:T.associatedBondingCurve??null,isWritable:!0},associatedUser:{value:T.associatedUser??null,isWritable:!0},user:{value:T.user??null,isWritable:!0},systemProgram:{value:T.systemProgram??null,isWritable:!1},creatorVault:{value:T.creatorVault??null,isWritable:!0},tokenProgram:{value:T.tokenProgram??null,isWritable:!1},eventAuthority:{value:T.eventAuthority??null,isWritable:!1},program:{value:T.program??null,isWritable:!1},feeConfig:{value:T.feeConfig??null,isWritable:!1},feeProgram:{value:T.feeProgram??null,isWritable:!1}},W={...T};if(!$.systemProgram.value)$.systemProgram.value="11111111111111111111111111111111";if(!$.tokenProgram.value)$.tokenProgram.value="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";if(!$.program.value)$.program.value="6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P";if(!$.feeProgram.value)$.feeProgram.value="pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ";let G=N1(Q,"programId");return Object.freeze({accounts:[G($.global),G($.feeRecipient),G($.mint),G($.bondingCurve),G($.associatedBondingCurve),G($.associatedUser),G($.user),G($.systemProgram),G($.creatorVault),G($.tokenProgram),G($.eventAuthority),G($.program),G($.feeConfig),G($.feeProgram)],data:h5().encode(W),programAddress:Q})}var VB=new Uint8Array([254,148,255,112,207,142,170,165]);var MB=new Uint8Array([138,96,174,217,48,85,197,246]);var NB=new Uint8Array([27,234,178,52,147,2,187,141]);var wB=new Uint8Array([86,31,192,87,163,87,79,238]);var _B=new Uint8Array([227,181,74,196,208,21,97,213]);var A_=new Uint8Array([23,183,248,55,96,216,172,96]);function g5(){return V0([["discriminator",E0(b0(),8)],["virtualTokenReserves",L1()],["virtualSolReserves",L1()],["realTokenReserves",L1()],["realSolReserves",L1()],["tokenTotalSupply",L1()],["complete",qJ()],["creator",Y0()]])}function m5(T){return H8(T,g5())}async function k8(T,A,Q){let J=await v5(T,A,Q);return j8(J),J}async function v5(T,A,Q){let J=await V8(T,A,Q);return m5(J)}async function H2(T){let{user:A,mint:Q,tokenAmount:J,maxSolCostLamports:$,feeRecipient:W,trackVolume:G=!0,bondingCurveCreator:Y,rpc:Z,commitment:C=M1()}=T,K=_(Q),j=A.address,M=await BT(K),z=C2(),N=g6(),E=v6(),L=QZ(),O=JZ(j),g=m6(M,K),v=H1({owner:j,mint:K,tokenProgram:_(j0)}),p=await XZ({bondingCurve:M,providedCreator:Y,rpc:Z,commitment:C}),[c,u,[i],d,h,o,n,x]=await Promise.all([N,g,v,EJ(p),E,L,O,z]);return GZ({global:c,feeRecipient:_(W),mint:K,bondingCurve:M,associatedBondingCurve:u,associatedUser:i,user:A,systemProgram:_(f8),tokenProgram:_(j0),creatorVault:d,eventAuthority:h,program:_(a0),globalVolumeAccumulator:o,userVolumeAccumulator:n,feeConfig:x,feeProgram:_(OT),amount:J,maxSolCost:$,trackVolume:[G]})}async function xJ(T){let{user:A,mint:Q,tokenAmount:J,minSolOutputLamports:$,feeRecipient:W,bondingCurveCreator:G,rpc:Y,commitment:Z=M1()}=T,C=_(Q),K=A.address,j=await BT(C),M=g6(),z=m6(j,C),N=H1({owner:K,mint:C,tokenProgram:_(j0)}),E=C2(),L=v6(),O=await XZ({bondingCurve:j,providedCreator:G,rpc:Y,commitment:Z}),[g,v,[p],c,u,i]=await Promise.all([M,z,N,EJ(O),L,E]);return YZ({global:g,feeRecipient:_(W),mint:C,bondingCurve:j,associatedBondingCurve:v,associatedUser:p,user:A,systemProgram:_(f8),creatorVault:c,tokenProgram:_(j0),eventAuthority:u,program:_(a0),feeConfig:i,feeProgram:_(OT),amount:J,minSolOutput:$})}async function ZZ(T){let{user:A,mint:Q,mintAuthority:J,name:$,symbol:W,uri:G,creator:Y}=T,Z=Q.address,C=Y?_(Y):A.address,K=await g6(),j=await BT(Z),M=await m6(j,Z),[z]=await R1({programAddress:_("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),seeds:[new TextEncoder().encode("metadata"),_("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),Z]}),N=await v6();return UZ({mint:Q,mintAuthority:_(J),bondingCurve:j,associatedBondingCurve:M,global:K,mplTokenMetadata:_("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),metadata:z,user:A,systemProgram:_(f8),tokenProgram:_(j0),associatedTokenProgram:_("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"),rent:_("SysvarRent111111111111111111111111111111111"),eventAuthority:N,program:_(a0),name:$,symbol:W,uri:G,creator:C})}async function XZ(T){let{bondingCurve:A,providedCreator:Q,rpc:J,commitment:$}=T;if(Q)return _(Q);try{return(await k8(J,A,{commitment:$})).data.creator}catch(W){throw Error("Unable to resolve bonding curve creator. Provide `bondingCurveCreator` or configure an RPC endpoint with access to the bonding curve account.",{cause:W})}}var _T="CebN5WGQ4jvEPvsVU4EoHEpgzq1VV7AbicfhtW4xC9iM";var $T=50,iT=(T,A=50)=>T+T*BigInt(A)/10000n,n8=(T,A=50)=>T-T*BigInt(A)/10000n;function WT(T){if(T<0)throw Error("Slippage cannot be negative");if(T>1e4)throw Error("Slippage cannot exceed 100%")}function y5(T){if(T<0||T>100)throw Error("Percent must be between 0 and 100");return Math.round(T*100)}function b5(T){return T/100}var p5=1000000000n;function xT(T){if(!Number.isFinite(T)||T<0)throw Error("SOL value must be a non-negative finite number");return BigInt(Math.round(T*Number(p5)))}function i8(T,A){if(!Number.isInteger(A)||A<0)throw Error("Token decimals must be a non-negative integer");return BigInt(Math.round(T*10**A))}async function l5(T){let{user:A,mint:Q,tokenAmount:J,estimatedSolCostSol:$,slippageBps:W=$T,feeRecipient:G=_T,bondingCurveCreator:Y,trackVolume:Z=!0,rpc:C,commitment:K=M1()}=T;if(WT(W),J<=0n)throw Error("Token amount must be positive");if(!Number.isFinite($)||$<=0)throw Error("Estimated SOL cost must be a positive number");let j=xT($),M=iT(j,W);return await H2({user:A,mint:Q,tokenAmount:J,maxSolCostLamports:M,feeRecipient:G,trackVolume:Z,bondingCurveCreator:Y,rpc:C,commitment:K})}async function hJ(T){let{user:A,mint:Q,tokenAmount:J,maxSolCostSol:$,maxSolCostLamports:W,feeRecipient:G=_T,trackVolume:Y=!0,bondingCurveCreator:Z,rpc:C,commitment:K=M1()}=T;if(J<=0n)throw Error("Token amount must be positive");let j=null;if(W!==void 0){if(W<=0n)throw Error("Max SOL cost lamports must be positive");j=W}else if($!==void 0){if(!Number.isFinite($)||$<=0)throw Error("Max SOL cost must be a positive number");j=xT($)}if(j===null)throw Error("Provide either maxSolCostLamports or maxSolCostSol when calling buySimple");return await H2({user:A,mint:Q,tokenAmount:J,maxSolCostLamports:j,feeRecipient:G,trackVolume:Y,bondingCurveCreator:Z,rpc:C,commitment:K})}var PZ=6;async function u5(T){let{user:A,mint:Q,tokenAmount:J,estimatedSolOutSol:$,slippageBps:W=$T,feeRecipient:G=_T,bondingCurveCreator:Y,rpc:Z,commitment:C}=T;if(WT(W),!Number.isFinite(J)||J<=0)throw Error("Token amount must be a positive number");if(!Number.isFinite($)||$<0)throw Error("Estimated SOL output cannot be negative");let K=i8(J,PZ),j=xT($),M=n8(j,W);return await xJ({user:A,mint:Q,tokenAmount:K,minSolOutputLamports:M,feeRecipient:G,bondingCurveCreator:Y,rpc:Z,commitment:C})}async function gJ(T){let{user:A,mint:Q,tokenAmount:J,tokenAmountRaw:$,minSolOutputSol:W,minSolOutputLamports:G,feeRecipient:Y=_T,bondingCurveCreator:Z,rpc:C,commitment:K}=T,j=null;if($!==void 0){if($<=0n)throw Error("Token amount lamports must be positive");j=$}else if(J!==void 0){if(!Number.isFinite(J)||J<=0)throw Error("Token amount must be a positive number");j=i8(J,PZ)}if(j===null)throw Error("Provide either tokenAmountRaw or tokenAmount when calling sellSimple");let M=null;if(G!==void 0){if(G<0n)throw Error("Min SOL output lamports cannot be negative");M=G}else if(W!==void 0){if(!Number.isFinite(W)||W<0)throw Error("Min SOL output cannot be negative");M=xT(W)}if(M===null)throw Error("Provide either minSolOutputLamports or minSolOutputSol when calling sellSimple");return await xJ({user:A,mint:Q,tokenAmount:j,minSolOutputLamports:M,feeRecipient:Y,bondingCurveCreator:Z,rpc:C,commitment:K})}OA();var s8=typeof globalThis==="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function sT(T){return T instanceof Uint8Array||ArrayBuffer.isView(T)&&T.constructor.name==="Uint8Array"}function F8(T){if(!Number.isSafeInteger(T)||T<0)throw Error("positive integer expected, got "+T)}function I0(T,...A){if(!sT(T))throw Error("Uint8Array expected");if(A.length>0&&!A.includes(T.length))throw Error("Uint8Array expected of length "+A+", got length="+T.length)}function u6(T){if(typeof T!=="function"||typeof T.create!=="function")throw Error("Hash should be wrapped by utils.createHasher");F8(T.outputLen),F8(T.blockLen)}function tT(T,A=!0){if(T.destroyed)throw Error("Hash instance has been destroyed");if(A&&T.finished)throw Error("Hash#digest() has already been called")}function d6(T,A){I0(T);let Q=A.outputLen;if(T.length<Q)throw Error("digestInto() expects output buffer of length at least "+Q)}function hZ(T){return new Uint32Array(T.buffer,T.byteOffset,Math.floor(T.byteLength/4))}function CT(...T){for(let A=0;A<T.length;A++)T[A].fill(0)}function c6(T){return new DataView(T.buffer,T.byteOffset,T.byteLength)}function DT(T,A){return T<<32-A|T>>>A}var Ej=(()=>new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68)();function Oj(T){return T<<24&4278190080|T<<8&16711680|T>>>8&65280|T>>>24&255}function Bj(T){for(let A=0;A<T.length;A++)T[A]=Oj(T[A]);return T}var fJ=Ej?(T)=>T:Bj,gZ=(()=>typeof Uint8Array.from([]).toHex==="function"&&typeof Uint8Array.fromHex==="function")(),_j=Array.from({length:256},(T,A)=>A.toString(16).padStart(2,"0"));function HT(T){if(I0(T),gZ)return T.toHex();let A="";for(let Q=0;Q<T.length;Q++)A+=_j[T[Q]];return A}var aT={_0:48,_9:57,A:65,F:70,a:97,f:102};function xZ(T){if(T>=aT._0&&T<=aT._9)return T-aT._0;if(T>=aT.A&&T<=aT.F)return T-(aT.A-10);if(T>=aT.a&&T<=aT.f)return T-(aT.a-10);return}function t8(T){if(typeof T!=="string")throw Error("hex string expected, got "+typeof T);if(gZ)return Uint8Array.fromHex(T);let A=T.length,Q=A/2;if(A%2)throw Error("hex string expected, got unpadded hex of length "+A);let J=new Uint8Array(Q);for(let $=0,W=0;$<Q;$++,W+=2){let G=xZ(T.charCodeAt(W)),Y=xZ(T.charCodeAt(W+1));if(G===void 0||Y===void 0){let Z=T[W]+T[W+1];throw Error('hex string expected, got non-hex character "'+Z+'" at index '+W)}J[$]=G*16+Y}return J}function rJ(T){if(typeof T!=="string")throw Error("string expected");return new Uint8Array(new TextEncoder().encode(T))}function e8(T){if(typeof T==="string")T=rJ(T);return I0(T),T}function l0(...T){let A=0;for(let J=0;J<T.length;J++){let $=T[J];I0($),A+=$.length}let Q=new Uint8Array(A);for(let J=0,$=0;J<T.length;J++){let W=T[J];Q.set(W,$),$+=W.length}return Q}class TA{}function R2(T){let A=(J)=>T().update(e8(J)).digest(),Q=T();return A.outputLen=Q.outputLen,A.blockLen=Q.blockLen,A.create=()=>T(),A}function BA(T=32){if(s8&&typeof s8.getRandomValues==="function")return s8.getRandomValues(new Uint8Array(T));if(s8&&typeof s8.randomBytes==="function")return Uint8Array.from(s8.randomBytes(T));throw Error("crypto.getRandomValues must be defined")}function xj(T,A,Q,J){if(typeof T.setBigUint64==="function")return T.setBigUint64(A,Q,J);let $=BigInt(32),W=BigInt(4294967295),G=Number(Q>>$&W),Y=Number(Q&W),Z=J?4:0,C=J?0:4;T.setUint32(A+Z,G,J),T.setUint32(A+C,Y,J)}function mZ(T,A,Q){return T&A^~T&Q}function vZ(T,A,Q){return T&A^T&Q^A&Q}class f6 extends TA{constructor(T,A,Q,J){super();this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=T,this.outputLen=A,this.padOffset=Q,this.isLE=J,this.buffer=new Uint8Array(T),this.view=c6(this.buffer)}update(T){tT(this),T=e8(T),I0(T);let{view:A,buffer:Q,blockLen:J}=this,$=T.length;for(let W=0;W<$;){let G=Math.min(J-this.pos,$-W);if(G===J){let Y=c6(T);for(;J<=$-W;W+=J)this.process(Y,W);continue}if(Q.set(T.subarray(W,W+G),this.pos),this.pos+=G,W+=G,this.pos===J)this.process(A,0),this.pos=0}return this.length+=T.length,this.roundClean(),this}digestInto(T){tT(this),d6(T,this),this.finished=!0;let{buffer:A,view:Q,blockLen:J,isLE:$}=this,{pos:W}=this;if(A[W++]=128,CT(this.buffer.subarray(W)),this.padOffset>J-W)this.process(Q,0),W=0;for(let K=W;K<J;K++)A[K]=0;xj(Q,J-8,BigInt(this.length*8),$),this.process(Q,0);let G=c6(T),Y=this.outputLen;if(Y%4)throw Error("_sha2: outputLen should be aligned to 32bit");let Z=Y/4,C=this.get();if(Z>C.length)throw Error("_sha2: outputLen bigger than state");for(let K=0;K<Z;K++)G.setUint32(4*K,C[K],$)}digest(){let{buffer:T,outputLen:A}=this;this.digestInto(T);let Q=T.slice(0,A);return this.destroy(),Q}_cloneInto(T){T||(T=new this.constructor),T.set(...this.get());let{blockLen:A,buffer:Q,length:J,finished:$,destroyed:W,pos:G}=this;if(T.destroyed=W,T.finished=$,T.length=J,T.pos=G,J%A)T.buffer.set(Q);return T}clone(){return this._cloneInto()}}var eT=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);var S0=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]);var r6=BigInt(4294967295),yZ=BigInt(32);function hj(T,A=!1){if(A)return{h:Number(T&r6),l:Number(T>>yZ&r6)};return{h:Number(T>>yZ&r6)|0,l:Number(T&r6)|0}}function n6(T,A=!1){let Q=T.length,J=new Uint32Array(Q),$=new Uint32Array(Q);for(let W=0;W<Q;W++){let{h:G,l:Y}=hj(T[W],A);[J[W],$[W]]=[G,Y]}return[J,$]}var nJ=(T,A,Q)=>T>>>Q,iJ=(T,A,Q)=>T<<32-Q|A>>>Q,AA=(T,A,Q)=>T>>>Q|A<<32-Q,QA=(T,A,Q)=>T<<32-Q|A>>>Q,D2=(T,A,Q)=>T<<64-Q|A>>>Q-32,M2=(T,A,Q)=>T>>>Q-32|A<<64-Q;var bZ=(T,A,Q)=>T<<Q|A>>>32-Q,pZ=(T,A,Q)=>A<<Q|T>>>32-Q,lZ=(T,A,Q)=>A<<Q-32|T>>>64-Q,uZ=(T,A,Q)=>T<<Q-32|A>>>64-Q;function mT(T,A,Q,J){let $=(A>>>0)+(J>>>0);return{h:T+Q+($/4294967296|0)|0,l:$|0}}var dZ=(T,A,Q)=>(T>>>0)+(A>>>0)+(Q>>>0),cZ=(T,A,Q,J)=>A+Q+J+(T/4294967296|0)|0,fZ=(T,A,Q,J)=>(T>>>0)+(A>>>0)+(Q>>>0)+(J>>>0),rZ=(T,A,Q,J,$)=>A+Q+J+$+(T/4294967296|0)|0,nZ=(T,A,Q,J,$)=>(T>>>0)+(A>>>0)+(Q>>>0)+(J>>>0)+($>>>0),iZ=(T,A,Q,J,$,W)=>A+Q+J+$+W+(T/4294967296|0)|0;var mj=Uint32Array.from([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]),N8=new Uint32Array(64);class oJ extends f6{constructor(T=32){super(64,T,8,!1);this.A=eT[0]|0,this.B=eT[1]|0,this.C=eT[2]|0,this.D=eT[3]|0,this.E=eT[4]|0,this.F=eT[5]|0,this.G=eT[6]|0,this.H=eT[7]|0}get(){let{A:T,B:A,C:Q,D:J,E:$,F:W,G,H:Y}=this;return[T,A,Q,J,$,W,G,Y]}set(T,A,Q,J,$,W,G,Y){this.A=T|0,this.B=A|0,this.C=Q|0,this.D=J|0,this.E=$|0,this.F=W|0,this.G=G|0,this.H=Y|0}process(T,A){for(let K=0;K<16;K++,A+=4)N8[K]=T.getUint32(A,!1);for(let K=16;K<64;K++){let j=N8[K-15],M=N8[K-2],z=DT(j,7)^DT(j,18)^j>>>3,N=DT(M,17)^DT(M,19)^M>>>10;N8[K]=N+N8[K-7]+z+N8[K-16]|0}let{A:Q,B:J,C:$,D:W,E:G,F:Y,G:Z,H:C}=this;for(let K=0;K<64;K++){let j=DT(G,6)^DT(G,11)^DT(G,25),M=C+j+mZ(G,Y,Z)+mj[K]+N8[K]|0,N=(DT(Q,2)^DT(Q,13)^DT(Q,22))+vZ(Q,J,$)|0;C=Z,Z=Y,Y=G,G=W+M|0,W=$,$=J,J=Q,Q=M+N|0}Q=Q+this.A|0,J=J+this.B|0,$=$+this.C|0,W=W+this.D|0,G=G+this.E|0,Y=Y+this.F|0,Z=Z+this.G|0,C=C+this.H|0,this.set(Q,J,$,W,G,Y,Z,C)}roundClean(){CT(N8)}destroy(){this.set(0,0,0,0,0,0,0,0),CT(this.buffer)}}var oZ=(()=>n6(["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))))(),vj=(()=>oZ[0])(),yj=(()=>oZ[1])(),I8=new Uint32Array(80),S8=new Uint32Array(80);class aZ extends f6{constructor(T=64){super(128,T,16,!1);this.Ah=S0[0]|0,this.Al=S0[1]|0,this.Bh=S0[2]|0,this.Bl=S0[3]|0,this.Ch=S0[4]|0,this.Cl=S0[5]|0,this.Dh=S0[6]|0,this.Dl=S0[7]|0,this.Eh=S0[8]|0,this.El=S0[9]|0,this.Fh=S0[10]|0,this.Fl=S0[11]|0,this.Gh=S0[12]|0,this.Gl=S0[13]|0,this.Hh=S0[14]|0,this.Hl=S0[15]|0}get(){let{Ah:T,Al:A,Bh:Q,Bl:J,Ch:$,Cl:W,Dh:G,Dl:Y,Eh:Z,El:C,Fh:K,Fl:j,Gh:M,Gl:z,Hh:N,Hl:E}=this;return[T,A,Q,J,$,W,G,Y,Z,C,K,j,M,z,N,E]}set(T,A,Q,J,$,W,G,Y,Z,C,K,j,M,z,N,E){this.Ah=T|0,this.Al=A|0,this.Bh=Q|0,this.Bl=J|0,this.Ch=$|0,this.Cl=W|0,this.Dh=G|0,this.Dl=Y|0,this.Eh=Z|0,this.El=C|0,this.Fh=K|0,this.Fl=j|0,this.Gh=M|0,this.Gl=z|0,this.Hh=N|0,this.Hl=E|0}process(T,A){for(let g=0;g<16;g++,A+=4)I8[g]=T.getUint32(A),S8[g]=T.getUint32(A+=4);for(let g=16;g<80;g++){let v=I8[g-15]|0,p=S8[g-15]|0,c=AA(v,p,1)^AA(v,p,8)^nJ(v,p,7),u=QA(v,p,1)^QA(v,p,8)^iJ(v,p,7),i=I8[g-2]|0,d=S8[g-2]|0,h=AA(i,d,19)^D2(i,d,61)^nJ(i,d,6),o=QA(i,d,19)^M2(i,d,61)^iJ(i,d,6),n=fZ(u,o,S8[g-7],S8[g-16]),x=rZ(n,c,h,I8[g-7],I8[g-16]);I8[g]=x|0,S8[g]=n|0}let{Ah:Q,Al:J,Bh:$,Bl:W,Ch:G,Cl:Y,Dh:Z,Dl:C,Eh:K,El:j,Fh:M,Fl:z,Gh:N,Gl:E,Hh:L,Hl:O}=this;for(let g=0;g<80;g++){let v=AA(K,j,14)^AA(K,j,18)^D2(K,j,41),p=QA(K,j,14)^QA(K,j,18)^M2(K,j,41),c=K&M^~K&N,u=j&z^~j&E,i=nZ(O,p,u,yj[g],S8[g]),d=iZ(i,L,v,c,vj[g],I8[g]),h=i|0,o=AA(Q,J,28)^D2(Q,J,34)^D2(Q,J,39),n=QA(Q,J,28)^M2(Q,J,34)^M2(Q,J,39),x=Q&$^Q&G^$&G,R=J&W^J&Y^W&Y;L=N|0,O=E|0,N=M|0,E=z|0,M=K|0,z=j|0,{h:K,l:j}=mT(Z|0,C|0,d|0,h|0),Z=G|0,C=Y|0,G=$|0,Y=W|0,$=Q|0,W=J|0;let U=dZ(h,n,R);Q=cZ(U,d,o,x),J=U|0}({h:Q,l:J}=mT(this.Ah|0,this.Al|0,Q|0,J|0)),{h:$,l:W}=mT(this.Bh|0,this.Bl|0,$|0,W|0),{h:G,l:Y}=mT(this.Ch|0,this.Cl|0,G|0,Y|0),{h:Z,l:C}=mT(this.Dh|0,this.Dl|0,Z|0,C|0),{h:K,l:j}=mT(this.Eh|0,this.El|0,K|0,j|0),{h:M,l:z}=mT(this.Fh|0,this.Fl|0,M|0,z|0),{h:N,l:E}=mT(this.Gh|0,this.Gl|0,N|0,E|0),{h:L,l:O}=mT(this.Hh|0,this.Hl|0,L|0,O|0),this.set(Q,J,$,W,G,Y,Z,C,K,j,M,z,N,E,L,O)}roundClean(){CT(I8,S8)}destroy(){CT(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}var i6=R2(()=>new oJ);var sZ=R2(()=>new aZ);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var tJ=BigInt(0),sJ=BigInt(1);function T8(T,A=""){if(typeof T!=="boolean"){let Q=A&&`"${A}"`;throw Error(Q+"expected boolean, got type="+typeof T)}return T}function GT(T,A,Q=""){let J=sT(T),$=T?.length,W=A!==void 0;if(!J||W&&$!==A){let G=Q&&`"${Q}" `,Y=W?` of length ${A}`:"",Z=J?`length=${$}`:`type=${typeof T}`;throw Error(G+"expected Uint8Array"+Y+", got "+Z)}return T}function k2(T){let A=T.toString(16);return A.length&1?"0"+A:A}function tZ(T){if(typeof T!=="string")throw Error("hex string expected, got "+typeof T);return T===""?tJ:BigInt("0x"+T)}function _A(T){return tZ(HT(T))}function A8(T){return I0(T),tZ(HT(Uint8Array.from(T).reverse()))}function o6(T,A){return t8(T.toString(16).padStart(A*2,"0"))}function eJ(T,A){return o6(T,A).reverse()}function q1(T,A,Q){let J;if(typeof A==="string")try{J=t8(A)}catch(W){throw Error(T+" must be hex string or Uint8Array, cause: "+W)}else if(sT(A))J=Uint8Array.from(A);else throw Error(T+" must be hex string or Uint8Array");let $=J.length;if(typeof Q==="number"&&$!==Q)throw Error(T+" of length "+Q+" expected, got "+$);return J}function eZ(T,A){if(T.length!==A.length)return!1;let Q=0;for(let J=0;J<T.length;J++)Q|=T[J]^A[J];return Q===0}function T$(T){return Uint8Array.from(T)}var aJ=(T)=>typeof T==="bigint"&&tJ<=T;function T9(T,A,Q){return aJ(T)&&aJ(A)&&aJ(Q)&&A<=T&&T<Q}function z2(T,A,Q,J){if(!T9(A,Q,J))throw Error("expected valid "+T+": "+Q+" <= n < "+J+", got "+A)}function a6(T){let A;for(A=0;T>tJ;T>>=sJ,A+=1);return A}var L8=(T)=>(sJ<<BigInt(T))-sJ;function A9(T,A,Q){if(typeof T!=="number"||T<2)throw Error("hashLen must be a number");if(typeof A!=="number"||A<2)throw Error("qByteLen must be a number");if(typeof Q!=="function")throw Error("hmacFn must be a function");let J=(z)=>new Uint8Array(z),$=(z)=>Uint8Array.of(z),W=J(T),G=J(T),Y=0,Z=()=>{W.fill(1),G.fill(0),Y=0},C=(...z)=>Q(G,W,...z),K=(z=J(0))=>{if(G=C($(0),z),W=C(),z.length===0)return;G=C($(1),z),W=C()},j=()=>{if(Y++>=1000)throw Error("drbg: tried 1000 values");let z=0,N=[];while(z<A){W=C();let E=W.slice();N.push(E),z+=W.length}return l0(...N)};return(z,N)=>{Z(),K(z);let E=void 0;while(!(E=N(j())))K();return Z(),E}}function w8(T,A,Q={}){if(!T||typeof T!=="object")throw Error("expected valid options object");function J($,W,G){let Y=T[$];if(G&&Y===void 0)return;let Z=typeof Y;if(Z!==W||Y===null)throw Error(`param "${$}" is invalid: expected ${W}, got ${Z}`)}Object.entries(A).forEach(([$,W])=>J($,W,!1)),Object.entries(Q).forEach(([$,W])=>J($,W,!0))}var A$=()=>{throw Error("not implemented")};function xA(T){let A=new WeakMap;return(Q,...J)=>{let $=A.get(Q);if($!==void 0)return $;let W=T(Q,...J);return A.set(Q,W),W}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var u0=BigInt(0),F0=BigInt(1),JA=BigInt(2),$9=BigInt(3),W9=BigInt(4),G9=BigInt(5),bj=BigInt(7),U9=BigInt(8),pj=BigInt(9),Y9=BigInt(16);function I1(T,A){let Q=T%A;return Q>=u0?Q:A+Q}function k1(T,A,Q){let J=T;while(A-- >u0)J*=J,J%=Q;return J}function Q9(T,A){if(T===u0)throw Error("invert: expected non-zero number");if(A<=u0)throw Error("invert: expected positive modulus, got "+A);let Q=I1(T,A),J=A,$=u0,W=F0,G=F0,Y=u0;while(Q!==u0){let C=J/Q,K=J%Q,j=$-G*C,M=W-Y*C;J=Q,Q=K,$=G,W=Y,G=j,Y=M}if(J!==F0)throw Error("invert: does not exist");return I1($,A)}function Q$(T,A,Q){if(!T.eql(T.sqr(A),Q))throw Error("Cannot find square root")}function Z9(T,A){let Q=(T.ORDER+F0)/W9,J=T.pow(A,Q);return Q$(T,J,A),J}function lj(T,A){let Q=(T.ORDER-G9)/U9,J=T.mul(A,JA),$=T.pow(J,Q),W=T.mul(A,$),G=T.mul(T.mul(W,JA),$),Y=T.mul(W,T.sub(G,T.ONE));return Q$(T,Y,A),Y}function uj(T){let A=UT(T),Q=X9(T),J=Q(A,A.neg(A.ONE)),$=Q(A,J),W=Q(A,A.neg(J)),G=(T+bj)/Y9;return(Y,Z)=>{let C=Y.pow(Z,G),K=Y.mul(C,J),j=Y.mul(C,$),M=Y.mul(C,W),z=Y.eql(Y.sqr(K),Z),N=Y.eql(Y.sqr(j),Z);C=Y.cmov(C,K,z),K=Y.cmov(M,j,N);let E=Y.eql(Y.sqr(K),Z),L=Y.cmov(C,K,E);return Q$(Y,L,Z),L}}function X9(T){if(T<$9)throw Error("sqrt is not defined for small field");let A=T-F0,Q=0;while(A%JA===u0)A/=JA,Q++;let J=JA,$=UT(T);while(J9($,J)===1)if(J++>1000)throw Error("Cannot find square root: probably non-prime P");if(Q===1)return Z9;let W=$.pow(J,A),G=(A+F0)/JA;return function(Z,C){if(Z.is0(C))return C;if(J9(Z,C)!==1)throw Error("Cannot find square root");let K=Q,j=Z.mul(Z.ONE,W),M=Z.pow(C,A),z=Z.pow(C,G);while(!Z.eql(M,Z.ONE)){if(Z.is0(M))return Z.ZERO;let N=1,E=Z.sqr(M);while(!Z.eql(E,Z.ONE))if(N++,E=Z.sqr(E),N===K)throw Error("Cannot find square root");let L=F0<<BigInt(K-N-1),O=Z.pow(j,L);K=N,j=Z.sqr(O),M=Z.mul(M,j),z=Z.mul(z,O)}return z}}function dj(T){if(T%W9===$9)return Z9;if(T%U9===G9)return lj;if(T%Y9===pj)return uj(T);return X9(T)}var Q8=(T,A)=>(I1(T,A)&F0)===F0,cj=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function J$(T){let A={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},Q=cj.reduce((J,$)=>{return J[$]="function",J},A);return w8(T,Q),T}function fj(T,A,Q){if(Q<u0)throw Error("invalid exponent, negatives unsupported");if(Q===u0)return T.ONE;if(Q===F0)return A;let J=T.ONE,$=A;while(Q>u0){if(Q&F0)J=T.mul(J,$);$=T.sqr($),Q>>=F0}return J}function F2(T,A,Q=!1){let J=Array(A.length).fill(Q?T.ZERO:void 0),$=A.reduce((G,Y,Z)=>{if(T.is0(Y))return G;return J[Z]=G,T.mul(G,Y)},T.ONE),W=T.inv($);return A.reduceRight((G,Y,Z)=>{if(T.is0(Y))return G;return J[Z]=T.mul(G,J[Z]),T.mul(G,Y)},W),J}function J9(T,A){let Q=(T.ORDER-F0)/JA,J=T.pow(A,Q),$=T.eql(J,T.ONE),W=T.eql(J,T.ZERO),G=T.eql(J,T.neg(T.ONE));if(!$&&!W&&!G)throw Error("invalid Legendre symbol result");return $?1:W?0:-1}function s6(T,A){if(A!==void 0)F8(A);let Q=A!==void 0?A:T.toString(2).length,J=Math.ceil(Q/8);return{nBitLength:Q,nByteLength:J}}function UT(T,A,Q=!1,J={}){if(T<=u0)throw Error("invalid field: expected ORDER > 0, got "+T);let $=void 0,W=void 0,G=!1,Y=void 0;if(typeof A==="object"&&A!=null){if(J.sqrt||Q)throw Error("cannot specify opts in two arguments");let M=A;if(M.BITS)$=M.BITS;if(M.sqrt)W=M.sqrt;if(typeof M.isLE==="boolean")Q=M.isLE;if(typeof M.modFromBytes==="boolean")G=M.modFromBytes;Y=M.allowedLengths}else{if(typeof A==="number")$=A;if(J.sqrt)W=J.sqrt}let{nBitLength:Z,nByteLength:C}=s6(T,$);if(C>2048)throw Error("invalid field: expected ORDER of <= 2048 bytes");let K,j=Object.freeze({ORDER:T,isLE:Q,BITS:Z,BYTES:C,MASK:L8(Z),ZERO:u0,ONE:F0,allowedLengths:Y,create:(M)=>I1(M,T),isValid:(M)=>{if(typeof M!=="bigint")throw Error("invalid field element: expected bigint, got "+typeof M);return u0<=M&&M<T},is0:(M)=>M===u0,isValidNot0:(M)=>!j.is0(M)&&j.isValid(M),isOdd:(M)=>(M&F0)===F0,neg:(M)=>I1(-M,T),eql:(M,z)=>M===z,sqr:(M)=>I1(M*M,T),add:(M,z)=>I1(M+z,T),sub:(M,z)=>I1(M-z,T),mul:(M,z)=>I1(M*z,T),pow:(M,z)=>fj(j,M,z),div:(M,z)=>I1(M*Q9(z,T),T),sqrN:(M)=>M*M,addN:(M,z)=>M+z,subN:(M,z)=>M-z,mulN:(M,z)=>M*z,inv:(M)=>Q9(M,T),sqrt:W||((M)=>{if(!K)K=dj(T);return K(j,M)}),toBytes:(M)=>Q?eJ(M,C):o6(M,C),fromBytes:(M,z=!0)=>{if(Y){if(!Y.includes(M.length)||M.length>C)throw Error("Field.fromBytes: expected "+Y+" bytes, got "+M.length);let E=new Uint8Array(C);E.set(M,Q?0:E.length-M.length),M=E}if(M.length!==C)throw Error("Field.fromBytes: expected "+C+" bytes, got "+M.length);let N=Q?A8(M):_A(M);if(G)N=I1(N,T);if(!z){if(!j.isValid(N))throw Error("invalid field element: outside of range 0..ORDER")}return N},invertBatch:(M)=>F2(j,M),cmov:(M,z,N)=>N?z:M});return Object.freeze(j)}function P9(T){if(typeof T!=="bigint")throw Error("field order must be bigint");let A=T.toString(2).length;return Math.ceil(A/8)}function $$(T){let A=P9(T);return A+Math.ceil(A/2)}function W$(T,A,Q=!1){let J=T.length,$=P9(A),W=$$(A);if(J<16||J<W||J>1024)throw Error("expected "+W+"-1024 bytes of input, got "+J);let G=Q?A8(T):_A(T),Y=I1(G,A-F0)+F0;return Q?eJ(Y,$):o6(Y,$)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var hA=BigInt(0),$A=BigInt(1);function N2(T,A){let Q=A.negate();return T?Q:A}function J8(T,A){let Q=F2(T.Fp,A.map((J)=>J.Z));return A.map((J,$)=>T.fromAffine(J.toAffine(Q[$])))}function H9(T,A){if(!Number.isSafeInteger(T)||T<=0||T>A)throw Error("invalid window size, expected [1.."+A+"], got W="+T)}function G$(T,A){H9(T,A);let Q=Math.ceil(A/T)+1,J=2**(T-1),$=2**T,W=L8(T),G=BigInt(T);return{windows:Q,windowSize:J,mask:W,maxNumber:$,shiftBy:G}}function q9(T,A,Q){let{windowSize:J,mask:$,maxNumber:W,shiftBy:G}=Q,Y=Number(T&$),Z=T>>G;if(Y>J)Y-=W,Z+=$A;let C=A*J,K=C+Math.abs(Y)-1,j=Y===0,M=Y<0,z=A%2!==0;return{nextN:Z,offset:K,isZero:j,isNeg:M,isNegF:z,offsetF:C}}function rj(T,A){if(!Array.isArray(T))throw Error("array expected");T.forEach((Q,J)=>{if(!(Q instanceof A))throw Error("invalid point at index "+J)})}function nj(T,A){if(!Array.isArray(T))throw Error("array of scalars expected");T.forEach((Q,J)=>{if(!A.isValid(Q))throw Error("invalid scalar at index "+J)})}var U$=new WeakMap,V9=new WeakMap;function Y$(T){return V9.get(T)||1}function K9(T){if(T!==hA)throw Error("invalid wNAF")}class I2{constructor(T,A){this.BASE=T.BASE,this.ZERO=T.ZERO,this.Fn=T.Fn,this.bits=A}_unsafeLadder(T,A,Q=this.ZERO){let J=T;while(A>hA){if(A&$A)Q=Q.add(J);J=J.double(),A>>=$A}return Q}precomputeWindow(T,A){let{windows:Q,windowSize:J}=G$(A,this.bits),$=[],W=T,G=W;for(let Y=0;Y<Q;Y++){G=W,$.push(G);for(let Z=1;Z<J;Z++)G=G.add(W),$.push(G);W=G.double()}return $}wNAF(T,A,Q){if(!this.Fn.isValid(Q))throw Error("invalid scalar");let J=this.ZERO,$=this.BASE,W=G$(T,this.bits);for(let G=0;G<W.windows;G++){let{nextN:Y,offset:Z,isZero:C,isNeg:K,isNegF:j,offsetF:M}=q9(Q,G,W);if(Q=Y,C)$=$.add(N2(j,A[M]));else J=J.add(N2(K,A[Z]))}return K9(Q),{p:J,f:$}}wNAFUnsafe(T,A,Q,J=this.ZERO){let $=G$(T,this.bits);for(let W=0;W<$.windows;W++){if(Q===hA)break;let{nextN:G,offset:Y,isZero:Z,isNeg:C}=q9(Q,W,$);if(Q=G,Z)continue;else{let K=A[Y];J=J.add(C?K.negate():K)}}return K9(Q),J}getPrecomputes(T,A,Q){let J=U$.get(A);if(!J){if(J=this.precomputeWindow(A,T),T!==1){if(typeof Q==="function")J=Q(J);U$.set(A,J)}}return J}cached(T,A,Q){let J=Y$(T);return this.wNAF(J,this.getPrecomputes(J,T,Q),A)}unsafe(T,A,Q,J){let $=Y$(T);if($===1)return this._unsafeLadder(T,A,J);return this.wNAFUnsafe($,this.getPrecomputes($,T,Q),A,J)}createCache(T,A){H9(A,this.bits),V9.set(T,A),U$.delete(T)}hasCache(T){return Y$(T)!==1}}function j9(T,A,Q,J){let $=A,W=T.ZERO,G=T.ZERO;while(Q>hA||J>hA){if(Q&$A)W=W.add($);if(J&$A)G=G.add($);$=$.double(),Q>>=$A,J>>=$A}return{p1:W,p2:G}}function gA(T,A,Q,J){rj(Q,T),nj(J,A);let $=Q.length,W=J.length;if($!==W)throw Error("arrays of points and scalars must have equal length");let G=T.ZERO,Y=a6(BigInt($)),Z=1;if(Y>12)Z=Y-3;else if(Y>4)Z=Y-2;else if(Y>0)Z=2;let C=L8(Z),K=Array(Number(C)+1).fill(G),j=Math.floor((A.BITS-1)/Z)*Z,M=G;for(let z=j;z>=0;z-=Z){K.fill(G);for(let E=0;E<W;E++){let L=J[E],O=Number(L>>BigInt(z)&C);K[O]=K[O].add(Q[E])}let N=G;for(let E=K.length-1,L=G;E>0;E--)L=L.add(K[E]),N=N.add(L);if(M=M.add(N),z!==0)for(let E=0;E<Z;E++)M=M.double()}return M}function C9(T,A,Q){if(A){if(A.ORDER!==T)throw Error("Field.ORDER must match order: Fp == p, Fn == n");return J$(A),A}else return UT(T,{isLE:Q})}function t6(T,A,Q={},J){if(J===void 0)J=T==="edwards";if(!A||typeof A!=="object")throw Error(`expected valid ${T} CURVE object`);for(let Z of["p","n","h"]){let C=A[Z];if(!(typeof C==="bigint"&&C>hA))throw Error(`CURVE.${Z} must be positive bigint`)}let $=C9(A.p,Q.Fp,J),W=C9(A.n,Q.Fn,J),Y=["Gx","Gy","a",T==="weierstrass"?"b":"d"];for(let Z of Y)if(!$.isValid(A[Z]))throw Error(`CURVE.${Z} must be valid field element of CURVE.Fp`);return A=Object.freeze(Object.assign({},A)),{CURVE:A,Fp:$,Fn:W}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var E8=BigInt(0),N0=BigInt(1),Z$=BigInt(2),ij=BigInt(8);function oj(T,A,Q,J){let $=T.sqr(Q),W=T.sqr(J),G=T.add(T.mul(A.a,$),W),Y=T.add(T.ONE,T.mul(A.d,T.mul($,W)));return T.eql(G,Y)}function aj(T,A={}){let Q=t6("edwards",T,A,A.FpFnLE),{Fp:J,Fn:$}=Q,W=Q.CURVE,{h:G}=W;w8(A,{},{uvRatio:"function"});let Y=Z$<<BigInt($.BYTES*8)-N0,Z=(L)=>J.create(L),C=A.uvRatio||((L,O)=>{try{return{isValid:!0,value:J.sqrt(J.div(L,O))}}catch(g){return{isValid:!1,value:E8}}});if(!oj(J,W,W.Gx,W.Gy))throw Error("bad curve params: generator point");function K(L,O,g=!1){let v=g?N0:E8;return z2("coordinate "+L,O,v,Y),O}function j(L){if(!(L instanceof N))throw Error("ExtendedPoint expected")}let M=xA((L,O)=>{let{X:g,Y:v,Z:p}=L,c=L.is0();if(O==null)O=c?ij:J.inv(p);let u=Z(g*O),i=Z(v*O),d=J.mul(p,O);if(c)return{x:E8,y:N0};if(d!==N0)throw Error("invZ was invalid");return{x:u,y:i}}),z=xA((L)=>{let{a:O,d:g}=W;if(L.is0())throw Error("bad point: ZERO");let{X:v,Y:p,Z:c,T:u}=L,i=Z(v*v),d=Z(p*p),h=Z(c*c),o=Z(h*h),n=Z(i*O),x=Z(h*Z(n+d)),R=Z(o+Z(g*Z(i*d)));if(x!==R)throw Error("bad point: equation left != right (1)");let U=Z(v*p),X=Z(c*u);if(U!==X)throw Error("bad point: equation left != right (2)");return!0});class N{constructor(L,O,g,v){this.X=K("x",L),this.Y=K("y",O),this.Z=K("z",g,!0),this.T=K("t",v),Object.freeze(this)}static CURVE(){return W}static fromAffine(L){if(L instanceof N)throw Error("extended point not allowed");let{x:O,y:g}=L||{};return K("x",O),K("y",g),new N(O,g,N0,Z(O*g))}static fromBytes(L,O=!1){let g=J.BYTES,{a:v,d:p}=W;L=T$(GT(L,g,"point")),T8(O,"zip215");let c=T$(L),u=L[g-1];c[g-1]=u&-129;let i=A8(c),d=O?Y:J.ORDER;z2("point.y",i,E8,d);let h=Z(i*i),o=Z(h-N0),n=Z(p*h-v),{isValid:x,value:R}=C(o,n);if(!x)throw Error("bad point: invalid y coordinate");let U=(R&N0)===N0,X=(u&128)!==0;if(!O&&R===E8&&X)throw Error("bad point: x=0 and x_0=1");if(X!==U)R=Z(-R);return N.fromAffine({x:R,y:i})}static fromHex(L,O=!1){return N.fromBytes(q1("point",L),O)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(L=8,O=!0){if(E.createCache(this,L),!O)this.multiply(Z$);return this}assertValidity(){z(this)}equals(L){j(L);let{X:O,Y:g,Z:v}=this,{X:p,Y:c,Z:u}=L,i=Z(O*u),d=Z(p*v),h=Z(g*u),o=Z(c*v);return i===d&&h===o}is0(){return this.equals(N.ZERO)}negate(){return new N(Z(-this.X),this.Y,this.Z,Z(-this.T))}double(){let{a:L}=W,{X:O,Y:g,Z:v}=this,p=Z(O*O),c=Z(g*g),u=Z(Z$*Z(v*v)),i=Z(L*p),d=O+g,h=Z(Z(d*d)-p-c),o=i+c,n=o-u,x=i-c,R=Z(h*n),U=Z(o*x),X=Z(h*x),q=Z(n*o);return new N(R,U,q,X)}add(L){j(L);let{a:O,d:g}=W,{X:v,Y:p,Z:c,T:u}=this,{X:i,Y:d,Z:h,T:o}=L,n=Z(v*i),x=Z(p*d),R=Z(u*g*o),U=Z(c*h),X=Z((v+p)*(i+d)-n-x),q=U-R,H=U+R,V=Z(x-O*n),F=Z(X*q),I=Z(H*V),D=Z(X*V),P=Z(q*H);return new N(F,I,P,D)}subtract(L){return this.add(L.negate())}multiply(L){if(!$.isValidNot0(L))throw Error("invalid scalar: expected 1 <= sc < curve.n");let{p:O,f:g}=E.cached(this,L,(v)=>J8(N,v));return J8(N,[O,g])[0]}multiplyUnsafe(L,O=N.ZERO){if(!$.isValid(L))throw Error("invalid scalar: expected 0 <= sc < curve.n");if(L===E8)return N.ZERO;if(this.is0()||L===N0)return this;return E.unsafe(this,L,(g)=>J8(N,g),O)}isSmallOrder(){return this.multiplyUnsafe(G).is0()}isTorsionFree(){return E.unsafe(this,W.n).is0()}toAffine(L){return M(this,L)}clearCofactor(){if(G===N0)return this;return this.multiplyUnsafe(G)}toBytes(){let{x:L,y:O}=this.toAffine(),g=J.toBytes(O);return g[g.length-1]|=L&N0?128:0,g}toHex(){return HT(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get ex(){return this.X}get ey(){return this.Y}get ez(){return this.Z}get et(){return this.T}static normalizeZ(L){return J8(N,L)}static msm(L,O){return gA(N,$,L,O)}_setWindowSize(L){this.precompute(L)}toRawBytes(){return this.toBytes()}}N.BASE=new N(W.Gx,W.Gy,N0,Z(W.Gx*W.Gy)),N.ZERO=new N(E8,N0,N0,E8),N.Fp=J,N.Fn=$;let E=new I2(N,$.BITS);return N.BASE.precompute(8),N}class X${constructor(T){this.ep=T}static fromBytes(T){A$()}static fromHex(T){A$()}get x(){return this.toAffine().x}get y(){return this.toAffine().y}clearCofactor(){return this}assertValidity(){this.ep.assertValidity()}toAffine(T){return this.ep.toAffine(T)}toHex(){return HT(this.toBytes())}toString(){return this.toHex()}isTorsionFree(){return!0}isSmallOrder(){return!1}add(T){return this.assertSame(T),this.init(this.ep.add(T.ep))}subtract(T){return this.assertSame(T),this.init(this.ep.subtract(T.ep))}multiply(T){return this.init(this.ep.multiply(T))}multiplyUnsafe(T){return this.init(this.ep.multiplyUnsafe(T))}double(){return this.init(this.ep.double())}negate(){return this.init(this.ep.negate())}precompute(T,A){return this.init(this.ep.precompute(T,A))}toRawBytes(){return this.toBytes()}}function sj(T,A,Q={}){if(typeof A!=="function")throw Error('"hash" function param is required');w8(Q,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});let{prehash:J}=Q,{BASE:$,Fp:W,Fn:G}=T,Y=Q.randomBytes||BA,Z=Q.adjustScalarBytes||((h)=>h),C=Q.domain||((h,o,n)=>{if(T8(n,"phflag"),o.length||n)throw Error("Contexts/pre-hash are not supported");return h});function K(h){return G.create(A8(h))}function j(h){let o=v.secretKey;h=q1("private key",h,o);let n=q1("hashed private key",A(h),2*o),x=Z(n.slice(0,o)),R=n.slice(o,2*o),U=K(x);return{head:x,prefix:R,scalar:U}}function M(h){let{head:o,prefix:n,scalar:x}=j(h),R=$.multiply(x),U=R.toBytes();return{head:o,prefix:n,scalar:x,point:R,pointBytes:U}}function z(h){return M(h).pointBytes}function N(h=Uint8Array.of(),...o){let n=l0(...o);return K(A(C(n,q1("context",h),!!J)))}function E(h,o,n={}){if(h=q1("message",h),J)h=J(h);let{prefix:x,scalar:R,pointBytes:U}=M(o),X=N(n.context,x,h),q=$.multiply(X).toBytes(),H=N(n.context,q,U,h),V=G.create(X+H*R);if(!G.isValid(V))throw Error("sign failed: invalid s");let F=l0(q,G.toBytes(V));return GT(F,v.signature,"result")}let L={zip215:!0};function O(h,o,n,x=L){let{context:R,zip215:U}=x,X=v.signature;if(h=q1("signature",h,X),o=q1("message",o),n=q1("publicKey",n,v.publicKey),U!==void 0)T8(U,"zip215");if(J)o=J(o);let q=X/2,H=h.subarray(0,q),V=A8(h.subarray(q,X)),F,I,D;try{F=T.fromBytes(n,U),I=T.fromBytes(H,U),D=$.multiplyUnsafe(V)}catch(b){return!1}if(!U&&F.isSmallOrder())return!1;let P=N(R,I.toBytes(),F.toBytes(),o);return I.add(F.multiplyUnsafe(P)).subtract(D).clearCofactor().is0()}let g=W.BYTES,v={secretKey:g,publicKey:g,signature:2*g,seed:g};function p(h=Y(v.seed)){return GT(h,v.seed,"seed")}function c(h){let o=d.randomSecretKey(h);return{secretKey:o,publicKey:z(o)}}function u(h){return sT(h)&&h.length===G.BYTES}function i(h,o){try{return!!T.fromBytes(h,o)}catch(n){return!1}}let d={getExtendedPublicKey:M,randomSecretKey:p,isValidSecretKey:u,isValidPublicKey:i,toMontgomery(h){let{y:o}=T.fromBytes(h),n=v.publicKey,x=n===32;if(!x&&n!==57)throw Error("only defined for 25519 and 448");let R=x?W.div(N0+o,N0-o):W.div(o-N0,o+N0);return W.toBytes(R)},toMontgomerySecret(h){let o=v.secretKey;GT(h,o);let n=A(h.subarray(0,o));return Z(n).subarray(0,o)},randomPrivateKey:p,precompute(h=8,o=T.BASE){return o.precompute(h,!1)}};return Object.freeze({keygen:c,getPublicKey:z,sign:E,verify:O,utils:d,Point:T,lengths:v})}function tj(T){let A={a:T.a,d:T.d,p:T.Fp.ORDER,n:T.n,h:T.h,Gx:T.Gx,Gy:T.Gy},Q=T.Fp,J=UT(A.n,T.nBitLength,!0),$={Fp:Q,Fn:J,uvRatio:T.uvRatio},W={randomBytes:T.randomBytes,adjustScalarBytes:T.adjustScalarBytes,domain:T.domain,prehash:T.prehash,mapToCurve:T.mapToCurve};return{CURVE:A,curveOpts:$,hash:T.hash,eddsaOpts:W}}function ej(T,A){let Q=A.Point;return Object.assign({},A,{ExtendedPoint:Q,CURVE:T,nBitLength:Q.Fn.BITS,nByteLength:Q.Fn.BYTES})}function R9(T){let{CURVE:A,curveOpts:Q,hash:J,eddsaOpts:$}=tj(T),W=aj(A,Q),G=sj(W,J,$);return ej(T,G)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var TR=BigInt(0),$8=BigInt(1),D9=BigInt(2),$x=BigInt(3),AR=BigInt(5),QR=BigInt(8),mA=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),S2=(()=>({p:mA,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:QR,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")}))();function JR(T){let A=BigInt(10),Q=BigInt(20),J=BigInt(40),$=BigInt(80),W=mA,Y=T*T%W*T%W,Z=k1(Y,D9,W)*Y%W,C=k1(Z,$8,W)*T%W,K=k1(C,AR,W)*C%W,j=k1(K,A,W)*K%W,M=k1(j,Q,W)*j%W,z=k1(M,J,W)*M%W,N=k1(z,$,W)*z%W,E=k1(N,$,W)*z%W,L=k1(E,A,W)*K%W;return{pow_p_5_8:k1(L,D9,W)*T%W,b2:Y}}function $R(T){return T[0]&=248,T[31]&=127,T[31]|=64,T}var P$=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function C$(T,A){let Q=mA,J=I1(A*A*A,Q),$=I1(J*J*A,Q),W=JR(T*$).pow_p_5_8,G=I1(T*J*W,Q),Y=I1(A*G*G,Q),Z=G,C=I1(G*P$,Q),K=Y===T,j=Y===I1(-T,Q),M=Y===I1(-T*P$,Q);if(K)G=Z;if(j||M)G=C;if(Q8(G,Q))G=I1(-G,Q);return{isValid:K||j,value:G}}var O8=(()=>UT(S2.p,{isLE:!0}))(),WR=(()=>UT(S2.n,{isLE:!0}))(),GR=(()=>({...S2,Fp:O8,hash:sZ,adjustScalarBytes:$R,uvRatio:C$}))(),t0=(()=>R9(GR))();var q$=P$,UR=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),YR=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),ZR=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),XR=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),M9=(T)=>C$($8,T),PR=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),K$=(T)=>t0.Point.Fp.create(A8(T)&PR);function k9(T){let{d:A}=S2,Q=mA,J=(O)=>O8.create(O),$=J(q$*T*T),W=J(($+$8)*ZR),G=BigInt(-1),Y=J((G-A*$)*J($+A)),{isValid:Z,value:C}=C$(W,Y),K=J(C*T);if(!Q8(K,Q))K=J(-K);if(!Z)C=K;if(!Z)G=$;let j=J(G*($-$8)*XR-Y),M=C*C,z=J((C+C)*Y),N=J(j*UR),E=J($8-M),L=J($8+M);return new t0.Point(J(z*L),J(E*N),J(N*L),J(z*E))}function qR(T){I0(T,64);let A=K$(T.subarray(0,32)),Q=k9(A),J=K$(T.subarray(32,64)),$=k9(J);return new d0(Q.add($))}class d0 extends X${constructor(T){super(T)}static fromAffine(T){return new d0(t0.Point.fromAffine(T))}assertSame(T){if(!(T instanceof d0))throw Error("RistrettoPoint expected")}init(T){return new d0(T)}static hashToCurve(T){return qR(q1("ristrettoHash",T,64))}static fromBytes(T){I0(T,32);let{a:A,d:Q}=S2,J=mA,$=(v)=>O8.create(v),W=K$(T);if(!eZ(O8.toBytes(W),T)||Q8(W,J))throw Error("invalid ristretto255 encoding 1");let G=$(W*W),Y=$($8+A*G),Z=$($8-A*G),C=$(Y*Y),K=$(Z*Z),j=$(A*Q*C-K),{isValid:M,value:z}=M9($(j*K)),N=$(z*Z),E=$(z*N*j),L=$((W+W)*N);if(Q8(L,J))L=$(-L);let O=$(Y*E),g=$(L*O);if(!M||Q8(g,J)||O===TR)throw Error("invalid ristretto255 encoding 2");return new d0(new t0.Point(L,O,$8,g))}static fromHex(T){return d0.fromBytes(q1("ristrettoHex",T,32))}static msm(T,A){return gA(d0,t0.Point.Fn,T,A)}toBytes(){let{X:T,Y:A,Z:Q,T:J}=this.ep,$=mA,W=(E)=>O8.create(E),G=W(W(Q+A)*W(Q-A)),Y=W(T*A),Z=W(Y*Y),{value:C}=M9(W(G*Z)),K=W(C*G),j=W(C*Y),M=W(K*j*J),z;if(Q8(J*M,$)){let E=W(A*q$),L=W(T*q$);T=E,A=L,z=W(K*YR)}else z=j;if(Q8(T*M,$))A=W(-A);let N=W((Q-A)*z);if(Q8(N,$))N=W(-N);return O8.toBytes(N)}equals(T){this.assertSame(T);let{X:A,Y:Q}=this.ep,{X:J,Y:$}=T.ep,W=(Z)=>O8.create(Z),G=W(A*$)===W(Q*J),Y=W(Q*$)===W(A*J);return G||Y}is0(){return this.equals(d0.ZERO)}}d0.BASE=(()=>new d0(t0.Point.BASE))();d0.ZERO=(()=>new d0(t0.Point.ZERO))();d0.Fp=(()=>O8)();d0.Fn=(()=>WR)();var zW=n0(V$(),1),TT=n0(R$(),1);var D$=i6;var nA=n0(g9(),1),S=n0(G8(),1),AP=n0(G8(),1);var tD=1,eD=2,TM=3,AM=4,QM=5,JM=6,$M=7,WM=8,GM=9,UM=10,YM=-32700,ZM=-32603,XM=-32602,PM=-32601,qM=-32600,KM=-32016,CM=-32015,HM=-32014,VM=-32013,jM=-32012,RM=-32011,DM=-32010,MM=-32009,kM=-32008,zM=-32007,FM=-32006,NM=-32005,IM=-32004,SM=-32003,LM=-32002,wM=-32001,EM=2800000,OM=2800001,BM=2800002,_M=2800003,xM=2800004,hM=2800005,gM=2800006,mM=2800007,vM=2800008,yM=2800009,bM=2800010,pM=2800011,lM=3230000,uM=32300001,dM=3230002,cM=3230003,fM=3230004,rM=3610000,nM=3610001,iM=3610002,oM=3610003,aM=3610004,sM=3610005,tM=3610006,eM=3610007,Tk=3611000,Ak=3704000,Qk=3704001,Jk=3704002,$k=3704003,Wk=3704004,Gk=4128000,Uk=4128001,Yk=4128002,Zk=4615000,Xk=4615001,Pk=4615002,qk=4615003,Kk=4615004,Ck=4615005,Hk=4615006,Vk=4615007,jk=4615008,Rk=4615009,Dk=4615010,Mk=4615011,kk=4615012,zk=4615013,Fk=4615014,Nk=4615015,Ik=4615016,Sk=4615017,Lk=4615018,wk=4615019,Ek=4615020,Ok=4615021,Bk=4615022,_k=4615023,xk=4615024,hk=4615025,gk=4615026,mk=4615027,vk=4615028,yk=4615029,bk=4615030,pk=4615031,lk=4615032,uk=4615033,dk=4615034,ck=4615035,fk=4615036,rk=4615037,nk=4615038,ik=4615039,ok=4615040,ak=4615041,sk=4615042,tk=4615043,ek=4615044,Tz=4615045,Az=4615046,Qz=4615047,Jz=4615048,$z=4615049,Wz=4615050,Gz=4615051,Uz=4615052,Yz=4615053,Zz=4615054,Xz=5508000,Pz=5508001,qz=5508002,Kz=5508003,Cz=5508004,Hz=5508005,Vz=5508006,jz=5508007,Rz=5508008,Dz=5508009,Mz=5508010,kz=5508011,zz=5663000,Fz=5663001,Nz=5663002,Iz=5663003,Sz=5663004,Lz=5663005,wz=5663006,Ez=5663007,Oz=5663008,Bz=5663009,_z=5663010,xz=5663011,hz=5663012,gz=5663013,mz=5663014,vz=5663015,yz=5663016,bz=5663017,pz=5663018,lz=5663019,uz=5663020,dz=7050000,cz=7050001,fz=7050002,rz=7050003,nz=7050004,iz=7050005,oz=7050006,az=7050007,sz=7050008,tz=7050009,ez=7050010,TF=7050011,AF=7050012,QF=7050013,JF=7050014,$F=7050015,WF=7050016,GF=7050017,UF=7050018,YF=7050019,ZF=7050020,XF=7050021,PF=7050022,qF=7050023,KF=7050024,CF=7050025,HF=7050026,VF=7050027,jF=7050028,RF=7050029,DF=7050030,MF=7050031,kF=7050032,zF=7050033,FF=7050034,NF=7050035,IF=7050036,f$=8078000,r$=8078001,b9=8078002,p9=8078003,n$=8078004,i$=8078005,o$=8078006,SF=8078007,LF=8078008,wF=8078009,EF=8078010,a$=8078011,OF=8078012,l9=8078013,u9=8078014,BF=8078015,_F=8078016,xF=8078017,hF=8078018,gF=8078019,d9=8078020,c9=8078021,mF=8078022,vF=8100000,yF=8100001,bF=8100002,pF=8100003,lF=8190000,uF=8190001,dF=8190002,cF=8190003,fF=8190004,rF=9900000,nF=9900001,iF=9900002,oF=9900003,aF=9900004;var sF={[lM]:"Account not found at address: $address",[fM]:"Not all accounts were decoded. Encoded accounts found at addresses: $addresses.",[cM]:"Expected decoded account at address: $address",[dM]:"Failed to decode account data at address: $address",[uM]:"Accounts not found at addresses: $addresses",[yM]:"Unable to find a viable program address bump seed.",[BM]:"$putativeAddress is not a base58-encoded address.",[EM]:"Expected base58 encoded address to decode to a byte array of length 32. Actual length: $actualLength.",[_M]:"The `CryptoKey` must be an `Ed25519` public key.",[pM]:"$putativeOffCurveAddress is not a base58-encoded off-curve address.",[vM]:"Invalid seeds; point must fall off the Ed25519 curve.",[xM]:"Expected given program derived address to have the following format: [Address, ProgramDerivedAddressBump].",[gM]:"A maximum of $maxSeeds seeds, including the bump seed, may be supplied when creating an address. Received: $actual.",[mM]:"The seed at index $index with length $actual exceeds the maximum length of $maxSeedLength bytes.",[hM]:"Expected program derived address bump to be in the range [0, 255], got: $bump.",[bM]:"Program address cannot end with PDA marker.",[OM]:"Expected base58-encoded address string of length in the range [32, 44]. Actual length: $actualLength.",[AM]:"Expected base58-encoded blockash string of length in the range [32, 44]. Actual length: $actualLength.",[tD]:"The network has progressed past the last block for which this transaction could have been committed.",[f$]:"Codec [$codecDescription] cannot decode empty byte arrays.",[mF]:"Enum codec cannot use lexical values [$stringValues] as discriminators. Either remove all lexical values or set `useValuesAsDiscriminators` to `false`.",[d9]:"Sentinel [$hexSentinel] must not be present in encoded bytes [$hexEncodedBytes].",[i$]:"Encoder and decoder must have the same fixed size, got [$encoderFixedSize] and [$decoderFixedSize].",[o$]:"Encoder and decoder must have the same max size, got [$encoderMaxSize] and [$decoderMaxSize].",[n$]:"Encoder and decoder must either both be fixed-size or variable-size.",[LF]:"Enum discriminator out of range. Expected a number in [$formattedValidDiscriminators], got $discriminator.",[b9]:"Expected a fixed-size codec, got a variable-size one.",[l9]:"Codec [$codecDescription] expected a positive byte length, got $bytesLength.",[p9]:"Expected a variable-size codec, got a fixed-size one.",[gF]:"Codec [$codecDescription] expected zero-value [$hexZeroValue] to have the same size as the provided fixed-size item [$expectedSize bytes].",[r$]:"Codec [$codecDescription] expected $expected bytes, got $bytesLength.",[hF]:"Expected byte array constant [$hexConstant] to be present in data [$hexData] at offset [$offset].",[wF]:"Invalid discriminated union variant. Expected one of [$variants], got $value.",[EF]:"Invalid enum variant. Expected one of [$stringValues] or a number in [$formattedNumericalValues], got $variant.",[BF]:"Invalid literal union variant. Expected one of [$variants], got $value.",[SF]:"Expected [$codecDescription] to have $expected items, got $actual.",[OF]:"Invalid value $value for base $base with alphabet $alphabet.",[_F]:"Literal union discriminator out of range. Expected a number between $minRange and $maxRange, got $discriminator.",[a$]:"Codec [$codecDescription] expected number to be in the range [$min, $max], got $value.",[u9]:"Codec [$codecDescription] expected offset to be in the range [0, $bytesLength], got $offset.",[c9]:"Expected sentinel [$hexSentinel] to be present in decoded bytes [$hexDecodedBytes].",[xF]:"Union variant out of range. Expected an index between $minRange and $maxRange, got $variant.",[Tk]:"No random values implementation could be found.",[Rk]:"instruction requires an uninitialized account",[_k]:"instruction tries to borrow reference for an account which is already borrowed",[xk]:"instruction left account with an outstanding borrowed reference",[Ok]:"program other than the account's owner changed the size of the account data",[Ck]:"account data too small for instruction",[Bk]:"instruction expected an executable account",[Az]:"An account does not have enough lamports to be rent-exempt",[Jz]:"Program arithmetic overflowed",[Tz]:"Failed to serialize or deserialize account data: $encodedData",[Zz]:"Builtin programs must consume compute units",[lk]:"Cross-program invocation call depth too deep",[nk]:"Computational budget exceeded",[gk]:"custom program error: #$code",[Sk]:"instruction contains duplicate accounts",[hk]:"instruction modifications of multiply-passed account differ",[bk]:"executable accounts must be rent exempt",[vk]:"instruction changed executable accounts data",[yk]:"instruction changed the balance of an executable account",[Lk]:"instruction changed executable bit of an account",[Fk]:"instruction modified data of an account it does not own",[zk]:"instruction spent from the balance of an account it does not own",[Xk]:"generic instruction error",[Wz]:"Provided owner is not allowed",[tk]:"Account is immutable",[ek]:"Incorrect authority provided",[Vk]:"incorrect program id for instruction",[Hk]:"insufficient funds for instruction",[Kk]:"invalid account data for instruction",[Qz]:"Invalid account owner",[Pk]:"invalid program argument",[mk]:"program returned invalid error code",[qk]:"invalid instruction data",[rk]:"Failed to reallocate account data",[fk]:"Provided seeds do not result in a valid address",[Gz]:"Accounts data allocations exceeded the maximum allowed per transaction",[Uz]:"Max accounts exceeded",[Yz]:"Max instruction trace length exceeded",[ck]:"Length of the seed is too long for address generation",[uk]:"An account required by the instruction is missing",[jk]:"missing required signature for instruction",[kk]:"instruction illegally modified the program id of an account",[Ek]:"insufficient account keys for instruction",[ik]:"Cross-program invocation with unauthorized signer or writable account",[ok]:"Failed to create program execution environment",[sk]:"Program failed to compile",[ak]:"Program failed to complete",[Ik]:"instruction modified data of a read-only account",[Nk]:"instruction changed the balance of a read-only account",[dk]:"Cross-program invocation reentrancy not allowed for this instruction",[wk]:"instruction modified rent epoch of an account",[Mk]:"sum of account balances before and after instruction do not match",[Dk]:"instruction requires an initialized account",[Zk]:"",[pk]:"Unsupported program id",[$z]:"Unsupported sysvar",[Gk]:"The instruction does not have any accounts.",[Uk]:"The instruction does not have any data.",[Yk]:"Expected instruction to have progress address $expectedProgramAddress, got $actualProgramAddress.",[QM]:"Expected base58 encoded blockhash to decode to a byte array of length 32. Actual length: $actualLength.",[eD]:"The nonce `$expectedNonceValue` is no longer valid. It has advanced to `$actualNonceValue`",[iF]:"Invariant violation: Found no abortable iterable cache entry for key `$cacheKey`. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[aF]:"Invariant violation: This data publisher does not publish to the channel named `$channelName`. Supported channels include $supportedChannelNames.",[nF]:"Invariant violation: WebSocket message iterator state is corrupt; iterated without first resolving existing message promise. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[rF]:"Invariant violation: WebSocket message iterator is missing state storage. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[oF]:"Invariant violation: Switch statement non-exhaustive. Received unexpected value `$unexpectedValue`. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[ZM]:"JSON-RPC error: Internal JSON-RPC error ($__serverMessage)",[XM]:"JSON-RPC error: Invalid method parameter(s) ($__serverMessage)",[qM]:"JSON-RPC error: The JSON sent is not a valid `Request` object ($__serverMessage)",[PM]:"JSON-RPC error: The method does not exist / is not available ($__serverMessage)",[YM]:"JSON-RPC error: An error occurred on the server while parsing the JSON text ($__serverMessage)",[jM]:"$__serverMessage",[wM]:"$__serverMessage",[IM]:"$__serverMessage",[HM]:"$__serverMessage",[DM]:"$__serverMessage",[MM]:"$__serverMessage",[KM]:"Minimum context slot has not been reached",[NM]:"Node is unhealthy; behind by $numSlotsBehind slots",[kM]:"No snapshot",[LM]:"Transaction simulation failed",[zM]:"$__serverMessage",[RM]:"Transaction history is not available from this node",[FM]:"$__serverMessage",[VM]:"Transaction signature length mismatch",[SM]:"Transaction signature verification failure",[CM]:"$__serverMessage",[Ak]:"Key pair bytes must be of length 64, got $byteLength.",[Qk]:"Expected private key bytes with length 32. Actual length: $actualLength.",[Jk]:"Expected base58-encoded signature to decode to a byte array of length 64. Actual length: $actualLength.",[Wk]:"The provided private key does not match the provided public key.",[$k]:"Expected base58-encoded signature string of length in the range [64, 88]. Actual length: $actualLength.",[JM]:"Lamports value must be in the range [0, 2e64-1]",[$M]:"`$value` cannot be parsed as a `BigInt`",[UM]:"$message",[WM]:"`$value` cannot be parsed as a `Number`",[TM]:"No nonce account could be found at address `$nonceAccountAddress`",[lF]:"The notification name must end in 'Notifications' and the API must supply a subscription plan creator function for the notification '$notificationName'.",[dF]:"WebSocket was closed before payload could be added to the send buffer",[cF]:"WebSocket connection closed",[fF]:"WebSocket failed to connect",[uF]:"Failed to obtain a subscription id from the server",[pF]:"Could not find an API plan for RPC method: `$method`",[vF]:"The $argumentLabel argument to the `$methodName` RPC method$optionalPathLabel was `$value`. This number is unsafe for use with the Solana JSON-RPC because it exceeds `Number.MAX_SAFE_INTEGER`.",[bF]:"HTTP error ($statusCode): $message",[yF]:"HTTP header(s) forbidden: $headers. Learn more at https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name.",[Xz]:"Multiple distinct signers were identified for address `$address`. Please ensure that you are using the same signer instance for each address.",[Pz]:"The provided value does not implement the `KeyPairSigner` interface",[Kz]:"The provided value does not implement the `MessageModifyingSigner` interface",[Cz]:"The provided value does not implement the `MessagePartialSigner` interface",[qz]:"The provided value does not implement any of the `MessageSigner` interfaces",[Vz]:"The provided value does not implement the `TransactionModifyingSigner` interface",[jz]:"The provided value does not implement the `TransactionPartialSigner` interface",[Rz]:"The provided value does not implement the `TransactionSendingSigner` interface",[Hz]:"The provided value does not implement any of the `TransactionSigner` interfaces",[Dz]:"More than one `TransactionSendingSigner` was identified.",[Mz]:"No `TransactionSendingSigner` was identified. Please provide a valid `TransactionWithSingleSendingSigner` transaction.",[kz]:"Wallet account signers do not support signing multiple messages/transactions in a single operation",[eM]:"Cannot export a non-extractable key.",[nM]:"No digest implementation could be found.",[rM]:"Cryptographic operations are only allowed in secure browser contexts. Read more here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts.",[iM]:`This runtime does not support the generation of Ed25519 key pairs.
|
|
11
11
|
|
|
12
12
|
Install @solana/webcrypto-ed25519-polyfill and call its \`install\` function before generating keys in environments that do not support Ed25519.
|
|
13
13
|
|
|
14
|
-
For a list of runtimes that currently support Ed25519 operations, visit https://github.com/WICG/webcrypto-secure-curves/issues/20.`,[JM]:"No signature verification implementation could be found.",[WM]:"No key generation implementation could be found.",[$M]:"No signing implementation could be found.",[GM]:"No key export implementation could be found.",[CD]:"Timestamp value must be in the range [-(2n ** 63n), (2n ** 63n) - 1]. `$value` given",[Kz]:"Transaction processing left an account with an outstanding borrowed reference",[tk]:"Account in use",[ek]:"Account loaded twice",[Tz]:"Attempt to debit an account but found no record of a prior credit.",[Mz]:"Transaction loads an address table account that doesn't exist",[Wz]:"This transaction has already been processed",[$z]:"Blockhash not found",[Gz]:"Loader call chain is too deep",[qz]:"Transactions are currently disabled due to cluster maintenance",[Lz]:"Transaction contains a duplicate instruction ($index) that is not allowed",[Qz]:"Insufficient funds for fee",[wz]:"Transaction results in an account ($accountIndex) with insufficient funds for rent",[Jz]:"This account may not be used to pay transaction fees",[Yz]:"Transaction contains an invalid account reference",[zz]:"Transaction loads an address table account with invalid data",[Fz]:"Transaction address table lookup uses an invalid index",[kz]:"Transaction loads an address table account with an invalid owner",[Oz]:"LoadedAccountsDataSizeLimit set for transaction must be greater than 0.",[Xz]:"This program may not be used for executing instructions",[Nz]:"Transaction leaves an account with a lower balance than rent-exempt minimum",[Vz]:"Transaction loads a writable account that cannot be written",[Ez]:"Transaction exceeded max loaded accounts data size cap",[Uz]:"Transaction requires a fee but has no signature present",[Az]:"Attempt to load a program that does not exist",[_z]:"Execution of the program referenced by account at index $accountIndex is temporarily restricted.",[Bz]:"ResanitizationNeeded",[Pz]:"Transaction failed to sanitize accounts offsets correctly",[Zz]:"Transaction did not pass signature verification",[Dz]:"Transaction locked too many accounts",[xz]:"Sum of account balances before and after transaction do not match",[sk]:"The transaction failed with the error `$errorName`",[Hz]:"Transaction version is unsupported",[Rz]:"Transaction would exceed account data limit within the block",[Sz]:"Transaction would exceed total account data limit",[jz]:"Transaction would exceed max account limit within the block",[Cz]:"Transaction would exceed max Block Cost Limit",[Iz]:"Transaction would exceed max Vote Cost Limit",[fk]:"Attempted to sign a transaction with an address that is not a signer for it",[pk]:"Transaction is missing an address at index: $index.",[rk]:"Transaction has no expected signers therefore it cannot be encoded",[ak]:"Transaction size $transactionSize exceeds limit of $transactionSizeLimit bytes",[_k]:"Transaction does not have a blockhash lifetime",[xk]:"Transaction is not a durable nonce transaction",[gk]:"Contents of these address lookup tables unknown: $lookupTableAddresses",[mk]:"Lookup of address at index $highestRequestedIndex failed for lookup table `$lookupTableAddress`. Highest known index is $highestKnownIndex. The lookup table may have been extended since its contents were retrieved",[yk]:"No fee payer set in CompiledTransaction",[vk]:"Could not find program address at index $index",[ik]:"Failed to estimate the compute unit consumption for this transaction message. This is likely because simulating the transaction failed. Inspect the `cause` property of this error to learn more",[ok]:"Transaction failed when it was simulated in order to estimate the compute unit consumption. The compute unit estimate provided is for a transaction that failed when simulated and may not be representative of the compute units this transaction would consume if successful. Inspect the `cause` property of this error to learn more",[lk]:"Transaction is missing a fee payer.",[uk]:"Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer.",[ck]:"Transaction first instruction is not advance nonce account instruction.",[dk]:"Transaction with no instructions cannot be durable nonce transaction.",[Ok]:"This transaction includes an address (`$programAddress`) which is both invoked and set as the fee payer. Program addresses may not pay fees",[Bk]:"This transaction includes an address (`$programAddress`) which is both invoked and marked writable. Program addresses may not be writable",[nk]:"The transaction message expected the transaction to have $signerAddressesLength signatures, got $signaturesLength.",[bk]:"Transaction is missing signatures for addresses: $addresses.",[hk]:"Transaction version must be in the range [0, 127]. `$actualVersion` given"},U8="i",pT="t";function GF(T,A={}){let Q=$F[T];if(Q.length===0)return"";let J;function W(G){if(J[pT]===2){let Y=Q.slice(J[U8]+1,G);$.push(Y in A?`${A[Y]}`:`$${Y}`)}else if(J[pT]===1)$.push(Q.slice(J[U8],G))}let $=[];return Q.split("").forEach((G,Y)=>{if(Y===0){J={[U8]:0,[pT]:Q[0]==="\\"?0:Q[0]==="$"?2:1};return}let Z;switch(J[pT]){case 0:Z={[U8]:Y,[pT]:1};break;case 1:if(G==="\\")Z={[U8]:Y,[pT]:0};else if(G==="$")Z={[U8]:Y,[pT]:2};break;case 2:if(G==="\\")Z={[U8]:Y,[pT]:0};else if(G==="$")Z={[U8]:Y,[pT]:2};else if(!G.match(/\w/))Z={[U8]:Y,[pT]:1};break}if(Z){if(J!==Z)W(Y);J=Z}}),W(),$.join("")}function UF(T,A={}){return GF(T,A)}var x8=class extends Error{cause=this.cause;context;constructor(...[T,A]){let Q,J;if(A){let{cause:$,...G}=A;if($)J={cause:$};if(Object.keys(G).length>0)Q=G}let W=UF(T,Q);super(W,J);this.context={__code:T,...Q},this.name="SolanaError"}};function YF(T,A){return"fixedSize"in A?A.fixedSize:A.getSizeFromValue(T)}function vX(T){return Object.freeze({...T,encode:(A)=>{let Q=new Uint8Array(YF(A,T));return T.write(A,Q,0),Q}})}function yX(T){return Object.freeze({...T,decode:(A,Q=0)=>T.read(A,Q)[0]})}function vA(T){return"fixedSize"in T&&typeof T.fixedSize==="number"}function bX(T,A){if(vA(T)!==vA(A))throw new x8(cW);if(vA(T)&&vA(A)&&T.fixedSize!==A.fixedSize)throw new x8(fW,{decoderFixedSize:A.fixedSize,encoderFixedSize:T.fixedSize});if(!vA(T)&&!vA(A)&&T.maxSize!==A.maxSize)throw new x8(rW,{decoderMaxSize:A.maxSize,encoderMaxSize:T.maxSize});return{...A,...T,decode:A.decode,encode:T.encode,read:A.read,write:T.write}}function pX(T,A,Q=0){if(A.length-Q<=0)throw new x8(uW,{codecDescription:T})}function lX(T,A,Q,J=0){let W=Q.length-J;if(W<A)throw new x8(dW,{bytesLength:W,codecDescription:T,expected:A})}function ZF(T,A,Q,J){if(J<A||J>Q)throw new x8(nW,{codecDescription:T,max:Q,min:A,value:J})}function uX(T){return T?.endian===1?!1:!0}function XF(T){return vX({fixedSize:T.size,write(A,Q,J){if(T.range)ZF(T.name,T.range[0],T.range[1],A);let W=new ArrayBuffer(T.size);return T.set(new DataView(W),A,uX(T.config)),Q.set(new Uint8Array(W),J),J+T.size}})}function PF(T){return yX({fixedSize:T.size,read(A,Q=0){pX(T.name,A,Q),lX(T.name,T.size,A,Q);let J=new DataView(qF(A,Q,T.size));return[T.get(J,uX(T.config)),Q+T.size]}})}function qF(T,A,Q){let J=T.byteOffset+(A??0),W=Q??T.byteLength;return T.buffer.slice(J,J+W)}var iW=(T={})=>XF({config:T,name:"u64",range:[0n,BigInt("0xffffffffffffffff")],set:(A,Q,J)=>A.setBigUint64(0,BigInt(Q),J),size:8}),KF=(T={})=>PF({config:T,get:(A,Q)=>A.getBigUint64(0,Q),name:"u64",size:8}),dX=(T={})=>bX(iW(T),KF(T));class fX extends TypeError{constructor(T,A){let Q,{message:J,explanation:W,...$}=T,{path:G}=T,Y=G.length===0?J:`At path: ${G.join(".")} -- ${J}`;super(W??Y);if(W!=null)this.cause=Y;Object.assign(this,$),this.name=this.constructor.name,this.failures=()=>{return Q??(Q=[T,...A()])}}}function CF(T){return N2(T)&&typeof T[Symbol.iterator]==="function"}function N2(T){return typeof T==="object"&&T!=null}function ZQ(T){return N2(T)&&!Array.isArray(T)}function DT(T){if(typeof T==="symbol")return T.toString();return typeof T==="string"?JSON.stringify(T):`${T}`}function HF(T){let{done:A,value:Q}=T.next();return A?void 0:Q}function VF(T,A,Q,J){if(T===!0)return;else if(T===!1)T={};else if(typeof T==="string")T={message:T};let{path:W,branch:$}=A,{type:G}=Q,{refinement:Y,message:Z=`Expected a value of type \`${G}\`${Y?` with refinement \`${Y}\``:""}, but received: \`${DT(J)}\``}=T;return{value:J,type:G,refinement:Y,key:W[W.length-1],path:W,branch:$,...T,message:Z}}function*cX(T,A,Q,J){if(!CF(T))T=[T];for(let W of T){let $=VF(W,A,Q,J);if($)yield $}}function*oW(T,A,Q={}){let{path:J=[],branch:W=[T],coerce:$=!1,mask:G=!1}=Q,Y={path:J,branch:W,mask:G};if($)T=A.coercer(T,Y);let Z="valid";for(let C of A.validator(T,Y))C.explanation=Q.message,Z="not_valid",yield[C,void 0];for(let[C,K,V]of A.entries(T,Y)){let M=oW(K,V,{path:C===void 0?J:[...J,C],branch:C===void 0?W:[...W,K],coerce:$,mask:G,message:Q.message});for(let z of M)if(z[0])Z=z[0].refinement!=null?"not_refined":"not_valid",yield[z[0],void 0];else if($){if(K=z[1],C===void 0)T=K;else if(T instanceof Map)T.set(C,K);else if(T instanceof Set)T.add(K);else if(N2(T)){if(K!==void 0||C in T)T[C]=K}}}if(Z!=="not_valid")for(let C of A.refiner(T,Y))C.explanation=Q.message,Z="not_refined",yield[C,void 0];if(Z==="valid")yield[void 0,T]}class MT{constructor(T){let{type:A,schema:Q,validator:J,refiner:W,coercer:$=(Y)=>Y,entries:G=function*(){}}=T;if(this.type=A,this.schema=Q,this.entries=G,this.coercer=$,J)this.validator=(Y,Z)=>{let C=J(Y,Z);return cX(C,Z,this,Y)};else this.validator=()=>[];if(W)this.refiner=(Y,Z)=>{let C=W(Y,Z);return cX(C,Z,this,Y)};else this.refiner=()=>[]}assert(T,A){return rX(T,this,A)}create(T,A){return yA(T,this,A)}is(T){return nX(T,this)}mask(T,A){return jF(T,this,A)}validate(T,A={}){return I2(T,this,A)}}function rX(T,A,Q){let J=I2(T,A,{message:Q});if(J[0])throw J[0]}function yA(T,A,Q){let J=I2(T,A,{coerce:!0,message:Q});if(J[0])throw J[0];else return J[1]}function jF(T,A,Q){let J=I2(T,A,{coerce:!0,mask:!0,message:Q});if(J[0])throw J[0];else return J[1]}function nX(T,A){return!I2(T,A)[0]}function I2(T,A,Q={}){let J=oW(T,A,Q),W=HF(J);if(W[0])return[new fX(W[0],function*(){for(let G of J)if(G[0])yield G[0]}),void 0];else return[void 0,W[1]]}function ZA(T,A){return new MT({type:T,schema:null,validator:A})}function iX(){return ZA("any",()=>!0)}function s(T){return new MT({type:"array",schema:T,*entries(A){if(T&&Array.isArray(A))for(let[Q,J]of A.entries())yield[Q,J,T]},coercer(A){return Array.isArray(A)?A.slice():A},validator(A){return Array.isArray(A)||`Expected an array value, but received: ${DT(A)}`}})}function kT(){return ZA("boolean",(T)=>{return typeof T==="boolean"})}function XQ(T){return ZA("instance",(A)=>{return A instanceof T||`Expected a \`${T.name}\` instance, but received: ${DT(A)}`})}function z1(T){let A=DT(T),Q=typeof T;return new MT({type:"literal",schema:Q==="string"||Q==="number"||Q==="boolean"?T:null,validator(J){return J===T||`Expected the literal \`${A}\`, but received: ${DT(J)}`}})}function RF(){return ZA("never",()=>!1)}function t(T){return new MT({...T,validator:(A,Q)=>A===null||T.validator(A,Q),refiner:(A,Q)=>A===null||T.refiner(A,Q)})}function B(){return ZA("number",(T)=>{return typeof T==="number"&&!isNaN(T)||`Expected a number, but received: ${DT(T)}`})}function A1(T){return new MT({...T,validator:(A,Q)=>A===void 0||T.validator(A,Q),refiner:(A,Q)=>A===void 0||T.refiner(A,Q)})}function aW(T,A){return new MT({type:"record",schema:null,*entries(Q){if(N2(Q))for(let J in Q){let W=Q[J];yield[J,J,T],yield[J,W,A]}},validator(Q){return ZQ(Q)||`Expected an object, but received: ${DT(Q)}`},coercer(Q){return ZQ(Q)?{...Q}:Q}})}function l(){return ZA("string",(T)=>{return typeof T==="string"||`Expected a string, but received: ${DT(T)}`})}function PQ(T){let A=RF();return new MT({type:"tuple",schema:null,*entries(Q){if(Array.isArray(Q)){let J=Math.max(T.length,Q.length);for(let W=0;W<J;W++)yield[W,Q[W],T[W]||A]}},validator(Q){return Array.isArray(Q)||`Expected an array, but received: ${DT(Q)}`},coercer(Q){return Array.isArray(Q)?Q.slice():Q}})}function y(T){let A=Object.keys(T);return new MT({type:"type",schema:T,*entries(Q){if(N2(Q))for(let J of A)yield[J,Q[J],T[J]]},validator(Q){return ZQ(Q)||`Expected an object, but received: ${DT(Q)}`},coercer(Q){return ZQ(Q)?{...Q}:Q}})}function _0(T){let A=T.map((Q)=>Q.type).join(" | ");return new MT({type:"union",schema:null,coercer(Q,J){for(let W of T){let[$,G]=W.validate(Q,{coerce:!0,mask:J.mask});if(!$)return G}return Q},validator(Q,J){let W=[];for(let $ of T){let[...G]=oW(Q,$,J),[Y]=G;if(!Y[0])return[];else for(let[Z]of G)if(Z)W.push(Z)}return[`Expected the value to satisfy a union of \`${A}\`, but received: ${DT(Q)}`,...W]}})}function XA(){return ZA("unknown",()=>!0)}function bA(T,A,Q){return new MT({...T,coercer:(J,W)=>{return nX(J,A)?T.coercer(Q(J,W),W):T.coercer(J,W)}})}var XN=n0(j9(),1);LA();var M9=n0(D9(),1);var fF=BigInt(0),x2=BigInt(1),rF=BigInt(2),nF=BigInt(7),iF=BigInt(256),oF=BigInt(113),F9=[],N9=[],I9=[];for(let T=0,A=x2,Q=1,J=0;T<24;T++){[Q,J]=[J,(2*Q+3*J)%5],F9.push(2*(5*J+Q)),N9.push((T+1)*(T+2)/2%64);let W=fF;for(let $=0;$<7;$++)if(A=(A<<x2^(A>>nF)*oF)%iF,A&rF)W^=x2<<(x2<<BigInt($))-x2;I9.push(W)}var S9=d6(I9,!0),aF=S9[0],sF=S9[1],k9=(T,A,Q)=>Q>32?xZ(T,A,Q):BZ(T,A,Q),z9=(T,A,Q)=>Q>32?hZ(T,A,Q):_Z(T,A,Q);function tF(T,A=24){let Q=new Uint32Array(10);for(let J=24-A;J<24;J++){for(let G=0;G<10;G++)Q[G]=T[G]^T[G+10]^T[G+20]^T[G+30]^T[G+40];for(let G=0;G<10;G+=2){let Y=(G+8)%10,Z=(G+2)%10,C=Q[Z],K=Q[Z+1],V=k9(C,K,1)^Q[Y],M=z9(C,K,1)^Q[Y+1];for(let z=0;z<50;z+=10)T[G+z]^=V,T[G+z+1]^=M}let W=T[2],$=T[3];for(let G=0;G<24;G++){let Y=N9[G],Z=k9(W,$,Y),C=z9(W,$,Y),K=F9[G];W=T[K],$=T[K+1],T[K]=Z,T[K+1]=C}for(let G=0;G<50;G+=10){for(let Y=0;Y<10;Y++)Q[Y]=T[G+Y];for(let Y=0;Y<10;Y++)T[G+Y]^=~Q[(Y+2)%10]&Q[(Y+4)%10]}T[0]^=aF[J],T[1]^=sF[J]}KT(Q)}class U$ extends TA{constructor(T,A,Q,J=!1,W=24){super();if(this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=T,this.suffix=A,this.outputLen=Q,this.enableXOF=J,this.rounds=W,F8(Q),!(0<T&&T<200))throw Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=SZ(this.state)}clone(){return this._cloneInto()}keccak(){uJ(this.state32),tF(this.state32,this.rounds),uJ(this.state32),this.posOut=0,this.pos=0}update(T){tT(this),T=e8(T),I0(T);let{blockLen:A,state:Q}=this,J=T.length;for(let W=0;W<J;){let $=Math.min(A-this.pos,J-W);for(let G=0;G<$;G++)Q[this.pos++]^=T[W++];if(this.pos===A)this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:T,suffix:A,pos:Q,blockLen:J}=this;if(T[Q]^=A,(A&128)!==0&&Q===J-1)this.keccak();T[J-1]^=128,this.keccak()}writeInto(T){tT(this,!1),I0(T),this.finish();let A=this.state,{blockLen:Q}=this;for(let J=0,W=T.length;J<W;){if(this.posOut>=Q)this.keccak();let $=Math.min(Q-this.posOut,W-J);T.set(A.subarray(this.posOut,this.posOut+$),J),this.posOut+=$,J+=$}return T}xofInto(T){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(T)}xof(T){return F8(T),this.xofInto(new Uint8Array(T))}digestInto(T){if(b6(T,this),this.finished)throw Error("digest() was already called");return this.writeInto(T),this.destroy(),T}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,KT(this.state)}_cloneInto(T){let{blockLen:A,suffix:Q,outputLen:J,rounds:W,enableXOF:$}=this;return T||(T=new U$(A,Q,J,$,W)),T.state32.set(this.state32),T.pos=this.pos,T.posOut=this.posOut,T.finished=this.finished,T.rounds=W,T.suffix=Q,T.outputLen=J,T.enableXOF=$,T.destroyed=this.destroyed,T}}var eF=(T,A,Q)=>C2(()=>new U$(A,T,Q));var Y$=(()=>eF(1,136,32))();class Z$ extends TA{constructor(T,A){super();this.finished=!1,this.destroyed=!1,y6(T);let Q=e8(A);if(this.iHash=T.create(),typeof this.iHash.update!=="function")throw Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let J=this.blockLen,W=new Uint8Array(J);W.set(Q.length>J?T.create().update(Q).digest():Q);for(let $=0;$<W.length;$++)W[$]^=54;this.iHash.update(W),this.oHash=T.create();for(let $=0;$<W.length;$++)W[$]^=106;this.oHash.update(W),KT(W)}update(T){return tT(this),this.iHash.update(T),this}digestInto(T){tT(this),I0(T,this.outputLen),this.finished=!0,this.iHash.digestInto(T),this.oHash.update(T),this.oHash.digestInto(T),this.destroy()}digest(){let T=new Uint8Array(this.oHash.outputLen);return this.digestInto(T),T}_cloneInto(T){T||(T=Object.create(Object.getPrototypeOf(this),{}));let{oHash:A,iHash:Q,finished:J,destroyed:W,blockLen:$,outputLen:G}=this;return T=T,T.finished=J,T.destroyed=W,T.blockLen=$,T.outputLen=G,T.oHash=A._cloneInto(T.oHash),T.iHash=Q._cloneInto(T.iHash),T}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}var X$=(T,A,Q)=>new Z$(T,A).update(Q).digest();X$.create=(T,A)=>new Z$(T,A);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var L9=(T,A)=>(T+(T>=0?A:-A)/E9)/A;function TN(T,A,Q){let[[J,W],[$,G]]=A,Y=L9(G*T,Q),Z=L9(-W*T,Q),C=T-Y*J-Z*$,K=-Y*W-Z*G,V=C<Z8,M=K<Z8;if(V)C=-C;if(M)K=-K;let z=L8(Math.ceil(r6(Q)/2))+lA;if(C<Z8||C>=z||K<Z8||K>=z)throw Error("splitScalar (endomorphism): failed, k="+T);return{k1neg:V,k1:C,k2neg:M,k2:K}}function q$(T){if(!["compact","recovered","der"].includes(T))throw Error('Signature format must be "compact", "recovered", or "der"');return T}function P$(T,A){let Q={};for(let J of Object.keys(A))Q[J]=T[J]===void 0?A[J]:T[J];if(T8(Q.lowS,"lowS"),T8(Q.prehash,"prehash"),Q.format!==void 0)q$(Q.format);return Q}class w9 extends Error{constructor(T=""){super(T)}}var Y8={Err:w9,_tlv:{encode:(T,A)=>{let{Err:Q}=Y8;if(T<0||T>256)throw new Q("tlv.encode: wrong tag");if(A.length&1)throw new Q("tlv.encode: unpadded data");let J=A.length/2,W=j2(J);if(W.length/2&128)throw new Q("tlv.encode: long form length too big");let $=J>127?j2(W.length/2|128):"";return j2(T)+$+W+A},decode(T,A){let{Err:Q}=Y8,J=0;if(T<0||T>256)throw new Q("tlv.encode: wrong tag");if(A.length<2||A[J++]!==T)throw new Q("tlv.decode: wrong tlv");let W=A[J++],$=!!(W&128),G=0;if(!$)G=W;else{let Z=W&127;if(!Z)throw new Q("tlv.decode(long): indefinite length not supported");if(Z>4)throw new Q("tlv.decode(long): byte length is too big");let C=A.subarray(J,J+Z);if(C.length!==Z)throw new Q("tlv.decode: length bytes not complete");if(C[0]===0)throw new Q("tlv.decode(long): zero leftmost byte");for(let K of C)G=G<<8|K;if(J+=Z,G<128)throw new Q("tlv.decode(long): not minimal encoding")}let Y=A.subarray(J,J+G);if(Y.length!==G)throw new Q("tlv.decode: wrong value length");return{v:Y,l:A.subarray(J+G)}}},_int:{encode(T){let{Err:A}=Y8;if(T<Z8)throw new A("integer: negative integers are not allowed");let Q=j2(T);if(Number.parseInt(Q[0],16)&8)Q="00"+Q;if(Q.length&1)throw new A("unexpected DER parsing assertion: unpadded hex");return Q},decode(T){let{Err:A}=Y8;if(T[0]&128)throw new A("invalid signature integer: negative");if(T[0]===0&&!(T[1]&128))throw new A("invalid signature integer: unnecessary leading zero");return EA(T)}},toSig(T){let{Err:A,_int:Q,_tlv:J}=Y8,W=q1("signature",T),{v:$,l:G}=J.decode(48,W);if(G.length)throw new A("invalid signature: left bytes after parsing");let{v:Y,l:Z}=J.decode(2,$),{v:C,l:K}=J.decode(2,Z);if(K.length)throw new A("invalid signature: left bytes after parsing");return{r:Q.decode(Y),s:Q.decode(C)}},hexFromSig(T){let{_tlv:A,_int:Q}=Y8,J=A.encode(2,Q.encode(T.r)),W=A.encode(2,Q.encode(T.s)),$=J+W;return A.encode(48,$)}},Z8=BigInt(0),lA=BigInt(1),E9=BigInt(2),VQ=BigInt(3),AN=BigInt(4);function pA(T,A){let{BYTES:Q}=T,J;if(typeof A==="bigint")J=A;else{let W=q1("private key",A);try{J=T.fromBytes(W)}catch($){throw Error(`invalid private key: expected ui8a of size ${Q}, got ${typeof A}`)}}if(!T.isValidNot0(J))throw Error("invalid private key: out of range [1..N-1]");return J}function QN(T,A={}){let Q=i6("weierstrass",T,A),{Fp:J,Fn:W}=Q,$=Q.CURVE,{h:G,n:Y}=$;w8(A,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});let{endo:Z}=A;if(Z){if(!J.is0($.a)||typeof Z.beta!=="bigint"||!Array.isArray(Z.basises))throw Error('invalid endo: expected "beta": bigint and "basises": array')}let C=B9(J,W);function K(){if(!J.isOdd)throw Error("compression is not supported: Field does not have .isOdd()")}function V(x,R,U){let{x:X,y:q}=R.toAffine(),H=J.toBytes(X);if(T8(U,"isCompressed"),U){K();let j=!J.isOdd(q);return l0(O9(j),H)}else return l0(Uint8Array.of(4),H,J.toBytes(q))}function M(x){$T(x,void 0,"Point");let{publicKey:R,publicKeyUncompressed:U}=C,X=x.length,q=x[0],H=x.subarray(1);if(X===R&&(q===2||q===3)){let j=J.fromBytes(H);if(!J.isValid(j))throw Error("bad point: is not on curve, wrong x");let F=w(j),I;try{I=J.sqrt(F)}catch(k){let b=k instanceof Error?": "+k.message:"";throw Error("bad point: is not on curve, sqrt error"+b)}K();let D=J.isOdd(I);if((q&1)===1!==D)I=J.neg(I);return{x:j,y:I}}else if(X===U&&q===4){let j=J.BYTES,F=J.fromBytes(H.subarray(0,j)),I=J.fromBytes(H.subarray(j,j*2));if(!L(F,I))throw Error("bad point: is not on curve");return{x:F,y:I}}else throw Error(`bad point: got length ${X}, expected compressed=${R} or uncompressed=${U}`)}let z=A.toBytes||V,N=A.fromBytes||M;function w(x){let R=J.sqr(x),U=J.mul(R,x);return J.add(J.add(U,J.mul(x,$.a)),$.b)}function L(x,R){let U=J.sqr(R),X=w(x);return J.eql(U,X)}if(!L($.Gx,$.Gy))throw Error("bad curve params: generator point");let O=J.mul(J.pow($.a,VQ),AN),g=J.mul(J.sqr($.b),BigInt(27));if(J.is0(J.add(O,g)))throw Error("bad curve params: a or b");function v(x,R,U=!1){if(!J.isValid(R)||U&&J.is0(R))throw Error(`bad point coordinate ${x}`);return R}function p(x){if(!(x instanceof h))throw Error("ProjectivePoint expected")}function d(x){if(!Z||!Z.basises)throw Error("no endo");return TN(x,Z.basises,W.ORDER)}let c=OA((x,R)=>{let{X:U,Y:X,Z:q}=x;if(J.eql(q,J.ONE))return{x:U,y:X};let H=x.is0();if(R==null)R=H?J.ONE:J.inv(q);let j=J.mul(U,R),F=J.mul(X,R),I=J.mul(q,R);if(H)return{x:J.ZERO,y:J.ZERO};if(!J.eql(I,J.ONE))throw Error("invZ was invalid");return{x:j,y:F}}),r=OA((x)=>{if(x.is0()){if(A.allowInfinityPoint&&!J.is0(x.Y))return;throw Error("bad point: ZERO")}let{x:R,y:U}=x.toAffine();if(!J.isValid(R)||!J.isValid(U))throw Error("bad point: x or y not field elements");if(!L(R,U))throw Error("bad point: equation left != right");if(!x.isTorsionFree())throw Error("bad point: not in prime-order subgroup");return!0});function u(x,R,U,X,q){return U=new h(J.mul(U.X,x),U.Y,U.Z),R=M2(X,R),U=M2(q,U),R.add(U)}class h{constructor(x,R,U){this.X=v("x",x),this.Y=v("y",R,!0),this.Z=v("z",U),Object.freeze(this)}static CURVE(){return $}static fromAffine(x){let{x:R,y:U}=x||{};if(!x||!J.isValid(R)||!J.isValid(U))throw Error("invalid affine point");if(x instanceof h)throw Error("projective point not allowed");if(J.is0(R)&&J.is0(U))return h.ZERO;return new h(R,U,J.ONE)}static fromBytes(x){let R=h.fromAffine(N($T(x,void 0,"point")));return R.assertValidity(),R}static fromHex(x){return h.fromBytes(q1("pointHex",x))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(x=8,R=!0){if(i.createCache(this,x),!R)this.multiply(VQ);return this}assertValidity(){r(this)}hasEvenY(){let{y:x}=this.toAffine();if(!J.isOdd)throw Error("Field doesn't support isOdd");return!J.isOdd(x)}equals(x){p(x);let{X:R,Y:U,Z:X}=this,{X:q,Y:H,Z:j}=x,F=J.eql(J.mul(R,j),J.mul(q,X)),I=J.eql(J.mul(U,j),J.mul(H,X));return F&&I}negate(){return new h(this.X,J.neg(this.Y),this.Z)}double(){let{a:x,b:R}=$,U=J.mul(R,VQ),{X,Y:q,Z:H}=this,j=J.ZERO,F=J.ZERO,I=J.ZERO,D=J.mul(X,X),P=J.mul(q,q),k=J.mul(H,H),b=J.mul(X,q);return b=J.add(b,b),I=J.mul(X,H),I=J.add(I,I),j=J.mul(x,I),F=J.mul(U,k),F=J.add(j,F),j=J.sub(P,F),F=J.add(P,F),F=J.mul(j,F),j=J.mul(b,j),I=J.mul(U,I),k=J.mul(x,k),b=J.sub(D,k),b=J.mul(x,b),b=J.add(b,I),I=J.add(D,D),D=J.add(I,D),D=J.add(D,k),D=J.mul(D,b),F=J.add(F,D),k=J.mul(q,H),k=J.add(k,k),D=J.mul(k,b),j=J.sub(j,D),I=J.mul(k,P),I=J.add(I,I),I=J.add(I,I),new h(j,F,I)}add(x){p(x);let{X:R,Y:U,Z:X}=this,{X:q,Y:H,Z:j}=x,F=J.ZERO,I=J.ZERO,D=J.ZERO,P=$.a,k=J.mul($.b,VQ),b=J.mul(R,q),n=J.mul(U,H),f=J.mul(X,j),T1=J.add(R,U),Q1=J.add(q,H);T1=J.mul(T1,Q1),Q1=J.add(b,n),T1=J.sub(T1,Q1),Q1=J.add(R,X);let J1=J.add(q,j);return Q1=J.mul(Q1,J1),J1=J.add(b,f),Q1=J.sub(Q1,J1),J1=J.add(U,X),F=J.add(H,j),J1=J.mul(J1,F),F=J.add(n,f),J1=J.sub(J1,F),D=J.mul(P,Q1),F=J.mul(k,f),D=J.add(F,D),F=J.sub(n,D),D=J.add(n,D),I=J.mul(F,D),n=J.add(b,b),n=J.add(n,b),f=J.mul(P,f),Q1=J.mul(k,Q1),n=J.add(n,f),f=J.sub(b,f),f=J.mul(P,f),Q1=J.add(Q1,f),b=J.mul(n,Q1),I=J.add(I,b),b=J.mul(J1,Q1),F=J.mul(T1,F),F=J.sub(F,b),b=J.mul(T1,n),D=J.mul(J1,D),D=J.add(D,b),new h(F,I,D)}subtract(x){return this.add(x.negate())}is0(){return this.equals(h.ZERO)}multiply(x){let{endo:R}=A;if(!W.isValidNot0(x))throw Error("invalid scalar: out of range");let U,X,q=(H)=>i.cached(this,H,(j)=>J8(h,j));if(R){let{k1neg:H,k1:j,k2neg:F,k2:I}=d(x),{p:D,f:P}=q(j),{p:k,f:b}=q(I);X=P.add(b),U=u(R.beta,D,k,H,F)}else{let{p:H,f:j}=q(x);U=H,X=j}return J8(h,[U,X])[0]}multiplyUnsafe(x){let{endo:R}=A,U=this;if(!W.isValid(x))throw Error("invalid scalar: out of range");if(x===Z8||U.is0())return h.ZERO;if(x===lA)return U;if(i.hasCache(this))return this.multiply(x);if(R){let{k1neg:X,k1:q,k2neg:H,k2:j}=d(x),{p1:F,p2:I}=ZX(h,U,q,j);return u(R.beta,F,I,X,H)}else return i.unsafe(U,x)}multiplyAndAddUnsafe(x,R,U){let X=this.multiplyUnsafe(R).add(x.multiplyUnsafe(U));return X.is0()?void 0:X}toAffine(x){return c(this,x)}isTorsionFree(){let{isTorsionFree:x}=A;if(G===lA)return!0;if(x)return x(h,this);return i.unsafe(this,Y).is0()}clearCofactor(){let{clearCofactor:x}=A;if(G===lA)return this;if(x)return x(h,this);return this.multiplyUnsafe(G)}isSmallOrder(){return this.multiplyUnsafe(G).is0()}toBytes(x=!0){return T8(x,"isCompressed"),this.assertValidity(),z(h,this,x)}toHex(x=!0){return CT(this.toBytes(x))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(x=!0){return this.toBytes(x)}_setWindowSize(x){this.precompute(x)}static normalizeZ(x){return J8(h,x)}static msm(x,R){return _A(h,W,x,R)}static fromPrivateKey(x){return h.BASE.multiply(pA(W,x))}}h.BASE=new h($.Gx,$.Gy,J.ONE),h.ZERO=new h(J.ZERO,J.ONE,J.ZERO),h.Fp=J,h.Fn=W;let o=W.BITS,i=new k2(h,A.endo?Math.ceil(o/2):o);return h.BASE.precompute(8),h}function O9(T){return Uint8Array.of(T?2:3)}function B9(T,A){return{secretKey:A.BYTES,publicKey:1+T.BYTES,publicKeyUncompressed:1+2*T.BYTES,publicKeyHasPrefix:!0,signature:2*A.BYTES}}function JN(T,A={}){let{Fn:Q}=T,J=A.randomBytes||wA,W=Object.assign(B9(T.Fp,Q),{seed:AW(Q.ORDER)});function $(z){try{return!!pA(Q,z)}catch(N){return!1}}function G(z,N){let{publicKey:w,publicKeyUncompressed:L}=W;try{let O=z.length;if(N===!0&&O!==w)return!1;if(N===!1&&O!==L)return!1;return!!T.fromBytes(z)}catch(O){return!1}}function Y(z=J(W.seed)){return QW($T(z,W.seed,"seed"),Q.ORDER)}function Z(z,N=!0){return T.BASE.multiply(pA(Q,z)).toBytes(N)}function C(z){let N=Y(z);return{secretKey:N,publicKey:Z(N)}}function K(z){if(typeof z==="bigint")return!1;if(z instanceof T)return!0;let{secretKey:N,publicKey:w,publicKeyUncompressed:L}=W;if(Q.allowedLengths||N===w)return;let O=q1("key",z).length;return O===w||O===L}function V(z,N,w=!0){if(K(z)===!0)throw Error("first arg must be private key");if(K(N)===!1)throw Error("second arg must be public key");let L=pA(Q,z);return T.fromHex(N).multiply(L).toBytes(w)}return Object.freeze({getPublicKey:Z,getSharedSecret:V,keygen:C,Point:T,utils:{isValidSecretKey:$,isValidPublicKey:G,randomSecretKey:Y,isValidPrivateKey:$,randomPrivateKey:Y,normPrivateKeyToScalar:(z)=>pA(Q,z),precompute(z=8,N=T.BASE){return N.precompute(z,!1)}},lengths:W})}function WN(T,A,Q={}){y6(A),w8(Q,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});let J=Q.randomBytes||wA,W=Q.hmac||((U,...X)=>X$(A,U,l0(...X))),{Fp:$,Fn:G}=T,{ORDER:Y,BITS:Z}=G,{keygen:C,getPublicKey:K,getSharedSecret:V,utils:M,lengths:z}=JN(T,Q),N={prehash:!1,lowS:typeof Q.lowS==="boolean"?Q.lowS:!1,format:void 0,extraEntropy:!1},w="compact";function L(U){let X=Y>>lA;return U>X}function O(U,X){if(!G.isValidNot0(X))throw Error(`invalid signature ${U}: out of range 1..Point.Fn.ORDER`);return X}function g(U,X){q$(X);let q=z.signature,H=X==="compact"?q:X==="recovered"?q+1:void 0;return $T(U,H,`${X} signature`)}class v{constructor(U,X,q){if(this.r=O("r",U),this.s=O("s",X),q!=null)this.recovery=q;Object.freeze(this)}static fromBytes(U,X=w){g(U,X);let q;if(X==="der"){let{r:I,s:D}=Y8.toSig($T(U));return new v(I,D)}if(X==="recovered")q=U[0],X="compact",U=U.subarray(1);let H=G.BYTES,j=U.subarray(0,H),F=U.subarray(H,H*2);return new v(G.fromBytes(j),G.fromBytes(F),q)}static fromHex(U,X){return this.fromBytes(t8(U),X)}addRecoveryBit(U){return new v(this.r,this.s,U)}recoverPublicKey(U){let X=$.ORDER,{r:q,s:H,recovery:j}=this;if(j==null||![0,1,2,3].includes(j))throw Error("recovery id invalid");if(Y*E9<X&&j>1)throw Error("recovery id is ambiguous for h>1 curve");let I=j===2||j===3?q+Y:q;if(!$.isValid(I))throw Error("recovery id 2 or 3 invalid");let D=$.toBytes(I),P=T.fromBytes(l0(O9((j&1)===0),D)),k=G.inv(I),b=d(q1("msgHash",U)),n=G.create(-b*k),f=G.create(H*k),T1=T.BASE.multiplyUnsafe(n).add(P.multiplyUnsafe(f));if(T1.is0())throw Error("point at infinify");return T1.assertValidity(),T1}hasHighS(){return L(this.s)}toBytes(U=w){if(q$(U),U==="der")return t8(Y8.hexFromSig(this));let X=G.toBytes(this.r),q=G.toBytes(this.s);if(U==="recovered"){if(this.recovery==null)throw Error("recovery bit must be present");return l0(Uint8Array.of(this.recovery),X,q)}return l0(X,q)}toHex(U){return CT(this.toBytes(U))}assertValidity(){}static fromCompact(U){return v.fromBytes(q1("sig",U),"compact")}static fromDER(U){return v.fromBytes(q1("sig",U),"der")}normalizeS(){return this.hasHighS()?new v(this.r,G.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return CT(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return CT(this.toBytes("compact"))}}let p=Q.bits2int||function(X){if(X.length>8192)throw Error("input is too large");let q=EA(X),H=X.length*8-Z;return H>0?q>>BigInt(H):q},d=Q.bits2int_modN||function(X){return G.create(p(X))},c=L8(Z);function r(U){return R2("num < 2^"+Z,U,Z8,c),G.toBytes(U)}function u(U,X){return $T(U,void 0,"message"),X?$T(A(U),void 0,"prehashed message"):U}function h(U,X,q){if(["recovered","canonical"].some((f)=>(f in q)))throw Error("sign() legacy options not supported");let{lowS:H,prehash:j,extraEntropy:F}=P$(q,N);U=u(U,j);let I=d(U),D=pA(G,X),P=[r(D),r(I)];if(F!=null&&F!==!1){let f=F===!0?J(z.secretKey):F;P.push(q1("extraEntropy",f))}let k=l0(...P),b=I;function n(f){let T1=p(f);if(!G.isValidNot0(T1))return;let Q1=G.inv(T1),J1=T.BASE.multiply(T1).toAffine(),r0=G.create(J1.x);if(r0===Z8)return;let X1=G.create(Q1*G.create(b+r0*D));if(X1===Z8)return;let C1=(J1.x===r0?0:2)|Number(J1.y&lA),sA=X1;if(H&&L(X1))sA=G.neg(X1),C1^=1;return new v(r0,sA,C1)}return{seed:k,k2sig:n}}function o(U,X,q={}){U=q1("message",U);let{seed:H,k2sig:j}=h(U,X,q);return nZ(A.outputLen,G.BYTES,W)(H,j)}function i(U){let X=void 0,q=typeof U==="string"||sT(U),H=!q&&U!==null&&typeof U==="object"&&typeof U.r==="bigint"&&typeof U.s==="bigint";if(!q&&!H)throw Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(H)X=new v(U.r,U.s);else if(q){try{X=v.fromBytes(q1("sig",U),"der")}catch(j){if(!(j instanceof Y8.Err))throw j}if(!X)try{X=v.fromBytes(q1("sig",U),"compact")}catch(j){return!1}}if(!X)return!1;return X}function x(U,X,q,H={}){let{lowS:j,prehash:F,format:I}=P$(H,N);if(q=q1("publicKey",q),X=u(q1("message",X),F),"strict"in H)throw Error("options.strict was renamed to lowS");let D=I===void 0?i(U):v.fromBytes(q1("sig",U),I);if(D===!1)return!1;try{let P=T.fromBytes(q);if(j&&D.hasHighS())return!1;let{r:k,s:b}=D,n=d(X),f=G.inv(b),T1=G.create(n*f),Q1=G.create(k*f),J1=T.BASE.multiplyUnsafe(T1).add(P.multiplyUnsafe(Q1));if(J1.is0())return!1;return G.create(J1.x)===k}catch(P){return!1}}function R(U,X,q={}){let{prehash:H}=P$(q,N);return X=u(X,H),v.fromBytes(U,"recovered").recoverPublicKey(X).toBytes()}return Object.freeze({keygen:C,getPublicKey:K,getSharedSecret:V,utils:M,lengths:z,Point:T,sign:o,verify:x,recoverPublicKey:R,Signature:v,hash:A})}function $N(T){let A={a:T.a,b:T.b,p:T.Fp.ORDER,n:T.n,h:T.h,Gx:T.Gx,Gy:T.Gy},Q=T.Fp,J=T.allowedPrivateKeyLengths?Array.from(new Set(T.allowedPrivateKeyLengths.map((G)=>Math.ceil(G/2)))):void 0,W=GT(A.n,{BITS:T.nBitLength,allowedLengths:J,modFromBytes:T.wrapPrivateKey}),$={Fp:Q,Fn:W,allowInfinityPoint:T.allowInfinityPoint,endo:T.endo,isTorsionFree:T.isTorsionFree,clearCofactor:T.clearCofactor,fromBytes:T.fromBytes,toBytes:T.toBytes};return{CURVE:A,curveOpts:$}}function GN(T){let{CURVE:A,curveOpts:Q}=$N(T),J={hmac:T.hmac,randomBytes:T.randomBytes,lowS:T.lowS,bits2int:T.bits2int,bits2int_modN:T.bits2int_modN};return{CURVE:A,curveOpts:Q,hash:T.hash,ecdsaOpts:J}}function UN(T,A){let Q=A.Point;return Object.assign({},A,{ProjectivePoint:Q,CURVE:Object.assign({},T,n6(Q.Fn.ORDER,Q.Fn.BITS))})}function _9(T){let{CURVE:A,curveOpts:Q,hash:J,ecdsaOpts:W}=GN(T),$=QN(A,Q),G=WN($,J,W);return UN(T,G)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function x9(T,A){let Q=(J)=>_9({...T,hash:J});return{...Q(A),create:Q}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var C$={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},YN={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]};var h9=BigInt(2);function ZN(T){let A=C$.p,Q=BigInt(3),J=BigInt(6),W=BigInt(11),$=BigInt(22),G=BigInt(23),Y=BigInt(44),Z=BigInt(88),C=T*T*T%A,K=C*C*T%A,V=k1(K,Q,A)*K%A,M=k1(V,Q,A)*K%A,z=k1(M,h9,A)*C%A,N=k1(z,W,A)*z%A,w=k1(N,$,A)*N%A,L=k1(w,Y,A)*w%A,O=k1(L,Z,A)*L%A,g=k1(O,Y,A)*w%A,v=k1(g,Q,A)*K%A,p=k1(v,G,A)*N%A,d=k1(p,J,A)*C%A,c=k1(d,h9,A);if(!K$.eql(K$.sqr(c),T))throw Error("Cannot find square root");return c}var K$=GT(C$.p,{sqrt:ZN}),jQ=x9({...C$,Fp:K$,lowS:!0,endo:YN},c6);var px=s0.utils.randomPrivateKey,g9=()=>{let T=s0.utils.randomPrivateKey(),A=M$(T),Q=new Uint8Array(64);return Q.set(T),Q.set(A,32),{publicKey:A,secretKey:Q}},M$=s0.getPublicKey;function m9(T){try{return s0.ExtendedPoint.fromHex(T),!0}catch{return!1}}var i9=(T,A)=>s0.sign(T,A.slice(0,32)),PN=s0.verify,Y1=(T)=>{if(E.isBuffer(T))return T;else if(T instanceof Uint8Array)return E.from(T.buffer,T.byteOffset,T.byteLength);else return E.from(T)};class o9{constructor(T){Object.assign(this,T)}encode(){return E.from(cA.serialize(MQ,this))}static decode(T){return cA.deserialize(MQ,this,T)}static decodeUnchecked(T){return cA.deserializeUnchecked(MQ,this,T)}}var MQ=new Map,a9,qN=32,b2=32;function KN(T){return T._bn!==void 0}var v9=1;class a extends o9{constructor(T){super({});if(this._bn=void 0,KN(T))this._bn=T._bn;else{if(typeof T==="string"){let A=e0.default.decode(T);if(A.length!=b2)throw Error("Invalid public key input");this._bn=new D$.default(A)}else this._bn=new D$.default(T);if(this._bn.byteLength()>b2)throw Error("Invalid public key input")}}static unique(){let T=new a(v9);return v9+=1,new a(T.toBuffer())}equals(T){return this._bn.eq(T._bn)}toBase58(){return e0.default.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){let T=this.toBuffer();return new Uint8Array(T.buffer,T.byteOffset,T.byteLength)}toBuffer(){let T=this._bn.toArrayLike(E);if(T.length===b2)return T;let A=E.alloc(32);return T.copy(A,32-T.length),A}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(T,A,Q){let J=E.concat([T.toBuffer(),E.from(A),Q.toBuffer()]),W=VW(J);return new a(W)}static createProgramAddressSync(T,A){let Q=E.alloc(0);T.forEach(function(W){if(W.length>qN)throw TypeError("Max seed length exceeded");Q=E.concat([Q,Y1(W)])}),Q=E.concat([Q,A.toBuffer(),E.from("ProgramDerivedAddress")]);let J=VW(Q);if(m9(J))throw Error("Invalid seeds, address must fall off the curve");return new a(J)}static async createProgramAddress(T,A){return this.createProgramAddressSync(T,A)}static findProgramAddressSync(T,A){let Q=255,J;while(Q!=0){try{let W=T.concat(E.from([Q]));J=this.createProgramAddressSync(W,A)}catch(W){if(W instanceof TypeError)throw W;Q--;continue}return[J,Q]}throw Error("Unable to find a viable program address nonce")}static async findProgramAddress(T,A){return this.findProgramAddressSync(T,A)}static isOnCurve(T){let A=new a(T);return m9(A.toBytes())}}a9=a;a.default=new a9("11111111111111111111111111111111");MQ.set(a,{kind:"struct",fields:[["_bn","u256"]]});var lx=new a("BPFLoader1111111111111111111111111111111111"),kQ=1232,CN=127,s9=64;class t9 extends Error{constructor(T){super(`Signature ${T} has expired: block height exceeded.`);this.signature=void 0,this.signature=T}}Object.defineProperty(t9.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class e9 extends Error{constructor(T,A){super(`Transaction was not confirmed in ${A.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${T} using the Solana Explorer or CLI tools.`);this.signature=void 0,this.signature=T}}Object.defineProperty(e9.prototype,"name",{value:"TransactionExpiredTimeoutError"});class TP extends Error{constructor(T){super(`Signature ${T} has expired: the nonce is no longer valid.`);this.signature=void 0,this.signature=T}}Object.defineProperty(TP.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class k${constructor(T,A){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=T,this.accountKeysFromLookups=A}keySegments(){let T=[this.staticAccountKeys];if(this.accountKeysFromLookups)T.push(this.accountKeysFromLookups.writable),T.push(this.accountKeysFromLookups.readonly);return T}get(T){for(let A of this.keySegments())if(T<A.length)return A[T];else T-=A.length;return}get length(){return this.keySegments().flat().length}compileInstructions(T){if(this.length>256)throw Error("Account index overflow encountered during compilation");let Q=new Map;this.keySegments().flat().forEach((W,$)=>{Q.set(W.toBase58(),$)});let J=(W)=>{let $=Q.get(W.toBase58());if($===void 0)throw Error("Encountered an unknown instruction account key during compilation");return $};return T.map((W)=>{return{programIdIndex:J(W.programId),accountKeyIndexes:W.keys.map(($)=>J($.pubkey)),data:W.data}})}}var G1=(T="publicKey")=>{return S.blob(32,T)};var uA=(T="string")=>{let A=S.struct([S.u32("length"),S.u32("lengthPadding"),S.blob(S.offset(S.u32(),-8),"chars")],T),Q=A.decode.bind(A),J=A.encode.bind(A),W=A;return W.decode=($,G)=>{return Q($,G).chars.toString()},W.encode=($,G,Y)=>{let Z={chars:E.from($,"utf8")};return J(Z,G,Y)},W.alloc=($)=>{return S.u32().span+S.u32().span+E.from($,"utf8").length},W},HN=(T="authorized")=>{return S.struct([G1("staker"),G1("withdrawer")],T)},VN=(T="lockup")=>{return S.struct([S.ns64("unixTimestamp"),S.ns64("epoch"),G1("custodian")],T)},jN=(T="voteInit")=>{return S.struct([G1("nodePubkey"),G1("authorizedVoter"),G1("authorizedWithdrawer"),S.u8("commission")],T)},RN=(T="voteAuthorizeWithSeedArgs")=>{return S.struct([S.u32("voteAuthorizationType"),G1("currentAuthorityDerivedKeyOwnerPubkey"),uA("currentAuthorityDerivedKeySeed"),G1("newAuthorized")],T)};function AP(T,A){let Q=(W)=>{if(W.span>=0)return W.span;else if(typeof W.alloc==="function")return W.alloc(A[W.property]);else if("count"in W&&"elementLayout"in W){let $=A[W.property];if(Array.isArray($))return $.length*Q(W.elementLayout)}else if("fields"in W)return AP({layout:W},A[W.property]);return 0},J=0;return T.layout.fields.forEach((W)=>{J+=Q(W)}),J}function m2(T){let A=0,Q=0;for(;;){let J=T.shift();if(A|=(J&127)<<Q*7,Q+=1,(J&128)===0)break}return A}function v2(T,A){let Q=A;for(;;){let J=Q&127;if(Q>>=7,Q==0){T.push(J);break}else J|=128,T.push(J)}}function R0(T,A){if(!T)throw Error(A||"Assertion failed")}class F${constructor(T,A){this.payer=void 0,this.keyMetaMap=void 0,this.payer=T,this.keyMetaMap=A}static compile(T,A){let Q=new Map,J=($)=>{let G=$.toBase58(),Y=Q.get(G);if(Y===void 0)Y={isSigner:!1,isWritable:!1,isInvoked:!1},Q.set(G,Y);return Y},W=J(A);W.isSigner=!0,W.isWritable=!0;for(let $ of T){J($.programId).isInvoked=!0;for(let G of $.keys){let Y=J(G.pubkey);Y.isSigner||=G.isSigner,Y.isWritable||=G.isWritable}}return new F$(A,Q)}getMessageComponents(){let T=[...this.keyMetaMap.entries()];R0(T.length<=256,"Max static account keys length exceeded");let A=T.filter(([,Y])=>Y.isSigner&&Y.isWritable),Q=T.filter(([,Y])=>Y.isSigner&&!Y.isWritable),J=T.filter(([,Y])=>!Y.isSigner&&Y.isWritable),W=T.filter(([,Y])=>!Y.isSigner&&!Y.isWritable),$={numRequiredSignatures:A.length+Q.length,numReadonlySignedAccounts:Q.length,numReadonlyUnsignedAccounts:W.length};{R0(A.length>0,"Expected at least one writable signer key");let[Y]=A[0];R0(Y===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}let G=[...A.map(([Y])=>new a(Y)),...Q.map(([Y])=>new a(Y)),...J.map(([Y])=>new a(Y)),...W.map(([Y])=>new a(Y))];return[$,G]}extractTableLookup(T){let[A,Q]=this.drainKeysFoundInLookupTable(T.state.addresses,($)=>!$.isSigner&&!$.isInvoked&&$.isWritable),[J,W]=this.drainKeysFoundInLookupTable(T.state.addresses,($)=>!$.isSigner&&!$.isInvoked&&!$.isWritable);if(A.length===0&&J.length===0)return;return[{accountKey:T.key,writableIndexes:A,readonlyIndexes:J},{writable:Q,readonly:W}]}drainKeysFoundInLookupTable(T,A){let Q=[],J=[];for(let[W,$]of this.keyMetaMap.entries())if(A($)){let G=new a(W),Y=T.findIndex((Z)=>Z.equals(G));if(Y>=0)R0(Y<256,"Max lookup table index exceeded"),Q.push(Y),J.push(G),this.keyMetaMap.delete(W)}return[Q,J]}}var QP="Reached end of buffer unexpectedly";function RQ(T){if(T.length===0)throw Error(QP);return T.shift()}function y2(T,...A){let[Q]=A;if(A.length===2?Q+(A[1]??0)>T.length:Q>=T.length)throw Error(QP);return T.splice(...A)}class u2{constructor(T){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=T.header,this.accountKeys=T.accountKeys.map((A)=>new a(A)),this.recentBlockhash=T.recentBlockhash,this.instructions=T.instructions,this.instructions.forEach((A)=>this.indexToProgramIds.set(A.programIdIndex,this.accountKeys[A.programIdIndex]))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map((T)=>({programIdIndex:T.programIdIndex,accountKeyIndexes:T.accounts,data:e0.default.decode(T.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new k$(this.staticAccountKeys)}static compile(T){let A=F$.compile(T.instructions,T.payerKey),[Q,J]=A.getMessageComponents(),$=new k$(J).compileInstructions(T.instructions).map((G)=>({programIdIndex:G.programIdIndex,accounts:G.accountKeyIndexes,data:e0.default.encode(G.data)}));return new u2({header:Q,accountKeys:J,recentBlockhash:T.recentBlockhash,instructions:$})}isAccountSigner(T){return T<this.header.numRequiredSignatures}isAccountWritable(T){let A=this.header.numRequiredSignatures;if(T>=this.header.numRequiredSignatures){let Q=T-A,W=this.accountKeys.length-A-this.header.numReadonlyUnsignedAccounts;return Q<W}else{let Q=A-this.header.numReadonlySignedAccounts;return T<Q}}isProgramId(T){return this.indexToProgramIds.has(T)}programIds(){return[...this.indexToProgramIds.values()]}nonProgramIds(){return this.accountKeys.filter((T,A)=>!this.isProgramId(A))}serialize(){let T=this.accountKeys.length,A=[];v2(A,T);let Q=this.instructions.map((K)=>{let{accounts:V,programIdIndex:M}=K,z=Array.from(e0.default.decode(K.data)),N=[];v2(N,V.length);let w=[];return v2(w,z.length),{programIdIndex:M,keyIndicesCount:E.from(N),keyIndices:V,dataLength:E.from(w),data:z}}),J=[];v2(J,Q.length);let W=E.alloc(kQ);E.from(J).copy(W);let $=J.length;Q.forEach((K)=>{let M=S.struct([S.u8("programIdIndex"),S.blob(K.keyIndicesCount.length,"keyIndicesCount"),S.seq(S.u8("keyIndex"),K.keyIndices.length,"keyIndices"),S.blob(K.dataLength.length,"dataLength"),S.seq(S.u8("userdatum"),K.data.length,"data")]).encode(K,W,$);$+=M}),W=W.slice(0,$);let G=S.struct([S.blob(1,"numRequiredSignatures"),S.blob(1,"numReadonlySignedAccounts"),S.blob(1,"numReadonlyUnsignedAccounts"),S.blob(A.length,"keyCount"),S.seq(G1("key"),T,"keys"),G1("recentBlockhash")]),Y={numRequiredSignatures:E.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:E.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:E.from([this.header.numReadonlyUnsignedAccounts]),keyCount:E.from(A),keys:this.accountKeys.map((K)=>Y1(K.toBytes())),recentBlockhash:e0.default.decode(this.recentBlockhash)},Z=E.alloc(2048),C=G.encode(Y,Z);return W.copy(Z,C),Z.slice(0,C+W.length)}static from(T){let A=[...T],Q=RQ(A);if(Q!==(Q&CN))throw Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");let J=RQ(A),W=RQ(A),$=m2(A),G=[];for(let V=0;V<$;V++){let M=y2(A,0,b2);G.push(new a(E.from(M)))}let Y=y2(A,0,b2),Z=m2(A),C=[];for(let V=0;V<Z;V++){let M=RQ(A),z=m2(A),N=y2(A,0,z),w=m2(A),L=y2(A,0,w),O=e0.default.encode(E.from(L));C.push({programIdIndex:M,accounts:N,data:O})}let K={header:{numRequiredSignatures:Q,numReadonlySignedAccounts:J,numReadonlyUnsignedAccounts:W},recentBlockhash:e0.default.encode(E.from(Y)),accountKeys:G,instructions:C};return new u2(K)}}var DN=E.alloc(s9).fill(0);class Z1{constructor(T){if(this.keys=void 0,this.programId=void 0,this.data=E.alloc(0),this.programId=T.programId,this.keys=T.keys,T.data)this.data=T.data}toJSON(){return{keys:this.keys.map(({pubkey:T,isSigner:A,isWritable:Q})=>({pubkey:T.toJSON(),isSigner:A,isWritable:Q})),programId:this.programId.toJSON(),data:[...this.data]}}}class j1{get signature(){if(this.signatures.length>0)return this.signatures[0].signature;return null}constructor(T){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,!T)return;if(T.feePayer)this.feePayer=T.feePayer;if(T.signatures)this.signatures=T.signatures;if(Object.prototype.hasOwnProperty.call(T,"nonceInfo")){let{minContextSlot:A,nonceInfo:Q}=T;this.minNonceContextSlot=A,this.nonceInfo=Q}else if(Object.prototype.hasOwnProperty.call(T,"lastValidBlockHeight")){let{blockhash:A,lastValidBlockHeight:Q}=T;this.recentBlockhash=A,this.lastValidBlockHeight=Q}else{let{recentBlockhash:A,nonceInfo:Q}=T;if(Q)this.nonceInfo=Q;this.recentBlockhash=A}}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((T)=>T.toJSON()),signers:this.signatures.map(({publicKey:T})=>{return T.toJSON()})}}add(...T){if(T.length===0)throw Error("No instructions");return T.forEach((A)=>{if("instructions"in A)this.instructions=this.instructions.concat(A.instructions);else if("data"in A&&"programId"in A&&"keys"in A)this.instructions.push(A);else this.instructions.push(new Z1(A))}),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let T,A;if(this.nonceInfo)if(T=this.nonceInfo.nonce,this.instructions[0]!=this.nonceInfo.nonceInstruction)A=[this.nonceInfo.nonceInstruction,...this.instructions];else A=this.instructions;else T=this.recentBlockhash,A=this.instructions;if(!T)throw Error("Transaction recentBlockhash required");if(A.length<1)console.warn("No instructions provided");let Q;if(this.feePayer)Q=this.feePayer;else if(this.signatures.length>0&&this.signatures[0].publicKey)Q=this.signatures[0].publicKey;else throw Error("Transaction fee payer required");for(let N=0;N<A.length;N++)if(A[N].programId===void 0)throw Error(`Transaction instruction index ${N} has undefined program id`);let J=[],W=[];A.forEach((N)=>{N.keys.forEach((L)=>{W.push({...L})});let w=N.programId.toString();if(!J.includes(w))J.push(w)}),J.forEach((N)=>{W.push({pubkey:new a(N),isSigner:!1,isWritable:!1})});let $=[];W.forEach((N)=>{let w=N.pubkey.toString(),L=$.findIndex((O)=>{return O.pubkey.toString()===w});if(L>-1)$[L].isWritable=$[L].isWritable||N.isWritable,$[L].isSigner=$[L].isSigner||N.isSigner;else $.push(N)}),$.sort(function(N,w){if(N.isSigner!==w.isSigner)return N.isSigner?-1:1;if(N.isWritable!==w.isWritable)return N.isWritable?-1:1;let L={localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"};return N.pubkey.toBase58().localeCompare(w.pubkey.toBase58(),"en",L)});let G=$.findIndex((N)=>{return N.pubkey.equals(Q)});if(G>-1){let[N]=$.splice(G,1);N.isSigner=!0,N.isWritable=!0,$.unshift(N)}else $.unshift({pubkey:Q,isSigner:!0,isWritable:!0});for(let N of this.signatures){let w=$.findIndex((L)=>{return L.pubkey.equals(N.publicKey)});if(w>-1){if(!$[w].isSigner)$[w].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 Error(`unknown signer: ${N.publicKey.toString()}`)}let Y=0,Z=0,C=0,K=[],V=[];$.forEach(({pubkey:N,isSigner:w,isWritable:L})=>{if(w){if(K.push(N.toString()),Y+=1,!L)Z+=1}else if(V.push(N.toString()),!L)C+=1});let M=K.concat(V),z=A.map((N)=>{let{data:w,programId:L}=N;return{programIdIndex:M.indexOf(L.toString()),accounts:N.keys.map((O)=>M.indexOf(O.pubkey.toString())),data:e0.default.encode(w)}});return z.forEach((N)=>{R0(N.programIdIndex>=0),N.accounts.forEach((w)=>R0(w>=0))}),new u2({header:{numRequiredSignatures:Y,numReadonlySignedAccounts:Z,numReadonlyUnsignedAccounts:C},accountKeys:M,recentBlockhash:T,instructions:z})}_compile(){let T=this.compileMessage(),A=T.accountKeys.slice(0,T.header.numRequiredSignatures);if(this.signatures.length===A.length){if(this.signatures.every((J,W)=>{return A[W].equals(J.publicKey)}))return T}return this.signatures=A.map((Q)=>({signature:null,publicKey:Q})),T}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(T){return(await T.getFeeForMessage(this.compileMessage())).value}setSigners(...T){if(T.length===0)throw Error("No signers");let A=new Set;this.signatures=T.filter((Q)=>{let J=Q.toString();if(A.has(J))return!1;else return A.add(J),!0}).map((Q)=>({signature:null,publicKey:Q}))}sign(...T){if(T.length===0)throw Error("No signers");let A=new Set,Q=[];for(let W of T){let $=W.publicKey.toString();if(A.has($))continue;else A.add($),Q.push(W)}this.signatures=Q.map((W)=>({signature:null,publicKey:W.publicKey}));let J=this._compile();this._partialSign(J,...Q)}partialSign(...T){if(T.length===0)throw Error("No signers");let A=new Set,Q=[];for(let W of T){let $=W.publicKey.toString();if(A.has($))continue;else A.add($),Q.push(W)}let J=this._compile();this._partialSign(J,...Q)}_partialSign(T,...A){let Q=T.serialize();A.forEach((J)=>{let W=i9(Q,J.secretKey);this._addSignature(J.publicKey,Y1(W))})}addSignature(T,A){this._compile(),this._addSignature(T,A)}_addSignature(T,A){R0(A.length===64);let Q=this.signatures.findIndex((J)=>T.equals(J.publicKey));if(Q<0)throw Error(`unknown signer: ${T.toString()}`);this.signatures[Q].signature=E.from(A)}verifySignatures(T=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),T)}_getMessageSignednessErrors(T,A){let Q={};for(let{signature:J,publicKey:W}of this.signatures)if(J===null){if(A)(Q.missing||=[]).push(W)}else if(!PN(J,T,W.toBytes()))(Q.invalid||=[]).push(W);return Q.invalid||Q.missing?Q:void 0}serialize(T){let{requireAllSignatures:A,verifySignatures:Q}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},T),J=this.serializeMessage();if(Q){let W=this._getMessageSignednessErrors(J,A);if(W){let $="Signature verification failed.";if(W.invalid)$+=`
|
|
15
|
-
Invalid signature for public key${
|
|
16
|
-
Missing signature for public key${
|
|
17
|
-
${JSON.stringify(J.slice(-10),null,2)}. `:""
|
|
18
|
-
${Q}.
|
|
14
|
+
For a list of runtimes that currently support Ed25519 operations, visit https://github.com/WICG/webcrypto-secure-curves/issues/20.`,[oM]:"No signature verification implementation could be found.",[aM]:"No key generation implementation could be found.",[sM]:"No signing implementation could be found.",[tM]:"No key export implementation could be found.",[GM]:"Timestamp value must be in the range [-(2n ** 63n), (2n ** 63n) - 1]. `$value` given",[WF]:"Transaction processing left an account with an outstanding borrowed reference",[cz]:"Account in use",[fz]:"Account loaded twice",[rz]:"Attempt to debit an account but found no record of a prior credit.",[qF]:"Transaction loads an address table account that doesn't exist",[az]:"This transaction has already been processed",[sz]:"Blockhash not found",[tz]:"Loader call chain is too deep",[$F]:"Transactions are currently disabled due to cluster maintenance",[DF]:"Transaction contains a duplicate instruction ($index) that is not allowed",[iz]:"Insufficient funds for fee",[MF]:"Transaction results in an account ($accountIndex) with insufficient funds for rent",[oz]:"This account may not be used to pay transaction fees",[TF]:"Transaction contains an invalid account reference",[CF]:"Transaction loads an address table account with invalid data",[HF]:"Transaction address table lookup uses an invalid index",[KF]:"Transaction loads an address table account with an invalid owner",[zF]:"LoadedAccountsDataSizeLimit set for transaction must be greater than 0.",[QF]:"This program may not be used for executing instructions",[VF]:"Transaction leaves an account with a lower balance than rent-exempt minimum",[YF]:"Transaction loads a writable account that cannot be written",[kF]:"Transaction exceeded max loaded accounts data size cap",[ez]:"Transaction requires a fee but has no signature present",[nz]:"Attempt to load a program that does not exist",[NF]:"Execution of the program referenced by account at index $accountIndex is temporarily restricted.",[FF]:"ResanitizationNeeded",[JF]:"Transaction failed to sanitize accounts offsets correctly",[AF]:"Transaction did not pass signature verification",[PF]:"Transaction locked too many accounts",[IF]:"Sum of account balances before and after transaction do not match",[dz]:"The transaction failed with the error `$errorName`",[UF]:"Transaction version is unsupported",[XF]:"Transaction would exceed account data limit within the block",[RF]:"Transaction would exceed total account data limit",[ZF]:"Transaction would exceed max account limit within the block",[GF]:"Transaction would exceed max Block Cost Limit",[jF]:"Transaction would exceed max Vote Cost Limit",[vz]:"Attempted to sign a transaction with an address that is not a signer for it",[_z]:"Transaction is missing an address at index: $index.",[yz]:"Transaction has no expected signers therefore it cannot be encoded",[uz]:"Transaction size $transactionSize exceeds limit of $transactionSizeLimit bytes",[Nz]:"Transaction does not have a blockhash lifetime",[Iz]:"Transaction is not a durable nonce transaction",[Lz]:"Contents of these address lookup tables unknown: $lookupTableAddresses",[wz]:"Lookup of address at index $highestRequestedIndex failed for lookup table `$lookupTableAddress`. Highest known index is $highestKnownIndex. The lookup table may have been extended since its contents were retrieved",[Oz]:"No fee payer set in CompiledTransaction",[Ez]:"Could not find program address at index $index",[pz]:"Failed to estimate the compute unit consumption for this transaction message. This is likely because simulating the transaction failed. Inspect the `cause` property of this error to learn more",[lz]:"Transaction failed when it was simulated in order to estimate the compute unit consumption. The compute unit estimate provided is for a transaction that failed when simulated and may not be representative of the compute units this transaction would consume if successful. Inspect the `cause` property of this error to learn more",[xz]:"Transaction is missing a fee payer.",[hz]:"Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer.",[mz]:"Transaction first instruction is not advance nonce account instruction.",[gz]:"Transaction with no instructions cannot be durable nonce transaction.",[zz]:"This transaction includes an address (`$programAddress`) which is both invoked and set as the fee payer. Program addresses may not pay fees",[Fz]:"This transaction includes an address (`$programAddress`) which is both invoked and marked writable. Program addresses may not be writable",[bz]:"The transaction message expected the transaction to have $signerAddressesLength signatures, got $signaturesLength.",[Bz]:"Transaction is missing signatures for addresses: $addresses.",[Sz]:"Transaction version must be in the range [0, 127]. `$actualVersion` given"},U8="i",pT="t";function tF(T,A={}){let Q=sF[T];if(Q.length===0)return"";let J;function $(G){if(J[pT]===2){let Y=Q.slice(J[U8]+1,G);W.push(Y in A?`${A[Y]}`:`$${Y}`)}else if(J[pT]===1)W.push(Q.slice(J[U8],G))}let W=[];return Q.split("").forEach((G,Y)=>{if(Y===0){J={[U8]:0,[pT]:Q[0]==="\\"?0:Q[0]==="$"?2:1};return}let Z;switch(J[pT]){case 0:Z={[U8]:Y,[pT]:1};break;case 1:if(G==="\\")Z={[U8]:Y,[pT]:0};else if(G==="$")Z={[U8]:Y,[pT]:2};break;case 2:if(G==="\\")Z={[U8]:Y,[pT]:0};else if(G==="$")Z={[U8]:Y,[pT]:2};else if(!G.match(/\w/))Z={[U8]:Y,[pT]:1};break}if(Z){if(J!==Z)$(Y);J=Z}}),$(),W.join("")}function eF(T,A={}){return tF(T,A)}var x8=class extends Error{cause=this.cause;context;constructor(...[T,A]){let Q,J;if(A){let{cause:W,...G}=A;if(W)J={cause:W};if(Object.keys(G).length>0)Q=G}let $=eF(T,Q);super($,J);this.context={__code:T,...Q},this.name="SolanaError"}};function TN(T,A){return"fixedSize"in A?A.fixedSize:A.getSizeFromValue(T)}function f9(T){return Object.freeze({...T,encode:(A)=>{let Q=new Uint8Array(TN(A,T));return T.write(A,Q,0),Q}})}function r9(T){return Object.freeze({...T,decode:(A,Q=0)=>T.read(A,Q)[0]})}function pA(T){return"fixedSize"in T&&typeof T.fixedSize==="number"}function n9(T,A){if(pA(T)!==pA(A))throw new x8(n$);if(pA(T)&&pA(A)&&T.fixedSize!==A.fixedSize)throw new x8(i$,{decoderFixedSize:A.fixedSize,encoderFixedSize:T.fixedSize});if(!pA(T)&&!pA(A)&&T.maxSize!==A.maxSize)throw new x8(o$,{decoderMaxSize:A.maxSize,encoderMaxSize:T.maxSize});return{...A,...T,decode:A.decode,encode:T.encode,read:A.read,write:T.write}}function i9(T,A,Q=0){if(A.length-Q<=0)throw new x8(f$,{codecDescription:T})}function o9(T,A,Q,J=0){let $=Q.length-J;if($<A)throw new x8(r$,{bytesLength:$,codecDescription:T,expected:A})}function AN(T,A,Q,J){if(J<A||J>Q)throw new x8(a$,{codecDescription:T,max:Q,min:A,value:J})}function a9(T){return T?.endian===1?!1:!0}function QN(T){return f9({fixedSize:T.size,write(A,Q,J){if(T.range)AN(T.name,T.range[0],T.range[1],A);let $=new ArrayBuffer(T.size);return T.set(new DataView($),A,a9(T.config)),Q.set(new Uint8Array($),J),J+T.size}})}function JN(T){return r9({fixedSize:T.size,read(A,Q=0){i9(T.name,A,Q),o9(T.name,T.size,A,Q);let J=new DataView($N(A,Q,T.size));return[T.get(J,a9(T.config)),Q+T.size]}})}function $N(T,A,Q){let J=T.byteOffset+(A??0),$=Q??T.byteLength;return T.buffer.slice(J,J+$)}var s$=(T={})=>QN({config:T,name:"u64",range:[0n,BigInt("0xffffffffffffffff")],set:(A,Q,J)=>A.setBigUint64(0,BigInt(Q),J),size:8}),WN=(T={})=>JN({config:T,get:(A,Q)=>A.getBigUint64(0,Q),name:"u64",size:8}),s9=(T={})=>n9(s$(T),WN(T));class e9 extends TypeError{constructor(T,A){let Q,{message:J,explanation:$,...W}=T,{path:G}=T,Y=G.length===0?J:`At path: ${G.join(".")} -- ${J}`;super($??Y);if($!=null)this.cause=Y;Object.assign(this,W),this.name=this.constructor.name,this.failures=()=>{return Q??(Q=[T,...A()])}}}function GN(T){return w2(T)&&typeof T[Symbol.iterator]==="function"}function w2(T){return typeof T==="object"&&T!=null}function KQ(T){return w2(T)&&!Array.isArray(T)}function MT(T){if(typeof T==="symbol")return T.toString();return typeof T==="string"?JSON.stringify(T):`${T}`}function UN(T){let{done:A,value:Q}=T.next();return A?void 0:Q}function YN(T,A,Q,J){if(T===!0)return;else if(T===!1)T={};else if(typeof T==="string")T={message:T};let{path:$,branch:W}=A,{type:G}=Q,{refinement:Y,message:Z=`Expected a value of type \`${G}\`${Y?` with refinement \`${Y}\``:""}, but received: \`${MT(J)}\``}=T;return{value:J,type:G,refinement:Y,key:$[$.length-1],path:$,branch:W,...T,message:Z}}function*t9(T,A,Q,J){if(!GN(T))T=[T];for(let $ of T){let W=YN($,A,Q,J);if(W)yield W}}function*t$(T,A,Q={}){let{path:J=[],branch:$=[T],coerce:W=!1,mask:G=!1}=Q,Y={path:J,branch:$,mask:G};if(W)T=A.coercer(T,Y);let Z="valid";for(let C of A.validator(T,Y))C.explanation=Q.message,Z="not_valid",yield[C,void 0];for(let[C,K,j]of A.entries(T,Y)){let M=t$(K,j,{path:C===void 0?J:[...J,C],branch:C===void 0?$:[...$,K],coerce:W,mask:G,message:Q.message});for(let z of M)if(z[0])Z=z[0].refinement!=null?"not_refined":"not_valid",yield[z[0],void 0];else if(W){if(K=z[1],C===void 0)T=K;else if(T instanceof Map)T.set(C,K);else if(T instanceof Set)T.add(K);else if(w2(T)){if(K!==void 0||C in T)T[C]=K}}}if(Z!=="not_valid")for(let C of A.refiner(T,Y))C.explanation=Q.message,Z="not_refined",yield[C,void 0];if(Z==="valid")yield[void 0,T]}class kT{constructor(T){let{type:A,schema:Q,validator:J,refiner:$,coercer:W=(Y)=>Y,entries:G=function*(){}}=T;if(this.type=A,this.schema=Q,this.entries=G,this.coercer=W,J)this.validator=(Y,Z)=>{let C=J(Y,Z);return t9(C,Z,this,Y)};else this.validator=()=>[];if($)this.refiner=(Y,Z)=>{let C=$(Y,Z);return t9(C,Z,this,Y)};else this.refiner=()=>[]}assert(T,A){return TX(T,this,A)}create(T,A){return lA(T,this,A)}is(T){return AX(T,this)}mask(T,A){return ZN(T,this,A)}validate(T,A={}){return E2(T,this,A)}}function TX(T,A,Q){let J=E2(T,A,{message:Q});if(J[0])throw J[0]}function lA(T,A,Q){let J=E2(T,A,{coerce:!0,message:Q});if(J[0])throw J[0];else return J[1]}function ZN(T,A,Q){let J=E2(T,A,{coerce:!0,mask:!0,message:Q});if(J[0])throw J[0];else return J[1]}function AX(T,A){return!E2(T,A)[0]}function E2(T,A,Q={}){let J=t$(T,A,Q),$=UN(J);if($[0])return[new e9($[0],function*(){for(let G of J)if(G[0])yield G[0]}),void 0];else return[void 0,$[1]]}function ZA(T,A){return new kT({type:T,schema:null,validator:A})}function QX(){return ZA("any",()=>!0)}function s(T){return new kT({type:"array",schema:T,*entries(A){if(T&&Array.isArray(A))for(let[Q,J]of A.entries())yield[Q,J,T]},coercer(A){return Array.isArray(A)?A.slice():A},validator(A){return Array.isArray(A)||`Expected an array value, but received: ${MT(A)}`}})}function zT(){return ZA("boolean",(T)=>{return typeof T==="boolean"})}function CQ(T){return ZA("instance",(A)=>{return A instanceof T||`Expected a \`${T.name}\` instance, but received: ${MT(A)}`})}function z1(T){let A=MT(T),Q=typeof T;return new kT({type:"literal",schema:Q==="string"||Q==="number"||Q==="boolean"?T:null,validator(J){return J===T||`Expected the literal \`${A}\`, but received: ${MT(J)}`}})}function XN(){return ZA("never",()=>!1)}function t(T){return new kT({...T,validator:(A,Q)=>A===null||T.validator(A,Q),refiner:(A,Q)=>A===null||T.refiner(A,Q)})}function B(){return ZA("number",(T)=>{return typeof T==="number"&&!isNaN(T)||`Expected a number, but received: ${MT(T)}`})}function A1(T){return new kT({...T,validator:(A,Q)=>A===void 0||T.validator(A,Q),refiner:(A,Q)=>A===void 0||T.refiner(A,Q)})}function e$(T,A){return new kT({type:"record",schema:null,*entries(Q){if(w2(Q))for(let J in Q){let $=Q[J];yield[J,J,T],yield[J,$,A]}},validator(Q){return KQ(Q)||`Expected an object, but received: ${MT(Q)}`},coercer(Q){return KQ(Q)?{...Q}:Q}})}function l(){return ZA("string",(T)=>{return typeof T==="string"||`Expected a string, but received: ${MT(T)}`})}function HQ(T){let A=XN();return new kT({type:"tuple",schema:null,*entries(Q){if(Array.isArray(Q)){let J=Math.max(T.length,Q.length);for(let $=0;$<J;$++)yield[$,Q[$],T[$]||A]}},validator(Q){return Array.isArray(Q)||`Expected an array, but received: ${MT(Q)}`},coercer(Q){return Array.isArray(Q)?Q.slice():Q}})}function y(T){let A=Object.keys(T);return new kT({type:"type",schema:T,*entries(Q){if(w2(Q))for(let J of A)yield[J,Q[J],T[J]]},validator(Q){return KQ(Q)||`Expected an object, but received: ${MT(Q)}`},coercer(Q){return KQ(Q)?{...Q}:Q}})}function _0(T){let A=T.map((Q)=>Q.type).join(" | ");return new kT({type:"union",schema:null,coercer(Q,J){for(let $ of T){let[W,G]=$.validate(Q,{coerce:!0,mask:J.mask});if(!W)return G}return Q},validator(Q,J){let $=[];for(let W of T){let[...G]=t$(Q,W,J),[Y]=G;if(!Y[0])return[];else for(let[Z]of G)if(Z)$.push(Z)}return[`Expected the value to satisfy a union of \`${A}\`, but received: ${MT(Q)}`,...$]}})}function XA(){return ZA("unknown",()=>!0)}function uA(T,A,Q){return new kT({...T,coercer:(J,$)=>{return AX(J,A)?T.coercer(Q(J,$),$):T.coercer(J,$)}})}var QI=n0(IX(),1);OA();var wX=n0(LX(),1);var vN=BigInt(0),v2=BigInt(1),yN=BigInt(2),bN=BigInt(7),pN=BigInt(256),lN=BigInt(113),BX=[],_X=[],xX=[];for(let T=0,A=v2,Q=1,J=0;T<24;T++){[Q,J]=[J,(2*Q+3*J)%5],BX.push(2*(5*J+Q)),_X.push((T+1)*(T+2)/2%64);let $=vN;for(let W=0;W<7;W++)if(A=(A<<v2^(A>>bN)*lN)%pN,A&yN)$^=v2<<(v2<<BigInt(W))-v2;xX.push($)}var hX=n6(xX,!0),uN=hX[0],dN=hX[1],EX=(T,A,Q)=>Q>32?lZ(T,A,Q):bZ(T,A,Q),OX=(T,A,Q)=>Q>32?uZ(T,A,Q):pZ(T,A,Q);function cN(T,A=24){let Q=new Uint32Array(10);for(let J=24-A;J<24;J++){for(let G=0;G<10;G++)Q[G]=T[G]^T[G+10]^T[G+20]^T[G+30]^T[G+40];for(let G=0;G<10;G+=2){let Y=(G+8)%10,Z=(G+2)%10,C=Q[Z],K=Q[Z+1],j=EX(C,K,1)^Q[Y],M=OX(C,K,1)^Q[Y+1];for(let z=0;z<50;z+=10)T[G+z]^=j,T[G+z+1]^=M}let $=T[2],W=T[3];for(let G=0;G<24;G++){let Y=_X[G],Z=EX($,W,Y),C=OX($,W,Y),K=BX[G];$=T[K],W=T[K+1],T[K]=Z,T[K+1]=C}for(let G=0;G<50;G+=10){for(let Y=0;Y<10;Y++)Q[Y]=T[G+Y];for(let Y=0;Y<10;Y++)T[G+Y]^=~Q[(Y+2)%10]&Q[(Y+4)%10]}T[0]^=uN[J],T[1]^=dN[J]}CT(Q)}class XW extends TA{constructor(T,A,Q,J=!1,$=24){super();if(this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=T,this.suffix=A,this.outputLen=Q,this.enableXOF=J,this.rounds=$,F8(Q),!(0<T&&T<200))throw Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=hZ(this.state)}clone(){return this._cloneInto()}keccak(){fJ(this.state32),cN(this.state32,this.rounds),fJ(this.state32),this.posOut=0,this.pos=0}update(T){tT(this),T=e8(T),I0(T);let{blockLen:A,state:Q}=this,J=T.length;for(let $=0;$<J;){let W=Math.min(A-this.pos,J-$);for(let G=0;G<W;G++)Q[this.pos++]^=T[$++];if(this.pos===A)this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:T,suffix:A,pos:Q,blockLen:J}=this;if(T[Q]^=A,(A&128)!==0&&Q===J-1)this.keccak();T[J-1]^=128,this.keccak()}writeInto(T){tT(this,!1),I0(T),this.finish();let A=this.state,{blockLen:Q}=this;for(let J=0,$=T.length;J<$;){if(this.posOut>=Q)this.keccak();let W=Math.min(Q-this.posOut,$-J);T.set(A.subarray(this.posOut,this.posOut+W),J),this.posOut+=W,J+=W}return T}xofInto(T){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(T)}xof(T){return F8(T),this.xofInto(new Uint8Array(T))}digestInto(T){if(d6(T,this),this.finished)throw Error("digest() was already called");return this.writeInto(T),this.destroy(),T}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,CT(this.state)}_cloneInto(T){let{blockLen:A,suffix:Q,outputLen:J,rounds:$,enableXOF:W}=this;return T||(T=new XW(A,Q,J,W,$)),T.state32.set(this.state32),T.pos=this.pos,T.posOut=this.posOut,T.finished=this.finished,T.rounds=$,T.suffix=Q,T.outputLen=J,T.enableXOF=W,T.destroyed=this.destroyed,T}}var fN=(T,A,Q)=>R2(()=>new XW(A,T,Q));var PW=(()=>fN(1,136,32))();class qW extends TA{constructor(T,A){super();this.finished=!1,this.destroyed=!1,u6(T);let Q=e8(A);if(this.iHash=T.create(),typeof this.iHash.update!=="function")throw Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let J=this.blockLen,$=new Uint8Array(J);$.set(Q.length>J?T.create().update(Q).digest():Q);for(let W=0;W<$.length;W++)$[W]^=54;this.iHash.update($),this.oHash=T.create();for(let W=0;W<$.length;W++)$[W]^=106;this.oHash.update($),CT($)}update(T){return tT(this),this.iHash.update(T),this}digestInto(T){tT(this),I0(T,this.outputLen),this.finished=!0,this.iHash.digestInto(T),this.oHash.update(T),this.oHash.digestInto(T),this.destroy()}digest(){let T=new Uint8Array(this.oHash.outputLen);return this.digestInto(T),T}_cloneInto(T){T||(T=Object.create(Object.getPrototypeOf(this),{}));let{oHash:A,iHash:Q,finished:J,destroyed:$,blockLen:W,outputLen:G}=this;return T=T,T.finished=J,T.destroyed=$,T.blockLen=W,T.outputLen=G,T.oHash=A._cloneInto(T.oHash),T.iHash=Q._cloneInto(T.iHash),T}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}var KW=(T,A,Q)=>new qW(T,A).update(Q).digest();KW.create=(T,A)=>new qW(T,A);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var gX=(T,A)=>(T+(T>=0?A:-A)/vX)/A;function rN(T,A,Q){let[[J,$],[W,G]]=A,Y=gX(G*T,Q),Z=gX(-$*T,Q),C=T-Y*J-Z*W,K=-Y*$-Z*G,j=C<Z8,M=K<Z8;if(j)C=-C;if(M)K=-K;let z=L8(Math.ceil(a6(Q)/2))+cA;if(C<Z8||C>=z||K<Z8||K>=z)throw Error("splitScalar (endomorphism): failed, k="+T);return{k1neg:j,k1:C,k2neg:M,k2:K}}function HW(T){if(!["compact","recovered","der"].includes(T))throw Error('Signature format must be "compact", "recovered", or "der"');return T}function CW(T,A){let Q={};for(let J of Object.keys(A))Q[J]=T[J]===void 0?A[J]:T[J];if(T8(Q.lowS,"lowS"),T8(Q.prehash,"prehash"),Q.format!==void 0)HW(Q.format);return Q}class mX extends Error{constructor(T=""){super(T)}}var Y8={Err:mX,_tlv:{encode:(T,A)=>{let{Err:Q}=Y8;if(T<0||T>256)throw new Q("tlv.encode: wrong tag");if(A.length&1)throw new Q("tlv.encode: unpadded data");let J=A.length/2,$=k2(J);if($.length/2&128)throw new Q("tlv.encode: long form length too big");let W=J>127?k2($.length/2|128):"";return k2(T)+W+$+A},decode(T,A){let{Err:Q}=Y8,J=0;if(T<0||T>256)throw new Q("tlv.encode: wrong tag");if(A.length<2||A[J++]!==T)throw new Q("tlv.decode: wrong tlv");let $=A[J++],W=!!($&128),G=0;if(!W)G=$;else{let Z=$&127;if(!Z)throw new Q("tlv.decode(long): indefinite length not supported");if(Z>4)throw new Q("tlv.decode(long): byte length is too big");let C=A.subarray(J,J+Z);if(C.length!==Z)throw new Q("tlv.decode: length bytes not complete");if(C[0]===0)throw new Q("tlv.decode(long): zero leftmost byte");for(let K of C)G=G<<8|K;if(J+=Z,G<128)throw new Q("tlv.decode(long): not minimal encoding")}let Y=A.subarray(J,J+G);if(Y.length!==G)throw new Q("tlv.decode: wrong value length");return{v:Y,l:A.subarray(J+G)}}},_int:{encode(T){let{Err:A}=Y8;if(T<Z8)throw new A("integer: negative integers are not allowed");let Q=k2(T);if(Number.parseInt(Q[0],16)&8)Q="00"+Q;if(Q.length&1)throw new A("unexpected DER parsing assertion: unpadded hex");return Q},decode(T){let{Err:A}=Y8;if(T[0]&128)throw new A("invalid signature integer: negative");if(T[0]===0&&!(T[1]&128))throw new A("invalid signature integer: unnecessary leading zero");return _A(T)}},toSig(T){let{Err:A,_int:Q,_tlv:J}=Y8,$=q1("signature",T),{v:W,l:G}=J.decode(48,$);if(G.length)throw new A("invalid signature: left bytes after parsing");let{v:Y,l:Z}=J.decode(2,W),{v:C,l:K}=J.decode(2,Z);if(K.length)throw new A("invalid signature: left bytes after parsing");return{r:Q.decode(Y),s:Q.decode(C)}},hexFromSig(T){let{_tlv:A,_int:Q}=Y8,J=A.encode(2,Q.encode(T.r)),$=A.encode(2,Q.encode(T.s)),W=J+$;return A.encode(48,W)}},Z8=BigInt(0),cA=BigInt(1),vX=BigInt(2),MQ=BigInt(3),nN=BigInt(4);function dA(T,A){let{BYTES:Q}=T,J;if(typeof A==="bigint")J=A;else{let $=q1("private key",A);try{J=T.fromBytes($)}catch(W){throw Error(`invalid private key: expected ui8a of size ${Q}, got ${typeof A}`)}}if(!T.isValidNot0(J))throw Error("invalid private key: out of range [1..N-1]");return J}function iN(T,A={}){let Q=t6("weierstrass",T,A),{Fp:J,Fn:$}=Q,W=Q.CURVE,{h:G,n:Y}=W;w8(A,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});let{endo:Z}=A;if(Z){if(!J.is0(W.a)||typeof Z.beta!=="bigint"||!Array.isArray(Z.basises))throw Error('invalid endo: expected "beta": bigint and "basises": array')}let C=bX(J,$);function K(){if(!J.isOdd)throw Error("compression is not supported: Field does not have .isOdd()")}function j(x,R,U){let{x:X,y:q}=R.toAffine(),H=J.toBytes(X);if(T8(U,"isCompressed"),U){K();let V=!J.isOdd(q);return l0(yX(V),H)}else return l0(Uint8Array.of(4),H,J.toBytes(q))}function M(x){GT(x,void 0,"Point");let{publicKey:R,publicKeyUncompressed:U}=C,X=x.length,q=x[0],H=x.subarray(1);if(X===R&&(q===2||q===3)){let V=J.fromBytes(H);if(!J.isValid(V))throw Error("bad point: is not on curve, wrong x");let F=E(V),I;try{I=J.sqrt(F)}catch(k){let b=k instanceof Error?": "+k.message:"";throw Error("bad point: is not on curve, sqrt error"+b)}K();let D=J.isOdd(I);if((q&1)===1!==D)I=J.neg(I);return{x:V,y:I}}else if(X===U&&q===4){let V=J.BYTES,F=J.fromBytes(H.subarray(0,V)),I=J.fromBytes(H.subarray(V,V*2));if(!L(F,I))throw Error("bad point: is not on curve");return{x:F,y:I}}else throw Error(`bad point: got length ${X}, expected compressed=${R} or uncompressed=${U}`)}let z=A.toBytes||j,N=A.fromBytes||M;function E(x){let R=J.sqr(x),U=J.mul(R,x);return J.add(J.add(U,J.mul(x,W.a)),W.b)}function L(x,R){let U=J.sqr(R),X=E(x);return J.eql(U,X)}if(!L(W.Gx,W.Gy))throw Error("bad curve params: generator point");let O=J.mul(J.pow(W.a,MQ),nN),g=J.mul(J.sqr(W.b),BigInt(27));if(J.is0(J.add(O,g)))throw Error("bad curve params: a or b");function v(x,R,U=!1){if(!J.isValid(R)||U&&J.is0(R))throw Error(`bad point coordinate ${x}`);return R}function p(x){if(!(x instanceof h))throw Error("ProjectivePoint expected")}function c(x){if(!Z||!Z.basises)throw Error("no endo");return rN(x,Z.basises,$.ORDER)}let u=xA((x,R)=>{let{X:U,Y:X,Z:q}=x;if(J.eql(q,J.ONE))return{x:U,y:X};let H=x.is0();if(R==null)R=H?J.ONE:J.inv(q);let V=J.mul(U,R),F=J.mul(X,R),I=J.mul(q,R);if(H)return{x:J.ZERO,y:J.ZERO};if(!J.eql(I,J.ONE))throw Error("invZ was invalid");return{x:V,y:F}}),i=xA((x)=>{if(x.is0()){if(A.allowInfinityPoint&&!J.is0(x.Y))return;throw Error("bad point: ZERO")}let{x:R,y:U}=x.toAffine();if(!J.isValid(R)||!J.isValid(U))throw Error("bad point: x or y not field elements");if(!L(R,U))throw Error("bad point: equation left != right");if(!x.isTorsionFree())throw Error("bad point: not in prime-order subgroup");return!0});function d(x,R,U,X,q){return U=new h(J.mul(U.X,x),U.Y,U.Z),R=N2(X,R),U=N2(q,U),R.add(U)}class h{constructor(x,R,U){this.X=v("x",x),this.Y=v("y",R,!0),this.Z=v("z",U),Object.freeze(this)}static CURVE(){return W}static fromAffine(x){let{x:R,y:U}=x||{};if(!x||!J.isValid(R)||!J.isValid(U))throw Error("invalid affine point");if(x instanceof h)throw Error("projective point not allowed");if(J.is0(R)&&J.is0(U))return h.ZERO;return new h(R,U,J.ONE)}static fromBytes(x){let R=h.fromAffine(N(GT(x,void 0,"point")));return R.assertValidity(),R}static fromHex(x){return h.fromBytes(q1("pointHex",x))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(x=8,R=!0){if(n.createCache(this,x),!R)this.multiply(MQ);return this}assertValidity(){i(this)}hasEvenY(){let{y:x}=this.toAffine();if(!J.isOdd)throw Error("Field doesn't support isOdd");return!J.isOdd(x)}equals(x){p(x);let{X:R,Y:U,Z:X}=this,{X:q,Y:H,Z:V}=x,F=J.eql(J.mul(R,V),J.mul(q,X)),I=J.eql(J.mul(U,V),J.mul(H,X));return F&&I}negate(){return new h(this.X,J.neg(this.Y),this.Z)}double(){let{a:x,b:R}=W,U=J.mul(R,MQ),{X,Y:q,Z:H}=this,V=J.ZERO,F=J.ZERO,I=J.ZERO,D=J.mul(X,X),P=J.mul(q,q),k=J.mul(H,H),b=J.mul(X,q);return b=J.add(b,b),I=J.mul(X,H),I=J.add(I,I),V=J.mul(x,I),F=J.mul(U,k),F=J.add(V,F),V=J.sub(P,F),F=J.add(P,F),F=J.mul(V,F),V=J.mul(b,V),I=J.mul(U,I),k=J.mul(x,k),b=J.sub(D,k),b=J.mul(x,b),b=J.add(b,I),I=J.add(D,D),D=J.add(I,D),D=J.add(D,k),D=J.mul(D,b),F=J.add(F,D),k=J.mul(q,H),k=J.add(k,k),D=J.mul(k,b),V=J.sub(V,D),I=J.mul(k,P),I=J.add(I,I),I=J.add(I,I),new h(V,F,I)}add(x){p(x);let{X:R,Y:U,Z:X}=this,{X:q,Y:H,Z:V}=x,F=J.ZERO,I=J.ZERO,D=J.ZERO,P=W.a,k=J.mul(W.b,MQ),b=J.mul(R,q),r=J.mul(U,H),f=J.mul(X,V),T1=J.add(R,U),Q1=J.add(q,H);T1=J.mul(T1,Q1),Q1=J.add(b,r),T1=J.sub(T1,Q1),Q1=J.add(R,X);let J1=J.add(q,V);return Q1=J.mul(Q1,J1),J1=J.add(b,f),Q1=J.sub(Q1,J1),J1=J.add(U,X),F=J.add(H,V),J1=J.mul(J1,F),F=J.add(r,f),J1=J.sub(J1,F),D=J.mul(P,Q1),F=J.mul(k,f),D=J.add(F,D),F=J.sub(r,D),D=J.add(r,D),I=J.mul(F,D),r=J.add(b,b),r=J.add(r,b),f=J.mul(P,f),Q1=J.mul(k,Q1),r=J.add(r,f),f=J.sub(b,f),f=J.mul(P,f),Q1=J.add(Q1,f),b=J.mul(r,Q1),I=J.add(I,b),b=J.mul(J1,Q1),F=J.mul(T1,F),F=J.sub(F,b),b=J.mul(T1,r),D=J.mul(J1,D),D=J.add(D,b),new h(F,I,D)}subtract(x){return this.add(x.negate())}is0(){return this.equals(h.ZERO)}multiply(x){let{endo:R}=A;if(!$.isValidNot0(x))throw Error("invalid scalar: out of range");let U,X,q=(H)=>n.cached(this,H,(V)=>J8(h,V));if(R){let{k1neg:H,k1:V,k2neg:F,k2:I}=c(x),{p:D,f:P}=q(V),{p:k,f:b}=q(I);X=P.add(b),U=d(R.beta,D,k,H,F)}else{let{p:H,f:V}=q(x);U=H,X=V}return J8(h,[U,X])[0]}multiplyUnsafe(x){let{endo:R}=A,U=this;if(!$.isValid(x))throw Error("invalid scalar: out of range");if(x===Z8||U.is0())return h.ZERO;if(x===cA)return U;if(n.hasCache(this))return this.multiply(x);if(R){let{k1neg:X,k1:q,k2neg:H,k2:V}=c(x),{p1:F,p2:I}=j9(h,U,q,V);return d(R.beta,F,I,X,H)}else return n.unsafe(U,x)}multiplyAndAddUnsafe(x,R,U){let X=this.multiplyUnsafe(R).add(x.multiplyUnsafe(U));return X.is0()?void 0:X}toAffine(x){return u(this,x)}isTorsionFree(){let{isTorsionFree:x}=A;if(G===cA)return!0;if(x)return x(h,this);return n.unsafe(this,Y).is0()}clearCofactor(){let{clearCofactor:x}=A;if(G===cA)return this;if(x)return x(h,this);return this.multiplyUnsafe(G)}isSmallOrder(){return this.multiplyUnsafe(G).is0()}toBytes(x=!0){return T8(x,"isCompressed"),this.assertValidity(),z(h,this,x)}toHex(x=!0){return HT(this.toBytes(x))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(x=!0){return this.toBytes(x)}_setWindowSize(x){this.precompute(x)}static normalizeZ(x){return J8(h,x)}static msm(x,R){return gA(h,$,x,R)}static fromPrivateKey(x){return h.BASE.multiply(dA($,x))}}h.BASE=new h(W.Gx,W.Gy,J.ONE),h.ZERO=new h(J.ZERO,J.ONE,J.ZERO),h.Fp=J,h.Fn=$;let o=$.BITS,n=new I2(h,A.endo?Math.ceil(o/2):o);return h.BASE.precompute(8),h}function yX(T){return Uint8Array.of(T?2:3)}function bX(T,A){return{secretKey:A.BYTES,publicKey:1+T.BYTES,publicKeyUncompressed:1+2*T.BYTES,publicKeyHasPrefix:!0,signature:2*A.BYTES}}function oN(T,A={}){let{Fn:Q}=T,J=A.randomBytes||BA,$=Object.assign(bX(T.Fp,Q),{seed:$$(Q.ORDER)});function W(z){try{return!!dA(Q,z)}catch(N){return!1}}function G(z,N){let{publicKey:E,publicKeyUncompressed:L}=$;try{let O=z.length;if(N===!0&&O!==E)return!1;if(N===!1&&O!==L)return!1;return!!T.fromBytes(z)}catch(O){return!1}}function Y(z=J($.seed)){return W$(GT(z,$.seed,"seed"),Q.ORDER)}function Z(z,N=!0){return T.BASE.multiply(dA(Q,z)).toBytes(N)}function C(z){let N=Y(z);return{secretKey:N,publicKey:Z(N)}}function K(z){if(typeof z==="bigint")return!1;if(z instanceof T)return!0;let{secretKey:N,publicKey:E,publicKeyUncompressed:L}=$;if(Q.allowedLengths||N===E)return;let O=q1("key",z).length;return O===E||O===L}function j(z,N,E=!0){if(K(z)===!0)throw Error("first arg must be private key");if(K(N)===!1)throw Error("second arg must be public key");let L=dA(Q,z);return T.fromHex(N).multiply(L).toBytes(E)}return Object.freeze({getPublicKey:Z,getSharedSecret:j,keygen:C,Point:T,utils:{isValidSecretKey:W,isValidPublicKey:G,randomSecretKey:Y,isValidPrivateKey:W,randomPrivateKey:Y,normPrivateKeyToScalar:(z)=>dA(Q,z),precompute(z=8,N=T.BASE){return N.precompute(z,!1)}},lengths:$})}function aN(T,A,Q={}){u6(A),w8(Q,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});let J=Q.randomBytes||BA,$=Q.hmac||((U,...X)=>KW(A,U,l0(...X))),{Fp:W,Fn:G}=T,{ORDER:Y,BITS:Z}=G,{keygen:C,getPublicKey:K,getSharedSecret:j,utils:M,lengths:z}=oN(T,Q),N={prehash:!1,lowS:typeof Q.lowS==="boolean"?Q.lowS:!1,format:void 0,extraEntropy:!1},E="compact";function L(U){let X=Y>>cA;return U>X}function O(U,X){if(!G.isValidNot0(X))throw Error(`invalid signature ${U}: out of range 1..Point.Fn.ORDER`);return X}function g(U,X){HW(X);let q=z.signature,H=X==="compact"?q:X==="recovered"?q+1:void 0;return GT(U,H,`${X} signature`)}class v{constructor(U,X,q){if(this.r=O("r",U),this.s=O("s",X),q!=null)this.recovery=q;Object.freeze(this)}static fromBytes(U,X=E){g(U,X);let q;if(X==="der"){let{r:I,s:D}=Y8.toSig(GT(U));return new v(I,D)}if(X==="recovered")q=U[0],X="compact",U=U.subarray(1);let H=G.BYTES,V=U.subarray(0,H),F=U.subarray(H,H*2);return new v(G.fromBytes(V),G.fromBytes(F),q)}static fromHex(U,X){return this.fromBytes(t8(U),X)}addRecoveryBit(U){return new v(this.r,this.s,U)}recoverPublicKey(U){let X=W.ORDER,{r:q,s:H,recovery:V}=this;if(V==null||![0,1,2,3].includes(V))throw Error("recovery id invalid");if(Y*vX<X&&V>1)throw Error("recovery id is ambiguous for h>1 curve");let I=V===2||V===3?q+Y:q;if(!W.isValid(I))throw Error("recovery id 2 or 3 invalid");let D=W.toBytes(I),P=T.fromBytes(l0(yX((V&1)===0),D)),k=G.inv(I),b=c(q1("msgHash",U)),r=G.create(-b*k),f=G.create(H*k),T1=T.BASE.multiplyUnsafe(r).add(P.multiplyUnsafe(f));if(T1.is0())throw Error("point at infinify");return T1.assertValidity(),T1}hasHighS(){return L(this.s)}toBytes(U=E){if(HW(U),U==="der")return t8(Y8.hexFromSig(this));let X=G.toBytes(this.r),q=G.toBytes(this.s);if(U==="recovered"){if(this.recovery==null)throw Error("recovery bit must be present");return l0(Uint8Array.of(this.recovery),X,q)}return l0(X,q)}toHex(U){return HT(this.toBytes(U))}assertValidity(){}static fromCompact(U){return v.fromBytes(q1("sig",U),"compact")}static fromDER(U){return v.fromBytes(q1("sig",U),"der")}normalizeS(){return this.hasHighS()?new v(this.r,G.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return HT(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return HT(this.toBytes("compact"))}}let p=Q.bits2int||function(X){if(X.length>8192)throw Error("input is too large");let q=_A(X),H=X.length*8-Z;return H>0?q>>BigInt(H):q},c=Q.bits2int_modN||function(X){return G.create(p(X))},u=L8(Z);function i(U){return z2("num < 2^"+Z,U,Z8,u),G.toBytes(U)}function d(U,X){return GT(U,void 0,"message"),X?GT(A(U),void 0,"prehashed message"):U}function h(U,X,q){if(["recovered","canonical"].some((f)=>(f in q)))throw Error("sign() legacy options not supported");let{lowS:H,prehash:V,extraEntropy:F}=CW(q,N);U=d(U,V);let I=c(U),D=dA(G,X),P=[i(D),i(I)];if(F!=null&&F!==!1){let f=F===!0?J(z.secretKey):F;P.push(q1("extraEntropy",f))}let k=l0(...P),b=I;function r(f){let T1=p(f);if(!G.isValidNot0(T1))return;let Q1=G.inv(T1),J1=T.BASE.multiply(T1).toAffine(),r0=G.create(J1.x);if(r0===Z8)return;let X1=G.create(Q1*G.create(b+r0*D));if(X1===Z8)return;let C1=(J1.x===r0?0:2)|Number(J1.y&cA),T2=X1;if(H&&L(X1))T2=G.neg(X1),C1^=1;return new v(r0,T2,C1)}return{seed:k,k2sig:r}}function o(U,X,q={}){U=q1("message",U);let{seed:H,k2sig:V}=h(U,X,q);return A9(A.outputLen,G.BYTES,$)(H,V)}function n(U){let X=void 0,q=typeof U==="string"||sT(U),H=!q&&U!==null&&typeof U==="object"&&typeof U.r==="bigint"&&typeof U.s==="bigint";if(!q&&!H)throw Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(H)X=new v(U.r,U.s);else if(q){try{X=v.fromBytes(q1("sig",U),"der")}catch(V){if(!(V instanceof Y8.Err))throw V}if(!X)try{X=v.fromBytes(q1("sig",U),"compact")}catch(V){return!1}}if(!X)return!1;return X}function x(U,X,q,H={}){let{lowS:V,prehash:F,format:I}=CW(H,N);if(q=q1("publicKey",q),X=d(q1("message",X),F),"strict"in H)throw Error("options.strict was renamed to lowS");let D=I===void 0?n(U):v.fromBytes(q1("sig",U),I);if(D===!1)return!1;try{let P=T.fromBytes(q);if(V&&D.hasHighS())return!1;let{r:k,s:b}=D,r=c(X),f=G.inv(b),T1=G.create(r*f),Q1=G.create(k*f),J1=T.BASE.multiplyUnsafe(T1).add(P.multiplyUnsafe(Q1));if(J1.is0())return!1;return G.create(J1.x)===k}catch(P){return!1}}function R(U,X,q={}){let{prehash:H}=CW(q,N);return X=d(X,H),v.fromBytes(U,"recovered").recoverPublicKey(X).toBytes()}return Object.freeze({keygen:C,getPublicKey:K,getSharedSecret:j,utils:M,lengths:z,Point:T,sign:o,verify:x,recoverPublicKey:R,Signature:v,hash:A})}function sN(T){let A={a:T.a,b:T.b,p:T.Fp.ORDER,n:T.n,h:T.h,Gx:T.Gx,Gy:T.Gy},Q=T.Fp,J=T.allowedPrivateKeyLengths?Array.from(new Set(T.allowedPrivateKeyLengths.map((G)=>Math.ceil(G/2)))):void 0,$=UT(A.n,{BITS:T.nBitLength,allowedLengths:J,modFromBytes:T.wrapPrivateKey}),W={Fp:Q,Fn:$,allowInfinityPoint:T.allowInfinityPoint,endo:T.endo,isTorsionFree:T.isTorsionFree,clearCofactor:T.clearCofactor,fromBytes:T.fromBytes,toBytes:T.toBytes};return{CURVE:A,curveOpts:W}}function tN(T){let{CURVE:A,curveOpts:Q}=sN(T),J={hmac:T.hmac,randomBytes:T.randomBytes,lowS:T.lowS,bits2int:T.bits2int,bits2int_modN:T.bits2int_modN};return{CURVE:A,curveOpts:Q,hash:T.hash,ecdsaOpts:J}}function eN(T,A){let Q=A.Point;return Object.assign({},A,{ProjectivePoint:Q,CURVE:Object.assign({},T,s6(Q.Fn.ORDER,Q.Fn.BITS))})}function pX(T){let{CURVE:A,curveOpts:Q,hash:J,ecdsaOpts:$}=tN(T),W=iN(A,Q),G=aN(W,J,$);return eN(T,G)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function lX(T,A){let Q=(J)=>pX({...T,hash:J});return{...Q(A),create:Q}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var jW={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},TI={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]};var uX=BigInt(2);function AI(T){let A=jW.p,Q=BigInt(3),J=BigInt(6),$=BigInt(11),W=BigInt(22),G=BigInt(23),Y=BigInt(44),Z=BigInt(88),C=T*T*T%A,K=C*C*T%A,j=k1(K,Q,A)*K%A,M=k1(j,Q,A)*K%A,z=k1(M,uX,A)*C%A,N=k1(z,$,A)*z%A,E=k1(N,W,A)*N%A,L=k1(E,Y,A)*E%A,O=k1(L,Z,A)*L%A,g=k1(O,Y,A)*E%A,v=k1(g,Q,A)*K%A,p=k1(v,G,A)*N%A,c=k1(p,J,A)*C%A,u=k1(c,uX,A);if(!VW.eql(VW.sqr(u),T))throw Error("Cannot find square root");return u}var VW=UT(jW.p,{sqrt:AI}),kQ=lX({...jW,Fp:VW,lowS:!0,endo:TI},i6);var ph=t0.utils.randomPrivateKey,dX=()=>{let T=t0.utils.randomPrivateKey(),A=FW(T),Q=new Uint8Array(64);return Q.set(T),Q.set(A,32),{publicKey:A,secretKey:Q}},FW=t0.getPublicKey;function cX(T){try{return t0.ExtendedPoint.fromHex(T),!0}catch{return!1}}var QP=(T,A)=>t0.sign(T,A.slice(0,32)),JI=t0.verify,Y1=(T)=>{if(w.isBuffer(T))return T;else if(T instanceof Uint8Array)return w.from(T.buffer,T.byteOffset,T.byteLength);else return w.from(T)};class JP{constructor(T){Object.assign(this,T)}encode(){return w.from(nA.serialize(NQ,this))}static decode(T){return nA.deserialize(NQ,this,T)}static decodeUnchecked(T){return nA.deserializeUnchecked(NQ,this,T)}}var NQ=new Map,$P,$I=32,d2=32;function WI(T){return T._bn!==void 0}var fX=1;class a extends JP{constructor(T){super({});if(this._bn=void 0,WI(T))this._bn=T._bn;else{if(typeof T==="string"){let A=TT.default.decode(T);if(A.length!=d2)throw Error("Invalid public key input");this._bn=new zW.default(A)}else this._bn=new zW.default(T);if(this._bn.byteLength()>d2)throw Error("Invalid public key input")}}static unique(){let T=new a(fX);return fX+=1,new a(T.toBuffer())}equals(T){return this._bn.eq(T._bn)}toBase58(){return TT.default.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){let T=this.toBuffer();return new Uint8Array(T.buffer,T.byteOffset,T.byteLength)}toBuffer(){let T=this._bn.toArrayLike(w);if(T.length===d2)return T;let A=w.alloc(32);return T.copy(A,32-T.length),A}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(T,A,Q){let J=w.concat([T.toBuffer(),w.from(A),Q.toBuffer()]),$=D$(J);return new a($)}static createProgramAddressSync(T,A){let Q=w.alloc(0);T.forEach(function($){if($.length>$I)throw TypeError("Max seed length exceeded");Q=w.concat([Q,Y1($)])}),Q=w.concat([Q,A.toBuffer(),w.from("ProgramDerivedAddress")]);let J=D$(Q);if(cX(J))throw Error("Invalid seeds, address must fall off the curve");return new a(J)}static async createProgramAddress(T,A){return this.createProgramAddressSync(T,A)}static findProgramAddressSync(T,A){let Q=255,J;while(Q!=0){try{let $=T.concat(w.from([Q]));J=this.createProgramAddressSync($,A)}catch($){if($ instanceof TypeError)throw $;Q--;continue}return[J,Q]}throw Error("Unable to find a viable program address nonce")}static async findProgramAddress(T,A){return this.findProgramAddressSync(T,A)}static isOnCurve(T){let A=new a(T);return cX(A.toBytes())}}$P=a;a.default=new $P("11111111111111111111111111111111");NQ.set(a,{kind:"struct",fields:[["_bn","u256"]]});var lh=new a("BPFLoader1111111111111111111111111111111111"),IQ=1232,GI=127,WP=64;class GP extends Error{constructor(T){super(`Signature ${T} has expired: block height exceeded.`);this.signature=void 0,this.signature=T}}Object.defineProperty(GP.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class UP extends Error{constructor(T,A){super(`Transaction was not confirmed in ${A.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${T} using the Solana Explorer or CLI tools.`);this.signature=void 0,this.signature=T}}Object.defineProperty(UP.prototype,"name",{value:"TransactionExpiredTimeoutError"});class YP extends Error{constructor(T){super(`Signature ${T} has expired: the nonce is no longer valid.`);this.signature=void 0,this.signature=T}}Object.defineProperty(YP.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class NW{constructor(T,A){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=T,this.accountKeysFromLookups=A}keySegments(){let T=[this.staticAccountKeys];if(this.accountKeysFromLookups)T.push(this.accountKeysFromLookups.writable),T.push(this.accountKeysFromLookups.readonly);return T}get(T){for(let A of this.keySegments())if(T<A.length)return A[T];else T-=A.length;return}get length(){return this.keySegments().flat().length}compileInstructions(T){if(this.length>256)throw Error("Account index overflow encountered during compilation");let Q=new Map;this.keySegments().flat().forEach(($,W)=>{Q.set($.toBase58(),W)});let J=($)=>{let W=Q.get($.toBase58());if(W===void 0)throw Error("Encountered an unknown instruction account key during compilation");return W};return T.map(($)=>{return{programIdIndex:J($.programId),accountKeyIndexes:$.keys.map((W)=>J(W.pubkey)),data:$.data}})}}var G1=(T="publicKey")=>{return S.blob(32,T)};var fA=(T="string")=>{let A=S.struct([S.u32("length"),S.u32("lengthPadding"),S.blob(S.offset(S.u32(),-8),"chars")],T),Q=A.decode.bind(A),J=A.encode.bind(A),$=A;return $.decode=(W,G)=>{return Q(W,G).chars.toString()},$.encode=(W,G,Y)=>{let Z={chars:w.from(W,"utf8")};return J(Z,G,Y)},$.alloc=(W)=>{return S.u32().span+S.u32().span+w.from(W,"utf8").length},$},UI=(T="authorized")=>{return S.struct([G1("staker"),G1("withdrawer")],T)},YI=(T="lockup")=>{return S.struct([S.ns64("unixTimestamp"),S.ns64("epoch"),G1("custodian")],T)},ZI=(T="voteInit")=>{return S.struct([G1("nodePubkey"),G1("authorizedVoter"),G1("authorizedWithdrawer"),S.u8("commission")],T)},XI=(T="voteAuthorizeWithSeedArgs")=>{return S.struct([S.u32("voteAuthorizationType"),G1("currentAuthorityDerivedKeyOwnerPubkey"),fA("currentAuthorityDerivedKeySeed"),G1("newAuthorized")],T)};function ZP(T,A){let Q=($)=>{if($.span>=0)return $.span;else if(typeof $.alloc==="function")return $.alloc(A[$.property]);else if("count"in $&&"elementLayout"in $){let W=A[$.property];if(Array.isArray(W))return W.length*Q($.elementLayout)}else if("fields"in $)return ZP({layout:$},A[$.property]);return 0},J=0;return T.layout.fields.forEach(($)=>{J+=Q($)}),J}function p2(T){let A=0,Q=0;for(;;){let J=T.shift();if(A|=(J&127)<<Q*7,Q+=1,(J&128)===0)break}return A}function l2(T,A){let Q=A;for(;;){let J=Q&127;if(Q>>=7,Q==0){T.push(J);break}else J|=128,T.push(J)}}function R0(T,A){if(!T)throw Error(A||"Assertion failed")}class SW{constructor(T,A){this.payer=void 0,this.keyMetaMap=void 0,this.payer=T,this.keyMetaMap=A}static compile(T,A){let Q=new Map,J=(W)=>{let G=W.toBase58(),Y=Q.get(G);if(Y===void 0)Y={isSigner:!1,isWritable:!1,isInvoked:!1},Q.set(G,Y);return Y},$=J(A);$.isSigner=!0,$.isWritable=!0;for(let W of T){J(W.programId).isInvoked=!0;for(let G of W.keys){let Y=J(G.pubkey);Y.isSigner||=G.isSigner,Y.isWritable||=G.isWritable}}return new SW(A,Q)}getMessageComponents(){let T=[...this.keyMetaMap.entries()];R0(T.length<=256,"Max static account keys length exceeded");let A=T.filter(([,Y])=>Y.isSigner&&Y.isWritable),Q=T.filter(([,Y])=>Y.isSigner&&!Y.isWritable),J=T.filter(([,Y])=>!Y.isSigner&&Y.isWritable),$=T.filter(([,Y])=>!Y.isSigner&&!Y.isWritable),W={numRequiredSignatures:A.length+Q.length,numReadonlySignedAccounts:Q.length,numReadonlyUnsignedAccounts:$.length};{R0(A.length>0,"Expected at least one writable signer key");let[Y]=A[0];R0(Y===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}let G=[...A.map(([Y])=>new a(Y)),...Q.map(([Y])=>new a(Y)),...J.map(([Y])=>new a(Y)),...$.map(([Y])=>new a(Y))];return[W,G]}extractTableLookup(T){let[A,Q]=this.drainKeysFoundInLookupTable(T.state.addresses,(W)=>!W.isSigner&&!W.isInvoked&&W.isWritable),[J,$]=this.drainKeysFoundInLookupTable(T.state.addresses,(W)=>!W.isSigner&&!W.isInvoked&&!W.isWritable);if(A.length===0&&J.length===0)return;return[{accountKey:T.key,writableIndexes:A,readonlyIndexes:J},{writable:Q,readonly:$}]}drainKeysFoundInLookupTable(T,A){let Q=[],J=[];for(let[$,W]of this.keyMetaMap.entries())if(A(W)){let G=new a($),Y=T.findIndex((Z)=>Z.equals(G));if(Y>=0)R0(Y<256,"Max lookup table index exceeded"),Q.push(Y),J.push(G),this.keyMetaMap.delete($)}return[Q,J]}}var XP="Reached end of buffer unexpectedly";function zQ(T){if(T.length===0)throw Error(XP);return T.shift()}function u2(T,...A){let[Q]=A;if(A.length===2?Q+(A[1]??0)>T.length:Q>=T.length)throw Error(XP);return T.splice(...A)}class r2{constructor(T){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=T.header,this.accountKeys=T.accountKeys.map((A)=>new a(A)),this.recentBlockhash=T.recentBlockhash,this.instructions=T.instructions,this.instructions.forEach((A)=>this.indexToProgramIds.set(A.programIdIndex,this.accountKeys[A.programIdIndex]))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map((T)=>({programIdIndex:T.programIdIndex,accountKeyIndexes:T.accounts,data:TT.default.decode(T.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new NW(this.staticAccountKeys)}static compile(T){let A=SW.compile(T.instructions,T.payerKey),[Q,J]=A.getMessageComponents(),W=new NW(J).compileInstructions(T.instructions).map((G)=>({programIdIndex:G.programIdIndex,accounts:G.accountKeyIndexes,data:TT.default.encode(G.data)}));return new r2({header:Q,accountKeys:J,recentBlockhash:T.recentBlockhash,instructions:W})}isAccountSigner(T){return T<this.header.numRequiredSignatures}isAccountWritable(T){let A=this.header.numRequiredSignatures;if(T>=this.header.numRequiredSignatures){let Q=T-A,$=this.accountKeys.length-A-this.header.numReadonlyUnsignedAccounts;return Q<$}else{let Q=A-this.header.numReadonlySignedAccounts;return T<Q}}isProgramId(T){return this.indexToProgramIds.has(T)}programIds(){return[...this.indexToProgramIds.values()]}nonProgramIds(){return this.accountKeys.filter((T,A)=>!this.isProgramId(A))}serialize(){let T=this.accountKeys.length,A=[];l2(A,T);let Q=this.instructions.map((K)=>{let{accounts:j,programIdIndex:M}=K,z=Array.from(TT.default.decode(K.data)),N=[];l2(N,j.length);let E=[];return l2(E,z.length),{programIdIndex:M,keyIndicesCount:w.from(N),keyIndices:j,dataLength:w.from(E),data:z}}),J=[];l2(J,Q.length);let $=w.alloc(IQ);w.from(J).copy($);let W=J.length;Q.forEach((K)=>{let M=S.struct([S.u8("programIdIndex"),S.blob(K.keyIndicesCount.length,"keyIndicesCount"),S.seq(S.u8("keyIndex"),K.keyIndices.length,"keyIndices"),S.blob(K.dataLength.length,"dataLength"),S.seq(S.u8("userdatum"),K.data.length,"data")]).encode(K,$,W);W+=M}),$=$.slice(0,W);let G=S.struct([S.blob(1,"numRequiredSignatures"),S.blob(1,"numReadonlySignedAccounts"),S.blob(1,"numReadonlyUnsignedAccounts"),S.blob(A.length,"keyCount"),S.seq(G1("key"),T,"keys"),G1("recentBlockhash")]),Y={numRequiredSignatures:w.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:w.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:w.from([this.header.numReadonlyUnsignedAccounts]),keyCount:w.from(A),keys:this.accountKeys.map((K)=>Y1(K.toBytes())),recentBlockhash:TT.default.decode(this.recentBlockhash)},Z=w.alloc(2048),C=G.encode(Y,Z);return $.copy(Z,C),Z.slice(0,C+$.length)}static from(T){let A=[...T],Q=zQ(A);if(Q!==(Q&GI))throw Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");let J=zQ(A),$=zQ(A),W=p2(A),G=[];for(let j=0;j<W;j++){let M=u2(A,0,d2);G.push(new a(w.from(M)))}let Y=u2(A,0,d2),Z=p2(A),C=[];for(let j=0;j<Z;j++){let M=zQ(A),z=p2(A),N=u2(A,0,z),E=p2(A),L=u2(A,0,E),O=TT.default.encode(w.from(L));C.push({programIdIndex:M,accounts:N,data:O})}let K={header:{numRequiredSignatures:Q,numReadonlySignedAccounts:J,numReadonlyUnsignedAccounts:$},recentBlockhash:TT.default.encode(w.from(Y)),accountKeys:G,instructions:C};return new r2(K)}}var PI=w.alloc(WP).fill(0);class Z1{constructor(T){if(this.keys=void 0,this.programId=void 0,this.data=w.alloc(0),this.programId=T.programId,this.keys=T.keys,T.data)this.data=T.data}toJSON(){return{keys:this.keys.map(({pubkey:T,isSigner:A,isWritable:Q})=>({pubkey:T.toJSON(),isSigner:A,isWritable:Q})),programId:this.programId.toJSON(),data:[...this.data]}}}class j1{get signature(){if(this.signatures.length>0)return this.signatures[0].signature;return null}constructor(T){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,!T)return;if(T.feePayer)this.feePayer=T.feePayer;if(T.signatures)this.signatures=T.signatures;if(Object.prototype.hasOwnProperty.call(T,"nonceInfo")){let{minContextSlot:A,nonceInfo:Q}=T;this.minNonceContextSlot=A,this.nonceInfo=Q}else if(Object.prototype.hasOwnProperty.call(T,"lastValidBlockHeight")){let{blockhash:A,lastValidBlockHeight:Q}=T;this.recentBlockhash=A,this.lastValidBlockHeight=Q}else{let{recentBlockhash:A,nonceInfo:Q}=T;if(Q)this.nonceInfo=Q;this.recentBlockhash=A}}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((T)=>T.toJSON()),signers:this.signatures.map(({publicKey:T})=>{return T.toJSON()})}}add(...T){if(T.length===0)throw Error("No instructions");return T.forEach((A)=>{if("instructions"in A)this.instructions=this.instructions.concat(A.instructions);else if("data"in A&&"programId"in A&&"keys"in A)this.instructions.push(A);else this.instructions.push(new Z1(A))}),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let T,A;if(this.nonceInfo)if(T=this.nonceInfo.nonce,this.instructions[0]!=this.nonceInfo.nonceInstruction)A=[this.nonceInfo.nonceInstruction,...this.instructions];else A=this.instructions;else T=this.recentBlockhash,A=this.instructions;if(!T)throw Error("Transaction recentBlockhash required");if(A.length<1)console.warn("No instructions provided");let Q;if(this.feePayer)Q=this.feePayer;else if(this.signatures.length>0&&this.signatures[0].publicKey)Q=this.signatures[0].publicKey;else throw Error("Transaction fee payer required");for(let N=0;N<A.length;N++)if(A[N].programId===void 0)throw Error(`Transaction instruction index ${N} has undefined program id`);let J=[],$=[];A.forEach((N)=>{N.keys.forEach((L)=>{$.push({...L})});let E=N.programId.toString();if(!J.includes(E))J.push(E)}),J.forEach((N)=>{$.push({pubkey:new a(N),isSigner:!1,isWritable:!1})});let W=[];$.forEach((N)=>{let E=N.pubkey.toString(),L=W.findIndex((O)=>{return O.pubkey.toString()===E});if(L>-1)W[L].isWritable=W[L].isWritable||N.isWritable,W[L].isSigner=W[L].isSigner||N.isSigner;else W.push(N)}),W.sort(function(N,E){if(N.isSigner!==E.isSigner)return N.isSigner?-1:1;if(N.isWritable!==E.isWritable)return N.isWritable?-1:1;let L={localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"};return N.pubkey.toBase58().localeCompare(E.pubkey.toBase58(),"en",L)});let G=W.findIndex((N)=>{return N.pubkey.equals(Q)});if(G>-1){let[N]=W.splice(G,1);N.isSigner=!0,N.isWritable=!0,W.unshift(N)}else W.unshift({pubkey:Q,isSigner:!0,isWritable:!0});for(let N of this.signatures){let E=W.findIndex((L)=>{return L.pubkey.equals(N.publicKey)});if(E>-1){if(!W[E].isSigner)W[E].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 Error(`unknown signer: ${N.publicKey.toString()}`)}let Y=0,Z=0,C=0,K=[],j=[];W.forEach(({pubkey:N,isSigner:E,isWritable:L})=>{if(E){if(K.push(N.toString()),Y+=1,!L)Z+=1}else if(j.push(N.toString()),!L)C+=1});let M=K.concat(j),z=A.map((N)=>{let{data:E,programId:L}=N;return{programIdIndex:M.indexOf(L.toString()),accounts:N.keys.map((O)=>M.indexOf(O.pubkey.toString())),data:TT.default.encode(E)}});return z.forEach((N)=>{R0(N.programIdIndex>=0),N.accounts.forEach((E)=>R0(E>=0))}),new r2({header:{numRequiredSignatures:Y,numReadonlySignedAccounts:Z,numReadonlyUnsignedAccounts:C},accountKeys:M,recentBlockhash:T,instructions:z})}_compile(){let T=this.compileMessage(),A=T.accountKeys.slice(0,T.header.numRequiredSignatures);if(this.signatures.length===A.length){if(this.signatures.every((J,$)=>{return A[$].equals(J.publicKey)}))return T}return this.signatures=A.map((Q)=>({signature:null,publicKey:Q})),T}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(T){return(await T.getFeeForMessage(this.compileMessage())).value}setSigners(...T){if(T.length===0)throw Error("No signers");let A=new Set;this.signatures=T.filter((Q)=>{let J=Q.toString();if(A.has(J))return!1;else return A.add(J),!0}).map((Q)=>({signature:null,publicKey:Q}))}sign(...T){if(T.length===0)throw Error("No signers");let A=new Set,Q=[];for(let $ of T){let W=$.publicKey.toString();if(A.has(W))continue;else A.add(W),Q.push($)}this.signatures=Q.map(($)=>({signature:null,publicKey:$.publicKey}));let J=this._compile();this._partialSign(J,...Q)}partialSign(...T){if(T.length===0)throw Error("No signers");let A=new Set,Q=[];for(let $ of T){let W=$.publicKey.toString();if(A.has(W))continue;else A.add(W),Q.push($)}let J=this._compile();this._partialSign(J,...Q)}_partialSign(T,...A){let Q=T.serialize();A.forEach((J)=>{let $=QP(Q,J.secretKey);this._addSignature(J.publicKey,Y1($))})}addSignature(T,A){this._compile(),this._addSignature(T,A)}_addSignature(T,A){R0(A.length===64);let Q=this.signatures.findIndex((J)=>T.equals(J.publicKey));if(Q<0)throw Error(`unknown signer: ${T.toString()}`);this.signatures[Q].signature=w.from(A)}verifySignatures(T=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),T)}_getMessageSignednessErrors(T,A){let Q={};for(let{signature:J,publicKey:$}of this.signatures)if(J===null){if(A)(Q.missing||=[]).push($)}else if(!JI(J,T,$.toBytes()))(Q.invalid||=[]).push($);return Q.invalid||Q.missing?Q:void 0}serialize(T){let{requireAllSignatures:A,verifySignatures:Q}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},T),J=this.serializeMessage();if(Q){let $=this._getMessageSignednessErrors(J,A);if($){let W="Signature verification failed.";if($.invalid)W+=`
|
|
15
|
+
Invalid signature for public key${$.invalid.length===1?"":"(s)"} [\`${$.invalid.map((G)=>G.toBase58()).join("`, `")}\`].`;if($.missing)W+=`
|
|
16
|
+
Missing signature for public key${$.missing.length===1?"":"(s)"} [\`${$.missing.map((G)=>G.toBase58()).join("`, `")}\`].`;throw Error(W)}}return this._serialize(J)}_serialize(T){let{signatures:A}=this,Q=[];l2(Q,A.length);let J=Q.length+A.length*64+T.length,$=w.alloc(J);return R0(A.length<256),w.from(Q).copy($,0),A.forEach(({signature:W},G)=>{if(W!==null)R0(W.length===64,"signature has invalid length"),w.from(W).copy($,Q.length+G*64)}),T.copy($,Q.length+A.length*64),R0($.length<=IQ,`Transaction too large: ${$.length} > ${IQ}`),$}get keys(){return R0(this.instructions.length===1),this.instructions[0].keys.map((T)=>T.pubkey)}get programId(){return R0(this.instructions.length===1),this.instructions[0].programId}get data(){return R0(this.instructions.length===1),this.instructions[0].data}static from(T){let A=[...T],Q=p2(A),J=[];for(let $=0;$<Q;$++){let W=u2(A,0,WP);J.push(TT.default.encode(w.from(W)))}return j1.populate(r2.from(A),J)}static populate(T,A=[]){let Q=new j1;if(Q.recentBlockhash=T.recentBlockhash,T.header.numRequiredSignatures>0)Q.feePayer=T.accountKeys[0];return A.forEach((J,$)=>{let W={signature:J==TT.default.encode(PI)?null:TT.default.decode(J),publicKey:T.accountKeys[$]};Q.signatures.push(W)}),T.instructions.forEach((J)=>{let $=J.accounts.map((W)=>{let G=T.accountKeys[W];return{pubkey:G,isSigner:Q.signatures.some((Y)=>Y.publicKey.toString()===G.toString())||T.isAccountSigner(W),isWritable:T.isAccountWritable(W)}});Q.instructions.push(new Z1({keys:$,programId:T.accountKeys[J.programIdIndex],data:TT.default.decode(J.data)}))}),Q._message=T,Q._json=Q.toJSON(),Q}}var qI=160,KI=64,CI=qI/KI,HI=1000/CI,X8=new a("SysvarC1ock11111111111111111111111111111111"),uh=new a("SysvarEpochSchedu1e111111111111111111111111"),dh=new a("Sysvar1nstructions1111111111111111111111111"),RW=new a("SysvarRecentB1ockHashes11111111111111111111"),n2=new a("SysvarRent111111111111111111111111111111111"),ch=new a("SysvarRewards111111111111111111111111111111"),fh=new a("SysvarS1otHashes111111111111111111111111111"),rh=new a("SysvarS1otHistory11111111111111111111111111"),DW=new a("SysvarStakeHistory1111111111111111111111111");class PP extends Error{constructor({action:T,signature:A,transactionMessage:Q,logs:J}){let $=J?`Logs:
|
|
17
|
+
${JSON.stringify(J.slice(-10),null,2)}. `:"",W="\nCatch the `SendTransactionError` and call `getLogs()` on it for full details.",G;switch(T){case"send":G=`Transaction ${A} resulted in an error.
|
|
18
|
+
${Q}. `+$+"\nCatch the `SendTransactionError` and call `getLogs()` on it for full details.";break;case"simulate":G=`Simulation failed.
|
|
19
19
|
Message: ${Q}.
|
|
20
|
-
`+W+"\nCatch the `SendTransactionError` and call `getLogs()` on it for full details.";break;default:G=`Unknown action '${((Y)=>Y)(T)}'`}super(G);this.signature=void 0,this.transactionMessage=void 0,this.transactionLogs=void 0,this.signature=A,this.transactionMessage=Q,this.transactionLogs=J?J:void 0}get transactionError(){return{message:this.transactionMessage,logs:Array.isArray(this.transactionLogs)?this.transactionLogs:void 0}}get logs(){let T=this.transactionLogs;if(T!=null&&typeof T==="object"&&"then"in T)return;return T}async getLogs(T){if(!Array.isArray(this.transactionLogs))this.transactionLogs=new Promise((A,Q)=>{T.getTransaction(this.signature).then((J)=>{if(J&&J.meta&&J.meta.logMessages){let W=J.meta.logMessages;this.transactionLogs=W,A(W)}else Q(Error("Log messages not found"))}).catch(Q)});return await this.transactionLogs}}async function y9(T,A,Q,J){let W=J&&{skipPreflight:J.skipPreflight,preflightCommitment:J.preflightCommitment||J.commitment,maxRetries:J.maxRetries,minContextSlot:J.minContextSlot},$=await T.sendTransaction(A,Q,W),G;if(A.recentBlockhash!=null&&A.lastValidBlockHeight!=null)G=(await T.confirmTransaction({abortSignal:J?.abortSignal,signature:$,blockhash:A.recentBlockhash,lastValidBlockHeight:A.lastValidBlockHeight},J&&J.commitment)).value;else if(A.minNonceContextSlot!=null&&A.nonceInfo!=null){let{nonceInstruction:Y}=A.nonceInfo,Z=Y.keys[0].pubkey;G=(await T.confirmTransaction({abortSignal:J?.abortSignal,minContextSlot:A.minNonceContextSlot,nonceAccountPubkey:Z,nonceValue:A.nonceInfo.nonce,signature:$},J&&J.commitment)).value}else{if(J?.abortSignal!=null)console.warn("sendAndConfirmTransaction(): A transaction with a deprecated confirmation strategy was supplied along with an `abortSignal`. Only transactions having `lastValidBlockHeight` or a combination of `nonceInfo` and `minNonceContextSlot` are abortable.");G=(await T.confirmTransaction($,J&&J.commitment)).value}if(G.err){if($!=null)throw new JP({action:"send",signature:$,transactionMessage:`Status: (${JSON.stringify(G)})`});throw Error(`Transaction ${$} failed (${JSON.stringify(G)})`)}return $}function NN(T){return new Promise((A)=>setTimeout(A,T))}function $1(T,A){let Q=T.layout.span>=0?T.layout.span:AP(T,A),J=E.alloc(Q),W=Object.assign({instruction:T.index},A);return T.layout.encode(W,J),J}var IN=S.nu64("lamportsPerSignature"),SN=S.struct([S.u32("version"),S.u32("state"),G1("authorizedPubkey"),G1("nonce"),S.struct([IN],"feeCalculator")]),b9=SN.span;function dA(T){let A=n9.blob(8,T),Q=A.decode.bind(A),J=A.encode.bind(A),W=A,$=dX();return W.decode=(G,Y)=>{let Z=Q(G,Y);return $.decode(Z)},W.encode=(G,Y,Z)=>{let C=$.encode(G);return J(C,Y,Z)},W}var VT=Object.freeze({Create:{index:0,layout:S.struct([S.u32("instruction"),S.ns64("lamports"),S.ns64("space"),G1("programId")])},Assign:{index:1,layout:S.struct([S.u32("instruction"),G1("programId")])},Transfer:{index:2,layout:S.struct([S.u32("instruction"),dA("lamports")])},CreateWithSeed:{index:3,layout:S.struct([S.u32("instruction"),G1("base"),uA("seed"),S.ns64("lamports"),S.ns64("space"),G1("programId")])},AdvanceNonceAccount:{index:4,layout:S.struct([S.u32("instruction")])},WithdrawNonceAccount:{index:5,layout:S.struct([S.u32("instruction"),S.ns64("lamports")])},InitializeNonceAccount:{index:6,layout:S.struct([S.u32("instruction"),G1("authorized")])},AuthorizeNonceAccount:{index:7,layout:S.struct([S.u32("instruction"),G1("authorized")])},Allocate:{index:8,layout:S.struct([S.u32("instruction"),S.ns64("space")])},AllocateWithSeed:{index:9,layout:S.struct([S.u32("instruction"),G1("base"),uA("seed"),S.ns64("space"),G1("programId")])},AssignWithSeed:{index:10,layout:S.struct([S.u32("instruction"),G1("base"),uA("seed"),G1("programId")])},TransferWithSeed:{index:11,layout:S.struct([S.u32("instruction"),dA("lamports"),uA("seed"),G1("programId")])},UpgradeNonceAccount:{index:12,layout:S.struct([S.u32("instruction")])}});class K0{constructor(){}static createAccount(T){let A=VT.Create,Q=$1(A,{lamports:T.lamports,space:T.space,programId:Y1(T.programId.toBuffer())});return new Z1({keys:[{pubkey:T.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:T.newAccountPubkey,isSigner:!0,isWritable:!0}],programId:this.programId,data:Q})}static transfer(T){let A,Q;if("basePubkey"in T){let J=VT.TransferWithSeed;A=$1(J,{lamports:BigInt(T.lamports),seed:T.seed,programId:Y1(T.programId.toBuffer())}),Q=[{pubkey:T.fromPubkey,isSigner:!1,isWritable:!0},{pubkey:T.basePubkey,isSigner:!0,isWritable:!1},{pubkey:T.toPubkey,isSigner:!1,isWritable:!0}]}else{let J=VT.Transfer;A=$1(J,{lamports:BigInt(T.lamports)}),Q=[{pubkey:T.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:T.toPubkey,isSigner:!1,isWritable:!0}]}return new Z1({keys:Q,programId:this.programId,data:A})}static assign(T){let A,Q;if("basePubkey"in T){let J=VT.AssignWithSeed;A=$1(J,{base:Y1(T.basePubkey.toBuffer()),seed:T.seed,programId:Y1(T.programId.toBuffer())}),Q=[{pubkey:T.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:T.basePubkey,isSigner:!0,isWritable:!1}]}else{let J=VT.Assign;A=$1(J,{programId:Y1(T.programId.toBuffer())}),Q=[{pubkey:T.accountPubkey,isSigner:!0,isWritable:!0}]}return new Z1({keys:Q,programId:this.programId,data:A})}static createAccountWithSeed(T){let A=VT.CreateWithSeed,Q=$1(A,{base:Y1(T.basePubkey.toBuffer()),seed:T.seed,lamports:T.lamports,space:T.space,programId:Y1(T.programId.toBuffer())}),J=[{pubkey:T.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:T.newAccountPubkey,isSigner:!1,isWritable:!0}];if(!T.basePubkey.equals(T.fromPubkey))J.push({pubkey:T.basePubkey,isSigner:!0,isWritable:!1});return new Z1({keys:J,programId:this.programId,data:Q})}static createNonceAccount(T){let A=new j1;if("basePubkey"in T&&"seed"in T)A.add(K0.createAccountWithSeed({fromPubkey:T.fromPubkey,newAccountPubkey:T.noncePubkey,basePubkey:T.basePubkey,seed:T.seed,lamports:T.lamports,space:b9,programId:this.programId}));else A.add(K0.createAccount({fromPubkey:T.fromPubkey,newAccountPubkey:T.noncePubkey,lamports:T.lamports,space:b9,programId:this.programId}));let Q={noncePubkey:T.noncePubkey,authorizedPubkey:T.authorizedPubkey};return A.add(this.nonceInitialize(Q)),A}static nonceInitialize(T){let A=VT.InitializeNonceAccount,Q=$1(A,{authorized:Y1(T.authorizedPubkey.toBuffer())}),J={keys:[{pubkey:T.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:H$,isSigner:!1,isWritable:!1},{pubkey:d2,isSigner:!1,isWritable:!1}],programId:this.programId,data:Q};return new Z1(J)}static nonceAdvance(T){let A=VT.AdvanceNonceAccount,Q=$1(A),J={keys:[{pubkey:T.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:H$,isSigner:!1,isWritable:!1},{pubkey:T.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:Q};return new Z1(J)}static nonceWithdraw(T){let A=VT.WithdrawNonceAccount,Q=$1(A,{lamports:T.lamports});return new Z1({keys:[{pubkey:T.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:T.toPubkey,isSigner:!1,isWritable:!0},{pubkey:H$,isSigner:!1,isWritable:!1},{pubkey:d2,isSigner:!1,isWritable:!1},{pubkey:T.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:Q})}static nonceAuthorize(T){let A=VT.AuthorizeNonceAccount,Q=$1(A,{authorized:Y1(T.newAuthorizedPubkey.toBuffer())});return new Z1({keys:[{pubkey:T.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:T.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:Q})}static allocate(T){let A,Q;if("basePubkey"in T){let J=VT.AllocateWithSeed;A=$1(J,{base:Y1(T.basePubkey.toBuffer()),seed:T.seed,space:T.space,programId:Y1(T.programId.toBuffer())}),Q=[{pubkey:T.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:T.basePubkey,isSigner:!0,isWritable:!1}]}else{let J=VT.Allocate;A=$1(J,{space:T.space}),Q=[{pubkey:T.accountPubkey,isSigner:!0,isWritable:!0}]}return new Z1({keys:Q,programId:this.programId,data:A})}}K0.programId=new a("11111111111111111111111111111111");var LN=kQ-300;class zQ{constructor(){}static getMinNumSignatures(T){return 2*(Math.ceil(T/zQ.chunkSize)+1+1)}static async load(T,A,Q,J,W){{let K=await T.getMinimumBalanceForRentExemption(W.length),V=await T.getAccountInfo(Q.publicKey,"confirmed"),M=null;if(V!==null){if(V.executable)return console.error("Program load failed, account is already executable"),!1;if(V.data.length!==W.length)M=M||new j1,M.add(K0.allocate({accountPubkey:Q.publicKey,space:W.length}));if(!V.owner.equals(J))M=M||new j1,M.add(K0.assign({accountPubkey:Q.publicKey,programId:J}));if(V.lamports<K)M=M||new j1,M.add(K0.transfer({fromPubkey:A.publicKey,toPubkey:Q.publicKey,lamports:K-V.lamports}))}else M=new j1().add(K0.createAccount({fromPubkey:A.publicKey,newAccountPubkey:Q.publicKey,lamports:K>0?K:1,space:W.length,programId:J}));if(M!==null)await y9(T,M,[A,Q],{commitment:"confirmed"})}let $=S.struct([S.u32("instruction"),S.u32("offset"),S.u32("bytesLength"),S.u32("bytesLengthPadding"),S.seq(S.u8("byte"),S.offset(S.u32(),-8),"bytes")]),G=zQ.chunkSize,Y=0,Z=W,C=[];while(Z.length>0){let K=Z.slice(0,G),V=E.alloc(G+16);$.encode({instruction:0,offset:Y,bytes:K,bytesLength:0,bytesLengthPadding:0},V);let M=new j1().add({keys:[{pubkey:Q.publicKey,isSigner:!0,isWritable:!0}],programId:J,data:V});if(C.push(y9(T,M,[A,Q],{commitment:"confirmed"})),T._rpcEndpoint.includes("solana.com"))await NN(250);Y+=G,Z=Z.slice(G)}await Promise.all(C);{let K=S.struct([S.u32("instruction")]),V=E.alloc(K.span);K.encode({instruction:1},V);let M=new j1().add({keys:[{pubkey:Q.publicKey,isSigner:!0,isWritable:!0},{pubkey:d2,isSigner:!1,isWritable:!1}],programId:J,data:V}),z="processed",N=await T.sendTransaction(M,[A,Q],{preflightCommitment:z}),{context:w,value:L}=await T.confirmTransaction({signature:N,lastValidBlockHeight:M.lastValidBlockHeight,blockhash:M.recentBlockhash},z);if(L.err)throw Error(`Transaction ${N} failed (${JSON.stringify(L)})`);while(!0){try{if(await T.getSlot({commitment:z})>w.slot)break}catch{}await new Promise((O)=>setTimeout(O,Math.round(FN/2)))}}return!0}}zQ.chunkSize=LN;var nx=new a("BPFLoader2111111111111111111111111111111111");var ix=globalThis.fetch;var ox={index:1,layout:S.struct([S.u32("typeIndex"),dA("deactivationSlot"),S.nu64("lastExtendedSlot"),S.u8("lastExtendedStartIndex"),S.u8(),S.seq(G1(),S.offset(S.u8(),-1),"authority")])};var S1=bA(XQ(a),l(),(T)=>new a(T)),WP=PQ([l(),z1("base64")]),N$=bA(XQ(E),WP,(T)=>E.from(T[0],"base64"));function $P(T){return _0([y({jsonrpc:z1("2.0"),id:l(),result:T}),y({jsonrpc:z1("2.0"),id:l(),error:y({code:XA(),message:l(),data:A1(iX())})})])}var wN=$P(XA());function V1(T){return bA($P(T),wN,(A)=>{if("error"in A)return A;else return{...A,result:yA(A.result,T)}})}function zT(T){return V1(y({context:y({slot:B()}),value:T}))}function NQ(T){return y({context:y({slot:B()}),value:T})}var EN=y({foundation:B(),foundationTerm:B(),initial:B(),taper:B(),terminal:B()}),ax=V1(s(t(y({epoch:B(),effectiveSlot:B(),amount:B(),postBalance:B(),commission:A1(t(B()))})))),ON=s(y({slot:B(),prioritizationFee:B()})),BN=y({total:B(),validator:B(),foundation:B(),epoch:B()}),_N=y({epoch:B(),slotIndex:B(),slotsInEpoch:B(),absoluteSlot:B(),blockHeight:A1(B()),transactionCount:A1(B())}),xN=y({slotsPerEpoch:B(),leaderScheduleSlotOffset:B(),warmup:kT(),firstNormalEpoch:B(),firstNormalSlot:B()}),hN=aW(l(),s(B())),PA=t(_0([y({}),l()])),gN=y({err:PA}),mN=z1("receivedSignature"),sx=y({"solana-core":l(),"feature-set":A1(B())}),vN=y({program:l(),programId:S1,parsed:XA()}),yN=y({programId:S1,accounts:s(S1),data:l()}),tx=zT(y({err:t(_0([y({}),l()])),logs:t(s(l())),accounts:A1(t(s(t(y({executable:kT(),owner:l(),lamports:B(),data:s(l()),rentEpoch:A1(B())}))))),unitsConsumed:A1(B()),returnData:A1(t(y({programId:l(),data:PQ([l(),z1("base64")])}))),innerInstructions:A1(t(s(y({index:B(),instructions:s(_0([vN,yN]))}))))})),ex=zT(y({byIdentity:aW(l(),s(B())),range:y({firstSlot:B(),lastSlot:B()})}));var Th=V1(EN),Ah=V1(BN),Qh=V1(ON),Jh=V1(_N),Wh=V1(xN),$h=V1(hN),Gh=V1(B()),Uh=zT(y({total:B(),circulating:B(),nonCirculating:B(),nonCirculatingAccounts:s(S1)})),bN=y({amount:l(),uiAmount:t(B()),decimals:B(),uiAmountString:A1(l())}),Yh=zT(s(y({address:S1,amount:l(),uiAmount:t(B()),decimals:B(),uiAmountString:A1(l())}))),Zh=zT(s(y({pubkey:S1,account:y({executable:kT(),owner:S1,lamports:B(),data:N$,rentEpoch:B()})}))),z$=y({program:l(),parsed:XA(),space:B()}),Xh=zT(s(y({pubkey:S1,account:y({executable:kT(),owner:S1,lamports:B(),data:z$,rentEpoch:B()})}))),Ph=zT(s(y({lamports:B(),address:S1}))),I$=y({executable:kT(),owner:S1,lamports:B(),data:N$,rentEpoch:B()}),qh=y({pubkey:S1,account:I$}),pN=bA(_0([XQ(E),z$]),_0([WP,z$]),(T)=>{if(Array.isArray(T))return yA(T,N$);else return T}),lN=y({executable:kT(),owner:S1,lamports:B(),data:pN,rentEpoch:B()}),Kh=y({pubkey:S1,account:lN}),Ch=y({state:_0([z1("active"),z1("inactive"),z1("activating"),z1("deactivating")]),active:B(),inactive:B()}),Hh=V1(s(y({signature:l(),slot:B(),err:PA,memo:t(l()),blockTime:A1(t(B()))}))),Vh=V1(s(y({signature:l(),slot:B(),err:PA,memo:t(l()),blockTime:A1(t(B()))}))),jh=y({subscription:B(),result:NQ(I$)}),uN=y({pubkey:S1,account:I$}),Rh=y({subscription:B(),result:NQ(uN)}),dN=y({parent:B(),slot:B(),root:B()}),Dh=y({subscription:B(),result:dN}),cN=_0([y({type:_0([z1("firstShredReceived"),z1("completed"),z1("optimisticConfirmation"),z1("root")]),slot:B(),timestamp:B()}),y({type:z1("createdBank"),parent:B(),slot:B(),timestamp:B()}),y({type:z1("frozen"),slot:B(),timestamp:B(),stats:y({numTransactionEntries:B(),numSuccessfulTransactions:B(),numFailedTransactions:B(),maxTransactionsPerEntry:B()})}),y({type:z1("dead"),slot:B(),timestamp:B(),err:l()})]),Mh=y({subscription:B(),result:cN}),kh=y({subscription:B(),result:NQ(_0([gN,mN]))}),zh=y({subscription:B(),result:B()}),Fh=y({pubkey:l(),gossip:t(l()),tpu:t(l()),rpc:t(l()),version:t(l())}),p9=y({votePubkey:l(),nodePubkey:l(),activatedStake:B(),epochVoteAccount:kT(),epochCredits:s(PQ([B(),B(),B()])),commission:B(),lastVote:B(),rootSlot:t(B())}),Nh=V1(y({current:s(p9),delinquent:s(p9)})),fN=_0([z1("processed"),z1("confirmed"),z1("finalized")]),rN=y({slot:B(),confirmations:t(B()),err:PA,confirmationStatus:A1(fN)}),Ih=zT(s(t(rN))),Sh=V1(B()),GP=y({accountKey:S1,writableIndexes:s(B()),readonlyIndexes:s(B())}),S$=y({signatures:s(l()),message:y({accountKeys:s(l()),header:y({numRequiredSignatures:B(),numReadonlySignedAccounts:B(),numReadonlyUnsignedAccounts:B()}),instructions:s(y({accounts:s(B()),data:l(),programIdIndex:B()})),recentBlockhash:l(),addressTableLookups:A1(s(GP))})}),UP=y({pubkey:S1,signer:kT(),writable:kT(),source:A1(_0([z1("transaction"),z1("lookupTable")]))}),YP=y({accountKeys:s(UP),signatures:s(l())}),ZP=y({parsed:XA(),program:l(),programId:S1}),XP=y({accounts:s(S1),data:l(),programId:S1}),nN=_0([XP,ZP]),iN=_0([y({parsed:XA(),program:l(),programId:l()}),y({accounts:s(l()),data:l(),programId:l()})]),PP=bA(nN,iN,(T)=>{if("accounts"in T)return yA(T,XP);else return yA(T,ZP)}),qP=y({signatures:s(l()),message:y({accountKeys:s(UP),instructions:s(PP),recentBlockhash:l(),addressTableLookups:A1(t(s(GP)))})}),FQ=y({accountIndex:B(),mint:l(),owner:A1(l()),programId:A1(l()),uiTokenAmount:bN}),KP=y({writable:s(S1),readonly:s(S1)}),IQ=y({err:PA,fee:B(),innerInstructions:A1(t(s(y({index:B(),instructions:s(y({accounts:s(B()),data:l(),programIdIndex:B()}))})))),preBalances:s(B()),postBalances:s(B()),logMessages:A1(t(s(l()))),preTokenBalances:A1(t(s(FQ))),postTokenBalances:A1(t(s(FQ))),loadedAddresses:A1(KP),computeUnitsConsumed:A1(B()),costUnits:A1(B())}),L$=y({err:PA,fee:B(),innerInstructions:A1(t(s(y({index:B(),instructions:s(PP)})))),preBalances:s(B()),postBalances:s(B()),logMessages:A1(t(s(l()))),preTokenBalances:A1(t(s(FQ))),postTokenBalances:A1(t(s(FQ))),loadedAddresses:A1(KP),computeUnitsConsumed:A1(B()),costUnits:A1(B())}),fA=_0([z1(0),z1("legacy")]),qA=y({pubkey:l(),lamports:B(),postBalance:t(B()),rewardType:t(l()),commission:A1(t(B()))}),Lh=V1(t(y({blockhash:l(),previousBlockhash:l(),parentSlot:B(),transactions:s(y({transaction:S$,meta:t(IQ),version:A1(fA)})),rewards:A1(s(qA)),blockTime:t(B()),blockHeight:t(B())}))),wh=V1(t(y({blockhash:l(),previousBlockhash:l(),parentSlot:B(),rewards:A1(s(qA)),blockTime:t(B()),blockHeight:t(B())}))),Eh=V1(t(y({blockhash:l(),previousBlockhash:l(),parentSlot:B(),transactions:s(y({transaction:YP,meta:t(IQ),version:A1(fA)})),rewards:A1(s(qA)),blockTime:t(B()),blockHeight:t(B())}))),Oh=V1(t(y({blockhash:l(),previousBlockhash:l(),parentSlot:B(),transactions:s(y({transaction:qP,meta:t(L$),version:A1(fA)})),rewards:A1(s(qA)),blockTime:t(B()),blockHeight:t(B())}))),Bh=V1(t(y({blockhash:l(),previousBlockhash:l(),parentSlot:B(),transactions:s(y({transaction:YP,meta:t(L$),version:A1(fA)})),rewards:A1(s(qA)),blockTime:t(B()),blockHeight:t(B())}))),_h=V1(t(y({blockhash:l(),previousBlockhash:l(),parentSlot:B(),rewards:A1(s(qA)),blockTime:t(B()),blockHeight:t(B())}))),xh=V1(t(y({blockhash:l(),previousBlockhash:l(),parentSlot:B(),transactions:s(y({transaction:S$,meta:t(IQ)})),rewards:A1(s(qA)),blockTime:t(B())}))),hh=V1(t(y({blockhash:l(),previousBlockhash:l(),parentSlot:B(),signatures:s(l()),blockTime:t(B())}))),gh=V1(t(y({slot:B(),meta:t(IQ),blockTime:A1(t(B())),transaction:S$,version:A1(fA)}))),mh=V1(t(y({slot:B(),transaction:qP,meta:t(L$),blockTime:A1(t(B())),version:A1(fA)}))),vh=zT(y({blockhash:l(),lastValidBlockHeight:B()})),yh=zT(kT()),oN=y({slot:B(),numTransactions:B(),numSlots:B(),samplePeriodSecs:B()}),bh=V1(s(oN)),ph=zT(t(y({feeCalculator:y({lamportsPerSignature:B()})}))),lh=V1(l()),uh=V1(l()),aN=y({err:PA,logs:s(l()),signature:l()}),dh=y({result:NQ(aN),subscription:B()});class p2{constructor(T){this._keypair=void 0,this._keypair=T??g9()}static generate(){return new p2(g9())}static fromSecretKey(T,A){if(T.byteLength!==64)throw Error("bad secret key size");let Q=T.slice(32,64);if(!A||!A.skipValidation){let J=T.slice(0,32),W=M$(J);for(let $=0;$<32;$++)if(Q[$]!==W[$])throw Error("provided secretKey is invalid")}return new p2({publicKey:Q,secretKey:T})}static fromSeed(T){let A=M$(T),Q=new Uint8Array(64);return Q.set(T),Q.set(A,32),new p2({publicKey:A,secretKey:Q})}get publicKey(){return new a(this._keypair.publicKey)}get secretKey(){return new Uint8Array(this._keypair.secretKey)}}var h2=Object.freeze({CreateLookupTable:{index:0,layout:S.struct([S.u32("instruction"),dA("recentSlot"),S.u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:S.struct([S.u32("instruction")])},ExtendLookupTable:{index:2,layout:S.struct([S.u32("instruction"),dA(),S.seq(G1(),S.offset(S.u32(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:S.struct([S.u32("instruction")])},CloseLookupTable:{index:4,layout:S.struct([S.u32("instruction")])}});class CP{constructor(){}static createLookupTable(T){let[A,Q]=a.findProgramAddressSync([T.authority.toBuffer(),iW().encode(T.recentSlot)],this.programId),J=h2.CreateLookupTable,W=$1(J,{recentSlot:BigInt(T.recentSlot),bumpSeed:Q}),$=[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:T.authority,isSigner:!0,isWritable:!1},{pubkey:T.payer,isSigner:!0,isWritable:!0},{pubkey:K0.programId,isSigner:!1,isWritable:!1}];return[new Z1({programId:this.programId,keys:$,data:W}),A]}static freezeLookupTable(T){let A=h2.FreezeLookupTable,Q=$1(A),J=[{pubkey:T.lookupTable,isSigner:!1,isWritable:!0},{pubkey:T.authority,isSigner:!0,isWritable:!1}];return new Z1({programId:this.programId,keys:J,data:Q})}static extendLookupTable(T){let A=h2.ExtendLookupTable,Q=$1(A,{addresses:T.addresses.map((W)=>W.toBytes())}),J=[{pubkey:T.lookupTable,isSigner:!1,isWritable:!0},{pubkey:T.authority,isSigner:!0,isWritable:!1}];if(T.payer)J.push({pubkey:T.payer,isSigner:!0,isWritable:!0},{pubkey:K0.programId,isSigner:!1,isWritable:!1});return new Z1({programId:this.programId,keys:J,data:Q})}static deactivateLookupTable(T){let A=h2.DeactivateLookupTable,Q=$1(A),J=[{pubkey:T.lookupTable,isSigner:!1,isWritable:!0},{pubkey:T.authority,isSigner:!0,isWritable:!1}];return new Z1({programId:this.programId,keys:J,data:Q})}static closeLookupTable(T){let A=h2.CloseLookupTable,Q=$1(A),J=[{pubkey:T.lookupTable,isSigner:!1,isWritable:!0},{pubkey:T.authority,isSigner:!0,isWritable:!1},{pubkey:T.recipient,isSigner:!1,isWritable:!0}];return new Z1({programId:this.programId,keys:J,data:Q})}}CP.programId=new a("AddressLookupTab1e1111111111111111111111111");var DQ=Object.freeze({RequestUnits:{index:0,layout:S.struct([S.u8("instruction"),S.u32("units"),S.u32("additionalFee")])},RequestHeapFrame:{index:1,layout:S.struct([S.u8("instruction"),S.u32("bytes")])},SetComputeUnitLimit:{index:2,layout:S.struct([S.u8("instruction"),S.u32("units")])},SetComputeUnitPrice:{index:3,layout:S.struct([S.u8("instruction"),dA("microLamports")])}});class HP{constructor(){}static requestUnits(T){let A=DQ.RequestUnits,Q=$1(A,T);return new Z1({keys:[],programId:this.programId,data:Q})}static requestHeapFrame(T){let A=DQ.RequestHeapFrame,Q=$1(A,T);return new Z1({keys:[],programId:this.programId,data:Q})}static setComputeUnitLimit(T){let A=DQ.SetComputeUnitLimit,Q=$1(A,T);return new Z1({keys:[],programId:this.programId,data:Q})}static setComputeUnitPrice(T){let A=DQ.SetComputeUnitPrice,Q=$1(A,{microLamports:BigInt(T.microLamports)});return new Z1({keys:[],programId:this.programId,data:Q})}}HP.programId=new a("ComputeBudget111111111111111111111111111111");var l9=64,u9=32,d9=64,c9=S.struct([S.u8("numSignatures"),S.u8("padding"),S.u16("signatureOffset"),S.u16("signatureInstructionIndex"),S.u16("publicKeyOffset"),S.u16("publicKeyInstructionIndex"),S.u16("messageDataOffset"),S.u16("messageDataSize"),S.u16("messageInstructionIndex")]);class w${constructor(){}static createInstructionWithPublicKey(T){let{publicKey:A,message:Q,signature:J,instructionIndex:W}=T;R0(A.length===u9,`Public Key must be ${u9} bytes but received ${A.length} bytes`),R0(J.length===d9,`Signature must be ${d9} bytes but received ${J.length} bytes`);let $=c9.span,G=$+A.length,Y=G+J.length,Z=1,C=E.alloc(Y+Q.length),K=W==null?65535:W;return c9.encode({numSignatures:Z,padding:0,signatureOffset:G,signatureInstructionIndex:K,publicKeyOffset:$,publicKeyInstructionIndex:K,messageDataOffset:Y,messageDataSize:Q.length,messageInstructionIndex:K},C),C.fill(A,$),C.fill(J,G),C.fill(Q,Y),new Z1({keys:[],programId:w$.programId,data:C})}static createInstructionWithPrivateKey(T){let{privateKey:A,message:Q,instructionIndex:J}=T;R0(A.length===l9,`Private key must be ${l9} bytes but received ${A.length} bytes`);try{let W=p2.fromSecretKey(A),$=W.publicKey.toBytes(),G=i9(Q,W.secretKey);return this.createInstructionWithPublicKey({publicKey:$,message:Q,signature:G,instructionIndex:J})}catch(W){throw Error(`Error creating instruction; ${W}`)}}}w$.programId=new a("Ed25519SigVerify111111111111111111111111111");var sN=(T,A)=>{let Q=jQ.sign(T,A);return[Q.toCompactRawBytes(),Q.recovery]};jQ.utils.isValidPrivateKey;var tN=jQ.getPublicKey,f9=32,j$=20,r9=64,eN=11,R$=S.struct([S.u8("numSignatures"),S.u16("signatureOffset"),S.u8("signatureInstructionIndex"),S.u16("ethAddressOffset"),S.u8("ethAddressInstructionIndex"),S.u16("messageDataOffset"),S.u16("messageDataSize"),S.u8("messageInstructionIndex"),S.blob(20,"ethAddress"),S.blob(64,"signature"),S.u8("recoveryId")]);class l2{constructor(){}static publicKeyToEthAddress(T){R0(T.length===r9,`Public key must be ${r9} bytes but received ${T.length} bytes`);try{return E.from(Y$(Y1(T))).slice(-j$)}catch(A){throw Error(`Error constructing Ethereum address: ${A}`)}}static createInstructionWithPublicKey(T){let{publicKey:A,message:Q,signature:J,recoveryId:W,instructionIndex:$}=T;return l2.createInstructionWithEthAddress({ethAddress:l2.publicKeyToEthAddress(A),message:Q,signature:J,recoveryId:W,instructionIndex:$})}static createInstructionWithEthAddress(T){let{ethAddress:A,message:Q,signature:J,recoveryId:W,instructionIndex:$=0}=T,G;if(typeof A==="string")if(A.startsWith("0x"))G=E.from(A.substr(2),"hex");else G=E.from(A,"hex");else G=A;R0(G.length===j$,`Address must be ${j$} bytes but received ${G.length} bytes`);let Y=1+eN,Z=Y,C=Y+G.length,K=C+J.length+1,V=1,M=E.alloc(R$.span+Q.length);return R$.encode({numSignatures:V,signatureOffset:C,signatureInstructionIndex:$,ethAddressOffset:Z,ethAddressInstructionIndex:$,messageDataOffset:K,messageDataSize:Q.length,messageInstructionIndex:$,signature:Y1(J),ethAddress:Y1(G),recoveryId:W},M),M.fill(Y1(Q),R$.span),new Z1({keys:[],programId:l2.programId,data:M})}static createInstructionWithPrivateKey(T){let{privateKey:A,message:Q,instructionIndex:J}=T;R0(A.length===f9,`Private key must be ${f9} bytes but received ${A.length} bytes`);try{let W=Y1(A),$=tN(W,!1).slice(1),G=E.from(Y$(Y1(Q))),[Y,Z]=sN(G,W);return this.createInstructionWithPublicKey({publicKey:$,message:Q,signature:Y,recoveryId:Z,instructionIndex:J})}catch(W){throw Error(`Error creating instruction; ${W}`)}}}l2.programId=new a("KeccakSecp256k11111111111111111111111111111");var VP,TI=new a("StakeConfig11111111111111111111111111111111");class SQ{constructor(T,A,Q){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=T,this.epoch=A,this.custodian=Q}}VP=SQ;SQ.default=new VP(0,0,a.default);var v8=Object.freeze({Initialize:{index:0,layout:S.struct([S.u32("instruction"),HN(),VN()])},Authorize:{index:1,layout:S.struct([S.u32("instruction"),G1("newAuthorized"),S.u32("stakeAuthorizationType")])},Delegate:{index:2,layout:S.struct([S.u32("instruction")])},Split:{index:3,layout:S.struct([S.u32("instruction"),S.ns64("lamports")])},Withdraw:{index:4,layout:S.struct([S.u32("instruction"),S.ns64("lamports")])},Deactivate:{index:5,layout:S.struct([S.u32("instruction")])},Merge:{index:7,layout:S.struct([S.u32("instruction")])},AuthorizeWithSeed:{index:8,layout:S.struct([S.u32("instruction"),G1("newAuthorized"),S.u32("stakeAuthorizationType"),uA("authoritySeed"),G1("authorityOwner")])}}),ch=Object.freeze({Staker:{index:0},Withdrawer:{index:1}});class E${constructor(){}static initialize(T){let{stakePubkey:A,authorized:Q,lockup:J}=T,W=J||SQ.default,$=v8.Initialize,G=$1($,{authorized:{staker:Y1(Q.staker.toBuffer()),withdrawer:Y1(Q.withdrawer.toBuffer())},lockup:{unixTimestamp:W.unixTimestamp,epoch:W.epoch,custodian:Y1(W.custodian.toBuffer())}}),Y={keys:[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:d2,isSigner:!1,isWritable:!1}],programId:this.programId,data:G};return new Z1(Y)}static createAccountWithSeed(T){let A=new j1;A.add(K0.createAccountWithSeed({fromPubkey:T.fromPubkey,newAccountPubkey:T.stakePubkey,basePubkey:T.basePubkey,seed:T.seed,lamports:T.lamports,space:this.space,programId:this.programId}));let{stakePubkey:Q,authorized:J,lockup:W}=T;return A.add(this.initialize({stakePubkey:Q,authorized:J,lockup:W}))}static createAccount(T){let A=new j1;A.add(K0.createAccount({fromPubkey:T.fromPubkey,newAccountPubkey:T.stakePubkey,lamports:T.lamports,space:this.space,programId:this.programId}));let{stakePubkey:Q,authorized:J,lockup:W}=T;return A.add(this.initialize({stakePubkey:Q,authorized:J,lockup:W}))}static delegate(T){let{stakePubkey:A,authorizedPubkey:Q,votePubkey:J}=T,W=v8.Delegate,$=$1(W);return new j1().add({keys:[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:J,isSigner:!1,isWritable:!1},{pubkey:X8,isSigner:!1,isWritable:!1},{pubkey:V$,isSigner:!1,isWritable:!1},{pubkey:TI,isSigner:!1,isWritable:!1},{pubkey:Q,isSigner:!0,isWritable:!1}],programId:this.programId,data:$})}static authorize(T){let{stakePubkey:A,authorizedPubkey:Q,newAuthorizedPubkey:J,stakeAuthorizationType:W,custodianPubkey:$}=T,G=v8.Authorize,Y=$1(G,{newAuthorized:Y1(J.toBuffer()),stakeAuthorizationType:W.index}),Z=[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:X8,isSigner:!1,isWritable:!0},{pubkey:Q,isSigner:!0,isWritable:!1}];if($)Z.push({pubkey:$,isSigner:!0,isWritable:!1});return new j1().add({keys:Z,programId:this.programId,data:Y})}static authorizeWithSeed(T){let{stakePubkey:A,authorityBase:Q,authoritySeed:J,authorityOwner:W,newAuthorizedPubkey:$,stakeAuthorizationType:G,custodianPubkey:Y}=T,Z=v8.AuthorizeWithSeed,C=$1(Z,{newAuthorized:Y1($.toBuffer()),stakeAuthorizationType:G.index,authoritySeed:J,authorityOwner:Y1(W.toBuffer())}),K=[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:Q,isSigner:!0,isWritable:!1},{pubkey:X8,isSigner:!1,isWritable:!1}];if(Y)K.push({pubkey:Y,isSigner:!0,isWritable:!1});return new j1().add({keys:K,programId:this.programId,data:C})}static splitInstruction(T){let{stakePubkey:A,authorizedPubkey:Q,splitStakePubkey:J,lamports:W}=T,$=v8.Split,G=$1($,{lamports:W});return new Z1({keys:[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:J,isSigner:!1,isWritable:!0},{pubkey:Q,isSigner:!0,isWritable:!1}],programId:this.programId,data:G})}static split(T,A){let Q=new j1;return Q.add(K0.createAccount({fromPubkey:T.authorizedPubkey,newAccountPubkey:T.splitStakePubkey,lamports:A,space:this.space,programId:this.programId})),Q.add(this.splitInstruction(T))}static splitWithSeed(T,A){let{stakePubkey:Q,authorizedPubkey:J,splitStakePubkey:W,basePubkey:$,seed:G,lamports:Y}=T,Z=new j1;if(Z.add(K0.allocate({accountPubkey:W,basePubkey:$,seed:G,space:this.space,programId:this.programId})),A&&A>0)Z.add(K0.transfer({fromPubkey:T.authorizedPubkey,toPubkey:W,lamports:A}));return Z.add(this.splitInstruction({stakePubkey:Q,authorizedPubkey:J,splitStakePubkey:W,lamports:Y}))}static merge(T){let{stakePubkey:A,sourceStakePubKey:Q,authorizedPubkey:J}=T,W=v8.Merge,$=$1(W);return new j1().add({keys:[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:Q,isSigner:!1,isWritable:!0},{pubkey:X8,isSigner:!1,isWritable:!1},{pubkey:V$,isSigner:!1,isWritable:!1},{pubkey:J,isSigner:!0,isWritable:!1}],programId:this.programId,data:$})}static withdraw(T){let{stakePubkey:A,authorizedPubkey:Q,toPubkey:J,lamports:W,custodianPubkey:$}=T,G=v8.Withdraw,Y=$1(G,{lamports:W}),Z=[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:J,isSigner:!1,isWritable:!0},{pubkey:X8,isSigner:!1,isWritable:!1},{pubkey:V$,isSigner:!1,isWritable:!1},{pubkey:Q,isSigner:!0,isWritable:!1}];if($)Z.push({pubkey:$,isSigner:!0,isWritable:!1});return new j1().add({keys:Z,programId:this.programId,data:Y})}static deactivate(T){let{stakePubkey:A,authorizedPubkey:Q}=T,J=v8.Deactivate,W=$1(J);return new j1().add({keys:[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:X8,isSigner:!1,isWritable:!1},{pubkey:Q,isSigner:!0,isWritable:!1}],programId:this.programId,data:W})}}E$.programId=new a("Stake11111111111111111111111111111111111111");E$.space=200;var g2=Object.freeze({InitializeAccount:{index:0,layout:S.struct([S.u32("instruction"),jN()])},Authorize:{index:1,layout:S.struct([S.u32("instruction"),G1("newAuthorized"),S.u32("voteAuthorizationType")])},Withdraw:{index:3,layout:S.struct([S.u32("instruction"),S.ns64("lamports")])},UpdateValidatorIdentity:{index:4,layout:S.struct([S.u32("instruction")])},AuthorizeWithSeed:{index:10,layout:S.struct([S.u32("instruction"),RN()])}}),fh=Object.freeze({Voter:{index:0},Withdrawer:{index:1}});class LQ{constructor(){}static initializeAccount(T){let{votePubkey:A,nodePubkey:Q,voteInit:J}=T,W=g2.InitializeAccount,$=$1(W,{voteInit:{nodePubkey:Y1(J.nodePubkey.toBuffer()),authorizedVoter:Y1(J.authorizedVoter.toBuffer()),authorizedWithdrawer:Y1(J.authorizedWithdrawer.toBuffer()),commission:J.commission}}),G={keys:[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:d2,isSigner:!1,isWritable:!1},{pubkey:X8,isSigner:!1,isWritable:!1},{pubkey:Q,isSigner:!0,isWritable:!1}],programId:this.programId,data:$};return new Z1(G)}static createAccount(T){let A=new j1;return A.add(K0.createAccount({fromPubkey:T.fromPubkey,newAccountPubkey:T.votePubkey,lamports:T.lamports,space:this.space,programId:this.programId})),A.add(this.initializeAccount({votePubkey:T.votePubkey,nodePubkey:T.voteInit.nodePubkey,voteInit:T.voteInit}))}static authorize(T){let{votePubkey:A,authorizedPubkey:Q,newAuthorizedPubkey:J,voteAuthorizationType:W}=T,$=g2.Authorize,G=$1($,{newAuthorized:Y1(J.toBuffer()),voteAuthorizationType:W.index}),Y=[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:X8,isSigner:!1,isWritable:!1},{pubkey:Q,isSigner:!0,isWritable:!1}];return new j1().add({keys:Y,programId:this.programId,data:G})}static authorizeWithSeed(T){let{currentAuthorityDerivedKeyBasePubkey:A,currentAuthorityDerivedKeyOwnerPubkey:Q,currentAuthorityDerivedKeySeed:J,newAuthorizedPubkey:W,voteAuthorizationType:$,votePubkey:G}=T,Y=g2.AuthorizeWithSeed,Z=$1(Y,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:Y1(Q.toBuffer()),currentAuthorityDerivedKeySeed:J,newAuthorized:Y1(W.toBuffer()),voteAuthorizationType:$.index}}),C=[{pubkey:G,isSigner:!1,isWritable:!0},{pubkey:X8,isSigner:!1,isWritable:!1},{pubkey:A,isSigner:!0,isWritable:!1}];return new j1().add({keys:C,programId:this.programId,data:Z})}static withdraw(T){let{votePubkey:A,authorizedWithdrawerPubkey:Q,lamports:J,toPubkey:W}=T,$=g2.Withdraw,G=$1($,{lamports:J}),Y=[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:W,isSigner:!1,isWritable:!0},{pubkey:Q,isSigner:!0,isWritable:!1}];return new j1().add({keys:Y,programId:this.programId,data:G})}static safeWithdraw(T,A,Q){if(T.lamports>A-Q)throw Error("Withdraw will leave vote account with insufficient funds.");return LQ.withdraw(T)}static updateValidatorIdentity(T){let{votePubkey:A,authorizedWithdrawerPubkey:Q,nodePubkey:J}=T,W=g2.UpdateValidatorIdentity,$=$1(W),G=[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:J,isSigner:!0,isWritable:!1},{pubkey:Q,isSigner:!0,isWritable:!1}];return new j1().add({keys:G,programId:this.programId,data:$})}}LQ.programId=new a("Vote111111111111111111111111111111111111111");LQ.space=3762;var rh=new a("Va1idator1nfo111111111111111111111111111111"),nh=y({name:l(),website:A1(l()),details:A1(l()),iconUrl:A1(l()),keybaseUsername:A1(l())});var ih=new a("Vote111111111111111111111111111111111111111"),oh=S.struct([G1("nodePubkey"),G1("authorizedWithdrawer"),S.u8("commission"),S.nu64(),S.seq(S.struct([S.nu64("slot"),S.u32("confirmationCount")]),S.offset(S.u32(),-8),"votes"),S.u8("rootSlotValid"),S.nu64("rootSlot"),S.nu64(),S.seq(S.struct([S.nu64("epoch"),G1("authorizedVoter")]),S.offset(S.u32(),-8),"authorizedVoters"),S.struct([S.seq(S.struct([G1("authorizedPubkey"),S.nu64("epochOfLastAuthorizedSwitch"),S.nu64("targetEpoch")]),32,"buf"),S.nu64("idx"),S.u8("isEmpty")],"priorVoters"),S.nu64(),S.seq(S.struct([S.nu64("epoch"),S.nu64("credits"),S.nu64("prevCredits")]),S.offset(S.u32(),-8),"epochCredits"),S.struct([S.nu64("slot"),S.nu64("timestamp")],"lastTimestamp")]);var TT=new a("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),th=new a("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"),lT=new a("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"),eh=new a("So11111111111111111111111111111111111111112"),Tg=new a("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");var KA=(T)=>{let A=T.decode.bind(T),Q=T.encode.bind(T);return{decode:A,encode:Q}};var O$=n0(G8(),1),y8=n0(RP(),1);var EQ=(T)=>(A)=>{let Q=O$.blob(T,A),{encode:J,decode:W}=KA(Q),$=Q;return $.decode=(G,Y)=>{let Z=W(G,Y);return y8.toBigIntLE(Buffer.from(Z))},$.encode=(G,Y,Z)=>{let C=y8.toBufferLE(G,T);return J(C,Y,Z)},$},OQ=(T)=>(A)=>{let Q=O$.blob(T,A),{encode:J,decode:W}=KA(Q),$=Q;return $.decode=(G,Y)=>{let Z=W(G,Y);return y8.toBigIntBE(Buffer.from(Z))},$.encode=(G,Y,Z)=>{let C=y8.toBufferBE(G,T);return J(C,Y,Z)},$},DP=EQ(8),$g=OQ(8),Gg=EQ(16),Ug=OQ(16),Yg=EQ(24),Zg=OQ(24),Xg=EQ(32),Pg=OQ(32);var MP=n0(G8(),1);var kP=(T)=>{let A=MP.u8(T),{encode:Q,decode:J}=KA(A),W=A;return W.decode=($,G)=>{return!!J($,G)},W.encode=($,G,Y)=>{let Z=Number($);return Q(Z,G,Y)},W};var zP=n0(G8(),1);var B$=(T)=>{let A=zP.blob(32,T),{encode:Q,decode:J}=KA(A),W=A;return W.decode=($,G)=>{let Y=J($,G);return new a(Y)},W.encode=($,G,Y)=>{let Z=$.toBuffer();return Q(Z,G,Y)},W};class FP extends Error{constructor(T){super(T)}}class _$ extends FP{constructor(){super(...arguments);this.name="TokenOwnerOffCurveError"}}var rA;(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",T[T.GetAccountDataSize=21]="GetAccountDataSize",T[T.InitializeImmutableOwner=22]="InitializeImmutableOwner",T[T.AmountToUiAmount=23]="AmountToUiAmount",T[T.UiAmountToAmount=24]="UiAmountToAmount",T[T.InitializeMintCloseAuthority=25]="InitializeMintCloseAuthority",T[T.TransferFeeExtension=26]="TransferFeeExtension",T[T.ConfidentialTransferExtension=27]="ConfidentialTransferExtension",T[T.DefaultAccountStateExtension=28]="DefaultAccountStateExtension",T[T.Reallocate=29]="Reallocate",T[T.MemoTransferExtension=30]="MemoTransferExtension",T[T.CreateNativeMint=31]="CreateNativeMint",T[T.InitializeNonTransferableMint=32]="InitializeNonTransferableMint",T[T.InterestBearingMintExtension=33]="InterestBearingMintExtension",T[T.CpiGuardExtension=34]="CpiGuardExtension",T[T.InitializePermanentDelegate=35]="InitializePermanentDelegate",T[T.TransferHookExtension=36]="TransferHookExtension",T[T.MetadataPointerExtension=39]="MetadataPointerExtension",T[T.GroupPointerExtension=40]="GroupPointerExtension",T[T.GroupMemberPointerExtension=41]="GroupMemberPointerExtension",T[T.ScaledUiAmountExtension=43]="ScaledUiAmountExtension",T[T.PausableExtension=44]="PausableExtension"})(rA||(rA={}));var CA=n0(G8(),1);function NP(T,A,Q){if(Q.length){T.push({pubkey:A,isSigner:!1,isWritable:!1});for(let J of Q)T.push({pubkey:J instanceof a?J:J.publicKey,isSigner:!0,isWritable:!1})}else T.push({pubkey:A,isSigner:!0,isWritable:!1});return T}var ZI=CA.struct([CA.u32("mintAuthorityOption"),B$("mintAuthority"),DP("supply"),CA.u8("decimals"),kP("isInitialized"),CA.u32("freezeAuthorityOption"),B$("freezeAuthority")]),Og=ZI.span;function c2(T,A,Q=!1,J=TT,W=lT){if(!Q&&!a.isOnCurve(A.toBuffer()))throw new _$;let[$]=a.findProgramAddressSync([A.toBuffer(),J.toBuffer(),T.toBuffer()],W);return $}var BQ=n0(G8(),1);var IP=BQ.struct([BQ.u8("instruction")]);function x$(T,A,Q,J=[],W=TT){let $=NP([{pubkey:T,isSigner:!1,isWritable:!0},{pubkey:A,isSigner:!1,isWritable:!0}],Q,J),G=Buffer.alloc(IP.span);return IP.encode({instruction:rA.CloseAccount},G),new Z1({keys:$,programId:W,data:G})}function _Q(T,A,Q,J,W=TT,$=lT){return XI(T,A,Q,J,Buffer.alloc(0),W,$)}function XI(T,A,Q,J,W,$=TT,G=lT){let Y=[{pubkey:T,isSigner:!0,isWritable:!0},{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:Q,isSigner:!1,isWritable:!1},{pubkey:J,isSigner:!1,isWritable:!1},{pubkey:K0.programId,isSigner:!1,isWritable:!1},{pubkey:$,isSigner:!1,isWritable:!1}];return new Z1({keys:Y,programId:G,data:W})}var xQ=n0(G8(),1);var SP=xQ.struct([xQ.u8("instruction")]);function LP(T,A=TT){let Q=[{pubkey:T,isSigner:!1,isWritable:!0}],J=Buffer.alloc(SP.span);return SP.encode({instruction:rA.SyncNative},J),new Z1({keys:Q,programId:A,data:J})}function hQ(T){if(typeof T==="string")return new a(T);if(typeof T==="object"&&"address"in T)return new a(T.address);return new a(T)}function wP(T){if(T instanceof a)return T;return hQ(T)}function PI(T){return{programAddress:_(T.programId.toBase58()),accounts:T.keys.map((A)=>({address:_(A.pubkey.toBase58()),role:A.isSigner?A.isWritable?W1.WRITABLE_SIGNER:W1.READONLY_SIGNER:A.isWritable?W1.WRITABLE:W1.READONLY})),data:T.data}}function nA(T){let{payer:A,owner:Q,mint:J,tokenProgram:W=TT,associatedTokenProgram:$=lT}=T,G=hQ(A),Y=hQ(Q),Z=hQ(J),C=wP(W),K=wP($),V=c2(Z,Y,!1,C,K);return PI(_Q(G,V,Y,Z,C,K))}var eg=new Uint8Array([143,52,146,187,219,123,76,155]);function KI(){return V0([["discriminator",E0(b0(),8)],["bump",D8()],["admin",Y0()],["flatFees",h6()],["feeTiers",D6(sY())]])}function CI(T){return H8(T,KI())}async function EP(T,A,Q){let J=await HI(T,A,Q);return j8(J),J}async function HI(T,A,Q){let J=await V8(T,A,Q);return CI(J)}var P8=10000n,iA=(T,A,Q)=>{if(Q<=0n)throw Error("Division by zero (floor)");return T*A/Q},VI=(T,A,Q)=>{if(Q<=0n)throw Error("Division by zero (ceil)");let J=T*A,W=J/Q;return J%Q===0n?W:W+1n},h$=(T)=>{let A=BigInt(T.lpFeeBps),Q=BigInt(T.protocolFeeBps),J=BigInt(T.creatorFeeBps),W=A+Q,$=W+J;if($>=P8)throw Error("Total fee basis points must be less than 10_000");return{totalFeeBps:$,combinedFeeBps:W}},g$=(T)=>{let A=T.virtualTokenReserves+T.realTokenReserves,Q=T.virtualSolReserves+T.realSolReserves;return A*Q};function OP(T,A,Q){if(Q<=0n)throw Error("Total SOL cost must be positive");let{combinedFeeBps:J,totalFeeBps:W}=h$(A),$=iA(Q,J,P8),G=iA(Q,BigInt(A.creatorFeeBps),P8),Y=Q-$-G;if(Y<=0n)throw Error("Net SOL after fees must be positive");let Z=g$(T),C=T.virtualSolReserves+T.realSolReserves,K=T.virtualTokenReserves+T.realTokenReserves,V=C+Y,M=Z/V,z=K-M,N=z>T.realTokenReserves?T.realTokenReserves:z;if(N<=0n)throw Error("SOL amount is too small to purchase any tokens");let w=gQ(T,A,N);while(w.totalSolCostLamports>Q&&N>0n)N-=1n,w=gQ(T,A,N);if(w.totalSolCostLamports>Q)throw Error("Insufficient SOL to purchase any tokens with fees applied");return{tokenAmount:N,totalSolCostLamports:w.totalSolCostLamports,effectiveSolInLamports:w.effectiveSolInLamports,feeLamports:w.feeLamports,creatorFeeLamports:w.creatorFeeLamports}}function gQ(T,A,Q){if(Q<=0n)throw Error("Token amount must be positive");if(Q>T.realTokenReserves)throw Error("Token amount exceeds available reserves");let{combinedFeeBps:J,totalFeeBps:W}=h$(A),$=g$(T),G=T.virtualSolReserves+T.realSolReserves,Z=T.virtualTokenReserves+T.realTokenReserves-Q;if(Z<=0n)throw Error("Purchase would exhaust token reserves");let K=$/Z-G;if(K<=0n)throw Error("Resolved SOL input must be positive");let V=P8-W,M=VI(K,P8,V),z=iA(M,J,P8),N=iA(M,BigInt(A.creatorFeeBps),P8);return{tokenAmount:Q,totalSolCostLamports:M,effectiveSolInLamports:K,feeLamports:z,creatorFeeLamports:N}}function BP(T,A,Q){if(Q<=0n)throw Error("Token amount must be positive");let J=g$(T),W=T.virtualSolReserves+T.realSolReserves,G=T.virtualTokenReserves+T.realTokenReserves+Q,Y=J/G,Z=W-Y;if(Z<=0n)throw Error("No SOL output available for the given token amount");let{combinedFeeBps:C}=h$(A),K=iA(Z,C,P8),V=iA(Z,BigInt(A.creatorFeeBps),P8),M=Z-K-V;if(M<=0n)throw Error("SOL output after fees is non-positive");return{solOutputLamports:M,preFeeSolOutputLamports:Z,feeLamports:K,creatorFeeLamports:V}}var _P=_T,jI=1e4,xP=(T,A)=>{if(!Number.isFinite(T)||T<=0)throw Error(`${A} must be a positive number`)},RI=(T)=>({lpFeeBps:T.lpFeeBps,protocolFeeBps:T.protocolFeeBps,creatorFeeBps:T.creatorFeeBps});async function hP(T,A,Q,J){let W=J?.curve?Promise.resolve(J.curve):(async()=>{let G=await BT(T);return(await k8(A,G,{commitment:Q})).data})(),$=J?.fees?Promise.resolve(J.fees):(async()=>{let G=await X2(),Y=await EP(A,G,{commitment:Q});return RI(Y.data.flatFees)})();try{let[G,Y]=await Promise.all([W,$]);return{curve:G,fees:Y}}catch(G){throw Error("Failed to load bonding curve state. Provide overrides or ensure the RPC endpoint can access Pump accounts.",{cause:G})}}function DI(T){if(!Number.isFinite(T)||T<=0||T>100)throw Error("walletPercentage must be between 0 and 100");return BigInt(Math.round(T*100))}async function mQ(T){xP(T.solAmount,"solAmount");let A=T.slippageBps??JT;WT(A);let Q=T.feeRecipient??_P,J=T.rpc,W=T.commitment??M1(),{curve:$,fees:G}=await hP(T.mint,J,W,{curve:T.curveStateOverride,fees:T.feeStructureOverride});if($.complete)throw Error("Token has migrated to the AMM. Use ammBuy instead of curveBuy.");let Y=T.bondingCurveCreator?_(T.bondingCurveCreator):$.creator,Z=xT(T.solAmount),K=OP($,G,Z).tokenAmount,V=gQ($,G,K),z=iT(V.totalSolCostLamports,A)*2n,N=_(T.mint),[w]=await H1({owner:T.user.address,mint:N}),L;if(T.allowAtaCreation!==!1)try{if(!(await T.rpc.getAccountInfo(w,{encoding:"base64"}).send()).value)L=nA({payer:T.user,owner:T.user,mint:N})}catch(g){console.warn("[curveBuy] getAccountInfo failed for user ATA, defaulting to create",g),L=nA({payer:T.user,owner:T.user,mint:N})}let O=await BJ({user:T.user,mint:T.mint,tokenAmount:K,maxSolCostLamports:z,feeRecipient:Q,trackVolume:T.trackVolume,bondingCurveCreator:Y,rpc:J,commitment:W});if(L){let g=Object.assign({},O);return g.prepend=[L,...g.prepend??[]],g}return O}async function vQ(T){let A=T.slippageBps??JT;WT(A);let Q=T.feeRecipient??_P,J=T.rpc,W=T.commitment??M1(),{curve:$,fees:G}=await hP(T.mint,J,W,{curve:T.curveStateOverride,fees:T.feeStructureOverride});if($.complete)throw Error("Token has migrated to the AMM. Use ammSell instead of curveSell.");let Y=T.bondingCurveCreator?_(T.bondingCurveCreator):$.creator,Z=T.useWalletPercentage??!1,C=_(T.mint),K;if(Z){let z=T.walletPercentage??100,N=DI(z),[w]=await H1({owner:_(T.user.address),mint:C,tokenProgram:_(j0)}),L=await J.getTokenAccountBalance(w).send(),O=BigInt(L.value.amount);if(O===0n)throw Error("Wallet token balance is zero; nothing to sell");if(K=O*N/BigInt(jI),K<=0n)K=1n}else{if(T.tokenAmount===void 0)throw Error("tokenAmount is required when useWalletPercentage is false");xP(T.tokenAmount,"tokenAmount");let z=T.tokenDecimals??6;K=i8(T.tokenAmount,z)}let V=BP($,G,K),M=n8(V.solOutputLamports,A);if(M<=0n)throw Error("Slippage settings would result in zero SOL output");return _J({user:T.user,mint:T.mint,tokenAmountRaw:K,minSolOutputLamports:M,feeRecipient:Q,bondingCurveCreator:Y,rpc:J,commitment:W})}var b8=new TextEncoder,HA=C0();async function oA(T,A,Q,J){let W=new Uint8Array(2);W[0]=T&255,W[1]=T>>8&255;let[$]=await R1({programAddress:_(q0),seeds:[b8.encode("pool"),W,HA.encode(_(A)),HA.encode(_(Q)),HA.encode(_(J))]});return $}async function m$(T){let[A]=await R1({programAddress:_(q0),seeds:[b8.encode("pool_lp_mint"),HA.encode(_(T))]});return A}async function v$(T,A){let[Q]=await nY({owner:T,mint:A});return Q}async function jT(T,A,Q){let[J]=await H1({owner:T,mint:A,tokenProgram:Q});return J}async function aA(){let[T]=await R1({programAddress:_(q0),seeds:[b8.encode("global_config")]});return T}async function gP(){let[T]=await R1({programAddress:_(q0),seeds:[b8.encode("global_volume_accumulator")]});return T}async function mP(T){let[A]=await R1({programAddress:_(q0),seeds:[b8.encode("user_volume_accumulator"),HA.encode(_(T))]});return A}async function f2(){let[T]=await R1({programAddress:_(q0),seeds:[b8.encode("__event_authority")]});return T}async function y$(){let[T]=await R1({programAddress:_(OT),seeds:[b8.encode("fee_config"),HA.encode(_(q0))]});return T}async function b$(T){let[A]=await R1({programAddress:_(q0),seeds:[b8.encode("creator_vault"),HA.encode(_(T))]});return A}async function p$(T,A,Q){let[J]=await H1({owner:T,mint:A,tokenProgram:Q});return J}var AT="";function MI(T){if(!T)throw Error("Expected a Address.");if(typeof T==="object"&&"address"in T)return T.address;if(Array.isArray(T))return T[0];return T}function QT(T,A){return(Q)=>{if(!Q.value){if(A==="omitted")return;return Object.freeze({address:T,role:W1.READONLY})}let J=Q.isWritable?W1.WRITABLE:W1.READONLY;return Object.freeze({address:MI(Q.value),role:vP(Q.value)?k6(J):J,...vP(Q.value)?{signer:Q.value}:{}})}}function vP(T){return!!T&&typeof T==="object"&&"address"in T&&ET(T)}var kI=new Uint8Array([102,6,61,18,1,218,235,234]);function zI(){return Z0(X0([["discriminator",H0(M0(),8)],["baseAmountOut",D1()],["maxQuoteAmountIn",D1()]]),(T)=>({...T,discriminator:kI}))}function yP(T,A){let Q=A?.programAddress??AT,W={pool:{value:T.pool??null,isWritable:!1},user:{value:T.user??null,isWritable:!1},globalConfig:{value:T.globalConfig??null,isWritable:!1},baseMint:{value:T.baseMint??null,isWritable:!1},quoteMint:{value:T.quoteMint??null,isWritable:!1},userBaseTokenAccount:{value:T.userBaseTokenAccount??null,isWritable:!1},userQuoteTokenAccount:{value:T.userQuoteTokenAccount??null,isWritable:!1},poolBaseTokenAccount:{value:T.poolBaseTokenAccount??null,isWritable:!1},poolQuoteTokenAccount:{value:T.poolQuoteTokenAccount??null,isWritable:!1},protocolFeeRecipient:{value:T.protocolFeeRecipient??null,isWritable:!1},protocolFeeRecipientTokenAccount:{value:T.protocolFeeRecipientTokenAccount??null,isWritable:!1},baseTokenProgram:{value:T.baseTokenProgram??null,isWritable:!1},quoteTokenProgram:{value:T.quoteTokenProgram??null,isWritable:!1},systemProgram:{value:T.systemProgram??null,isWritable:!1},associatedTokenProgram:{value:T.associatedTokenProgram??null,isWritable:!1},eventAuthority:{value:T.eventAuthority??null,isWritable:!1},program:{value:T.program??null,isWritable:!1}},$={...T};if(!W.systemProgram.value)W.systemProgram.value="11111111111111111111111111111111";let G=QT(Q,"programId");return Object.freeze({accounts:[G(W.pool),G(W.user),G(W.globalConfig),G(W.baseMint),G(W.quoteMint),G(W.userBaseTokenAccount),G(W.userQuoteTokenAccount),G(W.poolBaseTokenAccount),G(W.poolQuoteTokenAccount),G(W.protocolFeeRecipient),G(W.protocolFeeRecipientTokenAccount),G(W.baseTokenProgram),G(W.quoteTokenProgram),G(W.systemProgram),G(W.associatedTokenProgram),G(W.eventAuthority),G(W.program)],data:zI().encode($),programAddress:Q})}var _m=new Uint8Array([201,207,243,114,75,111,47,189]);var mm=new Uint8Array([233,146,209,142,207,104,64,188]);var FI=new Uint8Array([242,35,198,137,82,225,242,182]);function NI(){return Z0(X0([["discriminator",H0(M0(),8)],["lpTokenAmountOut",D1()],["maxBaseAmountIn",D1()],["maxQuoteAmountIn",D1()]]),(T)=>({...T,discriminator:FI}))}function bP(T,A){let Q=A?.programAddress??AT,W={pool:{value:T.pool??null,isWritable:!1},globalConfig:{value:T.globalConfig??null,isWritable:!1},user:{value:T.user??null,isWritable:!1},baseMint:{value:T.baseMint??null,isWritable:!1},quoteMint:{value:T.quoteMint??null,isWritable:!1},lpMint:{value:T.lpMint??null,isWritable:!1},userBaseTokenAccount:{value:T.userBaseTokenAccount??null,isWritable:!1},userQuoteTokenAccount:{value:T.userQuoteTokenAccount??null,isWritable:!1},userPoolTokenAccount:{value:T.userPoolTokenAccount??null,isWritable:!1},poolBaseTokenAccount:{value:T.poolBaseTokenAccount??null,isWritable:!1},poolQuoteTokenAccount:{value:T.poolQuoteTokenAccount??null,isWritable:!1},tokenProgram:{value:T.tokenProgram??null,isWritable:!1},token2022Program:{value:T.token2022Program??null,isWritable:!1},eventAuthority:{value:T.eventAuthority??null,isWritable:!1},program:{value:T.program??null,isWritable:!1}},$={...T};if(!W.tokenProgram.value)W.tokenProgram.value="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";let G=QT(Q,"programId");return Object.freeze({accounts:[G(W.pool),G(W.globalConfig),G(W.user),G(W.baseMint),G(W.quoteMint),G(W.lpMint),G(W.userBaseTokenAccount),G(W.userQuoteTokenAccount),G(W.userPoolTokenAccount),G(W.poolBaseTokenAccount),G(W.poolQuoteTokenAccount),G(W.tokenProgram),G(W.token2022Program),G(W.eventAuthority),G(W.program)],data:NI().encode($),programAddress:Q})}var cm=new Uint8Array([185,173,187,90,216,15,238,233]);var im=new Uint8Array([234,102,194,203,150,72,62,229]);var II=new Uint8Array([51,230,133,164,1,127,131,173]);function SI(){return Z0(X0([["discriminator",H0(M0(),8)],["baseAmountIn",D1()],["minQuoteAmountOut",D1()]]),(T)=>({...T,discriminator:II}))}function pP(T,A){let Q=A?.programAddress??AT,W={pool:{value:T.pool??null,isWritable:!1},user:{value:T.user??null,isWritable:!1},globalConfig:{value:T.globalConfig??null,isWritable:!1},baseMint:{value:T.baseMint??null,isWritable:!1},quoteMint:{value:T.quoteMint??null,isWritable:!1},userBaseTokenAccount:{value:T.userBaseTokenAccount??null,isWritable:!1},userQuoteTokenAccount:{value:T.userQuoteTokenAccount??null,isWritable:!1},poolBaseTokenAccount:{value:T.poolBaseTokenAccount??null,isWritable:!1},poolQuoteTokenAccount:{value:T.poolQuoteTokenAccount??null,isWritable:!1},protocolFeeRecipient:{value:T.protocolFeeRecipient??null,isWritable:!1},protocolFeeRecipientTokenAccount:{value:T.protocolFeeRecipientTokenAccount??null,isWritable:!1},baseTokenProgram:{value:T.baseTokenProgram??null,isWritable:!1},quoteTokenProgram:{value:T.quoteTokenProgram??null,isWritable:!1},systemProgram:{value:T.systemProgram??null,isWritable:!1},associatedTokenProgram:{value:T.associatedTokenProgram??null,isWritable:!1},eventAuthority:{value:T.eventAuthority??null,isWritable:!1},program:{value:T.program??null,isWritable:!1}},$={...T};if(!W.systemProgram.value)W.systemProgram.value="11111111111111111111111111111111";let G=QT(Q,"programId");return Object.freeze({accounts:[G(W.pool),G(W.user),G(W.globalConfig),G(W.baseMint),G(W.quoteMint),G(W.userBaseTokenAccount),G(W.userQuoteTokenAccount),G(W.poolBaseTokenAccount),G(W.poolQuoteTokenAccount),G(W.protocolFeeRecipient),G(W.protocolFeeRecipientTokenAccount),G(W.baseTokenProgram),G(W.quoteTokenProgram),G(W.systemProgram),G(W.associatedTokenProgram),G(W.eventAuthority),G(W.program)],data:SI().encode($),programAddress:Q})}var Qv=new Uint8Array([161,176,40,213,60,184,179,228]);var Gv=new Uint8Array([104,184,103,242,88,151,107,20]);var LI=new Uint8Array([183,18,70,156,148,109,161,34]);function wI(){return Z0(X0([["discriminator",H0(M0(),8)],["lpTokenAmountIn",D1()],["minBaseAmountOut",D1()],["minQuoteAmountOut",D1()]]),(T)=>({...T,discriminator:LI}))}function lP(T,A){let Q=A?.programAddress??AT,W={pool:{value:T.pool??null,isWritable:!1},globalConfig:{value:T.globalConfig??null,isWritable:!1},user:{value:T.user??null,isWritable:!1},baseMint:{value:T.baseMint??null,isWritable:!1},quoteMint:{value:T.quoteMint??null,isWritable:!1},lpMint:{value:T.lpMint??null,isWritable:!1},userBaseTokenAccount:{value:T.userBaseTokenAccount??null,isWritable:!1},userQuoteTokenAccount:{value:T.userQuoteTokenAccount??null,isWritable:!1},userPoolTokenAccount:{value:T.userPoolTokenAccount??null,isWritable:!1},poolBaseTokenAccount:{value:T.poolBaseTokenAccount??null,isWritable:!1},poolQuoteTokenAccount:{value:T.poolQuoteTokenAccount??null,isWritable:!1},tokenProgram:{value:T.tokenProgram??null,isWritable:!1},token2022Program:{value:T.token2022Program??null,isWritable:!1},eventAuthority:{value:T.eventAuthority??null,isWritable:!1},program:{value:T.program??null,isWritable:!1}},$={...T};if(!W.tokenProgram.value)W.tokenProgram.value="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";let G=QT(Q,"programId");return Object.freeze({accounts:[G(W.pool),G(W.globalConfig),G(W.user),G(W.baseMint),G(W.quoteMint),G(W.lpMint),G(W.userBaseTokenAccount),G(W.userQuoteTokenAccount),G(W.userPoolTokenAccount),G(W.poolBaseTokenAccount),G(W.poolQuoteTokenAccount),G(W.tokenProgram),G(W.token2022Program),G(W.eventAuthority),G(W.program)],data:wI().encode($),programAddress:Q})}var Iv=new Uint8Array([241,154,109,4,17,177,109,188]);function EI(){return V0([["discriminator",E0(b0(),8)],["poolBump",D8()],["index",lU()],["creator",Y0()],["baseMint",Y0()],["quoteMint",Y0()],["lpMint",Y0()],["poolBaseTokenAccount",Y0()],["poolQuoteTokenAccount",Y0()],["lpSupply",L1()]])}function OI(T){return H8(T,EI())}async function yQ(T,A,Q){let J=await BI(T,A,Q);return j8(J),J}async function BI(T,A,Q){let J=await V8(T,A,Q);return OI(J)}var wv=new Uint8Array([149,8,156,202,160,252,176,217]);function _I(){return V0([["discriminator",E0(b0(),8)],["admin",Y0()],["lpFeeBasisPoints",L1()],["protocolFeeBasisPoints",L1()],["disableFlags",D8()],["protocolFeeRecipients",D6(Y0(),{size:8})]])}function xI(T){return H8(T,_I())}async function bQ(T,A,Q){let J=await hI(T,A,Q);return j8(J),J}async function hI(T,A,Q){let J=await V8(T,A,Q);return xI(J)}var l$=0;async function uP(T){let{user:A,baseMint:Q,quoteMint:J,index:W=l$,poolAddress:$,poolCreator:G,maxBaseIn:Y,maxQuoteIn:Z,minLpOut:C=0n,tokenProgram:K=j0,token2022Program:V=Y2}=T;if(Y<=0n)throw Error("maxBaseIn must be positive");if(Z<=0n)throw Error("maxQuoteIn must be positive");if(C<0n)throw Error("minLpOut cannot be negative");let M=_(A.address),z=_(Q),N=_(J),w=_(K),L=_(V),O=$?_($):await oA(W,_(G??M),z,N),g=await aA(),v=await m$(O),p=await v$(M,v),[d]=await H1({owner:M,tokenProgram:w,mint:z}),[c]=await H1({owner:M,tokenProgram:w,mint:N}),r=await jT(O,z,w),u=await jT(O,N,w),h=await f2();return bP({pool:O,globalConfig:g,user:A,baseMint:z,quoteMint:N,lpMint:v,userBaseTokenAccount:d,userQuoteTokenAccount:c,userPoolTokenAccount:p,poolBaseTokenAccount:r,poolQuoteTokenAccount:u,tokenProgram:w,token2022Program:L,eventAuthority:h,program:_(q0),lpTokenAmountOut:C,maxBaseAmountIn:Y,maxQuoteAmountIn:Z},{programAddress:_(q0)})}async function dP(T){let{user:A,baseMint:Q,quoteMint:J,index:W=l$,poolAddress:$,poolCreator:G,lpAmountIn:Y,minBaseOut:Z=0n,minQuoteOut:C=0n,tokenProgram:K=j0,token2022Program:V=Y2}=T;if(Y<=0n)throw Error("lpAmountIn must be positive");if(Z<0n)throw Error("minBaseOut cannot be negative");if(C<0n)throw Error("minQuoteOut cannot be negative");let M=_(A.address),z=_(Q),N=_(J),w=_(K),L=_(V),O=$?_($):await oA(W,_(G??M),z,N),g=await aA(),v=await m$(O),p=await v$(M,v),[d]=await H1({owner:M,tokenProgram:w,mint:z}),[c]=await H1({owner:M,tokenProgram:w,mint:N}),r=await jT(O,z,w),u=await jT(O,N,w),h=await f2();return lP({pool:O,globalConfig:g,user:A,baseMint:z,quoteMint:N,lpMint:v,userBaseTokenAccount:d,userQuoteTokenAccount:c,userPoolTokenAccount:p,poolBaseTokenAccount:r,poolQuoteTokenAccount:u,tokenProgram:w,token2022Program:L,eventAuthority:h,program:_(q0),lpTokenAmountIn:Y,minBaseAmountOut:Z,minQuoteAmountOut:C},{programAddress:_(q0)})}async function cP(T){let{user:A,baseMint:Q,quoteMint:J,tokenAmountOut:W,maxQuoteIn:$,rpc:G,allowTrackVolume:Y=!0,commitment:Z}=T;if(W<=0n)throw Error("tokenAmountOut must be positive");if($<=0n)throw Error("maxQuoteIn must be positive");let C=Z??M1(),K=_(A.address),V=_(Q),M=_(J),z=_(j0),N=await rP(T,K),{poolData:w,globalConfigData:L,globalConfigAddress:O,coinCreator:g}=await nP(G,N,C),v=iP(L.protocolFeeRecipients);if(!v)throw Error("Global config does not define a protocol fee recipient");let[p]=await H1({owner:K,tokenProgram:z,mint:V}),[d]=await H1({owner:K,tokenProgram:z,mint:M}),c=await jT(N,V,z),r=await jT(N,M,z),[u]=await H1({owner:v,tokenProgram:z,mint:M}),h=await f2(),o=g?_(g):w.creator,i=await b$(o),x=await p$(i,M,z),[R,U]=Y?await Promise.all([gP(),mP(K)]):[void 0,void 0],X=await y$(),q=yP({pool:N,user:A,globalConfig:O,baseMint:V,quoteMint:M,userBaseTokenAccount:p,userQuoteTokenAccount:d,poolBaseTokenAccount:c,poolQuoteTokenAccount:r,protocolFeeRecipient:v,protocolFeeRecipientTokenAccount:u,baseTokenProgram:z,quoteTokenProgram:z,systemProgram:_(f8),associatedTokenProgram:_(Z2),eventAuthority:h,program:_(q0),baseAmountOut:W,maxQuoteAmountIn:$},{programAddress:_(q0)}),H=new Set([N,p,d,c,r,u].map((I)=>_(I))),j=q.accounts.map((I)=>H.has(_(I.address))?{...I,role:W1.WRITABLE}:I),F=[{address:x,role:W1.WRITABLE},{address:i,role:W1.READONLY},...Y&&R&&U?[{address:R,role:W1.WRITABLE},{address:U,role:W1.WRITABLE}]:[],{address:X,role:W1.READONLY},{address:_(OT),role:W1.READONLY}];return{programAddress:q.programAddress,accounts:[...j,...F],data:q.data}}async function fP(T){let{user:A,baseMint:Q,quoteMint:J,tokenAmountIn:W,minQuoteOut:$,rpc:G,commitment:Y}=T;if(W<=0n)throw Error("tokenAmountIn must be positive");if($<=0n)throw Error("minQuoteOut must be positive");let Z=Y??M1(),C=_(A.address),K=_(Q),V=_(J),M=_(j0),z=await rP(T,C),{poolData:N,globalConfigData:w,globalConfigAddress:L,coinCreator:O}=await nP(G,z,Z),g=iP(w.protocolFeeRecipients);if(!g)throw Error("Global config does not define a protocol fee recipient");let[v]=await H1({owner:C,tokenProgram:M,mint:K}),[p]=await H1({owner:C,tokenProgram:M,mint:V}),d=await jT(z,K,M),c=await jT(z,V,M),[r]=await H1({owner:g,tokenProgram:M,mint:V}),u=await f2(),h=O?_(O):N.creator,o=await b$(h),i=await p$(o,V,M),x=await y$(),R=pP({pool:z,user:A,globalConfig:L,baseMint:K,quoteMint:V,userBaseTokenAccount:v,userQuoteTokenAccount:p,poolBaseTokenAccount:d,poolQuoteTokenAccount:c,protocolFeeRecipient:g,protocolFeeRecipientTokenAccount:r,baseTokenProgram:M,quoteTokenProgram:M,systemProgram:_(f8),associatedTokenProgram:_(Z2),eventAuthority:u,program:_(q0),baseAmountIn:W,minQuoteAmountOut:$},{programAddress:_(q0)}),U=new Set([z,v,p,d,c,r].map((H)=>_(H))),X=R.accounts.map((H)=>U.has(_(H.address))?{...H,role:W1.WRITABLE}:H),q=[{address:i,role:W1.WRITABLE},{address:o,role:W1.READONLY},{address:x,role:W1.READONLY},{address:_(OT),role:W1.READONLY}];return{programAddress:R.programAddress,accounts:[...X,...q],data:R.data}}async function rP(T,A){if(T.poolAddress)return _(T.poolAddress);let Q=T.index??l$,J=_(T.poolCreator??A);return await oA(Q,J,_(T.baseMint),_(T.quoteMint))}async function nP(T,A,Q){let J=await aA(),[W,$]=await Promise.all([yQ(T,A,{commitment:Q}),bQ(T,J,{commitment:Q})]),G;try{let Y=await BT(W.data.baseMint);G=(await k8(T,Y,{commitment:Q})).data.creator}catch{G=void 0}return{poolData:W.data,globalConfigData:$.data,globalConfigAddress:J,coinCreator:G}}function iP(T){let A=T.filter(Boolean);return A.length>0?_(A[0]):null}function gI(T){let{owner:A,amount:Q,payer:J=A,associatedTokenAddress:W,createAta:$=!0,autoClose:G=!1}=T;if(Q<=0n)throw Error("Amount must be positive when wrapping SOL");let Y=u$(A),Z=u$(J),C=W?new a(W):c2(new a(uT),Y,!1,TT,lT),K=[],V=[];if($)K.push(r2(_Q(Z,C,Y,new a(uT))));if(K.push(r2(K0.transfer({fromPubkey:Z,toPubkey:C,lamports:Number(Q)}))),K.push(r2(LP(C))),G)V.push(r2(x$(C,Z,Y)));return{prepend:K,append:V,associatedTokenAddress:_(C.toBase58())}}function mI(T,A){let Q=u$(T),J=A?new a(A):c2(new a(uT),Q,!1,TT,lT);return[r2(x$(J,Q,Q))]}function u$(T){if(typeof T==="string")return new a(T);if(typeof T==="object"&&"address"in T)return new a(T.address);return new a(T)}function r2(T){return{programAddress:_(T.programId.toBase58()),accounts:T.keys.map((A)=>({address:_(A.pubkey.toBase58()),role:A.isSigner?A.isWritable?W1.WRITABLE_SIGNER:W1.READONLY_SIGNER:A.isWritable?W1.WRITABLE:W1.READONLY})),data:T.data}}var uT="So11111111111111111111111111111111111111112";var pQ=_(j0),lQ=10000n,vI=10000n,sP=(T,A)=>{if(!Number.isFinite(T)||T<=0)throw Error(`${A} must be a positive number`)},tP=(T)=>_(T??uT);async function eP(T){sP(T.solAmount,"solAmount");let A=T.slippageBps??JT;WT(A);let Q=T.commitment??M1(),J=tP(T.quoteMint),W=_(T.mint),$=xT(T.solAmount),G=await Aq({rpc:T.rpc,mint:W,quoteMint:J,commitment:Q,poolAddress:T.poolAddress,poolCreator:T.poolCreator,poolIndex:T.poolIndex}),Y=Jq(G.globalConfigData),Z=Wq($,Y);if(Z<=0n)throw Error("Effective quote input after fees is zero");let C=dI(Z,G.baseReserve,G.quoteReserve);if(C<=0n)throw Error("SOL amount is too small to purchase any tokens from the AMM");if(C>=G.baseReserve)C=G.baseReserve-1n;if(C<=0n)throw Error("AMM pool does not have enough base liquidity for this trade");let K=aP(C,G.quoteReserve,G.baseReserve,Y);while(K>$&&C>0n)C-=1n,K=aP(C,G.quoteReserve,G.baseReserve,Y);if(C<=0n||K<=0n)throw Error("Unable to satisfy AMM buy with the provided SOL budget");let V=iT(K,A),{createInstruction:M}=await fI({rpc:T.rpc,owner:T.user,mint:W}),z=await cP({user:T.user,baseMint:W,quoteMint:J,tokenAmountOut:C,maxQuoteIn:V,poolAddress:G.poolAddress,poolCreator:G.poolCreator,index:Number(G.poolData.index),allowTrackVolume:T.allowTrackVolume,rpc:T.rpc,commitment:Q});if(M){let N=Object.assign({},z);return N.prepend=[M,...N.prepend??[]],N}return z}async function Tq(T){let A=T.slippageBps??JT;WT(A);let Q=T.commitment??M1(),J=tP(T.quoteMint),W=_(T.mint),$=await Aq({rpc:T.rpc,mint:W,quoteMint:J,commitment:Q,poolAddress:T.poolAddress,poolCreator:T.poolCreator,poolIndex:T.poolIndex}),G=await rI({params:T,rpc:T.rpc,mint:W});if(G<=0n)throw Error("Token amount must be positive");if(G>=$.baseReserve)throw Error("Token amount exceeds available AMM base liquidity");let Y=Jq($.globalConfigData),Z=Wq(G,Y);if(Z<=0n)throw Error("Effective base input after fees is zero");let C=cI(Z,$.baseReserve,$.quoteReserve);if(C<=0n)throw Error("AMM pool produced zero quote output");let K=n8(C,A);if(K<=0n)throw Error("Slippage settings would result in zero SOL output");return fP({user:T.user,baseMint:W,quoteMint:J,tokenAmountIn:G,minQuoteOut:K,poolAddress:$.poolAddress,poolCreator:$.poolCreator,index:Number($.poolData.index),allowTrackVolume:T.allowTrackVolume,rpc:T.rpc,commitment:Q})}var yI=8;async function Aq(T){let{poolAccount:A,globalConfigAccount:Q,poolAddress:J,poolCreator:W,coinCreator:$}=await pI(T),[G,Y]=await Promise.all([jT(J,T.mint,pQ),jT(J,T.quoteMint,pQ)]),Z=await uI(T.rpc,G,Y);return{poolAddress:J,poolCreator:W,coinCreator:$,poolData:A.data,globalConfigData:Q.data,baseReserve:Z.baseReserve,quoteReserve:Z.quoteReserve}}var Qq=43,bI=Qq+32,oP=(T)=>_(T);async function pI(T){let{rpc:A,mint:Q,quoteMint:J,commitment:W,poolAddress:$,poolCreator:G,poolIndex:Y}=T,Z=$?_($):void 0,C=G?_(G):void 0,K;try{let w=await BT(Q);K=(await k8(A,w,{commitment:W})).data.creator}catch{K=void 0}let V=await aA(),M=async(w)=>{try{return await yQ(A,w,{commitment:W})}catch(L){if(lI(L))return null;throw L}},z=null;if(Z)z=await M(Z);if(!z&&C){let w=Y!==void 0?[Y]:Array.from({length:yI},(L,O)=>O);for(let L of w){let O=await oA(L,C,Q,J),g=await M(O);if(g){Z=O,z=g;break}}}if(!z){let w=[{memcmp:{offset:BigInt(Qq),bytes:oP(Q),encoding:"base58"}},{memcmp:{offset:BigInt(bI),bytes:oP(J),encoding:"base58"}}],O=await A.getProgramAccounts(_(q0),{commitment:W,encoding:"base64",filters:w}).send()??[];for(let g of O){let v=_(g.pubkey),p=await M(v);if(!p)continue;Z=v,C=p.data.creator,z=p;break}}if(!z||!Z)throw Error(`Unable to locate AMM pool for mint ${Q}. Provide poolAddress or poolIndex explicitly.`);let N=await bQ(A,V,{commitment:W});if(!C)C=z.data.creator;if(!K)K=z.data.creator;return{poolAccount:z,globalConfigAccount:N,poolAddress:Z,poolCreator:C,coinCreator:K}}function lI(T){if(!(T instanceof Error))return!1;if(T.message.toLowerCase().includes("account not found"))return!0;return T?.context?.__code===4100}async function uI(T,A,Q){let[J,W]=await Promise.all([T.getTokenAccountBalance(A).send(),T.getTokenAccountBalance(Q).send()]);return{baseReserve:BigInt(J.value.amount),quoteReserve:BigInt(W.value.amount)}}function Jq(T){return BigInt(T.lpFeeBasisPoints??0n)+BigInt(T.protocolFeeBasisPoints??0n)}function Wq(T,A){let Q=lQ-A;if(Q<=0n)return 0n;return T*Q/lQ}function dI(T,A,Q){let J=Q+T;if(J<=0n)throw Error("Invalid AMM reserves (denominator is zero)");return T*A/J}function aP(T,A,Q,J){if(T<=0n)return 0n;if(T>=Q)throw Error("Requested token amount exceeds pool reserves");let W=T*A/(Q-T);if(W<=0n)return 0n;let $=lQ-J;if($<=0n)throw Error("Invalid AMM fee configuration");return(W*lQ+($-1n))/$}function cI(T,A,Q){let J=A+T;if(J<=0n)throw Error("Invalid AMM reserves (denominator is zero)");return T*Q/J}async function fI({rpc:T,owner:A,mint:Q}){let[J]=await H1({owner:_(A.address),mint:Q,tokenProgram:pQ}),W;try{if(!(await T.getAccountInfo(J,{encoding:"base64"}).send()).value)W=nA({payer:A,owner:A,mint:Q})}catch{W=nA({payer:A,owner:A,mint:Q})}return{userAta:J,createInstruction:W}}async function rI({params:T,rpc:A,mint:Q}){let J=T.useWalletPercentage??!1,W=T.tokenDecimals??6;if(J){let $=T.walletPercentage??100,G=iI($),Y=await nI(A,T.user,Q);if(Y===0n)throw Error("Wallet token balance is zero; nothing to sell");let Z=Y*G/vI;if(Z<=0n)Z=1n;return Z}if(T.tokenAmount===void 0)throw Error("tokenAmount is required when useWalletPercentage is false");return sP(T.tokenAmount,"tokenAmount"),i8(T.tokenAmount,W)}async function nI(T,A,Q){let[J]=await H1({owner:_(A.address),mint:Q,tokenProgram:pQ}),W=await T.getTokenAccountBalance(J).send();return BigInt(W.value.amount)}function iI(T){if(!Number.isFinite(T)||T<=0||T>100)throw Error("walletPercentage must be between 0 and 100");return BigInt(Math.round(T*100))}var oI=mQ,aI=vQ;async function d$(T){let{user:A,mint:Q,mintAuthority:J,name:W,symbol:$,uri:G,firstBuyTokenAmount:Y,estimatedFirstBuyCost:Z,slippageBps:C=JT,feeRecipient:K=_T,bondingCurveCreator:V,trackVolume:M,rpc:z,commitment:N=M1()}=T;if(WT(C),!W||W.length===0)throw Error("Token name is required");if(!$||$.length===0)throw Error("Token symbol is required");if(!G||G.length===0)throw Error("Metadata URI is required");if(Y<=0n)throw Error("First buy token amount must be positive");if(Z<=0n)throw Error("Estimated first buy cost must be positive");let w=await AZ({user:A,mint:Q,mintAuthority:J,name:W,symbol:$,uri:G}),L=iT(Z,C),O=await P2({user:A,mint:Q.address,tokenAmount:Y,maxSolCostLamports:L,feeRecipient:K,trackVolume:M??!0,bondingCurveCreator:V??A.address,rpc:z,commitment:N});return{createInstruction:w,buyInstruction:O}}function sI(T){let{name:A,symbol:Q,uri:J}=T;if(!A||A.length===0)throw Error("Token name is required");if(A.length>32)throw Error("Token name too long (max 32 characters)");if(!Q||Q.length===0)throw Error("Token symbol is required");if(Q.length>10)throw Error("Token symbol too long (max 10 characters)");if(!J||J.length===0)throw Error("Metadata URI is required");if(!J.startsWith("http://")&&!J.startsWith("https://")&&!J.startsWith("ipfs://"))throw Error("Metadata URI must be a valid URL or IPFS link")}var $q=_("ComputeBudget111111111111111111111111111111");async function c$({instructions:T,payer:A,additionalSigners:Q=[],latestBlockhash:J,lastValidBlockHeight:W,version:$="legacy",rpc:G,commitment:Y=M1(),prependInstructions:Z=[],appendInstructions:C=[],priorityFees:K}){let V=typeof A==="string"?_(A):A.address,M=VY({version:$}),z=Gq(K),N=[],w=[];for(let u of T)if("prepend"in u&&Array.isArray(u.prepend)){N.push(...u.prepend);let{prepend:h,...o}=u;w.push(o)}else w.push(u);let L=[...z,...N,...Z??[],...w,...C??[]],O=new Map;for(let u of L)if(M=DY(u,M),u.accounts){for(let h of u.accounts)if("signer"in h&&h.signer&&typeof h.signer==="object"&&"address"in h.signer){let o=h.signer;O.set(o.address,o)}}let g=RY(V,M),v=[];if(eI(A))g=bY(A,g),v.push(A);for(let u of O.values())if(!v.some((h)=>h.address===u.address))v.push(u);if(Q.length>0){for(let u of Q)if(ET(u)&&!v.some((h)=>h.address===u.address))v.push(u)}let p=v.length>0?yY(v,g):g,d=J,c=W!==void 0?BigInt(W):void 0;if(!d||c===void 0){let{value:u}=await G.getLatestBlockhash({commitment:Y}).send();if(d=d??u.blockhash,c===void 0)c=BigInt(u.lastValidBlockHeight)}return{transactionMessage:qY({blockhash:d,lastValidBlockHeight:c},p),latestBlockhash:d,lastValidBlockHeight:c}}async function f$({instructions:T,payer:A,additionalSigners:Q=[],latestBlockhash:J,lastValidBlockHeight:W,version:$,prependInstructions:G,appendInstructions:Y,priorityFees:Z,rpc:C,rpcSubscriptions:K,commitment:V=M1(),sendOptions:M={}}){let z=await c$({instructions:T,payer:A,additionalSigners:Q,latestBlockhash:J,lastValidBlockHeight:W,version:$,prependInstructions:G,appendInstructions:Y,priorityFees:Z,rpc:C,commitment:V}),N=await FJ(z.transactionMessage),w=S6(N),L=cY({rpc:C,rpcSubscriptions:K}),O={commitment:V};if(M.abortSignal)O.abortSignal=M.abortSignal;if(M.skipPreflight!==void 0)O.skipPreflight=M.skipPreflight;if(M.minContextSlot!==void 0)O.minContextSlot=BigInt(M.minContextSlot);if(M.maxRetries!==void 0)O.maxRetries=M.maxRetries;if(M.preflightCommitment)O.preflightCommitment=M.preflightCommitment;await L(N,O);let v=(await C.getSignatureStatuses([w],{searchTransactionHistory:!1}).send()).value?.[0]??null;if(v?.err)try{let d=await C.getTransaction(w,{commitment:V,encoding:"json",maxSupportedTransactionVersion:0}).send(),c="Transaction failed";if(v.err)c=`Transaction failed: ${typeof v.err==="object"?JSON.stringify(v.err,(u,h)=>typeof h==="bigint"?h.toString():h):String(v.err)}`;if(d?.meta?.err)c=`Transaction failed: ${typeof d.meta.err==="object"?JSON.stringify(d.meta.err,(u,h)=>typeof h==="bigint"?h.toString():h):String(d.meta.err)}`;if(d?.meta?.logMessages){let r=d.meta.logMessages.filter((u)=>u.toLowerCase().includes("error")||u.includes("Program log:"));if(r.length>0)c+=`
|
|
20
|
+
`+$+"\nCatch the `SendTransactionError` and call `getLogs()` on it for full details.";break;default:G=`Unknown action '${((Y)=>Y)(T)}'`}super(G);this.signature=void 0,this.transactionMessage=void 0,this.transactionLogs=void 0,this.signature=A,this.transactionMessage=Q,this.transactionLogs=J?J:void 0}get transactionError(){return{message:this.transactionMessage,logs:Array.isArray(this.transactionLogs)?this.transactionLogs:void 0}}get logs(){let T=this.transactionLogs;if(T!=null&&typeof T==="object"&&"then"in T)return;return T}async getLogs(T){if(!Array.isArray(this.transactionLogs))this.transactionLogs=new Promise((A,Q)=>{T.getTransaction(this.signature).then((J)=>{if(J&&J.meta&&J.meta.logMessages){let $=J.meta.logMessages;this.transactionLogs=$,A($)}else Q(Error("Log messages not found"))}).catch(Q)});return await this.transactionLogs}}async function rX(T,A,Q,J){let $=J&&{skipPreflight:J.skipPreflight,preflightCommitment:J.preflightCommitment||J.commitment,maxRetries:J.maxRetries,minContextSlot:J.minContextSlot},W=await T.sendTransaction(A,Q,$),G;if(A.recentBlockhash!=null&&A.lastValidBlockHeight!=null)G=(await T.confirmTransaction({abortSignal:J?.abortSignal,signature:W,blockhash:A.recentBlockhash,lastValidBlockHeight:A.lastValidBlockHeight},J&&J.commitment)).value;else if(A.minNonceContextSlot!=null&&A.nonceInfo!=null){let{nonceInstruction:Y}=A.nonceInfo,Z=Y.keys[0].pubkey;G=(await T.confirmTransaction({abortSignal:J?.abortSignal,minContextSlot:A.minNonceContextSlot,nonceAccountPubkey:Z,nonceValue:A.nonceInfo.nonce,signature:W},J&&J.commitment)).value}else{if(J?.abortSignal!=null)console.warn("sendAndConfirmTransaction(): A transaction with a deprecated confirmation strategy was supplied along with an `abortSignal`. Only transactions having `lastValidBlockHeight` or a combination of `nonceInfo` and `minNonceContextSlot` are abortable.");G=(await T.confirmTransaction(W,J&&J.commitment)).value}if(G.err){if(W!=null)throw new PP({action:"send",signature:W,transactionMessage:`Status: (${JSON.stringify(G)})`});throw Error(`Transaction ${W} failed (${JSON.stringify(G)})`)}return W}function VI(T){return new Promise((A)=>setTimeout(A,T))}function W1(T,A){let Q=T.layout.span>=0?T.layout.span:ZP(T,A),J=w.alloc(Q),$=Object.assign({instruction:T.index},A);return T.layout.encode($,J),J}var jI=S.nu64("lamportsPerSignature"),RI=S.struct([S.u32("version"),S.u32("state"),G1("authorizedPubkey"),G1("nonce"),S.struct([jI],"feeCalculator")]),nX=RI.span;function rA(T){let A=AP.blob(8,T),Q=A.decode.bind(A),J=A.encode.bind(A),$=A,W=s9();return $.decode=(G,Y)=>{let Z=Q(G,Y);return W.decode(Z)},$.encode=(G,Y,Z)=>{let C=W.encode(G);return J(C,Y,Z)},$}var jT=Object.freeze({Create:{index:0,layout:S.struct([S.u32("instruction"),S.ns64("lamports"),S.ns64("space"),G1("programId")])},Assign:{index:1,layout:S.struct([S.u32("instruction"),G1("programId")])},Transfer:{index:2,layout:S.struct([S.u32("instruction"),rA("lamports")])},CreateWithSeed:{index:3,layout:S.struct([S.u32("instruction"),G1("base"),fA("seed"),S.ns64("lamports"),S.ns64("space"),G1("programId")])},AdvanceNonceAccount:{index:4,layout:S.struct([S.u32("instruction")])},WithdrawNonceAccount:{index:5,layout:S.struct([S.u32("instruction"),S.ns64("lamports")])},InitializeNonceAccount:{index:6,layout:S.struct([S.u32("instruction"),G1("authorized")])},AuthorizeNonceAccount:{index:7,layout:S.struct([S.u32("instruction"),G1("authorized")])},Allocate:{index:8,layout:S.struct([S.u32("instruction"),S.ns64("space")])},AllocateWithSeed:{index:9,layout:S.struct([S.u32("instruction"),G1("base"),fA("seed"),S.ns64("space"),G1("programId")])},AssignWithSeed:{index:10,layout:S.struct([S.u32("instruction"),G1("base"),fA("seed"),G1("programId")])},TransferWithSeed:{index:11,layout:S.struct([S.u32("instruction"),rA("lamports"),fA("seed"),G1("programId")])},UpgradeNonceAccount:{index:12,layout:S.struct([S.u32("instruction")])}});class K0{constructor(){}static createAccount(T){let A=jT.Create,Q=W1(A,{lamports:T.lamports,space:T.space,programId:Y1(T.programId.toBuffer())});return new Z1({keys:[{pubkey:T.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:T.newAccountPubkey,isSigner:!0,isWritable:!0}],programId:this.programId,data:Q})}static transfer(T){let A,Q;if("basePubkey"in T){let J=jT.TransferWithSeed;A=W1(J,{lamports:BigInt(T.lamports),seed:T.seed,programId:Y1(T.programId.toBuffer())}),Q=[{pubkey:T.fromPubkey,isSigner:!1,isWritable:!0},{pubkey:T.basePubkey,isSigner:!0,isWritable:!1},{pubkey:T.toPubkey,isSigner:!1,isWritable:!0}]}else{let J=jT.Transfer;A=W1(J,{lamports:BigInt(T.lamports)}),Q=[{pubkey:T.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:T.toPubkey,isSigner:!1,isWritable:!0}]}return new Z1({keys:Q,programId:this.programId,data:A})}static assign(T){let A,Q;if("basePubkey"in T){let J=jT.AssignWithSeed;A=W1(J,{base:Y1(T.basePubkey.toBuffer()),seed:T.seed,programId:Y1(T.programId.toBuffer())}),Q=[{pubkey:T.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:T.basePubkey,isSigner:!0,isWritable:!1}]}else{let J=jT.Assign;A=W1(J,{programId:Y1(T.programId.toBuffer())}),Q=[{pubkey:T.accountPubkey,isSigner:!0,isWritable:!0}]}return new Z1({keys:Q,programId:this.programId,data:A})}static createAccountWithSeed(T){let A=jT.CreateWithSeed,Q=W1(A,{base:Y1(T.basePubkey.toBuffer()),seed:T.seed,lamports:T.lamports,space:T.space,programId:Y1(T.programId.toBuffer())}),J=[{pubkey:T.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:T.newAccountPubkey,isSigner:!1,isWritable:!0}];if(!T.basePubkey.equals(T.fromPubkey))J.push({pubkey:T.basePubkey,isSigner:!0,isWritable:!1});return new Z1({keys:J,programId:this.programId,data:Q})}static createNonceAccount(T){let A=new j1;if("basePubkey"in T&&"seed"in T)A.add(K0.createAccountWithSeed({fromPubkey:T.fromPubkey,newAccountPubkey:T.noncePubkey,basePubkey:T.basePubkey,seed:T.seed,lamports:T.lamports,space:nX,programId:this.programId}));else A.add(K0.createAccount({fromPubkey:T.fromPubkey,newAccountPubkey:T.noncePubkey,lamports:T.lamports,space:nX,programId:this.programId}));let Q={noncePubkey:T.noncePubkey,authorizedPubkey:T.authorizedPubkey};return A.add(this.nonceInitialize(Q)),A}static nonceInitialize(T){let A=jT.InitializeNonceAccount,Q=W1(A,{authorized:Y1(T.authorizedPubkey.toBuffer())}),J={keys:[{pubkey:T.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:RW,isSigner:!1,isWritable:!1},{pubkey:n2,isSigner:!1,isWritable:!1}],programId:this.programId,data:Q};return new Z1(J)}static nonceAdvance(T){let A=jT.AdvanceNonceAccount,Q=W1(A),J={keys:[{pubkey:T.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:RW,isSigner:!1,isWritable:!1},{pubkey:T.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:Q};return new Z1(J)}static nonceWithdraw(T){let A=jT.WithdrawNonceAccount,Q=W1(A,{lamports:T.lamports});return new Z1({keys:[{pubkey:T.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:T.toPubkey,isSigner:!1,isWritable:!0},{pubkey:RW,isSigner:!1,isWritable:!1},{pubkey:n2,isSigner:!1,isWritable:!1},{pubkey:T.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:Q})}static nonceAuthorize(T){let A=jT.AuthorizeNonceAccount,Q=W1(A,{authorized:Y1(T.newAuthorizedPubkey.toBuffer())});return new Z1({keys:[{pubkey:T.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:T.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:Q})}static allocate(T){let A,Q;if("basePubkey"in T){let J=jT.AllocateWithSeed;A=W1(J,{base:Y1(T.basePubkey.toBuffer()),seed:T.seed,space:T.space,programId:Y1(T.programId.toBuffer())}),Q=[{pubkey:T.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:T.basePubkey,isSigner:!0,isWritable:!1}]}else{let J=jT.Allocate;A=W1(J,{space:T.space}),Q=[{pubkey:T.accountPubkey,isSigner:!0,isWritable:!0}]}return new Z1({keys:Q,programId:this.programId,data:A})}}K0.programId=new a("11111111111111111111111111111111");var DI=IQ-300;class SQ{constructor(){}static getMinNumSignatures(T){return 2*(Math.ceil(T/SQ.chunkSize)+1+1)}static async load(T,A,Q,J,$){{let K=await T.getMinimumBalanceForRentExemption($.length),j=await T.getAccountInfo(Q.publicKey,"confirmed"),M=null;if(j!==null){if(j.executable)return console.error("Program load failed, account is already executable"),!1;if(j.data.length!==$.length)M=M||new j1,M.add(K0.allocate({accountPubkey:Q.publicKey,space:$.length}));if(!j.owner.equals(J))M=M||new j1,M.add(K0.assign({accountPubkey:Q.publicKey,programId:J}));if(j.lamports<K)M=M||new j1,M.add(K0.transfer({fromPubkey:A.publicKey,toPubkey:Q.publicKey,lamports:K-j.lamports}))}else M=new j1().add(K0.createAccount({fromPubkey:A.publicKey,newAccountPubkey:Q.publicKey,lamports:K>0?K:1,space:$.length,programId:J}));if(M!==null)await rX(T,M,[A,Q],{commitment:"confirmed"})}let W=S.struct([S.u32("instruction"),S.u32("offset"),S.u32("bytesLength"),S.u32("bytesLengthPadding"),S.seq(S.u8("byte"),S.offset(S.u32(),-8),"bytes")]),G=SQ.chunkSize,Y=0,Z=$,C=[];while(Z.length>0){let K=Z.slice(0,G),j=w.alloc(G+16);W.encode({instruction:0,offset:Y,bytes:K,bytesLength:0,bytesLengthPadding:0},j);let M=new j1().add({keys:[{pubkey:Q.publicKey,isSigner:!0,isWritable:!0}],programId:J,data:j});if(C.push(rX(T,M,[A,Q],{commitment:"confirmed"})),T._rpcEndpoint.includes("solana.com"))await VI(250);Y+=G,Z=Z.slice(G)}await Promise.all(C);{let K=S.struct([S.u32("instruction")]),j=w.alloc(K.span);K.encode({instruction:1},j);let M=new j1().add({keys:[{pubkey:Q.publicKey,isSigner:!0,isWritable:!0},{pubkey:n2,isSigner:!1,isWritable:!1}],programId:J,data:j}),z="processed",N=await T.sendTransaction(M,[A,Q],{preflightCommitment:z}),{context:E,value:L}=await T.confirmTransaction({signature:N,lastValidBlockHeight:M.lastValidBlockHeight,blockhash:M.recentBlockhash},z);if(L.err)throw Error(`Transaction ${N} failed (${JSON.stringify(L)})`);while(!0){try{if(await T.getSlot({commitment:z})>E.slot)break}catch{}await new Promise((O)=>setTimeout(O,Math.round(HI/2)))}}return!0}}SQ.chunkSize=DI;var nh=new a("BPFLoader2111111111111111111111111111111111");var ih=globalThis.fetch;var oh={index:1,layout:S.struct([S.u32("typeIndex"),rA("deactivationSlot"),S.nu64("lastExtendedSlot"),S.u8("lastExtendedStartIndex"),S.u8(),S.seq(G1(),S.offset(S.u8(),-1),"authority")])};var S1=uA(CQ(a),l(),(T)=>new a(T)),qP=HQ([l(),z1("base64")]),LW=uA(CQ(w),qP,(T)=>w.from(T[0],"base64"));function KP(T){return _0([y({jsonrpc:z1("2.0"),id:l(),result:T}),y({jsonrpc:z1("2.0"),id:l(),error:y({code:XA(),message:l(),data:A1(QX())})})])}var MI=KP(XA());function V1(T){return uA(KP(T),MI,(A)=>{if("error"in A)return A;else return{...A,result:lA(A.result,T)}})}function FT(T){return V1(y({context:y({slot:B()}),value:T}))}function wQ(T){return y({context:y({slot:B()}),value:T})}var kI=y({foundation:B(),foundationTerm:B(),initial:B(),taper:B(),terminal:B()}),ah=V1(s(t(y({epoch:B(),effectiveSlot:B(),amount:B(),postBalance:B(),commission:A1(t(B()))})))),zI=s(y({slot:B(),prioritizationFee:B()})),FI=y({total:B(),validator:B(),foundation:B(),epoch:B()}),NI=y({epoch:B(),slotIndex:B(),slotsInEpoch:B(),absoluteSlot:B(),blockHeight:A1(B()),transactionCount:A1(B())}),II=y({slotsPerEpoch:B(),leaderScheduleSlotOffset:B(),warmup:zT(),firstNormalEpoch:B(),firstNormalSlot:B()}),SI=e$(l(),s(B())),PA=t(_0([y({}),l()])),LI=y({err:PA}),wI=z1("receivedSignature"),sh=y({"solana-core":l(),"feature-set":A1(B())}),EI=y({program:l(),programId:S1,parsed:XA()}),OI=y({programId:S1,accounts:s(S1),data:l()}),th=FT(y({err:t(_0([y({}),l()])),logs:t(s(l())),accounts:A1(t(s(t(y({executable:zT(),owner:l(),lamports:B(),data:s(l()),rentEpoch:A1(B())}))))),unitsConsumed:A1(B()),returnData:A1(t(y({programId:l(),data:HQ([l(),z1("base64")])}))),innerInstructions:A1(t(s(y({index:B(),instructions:s(_0([EI,OI]))}))))})),eh=FT(y({byIdentity:e$(l(),s(B())),range:y({firstSlot:B(),lastSlot:B()})}));var Tg=V1(kI),Ag=V1(FI),Qg=V1(zI),Jg=V1(NI),$g=V1(II),Wg=V1(SI),Gg=V1(B()),Ug=FT(y({total:B(),circulating:B(),nonCirculating:B(),nonCirculatingAccounts:s(S1)})),BI=y({amount:l(),uiAmount:t(B()),decimals:B(),uiAmountString:A1(l())}),Yg=FT(s(y({address:S1,amount:l(),uiAmount:t(B()),decimals:B(),uiAmountString:A1(l())}))),Zg=FT(s(y({pubkey:S1,account:y({executable:zT(),owner:S1,lamports:B(),data:LW,rentEpoch:B()})}))),IW=y({program:l(),parsed:XA(),space:B()}),Xg=FT(s(y({pubkey:S1,account:y({executable:zT(),owner:S1,lamports:B(),data:IW,rentEpoch:B()})}))),Pg=FT(s(y({lamports:B(),address:S1}))),wW=y({executable:zT(),owner:S1,lamports:B(),data:LW,rentEpoch:B()}),qg=y({pubkey:S1,account:wW}),_I=uA(_0([CQ(w),IW]),_0([qP,IW]),(T)=>{if(Array.isArray(T))return lA(T,LW);else return T}),xI=y({executable:zT(),owner:S1,lamports:B(),data:_I,rentEpoch:B()}),Kg=y({pubkey:S1,account:xI}),Cg=y({state:_0([z1("active"),z1("inactive"),z1("activating"),z1("deactivating")]),active:B(),inactive:B()}),Hg=V1(s(y({signature:l(),slot:B(),err:PA,memo:t(l()),blockTime:A1(t(B()))}))),Vg=V1(s(y({signature:l(),slot:B(),err:PA,memo:t(l()),blockTime:A1(t(B()))}))),jg=y({subscription:B(),result:wQ(wW)}),hI=y({pubkey:S1,account:wW}),Rg=y({subscription:B(),result:wQ(hI)}),gI=y({parent:B(),slot:B(),root:B()}),Dg=y({subscription:B(),result:gI}),mI=_0([y({type:_0([z1("firstShredReceived"),z1("completed"),z1("optimisticConfirmation"),z1("root")]),slot:B(),timestamp:B()}),y({type:z1("createdBank"),parent:B(),slot:B(),timestamp:B()}),y({type:z1("frozen"),slot:B(),timestamp:B(),stats:y({numTransactionEntries:B(),numSuccessfulTransactions:B(),numFailedTransactions:B(),maxTransactionsPerEntry:B()})}),y({type:z1("dead"),slot:B(),timestamp:B(),err:l()})]),Mg=y({subscription:B(),result:mI}),kg=y({subscription:B(),result:wQ(_0([LI,wI]))}),zg=y({subscription:B(),result:B()}),Fg=y({pubkey:l(),gossip:t(l()),tpu:t(l()),rpc:t(l()),version:t(l())}),iX=y({votePubkey:l(),nodePubkey:l(),activatedStake:B(),epochVoteAccount:zT(),epochCredits:s(HQ([B(),B(),B()])),commission:B(),lastVote:B(),rootSlot:t(B())}),Ng=V1(y({current:s(iX),delinquent:s(iX)})),vI=_0([z1("processed"),z1("confirmed"),z1("finalized")]),yI=y({slot:B(),confirmations:t(B()),err:PA,confirmationStatus:A1(vI)}),Ig=FT(s(t(yI))),Sg=V1(B()),CP=y({accountKey:S1,writableIndexes:s(B()),readonlyIndexes:s(B())}),EW=y({signatures:s(l()),message:y({accountKeys:s(l()),header:y({numRequiredSignatures:B(),numReadonlySignedAccounts:B(),numReadonlyUnsignedAccounts:B()}),instructions:s(y({accounts:s(B()),data:l(),programIdIndex:B()})),recentBlockhash:l(),addressTableLookups:A1(s(CP))})}),HP=y({pubkey:S1,signer:zT(),writable:zT(),source:A1(_0([z1("transaction"),z1("lookupTable")]))}),VP=y({accountKeys:s(HP),signatures:s(l())}),jP=y({parsed:XA(),program:l(),programId:S1}),RP=y({accounts:s(S1),data:l(),programId:S1}),bI=_0([RP,jP]),pI=_0([y({parsed:XA(),program:l(),programId:l()}),y({accounts:s(l()),data:l(),programId:l()})]),DP=uA(bI,pI,(T)=>{if("accounts"in T)return lA(T,RP);else return lA(T,jP)}),MP=y({signatures:s(l()),message:y({accountKeys:s(HP),instructions:s(DP),recentBlockhash:l(),addressTableLookups:A1(t(s(CP)))})}),LQ=y({accountIndex:B(),mint:l(),owner:A1(l()),programId:A1(l()),uiTokenAmount:BI}),kP=y({writable:s(S1),readonly:s(S1)}),EQ=y({err:PA,fee:B(),innerInstructions:A1(t(s(y({index:B(),instructions:s(y({accounts:s(B()),data:l(),programIdIndex:B()}))})))),preBalances:s(B()),postBalances:s(B()),logMessages:A1(t(s(l()))),preTokenBalances:A1(t(s(LQ))),postTokenBalances:A1(t(s(LQ))),loadedAddresses:A1(kP),computeUnitsConsumed:A1(B()),costUnits:A1(B())}),OW=y({err:PA,fee:B(),innerInstructions:A1(t(s(y({index:B(),instructions:s(DP)})))),preBalances:s(B()),postBalances:s(B()),logMessages:A1(t(s(l()))),preTokenBalances:A1(t(s(LQ))),postTokenBalances:A1(t(s(LQ))),loadedAddresses:A1(kP),computeUnitsConsumed:A1(B()),costUnits:A1(B())}),iA=_0([z1(0),z1("legacy")]),qA=y({pubkey:l(),lamports:B(),postBalance:t(B()),rewardType:t(l()),commission:A1(t(B()))}),Lg=V1(t(y({blockhash:l(),previousBlockhash:l(),parentSlot:B(),transactions:s(y({transaction:EW,meta:t(EQ),version:A1(iA)})),rewards:A1(s(qA)),blockTime:t(B()),blockHeight:t(B())}))),wg=V1(t(y({blockhash:l(),previousBlockhash:l(),parentSlot:B(),rewards:A1(s(qA)),blockTime:t(B()),blockHeight:t(B())}))),Eg=V1(t(y({blockhash:l(),previousBlockhash:l(),parentSlot:B(),transactions:s(y({transaction:VP,meta:t(EQ),version:A1(iA)})),rewards:A1(s(qA)),blockTime:t(B()),blockHeight:t(B())}))),Og=V1(t(y({blockhash:l(),previousBlockhash:l(),parentSlot:B(),transactions:s(y({transaction:MP,meta:t(OW),version:A1(iA)})),rewards:A1(s(qA)),blockTime:t(B()),blockHeight:t(B())}))),Bg=V1(t(y({blockhash:l(),previousBlockhash:l(),parentSlot:B(),transactions:s(y({transaction:VP,meta:t(OW),version:A1(iA)})),rewards:A1(s(qA)),blockTime:t(B()),blockHeight:t(B())}))),_g=V1(t(y({blockhash:l(),previousBlockhash:l(),parentSlot:B(),rewards:A1(s(qA)),blockTime:t(B()),blockHeight:t(B())}))),xg=V1(t(y({blockhash:l(),previousBlockhash:l(),parentSlot:B(),transactions:s(y({transaction:EW,meta:t(EQ)})),rewards:A1(s(qA)),blockTime:t(B())}))),hg=V1(t(y({blockhash:l(),previousBlockhash:l(),parentSlot:B(),signatures:s(l()),blockTime:t(B())}))),gg=V1(t(y({slot:B(),meta:t(EQ),blockTime:A1(t(B())),transaction:EW,version:A1(iA)}))),mg=V1(t(y({slot:B(),transaction:MP,meta:t(OW),blockTime:A1(t(B())),version:A1(iA)}))),vg=FT(y({blockhash:l(),lastValidBlockHeight:B()})),yg=FT(zT()),lI=y({slot:B(),numTransactions:B(),numSlots:B(),samplePeriodSecs:B()}),bg=V1(s(lI)),pg=FT(t(y({feeCalculator:y({lamportsPerSignature:B()})}))),lg=V1(l()),ug=V1(l()),uI=y({err:PA,logs:s(l()),signature:l()}),dg=y({result:wQ(uI),subscription:B()});class c2{constructor(T){this._keypair=void 0,this._keypair=T??dX()}static generate(){return new c2(dX())}static fromSecretKey(T,A){if(T.byteLength!==64)throw Error("bad secret key size");let Q=T.slice(32,64);if(!A||!A.skipValidation){let J=T.slice(0,32),$=FW(J);for(let W=0;W<32;W++)if(Q[W]!==$[W])throw Error("provided secretKey is invalid")}return new c2({publicKey:Q,secretKey:T})}static fromSeed(T){let A=FW(T),Q=new Uint8Array(64);return Q.set(T),Q.set(A,32),new c2({publicKey:A,secretKey:Q})}get publicKey(){return new a(this._keypair.publicKey)}get secretKey(){return new Uint8Array(this._keypair.secretKey)}}var y2=Object.freeze({CreateLookupTable:{index:0,layout:S.struct([S.u32("instruction"),rA("recentSlot"),S.u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:S.struct([S.u32("instruction")])},ExtendLookupTable:{index:2,layout:S.struct([S.u32("instruction"),rA(),S.seq(G1(),S.offset(S.u32(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:S.struct([S.u32("instruction")])},CloseLookupTable:{index:4,layout:S.struct([S.u32("instruction")])}});class zP{constructor(){}static createLookupTable(T){let[A,Q]=a.findProgramAddressSync([T.authority.toBuffer(),s$().encode(T.recentSlot)],this.programId),J=y2.CreateLookupTable,$=W1(J,{recentSlot:BigInt(T.recentSlot),bumpSeed:Q}),W=[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:T.authority,isSigner:!0,isWritable:!1},{pubkey:T.payer,isSigner:!0,isWritable:!0},{pubkey:K0.programId,isSigner:!1,isWritable:!1}];return[new Z1({programId:this.programId,keys:W,data:$}),A]}static freezeLookupTable(T){let A=y2.FreezeLookupTable,Q=W1(A),J=[{pubkey:T.lookupTable,isSigner:!1,isWritable:!0},{pubkey:T.authority,isSigner:!0,isWritable:!1}];return new Z1({programId:this.programId,keys:J,data:Q})}static extendLookupTable(T){let A=y2.ExtendLookupTable,Q=W1(A,{addresses:T.addresses.map(($)=>$.toBytes())}),J=[{pubkey:T.lookupTable,isSigner:!1,isWritable:!0},{pubkey:T.authority,isSigner:!0,isWritable:!1}];if(T.payer)J.push({pubkey:T.payer,isSigner:!0,isWritable:!0},{pubkey:K0.programId,isSigner:!1,isWritable:!1});return new Z1({programId:this.programId,keys:J,data:Q})}static deactivateLookupTable(T){let A=y2.DeactivateLookupTable,Q=W1(A),J=[{pubkey:T.lookupTable,isSigner:!1,isWritable:!0},{pubkey:T.authority,isSigner:!0,isWritable:!1}];return new Z1({programId:this.programId,keys:J,data:Q})}static closeLookupTable(T){let A=y2.CloseLookupTable,Q=W1(A),J=[{pubkey:T.lookupTable,isSigner:!1,isWritable:!0},{pubkey:T.authority,isSigner:!0,isWritable:!1},{pubkey:T.recipient,isSigner:!1,isWritable:!0}];return new Z1({programId:this.programId,keys:J,data:Q})}}zP.programId=new a("AddressLookupTab1e1111111111111111111111111");var FQ=Object.freeze({RequestUnits:{index:0,layout:S.struct([S.u8("instruction"),S.u32("units"),S.u32("additionalFee")])},RequestHeapFrame:{index:1,layout:S.struct([S.u8("instruction"),S.u32("bytes")])},SetComputeUnitLimit:{index:2,layout:S.struct([S.u8("instruction"),S.u32("units")])},SetComputeUnitPrice:{index:3,layout:S.struct([S.u8("instruction"),rA("microLamports")])}});class FP{constructor(){}static requestUnits(T){let A=FQ.RequestUnits,Q=W1(A,T);return new Z1({keys:[],programId:this.programId,data:Q})}static requestHeapFrame(T){let A=FQ.RequestHeapFrame,Q=W1(A,T);return new Z1({keys:[],programId:this.programId,data:Q})}static setComputeUnitLimit(T){let A=FQ.SetComputeUnitLimit,Q=W1(A,T);return new Z1({keys:[],programId:this.programId,data:Q})}static setComputeUnitPrice(T){let A=FQ.SetComputeUnitPrice,Q=W1(A,{microLamports:BigInt(T.microLamports)});return new Z1({keys:[],programId:this.programId,data:Q})}}FP.programId=new a("ComputeBudget111111111111111111111111111111");var oX=64,aX=32,sX=64,tX=S.struct([S.u8("numSignatures"),S.u8("padding"),S.u16("signatureOffset"),S.u16("signatureInstructionIndex"),S.u16("publicKeyOffset"),S.u16("publicKeyInstructionIndex"),S.u16("messageDataOffset"),S.u16("messageDataSize"),S.u16("messageInstructionIndex")]);class BW{constructor(){}static createInstructionWithPublicKey(T){let{publicKey:A,message:Q,signature:J,instructionIndex:$}=T;R0(A.length===aX,`Public Key must be ${aX} bytes but received ${A.length} bytes`),R0(J.length===sX,`Signature must be ${sX} bytes but received ${J.length} bytes`);let W=tX.span,G=W+A.length,Y=G+J.length,Z=1,C=w.alloc(Y+Q.length),K=$==null?65535:$;return tX.encode({numSignatures:Z,padding:0,signatureOffset:G,signatureInstructionIndex:K,publicKeyOffset:W,publicKeyInstructionIndex:K,messageDataOffset:Y,messageDataSize:Q.length,messageInstructionIndex:K},C),C.fill(A,W),C.fill(J,G),C.fill(Q,Y),new Z1({keys:[],programId:BW.programId,data:C})}static createInstructionWithPrivateKey(T){let{privateKey:A,message:Q,instructionIndex:J}=T;R0(A.length===oX,`Private key must be ${oX} bytes but received ${A.length} bytes`);try{let $=c2.fromSecretKey(A),W=$.publicKey.toBytes(),G=QP(Q,$.secretKey);return this.createInstructionWithPublicKey({publicKey:W,message:Q,signature:G,instructionIndex:J})}catch($){throw Error(`Error creating instruction; ${$}`)}}}BW.programId=new a("Ed25519SigVerify111111111111111111111111111");var dI=(T,A)=>{let Q=kQ.sign(T,A);return[Q.toCompactRawBytes(),Q.recovery]};kQ.utils.isValidPrivateKey;var cI=kQ.getPublicKey,eX=32,MW=20,TP=64,fI=11,kW=S.struct([S.u8("numSignatures"),S.u16("signatureOffset"),S.u8("signatureInstructionIndex"),S.u16("ethAddressOffset"),S.u8("ethAddressInstructionIndex"),S.u16("messageDataOffset"),S.u16("messageDataSize"),S.u8("messageInstructionIndex"),S.blob(20,"ethAddress"),S.blob(64,"signature"),S.u8("recoveryId")]);class f2{constructor(){}static publicKeyToEthAddress(T){R0(T.length===TP,`Public key must be ${TP} bytes but received ${T.length} bytes`);try{return w.from(PW(Y1(T))).slice(-MW)}catch(A){throw Error(`Error constructing Ethereum address: ${A}`)}}static createInstructionWithPublicKey(T){let{publicKey:A,message:Q,signature:J,recoveryId:$,instructionIndex:W}=T;return f2.createInstructionWithEthAddress({ethAddress:f2.publicKeyToEthAddress(A),message:Q,signature:J,recoveryId:$,instructionIndex:W})}static createInstructionWithEthAddress(T){let{ethAddress:A,message:Q,signature:J,recoveryId:$,instructionIndex:W=0}=T,G;if(typeof A==="string")if(A.startsWith("0x"))G=w.from(A.substr(2),"hex");else G=w.from(A,"hex");else G=A;R0(G.length===MW,`Address must be ${MW} bytes but received ${G.length} bytes`);let Y=1+fI,Z=Y,C=Y+G.length,K=C+J.length+1,j=1,M=w.alloc(kW.span+Q.length);return kW.encode({numSignatures:j,signatureOffset:C,signatureInstructionIndex:W,ethAddressOffset:Z,ethAddressInstructionIndex:W,messageDataOffset:K,messageDataSize:Q.length,messageInstructionIndex:W,signature:Y1(J),ethAddress:Y1(G),recoveryId:$},M),M.fill(Y1(Q),kW.span),new Z1({keys:[],programId:f2.programId,data:M})}static createInstructionWithPrivateKey(T){let{privateKey:A,message:Q,instructionIndex:J}=T;R0(A.length===eX,`Private key must be ${eX} bytes but received ${A.length} bytes`);try{let $=Y1(A),W=cI($,!1).slice(1),G=w.from(PW(Y1(Q))),[Y,Z]=dI(G,$);return this.createInstructionWithPublicKey({publicKey:W,message:Q,signature:Y,recoveryId:Z,instructionIndex:J})}catch($){throw Error(`Error creating instruction; ${$}`)}}}f2.programId=new a("KeccakSecp256k11111111111111111111111111111");var NP,rI=new a("StakeConfig11111111111111111111111111111111");class OQ{constructor(T,A,Q){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=T,this.epoch=A,this.custodian=Q}}NP=OQ;OQ.default=new NP(0,0,a.default);var v8=Object.freeze({Initialize:{index:0,layout:S.struct([S.u32("instruction"),UI(),YI()])},Authorize:{index:1,layout:S.struct([S.u32("instruction"),G1("newAuthorized"),S.u32("stakeAuthorizationType")])},Delegate:{index:2,layout:S.struct([S.u32("instruction")])},Split:{index:3,layout:S.struct([S.u32("instruction"),S.ns64("lamports")])},Withdraw:{index:4,layout:S.struct([S.u32("instruction"),S.ns64("lamports")])},Deactivate:{index:5,layout:S.struct([S.u32("instruction")])},Merge:{index:7,layout:S.struct([S.u32("instruction")])},AuthorizeWithSeed:{index:8,layout:S.struct([S.u32("instruction"),G1("newAuthorized"),S.u32("stakeAuthorizationType"),fA("authoritySeed"),G1("authorityOwner")])}}),cg=Object.freeze({Staker:{index:0},Withdrawer:{index:1}});class _W{constructor(){}static initialize(T){let{stakePubkey:A,authorized:Q,lockup:J}=T,$=J||OQ.default,W=v8.Initialize,G=W1(W,{authorized:{staker:Y1(Q.staker.toBuffer()),withdrawer:Y1(Q.withdrawer.toBuffer())},lockup:{unixTimestamp:$.unixTimestamp,epoch:$.epoch,custodian:Y1($.custodian.toBuffer())}}),Y={keys:[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:n2,isSigner:!1,isWritable:!1}],programId:this.programId,data:G};return new Z1(Y)}static createAccountWithSeed(T){let A=new j1;A.add(K0.createAccountWithSeed({fromPubkey:T.fromPubkey,newAccountPubkey:T.stakePubkey,basePubkey:T.basePubkey,seed:T.seed,lamports:T.lamports,space:this.space,programId:this.programId}));let{stakePubkey:Q,authorized:J,lockup:$}=T;return A.add(this.initialize({stakePubkey:Q,authorized:J,lockup:$}))}static createAccount(T){let A=new j1;A.add(K0.createAccount({fromPubkey:T.fromPubkey,newAccountPubkey:T.stakePubkey,lamports:T.lamports,space:this.space,programId:this.programId}));let{stakePubkey:Q,authorized:J,lockup:$}=T;return A.add(this.initialize({stakePubkey:Q,authorized:J,lockup:$}))}static delegate(T){let{stakePubkey:A,authorizedPubkey:Q,votePubkey:J}=T,$=v8.Delegate,W=W1($);return new j1().add({keys:[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:J,isSigner:!1,isWritable:!1},{pubkey:X8,isSigner:!1,isWritable:!1},{pubkey:DW,isSigner:!1,isWritable:!1},{pubkey:rI,isSigner:!1,isWritable:!1},{pubkey:Q,isSigner:!0,isWritable:!1}],programId:this.programId,data:W})}static authorize(T){let{stakePubkey:A,authorizedPubkey:Q,newAuthorizedPubkey:J,stakeAuthorizationType:$,custodianPubkey:W}=T,G=v8.Authorize,Y=W1(G,{newAuthorized:Y1(J.toBuffer()),stakeAuthorizationType:$.index}),Z=[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:X8,isSigner:!1,isWritable:!0},{pubkey:Q,isSigner:!0,isWritable:!1}];if(W)Z.push({pubkey:W,isSigner:!0,isWritable:!1});return new j1().add({keys:Z,programId:this.programId,data:Y})}static authorizeWithSeed(T){let{stakePubkey:A,authorityBase:Q,authoritySeed:J,authorityOwner:$,newAuthorizedPubkey:W,stakeAuthorizationType:G,custodianPubkey:Y}=T,Z=v8.AuthorizeWithSeed,C=W1(Z,{newAuthorized:Y1(W.toBuffer()),stakeAuthorizationType:G.index,authoritySeed:J,authorityOwner:Y1($.toBuffer())}),K=[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:Q,isSigner:!0,isWritable:!1},{pubkey:X8,isSigner:!1,isWritable:!1}];if(Y)K.push({pubkey:Y,isSigner:!0,isWritable:!1});return new j1().add({keys:K,programId:this.programId,data:C})}static splitInstruction(T){let{stakePubkey:A,authorizedPubkey:Q,splitStakePubkey:J,lamports:$}=T,W=v8.Split,G=W1(W,{lamports:$});return new Z1({keys:[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:J,isSigner:!1,isWritable:!0},{pubkey:Q,isSigner:!0,isWritable:!1}],programId:this.programId,data:G})}static split(T,A){let Q=new j1;return Q.add(K0.createAccount({fromPubkey:T.authorizedPubkey,newAccountPubkey:T.splitStakePubkey,lamports:A,space:this.space,programId:this.programId})),Q.add(this.splitInstruction(T))}static splitWithSeed(T,A){let{stakePubkey:Q,authorizedPubkey:J,splitStakePubkey:$,basePubkey:W,seed:G,lamports:Y}=T,Z=new j1;if(Z.add(K0.allocate({accountPubkey:$,basePubkey:W,seed:G,space:this.space,programId:this.programId})),A&&A>0)Z.add(K0.transfer({fromPubkey:T.authorizedPubkey,toPubkey:$,lamports:A}));return Z.add(this.splitInstruction({stakePubkey:Q,authorizedPubkey:J,splitStakePubkey:$,lamports:Y}))}static merge(T){let{stakePubkey:A,sourceStakePubKey:Q,authorizedPubkey:J}=T,$=v8.Merge,W=W1($);return new j1().add({keys:[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:Q,isSigner:!1,isWritable:!0},{pubkey:X8,isSigner:!1,isWritable:!1},{pubkey:DW,isSigner:!1,isWritable:!1},{pubkey:J,isSigner:!0,isWritable:!1}],programId:this.programId,data:W})}static withdraw(T){let{stakePubkey:A,authorizedPubkey:Q,toPubkey:J,lamports:$,custodianPubkey:W}=T,G=v8.Withdraw,Y=W1(G,{lamports:$}),Z=[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:J,isSigner:!1,isWritable:!0},{pubkey:X8,isSigner:!1,isWritable:!1},{pubkey:DW,isSigner:!1,isWritable:!1},{pubkey:Q,isSigner:!0,isWritable:!1}];if(W)Z.push({pubkey:W,isSigner:!0,isWritable:!1});return new j1().add({keys:Z,programId:this.programId,data:Y})}static deactivate(T){let{stakePubkey:A,authorizedPubkey:Q}=T,J=v8.Deactivate,$=W1(J);return new j1().add({keys:[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:X8,isSigner:!1,isWritable:!1},{pubkey:Q,isSigner:!0,isWritable:!1}],programId:this.programId,data:$})}}_W.programId=new a("Stake11111111111111111111111111111111111111");_W.space=200;var b2=Object.freeze({InitializeAccount:{index:0,layout:S.struct([S.u32("instruction"),ZI()])},Authorize:{index:1,layout:S.struct([S.u32("instruction"),G1("newAuthorized"),S.u32("voteAuthorizationType")])},Withdraw:{index:3,layout:S.struct([S.u32("instruction"),S.ns64("lamports")])},UpdateValidatorIdentity:{index:4,layout:S.struct([S.u32("instruction")])},AuthorizeWithSeed:{index:10,layout:S.struct([S.u32("instruction"),XI()])}}),fg=Object.freeze({Voter:{index:0},Withdrawer:{index:1}});class BQ{constructor(){}static initializeAccount(T){let{votePubkey:A,nodePubkey:Q,voteInit:J}=T,$=b2.InitializeAccount,W=W1($,{voteInit:{nodePubkey:Y1(J.nodePubkey.toBuffer()),authorizedVoter:Y1(J.authorizedVoter.toBuffer()),authorizedWithdrawer:Y1(J.authorizedWithdrawer.toBuffer()),commission:J.commission}}),G={keys:[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:n2,isSigner:!1,isWritable:!1},{pubkey:X8,isSigner:!1,isWritable:!1},{pubkey:Q,isSigner:!0,isWritable:!1}],programId:this.programId,data:W};return new Z1(G)}static createAccount(T){let A=new j1;return A.add(K0.createAccount({fromPubkey:T.fromPubkey,newAccountPubkey:T.votePubkey,lamports:T.lamports,space:this.space,programId:this.programId})),A.add(this.initializeAccount({votePubkey:T.votePubkey,nodePubkey:T.voteInit.nodePubkey,voteInit:T.voteInit}))}static authorize(T){let{votePubkey:A,authorizedPubkey:Q,newAuthorizedPubkey:J,voteAuthorizationType:$}=T,W=b2.Authorize,G=W1(W,{newAuthorized:Y1(J.toBuffer()),voteAuthorizationType:$.index}),Y=[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:X8,isSigner:!1,isWritable:!1},{pubkey:Q,isSigner:!0,isWritable:!1}];return new j1().add({keys:Y,programId:this.programId,data:G})}static authorizeWithSeed(T){let{currentAuthorityDerivedKeyBasePubkey:A,currentAuthorityDerivedKeyOwnerPubkey:Q,currentAuthorityDerivedKeySeed:J,newAuthorizedPubkey:$,voteAuthorizationType:W,votePubkey:G}=T,Y=b2.AuthorizeWithSeed,Z=W1(Y,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:Y1(Q.toBuffer()),currentAuthorityDerivedKeySeed:J,newAuthorized:Y1($.toBuffer()),voteAuthorizationType:W.index}}),C=[{pubkey:G,isSigner:!1,isWritable:!0},{pubkey:X8,isSigner:!1,isWritable:!1},{pubkey:A,isSigner:!0,isWritable:!1}];return new j1().add({keys:C,programId:this.programId,data:Z})}static withdraw(T){let{votePubkey:A,authorizedWithdrawerPubkey:Q,lamports:J,toPubkey:$}=T,W=b2.Withdraw,G=W1(W,{lamports:J}),Y=[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:$,isSigner:!1,isWritable:!0},{pubkey:Q,isSigner:!0,isWritable:!1}];return new j1().add({keys:Y,programId:this.programId,data:G})}static safeWithdraw(T,A,Q){if(T.lamports>A-Q)throw Error("Withdraw will leave vote account with insufficient funds.");return BQ.withdraw(T)}static updateValidatorIdentity(T){let{votePubkey:A,authorizedWithdrawerPubkey:Q,nodePubkey:J}=T,$=b2.UpdateValidatorIdentity,W=W1($),G=[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:J,isSigner:!0,isWritable:!1},{pubkey:Q,isSigner:!0,isWritable:!1}];return new j1().add({keys:G,programId:this.programId,data:W})}}BQ.programId=new a("Vote111111111111111111111111111111111111111");BQ.space=3762;var rg=new a("Va1idator1nfo111111111111111111111111111111"),ng=y({name:l(),website:A1(l()),details:A1(l()),iconUrl:A1(l()),keybaseUsername:A1(l())});var ig=new a("Vote111111111111111111111111111111111111111"),og=S.struct([G1("nodePubkey"),G1("authorizedWithdrawer"),S.u8("commission"),S.nu64(),S.seq(S.struct([S.nu64("slot"),S.u32("confirmationCount")]),S.offset(S.u32(),-8),"votes"),S.u8("rootSlotValid"),S.nu64("rootSlot"),S.nu64(),S.seq(S.struct([S.nu64("epoch"),G1("authorizedVoter")]),S.offset(S.u32(),-8),"authorizedVoters"),S.struct([S.seq(S.struct([G1("authorizedPubkey"),S.nu64("epochOfLastAuthorizedSwitch"),S.nu64("targetEpoch")]),32,"buf"),S.nu64("idx"),S.u8("isEmpty")],"priorVoters"),S.nu64(),S.seq(S.struct([S.nu64("epoch"),S.nu64("credits"),S.nu64("prevCredits")]),S.offset(S.u32(),-8),"epochCredits"),S.struct([S.nu64("slot"),S.nu64("timestamp")],"lastTimestamp")]);var AT=new a("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),tg=new a("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"),lT=new a("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"),eg=new a("So11111111111111111111111111111111111111112"),Tm=new a("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");var KA=(T)=>{let A=T.decode.bind(T),Q=T.encode.bind(T);return{decode:A,encode:Q}};var xW=n0(G8(),1),y8=n0(SP(),1);var xQ=(T)=>(A)=>{let Q=xW.blob(T,A),{encode:J,decode:$}=KA(Q),W=Q;return W.decode=(G,Y)=>{let Z=$(G,Y);return y8.toBigIntLE(Buffer.from(Z))},W.encode=(G,Y,Z)=>{let C=y8.toBufferLE(G,T);return J(C,Y,Z)},W},hQ=(T)=>(A)=>{let Q=xW.blob(T,A),{encode:J,decode:$}=KA(Q),W=Q;return W.decode=(G,Y)=>{let Z=$(G,Y);return y8.toBigIntBE(Buffer.from(Z))},W.encode=(G,Y,Z)=>{let C=y8.toBufferBE(G,T);return J(C,Y,Z)},W},LP=xQ(8),Wm=hQ(8),Gm=xQ(16),Um=hQ(16),Ym=xQ(24),Zm=hQ(24),Xm=xQ(32),Pm=hQ(32);var wP=n0(G8(),1);var EP=(T)=>{let A=wP.u8(T),{encode:Q,decode:J}=KA(A),$=A;return $.decode=(W,G)=>{return!!J(W,G)},$.encode=(W,G,Y)=>{let Z=Number(W);return Q(Z,G,Y)},$};var OP=n0(G8(),1);var hW=(T)=>{let A=OP.blob(32,T),{encode:Q,decode:J}=KA(A),$=A;return $.decode=(W,G)=>{let Y=J(W,G);return new a(Y)},$.encode=(W,G,Y)=>{let Z=W.toBuffer();return Q(Z,G,Y)},$};class BP extends Error{constructor(T){super(T)}}class gW extends BP{constructor(){super(...arguments);this.name="TokenOwnerOffCurveError"}}var oA;(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",T[T.GetAccountDataSize=21]="GetAccountDataSize",T[T.InitializeImmutableOwner=22]="InitializeImmutableOwner",T[T.AmountToUiAmount=23]="AmountToUiAmount",T[T.UiAmountToAmount=24]="UiAmountToAmount",T[T.InitializeMintCloseAuthority=25]="InitializeMintCloseAuthority",T[T.TransferFeeExtension=26]="TransferFeeExtension",T[T.ConfidentialTransferExtension=27]="ConfidentialTransferExtension",T[T.DefaultAccountStateExtension=28]="DefaultAccountStateExtension",T[T.Reallocate=29]="Reallocate",T[T.MemoTransferExtension=30]="MemoTransferExtension",T[T.CreateNativeMint=31]="CreateNativeMint",T[T.InitializeNonTransferableMint=32]="InitializeNonTransferableMint",T[T.InterestBearingMintExtension=33]="InterestBearingMintExtension",T[T.CpiGuardExtension=34]="CpiGuardExtension",T[T.InitializePermanentDelegate=35]="InitializePermanentDelegate",T[T.TransferHookExtension=36]="TransferHookExtension",T[T.MetadataPointerExtension=39]="MetadataPointerExtension",T[T.GroupPointerExtension=40]="GroupPointerExtension",T[T.GroupMemberPointerExtension=41]="GroupMemberPointerExtension",T[T.ScaledUiAmountExtension=43]="ScaledUiAmountExtension",T[T.PausableExtension=44]="PausableExtension"})(oA||(oA={}));var CA=n0(G8(),1);function _P(T,A,Q){if(Q.length){T.push({pubkey:A,isSigner:!1,isWritable:!1});for(let J of Q)T.push({pubkey:J instanceof a?J:J.publicKey,isSigner:!0,isWritable:!1})}else T.push({pubkey:A,isSigner:!0,isWritable:!1});return T}var AS=CA.struct([CA.u32("mintAuthorityOption"),hW("mintAuthority"),LP("supply"),CA.u8("decimals"),EP("isInitialized"),CA.u32("freezeAuthorityOption"),hW("freezeAuthority")]),Om=AS.span;function i2(T,A,Q=!1,J=AT,$=lT){if(!Q&&!a.isOnCurve(A.toBuffer()))throw new gW;let[W]=a.findProgramAddressSync([A.toBuffer(),J.toBuffer(),T.toBuffer()],$);return W}var gQ=n0(G8(),1);var xP=gQ.struct([gQ.u8("instruction")]);function mW(T,A,Q,J=[],$=AT){let W=_P([{pubkey:T,isSigner:!1,isWritable:!0},{pubkey:A,isSigner:!1,isWritable:!0}],Q,J),G=Buffer.alloc(xP.span);return xP.encode({instruction:oA.CloseAccount},G),new Z1({keys:W,programId:$,data:G})}function mQ(T,A,Q,J,$=AT,W=lT){return QS(T,A,Q,J,Buffer.alloc(0),$,W)}function QS(T,A,Q,J,$,W=AT,G=lT){let Y=[{pubkey:T,isSigner:!0,isWritable:!0},{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:Q,isSigner:!1,isWritable:!1},{pubkey:J,isSigner:!1,isWritable:!1},{pubkey:K0.programId,isSigner:!1,isWritable:!1},{pubkey:W,isSigner:!1,isWritable:!1}];return new Z1({keys:Y,programId:G,data:$})}var vQ=n0(G8(),1);var hP=vQ.struct([vQ.u8("instruction")]);function gP(T,A=AT){let Q=[{pubkey:T,isSigner:!1,isWritable:!0}],J=Buffer.alloc(hP.span);return hP.encode({instruction:oA.SyncNative},J),new Z1({keys:Q,programId:A,data:J})}function yQ(T){if(typeof T==="string")return new a(T);if(typeof T==="object"&&"address"in T)return new a(T.address);return new a(T)}function mP(T){if(T instanceof a)return T;return yQ(T)}function JS(T){return{programAddress:_(T.programId.toBase58()),accounts:T.keys.map((A)=>({address:_(A.pubkey.toBase58()),role:A.isSigner?A.isWritable?$1.WRITABLE_SIGNER:$1.READONLY_SIGNER:A.isWritable?$1.WRITABLE:$1.READONLY})),data:T.data}}function aA(T){let{payer:A,owner:Q,mint:J,tokenProgram:$=AT,associatedTokenProgram:W=lT}=T,G=yQ(A),Y=yQ(Q),Z=yQ(J),C=mP($),K=mP(W),j=i2(Z,Y,!1,C,K);return JS(mQ(G,j,Y,Z,C,K))}var em=new Uint8Array([143,52,146,187,219,123,76,155]);function WS(){return V0([["discriminator",E0(b0(),8)],["bump",D8()],["admin",Y0()],["flatFees",y6()],["feeTiers",F6(WZ())]])}function GS(T){return H8(T,WS())}async function vP(T,A,Q){let J=await US(T,A,Q);return j8(J),J}async function US(T,A,Q){let J=await V8(T,A,Q);return GS(J)}var P8=10000n,sA=(T,A,Q)=>{if(Q<=0n)throw Error("Division by zero (floor)");return T*A/Q},YS=(T,A,Q)=>{if(Q<=0n)throw Error("Division by zero (ceil)");let J=T*A,$=J/Q;return J%Q===0n?$:$+1n},vW=(T)=>{let A=BigInt(T.lpFeeBps),Q=BigInt(T.protocolFeeBps),J=BigInt(T.creatorFeeBps),$=A+Q,W=$+J;if(W>=P8)throw Error("Total fee basis points must be less than 10_000");return{totalFeeBps:W,combinedFeeBps:$}},yW=(T)=>{let A=T.virtualTokenReserves+T.realTokenReserves,Q=T.virtualSolReserves+T.realSolReserves;return A*Q};function yP(T,A,Q){if(Q<=0n)throw Error("Total SOL cost must be positive");let{combinedFeeBps:J}=vW(A),$=sA(Q,J,P8),W=sA(Q,BigInt(A.creatorFeeBps),P8),G=Q-$-W;if(G<=0n)throw Error("Net SOL after fees must be positive");let Y=yW(T),Z=T.virtualSolReserves+T.realSolReserves,C=T.virtualTokenReserves+T.realTokenReserves,K=Z+G,j=Y/K,M=C-j,z=M>T.realTokenReserves?T.realTokenReserves:M;if(z<=0n)throw Error("SOL amount is too small to purchase any tokens");let N=bQ(T,A,z);while(N.totalSolCostLamports>Q&&z>0n)z-=1n,N=bQ(T,A,z);if(N.totalSolCostLamports>Q)throw Error("Insufficient SOL to purchase any tokens with fees applied");return{tokenAmount:z,totalSolCostLamports:N.totalSolCostLamports,effectiveSolInLamports:N.effectiveSolInLamports,feeLamports:N.feeLamports,creatorFeeLamports:N.creatorFeeLamports}}function bQ(T,A,Q){if(Q<=0n)throw Error("Token amount must be positive");if(Q>T.realTokenReserves)throw Error("Token amount exceeds available reserves");let{combinedFeeBps:J,totalFeeBps:$}=vW(A),W=yW(T),G=T.virtualSolReserves+T.realSolReserves,Z=T.virtualTokenReserves+T.realTokenReserves-Q;if(Z<=0n)throw Error("Purchase would exhaust token reserves");let K=W/Z-G;if(K<=0n)throw Error("Resolved SOL input must be positive");let j=P8-$,M=YS(K,P8,j),z=sA(M,J,P8),N=sA(M,BigInt(A.creatorFeeBps),P8);return{tokenAmount:Q,totalSolCostLamports:M,effectiveSolInLamports:K,feeLamports:z,creatorFeeLamports:N}}function bP(T,A,Q){if(Q<=0n)throw Error("Token amount must be positive");let J=yW(T),$=T.virtualSolReserves+T.realSolReserves,G=T.virtualTokenReserves+T.realTokenReserves+Q,Y=J/G,Z=$-Y;if(Z<=0n)throw Error("No SOL output available for the given token amount");let{combinedFeeBps:C}=vW(A),K=sA(Z,C,P8),j=sA(Z,BigInt(A.creatorFeeBps),P8),M=Z-K-j;if(M<=0n)throw Error("SOL output after fees is non-positive");return{solOutputLamports:M,preFeeSolOutputLamports:Z,feeLamports:K,creatorFeeLamports:j}}var pP=_T,ZS=1e4,lP=(T,A)=>{if(!Number.isFinite(T)||T<=0)throw Error(`${A} must be a positive number`)},XS=(T)=>({lpFeeBps:T.lpFeeBps,protocolFeeBps:T.protocolFeeBps,creatorFeeBps:T.creatorFeeBps});async function uP(T,A,Q,J){let $=J?.curve?Promise.resolve(J.curve):(async()=>{let G=await BT(T);return(await k8(A,G,{commitment:Q})).data})(),W=J?.fees?Promise.resolve(J.fees):(async()=>{let G=await C2(),Y=await vP(A,G,{commitment:Q});return XS(Y.data.flatFees)})();try{let[G,Y]=await Promise.all([$,W]);return{curve:G,fees:Y}}catch(G){throw Error("Failed to load bonding curve state. Provide overrides or ensure the RPC endpoint can access Pump accounts.",{cause:G})}}function PS(T){if(!Number.isFinite(T)||T<=0||T>100)throw Error("walletPercentage must be between 0 and 100");return BigInt(Math.round(T*100))}async function pQ(T){lP(T.solAmount,"solAmount");let A=T.slippageBps??$T;WT(A);let Q=T.feeRecipient??pP,J=T.rpc,$=T.commitment??M1(),{curve:W,fees:G}=await uP(T.mint,J,$,{curve:T.curveStateOverride,fees:T.feeStructureOverride});if(W.complete)throw Error("Token has migrated to the AMM. Use ammBuy instead of curveBuy.");let Y=T.bondingCurveCreator?_(T.bondingCurveCreator):W.creator,Z=xT(T.solAmount),K=yP(W,G,Z).tokenAmount,j=bQ(W,G,K),z=iT(j.totalSolCostLamports,A)*2n,N=_(T.mint),[E]=await H1({owner:T.user.address,mint:N}),L;if(T.allowAtaCreation!==!1)try{if(!(await T.rpc.getAccountInfo(E,{encoding:"base64"}).send()).value)L=aA({payer:T.user,owner:T.user,mint:N})}catch(g){console.warn("[curveBuy] getAccountInfo failed for user ATA, defaulting to create",g),L=aA({payer:T.user,owner:T.user,mint:N})}let O=await hJ({user:T.user,mint:T.mint,tokenAmount:K,maxSolCostLamports:z,feeRecipient:Q,trackVolume:T.trackVolume,bondingCurveCreator:Y,rpc:J,commitment:$});if(L){let g=Object.assign({},O);return g.prepend=[L,...g.prepend??[]],g}return O}async function lQ(T){let A=T.slippageBps??$T;WT(A);let Q=T.feeRecipient??pP,J=T.rpc,$=T.commitment??M1(),{curve:W,fees:G}=await uP(T.mint,J,$,{curve:T.curveStateOverride,fees:T.feeStructureOverride});if(W.complete)throw Error("Token has migrated to the AMM. Use ammSell instead of curveSell.");let Y=T.bondingCurveCreator?_(T.bondingCurveCreator):W.creator,Z=T.useWalletPercentage??!1,C=_(T.mint),K;if(Z){let z=T.walletPercentage??100,N=PS(z),[E]=await H1({owner:_(T.user.address),mint:C,tokenProgram:_(j0)}),L=await J.getTokenAccountBalance(E).send(),O=BigInt(L.value.amount);if(O===0n)throw Error("Wallet token balance is zero; nothing to sell");if(K=O*N/BigInt(ZS),K<=0n)K=1n}else{if(T.tokenAmount===void 0)throw Error("tokenAmount is required when useWalletPercentage is false");lP(T.tokenAmount,"tokenAmount");let z=T.tokenDecimals??6;K=i8(T.tokenAmount,z)}let j=bP(W,G,K),M=n8(j.solOutputLamports,A);if(M<=0n)throw Error("Slippage settings would result in zero SOL output");return gJ({user:T.user,mint:T.mint,tokenAmountRaw:K,minSolOutputLamports:M,feeRecipient:Q,bondingCurveCreator:Y,rpc:J,commitment:$})}var b8=new TextEncoder,HA=C0();async function tA(T,A,Q,J){let $=new Uint8Array(2);$[0]=T&255,$[1]=T>>8&255;let[W]=await R1({programAddress:_(q0),seeds:[b8.encode("pool"),$,HA.encode(_(A)),HA.encode(_(Q)),HA.encode(_(J))]});return W}async function bW(T){let[A]=await R1({programAddress:_(q0),seeds:[b8.encode("pool_lp_mint"),HA.encode(_(T))]});return A}async function pW(T,A){let[Q]=await AZ({owner:T,mint:A});return Q}async function RT(T,A,Q){let[J]=await H1({owner:T,mint:A,tokenProgram:Q});return J}async function eA(){let[T]=await R1({programAddress:_(q0),seeds:[b8.encode("global_config")]});return T}async function dP(){let[T]=await R1({programAddress:_(q0),seeds:[b8.encode("global_volume_accumulator")]});return T}async function cP(T){let[A]=await R1({programAddress:_(q0),seeds:[b8.encode("user_volume_accumulator"),HA.encode(_(T))]});return A}async function o2(){let[T]=await R1({programAddress:_(q0),seeds:[b8.encode("__event_authority")]});return T}async function lW(){let[T]=await R1({programAddress:_(OT),seeds:[b8.encode("fee_config"),HA.encode(_(q0))]});return T}async function uW(T){let[A]=await R1({programAddress:_(q0),seeds:[b8.encode("creator_vault"),HA.encode(_(T))]});return A}async function dW(T,A,Q){let[J]=await H1({owner:T,mint:A,tokenProgram:Q});return J}var QT="";function qS(T){if(!T)throw Error("Expected a Address.");if(typeof T==="object"&&"address"in T)return T.address;if(Array.isArray(T))return T[0];return T}function JT(T,A){return(Q)=>{if(!Q.value){if(A==="omitted")return;return Object.freeze({address:T,role:$1.READONLY})}let J=Q.isWritable?$1.WRITABLE:$1.READONLY;return Object.freeze({address:qS(Q.value),role:fP(Q.value)?I6(J):J,...fP(Q.value)?{signer:Q.value}:{}})}}function fP(T){return!!T&&typeof T==="object"&&"address"in T&&ET(T)}var KS=new Uint8Array([102,6,61,18,1,218,235,234]);function CS(){return Z0(X0([["discriminator",H0(M0(),8)],["baseAmountOut",D1()],["maxQuoteAmountIn",D1()]]),(T)=>({...T,discriminator:KS}))}function rP(T,A){let Q=A?.programAddress??QT,$={pool:{value:T.pool??null,isWritable:!1},user:{value:T.user??null,isWritable:!1},globalConfig:{value:T.globalConfig??null,isWritable:!1},baseMint:{value:T.baseMint??null,isWritable:!1},quoteMint:{value:T.quoteMint??null,isWritable:!1},userBaseTokenAccount:{value:T.userBaseTokenAccount??null,isWritable:!1},userQuoteTokenAccount:{value:T.userQuoteTokenAccount??null,isWritable:!1},poolBaseTokenAccount:{value:T.poolBaseTokenAccount??null,isWritable:!1},poolQuoteTokenAccount:{value:T.poolQuoteTokenAccount??null,isWritable:!1},protocolFeeRecipient:{value:T.protocolFeeRecipient??null,isWritable:!1},protocolFeeRecipientTokenAccount:{value:T.protocolFeeRecipientTokenAccount??null,isWritable:!1},baseTokenProgram:{value:T.baseTokenProgram??null,isWritable:!1},quoteTokenProgram:{value:T.quoteTokenProgram??null,isWritable:!1},systemProgram:{value:T.systemProgram??null,isWritable:!1},associatedTokenProgram:{value:T.associatedTokenProgram??null,isWritable:!1},eventAuthority:{value:T.eventAuthority??null,isWritable:!1},program:{value:T.program??null,isWritable:!1}},W={...T};if(!$.systemProgram.value)$.systemProgram.value="11111111111111111111111111111111";let G=JT(Q,"programId");return Object.freeze({accounts:[G($.pool),G($.user),G($.globalConfig),G($.baseMint),G($.quoteMint),G($.userBaseTokenAccount),G($.userQuoteTokenAccount),G($.poolBaseTokenAccount),G($.poolQuoteTokenAccount),G($.protocolFeeRecipient),G($.protocolFeeRecipientTokenAccount),G($.baseTokenProgram),G($.quoteTokenProgram),G($.systemProgram),G($.associatedTokenProgram),G($.eventAuthority),G($.program)],data:CS().encode(W),programAddress:Q})}var _v=new Uint8Array([201,207,243,114,75,111,47,189]);var mv=new Uint8Array([233,146,209,142,207,104,64,188]);var HS=new Uint8Array([242,35,198,137,82,225,242,182]);function VS(){return Z0(X0([["discriminator",H0(M0(),8)],["lpTokenAmountOut",D1()],["maxBaseAmountIn",D1()],["maxQuoteAmountIn",D1()]]),(T)=>({...T,discriminator:HS}))}function nP(T,A){let Q=A?.programAddress??QT,$={pool:{value:T.pool??null,isWritable:!1},globalConfig:{value:T.globalConfig??null,isWritable:!1},user:{value:T.user??null,isWritable:!1},baseMint:{value:T.baseMint??null,isWritable:!1},quoteMint:{value:T.quoteMint??null,isWritable:!1},lpMint:{value:T.lpMint??null,isWritable:!1},userBaseTokenAccount:{value:T.userBaseTokenAccount??null,isWritable:!1},userQuoteTokenAccount:{value:T.userQuoteTokenAccount??null,isWritable:!1},userPoolTokenAccount:{value:T.userPoolTokenAccount??null,isWritable:!1},poolBaseTokenAccount:{value:T.poolBaseTokenAccount??null,isWritable:!1},poolQuoteTokenAccount:{value:T.poolQuoteTokenAccount??null,isWritable:!1},tokenProgram:{value:T.tokenProgram??null,isWritable:!1},token2022Program:{value:T.token2022Program??null,isWritable:!1},eventAuthority:{value:T.eventAuthority??null,isWritable:!1},program:{value:T.program??null,isWritable:!1}},W={...T};if(!$.tokenProgram.value)$.tokenProgram.value="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";let G=JT(Q,"programId");return Object.freeze({accounts:[G($.pool),G($.globalConfig),G($.user),G($.baseMint),G($.quoteMint),G($.lpMint),G($.userBaseTokenAccount),G($.userQuoteTokenAccount),G($.userPoolTokenAccount),G($.poolBaseTokenAccount),G($.poolQuoteTokenAccount),G($.tokenProgram),G($.token2022Program),G($.eventAuthority),G($.program)],data:VS().encode(W),programAddress:Q})}var cv=new Uint8Array([185,173,187,90,216,15,238,233]);var iv=new Uint8Array([234,102,194,203,150,72,62,229]);var jS=new Uint8Array([51,230,133,164,1,127,131,173]);function RS(){return Z0(X0([["discriminator",H0(M0(),8)],["baseAmountIn",D1()],["minQuoteAmountOut",D1()]]),(T)=>({...T,discriminator:jS}))}function iP(T,A){let Q=A?.programAddress??QT,$={pool:{value:T.pool??null,isWritable:!1},user:{value:T.user??null,isWritable:!1},globalConfig:{value:T.globalConfig??null,isWritable:!1},baseMint:{value:T.baseMint??null,isWritable:!1},quoteMint:{value:T.quoteMint??null,isWritable:!1},userBaseTokenAccount:{value:T.userBaseTokenAccount??null,isWritable:!1},userQuoteTokenAccount:{value:T.userQuoteTokenAccount??null,isWritable:!1},poolBaseTokenAccount:{value:T.poolBaseTokenAccount??null,isWritable:!1},poolQuoteTokenAccount:{value:T.poolQuoteTokenAccount??null,isWritable:!1},protocolFeeRecipient:{value:T.protocolFeeRecipient??null,isWritable:!1},protocolFeeRecipientTokenAccount:{value:T.protocolFeeRecipientTokenAccount??null,isWritable:!1},baseTokenProgram:{value:T.baseTokenProgram??null,isWritable:!1},quoteTokenProgram:{value:T.quoteTokenProgram??null,isWritable:!1},systemProgram:{value:T.systemProgram??null,isWritable:!1},associatedTokenProgram:{value:T.associatedTokenProgram??null,isWritable:!1},eventAuthority:{value:T.eventAuthority??null,isWritable:!1},program:{value:T.program??null,isWritable:!1}},W={...T};if(!$.systemProgram.value)$.systemProgram.value="11111111111111111111111111111111";let G=JT(Q,"programId");return Object.freeze({accounts:[G($.pool),G($.user),G($.globalConfig),G($.baseMint),G($.quoteMint),G($.userBaseTokenAccount),G($.userQuoteTokenAccount),G($.poolBaseTokenAccount),G($.poolQuoteTokenAccount),G($.protocolFeeRecipient),G($.protocolFeeRecipientTokenAccount),G($.baseTokenProgram),G($.quoteTokenProgram),G($.systemProgram),G($.associatedTokenProgram),G($.eventAuthority),G($.program)],data:RS().encode(W),programAddress:Q})}var Qy=new Uint8Array([161,176,40,213,60,184,179,228]);var Gy=new Uint8Array([104,184,103,242,88,151,107,20]);var DS=new Uint8Array([183,18,70,156,148,109,161,34]);function MS(){return Z0(X0([["discriminator",H0(M0(),8)],["lpTokenAmountIn",D1()],["minBaseAmountOut",D1()],["minQuoteAmountOut",D1()]]),(T)=>({...T,discriminator:DS}))}function oP(T,A){let Q=A?.programAddress??QT,$={pool:{value:T.pool??null,isWritable:!1},globalConfig:{value:T.globalConfig??null,isWritable:!1},user:{value:T.user??null,isWritable:!1},baseMint:{value:T.baseMint??null,isWritable:!1},quoteMint:{value:T.quoteMint??null,isWritable:!1},lpMint:{value:T.lpMint??null,isWritable:!1},userBaseTokenAccount:{value:T.userBaseTokenAccount??null,isWritable:!1},userQuoteTokenAccount:{value:T.userQuoteTokenAccount??null,isWritable:!1},userPoolTokenAccount:{value:T.userPoolTokenAccount??null,isWritable:!1},poolBaseTokenAccount:{value:T.poolBaseTokenAccount??null,isWritable:!1},poolQuoteTokenAccount:{value:T.poolQuoteTokenAccount??null,isWritable:!1},tokenProgram:{value:T.tokenProgram??null,isWritable:!1},token2022Program:{value:T.token2022Program??null,isWritable:!1},eventAuthority:{value:T.eventAuthority??null,isWritable:!1},program:{value:T.program??null,isWritable:!1}},W={...T};if(!$.tokenProgram.value)$.tokenProgram.value="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";let G=JT(Q,"programId");return Object.freeze({accounts:[G($.pool),G($.globalConfig),G($.user),G($.baseMint),G($.quoteMint),G($.lpMint),G($.userBaseTokenAccount),G($.userQuoteTokenAccount),G($.userPoolTokenAccount),G($.poolBaseTokenAccount),G($.poolQuoteTokenAccount),G($.tokenProgram),G($.token2022Program),G($.eventAuthority),G($.program)],data:MS().encode(W),programAddress:Q})}var Iy=new Uint8Array([241,154,109,4,17,177,109,188]);function kS(){return V0([["discriminator",E0(b0(),8)],["poolBump",D8()],["index",fU()],["creator",Y0()],["baseMint",Y0()],["quoteMint",Y0()],["lpMint",Y0()],["poolBaseTokenAccount",Y0()],["poolQuoteTokenAccount",Y0()],["lpSupply",L1()]])}function zS(T){return H8(T,kS())}async function uQ(T,A,Q){let J=await FS(T,A,Q);return j8(J),J}async function FS(T,A,Q){let J=await V8(T,A,Q);return zS(J)}var wy=new Uint8Array([149,8,156,202,160,252,176,217]);function NS(){return V0([["discriminator",E0(b0(),8)],["admin",Y0()],["lpFeeBasisPoints",L1()],["protocolFeeBasisPoints",L1()],["disableFlags",D8()],["protocolFeeRecipients",F6(Y0(),{size:8})]])}function IS(T){return H8(T,NS())}async function dQ(T,A,Q){let J=await SS(T,A,Q);return j8(J),J}async function SS(T,A,Q){let J=await V8(T,A,Q);return IS(J)}var cW=0;async function aP(T){let{user:A,baseMint:Q,quoteMint:J,index:$=cW,poolAddress:W,poolCreator:G,maxBaseIn:Y,maxQuoteIn:Z,minLpOut:C=0n,tokenProgram:K=j0,token2022Program:j=q2}=T;if(Y<=0n)throw Error("maxBaseIn must be positive");if(Z<=0n)throw Error("maxQuoteIn must be positive");if(C<0n)throw Error("minLpOut cannot be negative");let M=_(A.address),z=_(Q),N=_(J),E=_(K),L=_(j),O=W?_(W):await tA($,_(G??M),z,N),g=await eA(),v=await bW(O),p=await pW(M,v),[c]=await H1({owner:M,tokenProgram:E,mint:z}),[u]=await H1({owner:M,tokenProgram:E,mint:N}),i=await RT(O,z,E),d=await RT(O,N,E),h=await o2();return nP({pool:O,globalConfig:g,user:A,baseMint:z,quoteMint:N,lpMint:v,userBaseTokenAccount:c,userQuoteTokenAccount:u,userPoolTokenAccount:p,poolBaseTokenAccount:i,poolQuoteTokenAccount:d,tokenProgram:E,token2022Program:L,eventAuthority:h,program:_(q0),lpTokenAmountOut:C,maxBaseAmountIn:Y,maxQuoteAmountIn:Z},{programAddress:_(q0)})}async function sP(T){let{user:A,baseMint:Q,quoteMint:J,index:$=cW,poolAddress:W,poolCreator:G,lpAmountIn:Y,minBaseOut:Z=0n,minQuoteOut:C=0n,tokenProgram:K=j0,token2022Program:j=q2}=T;if(Y<=0n)throw Error("lpAmountIn must be positive");if(Z<0n)throw Error("minBaseOut cannot be negative");if(C<0n)throw Error("minQuoteOut cannot be negative");let M=_(A.address),z=_(Q),N=_(J),E=_(K),L=_(j),O=W?_(W):await tA($,_(G??M),z,N),g=await eA(),v=await bW(O),p=await pW(M,v),[c]=await H1({owner:M,tokenProgram:E,mint:z}),[u]=await H1({owner:M,tokenProgram:E,mint:N}),i=await RT(O,z,E),d=await RT(O,N,E),h=await o2();return oP({pool:O,globalConfig:g,user:A,baseMint:z,quoteMint:N,lpMint:v,userBaseTokenAccount:c,userQuoteTokenAccount:u,userPoolTokenAccount:p,poolBaseTokenAccount:i,poolQuoteTokenAccount:d,tokenProgram:E,token2022Program:L,eventAuthority:h,program:_(q0),lpTokenAmountIn:Y,minBaseAmountOut:Z,minQuoteAmountOut:C},{programAddress:_(q0)})}async function tP(T){let{user:A,baseMint:Q,quoteMint:J,tokenAmountOut:$,maxQuoteIn:W,rpc:G,allowTrackVolume:Y=!0,commitment:Z}=T;if($<=0n)throw Error("tokenAmountOut must be positive");if(W<=0n)throw Error("maxQuoteIn must be positive");let C=Z??M1(),K=_(A.address),j=_(Q),M=_(J),z=_(j0),N=await Tq(T,K),{poolData:E,globalConfigData:L,globalConfigAddress:O,coinCreator:g}=await Aq(G,N,C),v=Qq(L.protocolFeeRecipients);if(!v)throw Error("Global config does not define a protocol fee recipient");let[p]=await H1({owner:K,tokenProgram:z,mint:j}),[c]=await H1({owner:K,tokenProgram:z,mint:M}),u=await RT(N,j,z),i=await RT(N,M,z),[d]=await H1({owner:v,tokenProgram:z,mint:M}),h=await o2(),o=g?_(g):E.creator,n=await uW(o),x=await dW(n,M,z),[R,U]=Y?await Promise.all([dP(),cP(K)]):[void 0,void 0],X=await lW(),q=rP({pool:N,user:A,globalConfig:O,baseMint:j,quoteMint:M,userBaseTokenAccount:p,userQuoteTokenAccount:c,poolBaseTokenAccount:u,poolQuoteTokenAccount:i,protocolFeeRecipient:v,protocolFeeRecipientTokenAccount:d,baseTokenProgram:z,quoteTokenProgram:z,systemProgram:_(f8),associatedTokenProgram:_(K2),eventAuthority:h,program:_(q0),baseAmountOut:$,maxQuoteAmountIn:W},{programAddress:_(q0)}),H=new Set([N,p,c,u,i,d].map((I)=>_(I))),V=q.accounts.map((I)=>H.has(_(I.address))?{...I,role:$1.WRITABLE}:I),F=[{address:x,role:$1.WRITABLE},{address:n,role:$1.READONLY},...Y&&R&&U?[{address:R,role:$1.WRITABLE},{address:U,role:$1.WRITABLE}]:[],{address:X,role:$1.READONLY},{address:_(OT),role:$1.READONLY}];return{programAddress:q.programAddress,accounts:[...V,...F],data:q.data}}async function eP(T){let{user:A,baseMint:Q,quoteMint:J,tokenAmountIn:$,minQuoteOut:W,rpc:G,commitment:Y}=T;if($<=0n)throw Error("tokenAmountIn must be positive");if(W<=0n)throw Error("minQuoteOut must be positive");let Z=Y??M1(),C=_(A.address),K=_(Q),j=_(J),M=_(j0),z=await Tq(T,C),{poolData:N,globalConfigData:E,globalConfigAddress:L,coinCreator:O}=await Aq(G,z,Z),g=Qq(E.protocolFeeRecipients);if(!g)throw Error("Global config does not define a protocol fee recipient");let[v]=await H1({owner:C,tokenProgram:M,mint:K}),[p]=await H1({owner:C,tokenProgram:M,mint:j}),c=await RT(z,K,M),u=await RT(z,j,M),[i]=await H1({owner:g,tokenProgram:M,mint:j}),d=await o2(),h=O?_(O):N.creator,o=await uW(h),n=await dW(o,j,M),x=await lW(),R=iP({pool:z,user:A,globalConfig:L,baseMint:K,quoteMint:j,userBaseTokenAccount:v,userQuoteTokenAccount:p,poolBaseTokenAccount:c,poolQuoteTokenAccount:u,protocolFeeRecipient:g,protocolFeeRecipientTokenAccount:i,baseTokenProgram:M,quoteTokenProgram:M,systemProgram:_(f8),associatedTokenProgram:_(K2),eventAuthority:d,program:_(q0),baseAmountIn:$,minQuoteAmountOut:W},{programAddress:_(q0)}),U=new Set([z,v,p,c,u,i].map((H)=>_(H))),X=R.accounts.map((H)=>U.has(_(H.address))?{...H,role:$1.WRITABLE}:H),q=[{address:n,role:$1.WRITABLE},{address:o,role:$1.READONLY},{address:x,role:$1.READONLY},{address:_(OT),role:$1.READONLY}];return{programAddress:R.programAddress,accounts:[...X,...q],data:R.data}}async function Tq(T,A){if(T.poolAddress)return _(T.poolAddress);let Q=T.index??cW,J=_(T.poolCreator??A);return await tA(Q,J,_(T.baseMint),_(T.quoteMint))}async function Aq(T,A,Q){let J=await eA(),[$,W]=await Promise.all([uQ(T,A,{commitment:Q}),dQ(T,J,{commitment:Q})]),G;try{let Y=await BT($.data.baseMint);G=(await k8(T,Y,{commitment:Q})).data.creator}catch{G=void 0}return{poolData:$.data,globalConfigData:W.data,globalConfigAddress:J,coinCreator:G}}function Qq(T){let A=T.filter(Boolean);return A.length>0?_(A[0]):null}function LS(T){let{owner:A,amount:Q,payer:J=A,associatedTokenAddress:$,createAta:W=!0,autoClose:G=!1}=T;if(Q<=0n)throw Error("Amount must be positive when wrapping SOL");let Y=fW(A),Z=fW(J),C=$?new a($):i2(new a(uT),Y,!1,AT,lT),K=[],j=[];if(W)K.push(a2(mQ(Z,C,Y,new a(uT))));if(K.push(a2(K0.transfer({fromPubkey:Z,toPubkey:C,lamports:Number(Q)}))),K.push(a2(gP(C))),G)j.push(a2(mW(C,Z,Y)));return{prepend:K,append:j,associatedTokenAddress:_(C.toBase58())}}function wS(T,A){let Q=fW(T),J=A?new a(A):i2(new a(uT),Q,!1,AT,lT);return[a2(mW(J,Q,Q))]}function fW(T){if(typeof T==="string")return new a(T);if(typeof T==="object"&&"address"in T)return new a(T.address);return new a(T)}function a2(T){return{programAddress:_(T.programId.toBase58()),accounts:T.keys.map((A)=>({address:_(A.pubkey.toBase58()),role:A.isSigner?A.isWritable?$1.WRITABLE_SIGNER:$1.READONLY_SIGNER:A.isWritable?$1.WRITABLE:$1.READONLY})),data:T.data}}var uT="So11111111111111111111111111111111111111112";var cQ=_(j0),fQ=10000n,ES=10000n,Wq=(T,A)=>{if(!Number.isFinite(T)||T<=0)throw Error(`${A} must be a positive number`)},Gq=(T)=>_(T??uT);async function Uq(T){Wq(T.solAmount,"solAmount");let A=T.slippageBps??$T;WT(A);let Q=T.commitment??M1(),J=Gq(T.quoteMint),$=_(T.mint),W=xT(T.solAmount),G=await Zq({rpc:T.rpc,mint:$,quoteMint:J,commitment:Q,poolAddress:T.poolAddress,poolCreator:T.poolCreator,poolIndex:T.poolIndex}),Y=Pq(G.globalConfigData),Z=qq(W,Y);if(Z<=0n)throw Error("Effective quote input after fees is zero");let C=gS(Z,G.baseReserve,G.quoteReserve);if(C<=0n)throw Error("SOL amount is too small to purchase any tokens from the AMM");if(C>=G.baseReserve)C=G.baseReserve-1n;if(C<=0n)throw Error("AMM pool does not have enough base liquidity for this trade");let K=$q(C,G.quoteReserve,G.baseReserve,Y);while(K>W&&C>0n)C-=1n,K=$q(C,G.quoteReserve,G.baseReserve,Y);if(C<=0n||K<=0n)throw Error("Unable to satisfy AMM buy with the provided SOL budget");let j=iT(K,A),{createInstruction:M}=await vS({rpc:T.rpc,owner:T.user,mint:$}),z=await tP({user:T.user,baseMint:$,quoteMint:J,tokenAmountOut:C,maxQuoteIn:j,poolAddress:G.poolAddress,poolCreator:G.poolCreator,index:Number(G.poolData.index),allowTrackVolume:T.allowTrackVolume,rpc:T.rpc,commitment:Q});if(M){let N=Object.assign({},z);return N.prepend=[M,...N.prepend??[]],N}return z}async function Yq(T){let A=T.slippageBps??$T;WT(A);let Q=T.commitment??M1(),J=Gq(T.quoteMint),$=_(T.mint),W=await Zq({rpc:T.rpc,mint:$,quoteMint:J,commitment:Q,poolAddress:T.poolAddress,poolCreator:T.poolCreator,poolIndex:T.poolIndex}),G=await yS({params:T,rpc:T.rpc,mint:$});if(G<=0n)throw Error("Token amount must be positive");if(G>=W.baseReserve)throw Error("Token amount exceeds available AMM base liquidity");let Y=Pq(W.globalConfigData),Z=qq(G,Y);if(Z<=0n)throw Error("Effective base input after fees is zero");let C=mS(Z,W.baseReserve,W.quoteReserve);if(C<=0n)throw Error("AMM pool produced zero quote output");let K=n8(C,A);if(K<=0n)throw Error("Slippage settings would result in zero SOL output");return eP({user:T.user,baseMint:$,quoteMint:J,tokenAmountIn:G,minQuoteOut:K,poolAddress:W.poolAddress,poolCreator:W.poolCreator,index:Number(W.poolData.index),allowTrackVolume:T.allowTrackVolume,rpc:T.rpc,commitment:Q})}var OS=8;async function Zq(T){let{poolAccount:A,globalConfigAccount:Q,poolAddress:J,poolCreator:$,coinCreator:W}=await _S(T),[G,Y]=await Promise.all([RT(J,T.mint,cQ),RT(J,T.quoteMint,cQ)]),Z=await hS(T.rpc,G,Y);return{poolAddress:J,poolCreator:$,coinCreator:W,poolData:A.data,globalConfigData:Q.data,baseReserve:Z.baseReserve,quoteReserve:Z.quoteReserve}}var Xq=43,BS=Xq+32,Jq=(T)=>_(T);async function _S(T){let{rpc:A,mint:Q,quoteMint:J,commitment:$,poolAddress:W,poolCreator:G,poolIndex:Y}=T,Z=W?_(W):void 0,C=G?_(G):void 0,K;try{let E=await BT(Q);K=(await k8(A,E,{commitment:$})).data.creator}catch{K=void 0}let j=await eA(),M=async(E)=>{try{return await uQ(A,E,{commitment:$})}catch(L){if(xS(L))return null;throw L}},z=null;if(Z)z=await M(Z);if(!z&&C){let E=Y!==void 0?[Y]:Array.from({length:OS},(L,O)=>O);for(let L of E){let O=await tA(L,C,Q,J),g=await M(O);if(g){Z=O,z=g;break}}}if(!z){let E=[{memcmp:{offset:BigInt(Xq),bytes:Jq(Q),encoding:"base58"}},{memcmp:{offset:BigInt(BS),bytes:Jq(J),encoding:"base58"}}],O=await A.getProgramAccounts(_(q0),{commitment:$,encoding:"base64",filters:E}).send()??[];for(let g of O){let v=_(g.pubkey),p=await M(v);if(!p)continue;Z=v,C=p.data.creator,z=p;break}}if(!z||!Z)throw Error(`Unable to locate AMM pool for mint ${Q}. Provide poolAddress or poolIndex explicitly.`);let N=await dQ(A,j,{commitment:$});if(!C)C=z.data.creator;if(!K)K=z.data.creator;return{poolAccount:z,globalConfigAccount:N,poolAddress:Z,poolCreator:C,coinCreator:K}}function xS(T){if(!(T instanceof Error))return!1;if(T.message.toLowerCase().includes("account not found"))return!0;return T?.context?.__code===4100}async function hS(T,A,Q){let[J,$]=await Promise.all([T.getTokenAccountBalance(A).send(),T.getTokenAccountBalance(Q).send()]);return{baseReserve:BigInt(J.value.amount),quoteReserve:BigInt($.value.amount)}}function Pq(T){return BigInt(T.lpFeeBasisPoints??0n)+BigInt(T.protocolFeeBasisPoints??0n)}function qq(T,A){let Q=fQ-A;if(Q<=0n)return 0n;return T*Q/fQ}function gS(T,A,Q){let J=Q+T;if(J<=0n)throw Error("Invalid AMM reserves (denominator is zero)");return T*A/J}function $q(T,A,Q,J){if(T<=0n)return 0n;if(T>=Q)throw Error("Requested token amount exceeds pool reserves");let $=T*A/(Q-T);if($<=0n)return 0n;let W=fQ-J;if(W<=0n)throw Error("Invalid AMM fee configuration");return($*fQ+(W-1n))/W}function mS(T,A,Q){let J=A+T;if(J<=0n)throw Error("Invalid AMM reserves (denominator is zero)");return T*Q/J}async function vS({rpc:T,owner:A,mint:Q}){let[J]=await H1({owner:_(A.address),mint:Q,tokenProgram:cQ}),$;try{if(!(await T.getAccountInfo(J,{encoding:"base64"}).send()).value)$=aA({payer:A,owner:A,mint:Q})}catch{$=aA({payer:A,owner:A,mint:Q})}return{userAta:J,createInstruction:$}}async function yS({params:T,rpc:A,mint:Q}){let J=T.useWalletPercentage??!1,$=T.tokenDecimals??6;if(J){let W=T.walletPercentage??100,G=pS(W),Y=await bS(A,T.user,Q);if(Y===0n)throw Error("Wallet token balance is zero; nothing to sell");let Z=Y*G/ES;if(Z<=0n)Z=1n;return Z}if(T.tokenAmount===void 0)throw Error("tokenAmount is required when useWalletPercentage is false");return Wq(T.tokenAmount,"tokenAmount"),i8(T.tokenAmount,$)}async function bS(T,A,Q){let[J]=await H1({owner:_(A.address),mint:Q,tokenProgram:cQ}),$=await T.getTokenAccountBalance(J).send();return BigInt($.value.amount)}function pS(T){if(!Number.isFinite(T)||T<=0||T>100)throw Error("walletPercentage must be between 0 and 100");return BigInt(Math.round(T*100))}var lS=pQ,uS=lQ;async function rW(T){let{user:A,mint:Q,mintAuthority:J,name:$,symbol:W,uri:G,firstBuyTokenAmount:Y,estimatedFirstBuyCost:Z,slippageBps:C=$T,feeRecipient:K=_T,bondingCurveCreator:j,trackVolume:M,rpc:z,commitment:N=M1()}=T;if(WT(C),!$||$.length===0)throw Error("Token name is required");if(!W||W.length===0)throw Error("Token symbol is required");if(!G||G.length===0)throw Error("Metadata URI is required");if(Y<=0n)throw Error("First buy token amount must be positive");if(Z<=0n)throw Error("Estimated first buy cost must be positive");let E=await ZZ({user:A,mint:Q,mintAuthority:J,name:$,symbol:W,uri:G}),L=iT(Z,C),O=await H2({user:A,mint:Q.address,tokenAmount:Y,maxSolCostLamports:L,feeRecipient:K,trackVolume:M??!0,bondingCurveCreator:j??A.address,rpc:z,commitment:N});return{createInstruction:E,buyInstruction:O}}function dS(T){let{name:A,symbol:Q,uri:J}=T;if(!A||A.length===0)throw Error("Token name is required");if(A.length>32)throw Error("Token name too long (max 32 characters)");if(!Q||Q.length===0)throw Error("Token symbol is required");if(Q.length>10)throw Error("Token symbol too long (max 10 characters)");if(!J||J.length===0)throw Error("Metadata URI is required");if(!J.startsWith("http://")&&!J.startsWith("https://")&&!J.startsWith("ipfs://"))throw Error("Metadata URI must be a valid URL or IPFS link")}var Kq=_("ComputeBudget111111111111111111111111111111");async function nW({instructions:T,payer:A,additionalSigners:Q=[],latestBlockhash:J,lastValidBlockHeight:$,version:W="legacy",rpc:G,commitment:Y=M1(),prependInstructions:Z=[],appendInstructions:C=[],priorityFees:K}){let j=typeof A==="string"?_(A):A.address,M=MY({version:W}),z=Cq(K),N=[],E=[];for(let d of T)if("prepend"in d&&Array.isArray(d.prepend)){N.push(...d.prepend);let{prepend:h,...o}=d;E.push(o)}else E.push(d);let L=[...z,...N,...Z??[],...E,...C??[]],O=new Map;for(let d of L)if(M=FY(d,M),d.accounts){for(let h of d.accounts)if("signer"in h&&h.signer&&typeof h.signer==="object"&&"address"in h.signer){let o=h.signer;O.set(o.address,o)}}let g=zY(j,M),v=[];if(fS(A))g=nY(A,g),v.push(A);for(let d of O.values())if(!v.some((h)=>h.address===d.address))v.push(d);if(Q.length>0){for(let d of Q)if(ET(d)&&!v.some((h)=>h.address===d.address))v.push(d)}let p=v.length>0?rY(v,g):g,c=J,u=$!==void 0?BigInt($):void 0;if(!c||u===void 0){let{value:d}=await G.getLatestBlockhash({commitment:Y}).send();if(c=c??d.blockhash,u===void 0)u=BigInt(d.lastValidBlockHeight)}return{transactionMessage:VY({blockhash:c,lastValidBlockHeight:u},p),latestBlockhash:c,lastValidBlockHeight:u}}async function iW({instructions:T,payer:A,additionalSigners:Q=[],latestBlockhash:J,lastValidBlockHeight:$,version:W,prependInstructions:G,appendInstructions:Y,priorityFees:Z,rpc:C,rpcSubscriptions:K,commitment:j=M1(),sendOptions:M={}}){let z=await nW({instructions:T,payer:A,additionalSigners:Q,latestBlockhash:J,lastValidBlockHeight:$,version:W,prependInstructions:G,appendInstructions:Y,priorityFees:Z,rpc:C,commitment:j}),N=await SJ(z.transactionMessage),E=X2(N),L=tY({rpc:C,rpcSubscriptions:K}),O={commitment:j};if(M.abortSignal)O.abortSignal=M.abortSignal;if(M.skipPreflight!==void 0)O.skipPreflight=M.skipPreflight;if(M.minContextSlot!==void 0)O.minContextSlot=BigInt(M.minContextSlot);if(M.maxRetries!==void 0)O.maxRetries=M.maxRetries;if(M.preflightCommitment)O.preflightCommitment=M.preflightCommitment;await L(N,O);let v=(await C.getSignatureStatuses([E],{searchTransactionHistory:!1}).send()).value?.[0]??null;if(v?.err)try{let c=await C.getTransaction(E,{commitment:j,encoding:"json",maxSupportedTransactionVersion:0}).send(),u="Transaction failed";if(v.err)u=`Transaction failed: ${typeof v.err==="object"?JSON.stringify(v.err,(d,h)=>typeof h==="bigint"?h.toString():h):String(v.err)}`;if(c?.meta?.err)u=`Transaction failed: ${typeof c.meta.err==="object"?JSON.stringify(c.meta.err,(d,h)=>typeof h==="bigint"?h.toString():h):String(c.meta.err)}`;if(c?.meta?.logMessages){let i=c.meta.logMessages.filter((d)=>d.toLowerCase().includes("error")||d.includes("Program log:"));if(i.length>0)u+=`
|
|
21
21
|
Program logs:
|
|
22
|
-
${
|
|
23
|
-
`)}`}throw Error(
|
|
22
|
+
${i.slice(0,10).join(`
|
|
23
|
+
`)}`}throw Error(u)}catch{let p=v.err&&typeof v.err==="object"?JSON.stringify(v.err,(c,u)=>typeof u==="bigint"?u.toString():u):String(v.err);throw Error(`Transaction failed: ${p}`)}return{signature:E,slot:v?.slot??null}}async function cS({instructions:T,payer:A,additionalSigners:Q=[],latestBlockhash:J,lastValidBlockHeight:$,version:W,prependInstructions:G,appendInstructions:Y,priorityFees:Z,rpc:C,commitment:K=M1(),options:j={}}){let M=await nW({instructions:T,payer:A,additionalSigners:Q,latestBlockhash:J,lastValidBlockHeight:$,version:W,prependInstructions:G,appendInstructions:Y,priorityFees:Z,rpc:C,commitment:K}),z=await SJ(M.transactionMessage),N=B6(z),E={commitment:j.commitment??K};if(j.minContextSlot!==void 0)E.minContextSlot=BigInt(j.minContextSlot);if(j.sigVerify!==void 0)E.sigVerify=j.sigVerify;if(j.replaceRecentBlockhash!==void 0){if(j.sigVerify)throw Error("replaceRecentBlockhash cannot be true when sigVerify is enabled.");E.replaceRecentBlockhash=j.replaceRecentBlockhash}if(j.accounts)E.accounts=j.accounts;let L=await C.simulateTransaction(N,E).send();return{context:{slot:Number(L.context.slot)},value:{err:L.value.err,logs:L.value.logs,unitsConsumed:L.value.unitsConsumed!==void 0?Number(L.value.unitsConsumed):void 0,accounts:L.value.accounts,returnData:L.value.returnData??void 0}}}function fS(T){return typeof T!=="string"&&ET(T)}function Cq(T){if(!T)return[];let A=[];if(T.computeUnitLimit!==void 0&&T.computeUnitLimit>0)A.push(rS(T.computeUnitLimit));if(T.computeUnitPriceMicroLamports!==void 0&&BigInt(T.computeUnitPriceMicroLamports)>0n)A.push(nS(BigInt(T.computeUnitPriceMicroLamports)));return A}function rS(T){let A=new Uint8Array(5);return A[0]=0,new DataView(A.buffer).setUint32(1,T,!0),{programAddress:Kq,accounts:[],data:A}}function nS(T){let A=new Uint8Array(9);return A[0]=3,new DataView(A.buffer).setBigUint64(1,T,!0),{programAddress:Kq,accounts:[],data:A}}async function iS(T){let{creator:A,metadata:Q,firstBuyTokenAmount:J,estimatedFirstBuyCost:$,slippageBps:W,feeRecipient:G,bondingCurveCreator:Y,mintAuthority:Z,mint:C,priorityFees:K,prependInstructions:j,appendInstructions:M,additionalSigners:z,sendOptions:N,commitment:E=M1(),rpc:L,rpcSubscriptions:O}=T,g=C??await iY(),v={user:A,mint:g,mintAuthority:Z??A.address,name:Q.name,symbol:Q.symbol,uri:Q.uri,firstBuyTokenAmount:J,estimatedFirstBuyCost:$,slippageBps:W,feeRecipient:G,bondingCurveCreator:Y??A.address,rpc:L,commitment:E},{createInstruction:p,buyInstruction:c}=await rW(v);return{...await iW({instructions:[p,c],payer:A,commitment:E,priorityFees:K,prependInstructions:j,appendInstructions:M,additionalSigners:oS([g,...z??[]]),sendOptions:N,rpc:L,rpcSubscriptions:O}),mint:g,createInstruction:p,buyInstruction:c}}function oS(T){let A=new Set,Q=[];for(let J of T){let $=J.address;if(!A.has($))A.add($),Q.push(J)}return Q}var aS=uT;async function Hq(T){let{user:A,baseMint:Q,quoteMint:J=uT,poolIndex:$,poolAddress:W,poolCreator:G,maxBaseAmountIn:Y,maxQuoteAmountIn:Z,minLpTokensOut:C,tokenProgram:K,token2022Program:j}=T;if(Y<=0n)throw Error("maxBaseAmountIn must be positive");if(Z<=0n)throw Error("maxQuoteAmountIn must be positive");return await aP({user:A,baseMint:Q,quoteMint:J,index:$,poolAddress:W,poolCreator:G,maxBaseIn:Y,maxQuoteIn:Z,minLpOut:C??0n,tokenProgram:K,token2022Program:j})}async function Vq(T){let{user:A,baseMint:Q,quoteMint:J=uT,poolIndex:$,poolAddress:W,poolCreator:G,lpAmountIn:Y,minBaseAmountOut:Z,minQuoteAmountOut:C,tokenProgram:K,token2022Program:j}=T;if(Y<=0n)throw Error("lpAmountIn must be positive");return await sP({user:A,baseMint:Q,quoteMint:J,index:$,poolAddress:W,poolCreator:G,lpAmountIn:Y,minBaseOut:Z??0n,minQuoteOut:C??0n,tokenProgram:K,token2022Program:j})}async function sS(T,A,Q,J,$={}){return Hq({user:T,baseMint:A,maxBaseAmountIn:Q,maxQuoteAmountIn:J,...$})}async function tS(T,A,Q,J={}){return Vq({user:T,baseMint:A,lpAmountIn:Q,...J})}class oW{connection;programId;commitment;listeners=new Map;nextListenerId=1;subscriptionId=null;constructor(T,A={}){this.connection=T,this.programId=new a(A.programId??a0),this.commitment=A.commitment??"confirmed"}addEventListener(T,A){let Q=this.nextListenerId++;return this.listeners.set(Q,{id:Q,type:T,callback:A}),this.ensureSubscription(),Q}removeEventListener(T){if(this.listeners.delete(T),this.listeners.size===0)this.teardownSubscription()}ensureSubscription(){if(this.subscriptionId!==null)return;let T=(A,Q)=>{this.dispatch(A,Q.slot)};try{let A=this.connection.onLogs(this.programId,T,this.commitment);this.subscriptionId=A}catch(A){console.error("Failed to subscribe to Pump.fun logs",A)}}async teardownSubscription(){if(this.subscriptionId!==null){try{await this.connection.removeOnLogsListener(this.subscriptionId)}catch(T){console.warn("Failed to remove Pump.fun log listener",T)}this.subscriptionId=null}}dispatch(T,A){let Q=T.signature??"";for(let J of T.logs){let $=T3(J,A,Q);for(let W of this.listeners.values())if(W.type==="raw"||W.type===$.type)W.callback($)}}}var eS={create:["createEvent","create_event"],trade:["tradeEvent","trade_event"],complete:["completeEvent","complete_event"],raw:[]};function T3(T,A,Q){let J="raw";for(let[G,Y]of Object.entries(eS)){if(G==="raw")continue;if(Y.some((Z)=>T.includes(Z))){J=G;break}}let $,W=T.indexOf("{");if(W!==-1){let G=T.slice(W);try{$=JSON.parse(G)}catch{$=void 0}}return{type:J,slot:A,signature:Q,rawLog:T,parsed:$}}function A3(T,A={}){return new oW(T,A)}export{WT as validateSlippage,dS as validateMintParams,n8 as subSlippage,cS as simulateTransaction,I5 as setDefaultCommitment,iW as sendAndConfirmTransaction,u5 as sellWithSlippage,gJ as sellSimple,uS as sell,Vq as removeLiquidity,tS as quickRemoveLiquidity,sS as quickAddLiquidity,y5 as percentToBps,rW as mintWithFirstBuy,M1 as getDefaultCommitment,lQ as curveSell,pQ as curveBuy,A3 as createPumpEventManager,iS as createAndBuy,l5 as buyWithSlippage,hJ as buySimple,lS as buy,LS as buildWrapSolInstructions,wS as buildUnwrapSolInstructions,nW as buildTransaction,Cq as buildPriorityFeeInstructions,b5 as bpsToPercent,Yq as ammSell,Uq as ammBuy,iT as addSlippage,Hq as addLiquidity,uT as WSOL_ADDRESS,aS as WSOL,oW as PumpEventManager,$T as DEFAULT_SLIPPAGE_BPS};
|