pump-kit 0.0.8 → 0.1.1
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/README.md +60 -45
- package/dist/index.js +12 -12
- package/dist/types/ammsdk/bondingCurveMath.d.ts +1 -1
- package/dist/types/ammsdk/generated/accounts/globalConfig.d.ts +4 -6
- package/dist/types/ammsdk/generated/accounts/index.d.ts +0 -4
- package/dist/types/ammsdk/generated/accounts/pool.d.ts +0 -2
- package/dist/types/ammsdk/generated/errors/pumpAmm.d.ts +29 -55
- package/dist/types/ammsdk/generated/index.d.ts +1 -1
- package/dist/types/ammsdk/generated/instructions/buy.d.ts +14 -67
- package/dist/types/ammsdk/generated/instructions/createConfig.d.ts +5 -26
- package/dist/types/ammsdk/generated/instructions/createPool.d.ts +12 -42
- package/dist/types/ammsdk/generated/instructions/deposit.d.ts +10 -33
- package/dist/types/ammsdk/generated/instructions/disable.d.ts +2 -16
- package/dist/types/ammsdk/generated/instructions/extendAccount.d.ts +2 -12
- package/dist/types/ammsdk/generated/instructions/index.d.ts +0 -9
- package/dist/types/ammsdk/generated/instructions/sell.d.ts +14 -54
- package/dist/types/ammsdk/generated/instructions/updateAdmin.d.ts +2 -12
- package/dist/types/ammsdk/generated/instructions/updateFeeConfig.d.ts +2 -22
- package/dist/types/ammsdk/generated/instructions/withdraw.d.ts +10 -33
- package/dist/types/ammsdk/generated/programs/pumpAmm.d.ts +15 -46
- package/dist/types/ammsdk/generated/types/buyEvent.d.ts +4 -25
- package/dist/types/ammsdk/generated/types/createConfigEvent.d.ts +0 -4
- package/dist/types/ammsdk/generated/types/createPoolEvent.d.ts +0 -2
- package/dist/types/ammsdk/generated/types/globalConfig.d.ts +49 -0
- package/dist/types/ammsdk/generated/types/index.d.ts +2 -12
- package/dist/types/ammsdk/generated/types/pool.d.ts +35 -0
- package/dist/types/ammsdk/generated/types/sellEvent.d.ts +0 -6
- package/dist/types/ammsdk/generated/types/updateFeeConfigEvent.d.ts +0 -4
- package/dist/types/clients/amm.d.ts +10 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/types/pda/pumpAmm.d.ts +4 -0
- package/dist/types/pumpsdk/generated/index.d.ts +1 -1
- package/dist/types/simple.d.ts +2 -2
- package/dist/types/swap/amm.d.ts +35 -0
- package/dist/types/swap/curve.d.ts +36 -0
- package/dist/types/swap.d.ts +10 -49
- package/package.json +3 -3
- package/dist/types/ammsdk/generated/accounts/bondingCurve.d.ts +0 -39
- package/dist/types/ammsdk/generated/accounts/feeConfig.d.ts +0 -33
- package/dist/types/ammsdk/generated/accounts/globalVolumeAccumulator.d.ts +0 -37
- package/dist/types/ammsdk/generated/accounts/userVolumeAccumulator.d.ts +0 -39
- package/dist/types/ammsdk/generated/instructions/adminSetCoinCreator.d.ts +0 -63
- package/dist/types/ammsdk/generated/instructions/adminUpdateTokenIncentives.d.ts +0 -99
- package/dist/types/ammsdk/generated/instructions/buyExactQuoteIn.d.ts +0 -144
- package/dist/types/ammsdk/generated/instructions/claimTokenIncentives.d.ts +0 -86
- package/dist/types/ammsdk/generated/instructions/closeUserVolumeAccumulator.d.ts +0 -54
- package/dist/types/ammsdk/generated/instructions/collectCoinCreatorFee.d.ts +0 -70
- package/dist/types/ammsdk/generated/instructions/initUserVolumeAccumulator.d.ts +0 -62
- package/dist/types/ammsdk/generated/instructions/setCoinCreator.d.ts +0 -58
- package/dist/types/ammsdk/generated/instructions/syncUserVolumeAccumulator.d.ts +0 -58
- package/dist/types/ammsdk/generated/types/adminSetCoinCreatorEvent.d.ts +0 -27
- package/dist/types/ammsdk/generated/types/adminUpdateTokenIncentivesEvent.d.ts +0 -29
- package/dist/types/ammsdk/generated/types/claimTokenIncentivesEvent.d.ts +0 -27
- package/dist/types/ammsdk/generated/types/closeUserVolumeAccumulatorEvent.d.ts +0 -27
- package/dist/types/ammsdk/generated/types/collectCoinCreatorFeeEvent.d.ts +0 -25
- package/dist/types/ammsdk/generated/types/feeTier.d.ts +0 -20
- package/dist/types/ammsdk/generated/types/fees.d.ts +0 -21
- package/dist/types/ammsdk/generated/types/initUserVolumeAccumulatorEvent.d.ts +0 -21
- package/dist/types/ammsdk/generated/types/optionBool.d.ts +0 -13
- package/dist/types/ammsdk/generated/types/setBondingCurveCoinCreatorEvent.d.ts +0 -25
- package/dist/types/ammsdk/generated/types/setMetaplexCoinCreatorEvent.d.ts +0 -25
- package/dist/types/ammsdk/generated/types/syncUserVolumeAccumulatorEvent.d.ts +0 -23
package/dist/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
var mq=Object.create;var{getPrototypeOf:gq,defineProperty:l8,getOwnPropertyNames:TG,getOwnPropertyDescriptor:vq}=Object,AG=Object.prototype.hasOwnProperty;var yT=(T,A,P)=>{P=T!=null?mq(gq(T)):{};let Q=A||!T||!T.__esModule?l8(P,"default",{value:T,enumerable:!0}):P;for(let C of TG(T))if(!AG.call(Q,C))l8(Q,C,{get:()=>T[C],enumerable:!0});return Q},eW=new WeakMap,G8=(T)=>{var A=eW.get(T),P;if(A)return A;if(A=l8({},"__esModule",{value:!0}),T&&typeof T==="object"||typeof T==="function")TG(T).map((Q)=>!AG.call(A,Q)&&l8(A,Q,{get:()=>T[Q],enumerable:!(P=vq(T,Q))||P.enumerable}));return eW.set(T,A),A},T0=(T,A)=>()=>(A||T((A={exports:{}}).exports,A),A.exports);var s4=(T,A)=>{for(var P in A)l8(T,P,{get:A[P],enumerable:!0,configurable:!0,set:(Q)=>A[P]=()=>Q})};var jT=(T,A)=>()=>(T&&(A=T(T=0)),A);var QG=T0((cq)=>{cq.byteLength=bq;cq.toByteArray=pq;cq.fromByteArray=rq;var R0=[],A0=[],yq=typeof Uint8Array<"u"?Uint8Array:Array,t4="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for($A=0,e4=t4.length;$A<e4;++$A)R0[$A]=t4[$A],A0[t4.charCodeAt($A)]=$A;var $A,e4;A0[45]=62;A0[95]=63;function PG(T){var A=T.length;if(A%4>0)throw Error("Invalid string. Length must be a multiple of 4");var P=T.indexOf("=");if(P===-1)P=A;var Q=P===A?0:4-P%4;return[P,Q]}function bq(T){var A=PG(T),P=A[0],Q=A[1];return(P+Q)*3/4-Q}function lq(T,A,P){return(A+P)*3/4-P}function pq(T){var A,P=PG(T),Q=P[0],C=P[1],W=new yq(lq(T,Q,C)),G=0,J=C>0?Q-4:Q,$;for($=0;$<J;$+=4)A=A0[T.charCodeAt($)]<<18|A0[T.charCodeAt($+1)]<<12|A0[T.charCodeAt($+2)]<<6|A0[T.charCodeAt($+3)],W[G++]=A>>16&255,W[G++]=A>>8&255,W[G++]=A&255;if(C===2)A=A0[T.charCodeAt($)]<<2|A0[T.charCodeAt($+1)]>>4,W[G++]=A&255;if(C===1)A=A0[T.charCodeAt($)]<<10|A0[T.charCodeAt($+1)]<<4|A0[T.charCodeAt($+2)]>>2,W[G++]=A>>8&255,W[G++]=A&255;return W}function uq(T){return R0[T>>18&63]+R0[T>>12&63]+R0[T>>6&63]+R0[T&63]}function dq(T,A,P){var Q,C=[];for(var W=A;W<P;W+=3)Q=(T[W]<<16&16711680)+(T[W+1]<<8&65280)+(T[W+2]&255),C.push(uq(Q));return C.join("")}function rq(T){var A,P=T.length,Q=P%3,C=[],W=16383;for(var G=0,J=P-Q;G<J;G+=W)C.push(dq(T,G,G+W>J?J:G+W));if(Q===1)A=T[P-1],C.push(R0[A>>2]+R0[A<<4&63]+"==");else if(Q===2)A=(T[P-2]<<8)+T[P-1],C.push(R0[A>>10]+R0[A>>4&63]+R0[A<<2&63]+"=");return C.join("")}});var CG=T0((iq)=>{/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */iq.read=function(T,A,P,Q,C){var W,G,J=C*8-Q-1,$=(1<<J)-1,X=$>>1,Z=-7,R=P?C-1:0,D=P?-1:1,z=T[A+R];R+=D,W=z&(1<<-Z)-1,z>>=-Z,Z+=J;for(;Z>0;W=W*256+T[A+R],R+=D,Z-=8);G=W&(1<<-Z)-1,W>>=-Z,Z+=Q;for(;Z>0;G=G*256+T[A+R],R+=D,Z-=8);if(W===0)W=1-X;else if(W===$)return G?NaN:(z?-1:1)*(1/0);else G=G+Math.pow(2,Q),W=W-X;return(z?-1:1)*G*Math.pow(2,W-Q)};iq.write=function(T,A,P,Q,C,W){var G,J,$,X=W*8-C-1,Z=(1<<X)-1,R=Z>>1,D=C===23?Math.pow(2,-24)-Math.pow(2,-77):0,z=Q?0:W-1,S=Q?1:-1,E=A<0||A===0&&1/A<0?1:0;if(A=Math.abs(A),isNaN(A)||A===1/0)J=isNaN(A)?1:0,G=Z;else{if(G=Math.floor(Math.log(A)/Math.LN2),A*($=Math.pow(2,-G))<1)G--,$*=2;if(G+R>=1)A+=D/$;else A+=D*Math.pow(2,1-R);if(A*$>=2)G++,$/=2;if(G+R>=Z)J=0,G=Z;else if(G+R>=1)J=(A*$-1)*Math.pow(2,C),G=G+R;else J=A*Math.pow(2,R-1)*Math.pow(2,C),G=0}for(;C>=8;T[P+z]=J&255,z+=S,J/=256,C-=8);G=G<<C|J,X+=C;for(;X>0;T[P+z]=G&255,z+=S,G/=256,X-=8);T[P+z-S]|=E*128}});var O6={};s4(O6,{transcode:()=>Zk,resolveObjectURL:()=>Vk,kStringMaxLength:()=>C$,kMaxLength:()=>A2,isUtf8:()=>qk,isAscii:()=>Yk,default:()=>Xk,constants:()=>yR,btoa:()=>hR,atob:()=>mR,INSPECT_MAX_BYTES:()=>Q$,File:()=>gR,Buffer:()=>L,Blob:()=>vR});function ER(T){var A=T.length;if(A%4>0)throw Error("Invalid string. Length must be a multiple of 4");var P=T.indexOf("=");if(P===-1)P=A;var Q=P===A?0:4-P%4;return[P,Q]}function BR(T,A){return(T+A)*3/4-A}function OR(T){var A,P=ER(T),Q=P[0],C=P[1],W=new Uint8Array(BR(Q,C)),G=0,J=C>0?Q-4:Q,$;for($=0;$<J;$+=4)A=G0[T.charCodeAt($)]<<18|G0[T.charCodeAt($+1)]<<12|G0[T.charCodeAt($+2)]<<6|G0[T.charCodeAt($+3)],W[G++]=A>>16&255,W[G++]=A>>8&255,W[G++]=A&255;if(C===2)A=G0[T.charCodeAt($)]<<2|G0[T.charCodeAt($+1)]>>4,W[G++]=A&255;if(C===1)A=G0[T.charCodeAt($)]<<10|G0[T.charCodeAt($+1)]<<4|G0[T.charCodeAt($+2)]>>2,W[G++]=A>>8&255,W[G++]=A&255;return W}function xR(T){return B0[T>>18&63]+B0[T>>12&63]+B0[T>>6&63]+B0[T&63]}function _R(T,A,P){var Q,C=[];for(var W=A;W<P;W+=3)Q=(T[W]<<16&16711680)+(T[W+1]<<8&65280)+(T[W+2]&255),C.push(xR(Q));return C.join("")}function sJ(T){var A,P=T.length,Q=P%3,C=[],W=16383;for(var G=0,J=P-Q;G<J;G+=W)C.push(_R(T,G,G+W>J?J:G+W));if(Q===1)A=T[P-1],C.push(B0[A>>2]+B0[A<<4&63]+"==");else if(Q===2)A=(T[P-2]<<8)+T[P-1],C.push(B0[A>>10]+B0[A>>4&63]+B0[A<<2&63]+"=");return C.join("")}function E6(T,A,P,Q,C){var W,G,J=C*8-Q-1,$=(1<<J)-1,X=$>>1,Z=-7,R=P?C-1:0,D=P?-1:1,z=T[A+R];R+=D,W=z&(1<<-Z)-1,z>>=-Z,Z+=J;for(;Z>0;W=W*256+T[A+R],R+=D,Z-=8);G=W&(1<<-Z)-1,W>>=-Z,Z+=Q;for(;Z>0;G=G*256+T[A+R],R+=D,Z-=8);if(W===0)W=1-X;else if(W===$)return G?NaN:(z?-1:1)*(1/0);else G=G+Math.pow(2,Q),W=W-X;return(z?-1:1)*G*Math.pow(2,W-Q)}function P$(T,A,P,Q,C,W){var G,J,$,X=W*8-C-1,Z=(1<<X)-1,R=Z>>1,D=C===23?Math.pow(2,-24)-Math.pow(2,-77):0,z=Q?0:W-1,S=Q?1:-1,E=A<0||A===0&&1/A<0?1:0;if(A=Math.abs(A),isNaN(A)||A===1/0)J=isNaN(A)?1:0,G=Z;else{if(G=Math.floor(Math.log(A)/Math.LN2),A*($=Math.pow(2,-G))<1)G--,$*=2;if(G+R>=1)A+=D/$;else A+=D*Math.pow(2,1-R);if(A*$>=2)G++,$/=2;if(G+R>=Z)J=0,G=Z;else if(G+R>=1)J=(A*$-1)*Math.pow(2,C),G=G+R;else J=A*Math.pow(2,R-1)*Math.pow(2,C),G=0}for(;C>=8;T[P+z]=J&255,z+=S,J/=256,C-=8);G=G<<C|J,X+=C;for(;X>0;T[P+z]=G&255,z+=S,G/=256,X-=8);T[P+z-S]|=E*128}function n0(T){if(T>A2)throw RangeError('The value "'+T+'" is invalid for option "size"');let A=new Uint8Array(T);return Object.setPrototypeOf(A,L.prototype),A}function BQ(T,A,P){return class extends P{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(C){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:C,writable:!0})}toString(){return`${this.name} [${T}]: ${this.message}`}}}function L(T,A,P){if(typeof T==="number"){if(typeof A==="string")throw TypeError('The "string" argument must be of type string. Received type number');return OQ(T)}return W$(T,A,P)}function W$(T,A,P){if(typeof T==="string")return uR(T,A);if(ArrayBuffer.isView(T))return dR(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(O0(T,ArrayBuffer)||T&&O0(T.buffer,ArrayBuffer))return LQ(T,A,P);if(typeof SharedArrayBuffer<"u"&&(O0(T,SharedArrayBuffer)||T&&O0(T.buffer,SharedArrayBuffer)))return LQ(T,A,P);if(typeof T==="number")throw TypeError('The "value" argument must not be of type number. Received type number');let Q=T.valueOf&&T.valueOf();if(Q!=null&&Q!==T)return L.from(Q,A,P);let C=rR(T);if(C)return C;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof T[Symbol.toPrimitive]==="function")return L.from(T[Symbol.toPrimitive]("string"),A,P);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T)}function G$(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 pR(T,A,P){if(G$(T),T<=0)return n0(T);if(A!==void 0)return typeof P==="string"?n0(T).fill(A,P):n0(T).fill(A);return n0(T)}function OQ(T){return G$(T),n0(T<0?0:xQ(T)|0)}function uR(T,A){if(typeof A!=="string"||A==="")A="utf8";if(!L.isEncoding(A))throw TypeError("Unknown encoding: "+A);let P=U$(T,A)|0,Q=n0(P),C=Q.write(T,A);if(C!==P)Q=Q.slice(0,C);return Q}function wQ(T){let A=T.length<0?0:xQ(T.length)|0,P=n0(A);for(let Q=0;Q<A;Q+=1)P[Q]=T[Q]&255;return P}function dR(T){if(O0(T,Uint8Array)){let A=new Uint8Array(T);return LQ(A.buffer,A.byteOffset,A.byteLength)}return wQ(T)}function LQ(T,A,P){if(A<0||T.byteLength<A)throw RangeError('"offset" is outside of buffer bounds');if(T.byteLength<A+(P||0))throw RangeError('"length" is outside of buffer bounds');let Q;if(A===void 0&&P===void 0)Q=new Uint8Array(T);else if(P===void 0)Q=new Uint8Array(T,A);else Q=new Uint8Array(T,A,P);return Object.setPrototypeOf(Q,L.prototype),Q}function rR(T){if(L.isBuffer(T)){let A=xQ(T.length)|0,P=n0(A);if(P.length===0)return P;return T.copy(P,0,0,A),P}if(T.length!==void 0){if(typeof T.length!=="number"||Number.isNaN(T.length))return n0(0);return wQ(T)}if(T.type==="Buffer"&&Array.isArray(T.data))return wQ(T.data)}function xQ(T){if(T>=A2)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+A2.toString(16)+" bytes");return T|0}function U$(T,A){if(L.isBuffer(T))return T.length;if(ArrayBuffer.isView(T)||O0(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 P=T.length,Q=arguments.length>2&&arguments[2]===!0;if(!Q&&P===0)return 0;let C=!1;for(;;)switch(A){case"ascii":case"latin1":case"binary":return P;case"utf8":case"utf-8":return EQ(T).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P*2;case"hex":return P>>>1;case"base64":return K$(T).length;default:if(C)return Q?-1:EQ(T).length;A=(""+A).toLowerCase(),C=!0}}function cR(T,A,P){let Q=!1;if(A===void 0||A<0)A=0;if(A>this.length)return"";if(P===void 0||P>this.length)P=this.length;if(P<=0)return"";if(P>>>=0,A>>>=0,P<=A)return"";if(!T)T="utf8";while(!0)switch(T){case"hex":return Ak(this,A,P);case"utf8":case"utf-8":return $$(this,A,P);case"ascii":return eR(this,A,P);case"latin1":case"binary":return Tk(this,A,P);case"base64":return sR(this,A,P);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Pk(this,A,P);default:if(Q)throw TypeError("Unknown encoding: "+T);T=(T+"").toLowerCase(),Q=!0}}function pA(T,A,P){let Q=T[A];T[A]=T[P],T[P]=Q}function J$(T,A,P,Q,C){if(T.length===0)return-1;if(typeof P==="string")Q=P,P=0;else if(P>2147483647)P=2147483647;else if(P<-2147483648)P=-2147483648;if(P=+P,Number.isNaN(P))P=C?0:T.length-1;if(P<0)P=T.length+P;if(P>=T.length)if(C)return-1;else P=T.length-1;else if(P<0)if(C)P=0;else return-1;if(typeof A==="string")A=L.from(A,Q);if(L.isBuffer(A)){if(A.length===0)return-1;return eJ(T,A,P,Q,C)}else if(typeof A==="number"){if(A=A&255,typeof Uint8Array.prototype.indexOf==="function")if(C)return Uint8Array.prototype.indexOf.call(T,A,P);else return Uint8Array.prototype.lastIndexOf.call(T,A,P);return eJ(T,[A],P,Q,C)}throw TypeError("val must be string, number or Buffer")}function eJ(T,A,P,Q,C){let W=1,G=T.length,J=A.length;if(Q!==void 0){if(Q=String(Q).toLowerCase(),Q==="ucs2"||Q==="ucs-2"||Q==="utf16le"||Q==="utf-16le"){if(T.length<2||A.length<2)return-1;W=2,G/=2,J/=2,P/=2}}function $(Z,R){if(W===1)return Z[R];else return Z.readUInt16BE(R*W)}let X;if(C){let Z=-1;for(X=P;X<G;X++)if($(T,X)===$(A,Z===-1?0:X-Z)){if(Z===-1)Z=X;if(X-Z+1===J)return Z*W}else{if(Z!==-1)X-=X-Z;Z=-1}}else{if(P+J>G)P=G-J;for(X=P;X>=0;X--){let Z=!0;for(let R=0;R<J;R++)if($(T,X+R)!==$(A,R)){Z=!1;break}if(Z)return X}}return-1}function oR(T,A,P,Q){P=Number(P)||0;let C=T.length-P;if(!Q)Q=C;else if(Q=Number(Q),Q>C)Q=C;let W=A.length;if(Q>W/2)Q=W/2;let G;for(G=0;G<Q;++G){let J=parseInt(A.substr(G*2,2),16);if(Number.isNaN(J))return G;T[P+G]=J}return G}function nR(T,A,P,Q){return B6(EQ(A,T.length-P),T,P,Q)}function fR(T,A,P,Q){return B6(Gk(A),T,P,Q)}function iR(T,A,P,Q){return B6(K$(A),T,P,Q)}function aR(T,A,P,Q){return B6(Uk(A,T.length-P),T,P,Q)}function sR(T,A,P){if(A===0&&P===T.length)return sJ(T);else return sJ(T.slice(A,P))}function $$(T,A,P){P=Math.min(T.length,P);let Q=[],C=A;while(C<P){let W=T[C],G=null,J=W>239?4:W>223?3:W>191?2:1;if(C+J<=P){let $,X,Z,R;switch(J){case 1:if(W<128)G=W;break;case 2:if($=T[C+1],($&192)===128){if(R=(W&31)<<6|$&63,R>127)G=R}break;case 3:if($=T[C+1],X=T[C+2],($&192)===128&&(X&192)===128){if(R=(W&15)<<12|($&63)<<6|X&63,R>2047&&(R<55296||R>57343))G=R}break;case 4:if($=T[C+1],X=T[C+2],Z=T[C+3],($&192)===128&&(X&192)===128&&(Z&192)===128){if(R=(W&15)<<18|($&63)<<12|(X&63)<<6|Z&63,R>65535&&R<1114112)G=R}}}if(G===null)G=65533,J=1;else if(G>65535)G-=65536,Q.push(G>>>10&1023|55296),G=56320|G&1023;Q.push(G),C+=J}return tR(Q)}function tR(T){let A=T.length;if(A<=T$)return String.fromCharCode.apply(String,T);let P="",Q=0;while(Q<A)P+=String.fromCharCode.apply(String,T.slice(Q,Q+=T$));return P}function eR(T,A,P){let Q="";P=Math.min(T.length,P);for(let C=A;C<P;++C)Q+=String.fromCharCode(T[C]&127);return Q}function Tk(T,A,P){let Q="";P=Math.min(T.length,P);for(let C=A;C<P;++C)Q+=String.fromCharCode(T[C]);return Q}function Ak(T,A,P){let Q=T.length;if(!A||A<0)A=0;if(!P||P<0||P>Q)P=Q;let C="";for(let W=A;W<P;++W)C+=Jk[T[W]];return C}function Pk(T,A,P){let Q=T.slice(A,P),C="";for(let W=0;W<Q.length-1;W+=2)C+=String.fromCharCode(Q[W]+Q[W+1]*256);return C}function YT(T,A,P){if(T%1!==0||T<0)throw RangeError("offset is not uint");if(T+A>P)throw RangeError("Trying to access beyond buffer length")}function rT(T,A,P,Q,C,W){if(!L.isBuffer(T))throw TypeError('"buffer" argument must be a Buffer instance');if(A>C||A<W)throw RangeError('"value" argument is out of bounds');if(P+Q>T.length)throw RangeError("Index out of range")}function V$(T,A,P,Q,C){H$(A,Q,C,T,P,7);let W=Number(A&BigInt(4294967295));T[P++]=W,W=W>>8,T[P++]=W,W=W>>8,T[P++]=W,W=W>>8,T[P++]=W;let G=Number(A>>BigInt(32)&BigInt(4294967295));return T[P++]=G,G=G>>8,T[P++]=G,G=G>>8,T[P++]=G,G=G>>8,T[P++]=G,P}function q$(T,A,P,Q,C){H$(A,Q,C,T,P,7);let W=Number(A&BigInt(4294967295));T[P+7]=W,W=W>>8,T[P+6]=W,W=W>>8,T[P+5]=W,W=W>>8,T[P+4]=W;let G=Number(A>>BigInt(32)&BigInt(4294967295));return T[P+3]=G,G=G>>8,T[P+2]=G,G=G>>8,T[P+1]=G,G=G>>8,T[P]=G,P+8}function Y$(T,A,P,Q,C,W){if(P+Q>T.length)throw RangeError("Index out of range");if(P<0)throw RangeError("Index out of range")}function Z$(T,A,P,Q,C){if(A=+A,P=P>>>0,!C)Y$(T,A,P,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return P$(T,A,P,Q,23,4),P+4}function X$(T,A,P,Q,C){if(A=+A,P=P>>>0,!C)Y$(T,A,P,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return P$(T,A,P,Q,52,8),P+8}function A$(T){let A="",P=T.length,Q=T[0]==="-"?1:0;for(;P>=Q+4;P-=3)A=`_${T.slice(P-3,P)}${A}`;return`${T.slice(0,P)}${A}`}function Qk(T,A,P){if(k8(A,"offset"),T[A]===void 0||T[A+P]===void 0)P2(A,T.length-(P+1))}function H$(T,A,P,Q,C,W){if(T>P||T<A){let G=typeof A==="bigint"?"n":"",J;if(W>3)if(A===0||A===BigInt(0))J=`>= 0${G} and < 2${G} ** ${(W+1)*8}${G}`;else J=`>= -(2${G} ** ${(W+1)*8-1}${G}) and < 2 ** ${(W+1)*8-1}${G}`;else J=`>= ${A}${G} and <= ${P}${G}`;throw new NQ("value",J,T)}Qk(Q,C,W)}function k8(T,A){if(typeof T!=="number")throw new lR(A,"number",T)}function P2(T,A,P){if(Math.floor(T)!==T)throw k8(T,P),new NQ(P||"offset","an integer",T);if(A<0)throw new bR;throw new NQ(P||"offset",`>= ${P?1:0} and <= ${A}`,T)}function Wk(T){if(T=T.split("=")[0],T=T.trim().replace(Ck,""),T.length<2)return"";while(T.length%4!==0)T=T+"=";return T}function EQ(T,A){A=A||1/0;let P,Q=T.length,C=null,W=[];for(let G=0;G<Q;++G){if(P=T.charCodeAt(G),P>55295&&P<57344){if(!C){if(P>56319){if((A-=3)>-1)W.push(239,191,189);continue}else if(G+1===Q){if((A-=3)>-1)W.push(239,191,189);continue}C=P;continue}if(P<56320){if((A-=3)>-1)W.push(239,191,189);C=P;continue}P=(C-55296<<10|P-56320)+65536}else if(C){if((A-=3)>-1)W.push(239,191,189)}if(C=null,P<128){if((A-=1)<0)break;W.push(P)}else if(P<2048){if((A-=2)<0)break;W.push(P>>6|192,P&63|128)}else if(P<65536){if((A-=3)<0)break;W.push(P>>12|224,P>>6&63|128,P&63|128)}else if(P<1114112){if((A-=4)<0)break;W.push(P>>18|240,P>>12&63|128,P>>6&63|128,P&63|128)}else throw Error("Invalid code point")}return W}function Gk(T){let A=[];for(let P=0;P<T.length;++P)A.push(T.charCodeAt(P)&255);return A}function Uk(T,A){let P,Q,C,W=[];for(let G=0;G<T.length;++G){if((A-=2)<0)break;P=T.charCodeAt(G),Q=P>>8,C=P%256,W.push(C),W.push(Q)}return W}function K$(T){return OR(Wk(T))}function B6(T,A,P,Q){let C;for(C=0;C<Q;++C){if(C+P>=A.length||C>=T.length)break;A[C+P]=T[C]}return C}function O0(T,A){return T instanceof A||T!=null&&T.constructor!=null&&T.constructor.name!=null&&T.constructor.name===A.name}function HA(T){return typeof BigInt>"u"?$k:T}function $k(){throw Error("BigInt not supported")}function _Q(T){return()=>{throw Error(T+" is not implemented for node:buffer browser polyfill")}}var B0,G0,SQ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",lA,aJ,tJ,Q$=50,A2=2147483647,C$=536870888,hR,mR,gR,vR,yR,bR,lR,NQ,T$=4096,Ck,Jk,Vk,qk,Yk=(T)=>{for(let A of T)if(A.charCodeAt(0)>127)return!1;return!0},Zk,Xk;var j8=jT(()=>{B0=[],G0=[];for(lA=0,aJ=SQ.length;lA<aJ;++lA)B0[lA]=SQ[lA],G0[SQ.charCodeAt(lA)]=lA;G0[45]=62;G0[95]=63;tJ=typeof Symbol==="function"&&typeof Symbol.for==="function"?Symbol.for("nodejs.util.inspect.custom"):null,hR=globalThis.btoa,mR=globalThis.atob,gR=globalThis.File,vR=globalThis.Blob,yR={MAX_LENGTH:A2,MAX_STRING_LENGTH:C$};bR=BQ("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),lR=BQ("ERR_INVALID_ARG_TYPE",function(T,A){return`The "${T}" argument must be of type number. Received type ${typeof A}`},TypeError),NQ=BQ("ERR_OUT_OF_RANGE",function(T,A,P){let Q=`The value of "${T}" is out of range.`,C=P;if(Number.isInteger(P)&&Math.abs(P)>4294967296)C=A$(String(P));else if(typeof P==="bigint"){if(C=String(P),P>BigInt(2)**BigInt(32)||P<-(BigInt(2)**BigInt(32)))C=A$(C);C+="n"}return Q+=` It must be ${A}. Received ${C}`,Q},RangeError);Object.defineProperty(L.prototype,"parent",{enumerable:!0,get:function(){if(!L.isBuffer(this))return;return this.buffer}});Object.defineProperty(L.prototype,"offset",{enumerable:!0,get:function(){if(!L.isBuffer(this))return;return this.byteOffset}});L.poolSize=8192;L.from=function(T,A,P){return W$(T,A,P)};Object.setPrototypeOf(L.prototype,Uint8Array.prototype);Object.setPrototypeOf(L,Uint8Array);L.alloc=function(T,A,P){return pR(T,A,P)};L.allocUnsafe=function(T){return OQ(T)};L.allocUnsafeSlow=function(T){return OQ(T)};L.isBuffer=function(A){return A!=null&&A._isBuffer===!0&&A!==L.prototype};L.compare=function(A,P){if(O0(A,Uint8Array))A=L.from(A,A.offset,A.byteLength);if(O0(P,Uint8Array))P=L.from(P,P.offset,P.byteLength);if(!L.isBuffer(A)||!L.isBuffer(P))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(A===P)return 0;let Q=A.length,C=P.length;for(let W=0,G=Math.min(Q,C);W<G;++W)if(A[W]!==P[W]){Q=A[W],C=P[W];break}if(Q<C)return-1;if(C<Q)return 1;return 0};L.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}};L.concat=function(A,P){if(!Array.isArray(A))throw TypeError('"list" argument must be an Array of Buffers');if(A.length===0)return L.alloc(0);let Q;if(P===void 0){P=0;for(Q=0;Q<A.length;++Q)P+=A[Q].length}let C=L.allocUnsafe(P),W=0;for(Q=0;Q<A.length;++Q){let G=A[Q];if(O0(G,Uint8Array))if(W+G.length>C.length){if(!L.isBuffer(G))G=L.from(G);G.copy(C,W)}else Uint8Array.prototype.set.call(C,G,W);else if(!L.isBuffer(G))throw TypeError('"list" argument must be an Array of Buffers');else G.copy(C,W);W+=G.length}return C};L.byteLength=U$;L.prototype._isBuffer=!0;L.prototype.swap16=function(){let A=this.length;if(A%2!==0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let P=0;P<A;P+=2)pA(this,P,P+1);return this};L.prototype.swap32=function(){let A=this.length;if(A%4!==0)throw RangeError("Buffer size must be a multiple of 32-bits");for(let P=0;P<A;P+=4)pA(this,P,P+3),pA(this,P+1,P+2);return this};L.prototype.swap64=function(){let A=this.length;if(A%8!==0)throw RangeError("Buffer size must be a multiple of 64-bits");for(let P=0;P<A;P+=8)pA(this,P,P+7),pA(this,P+1,P+6),pA(this,P+2,P+5),pA(this,P+3,P+4);return this};L.prototype.toString=function(){let A=this.length;if(A===0)return"";if(arguments.length===0)return $$(this,0,A);return cR.apply(this,arguments)};L.prototype.toLocaleString=L.prototype.toString;L.prototype.equals=function(A){if(!L.isBuffer(A))throw TypeError("Argument must be a Buffer");if(this===A)return!0;return L.compare(this,A)===0};L.prototype.inspect=function(){let A="",P=Q$;if(A=this.toString("hex",0,P).replace(/(.{2})/g,"$1 ").trim(),this.length>P)A+=" ... ";return"<Buffer "+A+">"};if(tJ)L.prototype[tJ]=L.prototype.inspect;L.prototype.compare=function(A,P,Q,C,W){if(O0(A,Uint8Array))A=L.from(A,A.offset,A.byteLength);if(!L.isBuffer(A))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof A);if(P===void 0)P=0;if(Q===void 0)Q=A?A.length:0;if(C===void 0)C=0;if(W===void 0)W=this.length;if(P<0||Q>A.length||C<0||W>this.length)throw RangeError("out of range index");if(C>=W&&P>=Q)return 0;if(C>=W)return-1;if(P>=Q)return 1;if(P>>>=0,Q>>>=0,C>>>=0,W>>>=0,this===A)return 0;let G=W-C,J=Q-P,$=Math.min(G,J),X=this.slice(C,W),Z=A.slice(P,Q);for(let R=0;R<$;++R)if(X[R]!==Z[R]){G=X[R],J=Z[R];break}if(G<J)return-1;if(J<G)return 1;return 0};L.prototype.includes=function(A,P,Q){return this.indexOf(A,P,Q)!==-1};L.prototype.indexOf=function(A,P,Q){return J$(this,A,P,Q,!0)};L.prototype.lastIndexOf=function(A,P,Q){return J$(this,A,P,Q,!1)};L.prototype.write=function(A,P,Q,C){if(P===void 0)C="utf8",Q=this.length,P=0;else if(Q===void 0&&typeof P==="string")C=P,Q=this.length,P=0;else if(isFinite(P))if(P=P>>>0,isFinite(Q)){if(Q=Q>>>0,C===void 0)C="utf8"}else C=Q,Q=void 0;else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let W=this.length-P;if(Q===void 0||Q>W)Q=W;if(A.length>0&&(Q<0||P<0)||P>this.length)throw RangeError("Attempt to write outside buffer bounds");if(!C)C="utf8";let G=!1;for(;;)switch(C){case"hex":return oR(this,A,P,Q);case"utf8":case"utf-8":return nR(this,A,P,Q);case"ascii":case"latin1":case"binary":return fR(this,A,P,Q);case"base64":return iR(this,A,P,Q);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return aR(this,A,P,Q);default:if(G)throw TypeError("Unknown encoding: "+C);C=(""+C).toLowerCase(),G=!0}};L.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};L.prototype.slice=function(A,P){let Q=this.length;if(A=~~A,P=P===void 0?Q:~~P,A<0){if(A+=Q,A<0)A=0}else if(A>Q)A=Q;if(P<0){if(P+=Q,P<0)P=0}else if(P>Q)P=Q;if(P<A)P=A;let C=this.subarray(A,P);return Object.setPrototypeOf(C,L.prototype),C};L.prototype.readUintLE=L.prototype.readUIntLE=function(A,P,Q){if(A=A>>>0,P=P>>>0,!Q)YT(A,P,this.length);let C=this[A],W=1,G=0;while(++G<P&&(W*=256))C+=this[A+G]*W;return C};L.prototype.readUintBE=L.prototype.readUIntBE=function(A,P,Q){if(A=A>>>0,P=P>>>0,!Q)YT(A,P,this.length);let C=this[A+--P],W=1;while(P>0&&(W*=256))C+=this[A+--P]*W;return C};L.prototype.readUint8=L.prototype.readUInt8=function(A,P){if(A=A>>>0,!P)YT(A,1,this.length);return this[A]};L.prototype.readUint16LE=L.prototype.readUInt16LE=function(A,P){if(A=A>>>0,!P)YT(A,2,this.length);return this[A]|this[A+1]<<8};L.prototype.readUint16BE=L.prototype.readUInt16BE=function(A,P){if(A=A>>>0,!P)YT(A,2,this.length);return this[A]<<8|this[A+1]};L.prototype.readUint32LE=L.prototype.readUInt32LE=function(A,P){if(A=A>>>0,!P)YT(A,4,this.length);return(this[A]|this[A+1]<<8|this[A+2]<<16)+this[A+3]*16777216};L.prototype.readUint32BE=L.prototype.readUInt32BE=function(A,P){if(A=A>>>0,!P)YT(A,4,this.length);return this[A]*16777216+(this[A+1]<<16|this[A+2]<<8|this[A+3])};L.prototype.readBigUInt64LE=HA(function(A){A=A>>>0,k8(A,"offset");let P=this[A],Q=this[A+7];if(P===void 0||Q===void 0)P2(A,this.length-8);let C=P+this[++A]*256+this[++A]*65536+this[++A]*16777216,W=this[++A]+this[++A]*256+this[++A]*65536+Q*16777216;return BigInt(C)+(BigInt(W)<<BigInt(32))});L.prototype.readBigUInt64BE=HA(function(A){A=A>>>0,k8(A,"offset");let P=this[A],Q=this[A+7];if(P===void 0||Q===void 0)P2(A,this.length-8);let C=P*16777216+this[++A]*65536+this[++A]*256+this[++A],W=this[++A]*16777216+this[++A]*65536+this[++A]*256+Q;return(BigInt(C)<<BigInt(32))+BigInt(W)});L.prototype.readIntLE=function(A,P,Q){if(A=A>>>0,P=P>>>0,!Q)YT(A,P,this.length);let C=this[A],W=1,G=0;while(++G<P&&(W*=256))C+=this[A+G]*W;if(W*=128,C>=W)C-=Math.pow(2,8*P);return C};L.prototype.readIntBE=function(A,P,Q){if(A=A>>>0,P=P>>>0,!Q)YT(A,P,this.length);let C=P,W=1,G=this[A+--C];while(C>0&&(W*=256))G+=this[A+--C]*W;if(W*=128,G>=W)G-=Math.pow(2,8*P);return G};L.prototype.readInt8=function(A,P){if(A=A>>>0,!P)YT(A,1,this.length);if(!(this[A]&128))return this[A];return(255-this[A]+1)*-1};L.prototype.readInt16LE=function(A,P){if(A=A>>>0,!P)YT(A,2,this.length);let Q=this[A]|this[A+1]<<8;return Q&32768?Q|4294901760:Q};L.prototype.readInt16BE=function(A,P){if(A=A>>>0,!P)YT(A,2,this.length);let Q=this[A+1]|this[A]<<8;return Q&32768?Q|4294901760:Q};L.prototype.readInt32LE=function(A,P){if(A=A>>>0,!P)YT(A,4,this.length);return this[A]|this[A+1]<<8|this[A+2]<<16|this[A+3]<<24};L.prototype.readInt32BE=function(A,P){if(A=A>>>0,!P)YT(A,4,this.length);return this[A]<<24|this[A+1]<<16|this[A+2]<<8|this[A+3]};L.prototype.readBigInt64LE=HA(function(A){A=A>>>0,k8(A,"offset");let P=this[A],Q=this[A+7];if(P===void 0||Q===void 0)P2(A,this.length-8);let C=this[A+4]+this[A+5]*256+this[A+6]*65536+(Q<<24);return(BigInt(C)<<BigInt(32))+BigInt(P+this[++A]*256+this[++A]*65536+this[++A]*16777216)});L.prototype.readBigInt64BE=HA(function(A){A=A>>>0,k8(A,"offset");let P=this[A],Q=this[A+7];if(P===void 0||Q===void 0)P2(A,this.length-8);let C=(P<<24)+this[++A]*65536+this[++A]*256+this[++A];return(BigInt(C)<<BigInt(32))+BigInt(this[++A]*16777216+this[++A]*65536+this[++A]*256+Q)});L.prototype.readFloatLE=function(A,P){if(A=A>>>0,!P)YT(A,4,this.length);return E6(this,A,!0,23,4)};L.prototype.readFloatBE=function(A,P){if(A=A>>>0,!P)YT(A,4,this.length);return E6(this,A,!1,23,4)};L.prototype.readDoubleLE=function(A,P){if(A=A>>>0,!P)YT(A,8,this.length);return E6(this,A,!0,52,8)};L.prototype.readDoubleBE=function(A,P){if(A=A>>>0,!P)YT(A,8,this.length);return E6(this,A,!1,52,8)};L.prototype.writeUintLE=L.prototype.writeUIntLE=function(A,P,Q,C){if(A=+A,P=P>>>0,Q=Q>>>0,!C){let J=Math.pow(2,8*Q)-1;rT(this,A,P,Q,J,0)}let W=1,G=0;this[P]=A&255;while(++G<Q&&(W*=256))this[P+G]=A/W&255;return P+Q};L.prototype.writeUintBE=L.prototype.writeUIntBE=function(A,P,Q,C){if(A=+A,P=P>>>0,Q=Q>>>0,!C){let J=Math.pow(2,8*Q)-1;rT(this,A,P,Q,J,0)}let W=Q-1,G=1;this[P+W]=A&255;while(--W>=0&&(G*=256))this[P+W]=A/G&255;return P+Q};L.prototype.writeUint8=L.prototype.writeUInt8=function(A,P,Q){if(A=+A,P=P>>>0,!Q)rT(this,A,P,1,255,0);return this[P]=A&255,P+1};L.prototype.writeUint16LE=L.prototype.writeUInt16LE=function(A,P,Q){if(A=+A,P=P>>>0,!Q)rT(this,A,P,2,65535,0);return this[P]=A&255,this[P+1]=A>>>8,P+2};L.prototype.writeUint16BE=L.prototype.writeUInt16BE=function(A,P,Q){if(A=+A,P=P>>>0,!Q)rT(this,A,P,2,65535,0);return this[P]=A>>>8,this[P+1]=A&255,P+2};L.prototype.writeUint32LE=L.prototype.writeUInt32LE=function(A,P,Q){if(A=+A,P=P>>>0,!Q)rT(this,A,P,4,4294967295,0);return this[P+3]=A>>>24,this[P+2]=A>>>16,this[P+1]=A>>>8,this[P]=A&255,P+4};L.prototype.writeUint32BE=L.prototype.writeUInt32BE=function(A,P,Q){if(A=+A,P=P>>>0,!Q)rT(this,A,P,4,4294967295,0);return this[P]=A>>>24,this[P+1]=A>>>16,this[P+2]=A>>>8,this[P+3]=A&255,P+4};L.prototype.writeBigUInt64LE=HA(function(A,P=0){return V$(this,A,P,BigInt(0),BigInt("0xffffffffffffffff"))});L.prototype.writeBigUInt64BE=HA(function(A,P=0){return q$(this,A,P,BigInt(0),BigInt("0xffffffffffffffff"))});L.prototype.writeIntLE=function(A,P,Q,C){if(A=+A,P=P>>>0,!C){let $=Math.pow(2,8*Q-1);rT(this,A,P,Q,$-1,-$)}let W=0,G=1,J=0;this[P]=A&255;while(++W<Q&&(G*=256)){if(A<0&&J===0&&this[P+W-1]!==0)J=1;this[P+W]=(A/G>>0)-J&255}return P+Q};L.prototype.writeIntBE=function(A,P,Q,C){if(A=+A,P=P>>>0,!C){let $=Math.pow(2,8*Q-1);rT(this,A,P,Q,$-1,-$)}let W=Q-1,G=1,J=0;this[P+W]=A&255;while(--W>=0&&(G*=256)){if(A<0&&J===0&&this[P+W+1]!==0)J=1;this[P+W]=(A/G>>0)-J&255}return P+Q};L.prototype.writeInt8=function(A,P,Q){if(A=+A,P=P>>>0,!Q)rT(this,A,P,1,127,-128);if(A<0)A=255+A+1;return this[P]=A&255,P+1};L.prototype.writeInt16LE=function(A,P,Q){if(A=+A,P=P>>>0,!Q)rT(this,A,P,2,32767,-32768);return this[P]=A&255,this[P+1]=A>>>8,P+2};L.prototype.writeInt16BE=function(A,P,Q){if(A=+A,P=P>>>0,!Q)rT(this,A,P,2,32767,-32768);return this[P]=A>>>8,this[P+1]=A&255,P+2};L.prototype.writeInt32LE=function(A,P,Q){if(A=+A,P=P>>>0,!Q)rT(this,A,P,4,2147483647,-2147483648);return this[P]=A&255,this[P+1]=A>>>8,this[P+2]=A>>>16,this[P+3]=A>>>24,P+4};L.prototype.writeInt32BE=function(A,P,Q){if(A=+A,P=P>>>0,!Q)rT(this,A,P,4,2147483647,-2147483648);if(A<0)A=4294967295+A+1;return this[P]=A>>>24,this[P+1]=A>>>16,this[P+2]=A>>>8,this[P+3]=A&255,P+4};L.prototype.writeBigInt64LE=HA(function(A,P=0){return V$(this,A,P,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});L.prototype.writeBigInt64BE=HA(function(A,P=0){return q$(this,A,P,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});L.prototype.writeFloatLE=function(A,P,Q){return Z$(this,A,P,!0,Q)};L.prototype.writeFloatBE=function(A,P,Q){return Z$(this,A,P,!1,Q)};L.prototype.writeDoubleLE=function(A,P,Q){return X$(this,A,P,!0,Q)};L.prototype.writeDoubleBE=function(A,P,Q){return X$(this,A,P,!1,Q)};L.prototype.copy=function(A,P,Q,C){if(!L.isBuffer(A))throw TypeError("argument should be a Buffer");if(!Q)Q=0;if(!C&&C!==0)C=this.length;if(P>=A.length)P=A.length;if(!P)P=0;if(C>0&&C<Q)C=Q;if(C===Q)return 0;if(A.length===0||this.length===0)return 0;if(P<0)throw RangeError("targetStart out of bounds");if(Q<0||Q>=this.length)throw RangeError("Index out of range");if(C<0)throw RangeError("sourceEnd out of bounds");if(C>this.length)C=this.length;if(A.length-P<C-Q)C=A.length-P+Q;let W=C-Q;if(this===A&&typeof Uint8Array.prototype.copyWithin==="function")this.copyWithin(P,Q,C);else Uint8Array.prototype.set.call(A,this.subarray(Q,C),P);return W};L.prototype.fill=function(A,P,Q,C){if(typeof A==="string"){if(typeof P==="string")C=P,P=0,Q=this.length;else if(typeof Q==="string")C=Q,Q=this.length;if(C!==void 0&&typeof C!=="string")throw TypeError("encoding must be a string");if(typeof C==="string"&&!L.isEncoding(C))throw TypeError("Unknown encoding: "+C);if(A.length===1){let G=A.charCodeAt(0);if(C==="utf8"&&G<128||C==="latin1")A=G}}else if(typeof A==="number")A=A&255;else if(typeof A==="boolean")A=Number(A);if(P<0||this.length<P||this.length<Q)throw RangeError("Out of range index");if(Q<=P)return this;if(P=P>>>0,Q=Q===void 0?this.length:Q>>>0,!A)A=0;let W;if(typeof A==="number")for(W=P;W<Q;++W)this[W]=A;else{let G=L.isBuffer(A)?A:L.from(A,C),J=G.length;if(J===0)throw TypeError('The value "'+A+'" is invalid for argument "value"');for(W=0;W<Q-P;++W)this[W+P]=G[W%J]}return this};Ck=/[^+/0-9A-Za-z-_]/g;Jk=function(){let T=Array(256);for(let A=0;A<16;++A){let P=A*16;for(let Q=0;Q<16;++Q)T[P+Q]="0123456789abcdef"[A]+"0123456789abcdef"[Q]}return T}();Vk=_Q("resolveObjectURL"),qk=_Q("isUtf8"),Zk=_Q("transcode"),Xk=L});var WC=T0((G9,CC)=>{(function(T,A){function P(k,U){if(!k)throw Error(U||"Assertion failed")}function Q(k,U){k.super_=U;var V=function(){};V.prototype=U.prototype,k.prototype=new V,k.prototype.constructor=k}function C(k,U,V){if(C.isBN(k))return k;if(this.negative=0,this.words=null,this.length=0,this.red=null,k!==null){if(U==="le"||U==="be")V=U,U=10;this._init(k||0,U||10,V||"be")}}if(typeof T==="object")T.exports=C;else A.BN=C;C.BN=C,C.wordSize=26;var W;try{if(typeof window<"u"&&typeof window.Buffer<"u")W=window.Buffer;else W=(j8(),G8(O6)).Buffer}catch(k){}C.isBN=function(U){if(U instanceof C)return!0;return U!==null&&typeof U==="object"&&U.constructor.wordSize===C.wordSize&&Array.isArray(U.words)},C.max=function(U,V){if(U.cmp(V)>0)return U;return V},C.min=function(U,V){if(U.cmp(V)<0)return U;return V},C.prototype._init=function(U,V,Y){if(typeof U==="number")return this._initNumber(U,V,Y);if(typeof U==="object")return this._initArray(U,V,Y);if(V==="hex")V=16;P(V===(V|0)&&V>=2&&V<=36),U=U.toString().replace(/\s+/g,"");var H=0;if(U[0]==="-")H++,this.negative=1;if(H<U.length){if(V===16)this._parseHex(U,H,Y);else if(this._parseBase(U,V,H),Y==="le")this._initArray(this.toArray(),V,Y)}},C.prototype._initNumber=function(U,V,Y){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 P(U<9007199254740992),this.words=[U&67108863,U/67108864&67108863,1],this.length=3;if(Y!=="le")return;this._initArray(this.toArray(),V,Y)},C.prototype._initArray=function(U,V,Y){if(P(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 K,M,I=0;if(Y==="be"){for(H=U.length-1,K=0;H>=0;H-=3)if(M=U[H]|U[H-1]<<8|U[H-2]<<16,this.words[K]|=M<<I&67108863,this.words[K+1]=M>>>26-I&67108863,I+=24,I>=26)I-=26,K++}else if(Y==="le"){for(H=0,K=0;H<U.length;H+=3)if(M=U[H]|U[H+1]<<8|U[H+2]<<16,this.words[K]|=M<<I&67108863,this.words[K+1]=M>>>26-I&67108863,I+=24,I>=26)I-=26,K++}return this._strip()};function G(k,U){var V=k.charCodeAt(U);if(V>=48&&V<=57)return V-48;else if(V>=65&&V<=70)return V-55;else if(V>=97&&V<=102)return V-87;else P(!1,"Invalid character in "+k)}function J(k,U,V){var Y=G(k,V);if(V-1>=U)Y|=G(k,V-1)<<4;return Y}C.prototype._parseHex=function(U,V,Y){this.length=Math.ceil((U.length-V)/6),this.words=Array(this.length);for(var H=0;H<this.length;H++)this.words[H]=0;var K=0,M=0,I;if(Y==="be")for(H=U.length-1;H>=V;H-=2)if(I=J(U,V,H)<<K,this.words[M]|=I&67108863,K>=18)K-=18,M+=1,this.words[M]|=I>>>26;else K+=8;else{var j=U.length-V;for(H=j%2===0?V+1:V;H<U.length;H+=2)if(I=J(U,V,H)<<K,this.words[M]|=I&67108863,K>=18)K-=18,M+=1,this.words[M]|=I>>>26;else K+=8}this._strip()};function $(k,U,V,Y){var H=0,K=0,M=Math.min(k.length,V);for(var I=U;I<M;I++){var j=k.charCodeAt(I)-48;if(H*=Y,j>=49)K=j-49+10;else if(j>=17)K=j-17+10;else K=j;P(j>=0&&K<Y,"Invalid character"),H+=K}return H}C.prototype._parseBase=function(U,V,Y){this.words=[0],this.length=1;for(var H=0,K=1;K<=67108863;K*=V)H++;H--,K=K/V|0;var M=U.length-Y,I=M%H,j=Math.min(M,M-I)+Y,q=0;for(var F=Y;F<j;F+=H)if(q=$(U,F,F+H,V),this.imuln(K),this.words[0]+q<67108864)this.words[0]+=q;else this._iaddn(q);if(I!==0){var y=1;q=$(U,F,U.length,V);for(F=0;F<I;F++)y*=V;if(this.imuln(y),this.words[0]+q<67108864)this.words[0]+=q;else this._iaddn(q)}this._strip()},C.prototype.copy=function(U){U.words=Array(this.length);for(var V=0;V<this.length;V++)U.words[V]=this.words[V];U.length=this.length,U.negative=this.negative,U.red=this.red};function X(k,U){k.words=U.words,k.length=U.length,k.negative=U.negative,k.red=U.red}if(C.prototype._move=function(U){X(U,this)},C.prototype.clone=function(){var U=new C(null);return this.copy(U),U},C.prototype._expand=function(U){while(this.length<U)this.words[this.length++]=0;return this},C.prototype._strip=function(){while(this.length>1&&this.words[this.length-1]===0)this.length--;return this._normSign()},C.prototype._normSign=function(){if(this.length===1&&this.words[0]===0)this.negative=0;return this},typeof Symbol<"u"&&typeof Symbol.for==="function")try{C.prototype[Symbol.for("nodejs.util.inspect.custom")]=Z}catch(k){C.prototype.inspect=Z}else C.prototype.inspect=Z;function Z(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var R=["","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"],D=[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(C.prototype.toString=function(U,V){U=U||10,V=V|0||1;var Y;if(U===16||U==="hex"){Y="";var H=0,K=0;for(var M=0;M<this.length;M++){var I=this.words[M],j=((I<<H|K)&16777215).toString(16);if(K=I>>>24-H&16777215,H+=2,H>=26)H-=26,M--;if(K!==0||M!==this.length-1)Y=R[6-j.length]+j+Y;else Y=j+Y}if(K!==0)Y=K.toString(16)+Y;while(Y.length%V!==0)Y="0"+Y;if(this.negative!==0)Y="-"+Y;return Y}if(U===(U|0)&&U>=2&&U<=36){var q=D[U],F=z[U];Y="";var y=this.clone();y.negative=0;while(!y.isZero()){var r=y.modrn(F).toString(U);if(y=y.idivn(F),!y.isZero())Y=R[q-r.length]+r+Y;else Y=r+Y}if(this.isZero())Y="0"+Y;while(Y.length%V!==0)Y="0"+Y;if(this.negative!==0)Y="-"+Y;return Y}P(!1,"Base should be between 2 and 36")},C.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)P(!1,"Number can only safely store up to 53 bits");return this.negative!==0?-U:U},C.prototype.toJSON=function(){return this.toString(16,2)},W)C.prototype.toBuffer=function(U,V){return this.toArrayLike(W,U,V)};C.prototype.toArray=function(U,V){return this.toArrayLike(Array,U,V)};var S=function(U,V){if(U.allocUnsafe)return U.allocUnsafe(V);return new U(V)};if(C.prototype.toArrayLike=function(U,V,Y){this._strip();var H=this.byteLength(),K=Y||Math.max(1,H);P(H<=K,"byte array longer than desired length"),P(K>0,"Requested array length <= 0");var M=S(U,K),I=V==="le"?"LE":"BE";return this["_toArrayLike"+I](M,H),M},C.prototype._toArrayLikeLE=function(U,V){var Y=0,H=0;for(var K=0,M=0;K<this.length;K++){var I=this.words[K]<<M|H;if(U[Y++]=I&255,Y<U.length)U[Y++]=I>>8&255;if(Y<U.length)U[Y++]=I>>16&255;if(M===6){if(Y<U.length)U[Y++]=I>>24&255;H=0,M=0}else H=I>>>24,M+=2}if(Y<U.length){U[Y++]=H;while(Y<U.length)U[Y++]=0}},C.prototype._toArrayLikeBE=function(U,V){var Y=U.length-1,H=0;for(var K=0,M=0;K<this.length;K++){var I=this.words[K]<<M|H;if(U[Y--]=I&255,Y>=0)U[Y--]=I>>8&255;if(Y>=0)U[Y--]=I>>16&255;if(M===6){if(Y>=0)U[Y--]=I>>24&255;H=0,M=0}else H=I>>>24,M+=2}if(Y>=0){U[Y--]=H;while(Y>=0)U[Y--]=0}},Math.clz32)C.prototype._countBits=function(U){return 32-Math.clz32(U)};else C.prototype._countBits=function(U){var V=U,Y=0;if(V>=4096)Y+=13,V>>>=13;if(V>=64)Y+=7,V>>>=7;if(V>=8)Y+=4,V>>>=4;if(V>=2)Y+=2,V>>>=2;return Y+V};C.prototype._zeroBits=function(U){if(U===0)return 26;var V=U,Y=0;if((V&8191)===0)Y+=13,V>>>=13;if((V&127)===0)Y+=7,V>>>=7;if((V&15)===0)Y+=4,V>>>=4;if((V&3)===0)Y+=2,V>>>=2;if((V&1)===0)Y++;return Y},C.prototype.bitLength=function(){var U=this.words[this.length-1],V=this._countBits(U);return(this.length-1)*26+V};function E(k){var U=Array(k.bitLength());for(var V=0;V<U.length;V++){var Y=V/26|0,H=V%26;U[V]=k.words[Y]>>>H&1}return U}C.prototype.zeroBits=function(){if(this.isZero())return 0;var U=0;for(var V=0;V<this.length;V++){var Y=this._zeroBits(this.words[V]);if(U+=Y,Y!==26)break}return U},C.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},C.prototype.toTwos=function(U){if(this.negative!==0)return this.abs().inotn(U).iaddn(1);return this.clone()},C.prototype.fromTwos=function(U){if(this.testn(U-1))return this.notn(U).iaddn(1).ineg();return this.clone()},C.prototype.isNeg=function(){return this.negative!==0},C.prototype.neg=function(){return this.clone().ineg()},C.prototype.ineg=function(){if(!this.isZero())this.negative^=1;return this},C.prototype.iuor=function(U){while(this.length<U.length)this.words[this.length++]=0;for(var V=0;V<U.length;V++)this.words[V]=this.words[V]|U.words[V];return this._strip()},C.prototype.ior=function(U){return P((this.negative|U.negative)===0),this.iuor(U)},C.prototype.or=function(U){if(this.length>U.length)return this.clone().ior(U);return U.clone().ior(this)},C.prototype.uor=function(U){if(this.length>U.length)return this.clone().iuor(U);return U.clone().iuor(this)},C.prototype.iuand=function(U){var V;if(this.length>U.length)V=U;else V=this;for(var Y=0;Y<V.length;Y++)this.words[Y]=this.words[Y]&U.words[Y];return this.length=V.length,this._strip()},C.prototype.iand=function(U){return P((this.negative|U.negative)===0),this.iuand(U)},C.prototype.and=function(U){if(this.length>U.length)return this.clone().iand(U);return U.clone().iand(this)},C.prototype.uand=function(U){if(this.length>U.length)return this.clone().iuand(U);return U.clone().iuand(this)},C.prototype.iuxor=function(U){var V,Y;if(this.length>U.length)V=this,Y=U;else V=U,Y=this;for(var H=0;H<Y.length;H++)this.words[H]=V.words[H]^Y.words[H];if(this!==V)for(;H<V.length;H++)this.words[H]=V.words[H];return this.length=V.length,this._strip()},C.prototype.ixor=function(U){return P((this.negative|U.negative)===0),this.iuxor(U)},C.prototype.xor=function(U){if(this.length>U.length)return this.clone().ixor(U);return U.clone().ixor(this)},C.prototype.uxor=function(U){if(this.length>U.length)return this.clone().iuxor(U);return U.clone().iuxor(this)},C.prototype.inotn=function(U){P(typeof U==="number"&&U>=0);var V=Math.ceil(U/26)|0,Y=U%26;if(this._expand(V),Y>0)V--;for(var H=0;H<V;H++)this.words[H]=~this.words[H]&67108863;if(Y>0)this.words[H]=~this.words[H]&67108863>>26-Y;return this._strip()},C.prototype.notn=function(U){return this.clone().inotn(U)},C.prototype.setn=function(U,V){P(typeof U==="number"&&U>=0);var Y=U/26|0,H=U%26;if(this._expand(Y+1),V)this.words[Y]=this.words[Y]|1<<H;else this.words[Y]=this.words[Y]&~(1<<H);return this._strip()},C.prototype.iadd=function(U){var V;if(this.negative!==0&&U.negative===0)return this.negative=0,V=this.isub(U),this.negative^=1,this._normSign();else if(this.negative===0&&U.negative!==0)return U.negative=0,V=this.isub(U),U.negative=1,V._normSign();var Y,H;if(this.length>U.length)Y=this,H=U;else Y=U,H=this;var K=0;for(var M=0;M<H.length;M++)V=(Y.words[M]|0)+(H.words[M]|0)+K,this.words[M]=V&67108863,K=V>>>26;for(;K!==0&&M<Y.length;M++)V=(Y.words[M]|0)+K,this.words[M]=V&67108863,K=V>>>26;if(this.length=Y.length,K!==0)this.words[this.length]=K,this.length++;else if(Y!==this)for(;M<Y.length;M++)this.words[M]=Y.words[M];return this},C.prototype.add=function(U){var V;if(U.negative!==0&&this.negative===0)return U.negative=0,V=this.sub(U),U.negative^=1,V;else if(U.negative===0&&this.negative!==0)return this.negative=0,V=U.sub(this),this.negative=1,V;if(this.length>U.length)return this.clone().iadd(U);return U.clone().iadd(this)},C.prototype.isub=function(U){if(U.negative!==0){U.negative=0;var V=this.iadd(U);return U.negative=1,V._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(U),this.negative=1,this._normSign();var Y=this.cmp(U);if(Y===0)return this.negative=0,this.length=1,this.words[0]=0,this;var H,K;if(Y>0)H=this,K=U;else H=U,K=this;var M=0;for(var I=0;I<K.length;I++)V=(H.words[I]|0)-(K.words[I]|0)+M,M=V>>26,this.words[I]=V&67108863;for(;M!==0&&I<H.length;I++)V=(H.words[I]|0)+M,M=V>>26,this.words[I]=V&67108863;if(M===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()},C.prototype.sub=function(U){return this.clone().isub(U)};function w(k,U,V){V.negative=U.negative^k.negative;var Y=k.length+U.length|0;V.length=Y,Y=Y-1|0;var H=k.words[0]|0,K=U.words[0]|0,M=H*K,I=M&67108863,j=M/67108864|0;V.words[0]=I;for(var q=1;q<Y;q++){var F=j>>>26,y=j&67108863,r=Math.min(q,U.length-1);for(var u=Math.max(0,q-k.length+1);u<=r;u++){var T1=q-u|0;H=k.words[T1]|0,K=U.words[u]|0,M=H*K+y,F+=M/67108864|0,y=M&67108863}V.words[q]=y|0,j=F|0}if(j!==0)V.words[q]=j|0;else V.length--;return V._strip()}var O=function(U,V,Y){var H=U.words,K=V.words,M=Y.words,I=0,j,q,F,y=H[0]|0,r=y&8191,u=y>>>13,T1=H[1]|0,P1=T1&8191,Q1=T1>>>13,vT=H[2]|0,$1=vT&8191,Z1=vT>>>13,b8=H[3]|0,N1=b8&8191,w1=b8>>>13,vW=H[4]|0,L1=vW&8191,E1=vW>>>13,yW=H[5]|0,B1=yW&8191,O1=yW>>>13,bW=H[6]|0,x1=bW&8191,_1=bW>>>13,lW=H[7]|0,h1=lW&8191,m1=lW>>>13,pW=H[8]|0,g1=pW&8191,v1=pW>>>13,uW=H[9]|0,y1=uW&8191,b1=uW>>>13,dW=K[0]|0,l1=dW&8191,p1=dW>>>13,rW=K[1]|0,u1=rW&8191,d1=rW>>>13,cW=K[2]|0,r1=cW&8191,c1=cW>>>13,oW=K[3]|0,o1=oW&8191,n1=oW>>>13,nW=K[4]|0,f1=nW&8191,i1=nW>>>13,fW=K[5]|0,a1=fW&8191,s1=fW>>>13,iW=K[6]|0,t1=iW&8191,e1=iW>>>13,aW=K[7]|0,TT=aW&8191,AT=aW>>>13,sW=K[8]|0,PT=sW&8191,QT=sW>>>13,tW=K[9]|0,CT=tW&8191,WT=tW>>>13;Y.negative=U.negative^V.negative,Y.length=19,j=Math.imul(r,l1),q=Math.imul(r,p1),q=q+Math.imul(u,l1)|0,F=Math.imul(u,p1);var x4=(I+j|0)+((q&8191)<<13)|0;I=(F+(q>>>13)|0)+(x4>>>26)|0,x4&=67108863,j=Math.imul(P1,l1),q=Math.imul(P1,p1),q=q+Math.imul(Q1,l1)|0,F=Math.imul(Q1,p1),j=j+Math.imul(r,u1)|0,q=q+Math.imul(r,d1)|0,q=q+Math.imul(u,u1)|0,F=F+Math.imul(u,d1)|0;var _4=(I+j|0)+((q&8191)<<13)|0;I=(F+(q>>>13)|0)+(_4>>>26)|0,_4&=67108863,j=Math.imul($1,l1),q=Math.imul($1,p1),q=q+Math.imul(Z1,l1)|0,F=Math.imul(Z1,p1),j=j+Math.imul(P1,u1)|0,q=q+Math.imul(P1,d1)|0,q=q+Math.imul(Q1,u1)|0,F=F+Math.imul(Q1,d1)|0,j=j+Math.imul(r,r1)|0,q=q+Math.imul(r,c1)|0,q=q+Math.imul(u,r1)|0,F=F+Math.imul(u,c1)|0;var h4=(I+j|0)+((q&8191)<<13)|0;I=(F+(q>>>13)|0)+(h4>>>26)|0,h4&=67108863,j=Math.imul(N1,l1),q=Math.imul(N1,p1),q=q+Math.imul(w1,l1)|0,F=Math.imul(w1,p1),j=j+Math.imul($1,u1)|0,q=q+Math.imul($1,d1)|0,q=q+Math.imul(Z1,u1)|0,F=F+Math.imul(Z1,d1)|0,j=j+Math.imul(P1,r1)|0,q=q+Math.imul(P1,c1)|0,q=q+Math.imul(Q1,r1)|0,F=F+Math.imul(Q1,c1)|0,j=j+Math.imul(r,o1)|0,q=q+Math.imul(r,n1)|0,q=q+Math.imul(u,o1)|0,F=F+Math.imul(u,n1)|0;var m4=(I+j|0)+((q&8191)<<13)|0;I=(F+(q>>>13)|0)+(m4>>>26)|0,m4&=67108863,j=Math.imul(L1,l1),q=Math.imul(L1,p1),q=q+Math.imul(E1,l1)|0,F=Math.imul(E1,p1),j=j+Math.imul(N1,u1)|0,q=q+Math.imul(N1,d1)|0,q=q+Math.imul(w1,u1)|0,F=F+Math.imul(w1,d1)|0,j=j+Math.imul($1,r1)|0,q=q+Math.imul($1,c1)|0,q=q+Math.imul(Z1,r1)|0,F=F+Math.imul(Z1,c1)|0,j=j+Math.imul(P1,o1)|0,q=q+Math.imul(P1,n1)|0,q=q+Math.imul(Q1,o1)|0,F=F+Math.imul(Q1,n1)|0,j=j+Math.imul(r,f1)|0,q=q+Math.imul(r,i1)|0,q=q+Math.imul(u,f1)|0,F=F+Math.imul(u,i1)|0;var g4=(I+j|0)+((q&8191)<<13)|0;I=(F+(q>>>13)|0)+(g4>>>26)|0,g4&=67108863,j=Math.imul(B1,l1),q=Math.imul(B1,p1),q=q+Math.imul(O1,l1)|0,F=Math.imul(O1,p1),j=j+Math.imul(L1,u1)|0,q=q+Math.imul(L1,d1)|0,q=q+Math.imul(E1,u1)|0,F=F+Math.imul(E1,d1)|0,j=j+Math.imul(N1,r1)|0,q=q+Math.imul(N1,c1)|0,q=q+Math.imul(w1,r1)|0,F=F+Math.imul(w1,c1)|0,j=j+Math.imul($1,o1)|0,q=q+Math.imul($1,n1)|0,q=q+Math.imul(Z1,o1)|0,F=F+Math.imul(Z1,n1)|0,j=j+Math.imul(P1,f1)|0,q=q+Math.imul(P1,i1)|0,q=q+Math.imul(Q1,f1)|0,F=F+Math.imul(Q1,i1)|0,j=j+Math.imul(r,a1)|0,q=q+Math.imul(r,s1)|0,q=q+Math.imul(u,a1)|0,F=F+Math.imul(u,s1)|0;var v4=(I+j|0)+((q&8191)<<13)|0;I=(F+(q>>>13)|0)+(v4>>>26)|0,v4&=67108863,j=Math.imul(x1,l1),q=Math.imul(x1,p1),q=q+Math.imul(_1,l1)|0,F=Math.imul(_1,p1),j=j+Math.imul(B1,u1)|0,q=q+Math.imul(B1,d1)|0,q=q+Math.imul(O1,u1)|0,F=F+Math.imul(O1,d1)|0,j=j+Math.imul(L1,r1)|0,q=q+Math.imul(L1,c1)|0,q=q+Math.imul(E1,r1)|0,F=F+Math.imul(E1,c1)|0,j=j+Math.imul(N1,o1)|0,q=q+Math.imul(N1,n1)|0,q=q+Math.imul(w1,o1)|0,F=F+Math.imul(w1,n1)|0,j=j+Math.imul($1,f1)|0,q=q+Math.imul($1,i1)|0,q=q+Math.imul(Z1,f1)|0,F=F+Math.imul(Z1,i1)|0,j=j+Math.imul(P1,a1)|0,q=q+Math.imul(P1,s1)|0,q=q+Math.imul(Q1,a1)|0,F=F+Math.imul(Q1,s1)|0,j=j+Math.imul(r,t1)|0,q=q+Math.imul(r,e1)|0,q=q+Math.imul(u,t1)|0,F=F+Math.imul(u,e1)|0;var y4=(I+j|0)+((q&8191)<<13)|0;I=(F+(q>>>13)|0)+(y4>>>26)|0,y4&=67108863,j=Math.imul(h1,l1),q=Math.imul(h1,p1),q=q+Math.imul(m1,l1)|0,F=Math.imul(m1,p1),j=j+Math.imul(x1,u1)|0,q=q+Math.imul(x1,d1)|0,q=q+Math.imul(_1,u1)|0,F=F+Math.imul(_1,d1)|0,j=j+Math.imul(B1,r1)|0,q=q+Math.imul(B1,c1)|0,q=q+Math.imul(O1,r1)|0,F=F+Math.imul(O1,c1)|0,j=j+Math.imul(L1,o1)|0,q=q+Math.imul(L1,n1)|0,q=q+Math.imul(E1,o1)|0,F=F+Math.imul(E1,n1)|0,j=j+Math.imul(N1,f1)|0,q=q+Math.imul(N1,i1)|0,q=q+Math.imul(w1,f1)|0,F=F+Math.imul(w1,i1)|0,j=j+Math.imul($1,a1)|0,q=q+Math.imul($1,s1)|0,q=q+Math.imul(Z1,a1)|0,F=F+Math.imul(Z1,s1)|0,j=j+Math.imul(P1,t1)|0,q=q+Math.imul(P1,e1)|0,q=q+Math.imul(Q1,t1)|0,F=F+Math.imul(Q1,e1)|0,j=j+Math.imul(r,TT)|0,q=q+Math.imul(r,AT)|0,q=q+Math.imul(u,TT)|0,F=F+Math.imul(u,AT)|0;var b4=(I+j|0)+((q&8191)<<13)|0;I=(F+(q>>>13)|0)+(b4>>>26)|0,b4&=67108863,j=Math.imul(g1,l1),q=Math.imul(g1,p1),q=q+Math.imul(v1,l1)|0,F=Math.imul(v1,p1),j=j+Math.imul(h1,u1)|0,q=q+Math.imul(h1,d1)|0,q=q+Math.imul(m1,u1)|0,F=F+Math.imul(m1,d1)|0,j=j+Math.imul(x1,r1)|0,q=q+Math.imul(x1,c1)|0,q=q+Math.imul(_1,r1)|0,F=F+Math.imul(_1,c1)|0,j=j+Math.imul(B1,o1)|0,q=q+Math.imul(B1,n1)|0,q=q+Math.imul(O1,o1)|0,F=F+Math.imul(O1,n1)|0,j=j+Math.imul(L1,f1)|0,q=q+Math.imul(L1,i1)|0,q=q+Math.imul(E1,f1)|0,F=F+Math.imul(E1,i1)|0,j=j+Math.imul(N1,a1)|0,q=q+Math.imul(N1,s1)|0,q=q+Math.imul(w1,a1)|0,F=F+Math.imul(w1,s1)|0,j=j+Math.imul($1,t1)|0,q=q+Math.imul($1,e1)|0,q=q+Math.imul(Z1,t1)|0,F=F+Math.imul(Z1,e1)|0,j=j+Math.imul(P1,TT)|0,q=q+Math.imul(P1,AT)|0,q=q+Math.imul(Q1,TT)|0,F=F+Math.imul(Q1,AT)|0,j=j+Math.imul(r,PT)|0,q=q+Math.imul(r,QT)|0,q=q+Math.imul(u,PT)|0,F=F+Math.imul(u,QT)|0;var l4=(I+j|0)+((q&8191)<<13)|0;I=(F+(q>>>13)|0)+(l4>>>26)|0,l4&=67108863,j=Math.imul(y1,l1),q=Math.imul(y1,p1),q=q+Math.imul(b1,l1)|0,F=Math.imul(b1,p1),j=j+Math.imul(g1,u1)|0,q=q+Math.imul(g1,d1)|0,q=q+Math.imul(v1,u1)|0,F=F+Math.imul(v1,d1)|0,j=j+Math.imul(h1,r1)|0,q=q+Math.imul(h1,c1)|0,q=q+Math.imul(m1,r1)|0,F=F+Math.imul(m1,c1)|0,j=j+Math.imul(x1,o1)|0,q=q+Math.imul(x1,n1)|0,q=q+Math.imul(_1,o1)|0,F=F+Math.imul(_1,n1)|0,j=j+Math.imul(B1,f1)|0,q=q+Math.imul(B1,i1)|0,q=q+Math.imul(O1,f1)|0,F=F+Math.imul(O1,i1)|0,j=j+Math.imul(L1,a1)|0,q=q+Math.imul(L1,s1)|0,q=q+Math.imul(E1,a1)|0,F=F+Math.imul(E1,s1)|0,j=j+Math.imul(N1,t1)|0,q=q+Math.imul(N1,e1)|0,q=q+Math.imul(w1,t1)|0,F=F+Math.imul(w1,e1)|0,j=j+Math.imul($1,TT)|0,q=q+Math.imul($1,AT)|0,q=q+Math.imul(Z1,TT)|0,F=F+Math.imul(Z1,AT)|0,j=j+Math.imul(P1,PT)|0,q=q+Math.imul(P1,QT)|0,q=q+Math.imul(Q1,PT)|0,F=F+Math.imul(Q1,QT)|0,j=j+Math.imul(r,CT)|0,q=q+Math.imul(r,WT)|0,q=q+Math.imul(u,CT)|0,F=F+Math.imul(u,WT)|0;var p4=(I+j|0)+((q&8191)<<13)|0;I=(F+(q>>>13)|0)+(p4>>>26)|0,p4&=67108863,j=Math.imul(y1,u1),q=Math.imul(y1,d1),q=q+Math.imul(b1,u1)|0,F=Math.imul(b1,d1),j=j+Math.imul(g1,r1)|0,q=q+Math.imul(g1,c1)|0,q=q+Math.imul(v1,r1)|0,F=F+Math.imul(v1,c1)|0,j=j+Math.imul(h1,o1)|0,q=q+Math.imul(h1,n1)|0,q=q+Math.imul(m1,o1)|0,F=F+Math.imul(m1,n1)|0,j=j+Math.imul(x1,f1)|0,q=q+Math.imul(x1,i1)|0,q=q+Math.imul(_1,f1)|0,F=F+Math.imul(_1,i1)|0,j=j+Math.imul(B1,a1)|0,q=q+Math.imul(B1,s1)|0,q=q+Math.imul(O1,a1)|0,F=F+Math.imul(O1,s1)|0,j=j+Math.imul(L1,t1)|0,q=q+Math.imul(L1,e1)|0,q=q+Math.imul(E1,t1)|0,F=F+Math.imul(E1,e1)|0,j=j+Math.imul(N1,TT)|0,q=q+Math.imul(N1,AT)|0,q=q+Math.imul(w1,TT)|0,F=F+Math.imul(w1,AT)|0,j=j+Math.imul($1,PT)|0,q=q+Math.imul($1,QT)|0,q=q+Math.imul(Z1,PT)|0,F=F+Math.imul(Z1,QT)|0,j=j+Math.imul(P1,CT)|0,q=q+Math.imul(P1,WT)|0,q=q+Math.imul(Q1,CT)|0,F=F+Math.imul(Q1,WT)|0;var u4=(I+j|0)+((q&8191)<<13)|0;I=(F+(q>>>13)|0)+(u4>>>26)|0,u4&=67108863,j=Math.imul(y1,r1),q=Math.imul(y1,c1),q=q+Math.imul(b1,r1)|0,F=Math.imul(b1,c1),j=j+Math.imul(g1,o1)|0,q=q+Math.imul(g1,n1)|0,q=q+Math.imul(v1,o1)|0,F=F+Math.imul(v1,n1)|0,j=j+Math.imul(h1,f1)|0,q=q+Math.imul(h1,i1)|0,q=q+Math.imul(m1,f1)|0,F=F+Math.imul(m1,i1)|0,j=j+Math.imul(x1,a1)|0,q=q+Math.imul(x1,s1)|0,q=q+Math.imul(_1,a1)|0,F=F+Math.imul(_1,s1)|0,j=j+Math.imul(B1,t1)|0,q=q+Math.imul(B1,e1)|0,q=q+Math.imul(O1,t1)|0,F=F+Math.imul(O1,e1)|0,j=j+Math.imul(L1,TT)|0,q=q+Math.imul(L1,AT)|0,q=q+Math.imul(E1,TT)|0,F=F+Math.imul(E1,AT)|0,j=j+Math.imul(N1,PT)|0,q=q+Math.imul(N1,QT)|0,q=q+Math.imul(w1,PT)|0,F=F+Math.imul(w1,QT)|0,j=j+Math.imul($1,CT)|0,q=q+Math.imul($1,WT)|0,q=q+Math.imul(Z1,CT)|0,F=F+Math.imul(Z1,WT)|0;var d4=(I+j|0)+((q&8191)<<13)|0;I=(F+(q>>>13)|0)+(d4>>>26)|0,d4&=67108863,j=Math.imul(y1,o1),q=Math.imul(y1,n1),q=q+Math.imul(b1,o1)|0,F=Math.imul(b1,n1),j=j+Math.imul(g1,f1)|0,q=q+Math.imul(g1,i1)|0,q=q+Math.imul(v1,f1)|0,F=F+Math.imul(v1,i1)|0,j=j+Math.imul(h1,a1)|0,q=q+Math.imul(h1,s1)|0,q=q+Math.imul(m1,a1)|0,F=F+Math.imul(m1,s1)|0,j=j+Math.imul(x1,t1)|0,q=q+Math.imul(x1,e1)|0,q=q+Math.imul(_1,t1)|0,F=F+Math.imul(_1,e1)|0,j=j+Math.imul(B1,TT)|0,q=q+Math.imul(B1,AT)|0,q=q+Math.imul(O1,TT)|0,F=F+Math.imul(O1,AT)|0,j=j+Math.imul(L1,PT)|0,q=q+Math.imul(L1,QT)|0,q=q+Math.imul(E1,PT)|0,F=F+Math.imul(E1,QT)|0,j=j+Math.imul(N1,CT)|0,q=q+Math.imul(N1,WT)|0,q=q+Math.imul(w1,CT)|0,F=F+Math.imul(w1,WT)|0;var r4=(I+j|0)+((q&8191)<<13)|0;I=(F+(q>>>13)|0)+(r4>>>26)|0,r4&=67108863,j=Math.imul(y1,f1),q=Math.imul(y1,i1),q=q+Math.imul(b1,f1)|0,F=Math.imul(b1,i1),j=j+Math.imul(g1,a1)|0,q=q+Math.imul(g1,s1)|0,q=q+Math.imul(v1,a1)|0,F=F+Math.imul(v1,s1)|0,j=j+Math.imul(h1,t1)|0,q=q+Math.imul(h1,e1)|0,q=q+Math.imul(m1,t1)|0,F=F+Math.imul(m1,e1)|0,j=j+Math.imul(x1,TT)|0,q=q+Math.imul(x1,AT)|0,q=q+Math.imul(_1,TT)|0,F=F+Math.imul(_1,AT)|0,j=j+Math.imul(B1,PT)|0,q=q+Math.imul(B1,QT)|0,q=q+Math.imul(O1,PT)|0,F=F+Math.imul(O1,QT)|0,j=j+Math.imul(L1,CT)|0,q=q+Math.imul(L1,WT)|0,q=q+Math.imul(E1,CT)|0,F=F+Math.imul(E1,WT)|0;var c4=(I+j|0)+((q&8191)<<13)|0;I=(F+(q>>>13)|0)+(c4>>>26)|0,c4&=67108863,j=Math.imul(y1,a1),q=Math.imul(y1,s1),q=q+Math.imul(b1,a1)|0,F=Math.imul(b1,s1),j=j+Math.imul(g1,t1)|0,q=q+Math.imul(g1,e1)|0,q=q+Math.imul(v1,t1)|0,F=F+Math.imul(v1,e1)|0,j=j+Math.imul(h1,TT)|0,q=q+Math.imul(h1,AT)|0,q=q+Math.imul(m1,TT)|0,F=F+Math.imul(m1,AT)|0,j=j+Math.imul(x1,PT)|0,q=q+Math.imul(x1,QT)|0,q=q+Math.imul(_1,PT)|0,F=F+Math.imul(_1,QT)|0,j=j+Math.imul(B1,CT)|0,q=q+Math.imul(B1,WT)|0,q=q+Math.imul(O1,CT)|0,F=F+Math.imul(O1,WT)|0;var o4=(I+j|0)+((q&8191)<<13)|0;I=(F+(q>>>13)|0)+(o4>>>26)|0,o4&=67108863,j=Math.imul(y1,t1),q=Math.imul(y1,e1),q=q+Math.imul(b1,t1)|0,F=Math.imul(b1,e1),j=j+Math.imul(g1,TT)|0,q=q+Math.imul(g1,AT)|0,q=q+Math.imul(v1,TT)|0,F=F+Math.imul(v1,AT)|0,j=j+Math.imul(h1,PT)|0,q=q+Math.imul(h1,QT)|0,q=q+Math.imul(m1,PT)|0,F=F+Math.imul(m1,QT)|0,j=j+Math.imul(x1,CT)|0,q=q+Math.imul(x1,WT)|0,q=q+Math.imul(_1,CT)|0,F=F+Math.imul(_1,WT)|0;var n4=(I+j|0)+((q&8191)<<13)|0;I=(F+(q>>>13)|0)+(n4>>>26)|0,n4&=67108863,j=Math.imul(y1,TT),q=Math.imul(y1,AT),q=q+Math.imul(b1,TT)|0,F=Math.imul(b1,AT),j=j+Math.imul(g1,PT)|0,q=q+Math.imul(g1,QT)|0,q=q+Math.imul(v1,PT)|0,F=F+Math.imul(v1,QT)|0,j=j+Math.imul(h1,CT)|0,q=q+Math.imul(h1,WT)|0,q=q+Math.imul(m1,CT)|0,F=F+Math.imul(m1,WT)|0;var f4=(I+j|0)+((q&8191)<<13)|0;I=(F+(q>>>13)|0)+(f4>>>26)|0,f4&=67108863,j=Math.imul(y1,PT),q=Math.imul(y1,QT),q=q+Math.imul(b1,PT)|0,F=Math.imul(b1,QT),j=j+Math.imul(g1,CT)|0,q=q+Math.imul(g1,WT)|0,q=q+Math.imul(v1,CT)|0,F=F+Math.imul(v1,WT)|0;var i4=(I+j|0)+((q&8191)<<13)|0;I=(F+(q>>>13)|0)+(i4>>>26)|0,i4&=67108863,j=Math.imul(y1,CT),q=Math.imul(y1,WT),q=q+Math.imul(b1,CT)|0,F=Math.imul(b1,WT);var a4=(I+j|0)+((q&8191)<<13)|0;if(I=(F+(q>>>13)|0)+(a4>>>26)|0,a4&=67108863,M[0]=x4,M[1]=_4,M[2]=h4,M[3]=m4,M[4]=g4,M[5]=v4,M[6]=y4,M[7]=b4,M[8]=l4,M[9]=p4,M[10]=u4,M[11]=d4,M[12]=r4,M[13]=c4,M[14]=o4,M[15]=n4,M[16]=f4,M[17]=i4,M[18]=a4,I!==0)M[19]=I,Y.length++;return Y};if(!Math.imul)O=w;function m(k,U,V){V.negative=U.negative^k.negative,V.length=k.length+U.length;var Y=0,H=0;for(var K=0;K<V.length-1;K++){var M=H;H=0;var I=Y&67108863,j=Math.min(K,U.length-1);for(var q=Math.max(0,K-k.length+1);q<=j;q++){var F=K-q,y=k.words[F]|0,r=U.words[q]|0,u=y*r,T1=u&67108863;M=M+(u/67108864|0)|0,T1=T1+I|0,I=T1&67108863,M=M+(T1>>>26)|0,H+=M>>>26,M&=67108863}V.words[K]=I,Y=M,M=H}if(Y!==0)V.words[K]=Y;else V.length--;return V._strip()}function g(k,U,V){return m(k,U,V)}C.prototype.mulTo=function(U,V){var Y,H=this.length+U.length;if(this.length===10&&U.length===10)Y=O(this,U,V);else if(H<63)Y=w(this,U,V);else if(H<1024)Y=m(this,U,V);else Y=g(this,U,V);return Y};function p(k,U){this.x=k,this.y=U}p.prototype.makeRBT=function(U){var V=Array(U),Y=C.prototype._countBits(U)-1;for(var H=0;H<U;H++)V[H]=this.revBin(H,Y,U);return V},p.prototype.revBin=function(U,V,Y){if(U===0||U===Y-1)return U;var H=0;for(var K=0;K<V;K++)H|=(U&1)<<V-K-1,U>>=1;return H},p.prototype.permute=function(U,V,Y,H,K,M){for(var I=0;I<M;I++)H[I]=V[U[I]],K[I]=Y[U[I]]},p.prototype.transform=function(U,V,Y,H,K,M){this.permute(M,U,V,Y,H,K);for(var I=1;I<K;I<<=1){var j=I<<1,q=Math.cos(2*Math.PI/j),F=Math.sin(2*Math.PI/j);for(var y=0;y<K;y+=j){var r=q,u=F;for(var T1=0;T1<I;T1++){var P1=Y[y+T1],Q1=H[y+T1],vT=Y[y+T1+I],$1=H[y+T1+I],Z1=r*vT-u*$1;if($1=r*$1+u*vT,vT=Z1,Y[y+T1]=P1+vT,H[y+T1]=Q1+$1,Y[y+T1+I]=P1-vT,H[y+T1+I]=Q1-$1,T1!==j)Z1=q*r-F*u,u=q*u+F*r,r=Z1}}}},p.prototype.guessLen13b=function(U,V){var Y=Math.max(V,U)|1,H=Y&1,K=0;for(Y=Y/2|0;Y;Y=Y>>>1)K++;return 1<<K+1+H},p.prototype.conjugate=function(U,V,Y){if(Y<=1)return;for(var H=0;H<Y/2;H++){var K=U[H];U[H]=U[Y-H-1],U[Y-H-1]=K,K=V[H],V[H]=-V[Y-H-1],V[Y-H-1]=-K}},p.prototype.normalize13b=function(U,V){var Y=0;for(var H=0;H<V/2;H++){var K=Math.round(U[2*H+1]/V)*8192+Math.round(U[2*H]/V)+Y;if(U[H]=K&67108863,K<67108864)Y=0;else Y=K/67108864|0}return U},p.prototype.convert13b=function(U,V,Y,H){var K=0;for(var M=0;M<V;M++)K=K+(U[M]|0),Y[2*M]=K&8191,K=K>>>13,Y[2*M+1]=K&8191,K=K>>>13;for(M=2*V;M<H;++M)Y[M]=0;P(K===0),P((K&-8192)===0)},p.prototype.stub=function(U){var V=Array(U);for(var Y=0;Y<U;Y++)V[Y]=0;return V},p.prototype.mulp=function(U,V,Y){var H=2*this.guessLen13b(U.length,V.length),K=this.makeRBT(H),M=this.stub(H),I=Array(H),j=Array(H),q=Array(H),F=Array(H),y=Array(H),r=Array(H),u=Y.words;u.length=H,this.convert13b(U.words,U.length,I,H),this.convert13b(V.words,V.length,F,H),this.transform(I,M,j,q,H,K),this.transform(F,M,y,r,H,K);for(var T1=0;T1<H;T1++){var P1=j[T1]*y[T1]-q[T1]*r[T1];q[T1]=j[T1]*r[T1]+q[T1]*y[T1],j[T1]=P1}return this.conjugate(j,q,H),this.transform(j,q,u,M,H,K),this.conjugate(u,M,H),this.normalize13b(u,H),Y.negative=U.negative^V.negative,Y.length=U.length+V.length,Y._strip()},C.prototype.mul=function(U){var V=new C(null);return V.words=Array(this.length+U.length),this.mulTo(U,V)},C.prototype.mulf=function(U){var V=new C(null);return V.words=Array(this.length+U.length),g(this,U,V)},C.prototype.imul=function(U){return this.clone().mulTo(U,this)},C.prototype.imuln=function(U){var V=U<0;if(V)U=-U;P(typeof U==="number"),P(U<67108864);var Y=0;for(var H=0;H<this.length;H++){var K=(this.words[H]|0)*U,M=(K&67108863)+(Y&67108863);Y>>=26,Y+=K/67108864|0,Y+=M>>>26,this.words[H]=M&67108863}if(Y!==0)this.words[H]=Y,this.length++;return this.length=U===0?1:this.length,V?this.ineg():this},C.prototype.muln=function(U){return this.clone().imuln(U)},C.prototype.sqr=function(){return this.mul(this)},C.prototype.isqr=function(){return this.imul(this.clone())},C.prototype.pow=function(U){var V=E(U);if(V.length===0)return new C(1);var Y=this;for(var H=0;H<V.length;H++,Y=Y.sqr())if(V[H]!==0)break;if(++H<V.length)for(var K=Y.sqr();H<V.length;H++,K=K.sqr()){if(V[H]===0)continue;Y=Y.mul(K)}return Y},C.prototype.iushln=function(U){P(typeof U==="number"&&U>=0);var V=U%26,Y=(U-V)/26,H=67108863>>>26-V<<26-V,K;if(V!==0){var M=0;for(K=0;K<this.length;K++){var I=this.words[K]&H,j=(this.words[K]|0)-I<<V;this.words[K]=j|M,M=I>>>26-V}if(M)this.words[K]=M,this.length++}if(Y!==0){for(K=this.length-1;K>=0;K--)this.words[K+Y]=this.words[K];for(K=0;K<Y;K++)this.words[K]=0;this.length+=Y}return this._strip()},C.prototype.ishln=function(U){return P(this.negative===0),this.iushln(U)},C.prototype.iushrn=function(U,V,Y){P(typeof U==="number"&&U>=0);var H;if(V)H=(V-V%26)/26;else H=0;var K=U%26,M=Math.min((U-K)/26,this.length),I=67108863^67108863>>>K<<K,j=Y;if(H-=M,H=Math.max(0,H),j){for(var q=0;q<M;q++)j.words[q]=this.words[q];j.length=M}if(M===0);else if(this.length>M){this.length-=M;for(q=0;q<this.length;q++)this.words[q]=this.words[q+M]}else this.words[0]=0,this.length=1;var F=0;for(q=this.length-1;q>=0&&(F!==0||q>=H);q--){var y=this.words[q]|0;this.words[q]=F<<26-K|y>>>K,F=y&I}if(j&&F!==0)j.words[j.length++]=F;if(this.length===0)this.words[0]=0,this.length=1;return this._strip()},C.prototype.ishrn=function(U,V,Y){return P(this.negative===0),this.iushrn(U,V,Y)},C.prototype.shln=function(U){return this.clone().ishln(U)},C.prototype.ushln=function(U){return this.clone().iushln(U)},C.prototype.shrn=function(U){return this.clone().ishrn(U)},C.prototype.ushrn=function(U){return this.clone().iushrn(U)},C.prototype.testn=function(U){P(typeof U==="number"&&U>=0);var V=U%26,Y=(U-V)/26,H=1<<V;if(this.length<=Y)return!1;var K=this.words[Y];return!!(K&H)},C.prototype.imaskn=function(U){P(typeof U==="number"&&U>=0);var V=U%26,Y=(U-V)/26;if(P(this.negative===0,"imaskn works only with positive numbers"),this.length<=Y)return this;if(V!==0)Y++;if(this.length=Math.min(Y,this.length),V!==0){var H=67108863^67108863>>>V<<V;this.words[this.length-1]&=H}return this._strip()},C.prototype.maskn=function(U){return this.clone().imaskn(U)},C.prototype.iaddn=function(U){if(P(typeof U==="number"),P(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)},C.prototype._iaddn=function(U){this.words[0]+=U;for(var V=0;V<this.length&&this.words[V]>=67108864;V++)if(this.words[V]-=67108864,V===this.length-1)this.words[V+1]=1;else this.words[V+1]++;return this.length=Math.max(this.length,V+1),this},C.prototype.isubn=function(U){if(P(typeof U==="number"),P(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 V=0;V<this.length&&this.words[V]<0;V++)this.words[V]+=67108864,this.words[V+1]-=1;return this._strip()},C.prototype.addn=function(U){return this.clone().iaddn(U)},C.prototype.subn=function(U){return this.clone().isubn(U)},C.prototype.iabs=function(){return this.negative=0,this},C.prototype.abs=function(){return this.clone().iabs()},C.prototype._ishlnsubmul=function(U,V,Y){var H=U.length+Y,K;this._expand(H);var M,I=0;for(K=0;K<U.length;K++){M=(this.words[K+Y]|0)+I;var j=(U.words[K]|0)*V;M-=j&67108863,I=(M>>26)-(j/67108864|0),this.words[K+Y]=M&67108863}for(;K<this.length-Y;K++)M=(this.words[K+Y]|0)+I,I=M>>26,this.words[K+Y]=M&67108863;if(I===0)return this._strip();P(I===-1),I=0;for(K=0;K<this.length;K++)M=-(this.words[K]|0)+I,I=M>>26,this.words[K]=M&67108863;return this.negative=1,this._strip()},C.prototype._wordDiv=function(U,V){var Y=this.length-U.length,H=this.clone(),K=U,M=K.words[K.length-1]|0,I=this._countBits(M);if(Y=26-I,Y!==0)K=K.ushln(Y),H.iushln(Y),M=K.words[K.length-1]|0;var j=H.length-K.length,q;if(V!=="mod"){q=new C(null),q.length=j+1,q.words=Array(q.length);for(var F=0;F<q.length;F++)q.words[F]=0}var y=H.clone()._ishlnsubmul(K,1,j);if(y.negative===0){if(H=y,q)q.words[j]=1}for(var r=j-1;r>=0;r--){var u=(H.words[K.length+r]|0)*67108864+(H.words[K.length+r-1]|0);u=Math.min(u/M|0,67108863),H._ishlnsubmul(K,u,r);while(H.negative!==0)if(u--,H.negative=0,H._ishlnsubmul(K,1,r),!H.isZero())H.negative^=1;if(q)q.words[r]=u}if(q)q._strip();if(H._strip(),V!=="div"&&Y!==0)H.iushrn(Y);return{div:q||null,mod:H}},C.prototype.divmod=function(U,V,Y){if(P(!U.isZero()),this.isZero())return{div:new C(0),mod:new C(0)};var H,K,M;if(this.negative!==0&&U.negative===0){if(M=this.neg().divmod(U,V),V!=="mod")H=M.div.neg();if(V!=="div"){if(K=M.mod.neg(),Y&&K.negative!==0)K.iadd(U)}return{div:H,mod:K}}if(this.negative===0&&U.negative!==0){if(M=this.divmod(U.neg(),V),V!=="mod")H=M.div.neg();return{div:H,mod:M.mod}}if((this.negative&U.negative)!==0){if(M=this.neg().divmod(U.neg(),V),V!=="div"){if(K=M.mod.neg(),Y&&K.negative!==0)K.isub(U)}return{div:M.div,mod:K}}if(U.length>this.length||this.cmp(U)<0)return{div:new C(0),mod:this};if(U.length===1){if(V==="div")return{div:this.divn(U.words[0]),mod:null};if(V==="mod")return{div:null,mod:new C(this.modrn(U.words[0]))};return{div:this.divn(U.words[0]),mod:new C(this.modrn(U.words[0]))}}return this._wordDiv(U,V)},C.prototype.div=function(U){return this.divmod(U,"div",!1).div},C.prototype.mod=function(U){return this.divmod(U,"mod",!1).mod},C.prototype.umod=function(U){return this.divmod(U,"mod",!0).mod},C.prototype.divRound=function(U){var V=this.divmod(U);if(V.mod.isZero())return V.div;var Y=V.div.negative!==0?V.mod.isub(U):V.mod,H=U.ushrn(1),K=U.andln(1),M=Y.cmp(H);if(M<0||K===1&&M===0)return V.div;return V.div.negative!==0?V.div.isubn(1):V.div.iaddn(1)},C.prototype.modrn=function(U){var V=U<0;if(V)U=-U;P(U<=67108863);var Y=67108864%U,H=0;for(var K=this.length-1;K>=0;K--)H=(Y*H+(this.words[K]|0))%U;return V?-H:H},C.prototype.modn=function(U){return this.modrn(U)},C.prototype.idivn=function(U){var V=U<0;if(V)U=-U;P(U<=67108863);var Y=0;for(var H=this.length-1;H>=0;H--){var K=(this.words[H]|0)+Y*67108864;this.words[H]=K/U|0,Y=K%U}return this._strip(),V?this.ineg():this},C.prototype.divn=function(U){return this.clone().idivn(U)},C.prototype.egcd=function(U){P(U.negative===0),P(!U.isZero());var V=this,Y=U.clone();if(V.negative!==0)V=V.umod(U);else V=V.clone();var H=new C(1),K=new C(0),M=new C(0),I=new C(1),j=0;while(V.isEven()&&Y.isEven())V.iushrn(1),Y.iushrn(1),++j;var q=Y.clone(),F=V.clone();while(!V.isZero()){for(var y=0,r=1;(V.words[0]&r)===0&&y<26;++y,r<<=1);if(y>0){V.iushrn(y);while(y-- >0){if(H.isOdd()||K.isOdd())H.iadd(q),K.isub(F);H.iushrn(1),K.iushrn(1)}}for(var u=0,T1=1;(Y.words[0]&T1)===0&&u<26;++u,T1<<=1);if(u>0){Y.iushrn(u);while(u-- >0){if(M.isOdd()||I.isOdd())M.iadd(q),I.isub(F);M.iushrn(1),I.iushrn(1)}}if(V.cmp(Y)>=0)V.isub(Y),H.isub(M),K.isub(I);else Y.isub(V),M.isub(H),I.isub(K)}return{a:M,b:I,gcd:Y.iushln(j)}},C.prototype._invmp=function(U){P(U.negative===0),P(!U.isZero());var V=this,Y=U.clone();if(V.negative!==0)V=V.umod(U);else V=V.clone();var H=new C(1),K=new C(0),M=Y.clone();while(V.cmpn(1)>0&&Y.cmpn(1)>0){for(var I=0,j=1;(V.words[0]&j)===0&&I<26;++I,j<<=1);if(I>0){V.iushrn(I);while(I-- >0){if(H.isOdd())H.iadd(M);H.iushrn(1)}}for(var q=0,F=1;(Y.words[0]&F)===0&&q<26;++q,F<<=1);if(q>0){Y.iushrn(q);while(q-- >0){if(K.isOdd())K.iadd(M);K.iushrn(1)}}if(V.cmp(Y)>=0)V.isub(Y),H.isub(K);else Y.isub(V),K.isub(H)}var y;if(V.cmpn(1)===0)y=H;else y=K;if(y.cmpn(0)<0)y.iadd(U);return y},C.prototype.gcd=function(U){if(this.isZero())return U.abs();if(U.isZero())return this.abs();var V=this.clone(),Y=U.clone();V.negative=0,Y.negative=0;for(var H=0;V.isEven()&&Y.isEven();H++)V.iushrn(1),Y.iushrn(1);do{while(V.isEven())V.iushrn(1);while(Y.isEven())Y.iushrn(1);var K=V.cmp(Y);if(K<0){var M=V;V=Y,Y=M}else if(K===0||Y.cmpn(1)===0)break;V.isub(Y)}while(!0);return Y.iushln(H)},C.prototype.invm=function(U){return this.egcd(U).a.umod(U)},C.prototype.isEven=function(){return(this.words[0]&1)===0},C.prototype.isOdd=function(){return(this.words[0]&1)===1},C.prototype.andln=function(U){return this.words[0]&U},C.prototype.bincn=function(U){P(typeof U==="number");var V=U%26,Y=(U-V)/26,H=1<<V;if(this.length<=Y)return this._expand(Y+1),this.words[Y]|=H,this;var K=H;for(var M=Y;K!==0&&M<this.length;M++){var I=this.words[M]|0;I+=K,K=I>>>26,I&=67108863,this.words[M]=I}if(K!==0)this.words[M]=K,this.length++;return this},C.prototype.isZero=function(){return this.length===1&&this.words[0]===0},C.prototype.cmpn=function(U){var V=U<0;if(this.negative!==0&&!V)return-1;if(this.negative===0&&V)return 1;this._strip();var Y;if(this.length>1)Y=1;else{if(V)U=-U;P(U<=67108863,"Number is too big");var H=this.words[0]|0;Y=H===U?0:H<U?-1:1}if(this.negative!==0)return-Y|0;return Y},C.prototype.cmp=function(U){if(this.negative!==0&&U.negative===0)return-1;if(this.negative===0&&U.negative!==0)return 1;var V=this.ucmp(U);if(this.negative!==0)return-V|0;return V},C.prototype.ucmp=function(U){if(this.length>U.length)return 1;if(this.length<U.length)return-1;var V=0;for(var Y=this.length-1;Y>=0;Y--){var H=this.words[Y]|0,K=U.words[Y]|0;if(H===K)continue;if(H<K)V=-1;else if(H>K)V=1;break}return V},C.prototype.gtn=function(U){return this.cmpn(U)===1},C.prototype.gt=function(U){return this.cmp(U)===1},C.prototype.gten=function(U){return this.cmpn(U)>=0},C.prototype.gte=function(U){return this.cmp(U)>=0},C.prototype.ltn=function(U){return this.cmpn(U)===-1},C.prototype.lt=function(U){return this.cmp(U)===-1},C.prototype.lten=function(U){return this.cmpn(U)<=0},C.prototype.lte=function(U){return this.cmp(U)<=0},C.prototype.eqn=function(U){return this.cmpn(U)===0},C.prototype.eq=function(U){return this.cmp(U)===0},C.red=function(U){return new i(U)},C.prototype.toRed=function(U){return P(!this.red,"Already a number in reduction context"),P(this.negative===0,"red works only with positives"),U.convertTo(this)._forceRed(U)},C.prototype.fromRed=function(){return P(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},C.prototype._forceRed=function(U){return this.red=U,this},C.prototype.forceRed=function(U){return P(!this.red,"Already a number in reduction context"),this._forceRed(U)},C.prototype.redAdd=function(U){return P(this.red,"redAdd works only with red numbers"),this.red.add(this,U)},C.prototype.redIAdd=function(U){return P(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,U)},C.prototype.redSub=function(U){return P(this.red,"redSub works only with red numbers"),this.red.sub(this,U)},C.prototype.redISub=function(U){return P(this.red,"redISub works only with red numbers"),this.red.isub(this,U)},C.prototype.redShl=function(U){return P(this.red,"redShl works only with red numbers"),this.red.shl(this,U)},C.prototype.redMul=function(U){return P(this.red,"redMul works only with red numbers"),this.red._verify2(this,U),this.red.mul(this,U)},C.prototype.redIMul=function(U){return P(this.red,"redMul works only with red numbers"),this.red._verify2(this,U),this.red.imul(this,U)},C.prototype.redSqr=function(){return P(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},C.prototype.redISqr=function(){return P(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},C.prototype.redSqrt=function(){return P(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},C.prototype.redInvm=function(){return P(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},C.prototype.redNeg=function(){return P(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},C.prototype.redPow=function(U){return P(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 o(k,U){this.name=k,this.p=new C(U,16),this.n=this.p.bitLength(),this.k=new C(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}o.prototype._tmp=function(){var U=new C(null);return U.words=Array(Math.ceil(this.n/13)),U},o.prototype.ireduce=function(U){var V=U,Y;do this.split(V,this.tmp),V=this.imulK(V),V=V.iadd(this.tmp),Y=V.bitLength();while(Y>this.n);var H=Y<this.n?-1:V.ucmp(this.p);if(H===0)V.words[0]=0,V.length=1;else if(H>0)V.isub(this.p);else if(V.strip!==void 0)V.strip();else V._strip();return V},o.prototype.split=function(U,V){U.iushrn(this.n,0,V)},o.prototype.imulK=function(U){return U.imul(this.k)};function f(){o.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}Q(f,o),f.prototype.split=function(U,V){var Y=4194303,H=Math.min(U.length,9);for(var K=0;K<H;K++)V.words[K]=U.words[K];if(V.length=H,U.length<=9){U.words[0]=0,U.length=1;return}var M=U.words[9];V.words[V.length++]=M&Y;for(K=10;K<U.length;K++){var I=U.words[K]|0;U.words[K-10]=(I&Y)<<4|M>>>22,M=I}if(M>>>=22,U.words[K-10]=M,M===0&&U.length>10)U.length-=10;else U.length-=9},f.prototype.imulK=function(U){U.words[U.length]=0,U.words[U.length+1]=0,U.length+=2;var V=0;for(var Y=0;Y<U.length;Y++){var H=U.words[Y]|0;V+=H*977,U.words[Y]=V&67108863,V=H*64+(V/67108864|0)}if(U.words[U.length-1]===0){if(U.length--,U.words[U.length-1]===0)U.length--}return U};function d(){o.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}Q(d,o);function _(){o.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}Q(_,o);function t(){o.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}Q(t,o),t.prototype.imulK=function(U){var V=0;for(var Y=0;Y<U.length;Y++){var H=(U.words[Y]|0)*19+V,K=H&67108863;H>>>=26,U.words[Y]=K,V=H}if(V!==0)U.words[U.length++]=V;return U},C._prime=function(U){if(c[U])return c[U];var V;if(U==="k256")V=new f;else if(U==="p224")V=new d;else if(U==="p192")V=new _;else if(U==="p25519")V=new t;else throw Error("Unknown prime "+U);return c[U]=V,V};function i(k){if(typeof k==="string"){var U=C._prime(k);this.m=U.p,this.prime=U}else P(k.gtn(1),"modulus must be greater than 1"),this.m=k,this.prime=null}i.prototype._verify1=function(U){P(U.negative===0,"red works only with positives"),P(U.red,"red works only with red numbers")},i.prototype._verify2=function(U,V){P((U.negative|V.negative)===0,"red works only with positives"),P(U.red&&U.red===V.red,"red works only with red numbers")},i.prototype.imod=function(U){if(this.prime)return this.prime.ireduce(U)._forceRed(this);return X(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,V){this._verify2(U,V);var Y=U.add(V);if(Y.cmp(this.m)>=0)Y.isub(this.m);return Y._forceRed(this)},i.prototype.iadd=function(U,V){this._verify2(U,V);var Y=U.iadd(V);if(Y.cmp(this.m)>=0)Y.isub(this.m);return Y},i.prototype.sub=function(U,V){this._verify2(U,V);var Y=U.sub(V);if(Y.cmpn(0)<0)Y.iadd(this.m);return Y._forceRed(this)},i.prototype.isub=function(U,V){this._verify2(U,V);var Y=U.isub(V);if(Y.cmpn(0)<0)Y.iadd(this.m);return Y},i.prototype.shl=function(U,V){return this._verify1(U),this.imod(U.ushln(V))},i.prototype.imul=function(U,V){return this._verify2(U,V),this.imod(U.imul(V))},i.prototype.mul=function(U,V){return this._verify2(U,V),this.imod(U.mul(V))},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 V=this.m.andln(3);if(P(V%2===1),V===3){var Y=this.m.add(new C(1)).iushrn(2);return this.pow(U,Y)}var H=this.m.subn(1),K=0;while(!H.isZero()&&H.andln(1)===0)K++,H.iushrn(1);P(!H.isZero());var M=new C(1).toRed(this),I=M.redNeg(),j=this.m.subn(1).iushrn(1),q=this.m.bitLength();q=new C(2*q*q).toRed(this);while(this.pow(q,j).cmp(I)!==0)q.redIAdd(I);var F=this.pow(q,H),y=this.pow(U,H.addn(1).iushrn(1)),r=this.pow(U,H),u=K;while(r.cmp(M)!==0){var T1=r;for(var P1=0;T1.cmp(M)!==0;P1++)T1=T1.redSqr();P(P1<u);var Q1=this.pow(F,new C(1).iushln(u-P1-1));y=y.redMul(Q1),F=Q1.redSqr(),r=r.redMul(F),u=P1}return y},i.prototype.invm=function(U){var V=U._invmp(this.m);if(V.negative!==0)return V.negative=0,this.imod(V).redNeg();else return this.imod(V)},i.prototype.pow=function(U,V){if(V.isZero())return new C(1).toRed(this);if(V.cmpn(1)===0)return U.clone();var Y=4,H=Array(1<<Y);H[0]=new C(1).toRed(this),H[1]=U;for(var K=2;K<H.length;K++)H[K]=this.mul(H[K-1],U);var M=H[0],I=0,j=0,q=V.bitLength()%26;if(q===0)q=26;for(K=V.length-1;K>=0;K--){var F=V.words[K];for(var y=q-1;y>=0;y--){var r=F>>y&1;if(M!==H[0])M=this.sqr(M);if(r===0&&I===0){j=0;continue}if(I<<=1,I|=r,j++,j!==Y&&(K!==0||y!==0))continue;M=this.mul(M,H[I]),j=0,I=0}q=26}return M},i.prototype.convertTo=function(U){var V=U.umod(this.m);return V===U?V.clone():V},i.prototype.convertFrom=function(U){var V=U.clone();return V.red=null,V},C.mont=function(U){return new x(U)};function x(k){if(i.call(this,k),this.shift=this.m.bitLength(),this.shift%26!==0)this.shift+=26-this.shift%26;this.r=new C(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)}Q(x,i),x.prototype.convertTo=function(U){return this.imod(U.ushln(this.shift))},x.prototype.convertFrom=function(U){var V=this.imod(U.mul(this.rinv));return V.red=null,V},x.prototype.imul=function(U,V){if(U.isZero()||V.isZero())return U.words[0]=0,U.length=1,U;var Y=U.imul(V),H=Y.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),K=Y.isub(H).iushrn(this.shift),M=K;if(K.cmp(this.m)>=0)M=K.isub(this.m);else if(K.cmpn(0)<0)M=K.iadd(this.m);return M._forceRed(this)},x.prototype.mul=function(U,V){if(U.isZero()||V.isZero())return new C(0)._forceRed(this);var Y=U.mul(V),H=Y.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),K=Y.isub(H).iushrn(this.shift),M=K;if(K.cmp(this.m)>=0)M=K.isub(this.m);else if(K.cmpn(0)<0)M=K.iadd(this.m);return M._forceRed(this)},x.prototype.invm=function(U){var V=this.imod(U._invmp(this.m).mul(this.r2));return V._forceRed(this)}})(typeof CC>"u"||CC,G9)});var $9=T0((GC,J9)=>{/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var d6=(j8(),G8(O6)),_0=d6.Buffer;function U9(T,A){for(var P in T)A[P]=T[P]}if(_0.from&&_0.alloc&&_0.allocUnsafe&&_0.allocUnsafeSlow)J9.exports=d6;else U9(d6,GC),GC.Buffer=aA;function aA(T,A,P){return _0(T,A,P)}aA.prototype=Object.create(_0.prototype);U9(_0,aA);aA.from=function(T,A,P){if(typeof T==="number")throw TypeError("Argument must not be a number");return _0(T,A,P)};aA.alloc=function(T,A,P){if(typeof T!=="number")throw TypeError("Argument must be a number");var Q=_0(T);if(A!==void 0)if(typeof P==="string")Q.fill(A,P);else Q.fill(A);else Q.fill(0);return Q};aA.allocUnsafe=function(T){if(typeof T!=="number")throw TypeError("Argument must be a number");return _0(T)};aA.allocUnsafeSlow=function(T){if(typeof T!=="number")throw TypeError("Argument must be a number");return d6.SlowBuffer(T)}});var q9=T0((DO,V9)=>{var r6=$9().Buffer;function ek(T){if(T.length>=255)throw TypeError("Alphabet too long");var A=new Uint8Array(256);for(var P=0;P<A.length;P++)A[P]=255;for(var Q=0;Q<T.length;Q++){var C=T.charAt(Q),W=C.charCodeAt(0);if(A[W]!==255)throw TypeError(C+" is ambiguous");A[W]=Q}var G=T.length,J=T.charAt(0),$=Math.log(G)/Math.log(256),X=Math.log(256)/Math.log(G);function Z(z){if(Array.isArray(z)||z instanceof Uint8Array)z=r6.from(z);if(!r6.isBuffer(z))throw TypeError("Expected Buffer");if(z.length===0)return"";var S=0,E=0,w=0,O=z.length;while(w!==O&&z[w]===0)w++,S++;var m=(O-w)*X+1>>>0,g=new Uint8Array(m);while(w!==O){var p=z[w],c=0;for(var o=m-1;(p!==0||c<E)&&o!==-1;o--,c++)p+=256*g[o]>>>0,g[o]=p%G>>>0,p=p/G>>>0;if(p!==0)throw Error("Non-zero carry");E=c,w++}var f=m-E;while(f!==m&&g[f]===0)f++;var d=J.repeat(S);for(;f<m;++f)d+=T.charAt(g[f]);return d}function R(z){if(typeof z!=="string")throw TypeError("Expected String");if(z.length===0)return r6.alloc(0);var S=0,E=0,w=0;while(z[S]===J)E++,S++;var O=(z.length-S)*$+1>>>0,m=new Uint8Array(O);while(S<z.length){var g=z.charCodeAt(S);if(g>255)return;var p=A[g];if(p===255)return;var c=0;for(var o=O-1;(p!==0||c<w)&&o!==-1;o--,c++)p+=G*m[o]>>>0,m[o]=p%256>>>0,p=p/256>>>0;if(p!==0)throw Error("Non-zero carry");w=c,S++}var f=O-w;while(f!==O&&m[f]===0)f++;var d=r6.allocUnsafe(E+(O-f));d.fill(0,0,E);var _=E;while(f!==O)d[_++]=m[f++];return d}function D(z){var S=R(z);if(S)return S;throw Error("Non-base"+G+" character")}return{encode:Z,decodeUnsafe:R,decode:D}}V9.exports=ek});var UC=T0((FO,Y9)=>{var Tj=q9(),Aj="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";Y9.exports=Tj(Aj)});var Z9={};s4(Z9,{TextEncoder:()=>f6,TextDecoder:()=>n6});function QA(T,A,P){return A<=T&&T<=P}function i6(T){if(T===void 0)return{};if(T===Object(T))return T;throw TypeError("Could not convert argument to dictionary")}function Pj(T){var A=String(T),P=A.length,Q=0,C=[];while(Q<P){var W=A.charCodeAt(Q);if(W<55296||W>57343)C.push(W);else if(56320<=W&&W<=57343)C.push(65533);else if(55296<=W&&W<=56319)if(Q===P-1)C.push(65533);else{var G=T.charCodeAt(Q+1);if(56320<=G&&G<=57343){var J=W&1023,$=G&1023;C.push(65536+(J<<10)+$),Q+=1}else C.push(65533)}Q+=1}return C}function Qj(T){var A="";for(var P=0;P<T.length;++P){var Q=T[P];if(Q<=65535)A+=String.fromCharCode(Q);else Q-=65536,A+=String.fromCharCode((Q>>10)+55296,(Q&1023)+56320)}return A}function VC(T){this.tokens=[].slice.call(T)}function $C(T,A){if(T)throw TypeError("Decoder error");return A||65533}function Cj(){}function Wj(){}function n6(T,A){if(!(this instanceof n6))return new n6(T,A);if(T=T!==void 0?String(T).toLowerCase():o6,T!==o6)throw Error("Encoding not supported. Only utf-8 is supported");A=i6(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 f6(T,A){if(!(this instanceof f6))return new f6(T,A);if(T=T!==void 0?String(T).toLowerCase():o6,T!==o6)throw Error("Encoding not supported. Only utf-8 is supported");A=i6(A),this._streaming=!1,this._encoder=null,this._options={fatal:Boolean(A.fatal)},Object.defineProperty(this,"encoding",{value:"utf-8"})}function Gj(T){var A=T.fatal,P=0,Q=0,C=0,W=128,G=191;this.handler=function(J,$){if($===c6&&C!==0)return C=0,$C(A);if($===c6)return N8;if(C===0){if(QA($,0,127))return $;if(QA($,194,223))C=1,P=$-192;else if(QA($,224,239)){if($===224)W=160;if($===237)G=159;C=2,P=$-224}else if(QA($,240,244)){if($===240)W=144;if($===244)G=143;C=3,P=$-240}else return $C(A);return P=P<<6*C,null}if(!QA($,W,G))return P=C=Q=0,W=128,G=191,J.prepend($),$C(A);if(W=128,G=191,Q+=1,P+=$-128<<6*(C-Q),Q!==C)return null;var X=P;return P=C=Q=0,X}}function Uj(T){var A=T.fatal;this.handler=function(P,Q){if(Q===c6)return N8;if(QA(Q,0,127))return Q;var C,W;if(QA(Q,128,2047))C=1,W=192;else if(QA(Q,2048,65535))C=2,W=224;else if(QA(Q,65536,1114111))C=3,W=240;var G=[(Q>>6*C)+W];while(C>0){var J=Q>>6*(C-1);G.push(128|J&63),C-=1}return G}}var c6=-1,N8=-1,o6="utf-8";var X9=jT(()=>{VC.prototype={endOfStream:function(){return!this.tokens.length},read:function(){if(!this.tokens.length)return c6;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)}};Cj.prototype={handler:function(T,A){}};Wj.prototype={handler:function(T,A){}};n6.prototype={decode:function(A,P){var Q;if(typeof A==="object"&&A instanceof ArrayBuffer)Q=new Uint8Array(A);else if(typeof A==="object"&&"buffer"in A&&A.buffer instanceof ArrayBuffer)Q=new Uint8Array(A.buffer,A.byteOffset,A.byteLength);else Q=new Uint8Array(0);if(P=i6(P),!this._streaming)this._decoder=new Gj({fatal:this._fatal}),this._BOMseen=!1;this._streaming=Boolean(P.stream);var C=new VC(Q),W=[],G;while(!C.endOfStream()){if(G=this._decoder.handler(C,C.read()),G===N8)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(C,C.read()),G===N8)break;if(G===null)continue;if(Array.isArray(G))W.push.apply(W,G);else W.push(G)}while(!C.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 Qj(W)}};f6.prototype={encode:function(A,P){if(A=A?String(A):"",P=i6(P),!this._streaming)this._encoder=new Uj(this._options);this._streaming=Boolean(P.stream);var Q=[],C=new VC(Pj(A)),W;while(!C.endOfStream()){if(W=this._encoder.handler(C,C.read()),W===N8)break;if(Array.isArray(W))Q.push.apply(Q,W);else Q.push(W)}if(!this._streaming){while(!0){if(W=this._encoder.handler(C,C.read()),W===N8)break;if(Array.isArray(W))Q.push.apply(Q,W);else Q.push(W)}this._encoder=null}return new Uint8Array(Q)}}});var j9=T0((Y1)=>{var Jj=Y1&&Y1.__createBinding||(Object.create?function(T,A,P,Q){if(Q===void 0)Q=P;Object.defineProperty(T,Q,{enumerable:!0,get:function(){return A[P]}})}:function(T,A,P,Q){if(Q===void 0)Q=P;T[Q]=A[P]}),$j=Y1&&Y1.__setModuleDefault||(Object.create?function(T,A){Object.defineProperty(T,"default",{enumerable:!0,value:A})}:function(T,A){T.default=A}),h0=Y1&&Y1.__decorate||function(T,A,P,Q){var C=arguments.length,W=C<3?A:Q===null?Q=Object.getOwnPropertyDescriptor(A,P):Q,G;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")W=Reflect.decorate(T,A,P,Q);else for(var J=T.length-1;J>=0;J--)if(G=T[J])W=(C<3?G(W):C>3?G(A,P,W):G(A,P))||W;return C>3&&W&&Object.defineProperty(A,P,W),W},Vj=Y1&&Y1.__importStar||function(T){if(T&&T.__esModule)return T;var A={};if(T!=null){for(var P in T)if(P!=="default"&&Object.hasOwnProperty.call(T,P))Jj(A,T,P)}return $j(A,T),A},H9=Y1&&Y1.__importDefault||function(T){return T&&T.__esModule?T:{default:T}};Object.defineProperty(Y1,"__esModule",{value:!0});Y1.deserializeUnchecked=Y1.deserialize=Y1.serialize=Y1.BinaryReader=Y1.BinaryWriter=Y1.BorshError=Y1.baseDecode=Y1.baseEncode=void 0;var IA=H9(WC()),K9=H9(UC()),qj=Vj((X9(),G8(Z9))),Yj=typeof TextDecoder!=="function"?qj.TextDecoder:TextDecoder,Zj=new Yj("utf-8",{fatal:!0});function Xj(T){if(typeof T==="string")T=Buffer.from(T,"utf8");return K9.default.encode(Buffer.from(T))}Y1.baseEncode=Xj;function Hj(T){return Buffer.from(K9.default.decode(T))}Y1.baseDecode=Hj;var qC=1024;class zT 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(".")}}Y1.BorshError=zT;class YC{constructor(){this.buf=Buffer.alloc(qC),this.length=0}maybeResize(){if(this.buf.length<16+this.length)this.buf=Buffer.concat([this.buf,Buffer.alloc(qC)])}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 IA.default(T).toArray("le",8)))}writeU128(T){this.maybeResize(),this.writeBuffer(Buffer.from(new IA.default(T).toArray("le",16)))}writeU256(T){this.maybeResize(),this.writeBuffer(Buffer.from(new IA.default(T).toArray("le",32)))}writeU512(T){this.maybeResize(),this.writeBuffer(Buffer.from(new IA.default(T).toArray("le",64)))}writeBuffer(T){this.buf=Buffer.concat([Buffer.from(this.buf.subarray(0,this.length)),T,Buffer.alloc(qC)]),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 P of T)this.maybeResize(),A(P)}toArray(){return this.buf.subarray(0,this.length)}}Y1.BinaryWriter=YC;function m0(T,A,P){let Q=P.value;P.value=function(...C){try{return Q.apply(this,C)}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 zT("Reached the end of buffer when deserializing")}throw W}}}class oT{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 IA.default(T,"le")}readU128(){let T=this.readBuffer(16);return new IA.default(T,"le")}readU256(){let T=this.readBuffer(32);return new IA.default(T,"le")}readU512(){let T=this.readBuffer(64);return new IA.default(T,"le")}readBuffer(T){if(this.offset+T>this.buf.length)throw new zT(`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 Zj.decode(A)}catch(P){throw new zT(`Error decoding UTF-8 string: ${P}`)}}readFixedArray(T){return new Uint8Array(this.readBuffer(T))}readArray(T){let A=this.readU32(),P=Array();for(let Q=0;Q<A;++Q)P.push(T());return P}}h0([m0],oT.prototype,"readU8",null);h0([m0],oT.prototype,"readU16",null);h0([m0],oT.prototype,"readU32",null);h0([m0],oT.prototype,"readU64",null);h0([m0],oT.prototype,"readU128",null);h0([m0],oT.prototype,"readU256",null);h0([m0],oT.prototype,"readU512",null);h0([m0],oT.prototype,"readString",null);h0([m0],oT.prototype,"readFixedArray",null);h0([m0],oT.prototype,"readArray",null);Y1.BinaryReader=oT;function R9(T){return T.charAt(0).toUpperCase()+T.slice(1)}function sA(T,A,P,Q,C){try{if(typeof Q==="string")C[`write${R9(Q)}`](P);else if(Q instanceof Array)if(typeof Q[0]==="number"){if(P.length!==Q[0])throw new zT(`Expecting byte array of length ${Q[0]}, but got ${P.length} bytes`);C.writeFixedArray(P)}else if(Q.length===2&&typeof Q[1]==="number"){if(P.length!==Q[1])throw new zT(`Expecting byte array of length ${Q[1]}, but got ${P.length} bytes`);for(let W=0;W<Q[1];W++)sA(T,null,P[W],Q[0],C)}else C.writeArray(P,(W)=>{sA(T,A,W,Q[0],C)});else if(Q.kind!==void 0)switch(Q.kind){case"option":{if(P===null||P===void 0)C.writeU8(0);else C.writeU8(1),sA(T,A,P,Q.type,C);break}case"map":{C.writeU32(P.size),P.forEach((W,G)=>{sA(T,A,G,Q.key,C),sA(T,A,W,Q.value,C)});break}default:throw new zT(`FieldType ${Q} unrecognized`)}else k9(T,P,C)}catch(W){if(W instanceof zT)W.addToFieldPath(A);throw W}}function k9(T,A,P){if(typeof A.borshSerialize==="function"){A.borshSerialize(P);return}let Q=T.get(A.constructor);if(!Q)throw new zT(`Class ${A.constructor.name} is missing in schema`);if(Q.kind==="struct")Q.fields.map(([C,W])=>{sA(T,C,A[C],W,P)});else if(Q.kind==="enum"){let C=A[Q.field];for(let W=0;W<Q.values.length;++W){let[G,J]=Q.values[W];if(G===C){P.writeU8(W),sA(T,G,A[G],J,P);break}}}else throw new zT(`Unexpected schema kind: ${Q.kind} for ${A.constructor.name}`)}function Kj(T,A,P=YC){let Q=new P;return k9(T,A,Q),Q.toArray()}Y1.serialize=Kj;function tA(T,A,P,Q){try{if(typeof P==="string")return Q[`read${R9(P)}`]();if(P instanceof Array)if(typeof P[0]==="number")return Q.readFixedArray(P[0]);else if(typeof P[1]==="number"){let C=[];for(let W=0;W<P[1];W++)C.push(tA(T,null,P[0],Q));return C}else return Q.readArray(()=>tA(T,A,P[0],Q));if(P.kind==="option"){if(Q.readU8())return tA(T,A,P.type,Q);return}if(P.kind==="map"){let C=new Map,W=Q.readU32();for(let G=0;G<W;G++){let J=tA(T,A,P.key,Q),$=tA(T,A,P.value,Q);C.set(J,$)}return C}return ZC(T,P,Q)}catch(C){if(C instanceof zT)C.addToFieldPath(A);throw C}}function ZC(T,A,P){if(typeof A.borshDeserialize==="function")return A.borshDeserialize(P);let Q=T.get(A);if(!Q)throw new zT(`Class ${A.name} is missing in schema`);if(Q.kind==="struct"){let C={};for(let[W,G]of T.get(A).fields)C[W]=tA(T,W,G,P);return new A(C)}if(Q.kind==="enum"){let C=P.readU8();if(C>=Q.values.length)throw new zT(`Enum index: ${C} is out of range`);let[W,G]=Q.values[C],J=tA(T,W,G,P);return new A({[W]:J})}throw new zT(`Unexpected schema kind: ${Q.kind} for ${A.constructor.name}`)}function Rj(T,A,P,Q=oT){let C=new Q(P),W=ZC(T,A,C);if(C.offset<P.length)throw new zT(`Unexpected ${P.length-C.offset} bytes after deserialized data`);return W}Y1.deserialize=Rj;function kj(T,A,P,Q=oT){let C=new Q(P);return ZC(T,A,C)}Y1.deserializeUnchecked=kj});var CA=T0((D9)=>{Object.defineProperty(D9,"__esModule",{value:!0});D9.s16=D9.s8=D9.nu64be=D9.u48be=D9.u40be=D9.u32be=D9.u24be=D9.u16be=D9.nu64=D9.u48=D9.u40=D9.u32=D9.u24=D9.u16=D9.u8=D9.offset=D9.greedy=D9.Constant=D9.UTF8=D9.CString=D9.Blob=D9.Boolean=D9.BitField=D9.BitStructure=D9.VariantLayout=D9.Union=D9.UnionLayoutDiscriminator=D9.UnionDiscriminator=D9.Structure=D9.Sequence=D9.DoubleBE=D9.Double=D9.FloatBE=D9.Float=D9.NearInt64BE=D9.NearInt64=D9.NearUInt64BE=D9.NearUInt64=D9.IntBE=D9.Int=D9.UIntBE=D9.UInt=D9.OffsetLayout=D9.GreedyCount=D9.ExternalLayout=D9.bindConstructorLayout=D9.nameWithProperty=D9.Layout=D9.uint8ArrayToBuffer=D9.checkUint8Array=void 0;D9.constant=D9.utf8=D9.cstr=D9.blob=D9.unionLayoutDiscriminator=D9.union=D9.seq=D9.bits=D9.struct=D9.f64be=D9.f64=D9.f32be=D9.f32=D9.ns64be=D9.s48be=D9.s40be=D9.s32be=D9.s24be=D9.s16be=D9.ns64=D9.s48=D9.s40=D9.s32=D9.s24=void 0;var HC=(j8(),G8(O6));function L8(T){if(!(T instanceof Uint8Array))throw TypeError("b must be a Uint8Array")}D9.checkUint8Array=L8;function G1(T){return L8(T),HC.Buffer.from(T.buffer,T.byteOffset,T.length)}D9.uint8ArrayToBuffer=G1;class V1{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}}D9.Layout=V1;function KC(T,A){if(A.property)return T+"["+A.property+"]";return T}D9.nameWithProperty=KC;function jj(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 V1))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(P,Q){return A.encode(this,P,Q)},writable:!0}),Object.defineProperty(T,"decode",{value(P,Q){return A.decode(P,Q)},writable:!0})}D9.bindConstructorLayout=jj;class mT extends V1{isCount(){throw Error("ExternalLayout is abstract")}}D9.ExternalLayout=mT;class RC extends mT{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){L8(T);let P=T.length-A;return Math.floor(P/this.elementSpan)}encode(T,A,P){return 0}}D9.GreedyCount=RC;class a6 extends mT{constructor(T,A=0,P){if(!(T instanceof V1))throw TypeError("layout must be a Layout");if(!Number.isInteger(A))throw TypeError("offset must be integer or undefined");super(T.span,P||T.property);this.layout=T,this.offset=A}isCount(){return this.layout instanceof eT||this.layout instanceof $0}decode(T,A=0){return this.layout.decode(T,A+this.offset)}encode(T,A,P=0){return this.layout.encode(T,A,P+this.offset)}}D9.OffsetLayout=a6;class eT extends V1{constructor(T,A){super(T,A);if(6<this.span)throw RangeError("span must not exceed 6 bytes")}decode(T,A=0){return G1(T).readUIntLE(A,this.span)}encode(T,A,P=0){return G1(A).writeUIntLE(T,P,this.span),this.span}}D9.UInt=eT;class $0 extends V1{constructor(T,A){super(T,A);if(6<this.span)throw RangeError("span must not exceed 6 bytes")}decode(T,A=0){return G1(T).readUIntBE(A,this.span)}encode(T,A,P=0){return G1(A).writeUIntBE(T,P,this.span),this.span}}D9.UIntBE=$0;class SA extends V1{constructor(T,A){super(T,A);if(6<this.span)throw RangeError("span must not exceed 6 bytes")}decode(T,A=0){return G1(T).readIntLE(A,this.span)}encode(T,A,P=0){return G1(A).writeIntLE(T,P,this.span),this.span}}D9.Int=SA;class eA extends V1{constructor(T,A){super(T,A);if(6<this.span)throw RangeError("span must not exceed 6 bytes")}decode(T,A=0){return G1(T).readIntBE(A,this.span)}encode(T,A,P=0){return G1(A).writeIntBE(T,P,this.span),this.span}}D9.IntBE=eA;var XC=Math.pow(2,32);function s6(T){let A=Math.floor(T/XC),P=T-A*XC;return{hi32:A,lo32:P}}function t6(T,A){return T*XC+A}class kC extends V1{constructor(T){super(8,T)}decode(T,A=0){let P=G1(T),Q=P.readUInt32LE(A),C=P.readUInt32LE(A+4);return t6(C,Q)}encode(T,A,P=0){let Q=s6(T),C=G1(A);return C.writeUInt32LE(Q.lo32,P),C.writeUInt32LE(Q.hi32,P+4),8}}D9.NearUInt64=kC;class jC extends V1{constructor(T){super(8,T)}decode(T,A=0){let P=G1(T),Q=P.readUInt32BE(A),C=P.readUInt32BE(A+4);return t6(Q,C)}encode(T,A,P=0){let Q=s6(T),C=G1(A);return C.writeUInt32BE(Q.hi32,P),C.writeUInt32BE(Q.lo32,P+4),8}}D9.NearUInt64BE=jC;class DC extends V1{constructor(T){super(8,T)}decode(T,A=0){let P=G1(T),Q=P.readUInt32LE(A),C=P.readInt32LE(A+4);return t6(C,Q)}encode(T,A,P=0){let Q=s6(T),C=G1(A);return C.writeUInt32LE(Q.lo32,P),C.writeInt32LE(Q.hi32,P+4),8}}D9.NearInt64=DC;class FC extends V1{constructor(T){super(8,T)}decode(T,A=0){let P=G1(T),Q=P.readInt32BE(A),C=P.readUInt32BE(A+4);return t6(Q,C)}encode(T,A,P=0){let Q=s6(T),C=G1(A);return C.writeInt32BE(Q.hi32,P),C.writeUInt32BE(Q.lo32,P+4),8}}D9.NearInt64BE=FC;class MC extends V1{constructor(T){super(4,T)}decode(T,A=0){return G1(T).readFloatLE(A)}encode(T,A,P=0){return G1(A).writeFloatLE(T,P),4}}D9.Float=MC;class zC extends V1{constructor(T){super(4,T)}decode(T,A=0){return G1(T).readFloatBE(A)}encode(T,A,P=0){return G1(A).writeFloatBE(T,P),4}}D9.FloatBE=zC;class IC extends V1{constructor(T){super(8,T)}decode(T,A=0){return G1(T).readDoubleLE(A)}encode(T,A,P=0){return G1(A).writeDoubleLE(T,P),8}}D9.Double=IC;class SC extends V1{constructor(T){super(8,T)}decode(T,A=0){return G1(T).readDoubleBE(A)}encode(T,A,P=0){return G1(A).writeDoubleBE(T,P),8}}D9.DoubleBE=SC;class NC extends V1{constructor(T,A,P){if(!(T instanceof V1))throw TypeError("elementLayout must be a Layout");if(!(A instanceof mT&&A.isCount()||Number.isInteger(A)&&0<=A))throw TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let Q=-1;if(!(A instanceof mT)&&0<T.span)Q=A*T.span;super(Q,P);this.elementLayout=T,this.count=A}getSpan(T,A=0){if(0<=this.span)return this.span;let P=0,Q=this.count;if(Q instanceof mT)Q=Q.decode(T,A);if(0<this.elementLayout.span)P=Q*this.elementLayout.span;else{let C=0;while(C<Q)P+=this.elementLayout.getSpan(T,A+P),++C}return P}decode(T,A=0){let P=[],Q=0,C=this.count;if(C instanceof mT)C=C.decode(T,A);while(Q<C)P.push(this.elementLayout.decode(T,A)),A+=this.elementLayout.getSpan(T,A),Q+=1;return P}encode(T,A,P=0){let Q=this.elementLayout,C=T.reduce((W,G)=>{return W+Q.encode(G,A,P+W)},0);if(this.count instanceof mT)this.count.encode(T.length,A,P);return C}}D9.Sequence=NC;class wC extends V1{constructor(T,A,P){if(!(Array.isArray(T)&&T.reduce((C,W)=>C&&W instanceof V1,!0)))throw TypeError("fields must be array of Layout instances");if(typeof A==="boolean"&&P===void 0)P=A,A=void 0;for(let C of T)if(0>C.span&&C.property===void 0)throw Error("fields cannot contain unnamed variable-length layout");let Q=-1;try{Q=T.reduce((C,W)=>C+W.getSpan(),0)}catch(C){}super(Q,A);this.fields=T,this.decodePrefixes=!!P}getSpan(T,A=0){if(0<=this.span)return this.span;let P=0;try{P=this.fields.reduce((Q,C)=>{let W=C.getSpan(T,A);return A+=W,Q+W},0)}catch(Q){throw RangeError("indeterminate span")}return P}decode(T,A=0){L8(T);let P=this.makeDestinationObject();for(let Q of this.fields){if(Q.property!==void 0)P[Q.property]=Q.decode(T,A);if(A+=Q.getSpan(T,A),this.decodePrefixes&&T.length===A)break}return P}encode(T,A,P=0){let Q=P,C=0,W=0;for(let G of this.fields){let J=G.span;if(W=0<J?J:0,G.property!==void 0){let $=T[G.property];if($!==void 0){if(W=G.encode($,A,P),0>J)J=G.getSpan(A,P)}}C=P,P+=J}return C+W-Q}fromArray(T){let A=this.makeDestinationObject();for(let P of this.fields)if(P.property!==void 0&&0<T.length)A[P.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 P of this.fields){if(P.property===T)return A;if(0>P.span)A=-1;else if(0<=A)A+=P.span}return}}D9.Structure=wC;class e6{constructor(T){this.property=T}decode(T,A){throw Error("UnionDiscriminator is abstract")}encode(T,A,P){throw Error("UnionDiscriminator is abstract")}}D9.UnionDiscriminator=e6;class Y2 extends e6{constructor(T,A){if(!(T instanceof mT&&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,P){return this.layout.encode(T,A,P)}}D9.UnionLayoutDiscriminator=Y2;class T4 extends V1{constructor(T,A,P){let Q;if(T instanceof eT||T instanceof $0)Q=new Y2(new a6(T));else if(T instanceof mT&&T.isCount())Q=new Y2(T);else if(!(T instanceof e6))throw TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");else Q=T;if(A===void 0)A=null;if(!(A===null||A instanceof V1))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 C=-1;if(A){if(C=A.span,0<=C&&(T instanceof eT||T instanceof $0))C+=Q.layout.span}super(C,P);this.discriminator=Q,this.usesPrefixDiscriminator=T instanceof eT||T instanceof $0,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 P=this.getVariant(T,A);if(!P)throw Error("unable to determine span for unrecognized variant");return P.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 P=this.registry[A];if(P.property&&Object.prototype.hasOwnProperty.call(T,P.property))return P}throw Error("unable to infer src variant")}decode(T,A=0){let P,Q=this.discriminator,C=Q.decode(T,A),W=this.registry[C];if(W===void 0){let G=this.defaultLayout,J=0;if(this.usesPrefixDiscriminator)J=Q.layout.span;P=this.makeDestinationObject(),P[Q.property]=C,P[G.property]=G.decode(T,A+J)}else P=W.decode(T,A);return P}encode(T,A,P=0){let Q=this.getSourceVariant(T);if(Q===void 0){let C=this.discriminator,W=this.defaultLayout,G=0;if(this.usesPrefixDiscriminator)G=C.layout.span;return C.encode(T[C.property],A,P),G+W.encode(T[W.property],A,P+G)}return Q.encode(T,A,P)}addVariant(T,A,P){let Q=new LC(this,T,A,P);return this.registry[T]=Q,Q}getVariant(T,A=0){let P;if(T instanceof Uint8Array)P=this.discriminator.decode(T,A);else P=T;return this.registry[P]}}D9.Union=T4;class LC extends V1{constructor(T,A,P,Q){if(!(T instanceof T4))throw TypeError("union must be a Union");if(!Number.isInteger(A)||0>A)throw TypeError("variant must be a (non-negative) integer");if(typeof P==="string"&&Q===void 0)Q=P,P=null;if(P){if(!(P instanceof V1))throw TypeError("layout must be a Layout");if(T.defaultLayout!==null&&0<=P.span&&P.span>T.defaultLayout.span)throw Error("variant span exceeds span of containing union");if(typeof Q!=="string")throw TypeError("variant must have a String property")}let C=T.span;if(0>T.span){if(C=P?P.span:0,0<=C&&T.usesPrefixDiscriminator)C+=T.discriminator.layout.span}super(C,Q);this.union=T,this.variant=A,this.layout=P||null}getSpan(T,A=0){if(0<=this.span)return this.span;let P=0;if(this.union.usesPrefixDiscriminator)P=this.union.discriminator.layout.span;let Q=0;if(this.layout)Q=this.layout.getSpan(T,A+P);return P+Q}decode(T,A=0){let P=this.makeDestinationObject();if(this!==this.union.getVariant(T,A))throw Error("variant mismatch");let Q=0;if(this.union.usesPrefixDiscriminator)Q=this.union.discriminator.layout.span;if(this.layout)P[this.property]=this.layout.decode(T,A+Q);else if(this.property)P[this.property]=!0;else if(this.union.usesPrefixDiscriminator)P[this.union.discriminator.property]=this.variant;return P}encode(T,A,P=0){let Q=0;if(this.union.usesPrefixDiscriminator)Q=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,P);let C=Q;if(this.layout){if(this.layout.encode(T[this.property],A,P+Q),C+=this.layout.getSpan(A,P+Q),0<=this.union.span&&C>this.union.span)throw Error("encoded variant overruns containing union")}return C}fromArray(T){if(this.layout)return this.layout.fromArray(T);return}}D9.VariantLayout=LC;function w8(T){if(0>T)T+=4294967296;return T}class A4 extends V1{constructor(T,A,P){if(!(T instanceof eT||T instanceof $0))throw TypeError("word must be a UInt or UIntBE layout");if(typeof A==="string"&&P===void 0)P=A,A=!1;if(4<T.span)throw RangeError("word cannot exceed 32 bits");super(T.span,P);this.word=T,this.msb=!!A,this.fields=[];let Q=0;this._packedSetValue=function(C){return Q=w8(C),this},this._packedGetValue=function(){return Q}}decode(T,A=0){let P=this.makeDestinationObject(),Q=this.word.decode(T,A);this._packedSetValue(Q);for(let C of this.fields)if(C.property!==void 0)P[C.property]=C.decode(T);return P}encode(T,A,P=0){let Q=this.word.decode(A,P);this._packedSetValue(Q);for(let C of this.fields)if(C.property!==void 0){let W=T[C.property];if(W!==void 0)C.encode(W)}return this.word.encode(this._packedGetValue(),A,P)}addField(T,A){let P=new P4(this,T,A);return this.fields.push(P),P}addBoolean(T){let A=new EC(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}}D9.BitStructure=A4;class P4{constructor(T,A,P){if(!(T instanceof A4))throw TypeError("container must be a BitStructure");if(!Number.isInteger(A)||0>=A)throw TypeError("bits must be positive integer");let Q=8*T.span,C=T.fields.reduce((W,G)=>W+G.bits,0);if(A+C>Q)throw Error("bits too long for span remainder ("+(Q-C)+" of "+Q+" remain)");if(this.container=T,this.bits=A,this.valueMask=(1<<A)-1,A===32)this.valueMask=4294967295;if(this.start=C,this.container.msb)this.start=Q-C-A;this.wordMask=w8(this.valueMask<<this.start),this.property=P}decode(T,A){let P=this.container._packedGetValue();return w8(P&this.wordMask)>>>this.start}encode(T){if(typeof T!=="number"||!Number.isInteger(T)||T!==w8(T&this.valueMask))throw TypeError(KC("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);let A=this.container._packedGetValue(),P=w8(T<<this.start);this.container._packedSetValue(w8(A&~this.wordMask)|P)}}D9.BitField=P4;class EC extends P4{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)}}D9.Boolean=EC;class BC extends V1{constructor(T,A){if(!(T instanceof mT&&T.isCount()||Number.isInteger(T)&&0<=T))throw TypeError("length must be positive integer or an unsigned integer ExternalLayout");let P=-1;if(!(T instanceof mT))P=T;super(P,A);this.length=T}getSpan(T,A){let P=this.span;if(0>P)P=this.length.decode(T,A);return P}decode(T,A=0){let P=this.span;if(0>P)P=this.length.decode(T,A);return G1(T).slice(A,A+P)}encode(T,A,P){let Q=this.length;if(this.length instanceof mT)Q=T.length;if(!(T instanceof Uint8Array&&Q===T.length))throw TypeError(KC("Blob.encode",this)+" requires (length "+Q+") Uint8Array as src");if(P+Q>A.length)throw RangeError("encoding overruns Uint8Array");let C=G1(T);if(G1(A).write(C.toString("hex"),P,Q,"hex"),this.length instanceof mT)this.length.encode(Q,A,P);return Q}}D9.Blob=BC;class OC extends V1{constructor(T){super(-1,T)}getSpan(T,A=0){L8(T);let P=A;while(P<T.length&&T[P]!==0)P+=1;return 1+P-A}decode(T,A=0){let P=this.getSpan(T,A);return G1(T).slice(A,A+P-1).toString("utf-8")}encode(T,A,P=0){if(typeof T!=="string")T=String(T);let Q=HC.Buffer.from(T,"utf8"),C=Q.length;if(P+C>A.length)throw RangeError("encoding overruns Buffer");let W=G1(A);return Q.copy(W,P),W[P+C]=0,C+1}}D9.CString=OC;class xC extends V1{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 L8(T),T.length-A}decode(T,A=0){let P=this.getSpan(T,A);if(0<=this.maxSpan&&this.maxSpan<P)throw RangeError("text length exceeds maxSpan");return G1(T).slice(A,A+P).toString("utf-8")}encode(T,A,P=0){if(typeof T!=="string")T=String(T);let Q=HC.Buffer.from(T,"utf8"),C=Q.length;if(0<=this.maxSpan&&this.maxSpan<C)throw RangeError("text length exceeds maxSpan");if(P+C>A.length)throw RangeError("encoding overruns Buffer");return Q.copy(G1(A),P),C}}D9.UTF8=xC;class _C extends V1{constructor(T,A){super(0,A);this.value=T}decode(T,A){return this.value}encode(T,A,P){return 0}}D9.Constant=_C;D9.greedy=(T,A)=>new RC(T,A);D9.offset=(T,A,P)=>new a6(T,A,P);D9.u8=(T)=>new eT(1,T);D9.u16=(T)=>new eT(2,T);D9.u24=(T)=>new eT(3,T);D9.u32=(T)=>new eT(4,T);D9.u40=(T)=>new eT(5,T);D9.u48=(T)=>new eT(6,T);D9.nu64=(T)=>new kC(T);D9.u16be=(T)=>new $0(2,T);D9.u24be=(T)=>new $0(3,T);D9.u32be=(T)=>new $0(4,T);D9.u40be=(T)=>new $0(5,T);D9.u48be=(T)=>new $0(6,T);D9.nu64be=(T)=>new jC(T);D9.s8=(T)=>new SA(1,T);D9.s16=(T)=>new SA(2,T);D9.s24=(T)=>new SA(3,T);D9.s32=(T)=>new SA(4,T);D9.s40=(T)=>new SA(5,T);D9.s48=(T)=>new SA(6,T);D9.ns64=(T)=>new DC(T);D9.s16be=(T)=>new eA(2,T);D9.s24be=(T)=>new eA(3,T);D9.s32be=(T)=>new eA(4,T);D9.s40be=(T)=>new eA(5,T);D9.s48be=(T)=>new eA(6,T);D9.ns64be=(T)=>new FC(T);D9.f32=(T)=>new MC(T);D9.f32be=(T)=>new zC(T);D9.f64=(T)=>new IC(T);D9.f64be=(T)=>new SC(T);D9.struct=(T,A,P)=>new wC(T,A,P);D9.bits=(T,A,P)=>new A4(T,A,P);D9.seq=(T,A,P)=>new NC(T,A,P);D9.union=(T,A,P)=>new T4(T,A,P);D9.unionLayoutDiscriminator=(T,A)=>new Y2(T,A);D9.blob=(T,A)=>new BC(T,A);D9.cstr=(T)=>new OC(T);D9.utf8=(T,A)=>new xC(T,A);D9.constant=(T,A)=>new _C(T,A)});function H2(){if(!G4){if(G4=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues==="function"&&msCrypto.getRandomValues.bind(msCrypto),!G4)throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported")}return G4(sM)}var G4,sM;var dC=jT(()=>{sM=new Uint8Array(16)});var p9;var u9=jT(()=>{p9=/^(?:[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 tM(T){return typeof T==="string"&&p9.test(T)}var wA;var K2=jT(()=>{u9();wA=tM});function eM(T){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,P=(kT[T[A+0]]+kT[T[A+1]]+kT[T[A+2]]+kT[T[A+3]]+"-"+kT[T[A+4]]+kT[T[A+5]]+"-"+kT[T[A+6]]+kT[T[A+7]]+"-"+kT[T[A+8]]+kT[T[A+9]]+"-"+kT[T[A+10]]+kT[T[A+11]]+kT[T[A+12]]+kT[T[A+13]]+kT[T[A+14]]+kT[T[A+15]]).toLowerCase();if(!wA(P))throw TypeError("Stringified UUID is invalid");return P}var kT,R2,LA;var k2=jT(()=>{K2();kT=[];for(R2=0;R2<256;++R2)kT.push((R2+256).toString(16).substr(1));LA=eM});function Tz(T,A,P){var Q=A&&P||0,C=A||Array(16);T=T||{};var W=T.node||d9,G=T.clockseq!==void 0?T.clockseq:rC;if(W==null||G==null){var J=T.random||(T.rng||H2)();if(W==null)W=d9=[J[0]|1,J[1],J[2],J[3],J[4],J[5]];if(G==null)G=rC=(J[6]<<8|J[7])&16383}var $=T.msecs!==void 0?T.msecs:Date.now(),X=T.nsecs!==void 0?T.nsecs:oC+1,Z=$-cC+(X-oC)/1e4;if(Z<0&&T.clockseq===void 0)G=G+1&16383;if((Z<0||$>cC)&&T.nsecs===void 0)X=0;if(X>=1e4)throw Error("uuid.v1(): Can't create more than 10M uuids/sec");cC=$,oC=X,rC=G,$+=12219292800000;var R=(($&268435455)*1e4+X)%4294967296;C[Q++]=R>>>24&255,C[Q++]=R>>>16&255,C[Q++]=R>>>8&255,C[Q++]=R&255;var D=$/4294967296*1e4&268435455;C[Q++]=D>>>8&255,C[Q++]=D&255,C[Q++]=D>>>24&15|16,C[Q++]=D>>>16&255,C[Q++]=G>>>8|128,C[Q++]=G&255;for(var z=0;z<6;++z)C[Q+z]=W[z];return A||LA(C)}var d9,rC,cC=0,oC=0,r9;var c9=jT(()=>{dC();k2();r9=Tz});function Az(T){if(!wA(T))throw TypeError("Invalid UUID");var A,P=new Uint8Array(16);return P[0]=(A=parseInt(T.slice(0,8),16))>>>24,P[1]=A>>>16&255,P[2]=A>>>8&255,P[3]=A&255,P[4]=(A=parseInt(T.slice(9,13),16))>>>8,P[5]=A&255,P[6]=(A=parseInt(T.slice(14,18),16))>>>8,P[7]=A&255,P[8]=(A=parseInt(T.slice(19,23),16))>>>8,P[9]=A&255,P[10]=(A=parseInt(T.slice(24,36),16))/1099511627776&255,P[11]=A/4294967296&255,P[12]=A>>>24&255,P[13]=A>>>16&255,P[14]=A>>>8&255,P[15]=A&255,P}var U4;var nC=jT(()=>{K2();U4=Az});function Pz(T){T=unescape(encodeURIComponent(T));var A=[];for(var P=0;P<T.length;++P)A.push(T.charCodeAt(P));return A}function j2(T,A,P){function Q(C,W,G,J){if(typeof C==="string")C=Pz(C);if(typeof W==="string")W=U4(W);if(W.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var $=new Uint8Array(16+C.length);if($.set(W),$.set(C,W.length),$=P($),$[6]=$[6]&15|A,$[8]=$[8]&63|128,G){J=J||0;for(var X=0;X<16;++X)G[J+X]=$[X];return G}return LA($)}try{Q.name=T}catch(C){}return Q.DNS=Qz,Q.URL=Cz,Q}var Qz="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Cz="6ba7b811-9dad-11d1-80b4-00c04fd430c8";var fC=jT(()=>{k2();nC()});function Wz(T){if(typeof T==="string"){var A=unescape(encodeURIComponent(T));T=new Uint8Array(A.length);for(var P=0;P<A.length;++P)T[P]=A.charCodeAt(P)}return Gz(Uz(Jz(T),T.length*8))}function Gz(T){var A=[],P=T.length*32,Q="0123456789abcdef";for(var C=0;C<P;C+=8){var W=T[C>>5]>>>C%32&255,G=parseInt(Q.charAt(W>>>4&15)+Q.charAt(W&15),16);A.push(G)}return A}function o9(T){return(T+64>>>9<<4)+14+1}function Uz(T,A){T[A>>5]|=128<<A%32,T[o9(A)-1]=A;var P=1732584193,Q=-271733879,C=-1732584194,W=271733878;for(var G=0;G<T.length;G+=16){var J=P,$=Q,X=C,Z=W;P=ST(P,Q,C,W,T[G],7,-680876936),W=ST(W,P,Q,C,T[G+1],12,-389564586),C=ST(C,W,P,Q,T[G+2],17,606105819),Q=ST(Q,C,W,P,T[G+3],22,-1044525330),P=ST(P,Q,C,W,T[G+4],7,-176418897),W=ST(W,P,Q,C,T[G+5],12,1200080426),C=ST(C,W,P,Q,T[G+6],17,-1473231341),Q=ST(Q,C,W,P,T[G+7],22,-45705983),P=ST(P,Q,C,W,T[G+8],7,1770035416),W=ST(W,P,Q,C,T[G+9],12,-1958414417),C=ST(C,W,P,Q,T[G+10],17,-42063),Q=ST(Q,C,W,P,T[G+11],22,-1990404162),P=ST(P,Q,C,W,T[G+12],7,1804603682),W=ST(W,P,Q,C,T[G+13],12,-40341101),C=ST(C,W,P,Q,T[G+14],17,-1502002290),Q=ST(Q,C,W,P,T[G+15],22,1236535329),P=NT(P,Q,C,W,T[G+1],5,-165796510),W=NT(W,P,Q,C,T[G+6],9,-1069501632),C=NT(C,W,P,Q,T[G+11],14,643717713),Q=NT(Q,C,W,P,T[G],20,-373897302),P=NT(P,Q,C,W,T[G+5],5,-701558691),W=NT(W,P,Q,C,T[G+10],9,38016083),C=NT(C,W,P,Q,T[G+15],14,-660478335),Q=NT(Q,C,W,P,T[G+4],20,-405537848),P=NT(P,Q,C,W,T[G+9],5,568446438),W=NT(W,P,Q,C,T[G+14],9,-1019803690),C=NT(C,W,P,Q,T[G+3],14,-187363961),Q=NT(Q,C,W,P,T[G+8],20,1163531501),P=NT(P,Q,C,W,T[G+13],5,-1444681467),W=NT(W,P,Q,C,T[G+2],9,-51403784),C=NT(C,W,P,Q,T[G+7],14,1735328473),Q=NT(Q,C,W,P,T[G+12],20,-1926607734),P=wT(P,Q,C,W,T[G+5],4,-378558),W=wT(W,P,Q,C,T[G+8],11,-2022574463),C=wT(C,W,P,Q,T[G+11],16,1839030562),Q=wT(Q,C,W,P,T[G+14],23,-35309556),P=wT(P,Q,C,W,T[G+1],4,-1530992060),W=wT(W,P,Q,C,T[G+4],11,1272893353),C=wT(C,W,P,Q,T[G+7],16,-155497632),Q=wT(Q,C,W,P,T[G+10],23,-1094730640),P=wT(P,Q,C,W,T[G+13],4,681279174),W=wT(W,P,Q,C,T[G],11,-358537222),C=wT(C,W,P,Q,T[G+3],16,-722521979),Q=wT(Q,C,W,P,T[G+6],23,76029189),P=wT(P,Q,C,W,T[G+9],4,-640364487),W=wT(W,P,Q,C,T[G+12],11,-421815835),C=wT(C,W,P,Q,T[G+15],16,530742520),Q=wT(Q,C,W,P,T[G+2],23,-995338651),P=LT(P,Q,C,W,T[G],6,-198630844),W=LT(W,P,Q,C,T[G+7],10,1126891415),C=LT(C,W,P,Q,T[G+14],15,-1416354905),Q=LT(Q,C,W,P,T[G+5],21,-57434055),P=LT(P,Q,C,W,T[G+12],6,1700485571),W=LT(W,P,Q,C,T[G+3],10,-1894986606),C=LT(C,W,P,Q,T[G+10],15,-1051523),Q=LT(Q,C,W,P,T[G+1],21,-2054922799),P=LT(P,Q,C,W,T[G+8],6,1873313359),W=LT(W,P,Q,C,T[G+15],10,-30611744),C=LT(C,W,P,Q,T[G+6],15,-1560198380),Q=LT(Q,C,W,P,T[G+13],21,1309151649),P=LT(P,Q,C,W,T[G+4],6,-145523070),W=LT(W,P,Q,C,T[G+11],10,-1120210379),C=LT(C,W,P,Q,T[G+2],15,718787259),Q=LT(Q,C,W,P,T[G+9],21,-343485551),P=EA(P,J),Q=EA(Q,$),C=EA(C,X),W=EA(W,Z)}return[P,Q,C,W]}function Jz(T){if(T.length===0)return[];var A=T.length*8,P=new Uint32Array(o9(A));for(var Q=0;Q<A;Q+=8)P[Q>>5]|=(T[Q/8]&255)<<Q%32;return P}function EA(T,A){var P=(T&65535)+(A&65535),Q=(T>>16)+(A>>16)+(P>>16);return Q<<16|P&65535}function $z(T,A){return T<<A|T>>>32-A}function J4(T,A,P,Q,C,W){return EA($z(EA(EA(A,T),EA(Q,W)),C),P)}function ST(T,A,P,Q,C,W,G){return J4(A&P|~A&Q,T,A,C,W,G)}function NT(T,A,P,Q,C,W,G){return J4(A&Q|P&~Q,T,A,C,W,G)}function wT(T,A,P,Q,C,W,G){return J4(A^P^Q,T,A,C,W,G)}function LT(T,A,P,Q,C,W,G){return J4(P^(A|~Q),T,A,C,W,G)}var n9;var f9=jT(()=>{n9=Wz});var Vz,i9;var a9=jT(()=>{fC();f9();Vz=j2("v3",48,n9),i9=Vz});function qz(T,A,P){T=T||{};var Q=T.random||(T.rng||H2)();if(Q[6]=Q[6]&15|64,Q[8]=Q[8]&63|128,A){P=P||0;for(var C=0;C<16;++C)A[P+C]=Q[C];return A}return LA(Q)}var s9;var t9=jT(()=>{dC();k2();s9=qz});function Yz(T,A,P,Q){switch(T){case 0:return A&P^~A&Q;case 1:return A^P^Q;case 2:return A&P^A&Q^P&Q;case 3:return A^P^Q}}function iC(T,A){return T<<A|T>>>32-A}function Zz(T){var A=[1518500249,1859775393,2400959708,3395469782],P=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof T==="string"){var Q=unescape(encodeURIComponent(T));T=[];for(var C=0;C<Q.length;++C)T.push(Q.charCodeAt(C))}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),J=Array(G);for(var $=0;$<G;++$){var X=new Uint32Array(16);for(var Z=0;Z<16;++Z)X[Z]=T[$*64+Z*4]<<24|T[$*64+Z*4+1]<<16|T[$*64+Z*4+2]<<8|T[$*64+Z*4+3];J[$]=X}J[G-1][14]=(T.length-1)*8/Math.pow(2,32),J[G-1][14]=Math.floor(J[G-1][14]),J[G-1][15]=(T.length-1)*8&4294967295;for(var R=0;R<G;++R){var D=new Uint32Array(80);for(var z=0;z<16;++z)D[z]=J[R][z];for(var S=16;S<80;++S)D[S]=iC(D[S-3]^D[S-8]^D[S-14]^D[S-16],1);var E=P[0],w=P[1],O=P[2],m=P[3],g=P[4];for(var p=0;p<80;++p){var c=Math.floor(p/20),o=iC(E,5)+Yz(c,w,O,m)+g+A[c]+D[p]>>>0;g=m,m=O,O=iC(w,30)>>>0,w=E,E=o}P[0]=P[0]+E>>>0,P[1]=P[1]+w>>>0,P[2]=P[2]+O>>>0,P[3]=P[3]+m>>>0,P[4]=P[4]+g>>>0}return[P[0]>>24&255,P[0]>>16&255,P[0]>>8&255,P[0]&255,P[1]>>24&255,P[1]>>16&255,P[1]>>8&255,P[1]&255,P[2]>>24&255,P[2]>>16&255,P[2]>>8&255,P[2]&255,P[3]>>24&255,P[3]>>16&255,P[3]>>8&255,P[3]&255,P[4]>>24&255,P[4]>>16&255,P[4]>>8&255,P[4]&255]}var e9;var TV=jT(()=>{e9=Zz});var Xz,AV;var PV=jT(()=>{fC();TV();Xz=j2("v5",80,e9),AV=Xz});var QV="00000000-0000-0000-0000-000000000000";function Kz(T){if(!wA(T))throw TypeError("Invalid UUID");return parseInt(T.substr(14,1),16)}var CV;var WV=jT(()=>{K2();CV=Kz});var aC={};s4(aC,{version:()=>CV,validate:()=>wA,v5:()=>AV,v4:()=>s9,v3:()=>i9,v1:()=>r9,stringify:()=>LA,parse:()=>U4,NIL:()=>QV});var sC=jT(()=>{c9();a9();t9();PV();WV();K2();k2();nC()});var UV=T0((jx,GV)=>{var Rz=(sC(),G8(aC)).v4,kz=function(T,A,P,Q){if(typeof T!=="string")throw TypeError(T+" must be a string");Q=Q||{};let C=typeof Q.version==="number"?Q.version:2;if(C!==1&&C!==2)throw TypeError(C+" must be 1 or 2");let W={method:T};if(C===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 P>"u"){let G=typeof Q.generator==="function"?Q.generator:function(){return Rz()};W.id=G(W,Q)}else if(C===2&&P===null){if(Q.notificationIdNull)W.id=null}else W.id=P;return W};GV.exports=kz});var $V=T0((Dx,JV)=>{var jz=(sC(),G8(aC)).v4,Dz=UV(),D2=function(T,A){if(!(this instanceof D2))return new D2(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 jz()},version:typeof A.version<"u"?A.version:2,notificationIdNull:typeof A.notificationIdNull==="boolean"?A.notificationIdNull:!1},this.callServer=T};JV.exports=D2;D2.prototype.request=function(T,A,P,Q){let C=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")Q=A,W=T;else{if(typeof P==="function")Q=P,P=void 0;let X=typeof Q==="function";try{W=Dz(T,A,P,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(Z){if(X)return Q(Z);throw Z}if(!X)return W}let $;try{$=JSON.stringify(W,this.options.replacer)}catch(X){return Q(X)}return this.callServer($,function(X,Z){C._parseResponse(X,Z,Q)}),W};D2.prototype._parseResponse=function(T,A,P){if(T){P(T);return}if(!A)return P();let Q;try{Q=JSON.parse(A,this.options.reviver)}catch(C){return P(C)}if(P.length===3)if(Array.isArray(Q)){let C=function(G){return typeof G.error<"u"},W=function(G){return!C(G)};return P(null,Q.filter(C),Q.filter(W))}else return P(null,Q.error,Q.result);P(null,Q)}});var qV=T0((Fx,tC)=>{var Fz=Object.prototype.hasOwnProperty,gT="~";function F2(){}if(Object.create){if(F2.prototype=Object.create(null),!new F2().__proto__)gT=!1}function Mz(T,A,P){this.fn=T,this.context=A,this.once=P||!1}function VV(T,A,P,Q,C){if(typeof P!=="function")throw TypeError("The listener must be a function");var W=new Mz(P,Q||T,C),G=gT?gT+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 $4(T,A){if(--T._eventsCount===0)T._events=new F2;else delete T._events[A]}function ET(){this._events=new F2,this._eventsCount=0}ET.prototype.eventNames=function(){var A=[],P,Q;if(this._eventsCount===0)return A;for(Q in P=this._events)if(Fz.call(P,Q))A.push(gT?Q.slice(1):Q);if(Object.getOwnPropertySymbols)return A.concat(Object.getOwnPropertySymbols(P));return A};ET.prototype.listeners=function(A){var P=gT?gT+A:A,Q=this._events[P];if(!Q)return[];if(Q.fn)return[Q.fn];for(var C=0,W=Q.length,G=Array(W);C<W;C++)G[C]=Q[C].fn;return G};ET.prototype.listenerCount=function(A){var P=gT?gT+A:A,Q=this._events[P];if(!Q)return 0;if(Q.fn)return 1;return Q.length};ET.prototype.emit=function(A,P,Q,C,W,G){var J=gT?gT+A:A;if(!this._events[J])return!1;var $=this._events[J],X=arguments.length,Z,R;if($.fn){if($.once)this.removeListener(A,$.fn,void 0,!0);switch(X){case 1:return $.fn.call($.context),!0;case 2:return $.fn.call($.context,P),!0;case 3:return $.fn.call($.context,P,Q),!0;case 4:return $.fn.call($.context,P,Q,C),!0;case 5:return $.fn.call($.context,P,Q,C,W),!0;case 6:return $.fn.call($.context,P,Q,C,W,G),!0}for(R=1,Z=Array(X-1);R<X;R++)Z[R-1]=arguments[R];$.fn.apply($.context,Z)}else{var D=$.length,z;for(R=0;R<D;R++){if($[R].once)this.removeListener(A,$[R].fn,void 0,!0);switch(X){case 1:$[R].fn.call($[R].context);break;case 2:$[R].fn.call($[R].context,P);break;case 3:$[R].fn.call($[R].context,P,Q);break;case 4:$[R].fn.call($[R].context,P,Q,C);break;default:if(!Z)for(z=1,Z=Array(X-1);z<X;z++)Z[z-1]=arguments[z];$[R].fn.apply($[R].context,Z)}}}return!0};ET.prototype.on=function(A,P,Q){return VV(this,A,P,Q,!1)};ET.prototype.once=function(A,P,Q){return VV(this,A,P,Q,!0)};ET.prototype.removeListener=function(A,P,Q,C){var W=gT?gT+A:A;if(!this._events[W])return this;if(!P)return $4(this,W),this;var G=this._events[W];if(G.fn){if(G.fn===P&&(!C||G.once)&&(!Q||G.context===Q))$4(this,W)}else{for(var J=0,$=[],X=G.length;J<X;J++)if(G[J].fn!==P||C&&!G[J].once||Q&&G[J].context!==Q)$.push(G[J]);if($.length)this._events[W]=$.length===1?$[0]:$;else $4(this,W)}return this};ET.prototype.removeAllListeners=function(A){var P;if(A){if(P=gT?gT+A:A,this._events[P])$4(this,P)}else this._events=new F2,this._eventsCount=0;return this};ET.prototype.off=ET.prototype.removeListener;ET.prototype.addListener=ET.prototype.on;ET.prefixed=gT;ET.EventEmitter=ET;if(typeof tC<"u")tC.exports=ET});var Vq=T0(($q)=>{Object.defineProperty($q,"__esModule",{value:!0});var M4;function _I(T){{let A=Buffer.from(T);A.reverse();let P=A.toString("hex");if(P.length===0)return BigInt(0);return BigInt(`0x${P}`)}return M4.toBigInt(T,!1)}$q.toBigIntLE=_I;function hI(T){{let A=T.toString("hex");if(A.length===0)return BigInt(0);return BigInt(`0x${A}`)}return M4.toBigInt(T,!0)}$q.toBigIntBE=hI;function mI(T,A){{let P=T.toString(16),Q=Buffer.from(P.padStart(A*2,"0").slice(0,A*2),"hex");return Q.reverse(),Q}return M4.fromBigInt(T,Buffer.allocUnsafe(A),!1)}$q.toBufferLE=mI;function gI(T,A){{let P=T.toString(16);return Buffer.from(P.padStart(A*2,"0").slice(0,A*2),"hex")}return M4.fromBigInt(T,Buffer.allocUnsafe(A),!0)}$q.toBufferBE=gI});/*!
|
|
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});/*!
|
|
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 TP=QG(),J8=CG(),WG=typeof Symbol==="function"&&typeof Symbol.for==="function"?Symbol.for("nodejs.util.inspect.custom"):null;var $P=h;var FG=50;var AP=2147483647;h.TYPED_ARRAY_SUPPORT=tq();if(!h.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 tq(){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(h.prototype,"parent",{enumerable:!0,get:function(){if(!h.isBuffer(this))return;return this.buffer}});Object.defineProperty(h.prototype,"offset",{enumerable:!0,get:function(){if(!h.isBuffer(this))return;return this.byteOffset}});function y0(T){if(T>AP)throw RangeError('The value "'+T+'" is invalid for option "size"');let A=new Uint8Array(T);return Object.setPrototypeOf(A,h.prototype),A}function h(T,A,P){if(typeof T==="number"){if(typeof A==="string")throw TypeError('The "string" argument must be of type string. Received type number');return WP(T)}return $G(T,A,P)}h.poolSize=8192;function $G(T,A,P){if(typeof T==="string")return TY(T,A);if(ArrayBuffer.isView(T))return AY(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(k0(T,ArrayBuffer)||T&&k0(T.buffer,ArrayBuffer))return QP(T,A,P);if(typeof SharedArrayBuffer<"u"&&(k0(T,SharedArrayBuffer)||T&&k0(T.buffer,SharedArrayBuffer)))return QP(T,A,P);if(typeof T==="number")throw TypeError('The "value" argument must not be of type number. Received type number');let Q=T.valueOf&&T.valueOf();if(Q!=null&&Q!==T)return h.from(Q,A,P);let C=PY(T);if(C)return C;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof T[Symbol.toPrimitive]==="function")return h.from(T[Symbol.toPrimitive]("string"),A,P);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T)}h.from=function(T,A,P){return $G(T,A,P)};Object.setPrototypeOf(h.prototype,Uint8Array.prototype);Object.setPrototypeOf(h,Uint8Array);function VG(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 eq(T,A,P){if(VG(T),T<=0)return y0(T);if(A!==void 0)return typeof P==="string"?y0(T).fill(A,P):y0(T).fill(A);return y0(T)}h.alloc=function(T,A,P){return eq(T,A,P)};function WP(T){return VG(T),y0(T<0?0:GP(T)|0)}h.allocUnsafe=function(T){return WP(T)};h.allocUnsafeSlow=function(T){return WP(T)};function TY(T,A){if(typeof A!=="string"||A==="")A="utf8";if(!h.isEncoding(A))throw TypeError("Unknown encoding: "+A);let P=qG(T,A)|0,Q=y0(P),C=Q.write(T,A);if(C!==P)Q=Q.slice(0,C);return Q}function PP(T){let A=T.length<0?0:GP(T.length)|0,P=y0(A);for(let Q=0;Q<A;Q+=1)P[Q]=T[Q]&255;return P}function AY(T){if(k0(T,Uint8Array)){let A=new Uint8Array(T);return QP(A.buffer,A.byteOffset,A.byteLength)}return PP(T)}function QP(T,A,P){if(A<0||T.byteLength<A)throw RangeError('"offset" is outside of buffer bounds');if(T.byteLength<A+(P||0))throw RangeError('"length" is outside of buffer bounds');let Q;if(A===void 0&&P===void 0)Q=new Uint8Array(T);else if(P===void 0)Q=new Uint8Array(T,A);else Q=new Uint8Array(T,A,P);return Object.setPrototypeOf(Q,h.prototype),Q}function PY(T){if(h.isBuffer(T)){let A=GP(T.length)|0,P=y0(A);if(P.length===0)return P;return T.copy(P,0,0,A),P}if(T.length!==void 0){if(typeof T.length!=="number"||JP(T.length))return y0(0);return PP(T)}if(T.type==="Buffer"&&Array.isArray(T.data))return PP(T.data)}function GP(T){if(T>=AP)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+AP.toString(16)+" bytes");return T|0}h.isBuffer=function(A){return A!=null&&A._isBuffer===!0&&A!==h.prototype};h.compare=function(A,P){if(k0(A,Uint8Array))A=h.from(A,A.offset,A.byteLength);if(k0(P,Uint8Array))P=h.from(P,P.offset,P.byteLength);if(!h.isBuffer(A)||!h.isBuffer(P))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(A===P)return 0;let Q=A.length,C=P.length;for(let W=0,G=Math.min(Q,C);W<G;++W)if(A[W]!==P[W]){Q=A[W],C=P[W];break}if(Q<C)return-1;if(C<Q)return 1;return 0};h.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}};h.concat=function(A,P){if(!Array.isArray(A))throw TypeError('"list" argument must be an Array of Buffers');if(A.length===0)return h.alloc(0);let Q;if(P===void 0){P=0;for(Q=0;Q<A.length;++Q)P+=A[Q].length}let C=h.allocUnsafe(P),W=0;for(Q=0;Q<A.length;++Q){let G=A[Q];if(k0(G,Uint8Array))if(W+G.length>C.length){if(!h.isBuffer(G))G=h.from(G);G.copy(C,W)}else Uint8Array.prototype.set.call(C,G,W);else if(!h.isBuffer(G))throw TypeError('"list" argument must be an Array of Buffers');else G.copy(C,W);W+=G.length}return C};function qG(T,A){if(h.isBuffer(T))return T.length;if(ArrayBuffer.isView(T)||k0(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 P=T.length,Q=arguments.length>2&&arguments[2]===!0;if(!Q&&P===0)return 0;let C=!1;for(;;)switch(A){case"ascii":case"latin1":case"binary":return P;case"utf8":case"utf-8":return CP(T).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P*2;case"hex":return P>>>1;case"base64":return DG(T).length;default:if(C)return Q?-1:CP(T).length;A=(""+A).toLowerCase(),C=!0}}h.byteLength=qG;function QY(T,A,P){let Q=!1;if(A===void 0||A<0)A=0;if(A>this.length)return"";if(P===void 0||P>this.length)P=this.length;if(P<=0)return"";if(P>>>=0,A>>>=0,P<=A)return"";if(!T)T="utf8";while(!0)switch(T){case"hex":return ZY(this,A,P);case"utf8":case"utf-8":return ZG(this,A,P);case"ascii":return qY(this,A,P);case"latin1":case"binary":return YY(this,A,P);case"base64":return $Y(this,A,P);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return XY(this,A,P);default:if(Q)throw TypeError("Unknown encoding: "+T);T=(T+"").toLowerCase(),Q=!0}}h.prototype._isBuffer=!0;function _A(T,A,P){let Q=T[A];T[A]=T[P],T[P]=Q}h.prototype.swap16=function(){let A=this.length;if(A%2!==0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let P=0;P<A;P+=2)_A(this,P,P+1);return this};h.prototype.swap32=function(){let A=this.length;if(A%4!==0)throw RangeError("Buffer size must be a multiple of 32-bits");for(let P=0;P<A;P+=4)_A(this,P,P+3),_A(this,P+1,P+2);return this};h.prototype.swap64=function(){let A=this.length;if(A%8!==0)throw RangeError("Buffer size must be a multiple of 64-bits");for(let P=0;P<A;P+=8)_A(this,P,P+7),_A(this,P+1,P+6),_A(this,P+2,P+5),_A(this,P+3,P+4);return this};h.prototype.toString=function(){let A=this.length;if(A===0)return"";if(arguments.length===0)return ZG(this,0,A);return QY.apply(this,arguments)};h.prototype.toLocaleString=h.prototype.toString;h.prototype.equals=function(A){if(!h.isBuffer(A))throw TypeError("Argument must be a Buffer");if(this===A)return!0;return h.compare(this,A)===0};h.prototype.inspect=function(){let A="",P=FG;if(A=this.toString("hex",0,P).replace(/(.{2})/g,"$1 ").trim(),this.length>P)A+=" ... ";return"<Buffer "+A+">"};if(WG)h.prototype[WG]=h.prototype.inspect;h.prototype.compare=function(A,P,Q,C,W){if(k0(A,Uint8Array))A=h.from(A,A.offset,A.byteLength);if(!h.isBuffer(A))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof A);if(P===void 0)P=0;if(Q===void 0)Q=A?A.length:0;if(C===void 0)C=0;if(W===void 0)W=this.length;if(P<0||Q>A.length||C<0||W>this.length)throw RangeError("out of range index");if(C>=W&&P>=Q)return 0;if(C>=W)return-1;if(P>=Q)return 1;if(P>>>=0,Q>>>=0,C>>>=0,W>>>=0,this===A)return 0;let G=W-C,J=Q-P,$=Math.min(G,J),X=this.slice(C,W),Z=A.slice(P,Q);for(let R=0;R<$;++R)if(X[R]!==Z[R]){G=X[R],J=Z[R];break}if(G<J)return-1;if(J<G)return 1;return 0};function YG(T,A,P,Q,C){if(T.length===0)return-1;if(typeof P==="string")Q=P,P=0;else if(P>2147483647)P=2147483647;else if(P<-2147483648)P=-2147483648;if(P=+P,JP(P))P=C?0:T.length-1;if(P<0)P=T.length+P;if(P>=T.length)if(C)return-1;else P=T.length-1;else if(P<0)if(C)P=0;else return-1;if(typeof A==="string")A=h.from(A,Q);if(h.isBuffer(A)){if(A.length===0)return-1;return GG(T,A,P,Q,C)}else if(typeof A==="number"){if(A=A&255,typeof Uint8Array.prototype.indexOf==="function")if(C)return Uint8Array.prototype.indexOf.call(T,A,P);else return Uint8Array.prototype.lastIndexOf.call(T,A,P);return GG(T,[A],P,Q,C)}throw TypeError("val must be string, number or Buffer")}function GG(T,A,P,Q,C){let W=1,G=T.length,J=A.length;if(Q!==void 0){if(Q=String(Q).toLowerCase(),Q==="ucs2"||Q==="ucs-2"||Q==="utf16le"||Q==="utf-16le"){if(T.length<2||A.length<2)return-1;W=2,G/=2,J/=2,P/=2}}function $(Z,R){if(W===1)return Z[R];else return Z.readUInt16BE(R*W)}let X;if(C){let Z=-1;for(X=P;X<G;X++)if($(T,X)===$(A,Z===-1?0:X-Z)){if(Z===-1)Z=X;if(X-Z+1===J)return Z*W}else{if(Z!==-1)X-=X-Z;Z=-1}}else{if(P+J>G)P=G-J;for(X=P;X>=0;X--){let Z=!0;for(let R=0;R<J;R++)if($(T,X+R)!==$(A,R)){Z=!1;break}if(Z)return X}}return-1}h.prototype.includes=function(A,P,Q){return this.indexOf(A,P,Q)!==-1};h.prototype.indexOf=function(A,P,Q){return YG(this,A,P,Q,!0)};h.prototype.lastIndexOf=function(A,P,Q){return YG(this,A,P,Q,!1)};function CY(T,A,P,Q){P=Number(P)||0;let C=T.length-P;if(!Q)Q=C;else if(Q=Number(Q),Q>C)Q=C;let W=A.length;if(Q>W/2)Q=W/2;let G;for(G=0;G<Q;++G){let J=parseInt(A.substr(G*2,2),16);if(JP(J))return G;T[P+G]=J}return G}function WY(T,A,P,Q){return g2(CP(A,T.length-P),T,P,Q)}function GY(T,A,P,Q){return g2(kY(A),T,P,Q)}function UY(T,A,P,Q){return g2(DG(A),T,P,Q)}function JY(T,A,P,Q){return g2(jY(A,T.length-P),T,P,Q)}h.prototype.write=function(A,P,Q,C){if(P===void 0)C="utf8",Q=this.length,P=0;else if(Q===void 0&&typeof P==="string")C=P,Q=this.length,P=0;else if(isFinite(P))if(P=P>>>0,isFinite(Q)){if(Q=Q>>>0,C===void 0)C="utf8"}else C=Q,Q=void 0;else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let W=this.length-P;if(Q===void 0||Q>W)Q=W;if(A.length>0&&(Q<0||P<0)||P>this.length)throw RangeError("Attempt to write outside buffer bounds");if(!C)C="utf8";let G=!1;for(;;)switch(C){case"hex":return CY(this,A,P,Q);case"utf8":case"utf-8":return WY(this,A,P,Q);case"ascii":case"latin1":case"binary":return GY(this,A,P,Q);case"base64":return UY(this,A,P,Q);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return JY(this,A,P,Q);default:if(G)throw TypeError("Unknown encoding: "+C);C=(""+C).toLowerCase(),G=!0}};h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function $Y(T,A,P){if(A===0&&P===T.length)return TP.fromByteArray(T);else return TP.fromByteArray(T.slice(A,P))}function ZG(T,A,P){P=Math.min(T.length,P);let Q=[],C=A;while(C<P){let W=T[C],G=null,J=W>239?4:W>223?3:W>191?2:1;if(C+J<=P){let $,X,Z,R;switch(J){case 1:if(W<128)G=W;break;case 2:if($=T[C+1],($&192)===128){if(R=(W&31)<<6|$&63,R>127)G=R}break;case 3:if($=T[C+1],X=T[C+2],($&192)===128&&(X&192)===128){if(R=(W&15)<<12|($&63)<<6|X&63,R>2047&&(R<55296||R>57343))G=R}break;case 4:if($=T[C+1],X=T[C+2],Z=T[C+3],($&192)===128&&(X&192)===128&&(Z&192)===128){if(R=(W&15)<<18|($&63)<<12|(X&63)<<6|Z&63,R>65535&&R<1114112)G=R}}}if(G===null)G=65533,J=1;else if(G>65535)G-=65536,Q.push(G>>>10&1023|55296),G=56320|G&1023;Q.push(G),C+=J}return VY(Q)}var UG=4096;function VY(T){let A=T.length;if(A<=UG)return String.fromCharCode.apply(String,T);let P="",Q=0;while(Q<A)P+=String.fromCharCode.apply(String,T.slice(Q,Q+=UG));return P}function qY(T,A,P){let Q="";P=Math.min(T.length,P);for(let C=A;C<P;++C)Q+=String.fromCharCode(T[C]&127);return Q}function YY(T,A,P){let Q="";P=Math.min(T.length,P);for(let C=A;C<P;++C)Q+=String.fromCharCode(T[C]);return Q}function ZY(T,A,P){let Q=T.length;if(!A||A<0)A=0;if(!P||P<0||P>Q)P=Q;let C="";for(let W=A;W<P;++W)C+=DY[T[W]];return C}function XY(T,A,P){let Q=T.slice(A,P),C="";for(let W=0;W<Q.length-1;W+=2)C+=String.fromCharCode(Q[W]+Q[W+1]*256);return C}h.prototype.slice=function(A,P){let Q=this.length;if(A=~~A,P=P===void 0?Q:~~P,A<0){if(A+=Q,A<0)A=0}else if(A>Q)A=Q;if(P<0){if(P+=Q,P<0)P=0}else if(P>Q)P=Q;if(P<A)P=A;let C=this.subarray(A,P);return Object.setPrototypeOf(C,h.prototype),C};function VT(T,A,P){if(T%1!==0||T<0)throw RangeError("offset is not uint");if(T+A>P)throw RangeError("Trying to access beyond buffer length")}h.prototype.readUintLE=h.prototype.readUIntLE=function(A,P,Q){if(A=A>>>0,P=P>>>0,!Q)VT(A,P,this.length);let C=this[A],W=1,G=0;while(++G<P&&(W*=256))C+=this[A+G]*W;return C};h.prototype.readUintBE=h.prototype.readUIntBE=function(A,P,Q){if(A=A>>>0,P=P>>>0,!Q)VT(A,P,this.length);let C=this[A+--P],W=1;while(P>0&&(W*=256))C+=this[A+--P]*W;return C};h.prototype.readUint8=h.prototype.readUInt8=function(A,P){if(A=A>>>0,!P)VT(A,1,this.length);return this[A]};h.prototype.readUint16LE=h.prototype.readUInt16LE=function(A,P){if(A=A>>>0,!P)VT(A,2,this.length);return this[A]|this[A+1]<<8};h.prototype.readUint16BE=h.prototype.readUInt16BE=function(A,P){if(A=A>>>0,!P)VT(A,2,this.length);return this[A]<<8|this[A+1]};h.prototype.readUint32LE=h.prototype.readUInt32LE=function(A,P){if(A=A>>>0,!P)VT(A,4,this.length);return(this[A]|this[A+1]<<8|this[A+2]<<16)+this[A+3]*16777216};h.prototype.readUint32BE=h.prototype.readUInt32BE=function(A,P){if(A=A>>>0,!P)VT(A,4,this.length);return this[A]*16777216+(this[A+1]<<16|this[A+2]<<8|this[A+3])};h.prototype.readBigUInt64LE=VA(function(A){A=A>>>0,$8(A,"offset");let P=this[A],Q=this[A+7];if(P===void 0||Q===void 0)p8(A,this.length-8);let C=P+this[++A]*256+this[++A]*65536+this[++A]*16777216,W=this[++A]+this[++A]*256+this[++A]*65536+Q*16777216;return BigInt(C)+(BigInt(W)<<BigInt(32))});h.prototype.readBigUInt64BE=VA(function(A){A=A>>>0,$8(A,"offset");let P=this[A],Q=this[A+7];if(P===void 0||Q===void 0)p8(A,this.length-8);let C=P*16777216+this[++A]*65536+this[++A]*256+this[++A],W=this[++A]*16777216+this[++A]*65536+this[++A]*256+Q;return(BigInt(C)<<BigInt(32))+BigInt(W)});h.prototype.readIntLE=function(A,P,Q){if(A=A>>>0,P=P>>>0,!Q)VT(A,P,this.length);let C=this[A],W=1,G=0;while(++G<P&&(W*=256))C+=this[A+G]*W;if(W*=128,C>=W)C-=Math.pow(2,8*P);return C};h.prototype.readIntBE=function(A,P,Q){if(A=A>>>0,P=P>>>0,!Q)VT(A,P,this.length);let C=P,W=1,G=this[A+--C];while(C>0&&(W*=256))G+=this[A+--C]*W;if(W*=128,G>=W)G-=Math.pow(2,8*P);return G};h.prototype.readInt8=function(A,P){if(A=A>>>0,!P)VT(A,1,this.length);if(!(this[A]&128))return this[A];return(255-this[A]+1)*-1};h.prototype.readInt16LE=function(A,P){if(A=A>>>0,!P)VT(A,2,this.length);let Q=this[A]|this[A+1]<<8;return Q&32768?Q|4294901760:Q};h.prototype.readInt16BE=function(A,P){if(A=A>>>0,!P)VT(A,2,this.length);let Q=this[A+1]|this[A]<<8;return Q&32768?Q|4294901760:Q};h.prototype.readInt32LE=function(A,P){if(A=A>>>0,!P)VT(A,4,this.length);return this[A]|this[A+1]<<8|this[A+2]<<16|this[A+3]<<24};h.prototype.readInt32BE=function(A,P){if(A=A>>>0,!P)VT(A,4,this.length);return this[A]<<24|this[A+1]<<16|this[A+2]<<8|this[A+3]};h.prototype.readBigInt64LE=VA(function(A){A=A>>>0,$8(A,"offset");let P=this[A],Q=this[A+7];if(P===void 0||Q===void 0)p8(A,this.length-8);let C=this[A+4]+this[A+5]*256+this[A+6]*65536+(Q<<24);return(BigInt(C)<<BigInt(32))+BigInt(P+this[++A]*256+this[++A]*65536+this[++A]*16777216)});h.prototype.readBigInt64BE=VA(function(A){A=A>>>0,$8(A,"offset");let P=this[A],Q=this[A+7];if(P===void 0||Q===void 0)p8(A,this.length-8);let C=(P<<24)+this[++A]*65536+this[++A]*256+this[++A];return(BigInt(C)<<BigInt(32))+BigInt(this[++A]*16777216+this[++A]*65536+this[++A]*256+Q)});h.prototype.readFloatLE=function(A,P){if(A=A>>>0,!P)VT(A,4,this.length);return J8.read(this,A,!0,23,4)};h.prototype.readFloatBE=function(A,P){if(A=A>>>0,!P)VT(A,4,this.length);return J8.read(this,A,!1,23,4)};h.prototype.readDoubleLE=function(A,P){if(A=A>>>0,!P)VT(A,8,this.length);return J8.read(this,A,!0,52,8)};h.prototype.readDoubleBE=function(A,P){if(A=A>>>0,!P)VT(A,8,this.length);return J8.read(this,A,!1,52,8)};function bT(T,A,P,Q,C,W){if(!h.isBuffer(T))throw TypeError('"buffer" argument must be a Buffer instance');if(A>C||A<W)throw RangeError('"value" argument is out of bounds');if(P+Q>T.length)throw RangeError("Index out of range")}h.prototype.writeUintLE=h.prototype.writeUIntLE=function(A,P,Q,C){if(A=+A,P=P>>>0,Q=Q>>>0,!C){let J=Math.pow(2,8*Q)-1;bT(this,A,P,Q,J,0)}let W=1,G=0;this[P]=A&255;while(++G<Q&&(W*=256))this[P+G]=A/W&255;return P+Q};h.prototype.writeUintBE=h.prototype.writeUIntBE=function(A,P,Q,C){if(A=+A,P=P>>>0,Q=Q>>>0,!C){let J=Math.pow(2,8*Q)-1;bT(this,A,P,Q,J,0)}let W=Q-1,G=1;this[P+W]=A&255;while(--W>=0&&(G*=256))this[P+W]=A/G&255;return P+Q};h.prototype.writeUint8=h.prototype.writeUInt8=function(A,P,Q){if(A=+A,P=P>>>0,!Q)bT(this,A,P,1,255,0);return this[P]=A&255,P+1};h.prototype.writeUint16LE=h.prototype.writeUInt16LE=function(A,P,Q){if(A=+A,P=P>>>0,!Q)bT(this,A,P,2,65535,0);return this[P]=A&255,this[P+1]=A>>>8,P+2};h.prototype.writeUint16BE=h.prototype.writeUInt16BE=function(A,P,Q){if(A=+A,P=P>>>0,!Q)bT(this,A,P,2,65535,0);return this[P]=A>>>8,this[P+1]=A&255,P+2};h.prototype.writeUint32LE=h.prototype.writeUInt32LE=function(A,P,Q){if(A=+A,P=P>>>0,!Q)bT(this,A,P,4,4294967295,0);return this[P+3]=A>>>24,this[P+2]=A>>>16,this[P+1]=A>>>8,this[P]=A&255,P+4};h.prototype.writeUint32BE=h.prototype.writeUInt32BE=function(A,P,Q){if(A=+A,P=P>>>0,!Q)bT(this,A,P,4,4294967295,0);return this[P]=A>>>24,this[P+1]=A>>>16,this[P+2]=A>>>8,this[P+3]=A&255,P+4};function XG(T,A,P,Q,C){jG(A,Q,C,T,P,7);let W=Number(A&BigInt(4294967295));T[P++]=W,W=W>>8,T[P++]=W,W=W>>8,T[P++]=W,W=W>>8,T[P++]=W;let G=Number(A>>BigInt(32)&BigInt(4294967295));return T[P++]=G,G=G>>8,T[P++]=G,G=G>>8,T[P++]=G,G=G>>8,T[P++]=G,P}function HG(T,A,P,Q,C){jG(A,Q,C,T,P,7);let W=Number(A&BigInt(4294967295));T[P+7]=W,W=W>>8,T[P+6]=W,W=W>>8,T[P+5]=W,W=W>>8,T[P+4]=W;let G=Number(A>>BigInt(32)&BigInt(4294967295));return T[P+3]=G,G=G>>8,T[P+2]=G,G=G>>8,T[P+1]=G,G=G>>8,T[P]=G,P+8}h.prototype.writeBigUInt64LE=VA(function(A,P=0){return XG(this,A,P,BigInt(0),BigInt("0xffffffffffffffff"))});h.prototype.writeBigUInt64BE=VA(function(A,P=0){return HG(this,A,P,BigInt(0),BigInt("0xffffffffffffffff"))});h.prototype.writeIntLE=function(A,P,Q,C){if(A=+A,P=P>>>0,!C){let $=Math.pow(2,8*Q-1);bT(this,A,P,Q,$-1,-$)}let W=0,G=1,J=0;this[P]=A&255;while(++W<Q&&(G*=256)){if(A<0&&J===0&&this[P+W-1]!==0)J=1;this[P+W]=(A/G>>0)-J&255}return P+Q};h.prototype.writeIntBE=function(A,P,Q,C){if(A=+A,P=P>>>0,!C){let $=Math.pow(2,8*Q-1);bT(this,A,P,Q,$-1,-$)}let W=Q-1,G=1,J=0;this[P+W]=A&255;while(--W>=0&&(G*=256)){if(A<0&&J===0&&this[P+W+1]!==0)J=1;this[P+W]=(A/G>>0)-J&255}return P+Q};h.prototype.writeInt8=function(A,P,Q){if(A=+A,P=P>>>0,!Q)bT(this,A,P,1,127,-128);if(A<0)A=255+A+1;return this[P]=A&255,P+1};h.prototype.writeInt16LE=function(A,P,Q){if(A=+A,P=P>>>0,!Q)bT(this,A,P,2,32767,-32768);return this[P]=A&255,this[P+1]=A>>>8,P+2};h.prototype.writeInt16BE=function(A,P,Q){if(A=+A,P=P>>>0,!Q)bT(this,A,P,2,32767,-32768);return this[P]=A>>>8,this[P+1]=A&255,P+2};h.prototype.writeInt32LE=function(A,P,Q){if(A=+A,P=P>>>0,!Q)bT(this,A,P,4,2147483647,-2147483648);return this[P]=A&255,this[P+1]=A>>>8,this[P+2]=A>>>16,this[P+3]=A>>>24,P+4};h.prototype.writeInt32BE=function(A,P,Q){if(A=+A,P=P>>>0,!Q)bT(this,A,P,4,2147483647,-2147483648);if(A<0)A=4294967295+A+1;return this[P]=A>>>24,this[P+1]=A>>>16,this[P+2]=A>>>8,this[P+3]=A&255,P+4};h.prototype.writeBigInt64LE=VA(function(A,P=0){return XG(this,A,P,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});h.prototype.writeBigInt64BE=VA(function(A,P=0){return HG(this,A,P,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function KG(T,A,P,Q,C,W){if(P+Q>T.length)throw RangeError("Index out of range");if(P<0)throw RangeError("Index out of range")}function RG(T,A,P,Q,C){if(A=+A,P=P>>>0,!C)KG(T,A,P,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return J8.write(T,A,P,Q,23,4),P+4}h.prototype.writeFloatLE=function(A,P,Q){return RG(this,A,P,!0,Q)};h.prototype.writeFloatBE=function(A,P,Q){return RG(this,A,P,!1,Q)};function kG(T,A,P,Q,C){if(A=+A,P=P>>>0,!C)KG(T,A,P,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return J8.write(T,A,P,Q,52,8),P+8}h.prototype.writeDoubleLE=function(A,P,Q){return kG(this,A,P,!0,Q)};h.prototype.writeDoubleBE=function(A,P,Q){return kG(this,A,P,!1,Q)};h.prototype.copy=function(A,P,Q,C){if(!h.isBuffer(A))throw TypeError("argument should be a Buffer");if(!Q)Q=0;if(!C&&C!==0)C=this.length;if(P>=A.length)P=A.length;if(!P)P=0;if(C>0&&C<Q)C=Q;if(C===Q)return 0;if(A.length===0||this.length===0)return 0;if(P<0)throw RangeError("targetStart out of bounds");if(Q<0||Q>=this.length)throw RangeError("Index out of range");if(C<0)throw RangeError("sourceEnd out of bounds");if(C>this.length)C=this.length;if(A.length-P<C-Q)C=A.length-P+Q;let W=C-Q;if(this===A&&typeof Uint8Array.prototype.copyWithin==="function")this.copyWithin(P,Q,C);else Uint8Array.prototype.set.call(A,this.subarray(Q,C),P);return W};h.prototype.fill=function(A,P,Q,C){if(typeof A==="string"){if(typeof P==="string")C=P,P=0,Q=this.length;else if(typeof Q==="string")C=Q,Q=this.length;if(C!==void 0&&typeof C!=="string")throw TypeError("encoding must be a string");if(typeof C==="string"&&!h.isEncoding(C))throw TypeError("Unknown encoding: "+C);if(A.length===1){let G=A.charCodeAt(0);if(C==="utf8"&&G<128||C==="latin1")A=G}}else if(typeof A==="number")A=A&255;else if(typeof A==="boolean")A=Number(A);if(P<0||this.length<P||this.length<Q)throw RangeError("Out of range index");if(Q<=P)return this;if(P=P>>>0,Q=Q===void 0?this.length:Q>>>0,!A)A=0;let W;if(typeof A==="number")for(W=P;W<Q;++W)this[W]=A;else{let G=h.isBuffer(A)?A:h.from(A,C),J=G.length;if(J===0)throw TypeError('The value "'+A+'" is invalid for argument "value"');for(W=0;W<Q-P;++W)this[W+P]=G[W%J]}return this};var U8={};function UP(T,A,P){U8[T]=class extends P{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(C){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:C,writable:!0})}toString(){return`${this.name} [${T}]: ${this.message}`}}}UP("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);UP("ERR_INVALID_ARG_TYPE",function(T,A){return`The "${T}" argument must be of type number. Received type ${typeof A}`},TypeError);UP("ERR_OUT_OF_RANGE",function(T,A,P){let Q=`The value of "${T}" is out of range.`,C=P;if(Number.isInteger(P)&&Math.abs(P)>4294967296)C=JG(String(P));else if(typeof P==="bigint"){if(C=String(P),P>BigInt(2)**BigInt(32)||P<-(BigInt(2)**BigInt(32)))C=JG(C);C+="n"}return Q+=` It must be ${A}. Received ${C}`,Q},RangeError);function JG(T){let A="",P=T.length,Q=T[0]==="-"?1:0;for(;P>=Q+4;P-=3)A=`_${T.slice(P-3,P)}${A}`;return`${T.slice(0,P)}${A}`}function HY(T,A,P){if($8(A,"offset"),T[A]===void 0||T[A+P]===void 0)p8(A,T.length-(P+1))}function jG(T,A,P,Q,C,W){if(T>P||T<A){let G=typeof A==="bigint"?"n":"",J;if(W>3)if(A===0||A===BigInt(0))J=`>= 0${G} and < 2${G} ** ${(W+1)*8}${G}`;else J=`>= -(2${G} ** ${(W+1)*8-1}${G}) and < 2 ** ${(W+1)*8-1}${G}`;else J=`>= ${A}${G} and <= ${P}${G}`;throw new U8.ERR_OUT_OF_RANGE("value",J,T)}HY(Q,C,W)}function $8(T,A){if(typeof T!=="number")throw new U8.ERR_INVALID_ARG_TYPE(A,"number",T)}function p8(T,A,P){if(Math.floor(T)!==T)throw $8(T,P),new U8.ERR_OUT_OF_RANGE(P||"offset","an integer",T);if(A<0)throw new U8.ERR_BUFFER_OUT_OF_BOUNDS;throw new U8.ERR_OUT_OF_RANGE(P||"offset",`>= ${P?1:0} and <= ${A}`,T)}var KY=/[^+/0-9A-Za-z-_]/g;function RY(T){if(T=T.split("=")[0],T=T.trim().replace(KY,""),T.length<2)return"";while(T.length%4!==0)T=T+"=";return T}function CP(T,A){A=A||1/0;let P,Q=T.length,C=null,W=[];for(let G=0;G<Q;++G){if(P=T.charCodeAt(G),P>55295&&P<57344){if(!C){if(P>56319){if((A-=3)>-1)W.push(239,191,189);continue}else if(G+1===Q){if((A-=3)>-1)W.push(239,191,189);continue}C=P;continue}if(P<56320){if((A-=3)>-1)W.push(239,191,189);C=P;continue}P=(C-55296<<10|P-56320)+65536}else if(C){if((A-=3)>-1)W.push(239,191,189)}if(C=null,P<128){if((A-=1)<0)break;W.push(P)}else if(P<2048){if((A-=2)<0)break;W.push(P>>6|192,P&63|128)}else if(P<65536){if((A-=3)<0)break;W.push(P>>12|224,P>>6&63|128,P&63|128)}else if(P<1114112){if((A-=4)<0)break;W.push(P>>18|240,P>>12&63|128,P>>6&63|128,P&63|128)}else throw Error("Invalid code point")}return W}function kY(T){let A=[];for(let P=0;P<T.length;++P)A.push(T.charCodeAt(P)&255);return A}function jY(T,A){let P,Q,C,W=[];for(let G=0;G<T.length;++G){if((A-=2)<0)break;P=T.charCodeAt(G),Q=P>>8,C=P%256,W.push(C),W.push(Q)}return W}function DG(T){return TP.toByteArray(RY(T))}function g2(T,A,P,Q){let C;for(C=0;C<Q;++C){if(C+P>=A.length||C>=T.length)break;A[C+P]=T[C]}return C}function k0(T,A){return T instanceof A||T!=null&&T.constructor!=null&&T.constructor.name!=null&&T.constructor.name===A.name}function JP(T){return T!==T}var DY=function(){let A=Array(256);for(let P=0;P<16;++P){let Q=P*16;for(let C=0;C<16;++C)A[Q+C]="0123456789abcdef"[P]+"0123456789abcdef"[C]}return A}();function VA(T){return typeof BigInt>"u"?FY:T}function FY(){throw Error("BigInt not supported")}if(typeof globalThis.Buffer>"u")globalThis.Buffer=$P;var VP=1,MG=2,zG=3,IG=4,SG=5,NG=6,wG=7,LG=8,EG=9,MY=10,zY=-32700,IY=-32603,SY=-32602,NY=-32601,wY=-32600,LY=-32019,EY=-32018,BY=-32017,OY=-32016,xY=-32015,_Y=-32014,hY=-32013,mY=-32012,gY=-32011,vY=-32010,yY=-32009,bY=-32008,lY=-32007,pY=-32006,uY=-32005,dY=-32004,rY=-32003,cY=-32002,oY=-32001,v2=2800000,y2=2800001,nY=2800002,qP=2800003,BG=2800004,OG=2800005,YP=2800006,ZP=2800007,b2=2800008,XP=2800009,xG=2800010,_G=2800011,HP=3230000,hG=32300001,KP=3230002,mG=3230003,gG=3230004,RP=3610000,kP=3610001,jP=3610002,DP=3610003,FP=3610004,MP=3610005,vG=3610006,fY=3610007,yG=3611000,iY=3704000,aY=3704001,sY=3704002,tY=3704003,eY=3704004,TZ=4128000,AZ=4128001,PZ=4128002,bG=4615000,QZ=4615001,CZ=4615002,WZ=4615003,GZ=4615004,UZ=4615005,JZ=4615006,$Z=4615007,VZ=4615008,qZ=4615009,YZ=4615010,ZZ=4615011,XZ=4615012,HZ=4615013,KZ=4615014,RZ=4615015,kZ=4615016,jZ=4615017,DZ=4615018,FZ=4615019,MZ=4615020,zZ=4615021,IZ=4615022,SZ=4615023,NZ=4615024,wZ=4615025,lG=4615026,LZ=4615027,EZ=4615028,BZ=4615029,OZ=4615030,xZ=4615031,_Z=4615032,hZ=4615033,mZ=4615034,gZ=4615035,vZ=4615036,yZ=4615037,bZ=4615038,lZ=4615039,pZ=4615040,uZ=4615041,dZ=4615042,rZ=4615043,cZ=4615044,oZ=4615045,nZ=4615046,fZ=4615047,iZ=4615048,aZ=4615049,sZ=4615050,tZ=4615051,eZ=4615052,TX=4615053,AX=4615054,zP=5508000,pG=5508001,uG=5508002,dG=5508003,rG=5508004,cG=5508005,oG=5508006,nG=5508007,fG=5508008,iG=5508009,aG=5508010,PX=5508011,IP=5663000,l2=5663001,SP=5663002,NP=5663003,wP=5663004,sG=5663005,tG=5663006,eG=5663007,TU=5663008,LP=5663009,QX=5663010,CX=5663011,EP=5663012,WX=5663013,GX=5663014,BP=5663015,OP=5663016,AU=5663017,UX=5663018,JX=5663019,PU=5663020,xP=5663021,QU=5663022,CU=7050000,$X=7050001,VX=7050002,qX=7050003,YX=7050004,ZX=7050005,XX=7050006,HX=7050007,KX=7050008,RX=7050009,kX=7050010,jX=7050011,DX=7050012,FX=7050013,MX=7050014,zX=7050015,IX=7050016,SX=7050017,NX=7050018,wX=7050019,LX=7050020,EX=7050021,BX=7050022,OX=7050023,xX=7050024,_X=7050025,hX=7050026,mX=7050027,gX=7050028,vX=7050029,WU=7050030,GU=7050031,yX=7050032,bX=7050033,lX=7050034,UU=7050035,pX=7050036,uX=7618000,dX=7618001,rX=7618002,cX=7618003,p2=8078000,u8=8078001,_P=8078002,hP=8078003,u2=8078004,d2=8078005,r2=8078006,hA=8078007,c2=8078008,o2=8078009,n2=8078010,mA=8078011,qA=8078012,mP=8078013,gP=8078014,f2=8078015,i2=8078016,d8=8078017,a2=8078018,oX=8078019,vP=8078020,yP=8078021,s2=8078022,bP=8078023,nX=8100000,fX=8100001,iX=8100002,aX=8100003,sX=8190000,tX=8190001,eX=8190002,TH=8190003,AH=8190004,PH=9900000,QH=9900001,CH=9900002,lP=9900003,WH=9900004,GH=9900005,UH=9900006;var JH={[HP]:"Account not found at address: $address",[gG]:"Not all accounts were decoded. Encoded accounts found at addresses: $addresses.",[mG]:"Expected decoded account at address: $address",[KP]:"Failed to decode account data at address: $address",[hG]:"Accounts not found at addresses: $addresses",[XP]:"Unable to find a viable program address bump seed.",[nY]:"$putativeAddress is not a base58-encoded address.",[v2]:"Expected base58 encoded address to decode to a byte array of length 32. Actual length: $actualLength.",[qP]:"The `CryptoKey` must be an `Ed25519` public key.",[_G]:"$putativeOffCurveAddress is not a base58-encoded off-curve address.",[b2]:"Invalid seeds; point must fall off the Ed25519 curve.",[BG]:"Expected given program derived address to have the following format: [Address, ProgramDerivedAddressBump].",[YP]:"A maximum of $maxSeeds seeds, including the bump seed, may be supplied when creating an address. Received: $actual.",[ZP]:"The seed at index $index with length $actual exceeds the maximum length of $maxSeedLength bytes.",[OG]:"Expected program derived address bump to be in the range [0, 255], got: $bump.",[xG]:"Program address cannot end with PDA marker.",[y2]:"Expected base58-encoded address string of length in the range [32, 44]. Actual length: $actualLength.",[IG]:"Expected base58-encoded blockash string of length in the range [32, 44]. Actual length: $actualLength.",[VP]:"The network has progressed past the last block for which this transaction could have been committed.",[p2]:"Codec [$codecDescription] cannot decode empty byte arrays.",[s2]:"Enum codec cannot use lexical values [$stringValues] as discriminators. Either remove all lexical values or set `useValuesAsDiscriminators` to `false`.",[vP]:"Sentinel [$hexSentinel] must not be present in encoded bytes [$hexEncodedBytes].",[d2]:"Encoder and decoder must have the same fixed size, got [$encoderFixedSize] and [$decoderFixedSize].",[r2]:"Encoder and decoder must have the same max size, got [$encoderMaxSize] and [$decoderMaxSize].",[u2]:"Encoder and decoder must either both be fixed-size or variable-size.",[c2]:"Enum discriminator out of range. Expected a number in [$formattedValidDiscriminators], got $discriminator.",[_P]:"Expected a fixed-size codec, got a variable-size one.",[mP]:"Codec [$codecDescription] expected a positive byte length, got $bytesLength.",[hP]:"Expected a variable-size codec, got a fixed-size one.",[oX]:"Codec [$codecDescription] expected zero-value [$hexZeroValue] to have the same size as the provided fixed-size item [$expectedSize bytes].",[u8]:"Codec [$codecDescription] expected $expected bytes, got $bytesLength.",[a2]:"Expected byte array constant [$hexConstant] to be present in data [$hexData] at offset [$offset].",[o2]:"Invalid discriminated union variant. Expected one of [$variants], got $value.",[n2]:"Invalid enum variant. Expected one of [$stringValues] or a number in [$formattedNumericalValues], got $variant.",[f2]:"Invalid literal union variant. Expected one of [$variants], got $value.",[hA]:"Expected [$codecDescription] to have $expected items, got $actual.",[qA]:"Invalid value $value for base $base with alphabet $alphabet.",[i2]:"Literal union discriminator out of range. Expected a number between $minRange and $maxRange, got $discriminator.",[mA]:"Codec [$codecDescription] expected number to be in the range [$min, $max], got $value.",[gP]:"Codec [$codecDescription] expected offset to be in the range [0, $bytesLength], got $offset.",[yP]:"Expected sentinel [$hexSentinel] to be present in decoded bytes [$hexDecodedBytes].",[d8]:"Union variant out of range. Expected an index between $minRange and $maxRange, got $variant.",[bP]:"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?",[yG]:"No random values implementation could be found.",[qZ]:"instruction requires an uninitialized account",[SZ]:"instruction tries to borrow reference for an account which is already borrowed",[NZ]:"instruction left account with an outstanding borrowed reference",[zZ]:"program other than the account's owner changed the size of the account data",[UZ]:"account data too small for instruction",[IZ]:"instruction expected an executable account",[nZ]:"An account does not have enough lamports to be rent-exempt",[iZ]:"Program arithmetic overflowed",[oZ]:"Failed to serialize or deserialize account data: $encodedData",[AX]:"Builtin programs must consume compute units",[_Z]:"Cross-program invocation call depth too deep",[bZ]:"Computational budget exceeded",[lG]:"custom program error: #$code",[jZ]:"instruction contains duplicate accounts",[wZ]:"instruction modifications of multiply-passed account differ",[OZ]:"executable accounts must be rent exempt",[EZ]:"instruction changed executable accounts data",[BZ]:"instruction changed the balance of an executable account",[DZ]:"instruction changed executable bit of an account",[KZ]:"instruction modified data of an account it does not own",[HZ]:"instruction spent from the balance of an account it does not own",[QZ]:"generic instruction error",[sZ]:"Provided owner is not allowed",[rZ]:"Account is immutable",[cZ]:"Incorrect authority provided",[$Z]:"incorrect program id for instruction",[JZ]:"insufficient funds for instruction",[GZ]:"invalid account data for instruction",[fZ]:"Invalid account owner",[CZ]:"invalid program argument",[LZ]:"program returned invalid error code",[WZ]:"invalid instruction data",[yZ]:"Failed to reallocate account data",[vZ]:"Provided seeds do not result in a valid address",[tZ]:"Accounts data allocations exceeded the maximum allowed per transaction",[eZ]:"Max accounts exceeded",[TX]:"Max instruction trace length exceeded",[gZ]:"Length of the seed is too long for address generation",[hZ]:"An account required by the instruction is missing",[VZ]:"missing required signature for instruction",[XZ]:"instruction illegally modified the program id of an account",[MZ]:"insufficient account keys for instruction",[lZ]:"Cross-program invocation with unauthorized signer or writable account",[pZ]:"Failed to create program execution environment",[dZ]:"Program failed to compile",[uZ]:"Program failed to complete",[kZ]:"instruction modified data of a read-only account",[RZ]:"instruction changed the balance of a read-only account",[mZ]:"Cross-program invocation reentrancy not allowed for this instruction",[FZ]:"instruction modified rent epoch of an account",[ZZ]:"sum of account balances before and after instruction do not match",[YZ]:"instruction requires an initialized account",[bG]:"",[xZ]:"Unsupported program id",[aZ]:"Unsupported sysvar",[GH]:"Invalid instruction plan kind: $kind.",[rX]:"The provided instruction plan is empty.",[cX]:"The provided transaction plan failed to execute. See the `transactionPlanResult` attribute and the `cause` error for more details.",[uX]:"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).",[UH]:"Invalid transaction plan kind: $kind.",[dX]:"No more instructions to pack; the message packer has completed the instruction plan.",[TZ]:"The instruction does not have any accounts.",[AZ]:"The instruction does not have any data.",[PZ]:"Expected instruction to have progress address $expectedProgramAddress, got $actualProgramAddress.",[SG]:"Expected base58 encoded blockhash to decode to a byte array of length 32. Actual length: $actualLength.",[MG]:"The nonce `$expectedNonceValue` is no longer valid. It has advanced to `$actualNonceValue`",[CH]:"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",[WH]:"Invariant violation: This data publisher does not publish to the channel named `$channelName`. Supported channels include $supportedChannelNames.",[QH]:"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",[PH]:"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",[lP]:"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",[IY]:"JSON-RPC error: Internal JSON-RPC error ($__serverMessage)",[SY]:"JSON-RPC error: Invalid method parameter(s) ($__serverMessage)",[wY]:"JSON-RPC error: The JSON sent is not a valid `Request` object ($__serverMessage)",[NY]:"JSON-RPC error: The method does not exist / is not available ($__serverMessage)",[zY]:"JSON-RPC error: An error occurred on the server while parsing the JSON text ($__serverMessage)",[mY]:"$__serverMessage",[oY]:"$__serverMessage",[dY]:"$__serverMessage",[_Y]:"$__serverMessage",[BY]:"Epoch rewards period still active at slot $slot",[vY]:"$__serverMessage",[yY]:"$__serverMessage",[LY]:"Failed to query long-term storage; please try again",[OY]:"Minimum context slot has not been reached",[uY]:"Node is unhealthy; behind by $numSlotsBehind slots",[bY]:"No snapshot",[cY]:"Transaction simulation failed",[EY]:"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",[lY]:"$__serverMessage",[gY]:"Transaction history is not available from this node",[pY]:"$__serverMessage",[hY]:"Transaction signature length mismatch",[rY]:"Transaction signature verification failure",[xY]:"$__serverMessage",[iY]:"Key pair bytes must be of length 64, got $byteLength.",[aY]:"Expected private key bytes with length 32. Actual length: $actualLength.",[sY]:"Expected base58-encoded signature to decode to a byte array of length 64. Actual length: $actualLength.",[eY]:"The provided private key does not match the provided public key.",[tY]:"Expected base58-encoded signature string of length in the range [64, 88]. Actual length: $actualLength.",[NG]:"Lamports value must be in the range [0, 2e64-1]",[wG]:"`$value` cannot be parsed as a `BigInt`",[MY]:"$message",[LG]:"`$value` cannot be parsed as a `Number`",[zG]:"No nonce account could be found at address `$nonceAccountAddress`",[sX]:"The notification name must end in 'Notifications' and the API must supply a subscription plan creator function for the notification '$notificationName'.",[eX]:"WebSocket was closed before payload could be added to the send buffer",[TH]:"WebSocket connection closed",[AH]:"WebSocket failed to connect",[tX]:"Failed to obtain a subscription id from the server",[aX]:"Could not find an API plan for RPC method: `$method`",[nX]:"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`.",[iX]:"HTTP error ($statusCode): $message",[fX]:"HTTP header(s) forbidden: $headers. Learn more at https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name.",[zP]:"Multiple distinct signers were identified for address `$address`. Please ensure that you are using the same signer instance for each address.",[pG]:"The provided value does not implement the `KeyPairSigner` interface",[dG]:"The provided value does not implement the `MessageModifyingSigner` interface",[rG]:"The provided value does not implement the `MessagePartialSigner` interface",[uG]:"The provided value does not implement any of the `MessageSigner` interfaces",[oG]:"The provided value does not implement the `TransactionModifyingSigner` interface",[nG]:"The provided value does not implement the `TransactionPartialSigner` interface",[fG]:"The provided value does not implement the `TransactionSendingSigner` interface",[cG]:"The provided value does not implement any of the `TransactionSigner` interfaces",[iG]:"More than one `TransactionSendingSigner` was identified.",[aG]:"No `TransactionSendingSigner` was identified. Please provide a valid `TransactionWithSingleSendingSigner` transaction.",[PX]:"Wallet account signers do not support signing multiple messages/transactions in a single operation",[fY]:"Cannot export a non-extractable key.",[kP]:"No digest implementation could be found.",[RP]:"Cryptographic operations are only allowed in secure browser contexts. Read more here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts.",[jP]:`This runtime does not support the generation of Ed25519 key pairs.
|
|
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.
|
|
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.`,[DP]:"No signature verification implementation could be found.",[FP]:"No key generation implementation could be found.",[MP]:"No signing implementation could be found.",[vG]:"No key export implementation could be found.",[EG]:"Timestamp value must be in the range [-(2n ** 63n), (2n ** 63n) - 1]. `$value` given",[IX]:"Transaction processing left an account with an outstanding borrowed reference",[$X]:"Account in use",[VX]:"Account loaded twice",[qX]:"Attempt to debit an account but found no record of a prior credit.",[OX]:"Transaction loads an address table account that doesn't exist",[HX]:"This transaction has already been processed",[KX]:"Blockhash not found",[RX]:"Loader call chain is too deep",[zX]:"Transactions are currently disabled due to cluster maintenance",[WU]:"Transaction contains a duplicate instruction ($index) that is not allowed",[ZX]:"Insufficient funds for fee",[GU]:"Transaction results in an account ($accountIndex) with insufficient funds for rent",[XX]:"This account may not be used to pay transaction fees",[jX]:"Transaction contains an invalid account reference",[_X]:"Transaction loads an address table account with invalid data",[hX]:"Transaction address table lookup uses an invalid index",[xX]:"Transaction loads an address table account with an invalid owner",[bX]:"LoadedAccountsDataSizeLimit set for transaction must be greater than 0.",[FX]:"This program may not be used for executing instructions",[mX]:"Transaction leaves an account with a lower balance than rent-exempt minimum",[wX]:"Transaction loads a writable account that cannot be written",[yX]:"Transaction exceeded max loaded accounts data size cap",[kX]:"Transaction requires a fee but has no signature present",[YX]:"Attempt to load a program that does not exist",[UU]:"Execution of the program referenced by account at index $accountIndex is temporarily restricted.",[lX]:"ResanitizationNeeded",[MX]:"Transaction failed to sanitize accounts offsets correctly",[DX]:"Transaction did not pass signature verification",[BX]:"Transaction locked too many accounts",[pX]:"Sum of account balances before and after transaction do not match",[CU]:"The transaction failed with the error `$errorName`",[NX]:"Transaction version is unsupported",[EX]:"Transaction would exceed account data limit within the block",[vX]:"Transaction would exceed total account data limit",[LX]:"Transaction would exceed max account limit within the block",[SX]:"Transaction would exceed max Block Cost Limit",[gX]:"Transaction would exceed max Vote Cost Limit",[BP]:"Attempted to sign a transaction with an address that is not a signer for it",[QX]:"Transaction is missing an address at index: $index.",[OP]:"Transaction has no expected signers therefore it cannot be encoded",[PU]:"Transaction size $transactionSize exceeds limit of $transactionSizeLimit bytes",[SP]:"Transaction does not have a blockhash lifetime",[NP]:"Transaction is not a durable nonce transaction",[sG]:"Contents of these address lookup tables unknown: $lookupTableAddresses",[tG]:"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",[TU]:"No fee payer set in CompiledTransaction",[eG]:"Could not find program address at index $index",[UX]:"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",[JX]:"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",[CX]:"Transaction is missing a fee payer.",[EP]:"Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer.",[GX]:"Transaction first instruction is not advance nonce account instruction.",[WX]:"Transaction with no instructions cannot be durable nonce transaction.",[IP]:"This transaction includes an address (`$programAddress`) which is both invoked and set as the fee payer. Program addresses may not pay fees",[l2]:"This transaction includes an address (`$programAddress`) which is both invoked and marked writable. Program addresses may not be writable",[AU]:"The transaction message expected the transaction to have $numRequiredSignatures signatures, got $signaturesLength.",[LP]:"Transaction is missing signatures for addresses: $addresses.",[wP]:"Transaction version must be in the range [0, 127]. `$actualVersion` given",[xP]:"This version of Kit does not support decoding transactions with version $unsupportedVersion. The current max supported version is 0.",[QU]:"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."},b0="i",j0="t";function $H(T,A={}){let P=JH[T];if(P.length===0)return"";let Q;function C(G){if(Q[j0]===2){let J=P.slice(Q[b0]+1,G);W.push(J in A?`${A[J]}`:`$${J}`)}else if(Q[j0]===1)W.push(P.slice(Q[b0],G))}let W=[];return P.split("").forEach((G,J)=>{if(J===0){Q={[b0]:0,[j0]:P[0]==="\\"?0:P[0]==="$"?2:1};return}let $;switch(Q[j0]){case 0:$={[b0]:J,[j0]:1};break;case 1:if(G==="\\")$={[b0]:J,[j0]:0};else if(G==="$")$={[b0]:J,[j0]:2};break;case 2:if(G==="\\")$={[b0]:J,[j0]:0};else if(G==="$")$={[b0]:J,[j0]:2};else if(!G.match(/\w/))$={[b0]:J,[j0]:1};break}if($){if(Q!==$)C(J);Q=$}}),C(),W.join("")}function VH(T,A={}){return $H(T,A)}function pP(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 P,Q;if(A)Object.entries(Object.getOwnPropertyDescriptors(A)).forEach(([W,G])=>{if(W==="cause")Q={cause:G.value};else{if(P===void 0)P={};Object.defineProperty(P,W,G)}});let C=VH(T,P);super(C,Q);this.context=P===void 0?{}:P,this.context.__code=T,this.name="SolanaError"}};function qH(...T){if("captureStackTrace"in Error&&typeof Error.captureStackTrace==="function")Error.captureStackTrace(...T)}function JU({errorCodeBaseOffset:T,getErrorContext:A,orderedErrorNames:P,rpcEnumError:Q},C){let W,G;if(typeof Q==="string")W=Q;else W=Object.keys(Q)[0],G=Q[W];let J=P.indexOf(W),$=T+J,X=A($,W,G),Z=new e($,X);return qH(Z,C),Z}var YH=["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 $U(T,A){let P=Number(T);return JU({errorCodeBaseOffset:4615001,getErrorContext(Q,C,W){if(Q===bG)return{errorName:C,index:P,...W!==void 0?{instructionErrorContext:W}:null};else if(Q===lG)return{code:Number(W),index:P};return{index:P}},orderedErrorNames:YH,rpcEnumError:A},$U)}var ZH=["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 t2(T){if(typeof T==="object"&&"InstructionError"in T)return $U(...T.InstructionError);return JU({errorCodeBaseOffset:7050001,getErrorContext(A,P,Q){if(A===CU)return{errorName:P,...Q!==void 0?{transactionErrorContext:Q}:null};else if(A===WU)return{index:Number(Q)};else if(A===GU||A===UU)return{accountIndex:Number(Q.account_index)}},orderedErrorNames:ZH,rpcEnumError:T},t2)}function XH(T,A){return"fixedSize"in A?A.fixedSize:A.getSizeFromValue(T)}function VU(T){return Object.freeze({...T,encode:(A)=>{let P=new Uint8Array(XH(A,T));return T.write(A,P,0),P}})}var qU="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",YU=()=>{return VU({getSizeFromValue:(T)=>{try{return atob(T).length}catch{throw new e(qA,{alphabet:qU,base:64,value:T})}},write(T,A,P){try{let Q=atob(T).split("").map((C)=>C.charCodeAt(0));return A.set(Q,P),Q.length+P}catch{throw new e(qA,{alphabet:qU,base:64,value:T})}}})};var{TextDecoder:ES,TextEncoder:BS}=globalThis;function e2(T,A){try{if("exists"in T&&!T.exists)return T;return Object.freeze({...T,data:A.decode(T.data)})}catch{throw new e(KP,{address:T.address})}}function HH(T,A){if(!A)return Object.freeze({address:T,exists:!1});let P=YU().encode(A.data[0]);return Object.freeze({...KH(A),address:T,data:P,exists:!0})}function KH(T){return Object.freeze({executable:T.executable,lamports:T.lamports,programAddress:T.owner,space:T.space})}async function T6(T,A,P={}){let{abortSignal:Q,...C}=P,W=await T.getAccountInfo(A,{...C,encoding:"base64"}).send({abortSignal:Q});return HH(A,W.value)}function A6(T){if(!T.exists)throw new e(HP,{address:T.address})}function RH(T,A){if(T.length>=A)return T;let P=new Uint8Array(A).fill(0);return P.set(T),P}var kH=(T,A)=>RH(T.length<=A?T:T.slice(0,A),A);function jH(T,A){return"fixedSize"in A?A.fixedSize:A.getSizeFromValue(T)}function P6(T){return Object.freeze({...T,encode:(A)=>{let P=new Uint8Array(jH(A,T));return T.write(A,P,0),P}})}function uP(T){return Object.freeze({...T,decode:(A,P=0)=>T.read(A,P)[0]})}function YA(T){return"fixedSize"in T&&typeof T.fixedSize==="number"}function DH(T){return!YA(T)}function dP(T,A){if(YA(T)!==YA(A))throw new e(u2);if(YA(T)&&YA(A)&&T.fixedSize!==A.fixedSize)throw new e(d2,{decoderFixedSize:A.fixedSize,encoderFixedSize:T.fixedSize});if(!YA(T)&&!YA(A)&&T.maxSize!==A.maxSize)throw new e(r2,{decoderMaxSize:A.maxSize,encoderMaxSize:T.maxSize});return{...A,...T,decode:A.decode,encode:T.encode,read:A.read,write:T.write}}function FH(T,A,P,Q=0){let C=P.length-Q;if(C<A)throw new e(u8,{bytesLength:C,codecDescription:T,expected:A})}function ZU(T,A){return P6({fixedSize:A,write:(P,Q,C)=>{let W=T.encode(P),G=W.length>A?W.slice(0,A):W;return Q.set(G,C),C+A}})}function XU(T,A){return uP({fixedSize:A,read:(P,Q)=>{if(FH("fixCodecSize",A,P,Q),Q>0||P.length>A)P=P.slice(Q,Q+A);if(YA(T))P=kH(P,T.fixedSize);let[C]=T.read(P,0);return[C,Q+A]}})}function HU(T,A){return P6({...DH(T)?{...T,getSizeFromValue:(P)=>T.getSizeFromValue(A(P))}:T,write:(P,Q,C)=>T.write(A(P),Q,C)})}function MH(T,A,P=A){if(!A.match(new RegExp(`^[${T}]*$`)))throw new e(qA,{alphabet:T,base:T.length,value:P})}var zH=(T)=>{return P6({getSizeFromValue:(A)=>{let[P,Q]=KU(A,T[0]);if(!Q)return A.length;let C=RU(Q,T);return P.length+Math.ceil(C.toString(16).length/2)},write(A,P,Q){if(MH(T,A),A==="")return Q;let[C,W]=KU(A,T[0]);if(!W)return P.set(new Uint8Array(C.length).fill(0),Q),Q+C.length;let G=RU(W,T),J=[];while(G>0n)J.unshift(Number(G%256n)),G/=256n;let $=[...Array(C.length).fill(0),...J];return P.set($,Q),Q+$.length}})},IH=(T)=>{return uP({read(A,P){let Q=P===0?A:A.slice(P);if(Q.length===0)return["",0];let C=Q.findIndex(($)=>$!==0);C=C===-1?Q.length:C;let W=T[0].repeat(C);if(C===Q.length)return[W,A.length];let G=Q.slice(C).reduce(($,X)=>$*256n+BigInt(X),0n),J=SH(G,T);return[W+J,A.length]}})};function KU(T,A){let[P,Q]=T.split(new RegExp(`((?!${A}).*)`));return[P,Q]}function RU(T,A){let P=BigInt(A.length),Q=0n;for(let C of T)Q*=P,Q+=BigInt(A.indexOf(C));return Q}function SH(T,A){let P=BigInt(A.length),Q=[];while(T>0n)Q.unshift(A[Number(T%P)]),T/=P;return Q.join("")}var kU="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",jU=()=>zH(kU),DU=()=>IH(kU);var{TextDecoder:lS,TextEncoder:pS}=globalThis;function Q6(){if(!globalThis.isSecureContext)throw new e(RP)}var gA;async function NH(T){if(gA===void 0)gA=new Promise((A)=>{T.generateKey("Ed25519",!1,["sign","verify"]).then(()=>{A(gA=!0)}).catch(()=>{A(gA=!1)})});if(typeof gA==="boolean")return gA;else return await gA}function FU(){if(Q6(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.digest!=="function")throw new e(kP)}async function MU(){if(Q6(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.generateKey!=="function")throw new e(FP);if(!await NH(globalThis.crypto.subtle))throw new e(jP)}function rP(){if(Q6(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.exportKey!=="function")throw new e(DP)}function zU(){if(Q6(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.sign!=="function")throw new e(MP)}var cP,oP;function nP(){if(!cP)cP=jU();return cP}function wH(){if(!oP)oP=DU();return oP}function C6(T){if(T.length<32||T.length>44)return!1;let A=nP();try{return A.encode(T).byteLength===32}catch{return!1}}function fP(T){if(T.length<32||T.length>44)throw new e(y2,{actualLength:T.length});let Q=nP().encode(T).byteLength;if(Q!==32)throw new e(v2,{actualLength:Q})}function b(T){return fP(T),T}function HT(){return HU(ZU(nP(),32),(T)=>b(T))}function F0(){return XU(wH(),32)}function LH(){return dP(HT(),F0())}function W6(){return new Intl.Collator("en",{caseFirst:"lower",ignorePunctuation:!1,localeMatcher:"best fit",numeric:!1,sensitivity:"variant",usage:"sort"}).compare}var EH=37095705934669439343138083508754565189542113879843219016388785533085940283555n,BT=57896044618658097711785492504343953926634992332820282019728792003956564819949n,IU=19681161376707505956807079304988542015446066515923890162744021073123829784752n;function P0(T){let A=T%BT;return A>=0n?A:BT+A}function D0(T,A){let P=T;while(A-- >0n)P*=P,P%=BT;return P}function BH(T){let P=T*T%BT*T%BT,Q=D0(P,2n)*P%BT,C=D0(Q,1n)*T%BT,W=D0(C,5n)*C%BT,G=D0(W,10n)*W%BT,J=D0(G,20n)*G%BT,$=D0(J,40n)*J%BT,X=D0($,80n)*$%BT,Z=D0(X,80n)*$%BT,R=D0(Z,10n)*W%BT;return D0(R,2n)*T%BT}function OH(T,A){let P=P0(A*A*A),Q=P0(P*P*A),C=BH(T*Q),W=P0(T*P*C),G=P0(A*W*W),J=W,$=P0(W*IU),X=G===T,Z=G===P0(-T),R=G===P0(-T*IU);if(X)W=J;if(Z||R)W=$;if((P0(W)&1n)===1n)W=P0(-W);if(!X&&!Z)return null;return W}function xH(T,A){let P=P0(T*T),Q=P0(P-1n),C=P0(EH*P+1n),W=OH(Q,C);if(W===null)return!1;let G=(A&128)!==0;if(W===0n&&G)return!1;return!0}function _H(T){let A=T.toString(16);if(A.length===1)return`0${A}`;else return A}function hH(T){let P=`0x${T.reduce((Q,C,W)=>`${_H(W===31?C&-129:C)}${Q}`,"")}`;return BigInt(P)}function mH(T){if(T.byteLength!==32)return!1;let A=hH(T);return xH(A,T[31])}var SU=32,NU=16,gH=[80,114,111,103,114,97,109,68,101,114,105,118,101,100,65,100,100,114,101,115,115];async function vH({programAddress:T,seeds:A}){if(FU(),A.length>NU)throw new e(YP,{actual:A.length,maxSeeds:NU});let P,Q=A.reduce(($,X,Z)=>{let R=typeof X==="string"?(P||=new TextEncoder).encode(X):X;if(R.byteLength>SU)throw new e(ZP,{actual:R.byteLength,index:Z,maxSeedLength:SU});return $.push(...R),$},[]),C=LH(),W=C.encode(T),G=await crypto.subtle.digest("SHA-256",new Uint8Array([...Q,...W,...gH])),J=new Uint8Array(G);if(mH(J))throw new e(b2);return C.decode(J)}async function j1({programAddress:T,seeds:A}){let P=255;while(P>0)try{return[await vH({programAddress:T,seeds:[...A,new Uint8Array([P])]}),P]}catch(Q){if(pP(Q,b2))P--;else throw Q}throw new e(XP)}async function G6(T){if(rP(),T.type!=="public"||T.algorithm.name!=="Ed25519")throw new e(qP);let A=await crypto.subtle.exportKey("raw",T);return F0().decode(new Uint8Array(A))}function yH(T,A){if(T.length>=A)return T;let P=new Uint8Array(A).fill(0);return P.set(T),P}var bH=(T,A)=>yH(T.length<=A?T:T.slice(0,A),A);function V8(T,A){return"fixedSize"in A?A.fixedSize:A.getSizeFromValue(T)}function Q0(T){return Object.freeze({...T,encode:(A)=>{let P=new Uint8Array(V8(A,T));return T.write(A,P,0),P}})}function p0(T){return Object.freeze({...T,decode:(A,P=0)=>T.read(A,P)[0]})}function l0(T){return"fixedSize"in T&&typeof T.fixedSize==="number"}function lH(T){return!l0(T)}function wU(T,A,P=0){if(A.length-P<=0)throw new e(p2,{codecDescription:T})}function U6(T,A,P,Q=0){let C=P.length-Q;if(C<A)throw new e(u8,{bytesLength:C,codecDescription:T,expected:A})}function J6(T,A){let P=(G,J,$)=>{let X=T.encode(G);return $=A.write(X.length,J,$),J.set(X,$),$+X.length};if(l0(A)&&l0(T))return Q0({...T,fixedSize:A.fixedSize+T.fixedSize,write:P});let Q=l0(A)?A.fixedSize:A.maxSize??null,C=l0(T)?T.fixedSize:T.maxSize??null,W=Q!==null&&C!==null?Q+C:null;return Q0({...T,...W!==null?{maxSize:W}:{},getSizeFromValue:(G)=>{let J=V8(G,T);return V8(J,A)+J},write:P})}function iT(T,A){return Q0({fixedSize:A,write:(P,Q,C)=>{let W=T.encode(P),G=W.length>A?W.slice(0,A):W;return Q.set(G,C),C+A}})}function M0(T,A){return p0({fixedSize:A,read:(P,Q)=>{if(U6("fixCodecSize",A,P,Q),Q>0||P.length>A)P=P.slice(Q,Q+A);if(l0(T))P=bH(P,T.fixedSize);let[C]=T.read(P,0);return[C,Q+A]}})}function lT(T,A){return Q0({...lH(T)?{...T,getSizeFromValue:(P)=>T.getSizeFromValue(A(P))}:T,write:(P,Q,C)=>T.write(A(P),Q,C)})}function LU(T,A){return p0({...T,read:(P,Q)=>{let[C,W]=T.read(P,Q);return[A(C,P,Q),W]}})}function pH(T,A,P,Q){if(Q<A||Q>P)throw new e(mA,{codecDescription:T,max:P,min:A,value:Q})}function EU(T){return T?.endian===1?!1:!0}function iP(T){return Q0({fixedSize:T.size,write(A,P,Q){if(T.range)pH(T.name,T.range[0],T.range[1],A);let C=new ArrayBuffer(T.size);return T.set(new DataView(C),A,EU(T.config)),P.set(new Uint8Array(C),Q),Q+T.size}})}function $6(T){return p0({fixedSize:T.size,read(A,P=0){wU(T.name,A,P),U6(T.name,T.size,A,P);let Q=new DataView(uH(A,P,T.size));return[T.get(Q,EU(T.config)),P+T.size]}})}function uH(T,A,P){let Q=T.byteOffset+(A??0),C=P??T.byteLength;return T.buffer.slice(Q,Q+C)}var BU=(T={})=>$6({config:T,get:(A,P)=>{let Q=P?8:0,C=P?0:8,W=A.getBigUint64(Q,P),G=A.getBigUint64(C,P);return(W<<64n)+G},name:"u128",size:16});var r8=(T={})=>iP({config:T,name:"u32",range:[0,Number("0xffffffff")],set:(A,P,Q)=>A.setUint32(0,Number(P),Q),size:4}),aP=(T={})=>$6({config:T,get:(A,P)=>A.getUint32(0,P),name:"u32",size:4});var DT=(T={})=>iP({config:T,name:"u64",range:[0n,BigInt("0xffffffffffffffff")],set:(A,P,Q)=>A.setBigUint64(0,BigInt(P),Q),size:8}),pT=(T={})=>$6({config:T,get:(A,P)=>A.getBigUint64(0,P),name:"u64",size:8});var sP=()=>iP({name:"u8",range:[0,Number("0xff")],set:(T,A)=>T.setUint8(0,Number(A)),size:1}),V6=()=>$6({get:(T)=>T.getUint8(0),name:"u8",size:1});function dH(T,A,P){if(A!==P)throw new e(hA,{actual:P,codecDescription:T,expected:A})}function q8(T){return T.reduce((A,P)=>A===null||P===null?null:A+P,0)}function q6(T){return l0(T)?T.fixedSize:null}function Y6(T){return l0(T)?T.fixedSize:T.maxSize??null}function xU(T,A={}){let P=A.size??aP(),Q=q6(T),C=OU(P,Q),W=OU(P,Y6(T))??void 0;return p0({...C!==null?{fixedSize:C}:{maxSize:W},read:(G,J)=>{let $=[];if(typeof P==="object"&&G.slice(J).length===0)return[$,J];if(P==="remainder"){while(J<G.length){let[R,D]=T.read(G,J);J=D,$.push(R)}return[$,J]}let[X,Z]=typeof P==="number"?[P,J]:P.read(G,J);J=Z;for(let R=0;R<X;R+=1){let[D,z]=T.read(G,J);J=z,$.push(D)}return[$,J]}})}function OU(T,A){if(typeof T!=="number")return null;if(T===0)return 0;return A===null?null:A*T}function tP(T={}){return lT(T.size??sP(),(A)=>A?1:0)}function eP(T={}){return LU(T.size??V6(),(A)=>Number(A)===1)}function W0(){return Q0({getSizeFromValue:(T)=>T.length,write:(T,A,P)=>{return A.set(T,P),P+T.length}})}function u0(){return p0({read:(T,A)=>{let P=T.slice(A);return[P,A+P.length]}})}function _U(T){let A=q8(T.map(q6)),P=q8(T.map(Y6))??void 0;return Q0({...A===null?{getSizeFromValue:(Q)=>T.map((C,W)=>V8(Q[W],C)).reduce((C,W)=>C+W,0),maxSize:P}:{fixedSize:A},write:(Q,C,W)=>{return dH("tuple",T.length,Q.length),T.forEach((G,J)=>{W=G.write(Q[J],C,W)}),W}})}function uT(T){let A=T.map(([,C])=>C),P=q8(A.map(q6)),Q=q8(A.map(Y6))??void 0;return Q0({...P===null?{getSizeFromValue:(C)=>T.map(([W,G])=>V8(C[W],G)).reduce((W,G)=>W+G,0),maxSize:Q}:{fixedSize:P},write:(C,W,G)=>{return T.forEach(([J,$])=>{G=$.write(C[J],W,G)}),G}})}function aT(T){let A=T.map(([,C])=>C),P=q8(A.map(q6)),Q=q8(A.map(Y6))??void 0;return p0({...P===null?{maxSize:Q}:{fixedSize:P},read:(C,W)=>{let G={};return T.forEach(([J,$])=>{let[X,Z]=$.read(C,W);W=Z,G[J]=X}),[G,W]}})}var{TextDecoder:JN,TextEncoder:hU}=globalThis,Z6=()=>{let T;return Q0({getSizeFromValue:(A)=>(T||=new hU).encode(A).length,write:(A,P,Q)=>{let C=(T||=new hU).encode(A);return P.set(C,Q),Q+C.length}})};var X1=((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})(X1||{}),rH=2,cH=1;function d0(T){return T>=2}function Y8(T){return(T&cH)!==0}function TQ(T,A){return T|A}function X6(T){return T|rH}function gU(T){return C6(T)}function mU(T){switch(T){case"finalized":return 2;case"confirmed":return 1;case"processed":return 0;default:throw new e(lP,{unexpectedValue:T})}}function H6(T,A){if(T===A)return 0;return mU(T)<mU(A)?-1:1}var ZN=-9223372036854775808n;function ZA(T,A){return"fixedSize"in A?A.fixedSize:A.getSizeFromValue(T)}function qT(T){return Object.freeze({...T,encode:(A)=>{let P=new Uint8Array(ZA(A,T));return T.write(A,P,0),P}})}function z0(T){return"fixedSize"in T&&typeof T.fixedSize==="number"}function oH(T){return!z0(T)}function vU(T,A){let P=(G,J,$)=>{let X=T.encode(G);return $=A.write(X.length,J,$),J.set(X,$),$+X.length};if(z0(A)&&z0(T))return qT({...T,fixedSize:A.fixedSize+T.fixedSize,write:P});let Q=z0(A)?A.fixedSize:A.maxSize??null,C=z0(T)?T.fixedSize:T.maxSize??null,W=Q!==null&&C!==null?Q+C:null;return qT({...T,...W!==null?{maxSize:W}:{},getSizeFromValue:(G)=>{let J=ZA(G,T);return ZA(J,A)+J},write:P})}function AQ(T,A){return qT({fixedSize:A,write:(P,Q,C)=>{let W=T.encode(P),G=W.length>A?W.slice(0,A):W;return Q.set(G,C),C+A}})}function K6(T,A){return qT({...oH(T)?{...T,getSizeFromValue:(P)=>T.getSizeFromValue(A(P))}:T,write:(P,Q,C)=>T.write(A(P),Q,C)})}function lU(T,A,P,Q){if(Q<A||Q>P)throw new e(mA,{codecDescription:T,max:P,min:A,value:Q})}function fH(T){return T?.endian===1?!1:!0}function pU(T){return qT({fixedSize:T.size,write(A,P,Q){if(T.range)lU(T.name,T.range[0],T.range[1],A);let C=new ArrayBuffer(T.size);return T.set(new DataView(C),A,fH(T.config)),P.set(new Uint8Array(C),Q),Q+T.size}})}var vA=()=>qT({getSizeFromValue:(T)=>{if(T<=127)return 1;if(T<=16383)return 2;return 3},maxSize:3,write:(T,A,P)=>{lU("shortU16",0,65535,T);let Q=[0];for(let C=0;;C+=1){let W=Number(T)>>C*7;if(W===0)break;let G=127&W;if(Q[C]=G,C>0)Q[C-1]|=128}return A.set(Q,P),P+Q.length}});var uU=(T={})=>pU({config:T,name:"u32",range:[0,Number("0xffffffff")],set:(A,P,Q)=>A.setUint32(0,Number(P),Q),size:4});var Z8=()=>pU({name:"u8",range:[0,Number("0xff")],set:(T,A)=>T.setUint8(0,Number(A)),size:1});function tH(T,A,P){if(A!==P)throw new e(hA,{actual:P,codecDescription:T,expected:A})}function eH(T){return T.reduce((A,P)=>A===null||P===null?null:Math.max(A,P),0)}function dU(T){return T.reduce((A,P)=>A===null||P===null?null:A+P,0)}function oU(T){return z0(T)?T.fixedSize:null}function PQ(T){return z0(T)?T.fixedSize:T.maxSize??null}function X8(T,A={}){let P=A.size??uU(),Q=rU(P,oU(T)),C=rU(P,PQ(T))??void 0;return qT({...Q!==null?{fixedSize:Q}:{getSizeFromValue:(W)=>{return(typeof P==="object"?ZA(W.length,P):0)+[...W].reduce((J,$)=>J+ZA($,T),0)},maxSize:C},write:(W,G,J)=>{if(typeof P==="number")tH("array",P,W.length);if(typeof P==="object")J=P.write(W.length,G,J);return W.forEach(($)=>{J=T.write($,G,J)}),J}})}function rU(T,A){if(typeof T!=="number")return null;if(T===0)return 0;return A===null?null:A*T}function nU(){return qT({getSizeFromValue:(T)=>T.length,write:(T,A,P)=>{return A.set(T,P),P+T.length}})}function fU(T){return qT({fixedSize:T.length,write:(A,P,Q)=>{return P.set(T,Q),Q+T.length}})}function iU(T,A){let P=TK(T),Q=(W,G,J)=>{let $=A(W);return cU(T,$),T[$].write(W,G,J)};if(P!==null)return qT({fixedSize:P,write:Q});let C=AK(T);return qT({...C!==null?{maxSize:C}:{},getSizeFromValue:(W)=>{let G=A(W);return cU(T,G),ZA(W,T[G])},write:Q})}function cU(T,A){if(typeof T[A]>"u")throw new e(d8,{maxRange:T.length-1,minRange:0,variant:A})}function TK(T){if(T.length===0)return 0;if(!z0(T[0]))return null;let A=T[0].fixedSize;return T.every((Q)=>z0(Q)&&Q.fixedSize===A)?A:null}function AK(T){return eH(T.map((A)=>PQ(A)))}function H8(T){let A=T.map(([,C])=>C),P=dU(A.map(oU)),Q=dU(A.map(PQ))??void 0;return qT({...P===null?{getSizeFromValue:(C)=>T.map(([W,G])=>ZA(C[W],G)).reduce((W,G)=>W+G,0),maxSize:Q}:{fixedSize:P},write:(C,W,G)=>{return T.forEach(([J,$])=>{G=$.write(C[J],W,G)}),G}})}function AJ(T){return"lifetimeConstraint"in T&&typeof T.lifetimeConstraint.blockhash==="string"&&typeof T.lifetimeConstraint.lastValidBlockHeight==="bigint"&&gU(T.lifetimeConstraint.blockhash)}function PJ(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 PK(T,A,P=A){if(!A.match(new RegExp(`^[${T}]*$`)))throw new e(qA,{alphabet:T,base:T.length,value:P})}var QK=(T)=>{return qT({getSizeFromValue:(A)=>{let[P,Q]=aU(A,T[0]);if(!Q)return A.length;let C=sU(Q,T);return P.length+Math.ceil(C.toString(16).length/2)},write(A,P,Q){if(PK(T,A),A==="")return Q;let[C,W]=aU(A,T[0]);if(!W)return P.set(new Uint8Array(C.length).fill(0),Q),Q+C.length;let G=sU(W,T),J=[];while(G>0n)J.unshift(Number(G%256n)),G/=256n;let $=[...Array(C.length).fill(0),...J];return P.set($,Q),Q+$.length}})};function aU(T,A){let[P,Q]=T.split(new RegExp(`((?!${A}).*)`));return[P,Q]}function sU(T,A){let P=BigInt(A.length),Q=0n;for(let C of T)Q*=P,Q+=BigInt(A.indexOf(C));return Q}var CK="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",WK=()=>QK(CK);var QQ;function GK(){if(!QQ){let T=X8(Z8(),{size:vA()});QQ=H8([["lookupTableAddress",HT()],["writableIndexes",T],["readonlyIndexes",T]])}return QQ}var CQ;function WQ(){if(!CQ)CQ=Z8();return CQ}function UK(){return H8([["numSignerAccounts",WQ()],["numReadonlySignerAccounts",WQ()],["numReadonlyNonSignerAccounts",WQ()]])}var GQ;function JK(){if(!GQ)GQ=K6(H8([["programAddressIndex",Z8()],["accountIndices",X8(Z8(),{size:vA()})],["data",vU(nU(),vA())]]),(T)=>{if(T.accountIndices!==void 0&&T.data!==void 0)return T;return{...T,accountIndices:T.accountIndices??[],data:T.data??new Uint8Array(0)}});return GQ}var $K=0,VK=128;function qK(){return qT({getSizeFromValue:(T)=>T==="legacy"?0:1,maxSize:1,write:(T,A,P)=>{if(T==="legacy")return P;if(T<0||T>127)throw new e(wP,{actualVersion:T});if(T>$K)throw new e(xP,{unsupportedVersion:T});return A.set([T|VK],P),P+1}})}function tU(){return H8(QJ())}function eU(){return K6(H8([...QJ(),["addressTableLookups",YK()]]),(T)=>{if(T.version==="legacy")return T;return{...T,addressTableLookups:T.addressTableLookups??[]}})}function QJ(){let T=iU([fU(new Uint8Array(32)),AQ(WK(),32)],(A)=>A===void 0?0:1);return[["version",qK()],["header",UK()],["staticAccounts",X8(HT(),{size:vA()})],["lifetimeToken",T],["instructions",X8(JK(),{size:vA()})]]}function YK(){return X8(GK(),{size:vA()})}function CJ(){return qT({getSizeFromValue:(T)=>{if(T.version==="legacy")return tU().getSizeFromValue(T);else return eU().getSizeFromValue(T)},write:(T,A,P)=>{if(T.version==="legacy")return tU().write(T,A,P);else return eU().write(T,A,P)}})}function TJ(T,A,P){T[A]=P(T[A]??{role:X1.READONLY})}var GT=Symbol("AddressMapTypeProperty");function ZK(T,A){let P={[T]:{[GT]:0,role:X1.WRITABLE_SIGNER}},Q=new Set;for(let C of A){TJ(P,C.programAddress,(G)=>{if(Q.add(C.programAddress),GT in G){if(Y8(G.role))switch(G[GT]){case 0:throw new e(IP,{programAddress:C.programAddress});default:throw new e(l2,{programAddress:C.programAddress})}if(G[GT]===2)return G}return{[GT]:2,role:X1.READONLY}});let W;if(!C.accounts)continue;for(let G of C.accounts)TJ(P,G.address,(J)=>{let{address:$,...X}=G;if(GT in J)switch(J[GT]){case 0:return J;case 1:{let Z=TQ(J.role,X.role);if("lookupTableAddress"in X){if(J.lookupTableAddress!==X.lookupTableAddress&&(W||=W6())(X.lookupTableAddress,J.lookupTableAddress)<0)return{[GT]:1,...X,role:Z}}else if(d0(X.role))return{[GT]:2,role:Z};if(J.role!==Z)return{...J,role:Z};else return J}case 2:{let Z=TQ(J.role,X.role);if(Q.has(G.address)){if(Y8(X.role))throw new e(l2,{programAddress:G.address});if(J.role!==Z)return{...J,role:Z};else return J}else if("lookupTableAddress"in X&&!d0(J.role))return{...X,[GT]:1,role:Z};else if(J.role!==Z)return{...J,role:Z};else return J}}if("lookupTableAddress"in X)return{...X,[GT]:1};else return{...X,[GT]:2}})}return P}function XK(T){let A;return Object.entries(T).sort(([Q,C],[W,G])=>{if(C[GT]!==G[GT]){if(C[GT]===0)return-1;else if(G[GT]===0)return 1;else if(C[GT]===2)return-1;else if(G[GT]===2)return 1}let J=d0(C.role);if(J!==d0(G.role))return J?-1:1;let $=Y8(C.role);if($!==Y8(G.role))return $?-1:1;if(A||=W6(),C[GT]===1&&G[GT]===1&&C.lookupTableAddress!==G.lookupTableAddress)return A(C.lookupTableAddress,G.lookupTableAddress);else return A(Q,W)}).map(([Q,C])=>({address:Q,...C}))}function HK(T){let A={};for(let P of T){if(!("lookupTableAddress"in P))continue;let Q=A[P.lookupTableAddress]||={readonlyIndexes:[],writableIndexes:[]};if(P.role===X1.WRITABLE)Q.writableIndexes.push(P.addressIndex);else Q.readonlyIndexes.push(P.addressIndex)}return Object.keys(A).sort(W6()).map((P)=>({lookupTableAddress:P,...A[P]}))}function KK(T){let A=0,P=0,Q=0;for(let C of T){if("lookupTableAddress"in C)break;let W=Y8(C.role);if(d0(C.role)){if(Q++,!W)P++}else if(!W)A++}return{numReadonlyNonSignerAccounts:A,numReadonlySignerAccounts:P,numSignerAccounts:Q}}function RK(T){let A={};for(let[P,Q]of T.entries())A[Q.address]=P;return A}function kK(T,A){let P=RK(A);return T.map(({accounts:Q,data:C,programAddress:W})=>{return{programAddressIndex:P[W],...Q?{accountIndices:Q.map(({address:G})=>P[G])}:null,...C?{data:C}:null}})}function jK(T){if("nonce"in T)return T.nonce;return T.blockhash}function DK(T){let A=T.findIndex((Q)=>("lookupTableAddress"in Q));return(A===-1?T:T.slice(0,A)).map(({address:Q})=>Q)}function WJ(T){let A=ZK(T.feePayer.address,T.instructions),P=XK(A),Q=T.lifetimeConstraint;return{...T.version!=="legacy"?{addressTableLookups:HK(P)}:null,...Q?{lifetimeToken:jK(Q)}:null,header:KK(P),instructions:kK(T.instructions,P),staticAccounts:DK(P),version:T.version}}function GJ(T){return Object.freeze({instructions:Object.freeze([]),version:T.version})}var FK="SysvarRecentB1ockHashes11111111111111111111",MK="11111111111111111111111111111111";function zK(T){return T.programAddress===MK&&T.data!=null&&IK(T.data)&&T.accounts?.length===3&&T.accounts[0].address!=null&&T.accounts[0].role===X1.WRITABLE&&T.accounts[1].address===FK&&T.accounts[1].role===X1.READONLY&&T.accounts[2].address!=null&&d0(T.accounts[2].role)}function IK(T){return T.byteLength===4&&T[0]===4&&T[1]===0&&T[2]===0&&T[3]===0}function UJ(T){return"lifetimeConstraint"in T&&typeof T.lifetimeConstraint.nonce==="string"&&T.instructions[0]!=null&&zK(T.instructions[0])}function JJ(T,A){if("feePayer"in A&&T===A.feePayer?.address&&SK(A.feePayer))return A;let P={...A,feePayer:Object.freeze({address:T})};return Object.freeze(P),P}function SK(T){return!!T&&"address"in T&&typeof T.address==="string"&&Object.keys(T).length===1}function $J(T,A){return NK([T],A)}function NK(T,A){return Object.freeze({...A,instructions:Object.freeze([...A.instructions,...T])})}function c8(T,A){return"fixedSize"in A?A.fixedSize:A.getSizeFromValue(T)}function I0(T){return Object.freeze({...T,encode:(A)=>{let P=new Uint8Array(c8(A,T));return T.write(A,P,0),P}})}function o8(T){return Object.freeze({...T,decode:(A,P=0)=>T.read(A,P)[0]})}function R6(T){return"fixedSize"in T&&typeof T.fixedSize==="number"}function wK(T){return!R6(T)}function UQ(T,A){return I0({fixedSize:A,write:(P,Q,C)=>{let W=T.encode(P),G=W.length>A?W.slice(0,A):W;return Q.set(G,C),C+A}})}function JQ(T,A){return I0({...wK(T)?{...T,getSizeFromValue:(P)=>T.getSizeFromValue(A(P))}:T,write:(P,Q,C)=>T.write(A(P),Q,C)})}function VJ(T,A,P,Q){if(Q<A||Q>P)throw new e(mA,{codecDescription:T,max:P,min:A,value:Q})}function EK(T){return T?.endian===1?!1:!0}function BK(T){return I0({fixedSize:T.size,write(A,P,Q){if(T.range)VJ(T.name,T.range[0],T.range[1],A);let C=new ArrayBuffer(T.size);return T.set(new DataView(C),A,EK(T.config)),P.set(new Uint8Array(C),Q),Q+T.size}})}var qJ=()=>I0({getSizeFromValue:(T)=>{if(T<=127)return 1;if(T<=16383)return 2;return 3},maxSize:3,write:(T,A,P)=>{VJ("shortU16",0,65535,T);let Q=[0];for(let C=0;;C+=1){let W=Number(T)>>C*7;if(W===0)break;let G=127&W;if(Q[C]=G,C>0)Q[C-1]|=128}return A.set(Q,P),P+Q.length}});var YJ=(T={})=>BK({config:T,name:"u32",range:[0,Number("0xffffffff")],set:(A,P,Q)=>A.setUint32(0,Number(P),Q),size:4});function hK(T,A,P){if(A!==P)throw new e(hA,{actual:P,codecDescription:T,expected:A})}function ZJ(T){return T.reduce((A,P)=>A===null||P===null?null:A+P,0)}function HJ(T){return R6(T)?T.fixedSize:null}function KJ(T){return R6(T)?T.fixedSize:T.maxSize??null}function RJ(T,A={}){let P=A.size??YJ(),Q=XJ(P,HJ(T)),C=XJ(P,KJ(T))??void 0;return I0({...Q!==null?{fixedSize:Q}:{getSizeFromValue:(W)=>{return(typeof P==="object"?c8(W.length,P):0)+[...W].reduce((J,$)=>J+c8($,T),0)},maxSize:C},write:(W,G,J)=>{if(typeof P==="number")hK("array",P,W.length);if(typeof P==="object")J=P.write(W.length,G,J);return W.forEach(($)=>{J=T.write($,G,J)}),J}})}function XJ(T,A){if(typeof T!=="number")return null;if(T===0)return 0;return A===null?null:A*T}function VQ(){return I0({getSizeFromValue:(T)=>T.length,write:(T,A,P)=>{return A.set(T,P),P+T.length}})}function kJ(T){let A=T.map(([,C])=>C),P=ZJ(A.map(HJ)),Q=ZJ(A.map(KJ))??void 0;return I0({...P===null?{getSizeFromValue:(C)=>T.map(([W,G])=>c8(C[W],G)).reduce((W,G)=>W+G,0),maxSize:Q}:{fixedSize:P},write:(C,W,G)=>{return T.forEach(([J,$])=>{G=$.write(C[J],W,G)}),G}})}var mK=(T)=>{return o8({read(A,P){let Q=P===0?A:A.slice(P);if(Q.length===0)return["",0];let C=Q.findIndex(($)=>$!==0);C=C===-1?Q.length:C;let W=T[0].repeat(C);if(C===Q.length)return[W,A.length];let G=Q.slice(C).reduce(($,X)=>$*256n+BigInt(X),0n),J=gK(G,T);return[W+J,A.length]}})};function gK(T,A){let P=BigInt(A.length),Q=[];while(T>0n)Q.unshift(A[Number(T%P)]),T/=P;return Q.join("")}var vK="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";var jJ=()=>mK(vK);var DJ=()=>{return o8({read(T,A=0){let P=T.slice(A);return[btoa(String.fromCharCode(...P)),T.length]}})};var{TextDecoder:T3,TextEncoder:A3}=globalThis;var FJ=Object.freeze({name:"Ed25519"});async function k6(T,A){zU();let P=await crypto.subtle.sign(FJ,T,A);return new Uint8Array(P)}async function MJ(){return await MU(),await crypto.subtle.generateKey(FJ,!1,["sign","verify"])}function yK(T){let A=Object.values(T);if(A.length===0)throw new e(OP);return A.map((P)=>{if(!P)return new Uint8Array(64).fill(0);return P})}function bK(){return JQ(RJ(UQ(VQ(),64),{size:qJ()}),yK)}function lK(){return kJ([["signatures",bK()],["messageBytes",VQ()]])}function zJ(T){let A=WJ(T),P=CJ().encode(A),Q=A.staticAccounts.slice(0,A.header.numSignerAccounts),C={};for(let G of Q)C[G]=null;let W;if(AJ(T))W={blockhash:T.lifetimeConstraint.blockhash,lastValidBlockHeight:T.lifetimeConstraint.lastValidBlockHeight};else if(UJ(T))W={nonce:T.lifetimeConstraint.nonce,nonceAccountAddress:T.instructions[0].accounts[0].address};return Object.freeze({...W?{lifetimeConstraint:W}:void 0,messageBytes:P,signatures:Object.freeze(C)})}var qQ;function j6(T){if(!qQ)qQ=jJ();let A=Object.values(T.signatures)[0];if(!A)throw new e(EP);return qQ.decode(A)}function pK(T,A){return T.length===A.length&&T.every((P,Q)=>P===A[Q])}async function IJ(T,A){let P,Q;if(await Promise.all(T.map(async(C)=>{let W=await G6(C.publicKey),G=A.signatures[W];if(G===void 0){Q||=new Set,Q.add(W);return}if(Q)return;let J=await k6(C.privateKey,A.messageBytes);if(G!==null&&pK(J,G))return;P||={},P[W]=J})),Q&&Q.size>0){let C=Object.keys(A.signatures);throw new e(BP,{expectedAddresses:C,unexpectedAddresses:[...Q]})}if(!P)return A;return Object.freeze({...A,signatures:Object.freeze({...A.signatures,...P})})}function SJ(T){let A=[];if(Object.entries(T.signatures).forEach(([P,Q])=>{if(!Q)A.push(P)}),A.length>0)throw new e(LP,{addresses:A})}function D6(T){let A=lK().encode(T);return DJ().decode(A)}var uK=1280,dK=48,M3=uK-dK;function NJ(T){return T!==null&&(typeof T==="object"||typeof T==="function")}function rK(T){let A=new Set,P={deferreds:A,settled:!1};return Promise.resolve(T).then((Q)=>{for(let{resolve:C}of A)C(Q);A.clear(),P.settled=!0},(Q)=>{for(let{reject:C}of A)C(Q);A.clear(),P.settled=!0}),P}var YQ=new WeakMap;async function ZQ(T){let A;return await new Promise((Q,C)=>{A={reject:C,resolve:Q};for(let W of T){if(!NJ(W)){Promise.resolve(W).then(Q,C);continue}let G=YQ.get(W);if(G===void 0)G=rK(W),G.deferreds.add(A),YQ.set(W,G);else if(G.settled)Promise.resolve(W).then(Q,C);else G.deferreds.add(A)}}).finally(()=>{for(let Q of T)if(NJ(Q))YQ.get(Q).deferreds.delete(A)})}function F6(T){let A={};return T.forEach((P)=>{if(!A[P.address])A[P.address]=P;else if(A[P.address]!==P)throw new e(zP,{address:P.address})}),Object.values(A)}function M6(T){return"modifyAndSignTransactions"in T&&typeof T.modifyAndSignTransactions==="function"}function n8(T){return"signTransactions"in T&&typeof T.signTransactions==="function"}function wJ(T){return"signAndSendTransactions"in T&&typeof T.signAndSendTransactions==="function"}function S0(T){return n8(T)||M6(T)||wJ(T)}function cK(T){return F6((T.accounts??[]).flatMap((A)=>("signer"in A)?A.signer:[]))}function oK(T){return F6([...T.feePayer&&S0(T.feePayer)?[T.feePayer]:[],...T.instructions.flatMap(cK)])}function nK(T,A){if(!A.accounts||A.accounts.length===0)return A;let P=new Map(F6(T).map((Q)=>[Q.address,Q]));return Object.freeze({...A,accounts:A.accounts.map((Q)=>{let C=P.get(Q.address);if(!d0(Q.role)||"signer"in Q||!C)return Q;return Object.freeze({...Q,signer:C})})})}function LJ(T,A){let P=fK(A)?T.find((Q)=>Q.address===A.feePayer.address):void 0;if(!P&&A.instructions.length===0)return A;return Object.freeze({...A,...P?{feePayer:P}:null,instructions:A.instructions.map((Q)=>nK(T,Q))})}function fK(T){return!!T&&"feePayer"in T&&!!T.feePayer&&typeof T.feePayer.address==="string"&&!S0(T.feePayer)}function EJ(T,A){Object.freeze(T);let P={...A,feePayer:T};return Object.freeze(P),P}async function iK(T){let A=await G6(T.publicKey);return Object.freeze({address:A,keyPair:T,signMessages:(Q)=>Promise.all(Q.map(async(C)=>Object.freeze({[A]:await k6(T.privateKey,C.content)}))),signTransactions:(Q)=>Promise.all(Q.map(async(C)=>{let W=await IJ([T],C);return Object.freeze({[A]:W.signatures[A]})}))})}async function BJ(){return await iK(await MJ())}async function aK(T,A){let{partialSigners:P,modifyingSigners:Q}=sK(F6(oK(T).filter(S0)),{identifySendingSigner:!1});return await TR(T,Q,P,A)}async function XQ(T,A){let P=await aK(T,A);return SJ(P),P}function sK(T,A={}){let Q=A.identifySendingSigner??!0?tK(T):null,C=T.filter((J)=>J!==Q&&(M6(J)||n8(J))),W=eK(C),G=C.filter(n8).filter((J)=>!W.includes(J));return Object.freeze({modifyingSigners:W,partialSigners:G,sendingSigner:Q})}function tK(T){let A=T.filter(wJ);if(A.length===0)return null;let P=A.filter((Q)=>!M6(Q)&&!n8(Q));if(P.length>0)return P[0];return A[0]}function eK(T){let A=T.filter(M6);if(A.length===0)return[];let P=A.filter((Q)=>!n8(Q));if(P.length>0)return P;return[A[0]]}async function TR(T,A=[],P=[],Q){let C=zJ(T),W=await A.reduce(async(J,$)=>{Q?.abortSignal?.throwIfAborted();let[X]=await $.modifyAndSignTransactions([await J],Q);return Object.freeze(X)},Promise.resolve(C));Q?.abortSignal?.throwIfAborted();let G=await Promise.all(P.map(async(J)=>{let[$]=await J.signTransactions([W],Q);return $}));return Object.freeze({...W,signatures:Object.freeze(G.reduce((J,$)=>{return{...J,...$}},W.signatures??{}))})}var x3=globalThis.TextEncoder;var HQ=globalThis.AbortController;function OJ({rpc:T,rpcSubscriptions:A}){return async function({abortSignal:Q,commitment:C,lastValidBlockHeight:W}){Q.throwIfAborted();let G=new HQ,J=()=>{G.abort()};Q.addEventListener("abort",J,{signal:G.signal});async function $(){let{absoluteSlot:X,blockHeight:Z}=await T.getEpochInfo({commitment:C}).send({abortSignal:G.signal});return{blockHeight:Z,differenceBetweenSlotHeightAndBlockHeight:X-Z}}try{let[X,{blockHeight:Z,differenceBetweenSlotHeightAndBlockHeight:R}]=await Promise.all([A.slotNotifications().subscribe({abortSignal:G.signal}),$()]);Q.throwIfAborted();let D=Z;if(D<=W){let z=R;for await(let S of X){let{slot:E}=S;if(E-z>W){let{blockHeight:w,differenceBetweenSlotHeightAndBlockHeight:O}=await $();if(D=w,D>W)break;else z=O}}}throw Q.throwIfAborted(),new e(VP,{currentBlockHeight:D,lastValidBlockHeight:W})}finally{G.abort()}}}function xJ({rpc:T,rpcSubscriptions:A}){return async function({abortSignal:Q,commitment:C,signature:W}){let G=new HQ;function J(){G.abort()}Q.addEventListener("abort",J,{signal:G.signal});let $=await A.signatureNotifications(W,{commitment:C}).subscribe({abortSignal:G.signal}),X=(async()=>{for await(let R of $)if(R.value.err)throw t2(R.value.err);else return})(),Z=(async()=>{let{value:R}=await T.getSignatureStatuses([W]).send({abortSignal:G.signal}),D=R[0];if(D?.confirmationStatus&&H6(D.confirmationStatus,C)>=0)return;else if(D?.err)throw t2(D.err);else await new Promise(()=>{})})();try{return await ZQ([X,Z])}finally{G.abort()}}}async function AR(T,A,P){let{abortSignal:Q,commitment:C,getRecentSignatureConfirmationPromise:W}=A;Q?.throwIfAborted();let G=new HQ;if(Q){let J=()=>{G.abort()};Q.addEventListener("abort",J,{signal:G.signal})}try{let J=P({...A,abortSignal:G.signal});return await ZQ([W({abortSignal:G.signal,commitment:C,signature:T}),...J])}finally{G.abort()}}async function _J(T){await AR(j6(T.transaction),T,function({abortSignal:P,commitment:Q,getBlockHeightExceedencePromise:C,transaction:W}){return[C({abortSignal:P,commitment:Q,lastValidBlockHeight:W.lifetimeConstraint.lastValidBlockHeight})]})}function PR(T,A){if(!A?.preflightCommitment&&H6(T,"finalized")<0)return{...A,preflightCommitment:T};return A}async function QR({abortSignal:T,commitment:A,rpc:P,transaction:Q,...C}){let W=D6(Q);return await P.sendTransaction(W,{...PR(A,C),encoding:"base64"}).send({abortSignal:T})}async function CR({abortSignal:T,commitment:A,confirmRecentTransaction:P,rpc:Q,transaction:C,...W}){let G=await QR({...W,abortSignal:T,commitment:A,rpc:Q,transaction:C});return await P({abortSignal:T,commitment:A,transaction:C}),G}function hJ({rpc:T,rpcSubscriptions:A}){let P=OJ({rpc:T,rpcSubscriptions:A}),Q=xJ({rpc:T,rpcSubscriptions:A});async function C(W){await _J({...W,getBlockHeightExceedencePromise:P,getRecentSignatureConfirmationPromise:Q})}return async function(G,J){await CR({...J,confirmRecentTransaction:C,rpc:T,transaction:G})}}var dT="6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P",N0="pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA",f8="11111111111111111111111111111111",FT="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",i8="TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb",KQ="ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";var K8="pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ";var RQ=HT(),mJ=KQ;async function MT({owner:T,mint:A,tokenProgram:P=FT,associatedTokenProgram:Q=mJ}){return await j1({programAddress:b(Q),seeds:[RQ.encode(b(T)),RQ.encode(b(P)),RQ.encode(b(A))]})}async function gJ(T){return await MT({...T,tokenProgram:T.tokenProgram??i8,associatedTokenProgram:T.associatedTokenProgram??mJ})}var yA=new TextEncoder,z6=HT();async function I6(){let[T]=await j1({programAddress:b(dT),seeds:[yA.encode("global")]});return T}async function r0(T){let[A]=await j1({programAddress:b(dT),seeds:[yA.encode("bonding-curve"),z6.encode(b(T))]});return A}async function S6(T,A){let[P]=await MT({owner:b(T),mint:b(A),tokenProgram:b(FT)});return P}async function kQ(T){let[A]=await j1({programAddress:b(dT),seeds:[yA.encode("creator-vault"),z6.encode(b(T))]});return A}async function vJ(){let[T]=await j1({programAddress:b(dT),seeds:[yA.encode("global_volume_accumulator")]});return T}async function yJ(T){let[A]=await j1({programAddress:b(dT),seeds:[yA.encode("user_volume_accumulator"),z6.encode(b(T))]});return A}async function N6(){let[T]=await j1({programAddress:b(dT),seeds:[yA.encode("__event_authority")]});return T}async function c0(){let[T]=await j1({programAddress:b(K8),seeds:[yA.encode("fee_config"),z6.encode(b(dT))]});return T}var D1="6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P";function OT(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 F1(T,A){return(P)=>{if(!P.value){if(A==="omitted")return;return Object.freeze({address:T,role:X1.READONLY})}let Q=P.isWritable?X1.WRITABLE:X1.READONLY;return Object.freeze({address:OT(P.value),role:bJ(P.value)?X6(Q):Q,...bJ(P.value)?{signer:P.value}:{}})}}function bJ(T){return!!T&&typeof T==="object"&&"address"in T&&S0(T)}var Iw=new Uint8Array([69,25,171,142,57,239,13,4]);var Lw=new Uint8Array([8,217,96,231,144,104,192,5]);var xw=new Uint8Array([209,11,115,87,213,23,124,204]);function w6(){return aT([["lpFeeBps",pT()],["protocolFeeBps",pT()],["creatorFeeBps",pT()]])}function lJ(){return aT([["marketCapLamportsThreshold",BU()],["fees",w6()]])}function jQ(){return _U([tP()])}var JR=new Uint8Array([102,6,61,18,1,218,235,234]);function $R(){return lT(uT([["discriminator",iT(W0(),8)],["amount",DT()],["maxSolCost",DT()],["trackVolume",jQ()]]),(T)=>({...T,discriminator:JR}))}function pJ(T,A){let P=A?.programAddress??D1,C={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(!C.systemProgram.value)C.systemProgram.value="11111111111111111111111111111111";if(!C.tokenProgram.value)C.tokenProgram.value="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";if(!C.program.value)C.program.value="6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P";if(!C.feeProgram.value)C.feeProgram.value="pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ";let G=F1(P,"programId");return Object.freeze({accounts:[G(C.global),G(C.feeRecipient),G(C.mint),G(C.bondingCurve),G(C.associatedBondingCurve),G(C.associatedUser),G(C.user),G(C.systemProgram),G(C.tokenProgram),G(C.creatorVault),G(C.eventAuthority),G(C.program),G(C.globalVolumeAccumulator),G(C.userVolumeAccumulator),G(C.feeConfig),G(C.feeProgram)],data:$R().encode(W),programAddress:P})}var mL=new Uint8Array([56,252,116,8,158,223,205,95]);var bL=new Uint8Array([16,4,71,28,204,1,40,27]);var dL=new Uint8Array([249,69,164,218,150,103,84,138]);var nL=new Uint8Array([20,22,86,123,198,28,219,132]);var VR=new Uint8Array([24,30,200,40,5,28,7,119]);function qR(){return lT(uT([["discriminator",iT(W0(),8)],["name",J6(Z6(),r8())],["symbol",J6(Z6(),r8())],["uri",J6(Z6(),r8())],["creator",HT()]]),(T)=>({...T,discriminator:VR}))}function uJ(T,A){let P=A?.programAddress??D1,C={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(!C.mplTokenMetadata.value)C.mplTokenMetadata.value="metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s";if(!C.systemProgram.value)C.systemProgram.value="11111111111111111111111111111111";if(!C.tokenProgram.value)C.tokenProgram.value="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";if(!C.associatedTokenProgram.value)C.associatedTokenProgram.value="ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";if(!C.rent.value)C.rent.value="SysvarRent111111111111111111111111111111111";let G=F1(P,"programId");return Object.freeze({accounts:[G(C.mint),G(C.mintAuthority),G(C.bondingCurve),G(C.associatedBondingCurve),G(C.global),G(C.mplTokenMetadata),G(C.metadata),G(C.user),G(C.systemProgram),G(C.tokenProgram),G(C.associatedTokenProgram),G(C.rent),G(C.eventAuthority),G(C.program)],data:qR().encode(W),programAddress:P})}var QE=new Uint8Array([234,102,194,203,150,72,62,229]);var UE=new Uint8Array([175,175,109,31,13,152,155,237]);var qE=new Uint8Array([94,6,202,115,255,96,232,183]);var HE=new Uint8Array([155,234,231,146,236,158,162,30]);var YR=new Uint8Array([51,230,133,164,1,127,131,173]);function ZR(){return lT(uT([["discriminator",iT(W0(),8)],["amount",DT()],["minSolOutput",DT()]]),(T)=>({...T,discriminator:YR}))}function dJ(T,A){let P=A?.programAddress??D1,C={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(!C.systemProgram.value)C.systemProgram.value="11111111111111111111111111111111";if(!C.tokenProgram.value)C.tokenProgram.value="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";if(!C.program.value)C.program.value="6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P";if(!C.feeProgram.value)C.feeProgram.value="pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ";let G=F1(P,"programId");return Object.freeze({accounts:[G(C.global),G(C.feeRecipient),G(C.mint),G(C.bondingCurve),G(C.associatedBondingCurve),G(C.associatedUser),G(C.user),G(C.systemProgram),G(C.creatorVault),G(C.tokenProgram),G(C.eventAuthority),G(C.program),G(C.feeConfig),G(C.feeProgram)],data:ZR().encode(W),programAddress:P})}var zE=new Uint8Array([254,148,255,112,207,142,170,165]);var wE=new Uint8Array([138,96,174,217,48,85,197,246]);var OE=new Uint8Array([27,234,178,52,147,2,187,141]);var mE=new Uint8Array([86,31,192,87,163,87,79,238]);var bE=new Uint8Array([227,181,74,196,208,21,97,213]);var JB=new Uint8Array([23,183,248,55,96,216,172,96]);function KR(){return aT([["discriminator",M0(u0(),8)],["virtualTokenReserves",pT()],["virtualSolReserves",pT()],["realTokenReserves",pT()],["realSolReserves",pT()],["tokenTotalSupply",pT()],["complete",eP()],["creator",F0()]])}function RR(T){return e2(T,KR())}async function bA(T,A,P){let Q=await kR(T,A,P);return A6(Q),Q}async function kR(T,A,P){let Q=await T6(T,A,P);return RR(Q)}var rJ="confirmed";function jR(T){rJ=T}function JT(){return rJ}async function a8(T){let{user:A,mint:P,tokenAmount:Q,maxSolCostLamports:C,feeRecipient:W,trackVolume:G=!0,bondingCurveCreator:J,rpc:$,commitment:X=JT()}=T,Z=b(P),R=A.address,D=await r0(Z),z=c0(),S=I6(),E=N6(),w=vJ(),O=yJ(R),m=S6(D,Z),g=MT({owner:R,mint:Z,tokenProgram:b(FT)}),p=await oJ({bondingCurve:D,providedCreator:J,rpc:$,commitment:X}),[c,o,[f],d,_,t,i,x]=await Promise.all([S,m,g,kQ(p),E,w,O,z]);return pJ({global:c,feeRecipient:b(W),mint:Z,bondingCurve:D,associatedBondingCurve:o,associatedUser:f,user:A,systemProgram:b(f8),tokenProgram:b(FT),creatorVault:d,eventAuthority:_,program:b(dT),globalVolumeAccumulator:t,userVolumeAccumulator:i,feeConfig:x,feeProgram:b(K8),amount:Q,maxSolCost:C,trackVolume:[G]})}async function DQ(T){let{user:A,mint:P,tokenAmount:Q,minSolOutputLamports:C,feeRecipient:W,bondingCurveCreator:G,rpc:J,commitment:$=JT()}=T,X=b(P),Z=A.address,R=await r0(X),D=I6(),z=S6(R,X),S=MT({owner:Z,mint:X,tokenProgram:b(FT)}),E=c0(),w=N6(),O=await oJ({bondingCurve:R,providedCreator:G,rpc:J,commitment:$}),[m,g,[p],c,o,f]=await Promise.all([D,z,S,kQ(O),w,E]);return dJ({global:m,feeRecipient:b(W),mint:X,bondingCurve:R,associatedBondingCurve:g,associatedUser:p,user:A,systemProgram:b(f8),creatorVault:c,tokenProgram:b(FT),eventAuthority:o,program:b(dT),feeConfig:f,feeProgram:b(K8),amount:Q,minSolOutput:C})}async function cJ(T){let{user:A,mint:P,mintAuthority:Q,name:C,symbol:W,uri:G,creator:J}=T,$=P.address,X=J?b(J):A.address,Z=await I6(),R=await r0($),D=await S6(R,$),[z]=await j1({programAddress:b("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),seeds:[new TextEncoder().encode("metadata"),b("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),$]}),S=await N6();return uJ({mint:P,mintAuthority:b(Q),bondingCurve:R,associatedBondingCurve:D,global:Z,mplTokenMetadata:b("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),metadata:z,user:A,systemProgram:b(f8),tokenProgram:b(FT),associatedTokenProgram:b("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"),rent:b("SysvarRent111111111111111111111111111111111"),eventAuthority:S,program:b(dT),name:C,symbol:W,uri:G,creator:X})}async function oJ(T){let{bondingCurve:A,providedCreator:P,rpc:Q,commitment:C}=T;if(P)return b(P);try{return(await bA(Q,A,{commitment:C})).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 w0="CebN5WGQ4jvEPvsVU4EoHEpgzq1VV7AbicfhtW4xC9iM";var L0=50,s8=(T,A=50)=>T+T*BigInt(A)/10000n,t8=(T,A=50)=>T-T*BigInt(A)/10000n;function E0(T){if(T<0)throw Error("Slippage cannot be negative");if(T>1e4)throw Error("Slippage cannot exceed 100%")}function DR(T){if(T<0||T>100)throw Error("Percent must be between 0 and 100");return Math.round(T*100)}function FR(T){return T/100}var MR=1000000000n;function XA(T){if(!Number.isFinite(T)||T<0)throw Error("SOL value must be a non-negative finite number");return BigInt(Math.round(T*Number(MR)))}function e8(T,A){if(!Number.isInteger(A)||A<0)throw Error("Token decimals must be a non-negative integer");let P=BigInt(10)**BigInt(A);return BigInt(Math.round(T*10**A))}async function zR(T){let{user:A,mint:P,tokenAmount:Q,estimatedSolCostSol:C,slippageBps:W=L0,feeRecipient:G=w0,bondingCurveCreator:J,trackVolume:$=!0,rpc:X,commitment:Z=JT()}=T;if(E0(W),Q<=0n)throw Error("Token amount must be positive");if(!Number.isFinite(C)||C<=0)throw Error("Estimated SOL cost must be a positive number");let R=XA(C),D=s8(R,W);return await a8({user:A,mint:P,tokenAmount:Q,maxSolCostLamports:D,feeRecipient:G,trackVolume:$,bondingCurveCreator:J,rpc:X,commitment:Z})}async function FQ(T){let{user:A,mint:P,tokenAmount:Q,maxSolCostSol:C,maxSolCostLamports:W,feeRecipient:G=w0,trackVolume:J=!0,bondingCurveCreator:$,rpc:X,commitment:Z=JT()}=T;if(Q<=0n)throw Error("Token amount must be positive");let R=null;if(W!==void 0){if(W<=0n)throw Error("Max SOL cost lamports must be positive");R=W}else if(C!==void 0){if(!Number.isFinite(C)||C<=0)throw Error("Max SOL cost must be a positive number");R=XA(C)}if(R===null)throw Error("Provide either maxSolCostLamports or maxSolCostSol when calling buySimple");return await a8({user:A,mint:P,tokenAmount:Q,maxSolCostLamports:R,feeRecipient:G,trackVolume:J,bondingCurveCreator:$,rpc:X,commitment:Z})}var nJ=6;async function IR(T){let{user:A,mint:P,tokenAmount:Q,estimatedSolOutSol:C,slippageBps:W=L0,feeRecipient:G=w0,bondingCurveCreator:J,rpc:$,commitment:X}=T;if(E0(W),!Number.isFinite(Q)||Q<=0)throw Error("Token amount must be a positive number");if(!Number.isFinite(C)||C<0)throw Error("Estimated SOL output cannot be negative");let Z=e8(Q,nJ),R=XA(C),D=t8(R,W);return await DQ({user:A,mint:P,tokenAmount:Z,minSolOutputLamports:D,feeRecipient:G,bondingCurveCreator:J,rpc:$,commitment:X})}async function MQ(T){let{user:A,mint:P,tokenAmount:Q,tokenAmountRaw:C,minSolOutputSol:W,minSolOutputLamports:G,feeRecipient:J=w0,bondingCurveCreator:$,rpc:X,commitment:Z}=T,R=null;if(C!==void 0){if(C<=0n)throw Error("Token amount lamports must be positive");R=C}else if(Q!==void 0){if(!Number.isFinite(Q)||Q<=0)throw Error("Token amount must be a positive number");R=e8(Q,nJ)}if(R===null)throw Error("Provide either tokenAmountRaw or tokenAmount when calling sellSimple");let D=null;if(G!==void 0){if(G<0n)throw Error("Min SOL output lamports cannot be negative");D=G}else if(W!==void 0){if(!Number.isFinite(W)||W<0)throw Error("Min SOL output cannot be negative");D=XA(W)}if(D===null)throw Error("Provide either minSolOutputLamports or minSolOutputSol when calling sellSimple");return await DQ({user:A,mint:P,tokenAmount:R,minSolOutputLamports:D,feeRecipient:J,bondingCurveCreator:$,rpc:X,commitment:Z})}var yB=new Uint8Array([143,52,146,187,219,123,76,155]);function SR(){return aT([["discriminator",M0(u0(),8)],["bump",V6()],["admin",F0()],["flatFees",w6()],["feeTiers",xU(lJ())]])}function NR(T){return e2(T,SR())}async function T2(T,A,P){let Q=await wR(T,A,P);return A6(Q),Q}async function wR(T,A,P){let Q=await T6(T,A,P);return NR(Q)}var o0=10000n,R8=(T,A,P)=>{if(P<=0n)throw Error("Division by zero (floor)");return T*A/P},LR=(T,A,P)=>{if(P<=0n)throw Error("Division by zero (ceil)");let Q=T*A,C=Q/P;return Q%P===0n?C:C+1n},zQ=(T)=>{let A=BigInt(T.lpFeeBps),P=BigInt(T.protocolFeeBps),Q=BigInt(T.creatorFeeBps),C=A+P,W=C+Q;if(W>=o0)throw Error("Total fee basis points must be less than 10_000");return{totalFeeBps:W,combinedFeeBps:C}},IQ=(T)=>{let A=T.virtualTokenReserves+T.realTokenReserves,P=T.virtualSolReserves+T.realSolReserves;return A*P};function fJ(T,A,P){if(P<=0n)throw Error("Total SOL cost must be positive");let{combinedFeeBps:Q,totalFeeBps:C}=zQ(A),W=R8(P,Q,o0),G=R8(P,BigInt(A.creatorFeeBps),o0),J=P-W-G;if(J<=0n)throw Error("Net SOL after fees must be positive");let $=IQ(T),X=T.virtualSolReserves+T.realSolReserves,Z=T.virtualTokenReserves+T.realTokenReserves,R=X+J,D=$/R,z=Z-D,S=z>T.realTokenReserves?T.realTokenReserves:z;if(S<=0n)throw Error("SOL amount is too small to purchase any tokens");let E=L6(T,A,S);while(E.totalSolCostLamports>P&&S>0n)S-=1n,E=L6(T,A,S);if(E.totalSolCostLamports>P)throw Error("Insufficient SOL to purchase any tokens with fees applied");return{tokenAmount:S,totalSolCostLamports:E.totalSolCostLamports,effectiveSolInLamports:E.effectiveSolInLamports,feeLamports:E.feeLamports,creatorFeeLamports:E.creatorFeeLamports}}function L6(T,A,P){if(P<=0n)throw Error("Token amount must be positive");if(P>T.realTokenReserves)throw Error("Token amount exceeds available reserves");let{combinedFeeBps:Q,totalFeeBps:C}=zQ(A),W=IQ(T),G=T.virtualSolReserves+T.realSolReserves,$=T.virtualTokenReserves+T.realTokenReserves-P;if($<=0n)throw Error("Purchase would exhaust token reserves");let Z=W/$-G;if(Z<=0n)throw Error("Resolved SOL input must be positive");let R=o0-C,D=LR(Z,o0,R),z=R8(D,Q,o0),S=R8(D,BigInt(A.creatorFeeBps),o0);return{tokenAmount:P,totalSolCostLamports:D,effectiveSolInLamports:Z,feeLamports:z,creatorFeeLamports:S}}function iJ(T,A,P){if(P<=0n)throw Error("Token amount must be positive");let Q=IQ(T),C=T.virtualSolReserves+T.realSolReserves,G=T.virtualTokenReserves+T.realTokenReserves+P,J=Q/G,$=C-J;if($<=0n)throw Error("No SOL output available for the given token amount");let{combinedFeeBps:X}=zQ(A),Z=R8($,X,o0),R=R8($,BigInt(A.creatorFeeBps),o0),D=$-Z-R;if(D<=0n)throw Error("SOL output after fees is non-positive");return{solOutputLamports:D,preFeeSolOutputLamports:$,feeLamports:Z,creatorFeeLamports:R}}j8();var uA=typeof globalThis==="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function i0(T){return T instanceof Uint8Array||ArrayBuffer.isView(T)&&T.constructor.name==="Uint8Array"}function KA(T){if(!Number.isSafeInteger(T)||T<0)throw Error("positive integer expected, got "+T)}function KT(T,...A){if(!i0(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 x6(T){if(typeof T!=="function"||typeof T.create!=="function")throw Error("Hash should be wrapped by utils.createHasher");KA(T.outputLen),KA(T.blockLen)}function a0(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 _6(T,A){KT(T);let P=A.outputLen;if(T.length<P)throw Error("digestInto() expects output buffer of length at least "+P)}function k$(T){return new Uint32Array(T.buffer,T.byteOffset,Math.floor(T.byteLength/4))}function U0(...T){for(let A=0;A<T.length;A++)T[A].fill(0)}function h6(T){return new DataView(T.buffer,T.byteOffset,T.byteLength)}function q0(T,A){return T<<32-A|T>>>A}var Hk=(()=>new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68)();function Kk(T){return T<<24&4278190080|T<<8&16711680|T>>>8&65280|T>>>24&255}function Rk(T){for(let A=0;A<T.length;A++)T[A]=Kk(T[A]);return T}var hQ=Hk?(T)=>T:Rk,j$=(()=>typeof Uint8Array.from([]).toHex==="function"&&typeof Uint8Array.fromHex==="function")(),kk=Array.from({length:256},(T,A)=>A.toString(16).padStart(2,"0"));function J0(T){if(KT(T),j$)return T.toHex();let A="";for(let P=0;P<T.length;P++)A+=kk[T[P]];return A}var f0={_0:48,_9:57,A:65,F:70,a:97,f:102};function R$(T){if(T>=f0._0&&T<=f0._9)return T-f0._0;if(T>=f0.A&&T<=f0.F)return T-(f0.A-10);if(T>=f0.a&&T<=f0.f)return T-(f0.a-10);return}function dA(T){if(typeof T!=="string")throw Error("hex string expected, got "+typeof T);if(j$)return Uint8Array.fromHex(T);let A=T.length,P=A/2;if(A%2)throw Error("hex string expected, got unpadded hex of length "+A);let Q=new Uint8Array(P);for(let C=0,W=0;C<P;C++,W+=2){let G=R$(T.charCodeAt(W)),J=R$(T.charCodeAt(W+1));if(G===void 0||J===void 0){let $=T[W]+T[W+1];throw Error('hex string expected, got non-hex character "'+$+'" at index '+W)}Q[C]=G*16+J}return Q}function mQ(T){if(typeof T!=="string")throw Error("string expected");return new Uint8Array(new TextEncoder().encode(T))}function rA(T){if(typeof T==="string")T=mQ(T);return KT(T),T}function xT(...T){let A=0;for(let Q=0;Q<T.length;Q++){let C=T[Q];KT(C),A+=C.length}let P=new Uint8Array(A);for(let Q=0,C=0;Q<T.length;Q++){let W=T[Q];P.set(W,C),C+=W.length}return P}class cA{}function Q2(T){let A=(Q)=>T().update(rA(Q)).digest(),P=T();return A.outputLen=P.outputLen,A.blockLen=P.blockLen,A.create=()=>T(),A}function D8(T=32){if(uA&&typeof uA.getRandomValues==="function")return uA.getRandomValues(new Uint8Array(T));if(uA&&typeof uA.randomBytes==="function")return Uint8Array.from(uA.randomBytes(T));throw Error("crypto.getRandomValues must be defined")}function jk(T,A,P,Q){if(typeof T.setBigUint64==="function")return T.setBigUint64(A,P,Q);let C=BigInt(32),W=BigInt(4294967295),G=Number(P>>C&W),J=Number(P&W),$=Q?4:0,X=Q?0:4;T.setUint32(A+$,G,Q),T.setUint32(A+X,J,Q)}function D$(T,A,P){return T&A^~T&P}function F$(T,A,P){return T&A^T&P^A&P}class m6 extends cA{constructor(T,A,P,Q){super();this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=T,this.outputLen=A,this.padOffset=P,this.isLE=Q,this.buffer=new Uint8Array(T),this.view=h6(this.buffer)}update(T){a0(this),T=rA(T),KT(T);let{view:A,buffer:P,blockLen:Q}=this,C=T.length;for(let W=0;W<C;){let G=Math.min(Q-this.pos,C-W);if(G===Q){let J=h6(T);for(;Q<=C-W;W+=Q)this.process(J,W);continue}if(P.set(T.subarray(W,W+G),this.pos),this.pos+=G,W+=G,this.pos===Q)this.process(A,0),this.pos=0}return this.length+=T.length,this.roundClean(),this}digestInto(T){a0(this),_6(T,this),this.finished=!0;let{buffer:A,view:P,blockLen:Q,isLE:C}=this,{pos:W}=this;if(A[W++]=128,U0(this.buffer.subarray(W)),this.padOffset>Q-W)this.process(P,0),W=0;for(let Z=W;Z<Q;Z++)A[Z]=0;jk(P,Q-8,BigInt(this.length*8),C),this.process(P,0);let G=h6(T),J=this.outputLen;if(J%4)throw Error("_sha2: outputLen should be aligned to 32bit");let $=J/4,X=this.get();if($>X.length)throw Error("_sha2: outputLen bigger than state");for(let Z=0;Z<$;Z++)G.setUint32(4*Z,X[Z],C)}digest(){let{buffer:T,outputLen:A}=this;this.digestInto(T);let P=T.slice(0,A);return this.destroy(),P}_cloneInto(T){T||(T=new this.constructor),T.set(...this.get());let{blockLen:A,buffer:P,length:Q,finished:C,destroyed:W,pos:G}=this;if(T.destroyed=W,T.finished=C,T.length=Q,T.pos=G,Q%A)T.buffer.set(P);return T}clone(){return this._cloneInto()}}var s0=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);var RT=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]);var g6=BigInt(4294967295),M$=BigInt(32);function Dk(T,A=!1){if(A)return{h:Number(T&g6),l:Number(T>>M$&g6)};return{h:Number(T>>M$&g6)|0,l:Number(T&g6)|0}}function v6(T,A=!1){let P=T.length,Q=new Uint32Array(P),C=new Uint32Array(P);for(let W=0;W<P;W++){let{h:G,l:J}=Dk(T[W],A);[Q[W],C[W]]=[G,J]}return[Q,C]}var gQ=(T,A,P)=>T>>>P,vQ=(T,A,P)=>T<<32-P|A>>>P,oA=(T,A,P)=>T>>>P|A<<32-P,nA=(T,A,P)=>T<<32-P|A>>>P,C2=(T,A,P)=>T<<64-P|A>>>P-32,W2=(T,A,P)=>T>>>P-32|A<<64-P;var z$=(T,A,P)=>T<<P|A>>>32-P,I$=(T,A,P)=>A<<P|T>>>32-P,S$=(T,A,P)=>A<<P-32|T>>>64-P,N$=(T,A,P)=>T<<P-32|A>>>64-P;function x0(T,A,P,Q){let C=(A>>>0)+(Q>>>0);return{h:T+P+(C/4294967296|0)|0,l:C|0}}var w$=(T,A,P)=>(T>>>0)+(A>>>0)+(P>>>0),L$=(T,A,P,Q)=>A+P+Q+(T/4294967296|0)|0,E$=(T,A,P,Q)=>(T>>>0)+(A>>>0)+(P>>>0)+(Q>>>0),B$=(T,A,P,Q,C)=>A+P+Q+C+(T/4294967296|0)|0,O$=(T,A,P,Q,C)=>(T>>>0)+(A>>>0)+(P>>>0)+(Q>>>0)+(C>>>0),x$=(T,A,P,Q,C,W)=>A+P+Q+C+W+(T/4294967296|0)|0;var Mk=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]),RA=new Uint32Array(64);class yQ extends m6{constructor(T=32){super(64,T,8,!1);this.A=s0[0]|0,this.B=s0[1]|0,this.C=s0[2]|0,this.D=s0[3]|0,this.E=s0[4]|0,this.F=s0[5]|0,this.G=s0[6]|0,this.H=s0[7]|0}get(){let{A:T,B:A,C:P,D:Q,E:C,F:W,G,H:J}=this;return[T,A,P,Q,C,W,G,J]}set(T,A,P,Q,C,W,G,J){this.A=T|0,this.B=A|0,this.C=P|0,this.D=Q|0,this.E=C|0,this.F=W|0,this.G=G|0,this.H=J|0}process(T,A){for(let Z=0;Z<16;Z++,A+=4)RA[Z]=T.getUint32(A,!1);for(let Z=16;Z<64;Z++){let R=RA[Z-15],D=RA[Z-2],z=q0(R,7)^q0(R,18)^R>>>3,S=q0(D,17)^q0(D,19)^D>>>10;RA[Z]=S+RA[Z-7]+z+RA[Z-16]|0}let{A:P,B:Q,C,D:W,E:G,F:J,G:$,H:X}=this;for(let Z=0;Z<64;Z++){let R=q0(G,6)^q0(G,11)^q0(G,25),D=X+R+D$(G,J,$)+Mk[Z]+RA[Z]|0,S=(q0(P,2)^q0(P,13)^q0(P,22))+F$(P,Q,C)|0;X=$,$=J,J=G,G=W+D|0,W=C,C=Q,Q=P,P=D+S|0}P=P+this.A|0,Q=Q+this.B|0,C=C+this.C|0,W=W+this.D|0,G=G+this.E|0,J=J+this.F|0,$=$+this.G|0,X=X+this.H|0,this.set(P,Q,C,W,G,J,$,X)}roundClean(){U0(RA)}destroy(){this.set(0,0,0,0,0,0,0,0),U0(this.buffer)}}var _$=(()=>v6(["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))))(),zk=(()=>_$[0])(),Ik=(()=>_$[1])(),kA=new Uint32Array(80),jA=new Uint32Array(80);class h$ extends m6{constructor(T=64){super(128,T,16,!1);this.Ah=RT[0]|0,this.Al=RT[1]|0,this.Bh=RT[2]|0,this.Bl=RT[3]|0,this.Ch=RT[4]|0,this.Cl=RT[5]|0,this.Dh=RT[6]|0,this.Dl=RT[7]|0,this.Eh=RT[8]|0,this.El=RT[9]|0,this.Fh=RT[10]|0,this.Fl=RT[11]|0,this.Gh=RT[12]|0,this.Gl=RT[13]|0,this.Hh=RT[14]|0,this.Hl=RT[15]|0}get(){let{Ah:T,Al:A,Bh:P,Bl:Q,Ch:C,Cl:W,Dh:G,Dl:J,Eh:$,El:X,Fh:Z,Fl:R,Gh:D,Gl:z,Hh:S,Hl:E}=this;return[T,A,P,Q,C,W,G,J,$,X,Z,R,D,z,S,E]}set(T,A,P,Q,C,W,G,J,$,X,Z,R,D,z,S,E){this.Ah=T|0,this.Al=A|0,this.Bh=P|0,this.Bl=Q|0,this.Ch=C|0,this.Cl=W|0,this.Dh=G|0,this.Dl=J|0,this.Eh=$|0,this.El=X|0,this.Fh=Z|0,this.Fl=R|0,this.Gh=D|0,this.Gl=z|0,this.Hh=S|0,this.Hl=E|0}process(T,A){for(let m=0;m<16;m++,A+=4)kA[m]=T.getUint32(A),jA[m]=T.getUint32(A+=4);for(let m=16;m<80;m++){let g=kA[m-15]|0,p=jA[m-15]|0,c=oA(g,p,1)^oA(g,p,8)^gQ(g,p,7),o=nA(g,p,1)^nA(g,p,8)^vQ(g,p,7),f=kA[m-2]|0,d=jA[m-2]|0,_=oA(f,d,19)^C2(f,d,61)^gQ(f,d,6),t=nA(f,d,19)^W2(f,d,61)^vQ(f,d,6),i=E$(o,t,jA[m-7],jA[m-16]),x=B$(i,c,_,kA[m-7],kA[m-16]);kA[m]=x|0,jA[m]=i|0}let{Ah:P,Al:Q,Bh:C,Bl:W,Ch:G,Cl:J,Dh:$,Dl:X,Eh:Z,El:R,Fh:D,Fl:z,Gh:S,Gl:E,Hh:w,Hl:O}=this;for(let m=0;m<80;m++){let g=oA(Z,R,14)^oA(Z,R,18)^C2(Z,R,41),p=nA(Z,R,14)^nA(Z,R,18)^W2(Z,R,41),c=Z&D^~Z&S,o=R&z^~R&E,f=O$(O,p,o,Ik[m],jA[m]),d=x$(f,w,g,c,zk[m],kA[m]),_=f|0,t=oA(P,Q,28)^C2(P,Q,34)^C2(P,Q,39),i=nA(P,Q,28)^W2(P,Q,34)^W2(P,Q,39),x=P&C^P&G^C&G,k=Q&W^Q&J^W&J;w=S|0,O=E|0,S=D|0,E=z|0,D=Z|0,z=R|0,{h:Z,l:R}=x0($|0,X|0,d|0,_|0),$=G|0,X=J|0,G=C|0,J=W|0,C=P|0,W=Q|0;let U=w$(_,i,k);P=L$(U,d,t,x),Q=U|0}({h:P,l:Q}=x0(this.Ah|0,this.Al|0,P|0,Q|0)),{h:C,l:W}=x0(this.Bh|0,this.Bl|0,C|0,W|0),{h:G,l:J}=x0(this.Ch|0,this.Cl|0,G|0,J|0),{h:$,l:X}=x0(this.Dh|0,this.Dl|0,$|0,X|0),{h:Z,l:R}=x0(this.Eh|0,this.El|0,Z|0,R|0),{h:D,l:z}=x0(this.Fh|0,this.Fl|0,D|0,z|0),{h:S,l:E}=x0(this.Gh|0,this.Gl|0,S|0,E|0),{h:w,l:O}=x0(this.Hh|0,this.Hl|0,w|0,O|0),this.set(P,Q,C,W,G,J,$,X,Z,R,D,z,S,E,w,O)}roundClean(){U0(kA,jA)}destroy(){U0(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}var y6=Q2(()=>new yQ);var m$=Q2(()=>new h$);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var pQ=BigInt(0),lQ=BigInt(1);function t0(T,A=""){if(typeof T!=="boolean"){let P=A&&`"${A}"`;throw Error(P+"expected boolean, got type="+typeof T)}return T}function sT(T,A,P=""){let Q=i0(T),C=T?.length,W=A!==void 0;if(!Q||W&&C!==A){let G=P&&`"${P}" `,J=W?` of length ${A}`:"",$=Q?`length=${C}`:`type=${typeof T}`;throw Error(G+"expected Uint8Array"+J+", got "+$)}return T}function G2(T){let A=T.toString(16);return A.length&1?"0"+A:A}function g$(T){if(typeof T!=="string")throw Error("hex string expected, got "+typeof T);return T===""?pQ:BigInt("0x"+T)}function F8(T){return g$(J0(T))}function e0(T){return KT(T),g$(J0(Uint8Array.from(T).reverse()))}function b6(T,A){return dA(T.toString(16).padStart(A*2,"0"))}function uQ(T,A){return b6(T,A).reverse()}function q1(T,A,P){let Q;if(typeof A==="string")try{Q=dA(A)}catch(W){throw Error(T+" must be hex string or Uint8Array, cause: "+W)}else if(i0(A))Q=Uint8Array.from(A);else throw Error(T+" must be hex string or Uint8Array");let C=Q.length;if(typeof P==="number"&&C!==P)throw Error(T+" of length "+P+" expected, got "+C);return Q}function v$(T,A){if(T.length!==A.length)return!1;let P=0;for(let Q=0;Q<T.length;Q++)P|=T[Q]^A[Q];return P===0}function dQ(T){return Uint8Array.from(T)}var bQ=(T)=>typeof T==="bigint"&&pQ<=T;function y$(T,A,P){return bQ(T)&&bQ(A)&&bQ(P)&&A<=T&&T<P}function U2(T,A,P,Q){if(!y$(A,P,Q))throw Error("expected valid "+T+": "+P+" <= n < "+Q+", got "+A)}function l6(T){let A;for(A=0;T>pQ;T>>=lQ,A+=1);return A}var DA=(T)=>(lQ<<BigInt(T))-lQ;function b$(T,A,P){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 P!=="function")throw Error("hmacFn must be a function");let Q=(z)=>new Uint8Array(z),C=(z)=>Uint8Array.of(z),W=Q(T),G=Q(T),J=0,$=()=>{W.fill(1),G.fill(0),J=0},X=(...z)=>P(G,W,...z),Z=(z=Q(0))=>{if(G=X(C(0),z),W=X(),z.length===0)return;G=X(C(1),z),W=X()},R=()=>{if(J++>=1000)throw Error("drbg: tried 1000 values");let z=0,S=[];while(z<A){W=X();let E=W.slice();S.push(E),z+=W.length}return xT(...S)};return(z,S)=>{$(),Z(z);let E=void 0;while(!(E=S(R())))Z();return $(),E}}function FA(T,A,P={}){if(!T||typeof T!=="object")throw Error("expected valid options object");function Q(C,W,G){let J=T[C];if(G&&J===void 0)return;let $=typeof J;if($!==W||J===null)throw Error(`param "${C}" is invalid: expected ${W}, got ${$}`)}Object.entries(A).forEach(([C,W])=>Q(C,W,!1)),Object.entries(P).forEach(([C,W])=>Q(C,W,!0))}var rQ=()=>{throw Error("not implemented")};function M8(T){let A=new WeakMap;return(P,...Q)=>{let C=A.get(P);if(C!==void 0)return C;let W=T(P,...Q);return A.set(P,W),W}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var _T=BigInt(0),ZT=BigInt(1),fA=BigInt(2),u$=BigInt(3),d$=BigInt(4),r$=BigInt(5),Sk=BigInt(7),c$=BigInt(8),Nk=BigInt(9),o$=BigInt(16);function M1(T,A){let P=T%A;return P>=_T?P:A+P}function R1(T,A,P){let Q=T;while(A-- >_T)Q*=Q,Q%=P;return Q}function l$(T,A){if(T===_T)throw Error("invert: expected non-zero number");if(A<=_T)throw Error("invert: expected positive modulus, got "+A);let P=M1(T,A),Q=A,C=_T,W=ZT,G=ZT,J=_T;while(P!==_T){let X=Q/P,Z=Q%P,R=C-G*X,D=W-J*X;Q=P,P=Z,C=G,W=J,G=R,J=D}if(Q!==ZT)throw Error("invert: does not exist");return M1(C,A)}function cQ(T,A,P){if(!T.eql(T.sqr(A),P))throw Error("Cannot find square root")}function n$(T,A){let P=(T.ORDER+ZT)/d$,Q=T.pow(A,P);return cQ(T,Q,A),Q}function wk(T,A){let P=(T.ORDER-r$)/c$,Q=T.mul(A,fA),C=T.pow(Q,P),W=T.mul(A,C),G=T.mul(T.mul(W,fA),C),J=T.mul(W,T.sub(G,T.ONE));return cQ(T,J,A),J}function Lk(T){let A=tT(T),P=f$(T),Q=P(A,A.neg(A.ONE)),C=P(A,Q),W=P(A,A.neg(Q)),G=(T+Sk)/o$;return(J,$)=>{let X=J.pow($,G),Z=J.mul(X,Q),R=J.mul(X,C),D=J.mul(X,W),z=J.eql(J.sqr(Z),$),S=J.eql(J.sqr(R),$);X=J.cmov(X,Z,z),Z=J.cmov(D,R,S);let E=J.eql(J.sqr(Z),$),w=J.cmov(X,Z,E);return cQ(J,w,$),w}}function f$(T){if(T<u$)throw Error("sqrt is not defined for small field");let A=T-ZT,P=0;while(A%fA===_T)A/=fA,P++;let Q=fA,C=tT(T);while(p$(C,Q)===1)if(Q++>1000)throw Error("Cannot find square root: probably non-prime P");if(P===1)return n$;let W=C.pow(Q,A),G=(A+ZT)/fA;return function($,X){if($.is0(X))return X;if(p$($,X)!==1)throw Error("Cannot find square root");let Z=P,R=$.mul($.ONE,W),D=$.pow(X,A),z=$.pow(X,G);while(!$.eql(D,$.ONE)){if($.is0(D))return $.ZERO;let S=1,E=$.sqr(D);while(!$.eql(E,$.ONE))if(S++,E=$.sqr(E),S===Z)throw Error("Cannot find square root");let w=ZT<<BigInt(Z-S-1),O=$.pow(R,w);Z=S,R=$.sqr(O),D=$.mul(D,R),z=$.mul(z,O)}return z}}function Ek(T){if(T%d$===u$)return n$;if(T%c$===r$)return wk;if(T%o$===Nk)return Lk(T);return f$(T)}var TA=(T,A)=>(M1(T,A)&ZT)===ZT,Bk=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function oQ(T){let A={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},P=Bk.reduce((Q,C)=>{return Q[C]="function",Q},A);return FA(T,P),T}function Ok(T,A,P){if(P<_T)throw Error("invalid exponent, negatives unsupported");if(P===_T)return T.ONE;if(P===ZT)return A;let Q=T.ONE,C=A;while(P>_T){if(P&ZT)Q=T.mul(Q,C);C=T.sqr(C),P>>=ZT}return Q}function J2(T,A,P=!1){let Q=Array(A.length).fill(P?T.ZERO:void 0),C=A.reduce((G,J,$)=>{if(T.is0(J))return G;return Q[$]=G,T.mul(G,J)},T.ONE),W=T.inv(C);return A.reduceRight((G,J,$)=>{if(T.is0(J))return G;return Q[$]=T.mul(G,Q[$]),T.mul(G,J)},W),Q}function p$(T,A){let P=(T.ORDER-ZT)/fA,Q=T.pow(A,P),C=T.eql(Q,T.ONE),W=T.eql(Q,T.ZERO),G=T.eql(Q,T.neg(T.ONE));if(!C&&!W&&!G)throw Error("invalid Legendre symbol result");return C?1:W?0:-1}function p6(T,A){if(A!==void 0)KA(A);let P=A!==void 0?A:T.toString(2).length,Q=Math.ceil(P/8);return{nBitLength:P,nByteLength:Q}}function tT(T,A,P=!1,Q={}){if(T<=_T)throw Error("invalid field: expected ORDER > 0, got "+T);let C=void 0,W=void 0,G=!1,J=void 0;if(typeof A==="object"&&A!=null){if(Q.sqrt||P)throw Error("cannot specify opts in two arguments");let D=A;if(D.BITS)C=D.BITS;if(D.sqrt)W=D.sqrt;if(typeof D.isLE==="boolean")P=D.isLE;if(typeof D.modFromBytes==="boolean")G=D.modFromBytes;J=D.allowedLengths}else{if(typeof A==="number")C=A;if(Q.sqrt)W=Q.sqrt}let{nBitLength:$,nByteLength:X}=p6(T,C);if(X>2048)throw Error("invalid field: expected ORDER of <= 2048 bytes");let Z,R=Object.freeze({ORDER:T,isLE:P,BITS:$,BYTES:X,MASK:DA($),ZERO:_T,ONE:ZT,allowedLengths:J,create:(D)=>M1(D,T),isValid:(D)=>{if(typeof D!=="bigint")throw Error("invalid field element: expected bigint, got "+typeof D);return _T<=D&&D<T},is0:(D)=>D===_T,isValidNot0:(D)=>!R.is0(D)&&R.isValid(D),isOdd:(D)=>(D&ZT)===ZT,neg:(D)=>M1(-D,T),eql:(D,z)=>D===z,sqr:(D)=>M1(D*D,T),add:(D,z)=>M1(D+z,T),sub:(D,z)=>M1(D-z,T),mul:(D,z)=>M1(D*z,T),pow:(D,z)=>Ok(R,D,z),div:(D,z)=>M1(D*l$(z,T),T),sqrN:(D)=>D*D,addN:(D,z)=>D+z,subN:(D,z)=>D-z,mulN:(D,z)=>D*z,inv:(D)=>l$(D,T),sqrt:W||((D)=>{if(!Z)Z=Ek(T);return Z(R,D)}),toBytes:(D)=>P?uQ(D,X):b6(D,X),fromBytes:(D,z=!0)=>{if(J){if(!J.includes(D.length)||D.length>X)throw Error("Field.fromBytes: expected "+J+" bytes, got "+D.length);let E=new Uint8Array(X);E.set(D,P?0:E.length-D.length),D=E}if(D.length!==X)throw Error("Field.fromBytes: expected "+X+" bytes, got "+D.length);let S=P?e0(D):F8(D);if(G)S=M1(S,T);if(!z){if(!R.isValid(S))throw Error("invalid field element: outside of range 0..ORDER")}return S},invertBatch:(D)=>J2(R,D),cmov:(D,z,S)=>S?z:D});return Object.freeze(R)}function i$(T){if(typeof T!=="bigint")throw Error("field order must be bigint");let A=T.toString(2).length;return Math.ceil(A/8)}function nQ(T){let A=i$(T);return A+Math.ceil(A/2)}function fQ(T,A,P=!1){let Q=T.length,C=i$(A),W=nQ(A);if(Q<16||Q<W||Q>1024)throw Error("expected "+W+"-1024 bytes of input, got "+Q);let G=P?e0(T):F8(T),J=M1(G,A-ZT)+ZT;return P?uQ(J,C):b6(J,C)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var z8=BigInt(0),iA=BigInt(1);function $2(T,A){let P=A.negate();return T?P:A}function AA(T,A){let P=J2(T.Fp,A.map((Q)=>Q.Z));return A.map((Q,C)=>T.fromAffine(Q.toAffine(P[C])))}function e$(T,A){if(!Number.isSafeInteger(T)||T<=0||T>A)throw Error("invalid window size, expected [1.."+A+"], got W="+T)}function iQ(T,A){e$(T,A);let P=Math.ceil(A/T)+1,Q=2**(T-1),C=2**T,W=DA(T),G=BigInt(T);return{windows:P,windowSize:Q,mask:W,maxNumber:C,shiftBy:G}}function a$(T,A,P){let{windowSize:Q,mask:C,maxNumber:W,shiftBy:G}=P,J=Number(T&C),$=T>>G;if(J>Q)J-=W,$+=iA;let X=A*Q,Z=X+Math.abs(J)-1,R=J===0,D=J<0,z=A%2!==0;return{nextN:$,offset:Z,isZero:R,isNeg:D,isNegF:z,offsetF:X}}function xk(T,A){if(!Array.isArray(T))throw Error("array expected");T.forEach((P,Q)=>{if(!(P instanceof A))throw Error("invalid point at index "+Q)})}function _k(T,A){if(!Array.isArray(T))throw Error("array of scalars expected");T.forEach((P,Q)=>{if(!A.isValid(P))throw Error("invalid scalar at index "+Q)})}var aQ=new WeakMap,T9=new WeakMap;function sQ(T){return T9.get(T)||1}function s$(T){if(T!==z8)throw Error("invalid wNAF")}class V2{constructor(T,A){this.BASE=T.BASE,this.ZERO=T.ZERO,this.Fn=T.Fn,this.bits=A}_unsafeLadder(T,A,P=this.ZERO){let Q=T;while(A>z8){if(A&iA)P=P.add(Q);Q=Q.double(),A>>=iA}return P}precomputeWindow(T,A){let{windows:P,windowSize:Q}=iQ(A,this.bits),C=[],W=T,G=W;for(let J=0;J<P;J++){G=W,C.push(G);for(let $=1;$<Q;$++)G=G.add(W),C.push(G);W=G.double()}return C}wNAF(T,A,P){if(!this.Fn.isValid(P))throw Error("invalid scalar");let Q=this.ZERO,C=this.BASE,W=iQ(T,this.bits);for(let G=0;G<W.windows;G++){let{nextN:J,offset:$,isZero:X,isNeg:Z,isNegF:R,offsetF:D}=a$(P,G,W);if(P=J,X)C=C.add($2(R,A[D]));else Q=Q.add($2(Z,A[$]))}return s$(P),{p:Q,f:C}}wNAFUnsafe(T,A,P,Q=this.ZERO){let C=iQ(T,this.bits);for(let W=0;W<C.windows;W++){if(P===z8)break;let{nextN:G,offset:J,isZero:$,isNeg:X}=a$(P,W,C);if(P=G,$)continue;else{let Z=A[J];Q=Q.add(X?Z.negate():Z)}}return s$(P),Q}getPrecomputes(T,A,P){let Q=aQ.get(A);if(!Q){if(Q=this.precomputeWindow(A,T),T!==1){if(typeof P==="function")Q=P(Q);aQ.set(A,Q)}}return Q}cached(T,A,P){let Q=sQ(T);return this.wNAF(Q,this.getPrecomputes(Q,T,P),A)}unsafe(T,A,P,Q){let C=sQ(T);if(C===1)return this._unsafeLadder(T,A,Q);return this.wNAFUnsafe(C,this.getPrecomputes(C,T,P),A,Q)}createCache(T,A){e$(A,this.bits),T9.set(T,A),aQ.delete(T)}hasCache(T){return sQ(T)!==1}}function A9(T,A,P,Q){let C=A,W=T.ZERO,G=T.ZERO;while(P>z8||Q>z8){if(P&iA)W=W.add(C);if(Q&iA)G=G.add(C);C=C.double(),P>>=iA,Q>>=iA}return{p1:W,p2:G}}function I8(T,A,P,Q){xk(P,T),_k(Q,A);let C=P.length,W=Q.length;if(C!==W)throw Error("arrays of points and scalars must have equal length");let G=T.ZERO,J=l6(BigInt(C)),$=1;if(J>12)$=J-3;else if(J>4)$=J-2;else if(J>0)$=2;let X=DA($),Z=Array(Number(X)+1).fill(G),R=Math.floor((A.BITS-1)/$)*$,D=G;for(let z=R;z>=0;z-=$){Z.fill(G);for(let E=0;E<W;E++){let w=Q[E],O=Number(w>>BigInt(z)&X);Z[O]=Z[O].add(P[E])}let S=G;for(let E=Z.length-1,w=G;E>0;E--)w=w.add(Z[E]),S=S.add(w);if(D=D.add(S),z!==0)for(let E=0;E<$;E++)D=D.double()}return D}function t$(T,A,P){if(A){if(A.ORDER!==T)throw Error("Field.ORDER must match order: Fp == p, Fn == n");return oQ(A),A}else return tT(T,{isLE:P})}function u6(T,A,P={},Q){if(Q===void 0)Q=T==="edwards";if(!A||typeof A!=="object")throw Error(`expected valid ${T} CURVE object`);for(let $ of["p","n","h"]){let X=A[$];if(!(typeof X==="bigint"&&X>z8))throw Error(`CURVE.${$} must be positive bigint`)}let C=t$(A.p,P.Fp,Q),W=t$(A.n,P.Fn,Q),J=["Gx","Gy","a",T==="weierstrass"?"b":"d"];for(let $ of J)if(!C.isValid(A[$]))throw Error(`CURVE.${$} must be valid field element of CURVE.Fp`);return A=Object.freeze(Object.assign({},A)),{CURVE:A,Fp:C,Fn:W}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var MA=BigInt(0),XT=BigInt(1),tQ=BigInt(2),hk=BigInt(8);function mk(T,A,P,Q){let C=T.sqr(P),W=T.sqr(Q),G=T.add(T.mul(A.a,C),W),J=T.add(T.ONE,T.mul(A.d,T.mul(C,W)));return T.eql(G,J)}function gk(T,A={}){let P=u6("edwards",T,A,A.FpFnLE),{Fp:Q,Fn:C}=P,W=P.CURVE,{h:G}=W;FA(A,{},{uvRatio:"function"});let J=tQ<<BigInt(C.BYTES*8)-XT,$=(w)=>Q.create(w),X=A.uvRatio||((w,O)=>{try{return{isValid:!0,value:Q.sqrt(Q.div(w,O))}}catch(m){return{isValid:!1,value:MA}}});if(!mk(Q,W,W.Gx,W.Gy))throw Error("bad curve params: generator point");function Z(w,O,m=!1){let g=m?XT:MA;return U2("coordinate "+w,O,g,J),O}function R(w){if(!(w instanceof S))throw Error("ExtendedPoint expected")}let D=M8((w,O)=>{let{X:m,Y:g,Z:p}=w,c=w.is0();if(O==null)O=c?hk:Q.inv(p);let o=$(m*O),f=$(g*O),d=Q.mul(p,O);if(c)return{x:MA,y:XT};if(d!==XT)throw Error("invZ was invalid");return{x:o,y:f}}),z=M8((w)=>{let{a:O,d:m}=W;if(w.is0())throw Error("bad point: ZERO");let{X:g,Y:p,Z:c,T:o}=w,f=$(g*g),d=$(p*p),_=$(c*c),t=$(_*_),i=$(f*O),x=$(_*$(i+d)),k=$(t+$(m*$(f*d)));if(x!==k)throw Error("bad point: equation left != right (1)");let U=$(g*p),V=$(c*o);if(U!==V)throw Error("bad point: equation left != right (2)");return!0});class S{constructor(w,O,m,g){this.X=Z("x",w),this.Y=Z("y",O),this.Z=Z("z",m,!0),this.T=Z("t",g),Object.freeze(this)}static CURVE(){return W}static fromAffine(w){if(w instanceof S)throw Error("extended point not allowed");let{x:O,y:m}=w||{};return Z("x",O),Z("y",m),new S(O,m,XT,$(O*m))}static fromBytes(w,O=!1){let m=Q.BYTES,{a:g,d:p}=W;w=dQ(sT(w,m,"point")),t0(O,"zip215");let c=dQ(w),o=w[m-1];c[m-1]=o&-129;let f=e0(c),d=O?J:Q.ORDER;U2("point.y",f,MA,d);let _=$(f*f),t=$(_-XT),i=$(p*_-g),{isValid:x,value:k}=X(t,i);if(!x)throw Error("bad point: invalid y coordinate");let U=(k&XT)===XT,V=(o&128)!==0;if(!O&&k===MA&&V)throw Error("bad point: x=0 and x_0=1");if(V!==U)k=$(-k);return S.fromAffine({x:k,y:f})}static fromHex(w,O=!1){return S.fromBytes(q1("point",w),O)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(w=8,O=!0){if(E.createCache(this,w),!O)this.multiply(tQ);return this}assertValidity(){z(this)}equals(w){R(w);let{X:O,Y:m,Z:g}=this,{X:p,Y:c,Z:o}=w,f=$(O*o),d=$(p*g),_=$(m*o),t=$(c*g);return f===d&&_===t}is0(){return this.equals(S.ZERO)}negate(){return new S($(-this.X),this.Y,this.Z,$(-this.T))}double(){let{a:w}=W,{X:O,Y:m,Z:g}=this,p=$(O*O),c=$(m*m),o=$(tQ*$(g*g)),f=$(w*p),d=O+m,_=$($(d*d)-p-c),t=f+c,i=t-o,x=f-c,k=$(_*i),U=$(t*x),V=$(_*x),Y=$(i*t);return new S(k,U,Y,V)}add(w){R(w);let{a:O,d:m}=W,{X:g,Y:p,Z:c,T:o}=this,{X:f,Y:d,Z:_,T:t}=w,i=$(g*f),x=$(p*d),k=$(o*m*t),U=$(c*_),V=$((g+p)*(f+d)-i-x),Y=U-k,H=U+k,K=$(x-O*i),M=$(V*Y),I=$(H*K),j=$(V*K),q=$(Y*H);return new S(M,I,q,j)}subtract(w){return this.add(w.negate())}multiply(w){if(!C.isValidNot0(w))throw Error("invalid scalar: expected 1 <= sc < curve.n");let{p:O,f:m}=E.cached(this,w,(g)=>AA(S,g));return AA(S,[O,m])[0]}multiplyUnsafe(w,O=S.ZERO){if(!C.isValid(w))throw Error("invalid scalar: expected 0 <= sc < curve.n");if(w===MA)return S.ZERO;if(this.is0()||w===XT)return this;return E.unsafe(this,w,(m)=>AA(S,m),O)}isSmallOrder(){return this.multiplyUnsafe(G).is0()}isTorsionFree(){return E.unsafe(this,W.n).is0()}toAffine(w){return D(this,w)}clearCofactor(){if(G===XT)return this;return this.multiplyUnsafe(G)}toBytes(){let{x:w,y:O}=this.toAffine(),m=Q.toBytes(O);return m[m.length-1]|=w&XT?128:0,m}toHex(){return J0(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(w){return AA(S,w)}static msm(w,O){return I8(S,C,w,O)}_setWindowSize(w){this.precompute(w)}toRawBytes(){return this.toBytes()}}S.BASE=new S(W.Gx,W.Gy,XT,$(W.Gx*W.Gy)),S.ZERO=new S(MA,XT,XT,MA),S.Fp=Q,S.Fn=C;let E=new V2(S,C.BITS);return S.BASE.precompute(8),S}class eQ{constructor(T){this.ep=T}static fromBytes(T){rQ()}static fromHex(T){rQ()}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 J0(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 vk(T,A,P={}){if(typeof A!=="function")throw Error('"hash" function param is required');FA(P,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});let{prehash:Q}=P,{BASE:C,Fp:W,Fn:G}=T,J=P.randomBytes||D8,$=P.adjustScalarBytes||((_)=>_),X=P.domain||((_,t,i)=>{if(t0(i,"phflag"),t.length||i)throw Error("Contexts/pre-hash are not supported");return _});function Z(_){return G.create(e0(_))}function R(_){let t=g.secretKey;_=q1("private key",_,t);let i=q1("hashed private key",A(_),2*t),x=$(i.slice(0,t)),k=i.slice(t,2*t),U=Z(x);return{head:x,prefix:k,scalar:U}}function D(_){let{head:t,prefix:i,scalar:x}=R(_),k=C.multiply(x),U=k.toBytes();return{head:t,prefix:i,scalar:x,point:k,pointBytes:U}}function z(_){return D(_).pointBytes}function S(_=Uint8Array.of(),...t){let i=xT(...t);return Z(A(X(i,q1("context",_),!!Q)))}function E(_,t,i={}){if(_=q1("message",_),Q)_=Q(_);let{prefix:x,scalar:k,pointBytes:U}=D(t),V=S(i.context,x,_),Y=C.multiply(V).toBytes(),H=S(i.context,Y,U,_),K=G.create(V+H*k);if(!G.isValid(K))throw Error("sign failed: invalid s");let M=xT(Y,G.toBytes(K));return sT(M,g.signature,"result")}let w={zip215:!0};function O(_,t,i,x=w){let{context:k,zip215:U}=x,V=g.signature;if(_=q1("signature",_,V),t=q1("message",t),i=q1("publicKey",i,g.publicKey),U!==void 0)t0(U,"zip215");if(Q)t=Q(t);let Y=V/2,H=_.subarray(0,Y),K=e0(_.subarray(Y,V)),M,I,j;try{M=T.fromBytes(i,U),I=T.fromBytes(H,U),j=C.multiplyUnsafe(K)}catch(y){return!1}if(!U&&M.isSmallOrder())return!1;let q=S(k,I.toBytes(),M.toBytes(),t);return I.add(M.multiplyUnsafe(q)).subtract(j).clearCofactor().is0()}let m=W.BYTES,g={secretKey:m,publicKey:m,signature:2*m,seed:m};function p(_=J(g.seed)){return sT(_,g.seed,"seed")}function c(_){let t=d.randomSecretKey(_);return{secretKey:t,publicKey:z(t)}}function o(_){return i0(_)&&_.length===G.BYTES}function f(_,t){try{return!!T.fromBytes(_,t)}catch(i){return!1}}let d={getExtendedPublicKey:D,randomSecretKey:p,isValidSecretKey:o,isValidPublicKey:f,toMontgomery(_){let{y:t}=T.fromBytes(_),i=g.publicKey,x=i===32;if(!x&&i!==57)throw Error("only defined for 25519 and 448");let k=x?W.div(XT+t,XT-t):W.div(t-XT,t+XT);return W.toBytes(k)},toMontgomerySecret(_){let t=g.secretKey;sT(_,t);let i=A(_.subarray(0,t));return $(i).subarray(0,t)},randomPrivateKey:p,precompute(_=8,t=T.BASE){return t.precompute(_,!1)}};return Object.freeze({keygen:c,getPublicKey:z,sign:E,verify:O,utils:d,Point:T,lengths:g})}function yk(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},P=T.Fp,Q=tT(A.n,T.nBitLength,!0),C={Fp:P,Fn:Q,uvRatio:T.uvRatio},W={randomBytes:T.randomBytes,adjustScalarBytes:T.adjustScalarBytes,domain:T.domain,prehash:T.prehash,mapToCurve:T.mapToCurve};return{CURVE:A,curveOpts:C,hash:T.hash,eddsaOpts:W}}function bk(T,A){let P=A.Point;return Object.assign({},A,{ExtendedPoint:P,CURVE:T,nBitLength:P.Fn.BITS,nByteLength:P.Fn.BYTES})}function P9(T){let{CURVE:A,curveOpts:P,hash:Q,eddsaOpts:C}=yk(T),W=gk(A,P),G=vk(W,Q,C);return bk(T,G)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var lk=BigInt(0),PA=BigInt(1),Q9=BigInt(2),kO=BigInt(3),pk=BigInt(5),uk=BigInt(8),S8=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),q2=(()=>({p:S8,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:uk,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")}))();function dk(T){let A=BigInt(10),P=BigInt(20),Q=BigInt(40),C=BigInt(80),W=S8,J=T*T%W*T%W,$=R1(J,Q9,W)*J%W,X=R1($,PA,W)*T%W,Z=R1(X,pk,W)*X%W,R=R1(Z,A,W)*Z%W,D=R1(R,P,W)*R%W,z=R1(D,Q,W)*D%W,S=R1(z,C,W)*z%W,E=R1(S,C,W)*z%W,w=R1(E,A,W)*Z%W;return{pow_p_5_8:R1(w,Q9,W)*T%W,b2:J}}function rk(T){return T[0]&=248,T[31]&=127,T[31]|=64,T}var TC=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function QC(T,A){let P=S8,Q=M1(A*A*A,P),C=M1(Q*Q*A,P),W=dk(T*C).pow_p_5_8,G=M1(T*Q*W,P),J=M1(A*G*G,P),$=G,X=M1(G*TC,P),Z=J===T,R=J===M1(-T,P),D=J===M1(-T*TC,P);if(Z)G=$;if(R||D)G=X;if(TA(G,P))G=M1(-G,P);return{isValid:Z||R,value:G}}var zA=(()=>tT(q2.p,{isLE:!0}))(),ck=(()=>tT(q2.n,{isLE:!0}))(),ok=(()=>({...q2,Fp:zA,hash:m$,adjustScalarBytes:rk,uvRatio:QC}))(),cT=(()=>P9(ok))();var AC=TC,nk=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),fk=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),ik=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),ak=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),C9=(T)=>QC(PA,T),sk=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),PC=(T)=>cT.Point.Fp.create(e0(T)&sk);function W9(T){let{d:A}=q2,P=S8,Q=(O)=>zA.create(O),C=Q(AC*T*T),W=Q((C+PA)*ik),G=BigInt(-1),J=Q((G-A*C)*Q(C+A)),{isValid:$,value:X}=QC(W,J),Z=Q(X*T);if(!TA(Z,P))Z=Q(-Z);if(!$)X=Z;if(!$)G=C;let R=Q(G*(C-PA)*ak-J),D=X*X,z=Q((X+X)*J),S=Q(R*nk),E=Q(PA-D),w=Q(PA+D);return new cT.Point(Q(z*w),Q(E*S),Q(S*w),Q(z*E))}function tk(T){KT(T,64);let A=PC(T.subarray(0,32)),P=W9(A),Q=PC(T.subarray(32,64)),C=W9(Q);return new hT(P.add(C))}class hT extends eQ{constructor(T){super(T)}static fromAffine(T){return new hT(cT.Point.fromAffine(T))}assertSame(T){if(!(T instanceof hT))throw Error("RistrettoPoint expected")}init(T){return new hT(T)}static hashToCurve(T){return tk(q1("ristrettoHash",T,64))}static fromBytes(T){KT(T,32);let{a:A,d:P}=q2,Q=S8,C=(g)=>zA.create(g),W=PC(T);if(!v$(zA.toBytes(W),T)||TA(W,Q))throw Error("invalid ristretto255 encoding 1");let G=C(W*W),J=C(PA+A*G),$=C(PA-A*G),X=C(J*J),Z=C($*$),R=C(A*P*X-Z),{isValid:D,value:z}=C9(C(R*Z)),S=C(z*$),E=C(z*S*R),w=C((W+W)*S);if(TA(w,Q))w=C(-w);let O=C(J*E),m=C(w*O);if(!D||TA(m,Q)||O===lk)throw Error("invalid ristretto255 encoding 2");return new hT(new cT.Point(w,O,PA,m))}static fromHex(T){return hT.fromBytes(q1("ristrettoHex",T,32))}static msm(T,A){return I8(hT,cT.Point.Fn,T,A)}toBytes(){let{X:T,Y:A,Z:P,T:Q}=this.ep,C=S8,W=(E)=>zA.create(E),G=W(W(P+A)*W(P-A)),J=W(T*A),$=W(J*J),{value:X}=C9(W(G*$)),Z=W(X*G),R=W(X*J),D=W(Z*R*Q),z;if(TA(Q*D,C)){let E=W(A*AC),w=W(T*AC);T=E,A=w,z=W(Z*fk)}else z=R;if(TA(T*D,C))A=W(-A);let S=W((P-A)*z);if(TA(S,C))S=W(-S);return zA.toBytes(S)}equals(T){this.assertSame(T);let{X:A,Y:P}=this.ep,{X:Q,Y:C}=T.ep,W=($)=>zA.create($),G=W(A*C)===W(P*Q),J=W(P*C)===W(A*Q);return G||J}is0(){return this.equals(hT.ZERO)}}hT.BASE=(()=>new hT(cT.Point.BASE))();hT.ZERO=(()=>new hT(cT.Point.ZERO))();hT.Fp=(()=>zA)();hT.Fn=(()=>ck)();var qW=yT(WC(),1),nT=yT(UC(),1);var JC=y6;var g8=yT(j9(),1),N=yT(CA(),1),bV=yT(CA(),1);var yD=1,bD=2,lD=3,pD=4,uD=5,dD=6,rD=7,cD=8,oD=9,nD=10,fD=-32700,iD=-32603,aD=-32602,sD=-32601,tD=-32600,eD=-32016,TF=-32015,AF=-32014,PF=-32013,QF=-32012,CF=-32011,WF=-32010,GF=-32009,UF=-32008,JF=-32007,$F=-32006,VF=-32005,qF=-32004,YF=-32003,ZF=-32002,XF=-32001,HF=2800000,KF=2800001,RF=2800002,kF=2800003,jF=2800004,DF=2800005,FF=2800006,MF=2800007,zF=2800008,IF=2800009,SF=2800010,NF=2800011,wF=3230000,LF=32300001,EF=3230002,BF=3230003,OF=3230004,xF=3610000,_F=3610001,hF=3610002,mF=3610003,gF=3610004,vF=3610005,yF=3610006,bF=3610007,lF=3611000,pF=3704000,uF=3704001,dF=3704002,rF=3704003,cF=3704004,oF=4128000,nF=4128001,fF=4128002,iF=4615000,aF=4615001,sF=4615002,tF=4615003,eF=4615004,T5=4615005,A5=4615006,P5=4615007,Q5=4615008,C5=4615009,W5=4615010,G5=4615011,U5=4615012,J5=4615013,$5=4615014,V5=4615015,q5=4615016,Y5=4615017,Z5=4615018,X5=4615019,H5=4615020,K5=4615021,R5=4615022,k5=4615023,j5=4615024,D5=4615025,F5=4615026,M5=4615027,z5=4615028,I5=4615029,S5=4615030,N5=4615031,w5=4615032,L5=4615033,E5=4615034,B5=4615035,O5=4615036,x5=4615037,_5=4615038,h5=4615039,m5=4615040,g5=4615041,v5=4615042,y5=4615043,b5=4615044,l5=4615045,p5=4615046,u5=4615047,d5=4615048,r5=4615049,c5=4615050,o5=4615051,n5=4615052,f5=4615053,i5=4615054,a5=5508000,s5=5508001,t5=5508002,e5=5508003,T7=5508004,A7=5508005,P7=5508006,Q7=5508007,C7=5508008,W7=5508009,G7=5508010,U7=5508011,J7=5663000,$7=5663001,V7=5663002,q7=5663003,Y7=5663004,Z7=5663005,X7=5663006,H7=5663007,K7=5663008,R7=5663009,k7=5663010,j7=5663011,D7=5663012,F7=5663013,M7=5663014,z7=5663015,I7=5663016,S7=5663017,N7=5663018,w7=5663019,L7=5663020,E7=7050000,B7=7050001,O7=7050002,x7=7050003,_7=7050004,h7=7050005,m7=7050006,g7=7050007,v7=7050008,y7=7050009,b7=7050010,l7=7050011,p7=7050012,u7=7050013,d7=7050014,r7=7050015,c7=7050016,o7=7050017,n7=7050018,f7=7050019,i7=7050020,a7=7050021,s7=7050022,t7=7050023,e7=7050024,TM=7050025,AM=7050026,PM=7050027,QM=7050028,CM=7050029,WM=7050030,GM=7050031,UM=7050032,JM=7050033,$M=7050034,VM=7050035,qM=7050036,hC=8078000,mC=8078001,z9=8078002,I9=8078003,gC=8078004,vC=8078005,yC=8078006,YM=8078007,ZM=8078008,XM=8078009,HM=8078010,bC=8078011,KM=8078012,S9=8078013,N9=8078014,RM=8078015,kM=8078016,jM=8078017,DM=8078018,FM=8078019,w9=8078020,L9=8078021,MM=8078022,zM=8100000,IM=8100001,SM=8100002,NM=8100003,wM=8190000,LM=8190001,EM=8190002,BM=8190003,OM=8190004,xM=9900000,_M=9900001,hM=9900002,mM=9900003,gM=9900004;var vM={[wF]:"Account not found at address: $address",[OF]:"Not all accounts were decoded. Encoded accounts found at addresses: $addresses.",[BF]:"Expected decoded account at address: $address",[EF]:"Failed to decode account data at address: $address",[LF]:"Accounts not found at addresses: $addresses",[IF]:"Unable to find a viable program address bump seed.",[RF]:"$putativeAddress is not a base58-encoded address.",[HF]:"Expected base58 encoded address to decode to a byte array of length 32. Actual length: $actualLength.",[kF]:"The `CryptoKey` must be an `Ed25519` public key.",[NF]:"$putativeOffCurveAddress is not a base58-encoded off-curve address.",[zF]:"Invalid seeds; point must fall off the Ed25519 curve.",[jF]:"Expected given program derived address to have the following format: [Address, ProgramDerivedAddressBump].",[FF]:"A maximum of $maxSeeds seeds, including the bump seed, may be supplied when creating an address. Received: $actual.",[MF]:"The seed at index $index with length $actual exceeds the maximum length of $maxSeedLength bytes.",[DF]:"Expected program derived address bump to be in the range [0, 255], got: $bump.",[SF]:"Program address cannot end with PDA marker.",[KF]:"Expected base58-encoded address string of length in the range [32, 44]. Actual length: $actualLength.",[pD]:"Expected base58-encoded blockash string of length in the range [32, 44]. Actual length: $actualLength.",[yD]:"The network has progressed past the last block for which this transaction could have been committed.",[hC]:"Codec [$codecDescription] cannot decode empty byte arrays.",[MM]:"Enum codec cannot use lexical values [$stringValues] as discriminators. Either remove all lexical values or set `useValuesAsDiscriminators` to `false`.",[w9]:"Sentinel [$hexSentinel] must not be present in encoded bytes [$hexEncodedBytes].",[vC]:"Encoder and decoder must have the same fixed size, got [$encoderFixedSize] and [$decoderFixedSize].",[yC]:"Encoder and decoder must have the same max size, got [$encoderMaxSize] and [$decoderMaxSize].",[gC]:"Encoder and decoder must either both be fixed-size or variable-size.",[ZM]:"Enum discriminator out of range. Expected a number in [$formattedValidDiscriminators], got $discriminator.",[z9]:"Expected a fixed-size codec, got a variable-size one.",[S9]:"Codec [$codecDescription] expected a positive byte length, got $bytesLength.",[I9]:"Expected a variable-size codec, got a fixed-size one.",[FM]:"Codec [$codecDescription] expected zero-value [$hexZeroValue] to have the same size as the provided fixed-size item [$expectedSize bytes].",[mC]:"Codec [$codecDescription] expected $expected bytes, got $bytesLength.",[DM]:"Expected byte array constant [$hexConstant] to be present in data [$hexData] at offset [$offset].",[XM]:"Invalid discriminated union variant. Expected one of [$variants], got $value.",[HM]:"Invalid enum variant. Expected one of [$stringValues] or a number in [$formattedNumericalValues], got $variant.",[RM]:"Invalid literal union variant. Expected one of [$variants], got $value.",[YM]:"Expected [$codecDescription] to have $expected items, got $actual.",[KM]:"Invalid value $value for base $base with alphabet $alphabet.",[kM]:"Literal union discriminator out of range. Expected a number between $minRange and $maxRange, got $discriminator.",[bC]:"Codec [$codecDescription] expected number to be in the range [$min, $max], got $value.",[N9]:"Codec [$codecDescription] expected offset to be in the range [0, $bytesLength], got $offset.",[L9]:"Expected sentinel [$hexSentinel] to be present in decoded bytes [$hexDecodedBytes].",[jM]:"Union variant out of range. Expected an index between $minRange and $maxRange, got $variant.",[lF]:"No random values implementation could be found.",[C5]:"instruction requires an uninitialized account",[k5]:"instruction tries to borrow reference for an account which is already borrowed",[j5]:"instruction left account with an outstanding borrowed reference",[K5]:"program other than the account's owner changed the size of the account data",[T5]:"account data too small for instruction",[R5]:"instruction expected an executable account",[p5]:"An account does not have enough lamports to be rent-exempt",[d5]:"Program arithmetic overflowed",[l5]:"Failed to serialize or deserialize account data: $encodedData",[i5]:"Builtin programs must consume compute units",[w5]:"Cross-program invocation call depth too deep",[_5]:"Computational budget exceeded",[F5]:"custom program error: #$code",[Y5]:"instruction contains duplicate accounts",[D5]:"instruction modifications of multiply-passed account differ",[S5]:"executable accounts must be rent exempt",[z5]:"instruction changed executable accounts data",[I5]:"instruction changed the balance of an executable account",[Z5]:"instruction changed executable bit of an account",[$5]:"instruction modified data of an account it does not own",[J5]:"instruction spent from the balance of an account it does not own",[aF]:"generic instruction error",[c5]:"Provided owner is not allowed",[y5]:"Account is immutable",[b5]:"Incorrect authority provided",[P5]:"incorrect program id for instruction",[A5]:"insufficient funds for instruction",[eF]:"invalid account data for instruction",[u5]:"Invalid account owner",[sF]:"invalid program argument",[M5]:"program returned invalid error code",[tF]:"invalid instruction data",[x5]:"Failed to reallocate account data",[O5]:"Provided seeds do not result in a valid address",[o5]:"Accounts data allocations exceeded the maximum allowed per transaction",[n5]:"Max accounts exceeded",[f5]:"Max instruction trace length exceeded",[B5]:"Length of the seed is too long for address generation",[L5]:"An account required by the instruction is missing",[Q5]:"missing required signature for instruction",[U5]:"instruction illegally modified the program id of an account",[H5]:"insufficient account keys for instruction",[h5]:"Cross-program invocation with unauthorized signer or writable account",[m5]:"Failed to create program execution environment",[v5]:"Program failed to compile",[g5]:"Program failed to complete",[q5]:"instruction modified data of a read-only account",[V5]:"instruction changed the balance of a read-only account",[E5]:"Cross-program invocation reentrancy not allowed for this instruction",[X5]:"instruction modified rent epoch of an account",[G5]:"sum of account balances before and after instruction do not match",[W5]:"instruction requires an initialized account",[iF]:"",[N5]:"Unsupported program id",[r5]:"Unsupported sysvar",[oF]:"The instruction does not have any accounts.",[nF]:"The instruction does not have any data.",[fF]:"Expected instruction to have progress address $expectedProgramAddress, got $actualProgramAddress.",[uD]:"Expected base58 encoded blockhash to decode to a byte array of length 32. Actual length: $actualLength.",[bD]:"The nonce `$expectedNonceValue` is no longer valid. It has advanced to `$actualNonceValue`",[hM]:"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",[gM]:"Invariant violation: This data publisher does not publish to the channel named `$channelName`. Supported channels include $supportedChannelNames.",[_M]:"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",[xM]:"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",[mM]:"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",[iD]:"JSON-RPC error: Internal JSON-RPC error ($__serverMessage)",[aD]:"JSON-RPC error: Invalid method parameter(s) ($__serverMessage)",[tD]:"JSON-RPC error: The JSON sent is not a valid `Request` object ($__serverMessage)",[sD]:"JSON-RPC error: The method does not exist / is not available ($__serverMessage)",[fD]:"JSON-RPC error: An error occurred on the server while parsing the JSON text ($__serverMessage)",[QF]:"$__serverMessage",[XF]:"$__serverMessage",[qF]:"$__serverMessage",[AF]:"$__serverMessage",[WF]:"$__serverMessage",[GF]:"$__serverMessage",[eD]:"Minimum context slot has not been reached",[VF]:"Node is unhealthy; behind by $numSlotsBehind slots",[UF]:"No snapshot",[ZF]:"Transaction simulation failed",[JF]:"$__serverMessage",[CF]:"Transaction history is not available from this node",[$F]:"$__serverMessage",[PF]:"Transaction signature length mismatch",[YF]:"Transaction signature verification failure",[TF]:"$__serverMessage",[pF]:"Key pair bytes must be of length 64, got $byteLength.",[uF]:"Expected private key bytes with length 32. Actual length: $actualLength.",[dF]:"Expected base58-encoded signature to decode to a byte array of length 64. Actual length: $actualLength.",[cF]:"The provided private key does not match the provided public key.",[rF]:"Expected base58-encoded signature string of length in the range [64, 88]. Actual length: $actualLength.",[dD]:"Lamports value must be in the range [0, 2e64-1]",[rD]:"`$value` cannot be parsed as a `BigInt`",[nD]:"$message",[cD]:"`$value` cannot be parsed as a `Number`",[lD]:"No nonce account could be found at address `$nonceAccountAddress`",[wM]:"The notification name must end in 'Notifications' and the API must supply a subscription plan creator function for the notification '$notificationName'.",[EM]:"WebSocket was closed before payload could be added to the send buffer",[BM]:"WebSocket connection closed",[OM]:"WebSocket failed to connect",[LM]:"Failed to obtain a subscription id from the server",[NM]:"Could not find an API plan for RPC method: `$method`",[zM]:"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`.",[SM]:"HTTP error ($statusCode): $message",[IM]:"HTTP header(s) forbidden: $headers. Learn more at https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name.",[a5]:"Multiple distinct signers were identified for address `$address`. Please ensure that you are using the same signer instance for each address.",[s5]:"The provided value does not implement the `KeyPairSigner` interface",[e5]:"The provided value does not implement the `MessageModifyingSigner` interface",[T7]:"The provided value does not implement the `MessagePartialSigner` interface",[t5]:"The provided value does not implement any of the `MessageSigner` interfaces",[P7]:"The provided value does not implement the `TransactionModifyingSigner` interface",[Q7]:"The provided value does not implement the `TransactionPartialSigner` interface",[C7]:"The provided value does not implement the `TransactionSendingSigner` interface",[A7]:"The provided value does not implement any of the `TransactionSigner` interfaces",[W7]:"More than one `TransactionSendingSigner` was identified.",[G7]:"No `TransactionSendingSigner` was identified. Please provide a valid `TransactionWithSingleSendingSigner` transaction.",[U7]:"Wallet account signers do not support signing multiple messages/transactions in a single operation",[bF]:"Cannot export a non-extractable key.",[_F]:"No digest implementation could be found.",[xF]:"Cryptographic operations are only allowed in secure browser contexts. Read more here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts.",[hF]:`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.`,[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.
|
|
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.`,[mF]:"No signature verification implementation could be found.",[gF]:"No key generation implementation could be found.",[vF]:"No signing implementation could be found.",[yF]:"No key export implementation could be found.",[oD]:"Timestamp value must be in the range [-(2n ** 63n), (2n ** 63n) - 1]. `$value` given",[c7]:"Transaction processing left an account with an outstanding borrowed reference",[B7]:"Account in use",[O7]:"Account loaded twice",[x7]:"Attempt to debit an account but found no record of a prior credit.",[t7]:"Transaction loads an address table account that doesn't exist",[g7]:"This transaction has already been processed",[v7]:"Blockhash not found",[y7]:"Loader call chain is too deep",[r7]:"Transactions are currently disabled due to cluster maintenance",[WM]:"Transaction contains a duplicate instruction ($index) that is not allowed",[h7]:"Insufficient funds for fee",[GM]:"Transaction results in an account ($accountIndex) with insufficient funds for rent",[m7]:"This account may not be used to pay transaction fees",[l7]:"Transaction contains an invalid account reference",[TM]:"Transaction loads an address table account with invalid data",[AM]:"Transaction address table lookup uses an invalid index",[e7]:"Transaction loads an address table account with an invalid owner",[JM]:"LoadedAccountsDataSizeLimit set for transaction must be greater than 0.",[u7]:"This program may not be used for executing instructions",[PM]:"Transaction leaves an account with a lower balance than rent-exempt minimum",[f7]:"Transaction loads a writable account that cannot be written",[UM]:"Transaction exceeded max loaded accounts data size cap",[b7]:"Transaction requires a fee but has no signature present",[_7]:"Attempt to load a program that does not exist",[VM]:"Execution of the program referenced by account at index $accountIndex is temporarily restricted.",[$M]:"ResanitizationNeeded",[d7]:"Transaction failed to sanitize accounts offsets correctly",[p7]:"Transaction did not pass signature verification",[s7]:"Transaction locked too many accounts",[qM]:"Sum of account balances before and after transaction do not match",[E7]:"The transaction failed with the error `$errorName`",[n7]:"Transaction version is unsupported",[a7]:"Transaction would exceed account data limit within the block",[CM]:"Transaction would exceed total account data limit",[i7]:"Transaction would exceed max account limit within the block",[o7]:"Transaction would exceed max Block Cost Limit",[QM]:"Transaction would exceed max Vote Cost Limit",[z7]:"Attempted to sign a transaction with an address that is not a signer for it",[k7]:"Transaction is missing an address at index: $index.",[I7]:"Transaction has no expected signers therefore it cannot be encoded",[L7]:"Transaction size $transactionSize exceeds limit of $transactionSizeLimit bytes",[V7]:"Transaction does not have a blockhash lifetime",[q7]:"Transaction is not a durable nonce transaction",[Z7]:"Contents of these address lookup tables unknown: $lookupTableAddresses",[X7]:"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",[K7]:"No fee payer set in CompiledTransaction",[H7]:"Could not find program address at index $index",[N7]:"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",[w7]:"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",[j7]:"Transaction is missing a fee payer.",[D7]:"Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer.",[M7]:"Transaction first instruction is not advance nonce account instruction.",[F7]:"Transaction with no instructions cannot be durable nonce transaction.",[J7]:"This transaction includes an address (`$programAddress`) which is both invoked and set as the fee payer. Program addresses may not pay fees",[$7]:"This transaction includes an address (`$programAddress`) which is both invoked and marked writable. Program addresses may not be writable",[S7]:"The transaction message expected the transaction to have $signerAddressesLength signatures, got $signaturesLength.",[R7]:"Transaction is missing signatures for addresses: $addresses.",[Y7]:"Transaction version must be in the range [0, 127]. `$actualVersion` given"},WA="i",g0="t";function yM(T,A={}){let P=vM[T];if(P.length===0)return"";let Q;function C(G){if(Q[g0]===2){let J=P.slice(Q[WA]+1,G);W.push(J in A?`${A[J]}`:`$${J}`)}else if(Q[g0]===1)W.push(P.slice(Q[WA],G))}let W=[];return P.split("").forEach((G,J)=>{if(J===0){Q={[WA]:0,[g0]:P[0]==="\\"?0:P[0]==="$"?2:1};return}let $;switch(Q[g0]){case 0:$={[WA]:J,[g0]:1};break;case 1:if(G==="\\")$={[WA]:J,[g0]:0};else if(G==="$")$={[WA]:J,[g0]:2};break;case 2:if(G==="\\")$={[WA]:J,[g0]:0};else if(G==="$")$={[WA]:J,[g0]:2};else if(!G.match(/\w/))$={[WA]:J,[g0]:1};break}if($){if(Q!==$)C(J);Q=$}}),C(),W.join("")}function bM(T,A={}){return yM(T,A)}var NA=class extends Error{cause=this.cause;context;constructor(...[T,A]){let P,Q;if(A){let{cause:W,...G}=A;if(W)Q={cause:W};if(Object.keys(G).length>0)P=G}let C=bM(T,P);super(C,Q);this.context={__code:T,...P},this.name="SolanaError"}};function lM(T,A){return"fixedSize"in A?A.fixedSize:A.getSizeFromValue(T)}function E9(T){return Object.freeze({...T,encode:(A)=>{let P=new Uint8Array(lM(A,T));return T.write(A,P,0),P}})}function B9(T){return Object.freeze({...T,decode:(A,P=0)=>T.read(A,P)[0]})}function E8(T){return"fixedSize"in T&&typeof T.fixedSize==="number"}function O9(T,A){if(E8(T)!==E8(A))throw new NA(gC);if(E8(T)&&E8(A)&&T.fixedSize!==A.fixedSize)throw new NA(vC,{decoderFixedSize:A.fixedSize,encoderFixedSize:T.fixedSize});if(!E8(T)&&!E8(A)&&T.maxSize!==A.maxSize)throw new NA(yC,{decoderMaxSize:A.maxSize,encoderMaxSize:T.maxSize});return{...A,...T,decode:A.decode,encode:T.encode,read:A.read,write:T.write}}function x9(T,A,P=0){if(A.length-P<=0)throw new NA(hC,{codecDescription:T})}function _9(T,A,P,Q=0){let C=P.length-Q;if(C<A)throw new NA(mC,{bytesLength:C,codecDescription:T,expected:A})}function pM(T,A,P,Q){if(Q<A||Q>P)throw new NA(bC,{codecDescription:T,max:P,min:A,value:Q})}function h9(T){return T?.endian===1?!1:!0}function uM(T){return E9({fixedSize:T.size,write(A,P,Q){if(T.range)pM(T.name,T.range[0],T.range[1],A);let C=new ArrayBuffer(T.size);return T.set(new DataView(C),A,h9(T.config)),P.set(new Uint8Array(C),Q),Q+T.size}})}function dM(T){return B9({fixedSize:T.size,read(A,P=0){x9(T.name,A,P),_9(T.name,T.size,A,P);let Q=new DataView(rM(A,P,T.size));return[T.get(Q,h9(T.config)),P+T.size]}})}function rM(T,A,P){let Q=T.byteOffset+(A??0),C=P??T.byteLength;return T.buffer.slice(Q,Q+C)}var lC=(T={})=>uM({config:T,name:"u64",range:[0n,BigInt("0xffffffffffffffff")],set:(A,P,Q)=>A.setBigUint64(0,BigInt(P),Q),size:8}),cM=(T={})=>dM({config:T,get:(A,P)=>A.getBigUint64(0,P),name:"u64",size:8}),m9=(T={})=>O9(lC(T),cM(T));class v9 extends TypeError{constructor(T,A){let P,{message:Q,explanation:C,...W}=T,{path:G}=T,J=G.length===0?Q:`At path: ${G.join(".")} -- ${Q}`;super(C??J);if(C!=null)this.cause=J;Object.assign(this,W),this.name=this.constructor.name,this.failures=()=>{return P??(P=[T,...A()])}}}function oM(T){return Z2(T)&&typeof T[Symbol.iterator]==="function"}function Z2(T){return typeof T==="object"&&T!=null}function Q4(T){return Z2(T)&&!Array.isArray(T)}function Y0(T){if(typeof T==="symbol")return T.toString();return typeof T==="string"?JSON.stringify(T):`${T}`}function nM(T){let{done:A,value:P}=T.next();return A?void 0:P}function fM(T,A,P,Q){if(T===!0)return;else if(T===!1)T={};else if(typeof T==="string")T={message:T};let{path:C,branch:W}=A,{type:G}=P,{refinement:J,message:$=`Expected a value of type \`${G}\`${J?` with refinement \`${J}\``:""}, but received: \`${Y0(Q)}\``}=T;return{value:Q,type:G,refinement:J,key:C[C.length-1],path:C,branch:W,...T,message:$}}function*g9(T,A,P,Q){if(!oM(T))T=[T];for(let C of T){let W=fM(C,A,P,Q);if(W)yield W}}function*pC(T,A,P={}){let{path:Q=[],branch:C=[T],coerce:W=!1,mask:G=!1}=P,J={path:Q,branch:C,mask:G};if(W)T=A.coercer(T,J);let $="valid";for(let X of A.validator(T,J))X.explanation=P.message,$="not_valid",yield[X,void 0];for(let[X,Z,R]of A.entries(T,J)){let D=pC(Z,R,{path:X===void 0?Q:[...Q,X],branch:X===void 0?C:[...C,Z],coerce:W,mask:G,message:P.message});for(let z of D)if(z[0])$=z[0].refinement!=null?"not_refined":"not_valid",yield[z[0],void 0];else if(W){if(Z=z[1],X===void 0)T=Z;else if(T instanceof Map)T.set(X,Z);else if(T instanceof Set)T.add(Z);else if(Z2(T)){if(Z!==void 0||X in T)T[X]=Z}}}if($!=="not_valid")for(let X of A.refiner(T,J))X.explanation=P.message,$="not_refined",yield[X,void 0];if($==="valid")yield[void 0,T]}class Z0{constructor(T){let{type:A,schema:P,validator:Q,refiner:C,coercer:W=(J)=>J,entries:G=function*(){}}=T;if(this.type=A,this.schema=P,this.entries=G,this.coercer=W,Q)this.validator=(J,$)=>{let X=Q(J,$);return g9(X,$,this,J)};else this.validator=()=>[];if(C)this.refiner=(J,$)=>{let X=C(J,$);return g9(X,$,this,J)};else this.refiner=()=>[]}assert(T,A){return y9(T,this,A)}create(T,A){return B8(T,this,A)}is(T){return b9(T,this)}mask(T,A){return iM(T,this,A)}validate(T,A={}){return X2(T,this,A)}}function y9(T,A,P){let Q=X2(T,A,{message:P});if(Q[0])throw Q[0]}function B8(T,A,P){let Q=X2(T,A,{coerce:!0,message:P});if(Q[0])throw Q[0];else return Q[1]}function iM(T,A,P){let Q=X2(T,A,{coerce:!0,mask:!0,message:P});if(Q[0])throw Q[0];else return Q[1]}function b9(T,A){return!X2(T,A)[0]}function X2(T,A,P={}){let Q=pC(T,A,P),C=nM(Q);if(C[0])return[new v9(C[0],function*(){for(let G of Q)if(G[0])yield G[0]}),void 0];else return[void 0,C[1]]}function T8(T,A){return new Z0({type:T,schema:null,validator:A})}function l9(){return T8("any",()=>!0)}function a(T){return new Z0({type:"array",schema:T,*entries(A){if(T&&Array.isArray(A))for(let[P,Q]of A.entries())yield[P,Q,T]},coercer(A){return Array.isArray(A)?A.slice():A},validator(A){return Array.isArray(A)||`Expected an array value, but received: ${Y0(A)}`}})}function X0(){return T8("boolean",(T)=>{return typeof T==="boolean"})}function C4(T){return T8("instance",(A)=>{return A instanceof T||`Expected a \`${T.name}\` instance, but received: ${Y0(A)}`})}function k1(T){let A=Y0(T),P=typeof T;return new Z0({type:"literal",schema:P==="string"||P==="number"||P==="boolean"?T:null,validator(Q){return Q===T||`Expected the literal \`${A}\`, but received: ${Y0(Q)}`}})}function aM(){return T8("never",()=>!1)}function s(T){return new Z0({...T,validator:(A,P)=>A===null||T.validator(A,P),refiner:(A,P)=>A===null||T.refiner(A,P)})}function B(){return T8("number",(T)=>{return typeof T==="number"&&!isNaN(T)||`Expected a number, but received: ${Y0(T)}`})}function A1(T){return new Z0({...T,validator:(A,P)=>A===void 0||T.validator(A,P),refiner:(A,P)=>A===void 0||T.refiner(A,P)})}function uC(T,A){return new Z0({type:"record",schema:null,*entries(P){if(Z2(P))for(let Q in P){let C=P[Q];yield[Q,Q,T],yield[Q,C,A]}},validator(P){return Q4(P)||`Expected an object, but received: ${Y0(P)}`},coercer(P){return Q4(P)?{...P}:P}})}function l(){return T8("string",(T)=>{return typeof T==="string"||`Expected a string, but received: ${Y0(T)}`})}function W4(T){let A=aM();return new Z0({type:"tuple",schema:null,*entries(P){if(Array.isArray(P)){let Q=Math.max(T.length,P.length);for(let C=0;C<Q;C++)yield[C,P[C],T[C]||A]}},validator(P){return Array.isArray(P)||`Expected an array, but received: ${Y0(P)}`},coercer(P){return Array.isArray(P)?P.slice():P}})}function v(T){let A=Object.keys(T);return new Z0({type:"type",schema:T,*entries(P){if(Z2(P))for(let Q of A)yield[Q,P[Q],T[Q]]},validator(P){return Q4(P)||`Expected an object, but received: ${Y0(P)}`},coercer(P){return Q4(P)?{...P}:P}})}function IT(T){let A=T.map((P)=>P.type).join(" | ");return new Z0({type:"union",schema:null,coercer(P,Q){for(let C of T){let[W,G]=C.validate(P,{coerce:!0,mask:Q.mask});if(!W)return G}return P},validator(P,Q){let C=[];for(let W of T){let[...G]=pC(P,W,Q),[J]=G;if(!J[0])return[];else for(let[$]of G)if($)C.push($)}return[`Expected the value to satisfy a union of \`${A}\`, but received: ${Y0(P)}`,...C]}})}function A8(){return T8("unknown",()=>!0)}function O8(T,A,P){return new Z0({...T,coercer:(Q,C)=>{return b9(Q,A)?T.coercer(P(Q,C),C):T.coercer(Q,C)}})}var uz=yT($V(),1);j8();var YV=yT(qV(),1);var zz=BigInt(0),M2=BigInt(1),Iz=BigInt(2),Sz=BigInt(7),Nz=BigInt(256),wz=BigInt(113),HV=[],KV=[],RV=[];for(let T=0,A=M2,P=1,Q=0;T<24;T++){[P,Q]=[Q,(2*P+3*Q)%5],HV.push(2*(5*Q+P)),KV.push((T+1)*(T+2)/2%64);let C=zz;for(let W=0;W<7;W++)if(A=(A<<M2^(A>>Sz)*wz)%Nz,A&Iz)C^=M2<<(M2<<BigInt(W))-M2;RV.push(C)}var kV=v6(RV,!0),Lz=kV[0],Ez=kV[1],ZV=(T,A,P)=>P>32?S$(T,A,P):z$(T,A,P),XV=(T,A,P)=>P>32?N$(T,A,P):I$(T,A,P);function Bz(T,A=24){let P=new Uint32Array(10);for(let Q=24-A;Q<24;Q++){for(let G=0;G<10;G++)P[G]=T[G]^T[G+10]^T[G+20]^T[G+30]^T[G+40];for(let G=0;G<10;G+=2){let J=(G+8)%10,$=(G+2)%10,X=P[$],Z=P[$+1],R=ZV(X,Z,1)^P[J],D=XV(X,Z,1)^P[J+1];for(let z=0;z<50;z+=10)T[G+z]^=R,T[G+z+1]^=D}let C=T[2],W=T[3];for(let G=0;G<24;G++){let J=KV[G],$=ZV(C,W,J),X=XV(C,W,J),Z=HV[G];C=T[Z],W=T[Z+1],T[Z]=$,T[Z+1]=X}for(let G=0;G<50;G+=10){for(let J=0;J<10;J++)P[J]=T[G+J];for(let J=0;J<10;J++)T[G+J]^=~P[(J+2)%10]&P[(J+4)%10]}T[0]^=Lz[Q],T[1]^=Ez[Q]}U0(P)}class eC extends cA{constructor(T,A,P,Q=!1,C=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=P,this.enableXOF=Q,this.rounds=C,KA(P),!(0<T&&T<200))throw Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=k$(this.state)}clone(){return this._cloneInto()}keccak(){hQ(this.state32),Bz(this.state32,this.rounds),hQ(this.state32),this.posOut=0,this.pos=0}update(T){a0(this),T=rA(T),KT(T);let{blockLen:A,state:P}=this,Q=T.length;for(let C=0;C<Q;){let W=Math.min(A-this.pos,Q-C);for(let G=0;G<W;G++)P[this.pos++]^=T[C++];if(this.pos===A)this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:T,suffix:A,pos:P,blockLen:Q}=this;if(T[P]^=A,(A&128)!==0&&P===Q-1)this.keccak();T[Q-1]^=128,this.keccak()}writeInto(T){a0(this,!1),KT(T),this.finish();let A=this.state,{blockLen:P}=this;for(let Q=0,C=T.length;Q<C;){if(this.posOut>=P)this.keccak();let W=Math.min(P-this.posOut,C-Q);T.set(A.subarray(this.posOut,this.posOut+W),Q),this.posOut+=W,Q+=W}return T}xofInto(T){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(T)}xof(T){return KA(T),this.xofInto(new Uint8Array(T))}digestInto(T){if(_6(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,U0(this.state)}_cloneInto(T){let{blockLen:A,suffix:P,outputLen:Q,rounds:C,enableXOF:W}=this;return T||(T=new eC(A,P,Q,W,C)),T.state32.set(this.state32),T.pos=this.pos,T.posOut=this.posOut,T.finished=this.finished,T.rounds=C,T.suffix=P,T.outputLen=Q,T.enableXOF=W,T.destroyed=this.destroyed,T}}var Oz=(T,A,P)=>Q2(()=>new eC(A,T,P));var TW=(()=>Oz(1,136,32))();class AW extends cA{constructor(T,A){super();this.finished=!1,this.destroyed=!1,x6(T);let P=rA(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 Q=this.blockLen,C=new Uint8Array(Q);C.set(P.length>Q?T.create().update(P).digest():P);for(let W=0;W<C.length;W++)C[W]^=54;this.iHash.update(C),this.oHash=T.create();for(let W=0;W<C.length;W++)C[W]^=106;this.oHash.update(C),U0(C)}update(T){return a0(this),this.iHash.update(T),this}digestInto(T){a0(this),KT(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:P,finished:Q,destroyed:C,blockLen:W,outputLen:G}=this;return T=T,T.finished=Q,T.destroyed=C,T.blockLen=W,T.outputLen=G,T.oHash=A._cloneInto(T.oHash),T.iHash=P._cloneInto(T.iHash),T}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}var PW=(T,A,P)=>new AW(T,A).update(P).digest();PW.create=(T,A)=>new AW(T,A);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var jV=(T,A)=>(T+(T>=0?A:-A)/FV)/A;function xz(T,A,P){let[[Q,C],[W,G]]=A,J=jV(G*T,P),$=jV(-C*T,P),X=T-J*Q-$*W,Z=-J*C-$*G,R=X<UA,D=Z<UA;if(R)X=-X;if(D)Z=-Z;let z=DA(Math.ceil(l6(P)/2))+_8;if(X<UA||X>=z||Z<UA||Z>=z)throw Error("splitScalar (endomorphism): failed, k="+T);return{k1neg:R,k1:X,k2neg:D,k2:Z}}function CW(T){if(!["compact","recovered","der"].includes(T))throw Error('Signature format must be "compact", "recovered", or "der"');return T}function QW(T,A){let P={};for(let Q of Object.keys(A))P[Q]=T[Q]===void 0?A[Q]:T[Q];if(t0(P.lowS,"lowS"),t0(P.prehash,"prehash"),P.format!==void 0)CW(P.format);return P}class DV extends Error{constructor(T=""){super(T)}}var GA={Err:DV,_tlv:{encode:(T,A)=>{let{Err:P}=GA;if(T<0||T>256)throw new P("tlv.encode: wrong tag");if(A.length&1)throw new P("tlv.encode: unpadded data");let Q=A.length/2,C=G2(Q);if(C.length/2&128)throw new P("tlv.encode: long form length too big");let W=Q>127?G2(C.length/2|128):"";return G2(T)+W+C+A},decode(T,A){let{Err:P}=GA,Q=0;if(T<0||T>256)throw new P("tlv.encode: wrong tag");if(A.length<2||A[Q++]!==T)throw new P("tlv.decode: wrong tlv");let C=A[Q++],W=!!(C&128),G=0;if(!W)G=C;else{let $=C&127;if(!$)throw new P("tlv.decode(long): indefinite length not supported");if($>4)throw new P("tlv.decode(long): byte length is too big");let X=A.subarray(Q,Q+$);if(X.length!==$)throw new P("tlv.decode: length bytes not complete");if(X[0]===0)throw new P("tlv.decode(long): zero leftmost byte");for(let Z of X)G=G<<8|Z;if(Q+=$,G<128)throw new P("tlv.decode(long): not minimal encoding")}let J=A.subarray(Q,Q+G);if(J.length!==G)throw new P("tlv.decode: wrong value length");return{v:J,l:A.subarray(Q+G)}}},_int:{encode(T){let{Err:A}=GA;if(T<UA)throw new A("integer: negative integers are not allowed");let P=G2(T);if(Number.parseInt(P[0],16)&8)P="00"+P;if(P.length&1)throw new A("unexpected DER parsing assertion: unpadded hex");return P},decode(T){let{Err:A}=GA;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 F8(T)}},toSig(T){let{Err:A,_int:P,_tlv:Q}=GA,C=q1("signature",T),{v:W,l:G}=Q.decode(48,C);if(G.length)throw new A("invalid signature: left bytes after parsing");let{v:J,l:$}=Q.decode(2,W),{v:X,l:Z}=Q.decode(2,$);if(Z.length)throw new A("invalid signature: left bytes after parsing");return{r:P.decode(J),s:P.decode(X)}},hexFromSig(T){let{_tlv:A,_int:P}=GA,Q=A.encode(2,P.encode(T.r)),C=A.encode(2,P.encode(T.s)),W=Q+C;return A.encode(48,W)}},UA=BigInt(0),_8=BigInt(1),FV=BigInt(2),V4=BigInt(3),_z=BigInt(4);function x8(T,A){let{BYTES:P}=T,Q;if(typeof A==="bigint")Q=A;else{let C=q1("private key",A);try{Q=T.fromBytes(C)}catch(W){throw Error(`invalid private key: expected ui8a of size ${P}, got ${typeof A}`)}}if(!T.isValidNot0(Q))throw Error("invalid private key: out of range [1..N-1]");return Q}function hz(T,A={}){let P=u6("weierstrass",T,A),{Fp:Q,Fn:C}=P,W=P.CURVE,{h:G,n:J}=W;FA(A,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});let{endo:$}=A;if($){if(!Q.is0(W.a)||typeof $.beta!=="bigint"||!Array.isArray($.basises))throw Error('invalid endo: expected "beta": bigint and "basises": array')}let X=zV(Q,C);function Z(){if(!Q.isOdd)throw Error("compression is not supported: Field does not have .isOdd()")}function R(x,k,U){let{x:V,y:Y}=k.toAffine(),H=Q.toBytes(V);if(t0(U,"isCompressed"),U){Z();let K=!Q.isOdd(Y);return xT(MV(K),H)}else return xT(Uint8Array.of(4),H,Q.toBytes(Y))}function D(x){sT(x,void 0,"Point");let{publicKey:k,publicKeyUncompressed:U}=X,V=x.length,Y=x[0],H=x.subarray(1);if(V===k&&(Y===2||Y===3)){let K=Q.fromBytes(H);if(!Q.isValid(K))throw Error("bad point: is not on curve, wrong x");let M=E(K),I;try{I=Q.sqrt(M)}catch(F){let y=F instanceof Error?": "+F.message:"";throw Error("bad point: is not on curve, sqrt error"+y)}Z();let j=Q.isOdd(I);if((Y&1)===1!==j)I=Q.neg(I);return{x:K,y:I}}else if(V===U&&Y===4){let K=Q.BYTES,M=Q.fromBytes(H.subarray(0,K)),I=Q.fromBytes(H.subarray(K,K*2));if(!w(M,I))throw Error("bad point: is not on curve");return{x:M,y:I}}else throw Error(`bad point: got length ${V}, expected compressed=${k} or uncompressed=${U}`)}let z=A.toBytes||R,S=A.fromBytes||D;function E(x){let k=Q.sqr(x),U=Q.mul(k,x);return Q.add(Q.add(U,Q.mul(x,W.a)),W.b)}function w(x,k){let U=Q.sqr(k),V=E(x);return Q.eql(U,V)}if(!w(W.Gx,W.Gy))throw Error("bad curve params: generator point");let O=Q.mul(Q.pow(W.a,V4),_z),m=Q.mul(Q.sqr(W.b),BigInt(27));if(Q.is0(Q.add(O,m)))throw Error("bad curve params: a or b");function g(x,k,U=!1){if(!Q.isValid(k)||U&&Q.is0(k))throw Error(`bad point coordinate ${x}`);return k}function p(x){if(!(x instanceof _))throw Error("ProjectivePoint expected")}function c(x){if(!$||!$.basises)throw Error("no endo");return xz(x,$.basises,C.ORDER)}let o=M8((x,k)=>{let{X:U,Y:V,Z:Y}=x;if(Q.eql(Y,Q.ONE))return{x:U,y:V};let H=x.is0();if(k==null)k=H?Q.ONE:Q.inv(Y);let K=Q.mul(U,k),M=Q.mul(V,k),I=Q.mul(Y,k);if(H)return{x:Q.ZERO,y:Q.ZERO};if(!Q.eql(I,Q.ONE))throw Error("invZ was invalid");return{x:K,y:M}}),f=M8((x)=>{if(x.is0()){if(A.allowInfinityPoint&&!Q.is0(x.Y))return;throw Error("bad point: ZERO")}let{x:k,y:U}=x.toAffine();if(!Q.isValid(k)||!Q.isValid(U))throw Error("bad point: x or y not field elements");if(!w(k,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,k,U,V,Y){return U=new _(Q.mul(U.X,x),U.Y,U.Z),k=$2(V,k),U=$2(Y,U),k.add(U)}class _{constructor(x,k,U){this.X=g("x",x),this.Y=g("y",k,!0),this.Z=g("z",U),Object.freeze(this)}static CURVE(){return W}static fromAffine(x){let{x:k,y:U}=x||{};if(!x||!Q.isValid(k)||!Q.isValid(U))throw Error("invalid affine point");if(x instanceof _)throw Error("projective point not allowed");if(Q.is0(k)&&Q.is0(U))return _.ZERO;return new _(k,U,Q.ONE)}static fromBytes(x){let k=_.fromAffine(S(sT(x,void 0,"point")));return k.assertValidity(),k}static fromHex(x){return _.fromBytes(q1("pointHex",x))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(x=8,k=!0){if(i.createCache(this,x),!k)this.multiply(V4);return this}assertValidity(){f(this)}hasEvenY(){let{y:x}=this.toAffine();if(!Q.isOdd)throw Error("Field doesn't support isOdd");return!Q.isOdd(x)}equals(x){p(x);let{X:k,Y:U,Z:V}=this,{X:Y,Y:H,Z:K}=x,M=Q.eql(Q.mul(k,K),Q.mul(Y,V)),I=Q.eql(Q.mul(U,K),Q.mul(H,V));return M&&I}negate(){return new _(this.X,Q.neg(this.Y),this.Z)}double(){let{a:x,b:k}=W,U=Q.mul(k,V4),{X:V,Y,Z:H}=this,K=Q.ZERO,M=Q.ZERO,I=Q.ZERO,j=Q.mul(V,V),q=Q.mul(Y,Y),F=Q.mul(H,H),y=Q.mul(V,Y);return y=Q.add(y,y),I=Q.mul(V,H),I=Q.add(I,I),K=Q.mul(x,I),M=Q.mul(U,F),M=Q.add(K,M),K=Q.sub(q,M),M=Q.add(q,M),M=Q.mul(K,M),K=Q.mul(y,K),I=Q.mul(U,I),F=Q.mul(x,F),y=Q.sub(j,F),y=Q.mul(x,y),y=Q.add(y,I),I=Q.add(j,j),j=Q.add(I,j),j=Q.add(j,F),j=Q.mul(j,y),M=Q.add(M,j),F=Q.mul(Y,H),F=Q.add(F,F),j=Q.mul(F,y),K=Q.sub(K,j),I=Q.mul(F,q),I=Q.add(I,I),I=Q.add(I,I),new _(K,M,I)}add(x){p(x);let{X:k,Y:U,Z:V}=this,{X:Y,Y:H,Z:K}=x,M=Q.ZERO,I=Q.ZERO,j=Q.ZERO,q=W.a,F=Q.mul(W.b,V4),y=Q.mul(k,Y),r=Q.mul(U,H),u=Q.mul(V,K),T1=Q.add(k,U),P1=Q.add(Y,H);T1=Q.mul(T1,P1),P1=Q.add(y,r),T1=Q.sub(T1,P1),P1=Q.add(k,V);let Q1=Q.add(Y,K);return P1=Q.mul(P1,Q1),Q1=Q.add(y,u),P1=Q.sub(P1,Q1),Q1=Q.add(U,V),M=Q.add(H,K),Q1=Q.mul(Q1,M),M=Q.add(r,u),Q1=Q.sub(Q1,M),j=Q.mul(q,P1),M=Q.mul(F,u),j=Q.add(M,j),M=Q.sub(r,j),j=Q.add(r,j),I=Q.mul(M,j),r=Q.add(y,y),r=Q.add(r,y),u=Q.mul(q,u),P1=Q.mul(F,P1),r=Q.add(r,u),u=Q.sub(y,u),u=Q.mul(q,u),P1=Q.add(P1,u),y=Q.mul(r,P1),I=Q.add(I,y),y=Q.mul(Q1,P1),M=Q.mul(T1,M),M=Q.sub(M,y),y=Q.mul(T1,r),j=Q.mul(Q1,j),j=Q.add(j,y),new _(M,I,j)}subtract(x){return this.add(x.negate())}is0(){return this.equals(_.ZERO)}multiply(x){let{endo:k}=A;if(!C.isValidNot0(x))throw Error("invalid scalar: out of range");let U,V,Y=(H)=>i.cached(this,H,(K)=>AA(_,K));if(k){let{k1neg:H,k1:K,k2neg:M,k2:I}=c(x),{p:j,f:q}=Y(K),{p:F,f:y}=Y(I);V=q.add(y),U=d(k.beta,j,F,H,M)}else{let{p:H,f:K}=Y(x);U=H,V=K}return AA(_,[U,V])[0]}multiplyUnsafe(x){let{endo:k}=A,U=this;if(!C.isValid(x))throw Error("invalid scalar: out of range");if(x===UA||U.is0())return _.ZERO;if(x===_8)return U;if(i.hasCache(this))return this.multiply(x);if(k){let{k1neg:V,k1:Y,k2neg:H,k2:K}=c(x),{p1:M,p2:I}=A9(_,U,Y,K);return d(k.beta,M,I,V,H)}else return i.unsafe(U,x)}multiplyAndAddUnsafe(x,k,U){let V=this.multiplyUnsafe(k).add(x.multiplyUnsafe(U));return V.is0()?void 0:V}toAffine(x){return o(this,x)}isTorsionFree(){let{isTorsionFree:x}=A;if(G===_8)return!0;if(x)return x(_,this);return i.unsafe(this,J).is0()}clearCofactor(){let{clearCofactor:x}=A;if(G===_8)return this;if(x)return x(_,this);return this.multiplyUnsafe(G)}isSmallOrder(){return this.multiplyUnsafe(G).is0()}toBytes(x=!0){return t0(x,"isCompressed"),this.assertValidity(),z(_,this,x)}toHex(x=!0){return J0(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 AA(_,x)}static msm(x,k){return I8(_,C,x,k)}static fromPrivateKey(x){return _.BASE.multiply(x8(C,x))}}_.BASE=new _(W.Gx,W.Gy,Q.ONE),_.ZERO=new _(Q.ZERO,Q.ONE,Q.ZERO),_.Fp=Q,_.Fn=C;let t=C.BITS,i=new V2(_,A.endo?Math.ceil(t/2):t);return _.BASE.precompute(8),_}function MV(T){return Uint8Array.of(T?2:3)}function zV(T,A){return{secretKey:A.BYTES,publicKey:1+T.BYTES,publicKeyUncompressed:1+2*T.BYTES,publicKeyHasPrefix:!0,signature:2*A.BYTES}}function mz(T,A={}){let{Fn:P}=T,Q=A.randomBytes||D8,C=Object.assign(zV(T.Fp,P),{seed:nQ(P.ORDER)});function W(z){try{return!!x8(P,z)}catch(S){return!1}}function G(z,S){let{publicKey:E,publicKeyUncompressed:w}=C;try{let O=z.length;if(S===!0&&O!==E)return!1;if(S===!1&&O!==w)return!1;return!!T.fromBytes(z)}catch(O){return!1}}function J(z=Q(C.seed)){return fQ(sT(z,C.seed,"seed"),P.ORDER)}function $(z,S=!0){return T.BASE.multiply(x8(P,z)).toBytes(S)}function X(z){let S=J(z);return{secretKey:S,publicKey:$(S)}}function Z(z){if(typeof z==="bigint")return!1;if(z instanceof T)return!0;let{secretKey:S,publicKey:E,publicKeyUncompressed:w}=C;if(P.allowedLengths||S===E)return;let O=q1("key",z).length;return O===E||O===w}function R(z,S,E=!0){if(Z(z)===!0)throw Error("first arg must be private key");if(Z(S)===!1)throw Error("second arg must be public key");let w=x8(P,z);return T.fromHex(S).multiply(w).toBytes(E)}return Object.freeze({getPublicKey:$,getSharedSecret:R,keygen:X,Point:T,utils:{isValidSecretKey:W,isValidPublicKey:G,randomSecretKey:J,isValidPrivateKey:W,randomPrivateKey:J,normPrivateKeyToScalar:(z)=>x8(P,z),precompute(z=8,S=T.BASE){return S.precompute(z,!1)}},lengths:C})}function gz(T,A,P={}){x6(A),FA(P,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});let Q=P.randomBytes||D8,C=P.hmac||((U,...V)=>PW(A,U,xT(...V))),{Fp:W,Fn:G}=T,{ORDER:J,BITS:$}=G,{keygen:X,getPublicKey:Z,getSharedSecret:R,utils:D,lengths:z}=mz(T,P),S={prehash:!1,lowS:typeof P.lowS==="boolean"?P.lowS:!1,format:void 0,extraEntropy:!1},E="compact";function w(U){let V=J>>_8;return U>V}function O(U,V){if(!G.isValidNot0(V))throw Error(`invalid signature ${U}: out of range 1..Point.Fn.ORDER`);return V}function m(U,V){CW(V);let Y=z.signature,H=V==="compact"?Y:V==="recovered"?Y+1:void 0;return sT(U,H,`${V} signature`)}class g{constructor(U,V,Y){if(this.r=O("r",U),this.s=O("s",V),Y!=null)this.recovery=Y;Object.freeze(this)}static fromBytes(U,V=E){m(U,V);let Y;if(V==="der"){let{r:I,s:j}=GA.toSig(sT(U));return new g(I,j)}if(V==="recovered")Y=U[0],V="compact",U=U.subarray(1);let H=G.BYTES,K=U.subarray(0,H),M=U.subarray(H,H*2);return new g(G.fromBytes(K),G.fromBytes(M),Y)}static fromHex(U,V){return this.fromBytes(dA(U),V)}addRecoveryBit(U){return new g(this.r,this.s,U)}recoverPublicKey(U){let V=W.ORDER,{r:Y,s:H,recovery:K}=this;if(K==null||![0,1,2,3].includes(K))throw Error("recovery id invalid");if(J*FV<V&&K>1)throw Error("recovery id is ambiguous for h>1 curve");let I=K===2||K===3?Y+J:Y;if(!W.isValid(I))throw Error("recovery id 2 or 3 invalid");let j=W.toBytes(I),q=T.fromBytes(xT(MV((K&1)===0),j)),F=G.inv(I),y=c(q1("msgHash",U)),r=G.create(-y*F),u=G.create(H*F),T1=T.BASE.multiplyUnsafe(r).add(q.multiplyUnsafe(u));if(T1.is0())throw Error("point at infinify");return T1.assertValidity(),T1}hasHighS(){return w(this.s)}toBytes(U=E){if(CW(U),U==="der")return dA(GA.hexFromSig(this));let V=G.toBytes(this.r),Y=G.toBytes(this.s);if(U==="recovered"){if(this.recovery==null)throw Error("recovery bit must be present");return xT(Uint8Array.of(this.recovery),V,Y)}return xT(V,Y)}toHex(U){return J0(this.toBytes(U))}assertValidity(){}static fromCompact(U){return g.fromBytes(q1("sig",U),"compact")}static fromDER(U){return g.fromBytes(q1("sig",U),"der")}normalizeS(){return this.hasHighS()?new g(this.r,G.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return J0(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return J0(this.toBytes("compact"))}}let p=P.bits2int||function(V){if(V.length>8192)throw Error("input is too large");let Y=F8(V),H=V.length*8-$;return H>0?Y>>BigInt(H):Y},c=P.bits2int_modN||function(V){return G.create(p(V))},o=DA($);function f(U){return U2("num < 2^"+$,U,UA,o),G.toBytes(U)}function d(U,V){return sT(U,void 0,"message"),V?sT(A(U),void 0,"prehashed message"):U}function _(U,V,Y){if(["recovered","canonical"].some((u)=>(u in Y)))throw Error("sign() legacy options not supported");let{lowS:H,prehash:K,extraEntropy:M}=QW(Y,S);U=d(U,K);let I=c(U),j=x8(G,V),q=[f(j),f(I)];if(M!=null&&M!==!1){let u=M===!0?Q(z.secretKey):M;q.push(q1("extraEntropy",u))}let F=xT(...q),y=I;function r(u){let T1=p(u);if(!G.isValidNot0(T1))return;let P1=G.inv(T1),Q1=T.BASE.multiply(T1).toAffine(),vT=G.create(Q1.x);if(vT===UA)return;let $1=G.create(P1*G.create(y+vT*j));if($1===UA)return;let Z1=(Q1.x===vT?0:2)|Number(Q1.y&_8),b8=$1;if(H&&w($1))b8=G.neg($1),Z1^=1;return new g(vT,b8,Z1)}return{seed:F,k2sig:r}}function t(U,V,Y={}){U=q1("message",U);let{seed:H,k2sig:K}=_(U,V,Y);return b$(A.outputLen,G.BYTES,C)(H,K)}function i(U){let V=void 0,Y=typeof U==="string"||i0(U),H=!Y&&U!==null&&typeof U==="object"&&typeof U.r==="bigint"&&typeof U.s==="bigint";if(!Y&&!H)throw Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(H)V=new g(U.r,U.s);else if(Y){try{V=g.fromBytes(q1("sig",U),"der")}catch(K){if(!(K instanceof GA.Err))throw K}if(!V)try{V=g.fromBytes(q1("sig",U),"compact")}catch(K){return!1}}if(!V)return!1;return V}function x(U,V,Y,H={}){let{lowS:K,prehash:M,format:I}=QW(H,S);if(Y=q1("publicKey",Y),V=d(q1("message",V),M),"strict"in H)throw Error("options.strict was renamed to lowS");let j=I===void 0?i(U):g.fromBytes(q1("sig",U),I);if(j===!1)return!1;try{let q=T.fromBytes(Y);if(K&&j.hasHighS())return!1;let{r:F,s:y}=j,r=c(V),u=G.inv(y),T1=G.create(r*u),P1=G.create(F*u),Q1=T.BASE.multiplyUnsafe(T1).add(q.multiplyUnsafe(P1));if(Q1.is0())return!1;return G.create(Q1.x)===F}catch(q){return!1}}function k(U,V,Y={}){let{prehash:H}=QW(Y,S);return V=d(V,H),g.fromBytes(U,"recovered").recoverPublicKey(V).toBytes()}return Object.freeze({keygen:X,getPublicKey:Z,getSharedSecret:R,utils:D,lengths:z,Point:T,sign:t,verify:x,recoverPublicKey:k,Signature:g,hash:A})}function vz(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},P=T.Fp,Q=T.allowedPrivateKeyLengths?Array.from(new Set(T.allowedPrivateKeyLengths.map((G)=>Math.ceil(G/2)))):void 0,C=tT(A.n,{BITS:T.nBitLength,allowedLengths:Q,modFromBytes:T.wrapPrivateKey}),W={Fp:P,Fn:C,allowInfinityPoint:T.allowInfinityPoint,endo:T.endo,isTorsionFree:T.isTorsionFree,clearCofactor:T.clearCofactor,fromBytes:T.fromBytes,toBytes:T.toBytes};return{CURVE:A,curveOpts:W}}function yz(T){let{CURVE:A,curveOpts:P}=vz(T),Q={hmac:T.hmac,randomBytes:T.randomBytes,lowS:T.lowS,bits2int:T.bits2int,bits2int_modN:T.bits2int_modN};return{CURVE:A,curveOpts:P,hash:T.hash,ecdsaOpts:Q}}function bz(T,A){let P=A.Point;return Object.assign({},A,{ProjectivePoint:P,CURVE:Object.assign({},T,p6(P.Fn.ORDER,P.Fn.BITS))})}function IV(T){let{CURVE:A,curveOpts:P,hash:Q,ecdsaOpts:C}=yz(T),W=hz(A,P),G=gz(W,Q,C);return bz(T,G)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function SV(T,A){let P=(Q)=>IV({...T,hash:Q});return{...P(A),create:P}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var GW={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},lz={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]};var NV=BigInt(2);function pz(T){let A=GW.p,P=BigInt(3),Q=BigInt(6),C=BigInt(11),W=BigInt(22),G=BigInt(23),J=BigInt(44),$=BigInt(88),X=T*T*T%A,Z=X*X*T%A,R=R1(Z,P,A)*Z%A,D=R1(R,P,A)*Z%A,z=R1(D,NV,A)*X%A,S=R1(z,C,A)*z%A,E=R1(S,W,A)*S%A,w=R1(E,J,A)*E%A,O=R1(w,$,A)*w%A,m=R1(O,J,A)*E%A,g=R1(m,P,A)*Z%A,p=R1(g,G,A)*S%A,c=R1(p,Q,A)*X%A,o=R1(c,NV,A);if(!WW.eql(WW.sqr(o),T))throw Error("Cannot find square root");return o}var WW=tT(GW.p,{sqrt:pz}),q4=SV({...GW,Fp:WW,lowS:!0,endo:lz},y6);var T_=cT.utils.randomPrivateKey,wV=()=>{let T=cT.utils.randomPrivateKey(),A=YW(T),P=new Uint8Array(64);return P.set(T),P.set(A,32),{publicKey:A,secretKey:P}},YW=cT.getPublicKey;function LV(T){try{return cT.ExtendedPoint.fromHex(T),!0}catch{return!1}}var lV=(T,A)=>cT.sign(T,A.slice(0,32)),dz=cT.verify,U1=(T)=>{if(L.isBuffer(T))return T;else if(T instanceof Uint8Array)return L.from(T.buffer,T.byteOffset,T.byteLength);else return L.from(T)};class pV{constructor(T){Object.assign(this,T)}encode(){return L.from(g8.serialize(X4,this))}static decode(T){return g8.deserialize(X4,this,T)}static decodeUnchecked(T){return g8.deserializeUnchecked(X4,this,T)}}var X4=new Map,uV,rz=32,L2=32;function cz(T){return T._bn!==void 0}var EV=1;class n extends pV{constructor(T){super({});if(this._bn=void 0,cz(T))this._bn=T._bn;else{if(typeof T==="string"){let A=nT.default.decode(T);if(A.length!=L2)throw Error("Invalid public key input");this._bn=new qW.default(A)}else this._bn=new qW.default(T);if(this._bn.byteLength()>L2)throw Error("Invalid public key input")}}static unique(){let T=new n(EV);return EV+=1,new n(T.toBuffer())}equals(T){return this._bn.eq(T._bn)}toBase58(){return nT.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(L);if(T.length===L2)return T;let A=L.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,P){let Q=L.concat([T.toBuffer(),L.from(A),P.toBuffer()]),C=JC(Q);return new n(C)}static createProgramAddressSync(T,A){let P=L.alloc(0);T.forEach(function(C){if(C.length>rz)throw TypeError("Max seed length exceeded");P=L.concat([P,U1(C)])}),P=L.concat([P,A.toBuffer(),L.from("ProgramDerivedAddress")]);let Q=JC(P);if(LV(Q))throw Error("Invalid seeds, address must fall off the curve");return new n(Q)}static async createProgramAddress(T,A){return this.createProgramAddressSync(T,A)}static findProgramAddressSync(T,A){let P=255,Q;while(P!=0){try{let C=T.concat(L.from([P]));Q=this.createProgramAddressSync(C,A)}catch(C){if(C instanceof TypeError)throw C;P--;continue}return[Q,P]}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 n(T);return LV(A.toBytes())}}uV=n;n.default=new uV("11111111111111111111111111111111");X4.set(n,{kind:"struct",fields:[["_bn","u256"]]});var A_=new n("BPFLoader1111111111111111111111111111111111"),H4=1232,oz=127,dV=64;class rV extends Error{constructor(T){super(`Signature ${T} has expired: block height exceeded.`);this.signature=void 0,this.signature=T}}Object.defineProperty(rV.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class cV 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(cV.prototype,"name",{value:"TransactionExpiredTimeoutError"});class oV extends Error{constructor(T){super(`Signature ${T} has expired: the nonce is no longer valid.`);this.signature=void 0,this.signature=T}}Object.defineProperty(oV.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class ZW{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 P=new Map;this.keySegments().flat().forEach((C,W)=>{P.set(C.toBase58(),W)});let Q=(C)=>{let W=P.get(C.toBase58());if(W===void 0)throw Error("Encountered an unknown instruction account key during compilation");return W};return T.map((C)=>{return{programIdIndex:Q(C.programId),accountKeyIndexes:C.keys.map((W)=>Q(W.pubkey)),data:C.data}})}}var W1=(T="publicKey")=>{return N.blob(32,T)};var h8=(T="string")=>{let A=N.struct([N.u32("length"),N.u32("lengthPadding"),N.blob(N.offset(N.u32(),-8),"chars")],T),P=A.decode.bind(A),Q=A.encode.bind(A),C=A;return C.decode=(W,G)=>{return P(W,G).chars.toString()},C.encode=(W,G,J)=>{let $={chars:L.from(W,"utf8")};return Q($,G,J)},C.alloc=(W)=>{return N.u32().span+N.u32().span+L.from(W,"utf8").length},C},nz=(T="authorized")=>{return N.struct([W1("staker"),W1("withdrawer")],T)},fz=(T="lockup")=>{return N.struct([N.ns64("unixTimestamp"),N.ns64("epoch"),W1("custodian")],T)},iz=(T="voteInit")=>{return N.struct([W1("nodePubkey"),W1("authorizedVoter"),W1("authorizedWithdrawer"),N.u8("commission")],T)},az=(T="voteAuthorizeWithSeedArgs")=>{return N.struct([N.u32("voteAuthorizationType"),W1("currentAuthorityDerivedKeyOwnerPubkey"),h8("currentAuthorityDerivedKeySeed"),W1("newAuthorized")],T)};function nV(T,A){let P=(C)=>{if(C.span>=0)return C.span;else if(typeof C.alloc==="function")return C.alloc(A[C.property]);else if("count"in C&&"elementLayout"in C){let W=A[C.property];if(Array.isArray(W))return W.length*P(C.elementLayout)}else if("fields"in C)return nV({layout:C},A[C.property]);return 0},Q=0;return T.layout.fields.forEach((C)=>{Q+=P(C)}),Q}function S2(T){let A=0,P=0;for(;;){let Q=T.shift();if(A|=(Q&127)<<P*7,P+=1,(Q&128)===0)break}return A}function N2(T,A){let P=A;for(;;){let Q=P&127;if(P>>=7,P==0){T.push(Q);break}else Q|=128,T.push(Q)}}function $T(T,A){if(!T)throw Error(A||"Assertion failed")}class HW{constructor(T,A){this.payer=void 0,this.keyMetaMap=void 0,this.payer=T,this.keyMetaMap=A}static compile(T,A){let P=new Map,Q=(W)=>{let G=W.toBase58(),J=P.get(G);if(J===void 0)J={isSigner:!1,isWritable:!1,isInvoked:!1},P.set(G,J);return J},C=Q(A);C.isSigner=!0,C.isWritable=!0;for(let W of T){Q(W.programId).isInvoked=!0;for(let G of W.keys){let J=Q(G.pubkey);J.isSigner||=G.isSigner,J.isWritable||=G.isWritable}}return new HW(A,P)}getMessageComponents(){let T=[...this.keyMetaMap.entries()];$T(T.length<=256,"Max static account keys length exceeded");let A=T.filter(([,J])=>J.isSigner&&J.isWritable),P=T.filter(([,J])=>J.isSigner&&!J.isWritable),Q=T.filter(([,J])=>!J.isSigner&&J.isWritable),C=T.filter(([,J])=>!J.isSigner&&!J.isWritable),W={numRequiredSignatures:A.length+P.length,numReadonlySignedAccounts:P.length,numReadonlyUnsignedAccounts:C.length};{$T(A.length>0,"Expected at least one writable signer key");let[J]=A[0];$T(J===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}let G=[...A.map(([J])=>new n(J)),...P.map(([J])=>new n(J)),...Q.map(([J])=>new n(J)),...C.map(([J])=>new n(J))];return[W,G]}extractTableLookup(T){let[A,P]=this.drainKeysFoundInLookupTable(T.state.addresses,(W)=>!W.isSigner&&!W.isInvoked&&W.isWritable),[Q,C]=this.drainKeysFoundInLookupTable(T.state.addresses,(W)=>!W.isSigner&&!W.isInvoked&&!W.isWritable);if(A.length===0&&Q.length===0)return;return[{accountKey:T.key,writableIndexes:A,readonlyIndexes:Q},{writable:P,readonly:C}]}drainKeysFoundInLookupTable(T,A){let P=[],Q=[];for(let[C,W]of this.keyMetaMap.entries())if(A(W)){let G=new n(C),J=T.findIndex(($)=>$.equals(G));if(J>=0)$T(J<256,"Max lookup table index exceeded"),P.push(J),Q.push(G),this.keyMetaMap.delete(C)}return[P,Q]}}var fV="Reached end of buffer unexpectedly";function Y4(T){if(T.length===0)throw Error(fV);return T.shift()}function w2(T,...A){let[P]=A;if(A.length===2?P+(A[1]??0)>T.length:P>=T.length)throw Error(fV);return T.splice(...A)}class O2{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 n(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:nT.default.decode(T.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new ZW(this.staticAccountKeys)}static compile(T){let A=HW.compile(T.instructions,T.payerKey),[P,Q]=A.getMessageComponents(),W=new ZW(Q).compileInstructions(T.instructions).map((G)=>({programIdIndex:G.programIdIndex,accounts:G.accountKeyIndexes,data:nT.default.encode(G.data)}));return new O2({header:P,accountKeys:Q,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 P=T-A,C=this.accountKeys.length-A-this.header.numReadonlyUnsignedAccounts;return P<C}else{let P=A-this.header.numReadonlySignedAccounts;return T<P}}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=[];N2(A,T);let P=this.instructions.map((Z)=>{let{accounts:R,programIdIndex:D}=Z,z=Array.from(nT.default.decode(Z.data)),S=[];N2(S,R.length);let E=[];return N2(E,z.length),{programIdIndex:D,keyIndicesCount:L.from(S),keyIndices:R,dataLength:L.from(E),data:z}}),Q=[];N2(Q,P.length);let C=L.alloc(H4);L.from(Q).copy(C);let W=Q.length;P.forEach((Z)=>{let D=N.struct([N.u8("programIdIndex"),N.blob(Z.keyIndicesCount.length,"keyIndicesCount"),N.seq(N.u8("keyIndex"),Z.keyIndices.length,"keyIndices"),N.blob(Z.dataLength.length,"dataLength"),N.seq(N.u8("userdatum"),Z.data.length,"data")]).encode(Z,C,W);W+=D}),C=C.slice(0,W);let G=N.struct([N.blob(1,"numRequiredSignatures"),N.blob(1,"numReadonlySignedAccounts"),N.blob(1,"numReadonlyUnsignedAccounts"),N.blob(A.length,"keyCount"),N.seq(W1("key"),T,"keys"),W1("recentBlockhash")]),J={numRequiredSignatures:L.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:L.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:L.from([this.header.numReadonlyUnsignedAccounts]),keyCount:L.from(A),keys:this.accountKeys.map((Z)=>U1(Z.toBytes())),recentBlockhash:nT.default.decode(this.recentBlockhash)},$=L.alloc(2048),X=G.encode(J,$);return C.copy($,X),$.slice(0,X+C.length)}static from(T){let A=[...T],P=Y4(A);if(P!==(P&oz))throw Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");let Q=Y4(A),C=Y4(A),W=S2(A),G=[];for(let R=0;R<W;R++){let D=w2(A,0,L2);G.push(new n(L.from(D)))}let J=w2(A,0,L2),$=S2(A),X=[];for(let R=0;R<$;R++){let D=Y4(A),z=S2(A),S=w2(A,0,z),E=S2(A),w=w2(A,0,E),O=nT.default.encode(L.from(w));X.push({programIdIndex:D,accounts:S,data:O})}let Z={header:{numRequiredSignatures:P,numReadonlySignedAccounts:Q,numReadonlyUnsignedAccounts:C},recentBlockhash:nT.default.encode(L.from(J)),accountKeys:G,instructions:X};return new O2(Z)}}var sz=L.alloc(dV).fill(0);class J1{constructor(T){if(this.keys=void 0,this.programId=void 0,this.data=L.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:P})=>({pubkey:T.toJSON(),isSigner:A,isWritable:P})),programId:this.programId.toJSON(),data:[...this.data]}}}class K1{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:P}=T;this.minNonceContextSlot=A,this.nonceInfo=P}else if(Object.prototype.hasOwnProperty.call(T,"lastValidBlockHeight")){let{blockhash:A,lastValidBlockHeight:P}=T;this.recentBlockhash=A,this.lastValidBlockHeight=P}else{let{recentBlockhash:A,nonceInfo:P}=T;if(P)this.nonceInfo=P;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 J1(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 P;if(this.feePayer)P=this.feePayer;else if(this.signatures.length>0&&this.signatures[0].publicKey)P=this.signatures[0].publicKey;else throw Error("Transaction fee payer required");for(let S=0;S<A.length;S++)if(A[S].programId===void 0)throw Error(`Transaction instruction index ${S} has undefined program id`);let Q=[],C=[];A.forEach((S)=>{S.keys.forEach((w)=>{C.push({...w})});let E=S.programId.toString();if(!Q.includes(E))Q.push(E)}),Q.forEach((S)=>{C.push({pubkey:new n(S),isSigner:!1,isWritable:!1})});let W=[];C.forEach((S)=>{let E=S.pubkey.toString(),w=W.findIndex((O)=>{return O.pubkey.toString()===E});if(w>-1)W[w].isWritable=W[w].isWritable||S.isWritable,W[w].isSigner=W[w].isSigner||S.isSigner;else W.push(S)}),W.sort(function(S,E){if(S.isSigner!==E.isSigner)return S.isSigner?-1:1;if(S.isWritable!==E.isWritable)return S.isWritable?-1:1;let w={localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"};return S.pubkey.toBase58().localeCompare(E.pubkey.toBase58(),"en",w)});let G=W.findIndex((S)=>{return S.pubkey.equals(P)});if(G>-1){let[S]=W.splice(G,1);S.isSigner=!0,S.isWritable=!0,W.unshift(S)}else W.unshift({pubkey:P,isSigner:!0,isWritable:!0});for(let S of this.signatures){let E=W.findIndex((w)=>{return w.pubkey.equals(S.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: ${S.publicKey.toString()}`)}let J=0,$=0,X=0,Z=[],R=[];W.forEach(({pubkey:S,isSigner:E,isWritable:w})=>{if(E){if(Z.push(S.toString()),J+=1,!w)$+=1}else if(R.push(S.toString()),!w)X+=1});let D=Z.concat(R),z=A.map((S)=>{let{data:E,programId:w}=S;return{programIdIndex:D.indexOf(w.toString()),accounts:S.keys.map((O)=>D.indexOf(O.pubkey.toString())),data:nT.default.encode(E)}});return z.forEach((S)=>{$T(S.programIdIndex>=0),S.accounts.forEach((E)=>$T(E>=0))}),new O2({header:{numRequiredSignatures:J,numReadonlySignedAccounts:$,numReadonlyUnsignedAccounts:X},accountKeys:D,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((Q,C)=>{return A[C].equals(Q.publicKey)}))return T}return this.signatures=A.map((P)=>({signature:null,publicKey:P})),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((P)=>{let Q=P.toString();if(A.has(Q))return!1;else return A.add(Q),!0}).map((P)=>({signature:null,publicKey:P}))}sign(...T){if(T.length===0)throw Error("No signers");let A=new Set,P=[];for(let C of T){let W=C.publicKey.toString();if(A.has(W))continue;else A.add(W),P.push(C)}this.signatures=P.map((C)=>({signature:null,publicKey:C.publicKey}));let Q=this._compile();this._partialSign(Q,...P)}partialSign(...T){if(T.length===0)throw Error("No signers");let A=new Set,P=[];for(let C of T){let W=C.publicKey.toString();if(A.has(W))continue;else A.add(W),P.push(C)}let Q=this._compile();this._partialSign(Q,...P)}_partialSign(T,...A){let P=T.serialize();A.forEach((Q)=>{let C=lV(P,Q.secretKey);this._addSignature(Q.publicKey,U1(C))})}addSignature(T,A){this._compile(),this._addSignature(T,A)}_addSignature(T,A){$T(A.length===64);let P=this.signatures.findIndex((Q)=>T.equals(Q.publicKey));if(P<0)throw Error(`unknown signer: ${T.toString()}`);this.signatures[P].signature=L.from(A)}verifySignatures(T=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),T)}_getMessageSignednessErrors(T,A){let P={};for(let{signature:Q,publicKey:C}of this.signatures)if(Q===null){if(A)(P.missing||=[]).push(C)}else if(!dz(Q,T,C.toBytes()))(P.invalid||=[]).push(C);return P.invalid||P.missing?P:void 0}serialize(T){let{requireAllSignatures:A,verifySignatures:P}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},T),Q=this.serializeMessage();if(P){let C=this._getMessageSignednessErrors(Q,A);if(C){let W="Signature verification failed.";if(C.invalid)W+=`
|
|
15
|
-
Invalid signature for public key${
|
|
16
|
-
Missing signature for public key${
|
|
17
|
-
${JSON.stringify(
|
|
18
|
-
${
|
|
19
|
-
Message: ${
|
|
20
|
-
`+C+"\nCatch the `SendTransactionError` and call `getLogs()` on it for full details.";break;default:G=`Unknown action '${((J)=>J)(T)}'`}super(G);this.signature=void 0,this.transactionMessage=void 0,this.transactionLogs=void 0,this.signature=A,this.transactionMessage=P,this.transactionLogs=Q?Q: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,P)=>{T.getTransaction(this.signature).then((Q)=>{if(Q&&Q.meta&&Q.meta.logMessages){let C=Q.meta.logMessages;this.transactionLogs=C,A(C)}else P(Error("Log messages not found"))}).catch(P)});return await this.transactionLogs}}async function BV(T,A,P,Q){let C=Q&&{skipPreflight:Q.skipPreflight,preflightCommitment:Q.preflightCommitment||Q.commitment,maxRetries:Q.maxRetries,minContextSlot:Q.minContextSlot},W=await T.sendTransaction(A,P,C),G;if(A.recentBlockhash!=null&&A.lastValidBlockHeight!=null)G=(await T.confirmTransaction({abortSignal:Q?.abortSignal,signature:W,blockhash:A.recentBlockhash,lastValidBlockHeight:A.lastValidBlockHeight},Q&&Q.commitment)).value;else if(A.minNonceContextSlot!=null&&A.nonceInfo!=null){let{nonceInstruction:J}=A.nonceInfo,$=J.keys[0].pubkey;G=(await T.confirmTransaction({abortSignal:Q?.abortSignal,minContextSlot:A.minNonceContextSlot,nonceAccountPubkey:$,nonceValue:A.nonceInfo.nonce,signature:W},Q&&Q.commitment)).value}else{if(Q?.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,Q&&Q.commitment)).value}if(G.err){if(W!=null)throw new iV({action:"send",signature:W,transactionMessage:`Status: (${JSON.stringify(G)})`});throw Error(`Transaction ${W} failed (${JSON.stringify(G)})`)}return W}function PI(T){return new Promise((A)=>setTimeout(A,T))}function C1(T,A){let P=T.layout.span>=0?T.layout.span:nV(T,A),Q=L.alloc(P),C=Object.assign({instruction:T.index},A);return T.layout.encode(C,Q),Q}var QI=N.nu64("lamportsPerSignature"),CI=N.struct([N.u32("version"),N.u32("state"),W1("authorizedPubkey"),W1("nonce"),N.struct([QI],"feeCalculator")]),OV=CI.span;function m8(T){let A=bV.blob(8,T),P=A.decode.bind(A),Q=A.encode.bind(A),C=A,W=m9();return C.decode=(G,J)=>{let $=P(G,J);return W.decode($)},C.encode=(G,J,$)=>{let X=W.encode(G);return Q(X,J,$)},C}var V0=Object.freeze({Create:{index:0,layout:N.struct([N.u32("instruction"),N.ns64("lamports"),N.ns64("space"),W1("programId")])},Assign:{index:1,layout:N.struct([N.u32("instruction"),W1("programId")])},Transfer:{index:2,layout:N.struct([N.u32("instruction"),m8("lamports")])},CreateWithSeed:{index:3,layout:N.struct([N.u32("instruction"),W1("base"),h8("seed"),N.ns64("lamports"),N.ns64("space"),W1("programId")])},AdvanceNonceAccount:{index:4,layout:N.struct([N.u32("instruction")])},WithdrawNonceAccount:{index:5,layout:N.struct([N.u32("instruction"),N.ns64("lamports")])},InitializeNonceAccount:{index:6,layout:N.struct([N.u32("instruction"),W1("authorized")])},AuthorizeNonceAccount:{index:7,layout:N.struct([N.u32("instruction"),W1("authorized")])},Allocate:{index:8,layout:N.struct([N.u32("instruction"),N.ns64("space")])},AllocateWithSeed:{index:9,layout:N.struct([N.u32("instruction"),W1("base"),h8("seed"),N.ns64("space"),W1("programId")])},AssignWithSeed:{index:10,layout:N.struct([N.u32("instruction"),W1("base"),h8("seed"),W1("programId")])},TransferWithSeed:{index:11,layout:N.struct([N.u32("instruction"),m8("lamports"),h8("seed"),W1("programId")])},UpgradeNonceAccount:{index:12,layout:N.struct([N.u32("instruction")])}});class UT{constructor(){}static createAccount(T){let A=V0.Create,P=C1(A,{lamports:T.lamports,space:T.space,programId:U1(T.programId.toBuffer())});return new J1({keys:[{pubkey:T.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:T.newAccountPubkey,isSigner:!0,isWritable:!0}],programId:this.programId,data:P})}static transfer(T){let A,P;if("basePubkey"in T){let Q=V0.TransferWithSeed;A=C1(Q,{lamports:BigInt(T.lamports),seed:T.seed,programId:U1(T.programId.toBuffer())}),P=[{pubkey:T.fromPubkey,isSigner:!1,isWritable:!0},{pubkey:T.basePubkey,isSigner:!0,isWritable:!1},{pubkey:T.toPubkey,isSigner:!1,isWritable:!0}]}else{let Q=V0.Transfer;A=C1(Q,{lamports:BigInt(T.lamports)}),P=[{pubkey:T.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:T.toPubkey,isSigner:!1,isWritable:!0}]}return new J1({keys:P,programId:this.programId,data:A})}static assign(T){let A,P;if("basePubkey"in T){let Q=V0.AssignWithSeed;A=C1(Q,{base:U1(T.basePubkey.toBuffer()),seed:T.seed,programId:U1(T.programId.toBuffer())}),P=[{pubkey:T.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:T.basePubkey,isSigner:!0,isWritable:!1}]}else{let Q=V0.Assign;A=C1(Q,{programId:U1(T.programId.toBuffer())}),P=[{pubkey:T.accountPubkey,isSigner:!0,isWritable:!0}]}return new J1({keys:P,programId:this.programId,data:A})}static createAccountWithSeed(T){let A=V0.CreateWithSeed,P=C1(A,{base:U1(T.basePubkey.toBuffer()),seed:T.seed,lamports:T.lamports,space:T.space,programId:U1(T.programId.toBuffer())}),Q=[{pubkey:T.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:T.newAccountPubkey,isSigner:!1,isWritable:!0}];if(!T.basePubkey.equals(T.fromPubkey))Q.push({pubkey:T.basePubkey,isSigner:!0,isWritable:!1});return new J1({keys:Q,programId:this.programId,data:P})}static createNonceAccount(T){let A=new K1;if("basePubkey"in T&&"seed"in T)A.add(UT.createAccountWithSeed({fromPubkey:T.fromPubkey,newAccountPubkey:T.noncePubkey,basePubkey:T.basePubkey,seed:T.seed,lamports:T.lamports,space:OV,programId:this.programId}));else A.add(UT.createAccount({fromPubkey:T.fromPubkey,newAccountPubkey:T.noncePubkey,lamports:T.lamports,space:OV,programId:this.programId}));let P={noncePubkey:T.noncePubkey,authorizedPubkey:T.authorizedPubkey};return A.add(this.nonceInitialize(P)),A}static nonceInitialize(T){let A=V0.InitializeNonceAccount,P=C1(A,{authorized:U1(T.authorizedPubkey.toBuffer())}),Q={keys:[{pubkey:T.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:UW,isSigner:!1,isWritable:!1},{pubkey:x2,isSigner:!1,isWritable:!1}],programId:this.programId,data:P};return new J1(Q)}static nonceAdvance(T){let A=V0.AdvanceNonceAccount,P=C1(A),Q={keys:[{pubkey:T.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:UW,isSigner:!1,isWritable:!1},{pubkey:T.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:P};return new J1(Q)}static nonceWithdraw(T){let A=V0.WithdrawNonceAccount,P=C1(A,{lamports:T.lamports});return new J1({keys:[{pubkey:T.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:T.toPubkey,isSigner:!1,isWritable:!0},{pubkey:UW,isSigner:!1,isWritable:!1},{pubkey:x2,isSigner:!1,isWritable:!1},{pubkey:T.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:P})}static nonceAuthorize(T){let A=V0.AuthorizeNonceAccount,P=C1(A,{authorized:U1(T.newAuthorizedPubkey.toBuffer())});return new J1({keys:[{pubkey:T.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:T.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:P})}static allocate(T){let A,P;if("basePubkey"in T){let Q=V0.AllocateWithSeed;A=C1(Q,{base:U1(T.basePubkey.toBuffer()),seed:T.seed,space:T.space,programId:U1(T.programId.toBuffer())}),P=[{pubkey:T.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:T.basePubkey,isSigner:!0,isWritable:!1}]}else{let Q=V0.Allocate;A=C1(Q,{space:T.space}),P=[{pubkey:T.accountPubkey,isSigner:!0,isWritable:!0}]}return new J1({keys:P,programId:this.programId,data:A})}}UT.programId=new n("11111111111111111111111111111111");var WI=H4-300;class K4{constructor(){}static getMinNumSignatures(T){return 2*(Math.ceil(T/K4.chunkSize)+1+1)}static async load(T,A,P,Q,C){{let Z=await T.getMinimumBalanceForRentExemption(C.length),R=await T.getAccountInfo(P.publicKey,"confirmed"),D=null;if(R!==null){if(R.executable)return console.error("Program load failed, account is already executable"),!1;if(R.data.length!==C.length)D=D||new K1,D.add(UT.allocate({accountPubkey:P.publicKey,space:C.length}));if(!R.owner.equals(Q))D=D||new K1,D.add(UT.assign({accountPubkey:P.publicKey,programId:Q}));if(R.lamports<Z)D=D||new K1,D.add(UT.transfer({fromPubkey:A.publicKey,toPubkey:P.publicKey,lamports:Z-R.lamports}))}else D=new K1().add(UT.createAccount({fromPubkey:A.publicKey,newAccountPubkey:P.publicKey,lamports:Z>0?Z:1,space:C.length,programId:Q}));if(D!==null)await BV(T,D,[A,P],{commitment:"confirmed"})}let W=N.struct([N.u32("instruction"),N.u32("offset"),N.u32("bytesLength"),N.u32("bytesLengthPadding"),N.seq(N.u8("byte"),N.offset(N.u32(),-8),"bytes")]),G=K4.chunkSize,J=0,$=C,X=[];while($.length>0){let Z=$.slice(0,G),R=L.alloc(G+16);W.encode({instruction:0,offset:J,bytes:Z,bytesLength:0,bytesLengthPadding:0},R);let D=new K1().add({keys:[{pubkey:P.publicKey,isSigner:!0,isWritable:!0}],programId:Q,data:R});if(X.push(BV(T,D,[A,P],{commitment:"confirmed"})),T._rpcEndpoint.includes("solana.com"))await PI(250);J+=G,$=$.slice(G)}await Promise.all(X);{let Z=N.struct([N.u32("instruction")]),R=L.alloc(Z.span);Z.encode({instruction:1},R);let D=new K1().add({keys:[{pubkey:P.publicKey,isSigner:!0,isWritable:!0},{pubkey:x2,isSigner:!1,isWritable:!1}],programId:Q,data:R}),z="processed",S=await T.sendTransaction(D,[A,P],{preflightCommitment:z}),{context:E,value:w}=await T.confirmTransaction({signature:S,lastValidBlockHeight:D.lastValidBlockHeight,blockhash:D.recentBlockhash},z);if(w.err)throw Error(`Transaction ${S} failed (${JSON.stringify(w)})`);while(!0){try{if(await T.getSlot({commitment:z})>E.slot)break}catch{}await new Promise((O)=>setTimeout(O,Math.round(AI/2)))}}return!0}}K4.chunkSize=WI;var U_=new n("BPFLoader2111111111111111111111111111111111");var J_=globalThis.fetch;var $_={index:1,layout:N.struct([N.u32("typeIndex"),m8("deactivationSlot"),N.nu64("lastExtendedSlot"),N.u8("lastExtendedStartIndex"),N.u8(),N.seq(W1(),N.offset(N.u8(),-1),"authority")])};var z1=O8(C4(n),l(),(T)=>new n(T)),aV=W4([l(),k1("base64")]),KW=O8(C4(L),aV,(T)=>L.from(T[0],"base64"));function sV(T){return IT([v({jsonrpc:k1("2.0"),id:l(),result:T}),v({jsonrpc:k1("2.0"),id:l(),error:v({code:A8(),message:l(),data:A1(l9())})})])}var GI=sV(A8());function H1(T){return O8(sV(T),GI,(A)=>{if("error"in A)return A;else return{...A,result:B8(A.result,T)}})}function H0(T){return H1(v({context:v({slot:B()}),value:T}))}function k4(T){return v({context:v({slot:B()}),value:T})}var UI=v({foundation:B(),foundationTerm:B(),initial:B(),taper:B(),terminal:B()}),V_=H1(a(s(v({epoch:B(),effectiveSlot:B(),amount:B(),postBalance:B(),commission:A1(s(B()))})))),JI=a(v({slot:B(),prioritizationFee:B()})),$I=v({total:B(),validator:B(),foundation:B(),epoch:B()}),VI=v({epoch:B(),slotIndex:B(),slotsInEpoch:B(),absoluteSlot:B(),blockHeight:A1(B()),transactionCount:A1(B())}),qI=v({slotsPerEpoch:B(),leaderScheduleSlotOffset:B(),warmup:X0(),firstNormalEpoch:B(),firstNormalSlot:B()}),YI=uC(l(),a(B())),P8=s(IT([v({}),l()])),ZI=v({err:P8}),XI=k1("receivedSignature"),q_=v({"solana-core":l(),"feature-set":A1(B())}),HI=v({program:l(),programId:z1,parsed:A8()}),KI=v({programId:z1,accounts:a(z1),data:l()}),Y_=H0(v({err:s(IT([v({}),l()])),logs:s(a(l())),accounts:A1(s(a(s(v({executable:X0(),owner:l(),lamports:B(),data:a(l()),rentEpoch:A1(B())}))))),unitsConsumed:A1(B()),returnData:A1(s(v({programId:l(),data:W4([l(),k1("base64")])}))),innerInstructions:A1(s(a(v({index:B(),instructions:a(IT([HI,KI]))}))))})),Z_=H0(v({byIdentity:uC(l(),a(B())),range:v({firstSlot:B(),lastSlot:B()})}));var X_=H1(UI),H_=H1($I),K_=H1(JI),R_=H1(VI),k_=H1(qI),j_=H1(YI),D_=H1(B()),F_=H0(v({total:B(),circulating:B(),nonCirculating:B(),nonCirculatingAccounts:a(z1)})),RI=v({amount:l(),uiAmount:s(B()),decimals:B(),uiAmountString:A1(l())}),M_=H0(a(v({address:z1,amount:l(),uiAmount:s(B()),decimals:B(),uiAmountString:A1(l())}))),z_=H0(a(v({pubkey:z1,account:v({executable:X0(),owner:z1,lamports:B(),data:KW,rentEpoch:B()})}))),XW=v({program:l(),parsed:A8(),space:B()}),I_=H0(a(v({pubkey:z1,account:v({executable:X0(),owner:z1,lamports:B(),data:XW,rentEpoch:B()})}))),S_=H0(a(v({lamports:B(),address:z1}))),RW=v({executable:X0(),owner:z1,lamports:B(),data:KW,rentEpoch:B()}),N_=v({pubkey:z1,account:RW}),kI=O8(IT([C4(L),XW]),IT([aV,XW]),(T)=>{if(Array.isArray(T))return B8(T,KW);else return T}),jI=v({executable:X0(),owner:z1,lamports:B(),data:kI,rentEpoch:B()}),w_=v({pubkey:z1,account:jI}),L_=v({state:IT([k1("active"),k1("inactive"),k1("activating"),k1("deactivating")]),active:B(),inactive:B()}),E_=H1(a(v({signature:l(),slot:B(),err:P8,memo:s(l()),blockTime:A1(s(B()))}))),B_=H1(a(v({signature:l(),slot:B(),err:P8,memo:s(l()),blockTime:A1(s(B()))}))),O_=v({subscription:B(),result:k4(RW)}),DI=v({pubkey:z1,account:RW}),x_=v({subscription:B(),result:k4(DI)}),FI=v({parent:B(),slot:B(),root:B()}),__=v({subscription:B(),result:FI}),MI=IT([v({type:IT([k1("firstShredReceived"),k1("completed"),k1("optimisticConfirmation"),k1("root")]),slot:B(),timestamp:B()}),v({type:k1("createdBank"),parent:B(),slot:B(),timestamp:B()}),v({type:k1("frozen"),slot:B(),timestamp:B(),stats:v({numTransactionEntries:B(),numSuccessfulTransactions:B(),numFailedTransactions:B(),maxTransactionsPerEntry:B()})}),v({type:k1("dead"),slot:B(),timestamp:B(),err:l()})]),h_=v({subscription:B(),result:MI}),m_=v({subscription:B(),result:k4(IT([ZI,XI]))}),g_=v({subscription:B(),result:B()}),v_=v({pubkey:l(),gossip:s(l()),tpu:s(l()),rpc:s(l()),version:s(l())}),xV=v({votePubkey:l(),nodePubkey:l(),activatedStake:B(),epochVoteAccount:X0(),epochCredits:a(W4([B(),B(),B()])),commission:B(),lastVote:B(),rootSlot:s(B())}),y_=H1(v({current:a(xV),delinquent:a(xV)})),zI=IT([k1("processed"),k1("confirmed"),k1("finalized")]),II=v({slot:B(),confirmations:s(B()),err:P8,confirmationStatus:A1(zI)}),b_=H0(a(s(II))),l_=H1(B()),tV=v({accountKey:z1,writableIndexes:a(B()),readonlyIndexes:a(B())}),kW=v({signatures:a(l()),message:v({accountKeys:a(l()),header:v({numRequiredSignatures:B(),numReadonlySignedAccounts:B(),numReadonlyUnsignedAccounts:B()}),instructions:a(v({accounts:a(B()),data:l(),programIdIndex:B()})),recentBlockhash:l(),addressTableLookups:A1(a(tV))})}),eV=v({pubkey:z1,signer:X0(),writable:X0(),source:A1(IT([k1("transaction"),k1("lookupTable")]))}),Tq=v({accountKeys:a(eV),signatures:a(l())}),Aq=v({parsed:A8(),program:l(),programId:z1}),Pq=v({accounts:a(z1),data:l(),programId:z1}),SI=IT([Pq,Aq]),NI=IT([v({parsed:A8(),program:l(),programId:l()}),v({accounts:a(l()),data:l(),programId:l()})]),Qq=O8(SI,NI,(T)=>{if("accounts"in T)return B8(T,Pq);else return B8(T,Aq)}),Cq=v({signatures:a(l()),message:v({accountKeys:a(eV),instructions:a(Qq),recentBlockhash:l(),addressTableLookups:A1(s(a(tV)))})}),R4=v({accountIndex:B(),mint:l(),owner:A1(l()),programId:A1(l()),uiTokenAmount:RI}),Wq=v({writable:a(z1),readonly:a(z1)}),j4=v({err:P8,fee:B(),innerInstructions:A1(s(a(v({index:B(),instructions:a(v({accounts:a(B()),data:l(),programIdIndex:B()}))})))),preBalances:a(B()),postBalances:a(B()),logMessages:A1(s(a(l()))),preTokenBalances:A1(s(a(R4))),postTokenBalances:A1(s(a(R4))),loadedAddresses:A1(Wq),computeUnitsConsumed:A1(B()),costUnits:A1(B())}),jW=v({err:P8,fee:B(),innerInstructions:A1(s(a(v({index:B(),instructions:a(Qq)})))),preBalances:a(B()),postBalances:a(B()),logMessages:A1(s(a(l()))),preTokenBalances:A1(s(a(R4))),postTokenBalances:A1(s(a(R4))),loadedAddresses:A1(Wq),computeUnitsConsumed:A1(B()),costUnits:A1(B())}),v8=IT([k1(0),k1("legacy")]),Q8=v({pubkey:l(),lamports:B(),postBalance:s(B()),rewardType:s(l()),commission:A1(s(B()))}),p_=H1(s(v({blockhash:l(),previousBlockhash:l(),parentSlot:B(),transactions:a(v({transaction:kW,meta:s(j4),version:A1(v8)})),rewards:A1(a(Q8)),blockTime:s(B()),blockHeight:s(B())}))),u_=H1(s(v({blockhash:l(),previousBlockhash:l(),parentSlot:B(),rewards:A1(a(Q8)),blockTime:s(B()),blockHeight:s(B())}))),d_=H1(s(v({blockhash:l(),previousBlockhash:l(),parentSlot:B(),transactions:a(v({transaction:Tq,meta:s(j4),version:A1(v8)})),rewards:A1(a(Q8)),blockTime:s(B()),blockHeight:s(B())}))),r_=H1(s(v({blockhash:l(),previousBlockhash:l(),parentSlot:B(),transactions:a(v({transaction:Cq,meta:s(jW),version:A1(v8)})),rewards:A1(a(Q8)),blockTime:s(B()),blockHeight:s(B())}))),c_=H1(s(v({blockhash:l(),previousBlockhash:l(),parentSlot:B(),transactions:a(v({transaction:Tq,meta:s(jW),version:A1(v8)})),rewards:A1(a(Q8)),blockTime:s(B()),blockHeight:s(B())}))),o_=H1(s(v({blockhash:l(),previousBlockhash:l(),parentSlot:B(),rewards:A1(a(Q8)),blockTime:s(B()),blockHeight:s(B())}))),n_=H1(s(v({blockhash:l(),previousBlockhash:l(),parentSlot:B(),transactions:a(v({transaction:kW,meta:s(j4)})),rewards:A1(a(Q8)),blockTime:s(B())}))),f_=H1(s(v({blockhash:l(),previousBlockhash:l(),parentSlot:B(),signatures:a(l()),blockTime:s(B())}))),i_=H1(s(v({slot:B(),meta:s(j4),blockTime:A1(s(B())),transaction:kW,version:A1(v8)}))),a_=H1(s(v({slot:B(),transaction:Cq,meta:s(jW),blockTime:A1(s(B())),version:A1(v8)}))),s_=H0(v({blockhash:l(),lastValidBlockHeight:B()})),t_=H0(X0()),wI=v({slot:B(),numTransactions:B(),numSlots:B(),samplePeriodSecs:B()}),e_=H1(a(wI)),Th=H0(s(v({feeCalculator:v({lamportsPerSignature:B()})}))),Ah=H1(l()),Ph=H1(l()),LI=v({err:P8,logs:a(l()),signature:l()}),Qh=v({result:k4(LI),subscription:B()});class E2{constructor(T){this._keypair=void 0,this._keypair=T??wV()}static generate(){return new E2(wV())}static fromSecretKey(T,A){if(T.byteLength!==64)throw Error("bad secret key size");let P=T.slice(32,64);if(!A||!A.skipValidation){let Q=T.slice(0,32),C=YW(Q);for(let W=0;W<32;W++)if(P[W]!==C[W])throw Error("provided secretKey is invalid")}return new E2({publicKey:P,secretKey:T})}static fromSeed(T){let A=YW(T),P=new Uint8Array(64);return P.set(T),P.set(A,32),new E2({publicKey:A,secretKey:P})}get publicKey(){return new n(this._keypair.publicKey)}get secretKey(){return new Uint8Array(this._keypair.secretKey)}}var z2=Object.freeze({CreateLookupTable:{index:0,layout:N.struct([N.u32("instruction"),m8("recentSlot"),N.u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:N.struct([N.u32("instruction")])},ExtendLookupTable:{index:2,layout:N.struct([N.u32("instruction"),m8(),N.seq(W1(),N.offset(N.u32(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:N.struct([N.u32("instruction")])},CloseLookupTable:{index:4,layout:N.struct([N.u32("instruction")])}});class Gq{constructor(){}static createLookupTable(T){let[A,P]=n.findProgramAddressSync([T.authority.toBuffer(),lC().encode(T.recentSlot)],this.programId),Q=z2.CreateLookupTable,C=C1(Q,{recentSlot:BigInt(T.recentSlot),bumpSeed:P}),W=[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:T.authority,isSigner:!0,isWritable:!1},{pubkey:T.payer,isSigner:!0,isWritable:!0},{pubkey:UT.programId,isSigner:!1,isWritable:!1}];return[new J1({programId:this.programId,keys:W,data:C}),A]}static freezeLookupTable(T){let A=z2.FreezeLookupTable,P=C1(A),Q=[{pubkey:T.lookupTable,isSigner:!1,isWritable:!0},{pubkey:T.authority,isSigner:!0,isWritable:!1}];return new J1({programId:this.programId,keys:Q,data:P})}static extendLookupTable(T){let A=z2.ExtendLookupTable,P=C1(A,{addresses:T.addresses.map((C)=>C.toBytes())}),Q=[{pubkey:T.lookupTable,isSigner:!1,isWritable:!0},{pubkey:T.authority,isSigner:!0,isWritable:!1}];if(T.payer)Q.push({pubkey:T.payer,isSigner:!0,isWritable:!0},{pubkey:UT.programId,isSigner:!1,isWritable:!1});return new J1({programId:this.programId,keys:Q,data:P})}static deactivateLookupTable(T){let A=z2.DeactivateLookupTable,P=C1(A),Q=[{pubkey:T.lookupTable,isSigner:!1,isWritable:!0},{pubkey:T.authority,isSigner:!0,isWritable:!1}];return new J1({programId:this.programId,keys:Q,data:P})}static closeLookupTable(T){let A=z2.CloseLookupTable,P=C1(A),Q=[{pubkey:T.lookupTable,isSigner:!1,isWritable:!0},{pubkey:T.authority,isSigner:!0,isWritable:!1},{pubkey:T.recipient,isSigner:!1,isWritable:!0}];return new J1({programId:this.programId,keys:Q,data:P})}}Gq.programId=new n("AddressLookupTab1e1111111111111111111111111");var Z4=Object.freeze({RequestUnits:{index:0,layout:N.struct([N.u8("instruction"),N.u32("units"),N.u32("additionalFee")])},RequestHeapFrame:{index:1,layout:N.struct([N.u8("instruction"),N.u32("bytes")])},SetComputeUnitLimit:{index:2,layout:N.struct([N.u8("instruction"),N.u32("units")])},SetComputeUnitPrice:{index:3,layout:N.struct([N.u8("instruction"),m8("microLamports")])}});class Uq{constructor(){}static requestUnits(T){let A=Z4.RequestUnits,P=C1(A,T);return new J1({keys:[],programId:this.programId,data:P})}static requestHeapFrame(T){let A=Z4.RequestHeapFrame,P=C1(A,T);return new J1({keys:[],programId:this.programId,data:P})}static setComputeUnitLimit(T){let A=Z4.SetComputeUnitLimit,P=C1(A,T);return new J1({keys:[],programId:this.programId,data:P})}static setComputeUnitPrice(T){let A=Z4.SetComputeUnitPrice,P=C1(A,{microLamports:BigInt(T.microLamports)});return new J1({keys:[],programId:this.programId,data:P})}}Uq.programId=new n("ComputeBudget111111111111111111111111111111");var _V=64,hV=32,mV=64,gV=N.struct([N.u8("numSignatures"),N.u8("padding"),N.u16("signatureOffset"),N.u16("signatureInstructionIndex"),N.u16("publicKeyOffset"),N.u16("publicKeyInstructionIndex"),N.u16("messageDataOffset"),N.u16("messageDataSize"),N.u16("messageInstructionIndex")]);class DW{constructor(){}static createInstructionWithPublicKey(T){let{publicKey:A,message:P,signature:Q,instructionIndex:C}=T;$T(A.length===hV,`Public Key must be ${hV} bytes but received ${A.length} bytes`),$T(Q.length===mV,`Signature must be ${mV} bytes but received ${Q.length} bytes`);let W=gV.span,G=W+A.length,J=G+Q.length,$=1,X=L.alloc(J+P.length),Z=C==null?65535:C;return gV.encode({numSignatures:$,padding:0,signatureOffset:G,signatureInstructionIndex:Z,publicKeyOffset:W,publicKeyInstructionIndex:Z,messageDataOffset:J,messageDataSize:P.length,messageInstructionIndex:Z},X),X.fill(A,W),X.fill(Q,G),X.fill(P,J),new J1({keys:[],programId:DW.programId,data:X})}static createInstructionWithPrivateKey(T){let{privateKey:A,message:P,instructionIndex:Q}=T;$T(A.length===_V,`Private key must be ${_V} bytes but received ${A.length} bytes`);try{let C=E2.fromSecretKey(A),W=C.publicKey.toBytes(),G=lV(P,C.secretKey);return this.createInstructionWithPublicKey({publicKey:W,message:P,signature:G,instructionIndex:Q})}catch(C){throw Error(`Error creating instruction; ${C}`)}}}DW.programId=new n("Ed25519SigVerify111111111111111111111111111");var EI=(T,A)=>{let P=q4.sign(T,A);return[P.toCompactRawBytes(),P.recovery]};q4.utils.isValidPrivateKey;var BI=q4.getPublicKey,vV=32,$W=20,yV=64,OI=11,VW=N.struct([N.u8("numSignatures"),N.u16("signatureOffset"),N.u8("signatureInstructionIndex"),N.u16("ethAddressOffset"),N.u8("ethAddressInstructionIndex"),N.u16("messageDataOffset"),N.u16("messageDataSize"),N.u8("messageInstructionIndex"),N.blob(20,"ethAddress"),N.blob(64,"signature"),N.u8("recoveryId")]);class B2{constructor(){}static publicKeyToEthAddress(T){$T(T.length===yV,`Public key must be ${yV} bytes but received ${T.length} bytes`);try{return L.from(TW(U1(T))).slice(-$W)}catch(A){throw Error(`Error constructing Ethereum address: ${A}`)}}static createInstructionWithPublicKey(T){let{publicKey:A,message:P,signature:Q,recoveryId:C,instructionIndex:W}=T;return B2.createInstructionWithEthAddress({ethAddress:B2.publicKeyToEthAddress(A),message:P,signature:Q,recoveryId:C,instructionIndex:W})}static createInstructionWithEthAddress(T){let{ethAddress:A,message:P,signature:Q,recoveryId:C,instructionIndex:W=0}=T,G;if(typeof A==="string")if(A.startsWith("0x"))G=L.from(A.substr(2),"hex");else G=L.from(A,"hex");else G=A;$T(G.length===$W,`Address must be ${$W} bytes but received ${G.length} bytes`);let J=1+OI,$=J,X=J+G.length,Z=X+Q.length+1,R=1,D=L.alloc(VW.span+P.length);return VW.encode({numSignatures:R,signatureOffset:X,signatureInstructionIndex:W,ethAddressOffset:$,ethAddressInstructionIndex:W,messageDataOffset:Z,messageDataSize:P.length,messageInstructionIndex:W,signature:U1(Q),ethAddress:U1(G),recoveryId:C},D),D.fill(U1(P),VW.span),new J1({keys:[],programId:B2.programId,data:D})}static createInstructionWithPrivateKey(T){let{privateKey:A,message:P,instructionIndex:Q}=T;$T(A.length===vV,`Private key must be ${vV} bytes but received ${A.length} bytes`);try{let C=U1(A),W=BI(C,!1).slice(1),G=L.from(TW(U1(P))),[J,$]=EI(G,C);return this.createInstructionWithPublicKey({publicKey:W,message:P,signature:J,recoveryId:$,instructionIndex:Q})}catch(C){throw Error(`Error creating instruction; ${C}`)}}}B2.programId=new n("KeccakSecp256k11111111111111111111111111111");var Jq,xI=new n("StakeConfig11111111111111111111111111111111");class D4{constructor(T,A,P){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=T,this.epoch=A,this.custodian=P}}Jq=D4;D4.default=new Jq(0,0,n.default);var BA=Object.freeze({Initialize:{index:0,layout:N.struct([N.u32("instruction"),nz(),fz()])},Authorize:{index:1,layout:N.struct([N.u32("instruction"),W1("newAuthorized"),N.u32("stakeAuthorizationType")])},Delegate:{index:2,layout:N.struct([N.u32("instruction")])},Split:{index:3,layout:N.struct([N.u32("instruction"),N.ns64("lamports")])},Withdraw:{index:4,layout:N.struct([N.u32("instruction"),N.ns64("lamports")])},Deactivate:{index:5,layout:N.struct([N.u32("instruction")])},Merge:{index:7,layout:N.struct([N.u32("instruction")])},AuthorizeWithSeed:{index:8,layout:N.struct([N.u32("instruction"),W1("newAuthorized"),N.u32("stakeAuthorizationType"),h8("authoritySeed"),W1("authorityOwner")])}}),Ch=Object.freeze({Staker:{index:0},Withdrawer:{index:1}});class FW{constructor(){}static initialize(T){let{stakePubkey:A,authorized:P,lockup:Q}=T,C=Q||D4.default,W=BA.Initialize,G=C1(W,{authorized:{staker:U1(P.staker.toBuffer()),withdrawer:U1(P.withdrawer.toBuffer())},lockup:{unixTimestamp:C.unixTimestamp,epoch:C.epoch,custodian:U1(C.custodian.toBuffer())}}),J={keys:[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:x2,isSigner:!1,isWritable:!1}],programId:this.programId,data:G};return new J1(J)}static createAccountWithSeed(T){let A=new K1;A.add(UT.createAccountWithSeed({fromPubkey:T.fromPubkey,newAccountPubkey:T.stakePubkey,basePubkey:T.basePubkey,seed:T.seed,lamports:T.lamports,space:this.space,programId:this.programId}));let{stakePubkey:P,authorized:Q,lockup:C}=T;return A.add(this.initialize({stakePubkey:P,authorized:Q,lockup:C}))}static createAccount(T){let A=new K1;A.add(UT.createAccount({fromPubkey:T.fromPubkey,newAccountPubkey:T.stakePubkey,lamports:T.lamports,space:this.space,programId:this.programId}));let{stakePubkey:P,authorized:Q,lockup:C}=T;return A.add(this.initialize({stakePubkey:P,authorized:Q,lockup:C}))}static delegate(T){let{stakePubkey:A,authorizedPubkey:P,votePubkey:Q}=T,C=BA.Delegate,W=C1(C);return new K1().add({keys:[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:Q,isSigner:!1,isWritable:!1},{pubkey:JA,isSigner:!1,isWritable:!1},{pubkey:JW,isSigner:!1,isWritable:!1},{pubkey:xI,isSigner:!1,isWritable:!1},{pubkey:P,isSigner:!0,isWritable:!1}],programId:this.programId,data:W})}static authorize(T){let{stakePubkey:A,authorizedPubkey:P,newAuthorizedPubkey:Q,stakeAuthorizationType:C,custodianPubkey:W}=T,G=BA.Authorize,J=C1(G,{newAuthorized:U1(Q.toBuffer()),stakeAuthorizationType:C.index}),$=[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:JA,isSigner:!1,isWritable:!0},{pubkey:P,isSigner:!0,isWritable:!1}];if(W)$.push({pubkey:W,isSigner:!0,isWritable:!1});return new K1().add({keys:$,programId:this.programId,data:J})}static authorizeWithSeed(T){let{stakePubkey:A,authorityBase:P,authoritySeed:Q,authorityOwner:C,newAuthorizedPubkey:W,stakeAuthorizationType:G,custodianPubkey:J}=T,$=BA.AuthorizeWithSeed,X=C1($,{newAuthorized:U1(W.toBuffer()),stakeAuthorizationType:G.index,authoritySeed:Q,authorityOwner:U1(C.toBuffer())}),Z=[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:P,isSigner:!0,isWritable:!1},{pubkey:JA,isSigner:!1,isWritable:!1}];if(J)Z.push({pubkey:J,isSigner:!0,isWritable:!1});return new K1().add({keys:Z,programId:this.programId,data:X})}static splitInstruction(T){let{stakePubkey:A,authorizedPubkey:P,splitStakePubkey:Q,lamports:C}=T,W=BA.Split,G=C1(W,{lamports:C});return new J1({keys:[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:Q,isSigner:!1,isWritable:!0},{pubkey:P,isSigner:!0,isWritable:!1}],programId:this.programId,data:G})}static split(T,A){let P=new K1;return P.add(UT.createAccount({fromPubkey:T.authorizedPubkey,newAccountPubkey:T.splitStakePubkey,lamports:A,space:this.space,programId:this.programId})),P.add(this.splitInstruction(T))}static splitWithSeed(T,A){let{stakePubkey:P,authorizedPubkey:Q,splitStakePubkey:C,basePubkey:W,seed:G,lamports:J}=T,$=new K1;if($.add(UT.allocate({accountPubkey:C,basePubkey:W,seed:G,space:this.space,programId:this.programId})),A&&A>0)$.add(UT.transfer({fromPubkey:T.authorizedPubkey,toPubkey:C,lamports:A}));return $.add(this.splitInstruction({stakePubkey:P,authorizedPubkey:Q,splitStakePubkey:C,lamports:J}))}static merge(T){let{stakePubkey:A,sourceStakePubKey:P,authorizedPubkey:Q}=T,C=BA.Merge,W=C1(C);return new K1().add({keys:[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:P,isSigner:!1,isWritable:!0},{pubkey:JA,isSigner:!1,isWritable:!1},{pubkey:JW,isSigner:!1,isWritable:!1},{pubkey:Q,isSigner:!0,isWritable:!1}],programId:this.programId,data:W})}static withdraw(T){let{stakePubkey:A,authorizedPubkey:P,toPubkey:Q,lamports:C,custodianPubkey:W}=T,G=BA.Withdraw,J=C1(G,{lamports:C}),$=[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:Q,isSigner:!1,isWritable:!0},{pubkey:JA,isSigner:!1,isWritable:!1},{pubkey:JW,isSigner:!1,isWritable:!1},{pubkey:P,isSigner:!0,isWritable:!1}];if(W)$.push({pubkey:W,isSigner:!0,isWritable:!1});return new K1().add({keys:$,programId:this.programId,data:J})}static deactivate(T){let{stakePubkey:A,authorizedPubkey:P}=T,Q=BA.Deactivate,C=C1(Q);return new K1().add({keys:[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:JA,isSigner:!1,isWritable:!1},{pubkey:P,isSigner:!0,isWritable:!1}],programId:this.programId,data:C})}}FW.programId=new n("Stake11111111111111111111111111111111111111");FW.space=200;var I2=Object.freeze({InitializeAccount:{index:0,layout:N.struct([N.u32("instruction"),iz()])},Authorize:{index:1,layout:N.struct([N.u32("instruction"),W1("newAuthorized"),N.u32("voteAuthorizationType")])},Withdraw:{index:3,layout:N.struct([N.u32("instruction"),N.ns64("lamports")])},UpdateValidatorIdentity:{index:4,layout:N.struct([N.u32("instruction")])},AuthorizeWithSeed:{index:10,layout:N.struct([N.u32("instruction"),az()])}}),Wh=Object.freeze({Voter:{index:0},Withdrawer:{index:1}});class F4{constructor(){}static initializeAccount(T){let{votePubkey:A,nodePubkey:P,voteInit:Q}=T,C=I2.InitializeAccount,W=C1(C,{voteInit:{nodePubkey:U1(Q.nodePubkey.toBuffer()),authorizedVoter:U1(Q.authorizedVoter.toBuffer()),authorizedWithdrawer:U1(Q.authorizedWithdrawer.toBuffer()),commission:Q.commission}}),G={keys:[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:x2,isSigner:!1,isWritable:!1},{pubkey:JA,isSigner:!1,isWritable:!1},{pubkey:P,isSigner:!0,isWritable:!1}],programId:this.programId,data:W};return new J1(G)}static createAccount(T){let A=new K1;return A.add(UT.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:P,newAuthorizedPubkey:Q,voteAuthorizationType:C}=T,W=I2.Authorize,G=C1(W,{newAuthorized:U1(Q.toBuffer()),voteAuthorizationType:C.index}),J=[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:JA,isSigner:!1,isWritable:!1},{pubkey:P,isSigner:!0,isWritable:!1}];return new K1().add({keys:J,programId:this.programId,data:G})}static authorizeWithSeed(T){let{currentAuthorityDerivedKeyBasePubkey:A,currentAuthorityDerivedKeyOwnerPubkey:P,currentAuthorityDerivedKeySeed:Q,newAuthorizedPubkey:C,voteAuthorizationType:W,votePubkey:G}=T,J=I2.AuthorizeWithSeed,$=C1(J,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:U1(P.toBuffer()),currentAuthorityDerivedKeySeed:Q,newAuthorized:U1(C.toBuffer()),voteAuthorizationType:W.index}}),X=[{pubkey:G,isSigner:!1,isWritable:!0},{pubkey:JA,isSigner:!1,isWritable:!1},{pubkey:A,isSigner:!0,isWritable:!1}];return new K1().add({keys:X,programId:this.programId,data:$})}static withdraw(T){let{votePubkey:A,authorizedWithdrawerPubkey:P,lamports:Q,toPubkey:C}=T,W=I2.Withdraw,G=C1(W,{lamports:Q}),J=[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:C,isSigner:!1,isWritable:!0},{pubkey:P,isSigner:!0,isWritable:!1}];return new K1().add({keys:J,programId:this.programId,data:G})}static safeWithdraw(T,A,P){if(T.lamports>A-P)throw Error("Withdraw will leave vote account with insufficient funds.");return F4.withdraw(T)}static updateValidatorIdentity(T){let{votePubkey:A,authorizedWithdrawerPubkey:P,nodePubkey:Q}=T,C=I2.UpdateValidatorIdentity,W=C1(C),G=[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:Q,isSigner:!0,isWritable:!1},{pubkey:P,isSigner:!0,isWritable:!1}];return new K1().add({keys:G,programId:this.programId,data:W})}}F4.programId=new n("Vote111111111111111111111111111111111111111");F4.space=3762;var Gh=new n("Va1idator1nfo111111111111111111111111111111"),Uh=v({name:l(),website:A1(l()),details:A1(l()),iconUrl:A1(l()),keybaseUsername:A1(l())});var Jh=new n("Vote111111111111111111111111111111111111111"),$h=N.struct([W1("nodePubkey"),W1("authorizedWithdrawer"),N.u8("commission"),N.nu64(),N.seq(N.struct([N.nu64("slot"),N.u32("confirmationCount")]),N.offset(N.u32(),-8),"votes"),N.u8("rootSlotValid"),N.nu64("rootSlot"),N.nu64(),N.seq(N.struct([N.nu64("epoch"),W1("authorizedVoter")]),N.offset(N.u32(),-8),"authorizedVoters"),N.struct([N.seq(N.struct([W1("authorizedPubkey"),N.nu64("epochOfLastAuthorizedSwitch"),N.nu64("targetEpoch")]),32,"buf"),N.nu64("idx"),N.u8("isEmpty")],"priorVoters"),N.nu64(),N.seq(N.struct([N.nu64("epoch"),N.nu64("credits"),N.nu64("prevCredits")]),N.offset(N.u32(),-8),"epochCredits"),N.struct([N.nu64("slot"),N.nu64("timestamp")],"lastTimestamp")]);var fT=new n("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),Yh=new n("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"),v0=new n("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"),Zh=new n("So11111111111111111111111111111111111111112"),Xh=new n("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");var C8=(T)=>{let A=T.decode.bind(T),P=T.encode.bind(T);return{decode:A,encode:P}};var MW=yT(CA(),1),OA=yT(Vq(),1);var z4=(T)=>(A)=>{let P=MW.blob(T,A),{encode:Q,decode:C}=C8(P),W=P;return W.decode=(G,J)=>{let $=C(G,J);return OA.toBigIntLE(Buffer.from($))},W.encode=(G,J,$)=>{let X=OA.toBufferLE(G,T);return Q(X,J,$)},W},I4=(T)=>(A)=>{let P=MW.blob(T,A),{encode:Q,decode:C}=C8(P),W=P;return W.decode=(G,J)=>{let $=C(G,J);return OA.toBigIntBE(Buffer.from($))},W.encode=(G,J,$)=>{let X=OA.toBufferBE(G,T);return Q(X,J,$)},W},qq=z4(8),jh=I4(8),Dh=z4(16),Fh=I4(16),Mh=z4(24),zh=I4(24),Ih=z4(32),Sh=I4(32);var Yq=yT(CA(),1);var Zq=(T)=>{let A=Yq.u8(T),{encode:P,decode:Q}=C8(A),C=A;return C.decode=(W,G)=>{return!!Q(W,G)},C.encode=(W,G,J)=>{let $=Number(W);return P($,G,J)},C};var Xq=yT(CA(),1);var zW=(T)=>{let A=Xq.blob(32,T),{encode:P,decode:Q}=C8(A),C=A;return C.decode=(W,G)=>{let J=Q(W,G);return new n(J)},C.encode=(W,G,J)=>{let $=W.toBuffer();return P($,G,J)},C};class Hq extends Error{constructor(T){super(T)}}class IW extends Hq{constructor(){super(...arguments);this.name="TokenOwnerOffCurveError"}}var y8;(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"})(y8||(y8={}));var W8=yT(CA(),1);function Kq(T,A,P){if(P.length){T.push({pubkey:A,isSigner:!1,isWritable:!1});for(let Q of P)T.push({pubkey:Q instanceof n?Q:Q.publicKey,isSigner:!0,isWritable:!1})}else T.push({pubkey:A,isSigner:!0,isWritable:!1});return T}var pI=W8.struct([W8.u32("mintAuthorityOption"),zW("mintAuthority"),qq("supply"),W8.u8("decimals"),Zq("isInitialized"),W8.u32("freezeAuthorityOption"),zW("freezeAuthority")]),rh=pI.span;function _2(T,A,P=!1,Q=fT,C=v0){if(!P&&!n.isOnCurve(A.toBuffer()))throw new IW;let[W]=n.findProgramAddressSync([A.toBuffer(),Q.toBuffer(),T.toBuffer()],C);return W}var S4=yT(CA(),1);var Rq=S4.struct([S4.u8("instruction")]);function SW(T,A,P,Q=[],C=fT){let W=Kq([{pubkey:T,isSigner:!1,isWritable:!0},{pubkey:A,isSigner:!1,isWritable:!0}],P,Q),G=Buffer.alloc(Rq.span);return Rq.encode({instruction:y8.CloseAccount},G),new J1({keys:W,programId:C,data:G})}function N4(T,A,P,Q,C=fT,W=v0){return uI(T,A,P,Q,Buffer.alloc(0),C,W)}function uI(T,A,P,Q,C,W=fT,G=v0){let J=[{pubkey:T,isSigner:!0,isWritable:!0},{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:P,isSigner:!1,isWritable:!1},{pubkey:Q,isSigner:!1,isWritable:!1},{pubkey:UT.programId,isSigner:!1,isWritable:!1},{pubkey:W,isSigner:!1,isWritable:!1}];return new J1({keys:J,programId:G,data:C})}var w4=yT(CA(),1);var kq=w4.struct([w4.u8("instruction")]);function jq(T,A=fT){let P=[{pubkey:T,isSigner:!1,isWritable:!0}],Q=Buffer.alloc(kq.span);return kq.encode({instruction:y8.SyncNative},Q),new J1({keys:P,programId:A,data:Q})}function L4(T){if(typeof T==="string")return new n(T);if(typeof T==="object"&&"address"in T)return new n(T.address);return new n(T)}function Dq(T){if(T instanceof n)return T;return L4(T)}function dI(T){return{programAddress:b(T.programId.toBase58()),accounts:T.keys.map((A)=>({address:b(A.pubkey.toBase58()),role:A.isSigner?A.isWritable?X1.WRITABLE_SIGNER:X1.READONLY_SIGNER:A.isWritable?X1.WRITABLE:X1.READONLY})),data:T.data}}function NW(T){let{payer:A,owner:P,mint:Q,tokenProgram:C=fT,associatedTokenProgram:W=v0}=T,G=L4(A),J=L4(P),$=L4(Q),X=Dq(C),Z=Dq(W),R=_2($,J,!1,X,Z);return dI(N4(G,R,J,$,X,Z))}var Fq=w0,Mq=(T,A)=>{if(!Number.isFinite(T)||T<=0)throw Error(`${A} must be a positive number`)},E4=(T)=>({lpFeeBps:T.lpFeeBps,protocolFeeBps:T.protocolFeeBps,creatorFeeBps:T.creatorFeeBps});async function rI(T,A,P,Q){let C=Q?.curve?Promise.resolve(Q.curve):(async()=>{let G=await r0(T);return(await bA(A,G,{commitment:P})).data})(),W=Q?.fees?Promise.resolve(Q.fees):(async()=>{let G=await c0(),J=await T2(A,G,{commitment:P});return E4(J.data.flatFees)})();try{let[G,J]=await Promise.all([C,W]);return{curve:G,fees:J}}catch(G){throw Error("Failed to load bonding curve state. Provide overrides or ensure the RPC endpoint can access Pump accounts.",{cause:G})}}async function cI(T,A,P){try{let Q=await r0(T),C=await bA(A,Q,{commitment:P});if(C.data.complete)return null;let W=await c0(),G=await T2(A,W,{commitment:P}),J=E4(G.data.flatFees);return{curve:C.data,fees:J,creator:C.data.creator}}catch{return null}}async function zq(T){Mq(T.solAmount,"solAmount");let A=T.slippageBps??L0;E0(A);let P=T.feeRecipient??Fq,Q=T.rpc,C=T.commitment??JT(),W=null;if(T.curveStateOverride&&T.feeStructureOverride)W={curve:T.curveStateOverride,fees:T.feeStructureOverride,creator:T.bondingCurveCreator?b(T.bondingCurveCreator):T.curveStateOverride.creator};else try{if(W=await cI(T.mint,Q,C),!W)throw Error("Token has migrated to AMM (bonding curve is complete or doesn't exist). This token can only be traded via AMM swaps.")}catch(G){try{let J=await r0(T.mint),$=await bA(Q,J,{commitment:C});if($.data.complete)throw Error("Token has migrated to AMM (bonding curve is complete). This token can only be traded via AMM swaps.");let X=await c0(),Z=await T2(Q,X,{commitment:C});W={curve:$.data,fees:E4(Z.data.flatFees),creator:$.data.creator}}catch(J){throw Error(`Unable to determine token state (bonding curve vs AMM): ${J.message}. Check network connectivity or provide curveStateOverride and feeStructureOverride.`)}}if(W){let G=await r0(T.mint),J=await bA(Q,G,{commitment:C}),$=await c0(),X=await T2(Q,$,{commitment:C}),Z={curve:J.data,fees:E4(X.data.flatFees),creator:J.data.creator},R=XA(T.solAmount),z=fJ(Z.curve,Z.fees,R).tokenAmount,E=L6(Z.curve,Z.fees,z).totalSolCostLamports*2n,w=b(T.mint),[O]=await MT({owner:b(T.user.address),mint:w,tokenProgram:b(FT)}),m=null;try{if(!(await Q.getAccountInfo(O).send()).value)m=NW({payer:T.user,owner:T.user,mint:w})}catch{m=NW({payer:T.user,owner:T.user,mint:w})}let g=await FQ({user:T.user,mint:T.mint,tokenAmount:z,maxSolCostLamports:E,feeRecipient:P,trackVolume:T.trackVolume,bondingCurveCreator:Z.creator,rpc:Q,commitment:C});if(m)return{...g,prepend:[m]};return g}throw Error("Token has migrated to AMM. Use AMM-specific buy functions or ensure bonding curve is active.")}var oI=1e4;function nI(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 Iq(T){let A=T.slippageBps??L0;E0(A);let P=T.feeRecipient??Fq,Q=T.rpc,C=T.commitment??JT(),{curve:W,fees:G}=await rI(T.mint,Q,C,{curve:T.curveStateOverride,fees:T.feeStructureOverride}),J=T.bondingCurveCreator??W.creator,$=T.useWalletPercentage??!1,X=b(T.mint),Z;if($){let z=T.walletPercentage??100,S=nI(z),[E]=await MT({owner:b(T.user.address),mint:X,tokenProgram:b(FT)}),w=await Q.getTokenAccountBalance(E).send(),O=BigInt(w.value.amount);if(O===0n)throw Error("Wallet token balance is zero; nothing to sell");if(Z=O*S/BigInt(oI),Z<=0n)Z=1n}else{if(T.tokenAmount===void 0)throw Error("tokenAmount is required when useWalletPercentage is false");Mq(T.tokenAmount,"tokenAmount");let z=T.tokenDecimals??6;Z=e8(T.tokenAmount,z)}let R=iJ(W,G,Z),D=t8(R.solOutputLamports,A);if(D<=0n)throw Error("Slippage settings would result in zero SOL output");return await MQ({user:T.user,mint:T.mint,tokenAmountRaw:Z,minSolOutputLamports:D,feeRecipient:P,bondingCurveCreator:J,rpc:Q,commitment:C})}async function fI(T,A,P,Q){if(!Q)throw Error("quickBuy requires options with an RPC client (options.rpc)");let{rpc:C,...W}=Q;return zq({user:T,mint:A,solAmount:P,rpc:C,...W})}async function iI(T,A,P,Q){if(!Q)throw Error("quickSell requires options with an RPC client (options.rpc)");let{rpc:C,...W}=Q;return Iq({user:T,mint:A,tokenAmount:P,rpc:C,...W})}async function wW(T){let{user:A,mint:P,mintAuthority:Q,name:C,symbol:W,uri:G,firstBuyTokenAmount:J,estimatedFirstBuyCost:$,slippageBps:X=L0,feeRecipient:Z=w0,bondingCurveCreator:R,trackVolume:D,rpc:z,commitment:S=JT()}=T;if(E0(X),!C||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(J<=0n)throw Error("First buy token amount must be positive");if($<=0n)throw Error("Estimated first buy cost must be positive");let E=await cJ({user:A,mint:P,mintAuthority:Q,name:C,symbol:W,uri:G}),w=s8($,X),O=await a8({user:A,mint:P.address,tokenAmount:J,maxSolCostLamports:w,feeRecipient:Z,trackVolume:D??!0,bondingCurveCreator:R??A.address,rpc:z,commitment:S});return{createInstruction:E,buyInstruction:O}}function aI(T){let{name:A,symbol:P,uri:Q}=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(!P||P.length===0)throw Error("Token symbol is required");if(P.length>10)throw Error("Token symbol too long (max 10 characters)");if(!Q||Q.length===0)throw Error("Metadata URI is required");if(!Q.startsWith("http://")&&!Q.startsWith("https://")&&!Q.startsWith("ipfs://"))throw Error("Metadata URI must be a valid URL or IPFS link")}var Sq=b("ComputeBudget111111111111111111111111111111");async function LW({instructions:T,payer:A,additionalSigners:P=[],latestBlockhash:Q,lastValidBlockHeight:C,version:W="legacy",rpc:G,commitment:J=JT(),prependInstructions:$=[],appendInstructions:X=[],priorityFees:Z}){let R=typeof A==="string"?b(A):A.address,D=GJ({version:W}),z=Nq(Z),S=[],E=[];for(let d of T)if("prepend"in d&&Array.isArray(d.prepend)){S.push(...d.prepend);let{prepend:_,...t}=d;E.push(t)}else E.push(d);let w=[...z,...S,...$??[],...E,...X??[]],O=new Map;for(let d of w)if(D=$J(d,D),d.accounts){for(let _ of d.accounts)if("signer"in _&&_.signer&&typeof _.signer==="object"&&"address"in _.signer){let t=_.signer;O.set(t.address,t)}}let m=JJ(R,D),g=[];if(tI(A))m=EJ(A,m),g.push(A);for(let d of O.values())if(!g.some((_)=>_.address===d.address))g.push(d);if(P.length>0){for(let d of P)if(S0(d)&&!g.some((_)=>_.address===d.address))g.push(d)}let p=g.length>0?LJ(g,m):m,c=Q,o=C!==void 0?BigInt(C):void 0;if(!c||o===void 0){let{value:d}=await G.getLatestBlockhash({commitment:J}).send();if(c=c??d.blockhash,o===void 0)o=BigInt(d.lastValidBlockHeight)}return{transactionMessage:PJ({blockhash:c,lastValidBlockHeight:o},p),latestBlockhash:c,lastValidBlockHeight:o}}async function EW({instructions:T,payer:A,additionalSigners:P=[],latestBlockhash:Q,lastValidBlockHeight:C,version:W,prependInstructions:G,appendInstructions:J,priorityFees:$,rpc:X,rpcSubscriptions:Z,commitment:R=JT(),sendOptions:D={}}){let z=await LW({instructions:T,payer:A,additionalSigners:P,latestBlockhash:Q,lastValidBlockHeight:C,version:W,prependInstructions:G,appendInstructions:J,priorityFees:$,rpc:X,commitment:R}),S=await XQ(z.transactionMessage),E=j6(S),w=hJ({rpc:X,rpcSubscriptions:Z}),O={commitment:R};if(D.abortSignal)O.abortSignal=D.abortSignal;if(D.skipPreflight!==void 0)O.skipPreflight=D.skipPreflight;if(D.minContextSlot!==void 0)O.minContextSlot=BigInt(D.minContextSlot);if(D.maxRetries!==void 0)O.maxRetries=D.maxRetries;if(D.preflightCommitment)O.preflightCommitment=D.preflightCommitment;await w(S,O);let g=(await X.getSignatureStatuses([E],{searchTransactionHistory:!1}).send()).value?.[0]??null;if(g?.err)try{let c=await X.getTransaction(E,{commitment:R,encoding:"json",maxSupportedTransactionVersion:0}).send(),o="Transaction failed";if(g.err)o=`Transaction failed: ${typeof g.err==="object"?JSON.stringify(g.err,(d,_)=>typeof _==="bigint"?_.toString():_):String(g.err)}`;if(c?.meta?.err)o=`Transaction failed: ${typeof c.meta.err==="object"?JSON.stringify(c.meta.err,(d,_)=>typeof _==="bigint"?_.toString():_):String(c.meta.err)}`;if(c?.meta?.logMessages){let f=c.meta.logMessages.filter((d)=>d.toLowerCase().includes("error")||d.includes("Program log:"));if(f.length>0)o+=`
|
|
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${W.invalid.length===1?"":"(s)"} [\`${W.invalid.map((G)=>G.toBase58()).join("`, `")}\`].`;if(W.missing)$+=`
|
|
16
|
+
Missing signature for public key${W.missing.length===1?"":"(s)"} [\`${W.missing.map((G)=>G.toBase58()).join("`, `")}\`].`;throw Error($)}}return this._serialize(J)}_serialize(T){let{signatures:A}=this,Q=[];v2(Q,A.length);let J=Q.length+A.length*64+T.length,W=E.alloc(J);return R0(A.length<256),E.from(Q).copy(W,0),A.forEach(({signature:$},G)=>{if($!==null)R0($.length===64,"signature has invalid length"),E.from($).copy(W,Q.length+G*64)}),T.copy(W,Q.length+A.length*64),R0(W.length<=kQ,`Transaction too large: ${W.length} > ${kQ}`),W}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=m2(A),J=[];for(let W=0;W<Q;W++){let $=y2(A,0,s9);J.push(e0.default.encode(E.from($)))}return j1.populate(u2.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,W)=>{let $={signature:J==e0.default.encode(DN)?null:e0.default.decode(J),publicKey:T.accountKeys[W]};Q.signatures.push($)}),T.instructions.forEach((J)=>{let W=J.accounts.map(($)=>{let G=T.accountKeys[$];return{pubkey:G,isSigner:Q.signatures.some((Y)=>Y.publicKey.toString()===G.toString())||T.isAccountSigner($),isWritable:T.isAccountWritable($)}});Q.instructions.push(new Z1({keys:W,programId:T.accountKeys[J.programIdIndex],data:e0.default.decode(J.data)}))}),Q._message=T,Q._json=Q.toJSON(),Q}}var MN=160,kN=64,zN=MN/kN,FN=1000/zN,X8=new a("SysvarC1ock11111111111111111111111111111111"),ux=new a("SysvarEpochSchedu1e111111111111111111111111"),dx=new a("Sysvar1nstructions1111111111111111111111111"),H$=new a("SysvarRecentB1ockHashes11111111111111111111"),d2=new a("SysvarRent111111111111111111111111111111111"),cx=new a("SysvarRewards111111111111111111111111111111"),fx=new a("SysvarS1otHashes111111111111111111111111111"),rx=new a("SysvarS1otHistory11111111111111111111111111"),V$=new a("SysvarStakeHistory1111111111111111111111111");class JP extends Error{constructor({action:T,signature:A,transactionMessage:Q,logs:J}){let W=J?`Logs:
|
|
17
|
+
${JSON.stringify(J.slice(-10),null,2)}. `:"",$="\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}. `+W+"\nCatch the `SendTransactionError` and call `getLogs()` on it for full details.";break;case"simulate":G=`Simulation failed.
|
|
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+=`
|
|
21
21
|
Program logs:
|
|
22
|
-
${
|
|
23
|
-
`)}`}throw Error(o)}catch(p){let c=g.err&&typeof g.err==="object"?JSON.stringify(g.err,(o,f)=>typeof f==="bigint"?f.toString():f):String(g.err);throw Error(`Transaction failed: ${c}`)}return{signature:E,slot:g?.slot??null}}async function sI({instructions:T,payer:A,additionalSigners:P=[],latestBlockhash:Q,lastValidBlockHeight:C,version:W,prependInstructions:G,appendInstructions:J,priorityFees:$,rpc:X,commitment:Z=JT(),options:R={}}){let D=await LW({instructions:T,payer:A,additionalSigners:P,latestBlockhash:Q,lastValidBlockHeight:C,version:W,prependInstructions:G,appendInstructions:J,priorityFees:$,rpc:X,commitment:Z}),z=await XQ(D.transactionMessage),S=D6(z),E={commitment:R.commitment??Z};if(R.minContextSlot!==void 0)E.minContextSlot=BigInt(R.minContextSlot);if(R.sigVerify!==void 0)E.sigVerify=R.sigVerify;if(R.replaceRecentBlockhash!==void 0){if(R.sigVerify)throw Error("replaceRecentBlockhash cannot be true when sigVerify is enabled.");E.replaceRecentBlockhash=R.replaceRecentBlockhash}if(R.accounts)E.accounts=R.accounts;let w=await X.simulateTransaction(S,E).send();return{context:{slot:Number(w.context.slot)},value:{err:w.value.err,logs:w.value.logs,unitsConsumed:w.value.unitsConsumed!==void 0?Number(w.value.unitsConsumed):void 0,accounts:w.value.accounts,returnData:w.value.returnData??void 0}}}function tI(T){return typeof T!=="string"&&S0(T)}function Nq(T){if(!T)return[];let A=[];if(T.computeUnitLimit!==void 0&&T.computeUnitLimit>0)A.push(eI(T.computeUnitLimit));if(T.computeUnitPriceMicroLamports!==void 0&&BigInt(T.computeUnitPriceMicroLamports)>0n)A.push(TS(BigInt(T.computeUnitPriceMicroLamports)));return A}function eI(T){let A=new Uint8Array(5);return A[0]=0,new DataView(A.buffer).setUint32(1,T,!0),{programAddress:Sq,accounts:[],data:A}}function TS(T){let A=new Uint8Array(9);return A[0]=3,new DataView(A.buffer).setBigUint64(1,T,!0),{programAddress:Sq,accounts:[],data:A}}async function AS(T){let{creator:A,metadata:P,firstBuyTokenAmount:Q,estimatedFirstBuyCost:C,slippageBps:W,feeRecipient:G,bondingCurveCreator:J,mintAuthority:$,mint:X,priorityFees:Z,prependInstructions:R,appendInstructions:D,additionalSigners:z,sendOptions:S,commitment:E=JT(),rpc:w,rpcSubscriptions:O}=T,m=X??await BJ(),g={user:A,mint:m,mintAuthority:$??A.address,name:P.name,symbol:P.symbol,uri:P.uri,firstBuyTokenAmount:Q,estimatedFirstBuyCost:C,slippageBps:W,feeRecipient:G,bondingCurveCreator:J??A.address,rpc:w,commitment:E},{createInstruction:p,buyInstruction:c}=await wW(g);return{...await EW({instructions:[p,c],payer:A,commitment:E,priorityFees:Z,prependInstructions:R,appendInstructions:D,additionalSigners:PS([m,...z??[]]),sendOptions:S,rpc:w,rpcSubscriptions:O}),mint:m,createInstruction:p,buyInstruction:c}}function PS(T){let A=new Set,P=[];for(let Q of T){let C=Q.address;if(!A.has(C))A.add(C),P.push(Q)}return P}var O4=new TextEncoder,B4=HT();async function BW(T,A,P,Q){let C=new Uint8Array(2);C[0]=T&255,C[1]=T>>8&255;let[W]=await j1({programAddress:b(N0),seeds:[O4.encode("pool"),C,B4.encode(b(A)),B4.encode(b(P)),B4.encode(b(Q))]});return W}async function OW(T){let[A]=await j1({programAddress:b(N0),seeds:[O4.encode("pool_lp_mint"),B4.encode(b(T))]});return A}async function xW(T,A){let[P]=await gJ({owner:T,mint:A});return P}async function h2(T,A,P){let[Q]=await MT({owner:T,mint:A,tokenProgram:P});return Q}async function _W(){let[T]=await j1({programAddress:b(N0),seeds:[O4.encode("global_config")]});return T}async function hW(){let[T]=await j1({programAddress:b(N0),seeds:[O4.encode("__event_authority")]});return T}var I1="pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA";function K0(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 S1(T,A){return(P)=>{if(!P.value){if(A==="omitted")return;return Object.freeze({address:T,role:X1.READONLY})}let Q=P.isWritable?X1.WRITABLE:X1.READONLY;return Object.freeze({address:K0(P.value),role:wq(P.value)?X6(Q):Q,...wq(P.value)?{signer:P.value}:{}})}}function wq(T){return!!T&&typeof T==="object"&&"address"in T&&S0(T)}var Tg=new Uint8Array([242,40,117,145,73,96,105,104]);var Cg=new Uint8Array([209,11,115,87,213,23,124,204]);var Qv=new Uint8Array([102,6,61,18,1,218,235,234]);var Jv=new Uint8Array([198,46,21,82,180,217,232,112]);var Yv=new Uint8Array([16,4,71,28,204,1,40,27]);var Kv=new Uint8Array([249,69,164,218,150,103,84,138]);var Dv=new Uint8Array([160,57,89,42,181,139,43,66]);var Iv=new Uint8Array([201,207,243,114,75,111,47,189]);var Ev=new Uint8Array([233,146,209,142,207,104,64,188]);var WS=new Uint8Array([242,35,198,137,82,225,242,182]);function GS(){return lT(uT([["discriminator",iT(W0(),8)],["lpTokenAmountOut",DT()],["maxBaseAmountIn",DT()],["maxQuoteAmountIn",DT()]]),(T)=>({...T,discriminator:WS}))}function Lq(T,A){let P=A?.programAddress??I1,C={pool:{value:T.pool??null,isWritable:!0},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:!0},userBaseTokenAccount:{value:T.userBaseTokenAccount??null,isWritable:!0},userQuoteTokenAccount:{value:T.userQuoteTokenAccount??null,isWritable:!0},userPoolTokenAccount:{value:T.userPoolTokenAccount??null,isWritable:!0},poolBaseTokenAccount:{value:T.poolBaseTokenAccount??null,isWritable:!0},poolQuoteTokenAccount:{value:T.poolQuoteTokenAccount??null,isWritable:!0},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(!C.tokenProgram.value)C.tokenProgram.value="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";if(!C.token2022Program.value)C.token2022Program.value="TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb";let G=S1(P,"programId");return Object.freeze({accounts:[G(C.pool),G(C.globalConfig),G(C.user),G(C.baseMint),G(C.quoteMint),G(C.lpMint),G(C.userBaseTokenAccount),G(C.userQuoteTokenAccount),G(C.userPoolTokenAccount),G(C.poolBaseTokenAccount),G(C.poolQuoteTokenAccount),G(C.tokenProgram),G(C.token2022Program),G(C.eventAuthority),G(C.program)],data:GS().encode(W),programAddress:P})}var vv=new Uint8Array([185,173,187,90,216,15,238,233]);var pv=new Uint8Array([234,102,194,203,150,72,62,229]);var cv=new Uint8Array([94,6,202,115,255,96,232,183]);var iv=new Uint8Array([51,230,133,164,1,127,131,173]);var ev=new Uint8Array([210,149,128,45,188,58,78,175]);var Qy=new Uint8Array([86,31,192,87,163,87,79,238]);var Uy=new Uint8Array([161,176,40,213,60,184,179,228]);var qy=new Uint8Array([104,184,103,242,88,151,107,20]);var US=new Uint8Array([183,18,70,156,148,109,161,34]);function JS(){return lT(uT([["discriminator",iT(W0(),8)],["lpTokenAmountIn",DT()],["minBaseAmountOut",DT()],["minQuoteAmountOut",DT()]]),(T)=>({...T,discriminator:US}))}function Eq(T,A){let P=A?.programAddress??I1,C={pool:{value:T.pool??null,isWritable:!0},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:!0},userBaseTokenAccount:{value:T.userBaseTokenAccount??null,isWritable:!0},userQuoteTokenAccount:{value:T.userQuoteTokenAccount??null,isWritable:!0},userPoolTokenAccount:{value:T.userPoolTokenAccount??null,isWritable:!0},poolBaseTokenAccount:{value:T.poolBaseTokenAccount??null,isWritable:!0},poolQuoteTokenAccount:{value:T.poolQuoteTokenAccount??null,isWritable:!0},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(!C.tokenProgram.value)C.tokenProgram.value="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";if(!C.token2022Program.value)C.token2022Program.value="TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb";let G=S1(P,"programId");return Object.freeze({accounts:[G(C.pool),G(C.globalConfig),G(C.user),G(C.baseMint),G(C.quoteMint),G(C.lpMint),G(C.userBaseTokenAccount),G(C.userQuoteTokenAccount),G(C.userPoolTokenAccount),G(C.poolBaseTokenAccount),G(C.poolQuoteTokenAccount),G(C.tokenProgram),G(C.token2022Program),G(C.eventAuthority),G(C.program)],data:JS().encode(W),programAddress:P})}var vy=new Uint8Array([241,154,109,4,17,177,109,188]);var by=new Uint8Array([149,8,156,202,160,252,176,217]);var Bq=0;async function Oq(T){let{user:A,baseMint:P,quoteMint:Q,index:C=Bq,poolAddress:W,poolCreator:G,maxBaseIn:J,maxQuoteIn:$,minLpOut:X=0n,tokenProgram:Z=FT,token2022Program:R=i8}=T;if(J<=0n)throw Error("maxBaseIn must be positive");if($<=0n)throw Error("maxQuoteIn must be positive");if(X<0n)throw Error("minLpOut cannot be negative");let D=b(A.address),z=b(P),S=b(Q),E=b(Z),w=b(R),O=W?b(W):await BW(C,b(G??D),z,S),m=await _W(),g=await OW(O),p=await xW(D,g),[c]=await MT({owner:D,tokenProgram:E,mint:z}),[o]=await MT({owner:D,tokenProgram:E,mint:S}),f=await h2(O,z,E),d=await h2(O,S,E),_=await hW();return Lq({pool:O,globalConfig:m,user:A,baseMint:z,quoteMint:S,lpMint:g,userBaseTokenAccount:c,userQuoteTokenAccount:o,userPoolTokenAccount:p,poolBaseTokenAccount:f,poolQuoteTokenAccount:d,tokenProgram:E,token2022Program:w,eventAuthority:_,program:b(N0),lpTokenAmountOut:X,maxBaseAmountIn:J,maxQuoteAmountIn:$},{programAddress:b(N0)})}async function xq(T){let{user:A,baseMint:P,quoteMint:Q,index:C=Bq,poolAddress:W,poolCreator:G,lpAmountIn:J,minBaseOut:$=0n,minQuoteOut:X=0n,tokenProgram:Z=FT,token2022Program:R=i8}=T;if(J<=0n)throw Error("lpAmountIn must be positive");if($<0n)throw Error("minBaseOut cannot be negative");if(X<0n)throw Error("minQuoteOut cannot be negative");let D=b(A.address),z=b(P),S=b(Q),E=b(Z),w=b(R),O=W?b(W):await BW(C,b(G??D),z,S),m=await _W(),g=await OW(O),p=await xW(D,g),[c]=await MT({owner:D,tokenProgram:E,mint:z}),[o]=await MT({owner:D,tokenProgram:E,mint:S}),f=await h2(O,z,E),d=await h2(O,S,E),_=await hW();return Eq({pool:O,globalConfig:m,user:A,baseMint:z,quoteMint:S,lpMint:g,userBaseTokenAccount:c,userQuoteTokenAccount:o,userPoolTokenAccount:p,poolBaseTokenAccount:f,poolQuoteTokenAccount:d,tokenProgram:E,token2022Program:w,eventAuthority:_,program:b(N0),lpTokenAmountIn:J,minBaseAmountOut:$,minQuoteAmountOut:X},{programAddress:b(N0)})}function $S(T){let{owner:A,amount:P,payer:Q=A,associatedTokenAddress:C,createAta:W=!0,autoClose:G=!1}=T;if(P<=0n)throw Error("Amount must be positive when wrapping SOL");let J=mW(A),$=mW(Q),X=C?new n(C):_2(new n(xA),J,!1,fT,v0),Z=[],R=[];if(W)Z.push(m2(N4($,X,J,new n(xA))));if(Z.push(m2(UT.transfer({fromPubkey:$,toPubkey:X,lamports:Number(P)}))),Z.push(m2(jq(X))),G)R.push(m2(SW(X,$,J)));return{prepend:Z,append:R,associatedTokenAddress:b(X.toBase58())}}function VS(T,A){let P=mW(T),Q=A?new n(A):_2(new n(xA),P,!1,fT,v0);return[m2(SW(Q,P,P))]}function mW(T){if(typeof T==="string")return new n(T);if(typeof T==="object"&&"address"in T)return new n(T.address);return new n(T)}function m2(T){return{programAddress:b(T.programId.toBase58()),accounts:T.keys.map((A)=>({address:b(A.pubkey.toBase58()),role:A.isSigner?A.isWritable?X1.WRITABLE_SIGNER:X1.READONLY_SIGNER:A.isWritable?X1.WRITABLE:X1.READONLY})),data:T.data}}var xA="So11111111111111111111111111111111111111112";var qS=xA;async function _q(T){let{user:A,baseMint:P,quoteMint:Q=xA,poolIndex:C,poolAddress:W,poolCreator:G,maxBaseAmountIn:J,maxQuoteAmountIn:$,minLpTokensOut:X,tokenProgram:Z,token2022Program:R}=T;if(J<=0n)throw Error("maxBaseAmountIn must be positive");if($<=0n)throw Error("maxQuoteAmountIn must be positive");return await Oq({user:A,baseMint:P,quoteMint:Q,index:C,poolAddress:W,poolCreator:G,maxBaseIn:J,maxQuoteIn:$,minLpOut:X??0n,tokenProgram:Z,token2022Program:R})}async function hq(T){let{user:A,baseMint:P,quoteMint:Q=xA,poolIndex:C,poolAddress:W,poolCreator:G,lpAmountIn:J,minBaseAmountOut:$,minQuoteAmountOut:X,tokenProgram:Z,token2022Program:R}=T;if(J<=0n)throw Error("lpAmountIn must be positive");return await xq({user:A,baseMint:P,quoteMint:Q,index:C,poolAddress:W,poolCreator:G,lpAmountIn:J,minBaseOut:$??0n,minQuoteOut:X??0n,tokenProgram:Z,token2022Program:R})}async function YS(T,A,P,Q,C={}){return _q({user:T,baseMint:A,maxBaseAmountIn:P,maxQuoteAmountIn:Q,...C})}async function ZS(T,A,P,Q={}){return hq({user:T,baseMint:A,lpAmountIn:P,...Q})}class gW{connection;programId;commitment;listeners=new Map;nextListenerId=1;subscriptionId=null;constructor(T,A={}){this.connection=T,this.programId=new n(A.programId??dT),this.commitment=A.commitment??"confirmed"}addEventListener(T,A){let P=this.nextListenerId++;return this.listeners.set(P,{id:P,type:T,callback:A}),this.ensureSubscription(),P}removeEventListener(T){if(this.listeners.delete(T),this.listeners.size===0)this.teardownSubscription()}ensureSubscription(){if(this.subscriptionId!==null)return;let T=(A,P)=>{this.dispatch(A,P.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 P=T.signature??"";for(let Q of T.logs){let C=HS(Q,A,P);for(let W of this.listeners.values())if(W.type==="raw"||W.type===C.type)W.callback(C)}}}var XS={create:["createEvent","create_event"],trade:["tradeEvent","trade_event"],complete:["completeEvent","complete_event"],raw:[]};function HS(T,A,P){let Q="raw";for(let[G,J]of Object.entries(XS)){if(G==="raw")continue;if(J.some(($)=>T.includes($))){Q=G;break}}let C,W=T.indexOf("{");if(W!==-1){let G=T.slice(W);try{C=JSON.parse(G)}catch{C=void 0}}return{type:Q,slot:A,signature:P,rawLog:T,parsed:C}}function KS(T,A={}){return new gW(T,A)}export{E0 as validateSlippage,aI as validateMintParams,t8 as subSlippage,sI as simulateTransaction,jR as setDefaultCommitment,EW as sendAndConfirmTransaction,IR as sellWithSlippage,MQ as sellSimple,Iq as sell,hq as removeLiquidity,iI as quickSell,ZS as quickRemoveLiquidity,fI as quickBuy,YS as quickAddLiquidity,DR as percentToBps,wW as mintWithFirstBuy,JT as getDefaultCommitment,KS as createPumpEventManager,AS as createAndBuy,zR as buyWithSlippage,FQ as buySimple,zq as buy,$S as buildWrapSolInstructions,VS as buildUnwrapSolInstructions,LW as buildTransaction,Nq as buildPriorityFeeInstructions,FR as bpsToPercent,s8 as addSlippage,_q as addLiquidity,xA as WSOL_ADDRESS,qS as WSOL,gW as PumpEventManager,L0 as DEFAULT_SLIPPAGE_BPS};
|
|
22
|
+
${r.slice(0,10).join(`
|
|
23
|
+
`)}`}throw Error(c)}catch(p){let d=v.err&&typeof v.err==="object"?JSON.stringify(v.err,(c,r)=>typeof r==="bigint"?r.toString():r):String(v.err);throw Error(`Transaction failed: ${d}`)}return{signature:w,slot:v?.slot??null}}async function tI({instructions:T,payer:A,additionalSigners:Q=[],latestBlockhash:J,lastValidBlockHeight:W,version:$,prependInstructions:G,appendInstructions:Y,priorityFees:Z,rpc:C,commitment:K=M1(),options:V={}}){let M=await c$({instructions:T,payer:A,additionalSigners:Q,latestBlockhash:J,lastValidBlockHeight:W,version:$,prependInstructions:G,appendInstructions:Y,priorityFees:Z,rpc:C,commitment:K}),z=await FJ(M.transactionMessage),N=L6(z),w={commitment:V.commitment??K};if(V.minContextSlot!==void 0)w.minContextSlot=BigInt(V.minContextSlot);if(V.sigVerify!==void 0)w.sigVerify=V.sigVerify;if(V.replaceRecentBlockhash!==void 0){if(V.sigVerify)throw Error("replaceRecentBlockhash cannot be true when sigVerify is enabled.");w.replaceRecentBlockhash=V.replaceRecentBlockhash}if(V.accounts)w.accounts=V.accounts;let L=await C.simulateTransaction(N,w).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 eI(T){return typeof T!=="string"&&ET(T)}function Gq(T){if(!T)return[];let A=[];if(T.computeUnitLimit!==void 0&&T.computeUnitLimit>0)A.push(TS(T.computeUnitLimit));if(T.computeUnitPriceMicroLamports!==void 0&&BigInt(T.computeUnitPriceMicroLamports)>0n)A.push(AS(BigInt(T.computeUnitPriceMicroLamports)));return A}function TS(T){let A=new Uint8Array(5);return A[0]=0,new DataView(A.buffer).setUint32(1,T,!0),{programAddress:$q,accounts:[],data:A}}function AS(T){let A=new Uint8Array(9);return A[0]=3,new DataView(A.buffer).setBigUint64(1,T,!0),{programAddress:$q,accounts:[],data:A}}async function QS(T){let{creator:A,metadata:Q,firstBuyTokenAmount:J,estimatedFirstBuyCost:W,slippageBps:$,feeRecipient:G,bondingCurveCreator:Y,mintAuthority:Z,mint:C,priorityFees:K,prependInstructions:V,appendInstructions:M,additionalSigners:z,sendOptions:N,commitment:w=M1(),rpc:L,rpcSubscriptions:O}=T,g=C??await pY(),v={user:A,mint:g,mintAuthority:Z??A.address,name:Q.name,symbol:Q.symbol,uri:Q.uri,firstBuyTokenAmount:J,estimatedFirstBuyCost:W,slippageBps:$,feeRecipient:G,bondingCurveCreator:Y??A.address,rpc:L,commitment:w},{createInstruction:p,buyInstruction:d}=await d$(v);return{...await f$({instructions:[p,d],payer:A,commitment:w,priorityFees:K,prependInstructions:V,appendInstructions:M,additionalSigners:JS([g,...z??[]]),sendOptions:N,rpc:L,rpcSubscriptions:O}),mint:g,createInstruction:p,buyInstruction:d}}function JS(T){let A=new Set,Q=[];for(let J of T){let W=J.address;if(!A.has(W))A.add(W),Q.push(J)}return Q}var WS=uT;async function Uq(T){let{user:A,baseMint:Q,quoteMint:J=uT,poolIndex:W,poolAddress:$,poolCreator:G,maxBaseAmountIn:Y,maxQuoteAmountIn:Z,minLpTokensOut:C,tokenProgram:K,token2022Program:V}=T;if(Y<=0n)throw Error("maxBaseAmountIn must be positive");if(Z<=0n)throw Error("maxQuoteAmountIn must be positive");return await uP({user:A,baseMint:Q,quoteMint:J,index:W,poolAddress:$,poolCreator:G,maxBaseIn:Y,maxQuoteIn:Z,minLpOut:C??0n,tokenProgram:K,token2022Program:V})}async function Yq(T){let{user:A,baseMint:Q,quoteMint:J=uT,poolIndex:W,poolAddress:$,poolCreator:G,lpAmountIn:Y,minBaseAmountOut:Z,minQuoteAmountOut:C,tokenProgram:K,token2022Program:V}=T;if(Y<=0n)throw Error("lpAmountIn must be positive");return await dP({user:A,baseMint:Q,quoteMint:J,index:W,poolAddress:$,poolCreator:G,lpAmountIn:Y,minBaseOut:Z??0n,minQuoteOut:C??0n,tokenProgram:K,token2022Program:V})}async function $S(T,A,Q,J,W={}){return Uq({user:T,baseMint:A,maxBaseAmountIn:Q,maxQuoteAmountIn:J,...W})}async function GS(T,A,Q,J={}){return Yq({user:T,baseMint:A,lpAmountIn:Q,...J})}class r${connection;programId;commitment;listeners=new Map;nextListenerId=1;subscriptionId=null;constructor(T,A={}){this.connection=T,this.programId=new a(A.programId??o0),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 W=YS(J,A,Q);for(let $ of this.listeners.values())if($.type==="raw"||$.type===W.type)$.callback(W)}}}var US={create:["createEvent","create_event"],trade:["tradeEvent","trade_event"],complete:["completeEvent","complete_event"],raw:[]};function YS(T,A,Q){let J="raw";for(let[G,Y]of Object.entries(US)){if(G==="raw")continue;if(Y.some((Z)=>T.includes(Z))){J=G;break}}let W,$=T.indexOf("{");if($!==-1){let G=T.slice($);try{W=JSON.parse(G)}catch{W=void 0}}return{type:J,slot:A,signature:Q,rawLog:T,parsed:W}}function ZS(T,A={}){return new r$(T,A)}export{WT as validateSlippage,sI as validateMintParams,n8 as subSlippage,tI as simulateTransaction,xV as setDefaultCommitment,f$ as sendAndConfirmTransaction,aV as sellWithSlippage,_J as sellSimple,aI as sell,Yq as removeLiquidity,GS as quickRemoveLiquidity,$S as quickAddLiquidity,rV as percentToBps,d$ as mintWithFirstBuy,M1 as getDefaultCommitment,vQ as curveSell,mQ as curveBuy,ZS as createPumpEventManager,QS as createAndBuy,oV as buyWithSlippage,BJ as buySimple,oI as buy,gI as buildWrapSolInstructions,mI as buildUnwrapSolInstructions,c$ as buildTransaction,Gq as buildPriorityFeeInstructions,nV as bpsToPercent,Tq as ammSell,eP as ammBuy,iT as addSlippage,Uq as addLiquidity,uT as WSOL_ADDRESS,WS as WSOL,r$ as PumpEventManager,JT as DEFAULT_SLIPPAGE_BPS};
|