pump-kit 0.1.0 → 0.1.3

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.
Files changed (58) hide show
  1. package/README.md +13 -40
  2. package/dist/index.js +12 -12
  3. package/dist/types/ammsdk/generated/accounts/globalConfig.d.ts +4 -6
  4. package/dist/types/ammsdk/generated/accounts/index.d.ts +0 -4
  5. package/dist/types/ammsdk/generated/accounts/pool.d.ts +0 -2
  6. package/dist/types/ammsdk/generated/errors/pumpAmm.d.ts +29 -55
  7. package/dist/types/ammsdk/generated/index.d.ts +1 -1
  8. package/dist/types/ammsdk/generated/instructions/buy.d.ts +14 -67
  9. package/dist/types/ammsdk/generated/instructions/createConfig.d.ts +5 -26
  10. package/dist/types/ammsdk/generated/instructions/createPool.d.ts +12 -42
  11. package/dist/types/ammsdk/generated/instructions/deposit.d.ts +10 -33
  12. package/dist/types/ammsdk/generated/instructions/disable.d.ts +2 -16
  13. package/dist/types/ammsdk/generated/instructions/extendAccount.d.ts +2 -12
  14. package/dist/types/ammsdk/generated/instructions/index.d.ts +0 -9
  15. package/dist/types/ammsdk/generated/instructions/sell.d.ts +14 -54
  16. package/dist/types/ammsdk/generated/instructions/updateAdmin.d.ts +2 -12
  17. package/dist/types/ammsdk/generated/instructions/updateFeeConfig.d.ts +2 -22
  18. package/dist/types/ammsdk/generated/instructions/withdraw.d.ts +10 -33
  19. package/dist/types/ammsdk/generated/programs/pumpAmm.d.ts +15 -46
  20. package/dist/types/ammsdk/generated/types/buyEvent.d.ts +4 -25
  21. package/dist/types/ammsdk/generated/types/createConfigEvent.d.ts +0 -4
  22. package/dist/types/ammsdk/generated/types/createPoolEvent.d.ts +0 -2
  23. package/dist/types/ammsdk/generated/types/globalConfig.d.ts +49 -0
  24. package/dist/types/ammsdk/generated/types/index.d.ts +2 -12
  25. package/dist/types/ammsdk/generated/types/pool.d.ts +35 -0
  26. package/dist/types/ammsdk/generated/types/sellEvent.d.ts +0 -6
  27. package/dist/types/ammsdk/generated/types/updateFeeConfigEvent.d.ts +0 -4
  28. package/dist/types/clients/amm.d.ts +10 -2
  29. package/dist/types/pda/pumpAmm.d.ts +4 -0
  30. package/dist/types/pumpsdk/generated/index.d.ts +1 -1
  31. package/dist/types/swap/curve.d.ts +1 -4
  32. package/dist/types/swap.d.ts +7 -23
  33. package/package.json +1 -1
  34. package/dist/types/ammsdk/generated/accounts/bondingCurve.d.ts +0 -39
  35. package/dist/types/ammsdk/generated/accounts/feeConfig.d.ts +0 -33
  36. package/dist/types/ammsdk/generated/accounts/globalVolumeAccumulator.d.ts +0 -37
  37. package/dist/types/ammsdk/generated/accounts/userVolumeAccumulator.d.ts +0 -39
  38. package/dist/types/ammsdk/generated/instructions/adminSetCoinCreator.d.ts +0 -63
  39. package/dist/types/ammsdk/generated/instructions/adminUpdateTokenIncentives.d.ts +0 -99
  40. package/dist/types/ammsdk/generated/instructions/buyExactQuoteIn.d.ts +0 -144
  41. package/dist/types/ammsdk/generated/instructions/claimTokenIncentives.d.ts +0 -86
  42. package/dist/types/ammsdk/generated/instructions/closeUserVolumeAccumulator.d.ts +0 -54
  43. package/dist/types/ammsdk/generated/instructions/collectCoinCreatorFee.d.ts +0 -70
  44. package/dist/types/ammsdk/generated/instructions/initUserVolumeAccumulator.d.ts +0 -62
  45. package/dist/types/ammsdk/generated/instructions/setCoinCreator.d.ts +0 -58
  46. package/dist/types/ammsdk/generated/instructions/syncUserVolumeAccumulator.d.ts +0 -58
  47. package/dist/types/ammsdk/generated/types/adminSetCoinCreatorEvent.d.ts +0 -27
  48. package/dist/types/ammsdk/generated/types/adminUpdateTokenIncentivesEvent.d.ts +0 -29
  49. package/dist/types/ammsdk/generated/types/claimTokenIncentivesEvent.d.ts +0 -27
  50. package/dist/types/ammsdk/generated/types/closeUserVolumeAccumulatorEvent.d.ts +0 -27
  51. package/dist/types/ammsdk/generated/types/collectCoinCreatorFeeEvent.d.ts +0 -25
  52. package/dist/types/ammsdk/generated/types/feeTier.d.ts +0 -20
  53. package/dist/types/ammsdk/generated/types/fees.d.ts +0 -21
  54. package/dist/types/ammsdk/generated/types/initUserVolumeAccumulatorEvent.d.ts +0 -21
  55. package/dist/types/ammsdk/generated/types/optionBool.d.ts +0 -13
  56. package/dist/types/ammsdk/generated/types/setBondingCurveCoinCreatorEvent.d.ts +0 -25
  57. package/dist/types/ammsdk/generated/types/setMetaplexCoinCreatorEvent.d.ts +0 -25
  58. package/dist/types/ammsdk/generated/types/syncUserVolumeAccumulatorEvent.d.ts +0 -23
package/dist/index.js CHANGED
@@ -1,23 +1,23 @@
1
- var ZZ=Object.create;var{getPrototypeOf:qZ,defineProperty:P2,getOwnPropertyNames:KG,getOwnPropertyDescriptor:XZ}=Object,jG=Object.prototype.hasOwnProperty;var iT=(T,A,P)=>{P=T!=null?ZZ(qZ(T)):{};let Q=A||!T||!T.__esModule?P2(P,"default",{value:T,enumerable:!0}):P;for(let C of KG(T))if(!jG.call(Q,C))P2(Q,C,{get:()=>T[C],enumerable:!0});return Q},HG=new WeakMap,K8=(T)=>{var A=HG.get(T),P;if(A)return A;if(A=P2({},"__esModule",{value:!0}),T&&typeof T==="object"||typeof T==="function")KG(T).map((Q)=>!jG.call(A,Q)&&P2(A,Q,{get:()=>T[Q],enumerable:!(P=XZ(T,Q))||P.enumerable}));return HG.set(T,A),A},U0=(T,A)=>()=>(A||T((A={exports:{}}).exports,A),A.exports);var qP=(T,A)=>{for(var P in A)P2(T,P,{get:A[P],enumerable:!0,configurable:!0,set:(Q)=>A[P]=()=>Q})};var OT=(T,A)=>()=>(T&&(A=T(T=0)),A);var kG=U0((MZ)=>{MZ.byteLength=KZ;MZ.toByteArray=RZ;MZ.fromByteArray=DZ;var I0=[],$0=[],HZ=typeof Uint8Array<"u"?Uint8Array:Array,XP="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(YA=0,HP=XP.length;YA<HP;++YA)I0[YA]=XP[YA],$0[XP.charCodeAt(YA)]=YA;var YA,HP;$0[45]=62;$0[95]=63;function RG(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 KZ(T){var A=RG(T),P=A[0],Q=A[1];return(P+Q)*3/4-Q}function jZ(T,A,P){return(A+P)*3/4-P}function RZ(T){var A,P=RG(T),Q=P[0],C=P[1],W=new HZ(jZ(T,Q,C)),G=0,U=C>0?Q-4:Q,$;for($=0;$<U;$+=4)A=$0[T.charCodeAt($)]<<18|$0[T.charCodeAt($+1)]<<12|$0[T.charCodeAt($+2)]<<6|$0[T.charCodeAt($+3)],W[G++]=A>>16&255,W[G++]=A>>8&255,W[G++]=A&255;if(C===2)A=$0[T.charCodeAt($)]<<2|$0[T.charCodeAt($+1)]>>4,W[G++]=A&255;if(C===1)A=$0[T.charCodeAt($)]<<10|$0[T.charCodeAt($+1)]<<4|$0[T.charCodeAt($+2)]>>2,W[G++]=A>>8&255,W[G++]=A&255;return W}function kZ(T){return I0[T>>18&63]+I0[T>>12&63]+I0[T>>6&63]+I0[T&63]}function FZ(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(kZ(Q));return C.join("")}function DZ(T){var A,P=T.length,Q=P%3,C=[],W=16383;for(var G=0,U=P-Q;G<U;G+=W)C.push(FZ(T,G,G+W>U?U:G+W));if(Q===1)A=T[P-1],C.push(I0[A>>2]+I0[A<<4&63]+"==");else if(Q===2)A=(T[P-2]<<8)+T[P-1],C.push(I0[A>>10]+I0[A>>4&63]+I0[A<<2&63]+"=");return C.join("")}});var FG=U0((NZ)=>{/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */NZ.read=function(T,A,P,Q,C){var W,G,U=C*8-Q-1,$=(1<<U)-1,q=$>>1,X=-7,K=P?C-1:0,F=P?-1:1,M=T[A+K];K+=F,W=M&(1<<-X)-1,M>>=-X,X+=U;for(;X>0;W=W*256+T[A+K],K+=F,X-=8);G=W&(1<<-X)-1,W>>=-X,X+=Q;for(;X>0;G=G*256+T[A+K],K+=F,X-=8);if(W===0)W=1-q;else if(W===$)return G?NaN:(M?-1:1)*(1/0);else G=G+Math.pow(2,Q),W=W-q;return(M?-1:1)*G*Math.pow(2,W-Q)};NZ.write=function(T,A,P,Q,C,W){var G,U,$,q=W*8-C-1,X=(1<<q)-1,K=X>>1,F=C===23?Math.pow(2,-24)-Math.pow(2,-77):0,M=Q?0:W-1,I=Q?1:-1,E=A<0||A===0&&1/A<0?1:0;if(A=Math.abs(A),isNaN(A)||A===1/0)U=isNaN(A)?1:0,G=X;else{if(G=Math.floor(Math.log(A)/Math.LN2),A*($=Math.pow(2,-G))<1)G--,$*=2;if(G+K>=1)A+=F/$;else A+=F*Math.pow(2,1-K);if(A*$>=2)G++,$/=2;if(G+K>=X)U=0,G=X;else if(G+K>=1)U=(A*$-1)*Math.pow(2,C),G=G+K;else U=A*Math.pow(2,K-1)*Math.pow(2,C),G=0}for(;C>=8;T[P+M]=U&255,M+=I,U/=256,C-=8);G=G<<C|U,q+=C;for(;q>0;T[P+M]=G&255,M+=I,G/=256,q-=8);T[P+M-I]|=E*128}});var c6={};qP(c6,{transcode:()=>bR,resolveObjectURL:()=>mR,kStringMaxLength:()=>j$,kMaxLength:()=>K2,isUtf8:()=>vR,isAscii:()=>yR,default:()=>lR,constants:()=>VR,btoa:()=>GR,atob:()=>JR,INSPECT_MAX_BYTES:()=>K$,File:()=>UR,Buffer:()=>w,Blob:()=>$R});function AR(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 PR(T,A){return(T+A)*3/4-A}function QR(T){var A,P=AR(T),Q=P[0],C=P[1],W=new Uint8Array(PR(Q,C)),G=0,U=C>0?Q-4:Q,$;for($=0;$<U;$+=4)A=Z0[T.charCodeAt($)]<<18|Z0[T.charCodeAt($+1)]<<12|Z0[T.charCodeAt($+2)]<<6|Z0[T.charCodeAt($+3)],W[G++]=A>>16&255,W[G++]=A>>8&255,W[G++]=A&255;if(C===2)A=Z0[T.charCodeAt($)]<<2|Z0[T.charCodeAt($+1)]>>4,W[G++]=A&255;if(C===1)A=Z0[T.charCodeAt($)]<<10|Z0[T.charCodeAt($+1)]<<4|Z0[T.charCodeAt($+2)]>>2,W[G++]=A>>8&255,W[G++]=A&255;return W}function CR(T){return _0[T>>18&63]+_0[T>>12&63]+_0[T>>6&63]+_0[T&63]}function WR(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(CR(Q));return C.join("")}function V$(T){var A,P=T.length,Q=P%3,C=[],W=16383;for(var G=0,U=P-Q;G<U;G+=W)C.push(WR(T,G,G+W>U?U:G+W));if(Q===1)A=T[P-1],C.push(_0[A>>2]+_0[A<<4&63]+"==");else if(Q===2)A=(T[P-2]<<8)+T[P-1],C.push(_0[A>>10]+_0[A>>4&63]+_0[A<<2&63]+"=");return C.join("")}function d6(T,A,P,Q,C){var W,G,U=C*8-Q-1,$=(1<<U)-1,q=$>>1,X=-7,K=P?C-1:0,F=P?-1:1,M=T[A+K];K+=F,W=M&(1<<-X)-1,M>>=-X,X+=U;for(;X>0;W=W*256+T[A+K],K+=F,X-=8);G=W&(1<<-X)-1,W>>=-X,X+=Q;for(;X>0;G=G*256+T[A+K],K+=F,X-=8);if(W===0)W=1-q;else if(W===$)return G?NaN:(M?-1:1)*(1/0);else G=G+Math.pow(2,Q),W=W-q;return(M?-1:1)*G*Math.pow(2,W-Q)}function H$(T,A,P,Q,C,W){var G,U,$,q=W*8-C-1,X=(1<<q)-1,K=X>>1,F=C===23?Math.pow(2,-24)-Math.pow(2,-77):0,M=Q?0:W-1,I=Q?1:-1,E=A<0||A===0&&1/A<0?1:0;if(A=Math.abs(A),isNaN(A)||A===1/0)U=isNaN(A)?1:0,G=X;else{if(G=Math.floor(Math.log(A)/Math.LN2),A*($=Math.pow(2,-G))<1)G--,$*=2;if(G+K>=1)A+=F/$;else A+=F*Math.pow(2,1-K);if(A*$>=2)G++,$/=2;if(G+K>=X)U=0,G=X;else if(G+K>=1)U=(A*$-1)*Math.pow(2,C),G=G+K;else U=A*Math.pow(2,K-1)*Math.pow(2,C),G=0}for(;C>=8;T[P+M]=U&255,M+=I,U/=256,C-=8);G=G<<C|U,q+=C;for(;q>0;T[P+M]=G&255,M+=I,G/=256,q-=8);T[P+M-I]|=E*128}function n0(T){if(T>K2)throw RangeError('The value "'+T+'" is invalid for option "size"');let A=new Uint8Array(T);return Object.setPrototypeOf(A,w.prototype),A}function uQ(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 w(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 dQ(T)}return R$(T,A,P)}function R$(T,A,P){if(typeof T==="string")return XR(T,A);if(ArrayBuffer.isView(T))return HR(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(h0(T,ArrayBuffer)||T&&h0(T.buffer,ArrayBuffer))return lQ(T,A,P);if(typeof SharedArrayBuffer<"u"&&(h0(T,SharedArrayBuffer)||T&&h0(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 w.from(Q,A,P);let C=KR(T);if(C)return C;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof T[Symbol.toPrimitive]==="function")return w.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 k$(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 qR(T,A,P){if(k$(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 dQ(T){return k$(T),n0(T<0?0:rQ(T)|0)}function XR(T,A){if(typeof A!=="string"||A==="")A="utf8";if(!w.isEncoding(A))throw TypeError("Unknown encoding: "+A);let P=F$(T,A)|0,Q=n0(P),C=Q.write(T,A);if(C!==P)Q=Q.slice(0,C);return Q}function bQ(T){let A=T.length<0?0:rQ(T.length)|0,P=n0(A);for(let Q=0;Q<A;Q+=1)P[Q]=T[Q]&255;return P}function HR(T){if(h0(T,Uint8Array)){let A=new Uint8Array(T);return lQ(A.buffer,A.byteOffset,A.byteLength)}return bQ(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,w.prototype),Q}function KR(T){if(w.isBuffer(T)){let A=rQ(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 bQ(T)}if(T.type==="Buffer"&&Array.isArray(T.data))return bQ(T.data)}function rQ(T){if(T>=K2)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+K2.toString(16)+" bytes");return T|0}function F$(T,A){if(w.isBuffer(T))return T.length;if(ArrayBuffer.isView(T)||h0(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 pQ(T).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P*2;case"hex":return P>>>1;case"base64":return E$(T).length;default:if(C)return Q?-1:pQ(T).length;A=(""+A).toLowerCase(),C=!0}}function jR(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 LR(this,A,P);case"utf8":case"utf-8":return M$(this,A,P);case"ascii":return SR(this,A,P);case"latin1":case"binary":return NR(this,A,P);case"base64":return zR(this,A,P);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return wR(this,A,P);default:if(Q)throw TypeError("Unknown encoding: "+T);T=(T+"").toLowerCase(),Q=!0}}function aA(T,A,P){let Q=T[A];T[A]=T[P],T[P]=Q}function D$(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=w.from(A,Q);if(w.isBuffer(A)){if(A.length===0)return-1;return Z$(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 Z$(T,[A],P,Q,C)}throw TypeError("val must be string, number or Buffer")}function Z$(T,A,P,Q,C){let W=1,G=T.length,U=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,U/=2,P/=2}}function $(X,K){if(W===1)return X[K];else return X.readUInt16BE(K*W)}let q;if(C){let X=-1;for(q=P;q<G;q++)if($(T,q)===$(A,X===-1?0:q-X)){if(X===-1)X=q;if(q-X+1===U)return X*W}else{if(X!==-1)q-=q-X;X=-1}}else{if(P+U>G)P=G-U;for(q=P;q>=0;q--){let X=!0;for(let K=0;K<U;K++)if($(T,q+K)!==$(A,K)){X=!1;break}if(X)return q}}return-1}function RR(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 U=parseInt(A.substr(G*2,2),16);if(Number.isNaN(U))return G;T[P+G]=U}return G}function kR(T,A,P,Q){return r6(pQ(A,T.length-P),T,P,Q)}function FR(T,A,P,Q){return r6(xR(A),T,P,Q)}function DR(T,A,P,Q){return r6(E$(A),T,P,Q)}function MR(T,A,P,Q){return r6(_R(A,T.length-P),T,P,Q)}function zR(T,A,P){if(A===0&&P===T.length)return V$(T);else return V$(T.slice(A,P))}function M$(T,A,P){P=Math.min(T.length,P);let Q=[],C=A;while(C<P){let W=T[C],G=null,U=W>239?4:W>223?3:W>191?2:1;if(C+U<=P){let $,q,X,K;switch(U){case 1:if(W<128)G=W;break;case 2:if($=T[C+1],($&192)===128){if(K=(W&31)<<6|$&63,K>127)G=K}break;case 3:if($=T[C+1],q=T[C+2],($&192)===128&&(q&192)===128){if(K=(W&15)<<12|($&63)<<6|q&63,K>2047&&(K<55296||K>57343))G=K}break;case 4:if($=T[C+1],q=T[C+2],X=T[C+3],($&192)===128&&(q&192)===128&&(X&192)===128){if(K=(W&15)<<18|($&63)<<12|(q&63)<<6|X&63,K>65535&&K<1114112)G=K}}}if(G===null)G=65533,U=1;else if(G>65535)G-=65536,Q.push(G>>>10&1023|55296),G=56320|G&1023;Q.push(G),C+=U}return IR(Q)}function IR(T){let A=T.length;if(A<=q$)return String.fromCharCode.apply(String,T);let P="",Q=0;while(Q<A)P+=String.fromCharCode.apply(String,T.slice(Q,Q+=q$));return P}function SR(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 NR(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 LR(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+=hR[T[W]];return C}function wR(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 zT(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 tT(T,A,P,Q,C,W){if(!w.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 z$(T,A,P,Q,C){w$(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 I$(T,A,P,Q,C){w$(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 S$(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 N$(T,A,P,Q,C){if(A=+A,P=P>>>0,!C)S$(T,A,P,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return H$(T,A,P,Q,23,4),P+4}function L$(T,A,P,Q,C){if(A=+A,P=P>>>0,!C)S$(T,A,P,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return H$(T,A,P,Q,52,8),P+8}function X$(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 ER(T,A,P){if(L8(A,"offset"),T[A]===void 0||T[A+P]===void 0)j2(A,T.length-(P+1))}function w$(T,A,P,Q,C,W){if(T>P||T<A){let G=typeof A==="bigint"?"n":"",U;if(W>3)if(A===0||A===BigInt(0))U=`>= 0${G} and < 2${G} ** ${(W+1)*8}${G}`;else U=`>= -(2${G} ** ${(W+1)*8-1}${G}) and < 2 ** ${(W+1)*8-1}${G}`;else U=`>= ${A}${G} and <= ${P}${G}`;throw new yQ("value",U,T)}ER(Q,C,W)}function L8(T,A){if(typeof T!=="number")throw new ZR(A,"number",T)}function j2(T,A,P){if(Math.floor(T)!==T)throw L8(T,P),new yQ(P||"offset","an integer",T);if(A<0)throw new YR;throw new yQ(P||"offset",`>= ${P?1:0} and <= ${A}`,T)}function OR(T){if(T=T.split("=")[0],T=T.trim().replace(BR,""),T.length<2)return"";while(T.length%4!==0)T=T+"=";return T}function pQ(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 xR(T){let A=[];for(let P=0;P<T.length;++P)A.push(T.charCodeAt(P)&255);return A}function _R(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 E$(T){return QR(OR(T))}function r6(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 h0(T,A){return T instanceof A||T!=null&&T.constructor!=null&&T.constructor.name!=null&&T.constructor.name===A.name}function zA(T){return typeof BigInt>"u"?gR:T}function gR(){throw Error("BigInt not supported")}function cQ(T){return()=>{throw Error(T+" is not implemented for node:buffer browser polyfill")}}var _0,Z0,vQ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",iA,$$,Y$,K$=50,K2=2147483647,j$=536870888,GR,JR,UR,$R,VR,YR,ZR,yQ,q$=4096,BR,hR,mR,vR,yR=(T)=>{for(let A of T)if(A.charCodeAt(0)>127)return!1;return!0},bR,lR;var w8=OT(()=>{_0=[],Z0=[];for(iA=0,$$=vQ.length;iA<$$;++iA)_0[iA]=vQ[iA],Z0[vQ.charCodeAt(iA)]=iA;Z0[45]=62;Z0[95]=63;Y$=typeof Symbol==="function"&&typeof Symbol.for==="function"?Symbol.for("nodejs.util.inspect.custom"):null,GR=globalThis.btoa,JR=globalThis.atob,UR=globalThis.File,$R=globalThis.Blob,VR={MAX_LENGTH:K2,MAX_STRING_LENGTH:j$};YR=uQ("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),ZR=uQ("ERR_INVALID_ARG_TYPE",function(T,A){return`The "${T}" argument must be of type number. Received type ${typeof A}`},TypeError),yQ=uQ("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=X$(String(P));else if(typeof P==="bigint"){if(C=String(P),P>BigInt(2)**BigInt(32)||P<-(BigInt(2)**BigInt(32)))C=X$(C);C+="n"}return Q+=` It must be ${A}. Received ${C}`,Q},RangeError);Object.defineProperty(w.prototype,"parent",{enumerable:!0,get:function(){if(!w.isBuffer(this))return;return this.buffer}});Object.defineProperty(w.prototype,"offset",{enumerable:!0,get:function(){if(!w.isBuffer(this))return;return this.byteOffset}});w.poolSize=8192;w.from=function(T,A,P){return R$(T,A,P)};Object.setPrototypeOf(w.prototype,Uint8Array.prototype);Object.setPrototypeOf(w,Uint8Array);w.alloc=function(T,A,P){return qR(T,A,P)};w.allocUnsafe=function(T){return dQ(T)};w.allocUnsafeSlow=function(T){return dQ(T)};w.isBuffer=function(A){return A!=null&&A._isBuffer===!0&&A!==w.prototype};w.compare=function(A,P){if(h0(A,Uint8Array))A=w.from(A,A.offset,A.byteLength);if(h0(P,Uint8Array))P=w.from(P,P.offset,P.byteLength);if(!w.isBuffer(A)||!w.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};w.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}};w.concat=function(A,P){if(!Array.isArray(A))throw TypeError('"list" argument must be an Array of Buffers');if(A.length===0)return w.alloc(0);let Q;if(P===void 0){P=0;for(Q=0;Q<A.length;++Q)P+=A[Q].length}let C=w.allocUnsafe(P),W=0;for(Q=0;Q<A.length;++Q){let G=A[Q];if(h0(G,Uint8Array))if(W+G.length>C.length){if(!w.isBuffer(G))G=w.from(G);G.copy(C,W)}else Uint8Array.prototype.set.call(C,G,W);else if(!w.isBuffer(G))throw TypeError('"list" argument must be an Array of Buffers');else G.copy(C,W);W+=G.length}return C};w.byteLength=F$;w.prototype._isBuffer=!0;w.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)aA(this,P,P+1);return this};w.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)aA(this,P,P+3),aA(this,P+1,P+2);return this};w.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)aA(this,P,P+7),aA(this,P+1,P+6),aA(this,P+2,P+5),aA(this,P+3,P+4);return this};w.prototype.toString=function(){let A=this.length;if(A===0)return"";if(arguments.length===0)return M$(this,0,A);return jR.apply(this,arguments)};w.prototype.toLocaleString=w.prototype.toString;w.prototype.equals=function(A){if(!w.isBuffer(A))throw TypeError("Argument must be a Buffer");if(this===A)return!0;return w.compare(this,A)===0};w.prototype.inspect=function(){let A="",P=K$;if(A=this.toString("hex",0,P).replace(/(.{2})/g,"$1 ").trim(),this.length>P)A+=" ... ";return"<Buffer "+A+">"};if(Y$)w.prototype[Y$]=w.prototype.inspect;w.prototype.compare=function(A,P,Q,C,W){if(h0(A,Uint8Array))A=w.from(A,A.offset,A.byteLength);if(!w.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,U=Q-P,$=Math.min(G,U),q=this.slice(C,W),X=A.slice(P,Q);for(let K=0;K<$;++K)if(q[K]!==X[K]){G=q[K],U=X[K];break}if(G<U)return-1;if(U<G)return 1;return 0};w.prototype.includes=function(A,P,Q){return this.indexOf(A,P,Q)!==-1};w.prototype.indexOf=function(A,P,Q){return D$(this,A,P,Q,!0)};w.prototype.lastIndexOf=function(A,P,Q){return D$(this,A,P,Q,!1)};w.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 RR(this,A,P,Q);case"utf8":case"utf-8":return kR(this,A,P,Q);case"ascii":case"latin1":case"binary":return FR(this,A,P,Q);case"base64":return DR(this,A,P,Q);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return MR(this,A,P,Q);default:if(G)throw TypeError("Unknown encoding: "+C);C=(""+C).toLowerCase(),G=!0}};w.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};w.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,w.prototype),C};w.prototype.readUintLE=w.prototype.readUIntLE=function(A,P,Q){if(A=A>>>0,P=P>>>0,!Q)zT(A,P,this.length);let C=this[A],W=1,G=0;while(++G<P&&(W*=256))C+=this[A+G]*W;return C};w.prototype.readUintBE=w.prototype.readUIntBE=function(A,P,Q){if(A=A>>>0,P=P>>>0,!Q)zT(A,P,this.length);let C=this[A+--P],W=1;while(P>0&&(W*=256))C+=this[A+--P]*W;return C};w.prototype.readUint8=w.prototype.readUInt8=function(A,P){if(A=A>>>0,!P)zT(A,1,this.length);return this[A]};w.prototype.readUint16LE=w.prototype.readUInt16LE=function(A,P){if(A=A>>>0,!P)zT(A,2,this.length);return this[A]|this[A+1]<<8};w.prototype.readUint16BE=w.prototype.readUInt16BE=function(A,P){if(A=A>>>0,!P)zT(A,2,this.length);return this[A]<<8|this[A+1]};w.prototype.readUint32LE=w.prototype.readUInt32LE=function(A,P){if(A=A>>>0,!P)zT(A,4,this.length);return(this[A]|this[A+1]<<8|this[A+2]<<16)+this[A+3]*16777216};w.prototype.readUint32BE=w.prototype.readUInt32BE=function(A,P){if(A=A>>>0,!P)zT(A,4,this.length);return this[A]*16777216+(this[A+1]<<16|this[A+2]<<8|this[A+3])};w.prototype.readBigUInt64LE=zA(function(A){A=A>>>0,L8(A,"offset");let P=this[A],Q=this[A+7];if(P===void 0||Q===void 0)j2(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))});w.prototype.readBigUInt64BE=zA(function(A){A=A>>>0,L8(A,"offset");let P=this[A],Q=this[A+7];if(P===void 0||Q===void 0)j2(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)});w.prototype.readIntLE=function(A,P,Q){if(A=A>>>0,P=P>>>0,!Q)zT(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};w.prototype.readIntBE=function(A,P,Q){if(A=A>>>0,P=P>>>0,!Q)zT(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};w.prototype.readInt8=function(A,P){if(A=A>>>0,!P)zT(A,1,this.length);if(!(this[A]&128))return this[A];return(255-this[A]+1)*-1};w.prototype.readInt16LE=function(A,P){if(A=A>>>0,!P)zT(A,2,this.length);let Q=this[A]|this[A+1]<<8;return Q&32768?Q|4294901760:Q};w.prototype.readInt16BE=function(A,P){if(A=A>>>0,!P)zT(A,2,this.length);let Q=this[A+1]|this[A]<<8;return Q&32768?Q|4294901760:Q};w.prototype.readInt32LE=function(A,P){if(A=A>>>0,!P)zT(A,4,this.length);return this[A]|this[A+1]<<8|this[A+2]<<16|this[A+3]<<24};w.prototype.readInt32BE=function(A,P){if(A=A>>>0,!P)zT(A,4,this.length);return this[A]<<24|this[A+1]<<16|this[A+2]<<8|this[A+3]};w.prototype.readBigInt64LE=zA(function(A){A=A>>>0,L8(A,"offset");let P=this[A],Q=this[A+7];if(P===void 0||Q===void 0)j2(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)});w.prototype.readBigInt64BE=zA(function(A){A=A>>>0,L8(A,"offset");let P=this[A],Q=this[A+7];if(P===void 0||Q===void 0)j2(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)});w.prototype.readFloatLE=function(A,P){if(A=A>>>0,!P)zT(A,4,this.length);return d6(this,A,!0,23,4)};w.prototype.readFloatBE=function(A,P){if(A=A>>>0,!P)zT(A,4,this.length);return d6(this,A,!1,23,4)};w.prototype.readDoubleLE=function(A,P){if(A=A>>>0,!P)zT(A,8,this.length);return d6(this,A,!0,52,8)};w.prototype.readDoubleBE=function(A,P){if(A=A>>>0,!P)zT(A,8,this.length);return d6(this,A,!1,52,8)};w.prototype.writeUintLE=w.prototype.writeUIntLE=function(A,P,Q,C){if(A=+A,P=P>>>0,Q=Q>>>0,!C){let U=Math.pow(2,8*Q)-1;tT(this,A,P,Q,U,0)}let W=1,G=0;this[P]=A&255;while(++G<Q&&(W*=256))this[P+G]=A/W&255;return P+Q};w.prototype.writeUintBE=w.prototype.writeUIntBE=function(A,P,Q,C){if(A=+A,P=P>>>0,Q=Q>>>0,!C){let U=Math.pow(2,8*Q)-1;tT(this,A,P,Q,U,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};w.prototype.writeUint8=w.prototype.writeUInt8=function(A,P,Q){if(A=+A,P=P>>>0,!Q)tT(this,A,P,1,255,0);return this[P]=A&255,P+1};w.prototype.writeUint16LE=w.prototype.writeUInt16LE=function(A,P,Q){if(A=+A,P=P>>>0,!Q)tT(this,A,P,2,65535,0);return this[P]=A&255,this[P+1]=A>>>8,P+2};w.prototype.writeUint16BE=w.prototype.writeUInt16BE=function(A,P,Q){if(A=+A,P=P>>>0,!Q)tT(this,A,P,2,65535,0);return this[P]=A>>>8,this[P+1]=A&255,P+2};w.prototype.writeUint32LE=w.prototype.writeUInt32LE=function(A,P,Q){if(A=+A,P=P>>>0,!Q)tT(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};w.prototype.writeUint32BE=w.prototype.writeUInt32BE=function(A,P,Q){if(A=+A,P=P>>>0,!Q)tT(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};w.prototype.writeBigUInt64LE=zA(function(A,P=0){return z$(this,A,P,BigInt(0),BigInt("0xffffffffffffffff"))});w.prototype.writeBigUInt64BE=zA(function(A,P=0){return I$(this,A,P,BigInt(0),BigInt("0xffffffffffffffff"))});w.prototype.writeIntLE=function(A,P,Q,C){if(A=+A,P=P>>>0,!C){let $=Math.pow(2,8*Q-1);tT(this,A,P,Q,$-1,-$)}let W=0,G=1,U=0;this[P]=A&255;while(++W<Q&&(G*=256)){if(A<0&&U===0&&this[P+W-1]!==0)U=1;this[P+W]=(A/G>>0)-U&255}return P+Q};w.prototype.writeIntBE=function(A,P,Q,C){if(A=+A,P=P>>>0,!C){let $=Math.pow(2,8*Q-1);tT(this,A,P,Q,$-1,-$)}let W=Q-1,G=1,U=0;this[P+W]=A&255;while(--W>=0&&(G*=256)){if(A<0&&U===0&&this[P+W+1]!==0)U=1;this[P+W]=(A/G>>0)-U&255}return P+Q};w.prototype.writeInt8=function(A,P,Q){if(A=+A,P=P>>>0,!Q)tT(this,A,P,1,127,-128);if(A<0)A=255+A+1;return this[P]=A&255,P+1};w.prototype.writeInt16LE=function(A,P,Q){if(A=+A,P=P>>>0,!Q)tT(this,A,P,2,32767,-32768);return this[P]=A&255,this[P+1]=A>>>8,P+2};w.prototype.writeInt16BE=function(A,P,Q){if(A=+A,P=P>>>0,!Q)tT(this,A,P,2,32767,-32768);return this[P]=A>>>8,this[P+1]=A&255,P+2};w.prototype.writeInt32LE=function(A,P,Q){if(A=+A,P=P>>>0,!Q)tT(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};w.prototype.writeInt32BE=function(A,P,Q){if(A=+A,P=P>>>0,!Q)tT(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};w.prototype.writeBigInt64LE=zA(function(A,P=0){return z$(this,A,P,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});w.prototype.writeBigInt64BE=zA(function(A,P=0){return I$(this,A,P,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});w.prototype.writeFloatLE=function(A,P,Q){return N$(this,A,P,!0,Q)};w.prototype.writeFloatBE=function(A,P,Q){return N$(this,A,P,!1,Q)};w.prototype.writeDoubleLE=function(A,P,Q){return L$(this,A,P,!0,Q)};w.prototype.writeDoubleBE=function(A,P,Q){return L$(this,A,P,!1,Q)};w.prototype.copy=function(A,P,Q,C){if(!w.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};w.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"&&!w.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=w.isBuffer(A)?A:w.from(A,C),U=G.length;if(U===0)throw TypeError('The value "'+A+'" is invalid for argument "value"');for(W=0;W<Q-P;++W)this[W+P]=G[W%U]}return this};BR=/[^+/0-9A-Za-z-_]/g;hR=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}();mR=cQ("resolveObjectURL"),vR=cQ("isUtf8"),bR=cQ("transcode"),lR=w});var jC=U0((k9,KC)=>{(function(T,A){function P(R,J){if(!R)throw Error(J||"Assertion failed")}function Q(R,J){R.super_=J;var V=function(){};V.prototype=J.prototype,R.prototype=new V,R.prototype.constructor=R}function C(R,J,V){if(C.isBN(R))return R;if(this.negative=0,this.words=null,this.length=0,this.red=null,R!==null){if(J==="le"||J==="be")V=J,J=10;this._init(R||0,J||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=(w8(),K8(c6)).Buffer}catch(R){}C.isBN=function(J){if(J instanceof C)return!0;return J!==null&&typeof J==="object"&&J.constructor.wordSize===C.wordSize&&Array.isArray(J.words)},C.max=function(J,V){if(J.cmp(V)>0)return J;return V},C.min=function(J,V){if(J.cmp(V)<0)return J;return V},C.prototype._init=function(J,V,Z){if(typeof J==="number")return this._initNumber(J,V,Z);if(typeof J==="object")return this._initArray(J,V,Z);if(V==="hex")V=16;P(V===(V|0)&&V>=2&&V<=36),J=J.toString().replace(/\s+/g,"");var H=0;if(J[0]==="-")H++,this.negative=1;if(H<J.length){if(V===16)this._parseHex(J,H,Z);else if(this._parseBase(J,V,H),Z==="le")this._initArray(this.toArray(),V,Z)}},C.prototype._initNumber=function(J,V,Z){if(J<0)this.negative=1,J=-J;if(J<67108864)this.words=[J&67108863],this.length=1;else if(J<4503599627370496)this.words=[J&67108863,J/67108864&67108863],this.length=2;else P(J<9007199254740992),this.words=[J&67108863,J/67108864&67108863,1],this.length=3;if(Z!=="le")return;this._initArray(this.toArray(),V,Z)},C.prototype._initArray=function(J,V,Z){if(P(typeof J.length==="number"),J.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(J.length/3),this.words=Array(this.length);for(var H=0;H<this.length;H++)this.words[H]=0;var j,z,S=0;if(Z==="be"){for(H=J.length-1,j=0;H>=0;H-=3)if(z=J[H]|J[H-1]<<8|J[H-2]<<16,this.words[j]|=z<<S&67108863,this.words[j+1]=z>>>26-S&67108863,S+=24,S>=26)S-=26,j++}else if(Z==="le"){for(H=0,j=0;H<J.length;H+=3)if(z=J[H]|J[H+1]<<8|J[H+2]<<16,this.words[j]|=z<<S&67108863,this.words[j+1]=z>>>26-S&67108863,S+=24,S>=26)S-=26,j++}return this._strip()};function G(R,J){var V=R.charCodeAt(J);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 "+R)}function U(R,J,V){var Z=G(R,V);if(V-1>=J)Z|=G(R,V-1)<<4;return Z}C.prototype._parseHex=function(J,V,Z){this.length=Math.ceil((J.length-V)/6),this.words=Array(this.length);for(var H=0;H<this.length;H++)this.words[H]=0;var j=0,z=0,S;if(Z==="be")for(H=J.length-1;H>=V;H-=2)if(S=U(J,V,H)<<j,this.words[z]|=S&67108863,j>=18)j-=18,z+=1,this.words[z]|=S>>>26;else j+=8;else{var k=J.length-V;for(H=k%2===0?V+1:V;H<J.length;H+=2)if(S=U(J,V,H)<<j,this.words[z]|=S&67108863,j>=18)j-=18,z+=1,this.words[z]|=S>>>26;else j+=8}this._strip()};function $(R,J,V,Z){var H=0,j=0,z=Math.min(R.length,V);for(var S=J;S<z;S++){var k=R.charCodeAt(S)-48;if(H*=Z,k>=49)j=k-49+10;else if(k>=17)j=k-17+10;else j=k;P(k>=0&&j<Z,"Invalid character"),H+=j}return H}C.prototype._parseBase=function(J,V,Z){this.words=[0],this.length=1;for(var H=0,j=1;j<=67108863;j*=V)H++;H--,j=j/V|0;var z=J.length-Z,S=z%H,k=Math.min(z,z-S)+Z,Y=0;for(var D=Z;D<k;D+=H)if(Y=$(J,D,D+H,V),this.imuln(j),this.words[0]+Y<67108864)this.words[0]+=Y;else this._iaddn(Y);if(S!==0){var b=1;Y=$(J,D,J.length,V);for(D=0;D<S;D++)b*=V;if(this.imuln(b),this.words[0]+Y<67108864)this.words[0]+=Y;else this._iaddn(Y)}this._strip()},C.prototype.copy=function(J){J.words=Array(this.length);for(var V=0;V<this.length;V++)J.words[V]=this.words[V];J.length=this.length,J.negative=this.negative,J.red=this.red};function q(R,J){R.words=J.words,R.length=J.length,R.negative=J.negative,R.red=J.red}if(C.prototype._move=function(J){q(J,this)},C.prototype.clone=function(){var J=new C(null);return this.copy(J),J},C.prototype._expand=function(J){while(this.length<J)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")]=X}catch(R){C.prototype.inspect=X}else C.prototype.inspect=X;function X(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var K=["","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"],F=[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],M=[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(J,V){J=J||10,V=V|0||1;var Z;if(J===16||J==="hex"){Z="";var H=0,j=0;for(var z=0;z<this.length;z++){var S=this.words[z],k=((S<<H|j)&16777215).toString(16);if(j=S>>>24-H&16777215,H+=2,H>=26)H-=26,z--;if(j!==0||z!==this.length-1)Z=K[6-k.length]+k+Z;else Z=k+Z}if(j!==0)Z=j.toString(16)+Z;while(Z.length%V!==0)Z="0"+Z;if(this.negative!==0)Z="-"+Z;return Z}if(J===(J|0)&&J>=2&&J<=36){var Y=F[J],D=M[J];Z="";var b=this.clone();b.negative=0;while(!b.isZero()){var f=b.modrn(D).toString(J);if(b=b.idivn(D),!b.isZero())Z=K[Y-f.length]+f+Z;else Z=f+Z}if(this.isZero())Z="0"+Z;while(Z.length%V!==0)Z="0"+Z;if(this.negative!==0)Z="-"+Z;return Z}P(!1,"Base should be between 2 and 36")},C.prototype.toNumber=function(){var J=this.words[0];if(this.length===2)J+=this.words[1]*67108864;else if(this.length===3&&this.words[2]===1)J+=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?-J:J},C.prototype.toJSON=function(){return this.toString(16,2)},W)C.prototype.toBuffer=function(J,V){return this.toArrayLike(W,J,V)};C.prototype.toArray=function(J,V){return this.toArrayLike(Array,J,V)};var I=function(J,V){if(J.allocUnsafe)return J.allocUnsafe(V);return new J(V)};if(C.prototype.toArrayLike=function(J,V,Z){this._strip();var H=this.byteLength(),j=Z||Math.max(1,H);P(H<=j,"byte array longer than desired length"),P(j>0,"Requested array length <= 0");var z=I(J,j),S=V==="le"?"LE":"BE";return this["_toArrayLike"+S](z,H),z},C.prototype._toArrayLikeLE=function(J,V){var Z=0,H=0;for(var j=0,z=0;j<this.length;j++){var S=this.words[j]<<z|H;if(J[Z++]=S&255,Z<J.length)J[Z++]=S>>8&255;if(Z<J.length)J[Z++]=S>>16&255;if(z===6){if(Z<J.length)J[Z++]=S>>24&255;H=0,z=0}else H=S>>>24,z+=2}if(Z<J.length){J[Z++]=H;while(Z<J.length)J[Z++]=0}},C.prototype._toArrayLikeBE=function(J,V){var Z=J.length-1,H=0;for(var j=0,z=0;j<this.length;j++){var S=this.words[j]<<z|H;if(J[Z--]=S&255,Z>=0)J[Z--]=S>>8&255;if(Z>=0)J[Z--]=S>>16&255;if(z===6){if(Z>=0)J[Z--]=S>>24&255;H=0,z=0}else H=S>>>24,z+=2}if(Z>=0){J[Z--]=H;while(Z>=0)J[Z--]=0}},Math.clz32)C.prototype._countBits=function(J){return 32-Math.clz32(J)};else C.prototype._countBits=function(J){var V=J,Z=0;if(V>=4096)Z+=13,V>>>=13;if(V>=64)Z+=7,V>>>=7;if(V>=8)Z+=4,V>>>=4;if(V>=2)Z+=2,V>>>=2;return Z+V};C.prototype._zeroBits=function(J){if(J===0)return 26;var V=J,Z=0;if((V&8191)===0)Z+=13,V>>>=13;if((V&127)===0)Z+=7,V>>>=7;if((V&15)===0)Z+=4,V>>>=4;if((V&3)===0)Z+=2,V>>>=2;if((V&1)===0)Z++;return Z},C.prototype.bitLength=function(){var J=this.words[this.length-1],V=this._countBits(J);return(this.length-1)*26+V};function E(R){var J=Array(R.bitLength());for(var V=0;V<J.length;V++){var Z=V/26|0,H=V%26;J[V]=R.words[Z]>>>H&1}return J}C.prototype.zeroBits=function(){if(this.isZero())return 0;var J=0;for(var V=0;V<this.length;V++){var Z=this._zeroBits(this.words[V]);if(J+=Z,Z!==26)break}return J},C.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},C.prototype.toTwos=function(J){if(this.negative!==0)return this.abs().inotn(J).iaddn(1);return this.clone()},C.prototype.fromTwos=function(J){if(this.testn(J-1))return this.notn(J).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(J){while(this.length<J.length)this.words[this.length++]=0;for(var V=0;V<J.length;V++)this.words[V]=this.words[V]|J.words[V];return this._strip()},C.prototype.ior=function(J){return P((this.negative|J.negative)===0),this.iuor(J)},C.prototype.or=function(J){if(this.length>J.length)return this.clone().ior(J);return J.clone().ior(this)},C.prototype.uor=function(J){if(this.length>J.length)return this.clone().iuor(J);return J.clone().iuor(this)},C.prototype.iuand=function(J){var V;if(this.length>J.length)V=J;else V=this;for(var Z=0;Z<V.length;Z++)this.words[Z]=this.words[Z]&J.words[Z];return this.length=V.length,this._strip()},C.prototype.iand=function(J){return P((this.negative|J.negative)===0),this.iuand(J)},C.prototype.and=function(J){if(this.length>J.length)return this.clone().iand(J);return J.clone().iand(this)},C.prototype.uand=function(J){if(this.length>J.length)return this.clone().iuand(J);return J.clone().iuand(this)},C.prototype.iuxor=function(J){var V,Z;if(this.length>J.length)V=this,Z=J;else V=J,Z=this;for(var H=0;H<Z.length;H++)this.words[H]=V.words[H]^Z.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(J){return P((this.negative|J.negative)===0),this.iuxor(J)},C.prototype.xor=function(J){if(this.length>J.length)return this.clone().ixor(J);return J.clone().ixor(this)},C.prototype.uxor=function(J){if(this.length>J.length)return this.clone().iuxor(J);return J.clone().iuxor(this)},C.prototype.inotn=function(J){P(typeof J==="number"&&J>=0);var V=Math.ceil(J/26)|0,Z=J%26;if(this._expand(V),Z>0)V--;for(var H=0;H<V;H++)this.words[H]=~this.words[H]&67108863;if(Z>0)this.words[H]=~this.words[H]&67108863>>26-Z;return this._strip()},C.prototype.notn=function(J){return this.clone().inotn(J)},C.prototype.setn=function(J,V){P(typeof J==="number"&&J>=0);var Z=J/26|0,H=J%26;if(this._expand(Z+1),V)this.words[Z]=this.words[Z]|1<<H;else this.words[Z]=this.words[Z]&~(1<<H);return this._strip()},C.prototype.iadd=function(J){var V;if(this.negative!==0&&J.negative===0)return this.negative=0,V=this.isub(J),this.negative^=1,this._normSign();else if(this.negative===0&&J.negative!==0)return J.negative=0,V=this.isub(J),J.negative=1,V._normSign();var Z,H;if(this.length>J.length)Z=this,H=J;else Z=J,H=this;var j=0;for(var z=0;z<H.length;z++)V=(Z.words[z]|0)+(H.words[z]|0)+j,this.words[z]=V&67108863,j=V>>>26;for(;j!==0&&z<Z.length;z++)V=(Z.words[z]|0)+j,this.words[z]=V&67108863,j=V>>>26;if(this.length=Z.length,j!==0)this.words[this.length]=j,this.length++;else if(Z!==this)for(;z<Z.length;z++)this.words[z]=Z.words[z];return this},C.prototype.add=function(J){var V;if(J.negative!==0&&this.negative===0)return J.negative=0,V=this.sub(J),J.negative^=1,V;else if(J.negative===0&&this.negative!==0)return this.negative=0,V=J.sub(this),this.negative=1,V;if(this.length>J.length)return this.clone().iadd(J);return J.clone().iadd(this)},C.prototype.isub=function(J){if(J.negative!==0){J.negative=0;var V=this.iadd(J);return J.negative=1,V._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(J),this.negative=1,this._normSign();var Z=this.cmp(J);if(Z===0)return this.negative=0,this.length=1,this.words[0]=0,this;var H,j;if(Z>0)H=this,j=J;else H=J,j=this;var z=0;for(var S=0;S<j.length;S++)V=(H.words[S]|0)-(j.words[S]|0)+z,z=V>>26,this.words[S]=V&67108863;for(;z!==0&&S<H.length;S++)V=(H.words[S]|0)+z,z=V>>26,this.words[S]=V&67108863;if(z===0&&S<H.length&&H!==this)for(;S<H.length;S++)this.words[S]=H.words[S];if(this.length=Math.max(this.length,S),H!==this)this.negative=1;return this._strip()},C.prototype.sub=function(J){return this.clone().isub(J)};function L(R,J,V){V.negative=J.negative^R.negative;var Z=R.length+J.length|0;V.length=Z,Z=Z-1|0;var H=R.words[0]|0,j=J.words[0]|0,z=H*j,S=z&67108863,k=z/67108864|0;V.words[0]=S;for(var Y=1;Y<Z;Y++){var D=k>>>26,b=k&67108863,f=Math.min(Y,J.length-1);for(var d=Math.max(0,Y-R.length+1);d<=f;d++){var T1=Y-d|0;H=R.words[T1]|0,j=J.words[d]|0,z=H*j+b,D+=z/67108864|0,b=z&67108863}V.words[Y]=b|0,k=D|0}if(k!==0)V.words[Y]=k|0;else V.length--;return V._strip()}var O=function(J,V,Z){var H=J.words,j=V.words,z=Z.words,S=0,k,Y,D,b=H[0]|0,f=b&8191,d=b>>>13,T1=H[1]|0,P1=T1&8191,Q1=T1>>>13,nT=H[2]|0,$1=nT&8191,q1=nT>>>13,A2=H[3]|0,x1=A2&8191,_1=A2>>>13,eW=H[4]|0,h1=eW&8191,g1=eW>>>13,TG=H[5]|0,m1=TG&8191,v1=TG>>>13,AG=H[6]|0,y1=AG&8191,b1=AG>>>13,PG=H[7]|0,l1=PG&8191,p1=PG>>>13,QG=H[8]|0,u1=QG&8191,d1=QG>>>13,CG=H[9]|0,r1=CG&8191,c1=CG>>>13,WG=j[0]|0,o1=WG&8191,f1=WG>>>13,GG=j[1]|0,n1=GG&8191,i1=GG>>>13,JG=j[2]|0,a1=JG&8191,s1=JG>>>13,UG=j[3]|0,t1=UG&8191,e1=UG>>>13,$G=j[4]|0,TT=$G&8191,AT=$G>>>13,VG=j[5]|0,PT=VG&8191,QT=VG>>>13,YG=j[6]|0,CT=YG&8191,WT=YG>>>13,ZG=j[7]|0,GT=ZG&8191,JT=ZG>>>13,qG=j[8]|0,UT=qG&8191,$T=qG>>>13,XG=j[9]|0,VT=XG&8191,YT=XG>>>13;Z.negative=J.negative^V.negative,Z.length=19,k=Math.imul(f,o1),Y=Math.imul(f,f1),Y=Y+Math.imul(d,o1)|0,D=Math.imul(d,f1);var n4=(S+k|0)+((Y&8191)<<13)|0;S=(D+(Y>>>13)|0)+(n4>>>26)|0,n4&=67108863,k=Math.imul(P1,o1),Y=Math.imul(P1,f1),Y=Y+Math.imul(Q1,o1)|0,D=Math.imul(Q1,f1),k=k+Math.imul(f,n1)|0,Y=Y+Math.imul(f,i1)|0,Y=Y+Math.imul(d,n1)|0,D=D+Math.imul(d,i1)|0;var i4=(S+k|0)+((Y&8191)<<13)|0;S=(D+(Y>>>13)|0)+(i4>>>26)|0,i4&=67108863,k=Math.imul($1,o1),Y=Math.imul($1,f1),Y=Y+Math.imul(q1,o1)|0,D=Math.imul(q1,f1),k=k+Math.imul(P1,n1)|0,Y=Y+Math.imul(P1,i1)|0,Y=Y+Math.imul(Q1,n1)|0,D=D+Math.imul(Q1,i1)|0,k=k+Math.imul(f,a1)|0,Y=Y+Math.imul(f,s1)|0,Y=Y+Math.imul(d,a1)|0,D=D+Math.imul(d,s1)|0;var a4=(S+k|0)+((Y&8191)<<13)|0;S=(D+(Y>>>13)|0)+(a4>>>26)|0,a4&=67108863,k=Math.imul(x1,o1),Y=Math.imul(x1,f1),Y=Y+Math.imul(_1,o1)|0,D=Math.imul(_1,f1),k=k+Math.imul($1,n1)|0,Y=Y+Math.imul($1,i1)|0,Y=Y+Math.imul(q1,n1)|0,D=D+Math.imul(q1,i1)|0,k=k+Math.imul(P1,a1)|0,Y=Y+Math.imul(P1,s1)|0,Y=Y+Math.imul(Q1,a1)|0,D=D+Math.imul(Q1,s1)|0,k=k+Math.imul(f,t1)|0,Y=Y+Math.imul(f,e1)|0,Y=Y+Math.imul(d,t1)|0,D=D+Math.imul(d,e1)|0;var s4=(S+k|0)+((Y&8191)<<13)|0;S=(D+(Y>>>13)|0)+(s4>>>26)|0,s4&=67108863,k=Math.imul(h1,o1),Y=Math.imul(h1,f1),Y=Y+Math.imul(g1,o1)|0,D=Math.imul(g1,f1),k=k+Math.imul(x1,n1)|0,Y=Y+Math.imul(x1,i1)|0,Y=Y+Math.imul(_1,n1)|0,D=D+Math.imul(_1,i1)|0,k=k+Math.imul($1,a1)|0,Y=Y+Math.imul($1,s1)|0,Y=Y+Math.imul(q1,a1)|0,D=D+Math.imul(q1,s1)|0,k=k+Math.imul(P1,t1)|0,Y=Y+Math.imul(P1,e1)|0,Y=Y+Math.imul(Q1,t1)|0,D=D+Math.imul(Q1,e1)|0,k=k+Math.imul(f,TT)|0,Y=Y+Math.imul(f,AT)|0,Y=Y+Math.imul(d,TT)|0,D=D+Math.imul(d,AT)|0;var t4=(S+k|0)+((Y&8191)<<13)|0;S=(D+(Y>>>13)|0)+(t4>>>26)|0,t4&=67108863,k=Math.imul(m1,o1),Y=Math.imul(m1,f1),Y=Y+Math.imul(v1,o1)|0,D=Math.imul(v1,f1),k=k+Math.imul(h1,n1)|0,Y=Y+Math.imul(h1,i1)|0,Y=Y+Math.imul(g1,n1)|0,D=D+Math.imul(g1,i1)|0,k=k+Math.imul(x1,a1)|0,Y=Y+Math.imul(x1,s1)|0,Y=Y+Math.imul(_1,a1)|0,D=D+Math.imul(_1,s1)|0,k=k+Math.imul($1,t1)|0,Y=Y+Math.imul($1,e1)|0,Y=Y+Math.imul(q1,t1)|0,D=D+Math.imul(q1,e1)|0,k=k+Math.imul(P1,TT)|0,Y=Y+Math.imul(P1,AT)|0,Y=Y+Math.imul(Q1,TT)|0,D=D+Math.imul(Q1,AT)|0,k=k+Math.imul(f,PT)|0,Y=Y+Math.imul(f,QT)|0,Y=Y+Math.imul(d,PT)|0,D=D+Math.imul(d,QT)|0;var e4=(S+k|0)+((Y&8191)<<13)|0;S=(D+(Y>>>13)|0)+(e4>>>26)|0,e4&=67108863,k=Math.imul(y1,o1),Y=Math.imul(y1,f1),Y=Y+Math.imul(b1,o1)|0,D=Math.imul(b1,f1),k=k+Math.imul(m1,n1)|0,Y=Y+Math.imul(m1,i1)|0,Y=Y+Math.imul(v1,n1)|0,D=D+Math.imul(v1,i1)|0,k=k+Math.imul(h1,a1)|0,Y=Y+Math.imul(h1,s1)|0,Y=Y+Math.imul(g1,a1)|0,D=D+Math.imul(g1,s1)|0,k=k+Math.imul(x1,t1)|0,Y=Y+Math.imul(x1,e1)|0,Y=Y+Math.imul(_1,t1)|0,D=D+Math.imul(_1,e1)|0,k=k+Math.imul($1,TT)|0,Y=Y+Math.imul($1,AT)|0,Y=Y+Math.imul(q1,TT)|0,D=D+Math.imul(q1,AT)|0,k=k+Math.imul(P1,PT)|0,Y=Y+Math.imul(P1,QT)|0,Y=Y+Math.imul(Q1,PT)|0,D=D+Math.imul(Q1,QT)|0,k=k+Math.imul(f,CT)|0,Y=Y+Math.imul(f,WT)|0,Y=Y+Math.imul(d,CT)|0,D=D+Math.imul(d,WT)|0;var TP=(S+k|0)+((Y&8191)<<13)|0;S=(D+(Y>>>13)|0)+(TP>>>26)|0,TP&=67108863,k=Math.imul(l1,o1),Y=Math.imul(l1,f1),Y=Y+Math.imul(p1,o1)|0,D=Math.imul(p1,f1),k=k+Math.imul(y1,n1)|0,Y=Y+Math.imul(y1,i1)|0,Y=Y+Math.imul(b1,n1)|0,D=D+Math.imul(b1,i1)|0,k=k+Math.imul(m1,a1)|0,Y=Y+Math.imul(m1,s1)|0,Y=Y+Math.imul(v1,a1)|0,D=D+Math.imul(v1,s1)|0,k=k+Math.imul(h1,t1)|0,Y=Y+Math.imul(h1,e1)|0,Y=Y+Math.imul(g1,t1)|0,D=D+Math.imul(g1,e1)|0,k=k+Math.imul(x1,TT)|0,Y=Y+Math.imul(x1,AT)|0,Y=Y+Math.imul(_1,TT)|0,D=D+Math.imul(_1,AT)|0,k=k+Math.imul($1,PT)|0,Y=Y+Math.imul($1,QT)|0,Y=Y+Math.imul(q1,PT)|0,D=D+Math.imul(q1,QT)|0,k=k+Math.imul(P1,CT)|0,Y=Y+Math.imul(P1,WT)|0,Y=Y+Math.imul(Q1,CT)|0,D=D+Math.imul(Q1,WT)|0,k=k+Math.imul(f,GT)|0,Y=Y+Math.imul(f,JT)|0,Y=Y+Math.imul(d,GT)|0,D=D+Math.imul(d,JT)|0;var AP=(S+k|0)+((Y&8191)<<13)|0;S=(D+(Y>>>13)|0)+(AP>>>26)|0,AP&=67108863,k=Math.imul(u1,o1),Y=Math.imul(u1,f1),Y=Y+Math.imul(d1,o1)|0,D=Math.imul(d1,f1),k=k+Math.imul(l1,n1)|0,Y=Y+Math.imul(l1,i1)|0,Y=Y+Math.imul(p1,n1)|0,D=D+Math.imul(p1,i1)|0,k=k+Math.imul(y1,a1)|0,Y=Y+Math.imul(y1,s1)|0,Y=Y+Math.imul(b1,a1)|0,D=D+Math.imul(b1,s1)|0,k=k+Math.imul(m1,t1)|0,Y=Y+Math.imul(m1,e1)|0,Y=Y+Math.imul(v1,t1)|0,D=D+Math.imul(v1,e1)|0,k=k+Math.imul(h1,TT)|0,Y=Y+Math.imul(h1,AT)|0,Y=Y+Math.imul(g1,TT)|0,D=D+Math.imul(g1,AT)|0,k=k+Math.imul(x1,PT)|0,Y=Y+Math.imul(x1,QT)|0,Y=Y+Math.imul(_1,PT)|0,D=D+Math.imul(_1,QT)|0,k=k+Math.imul($1,CT)|0,Y=Y+Math.imul($1,WT)|0,Y=Y+Math.imul(q1,CT)|0,D=D+Math.imul(q1,WT)|0,k=k+Math.imul(P1,GT)|0,Y=Y+Math.imul(P1,JT)|0,Y=Y+Math.imul(Q1,GT)|0,D=D+Math.imul(Q1,JT)|0,k=k+Math.imul(f,UT)|0,Y=Y+Math.imul(f,$T)|0,Y=Y+Math.imul(d,UT)|0,D=D+Math.imul(d,$T)|0;var PP=(S+k|0)+((Y&8191)<<13)|0;S=(D+(Y>>>13)|0)+(PP>>>26)|0,PP&=67108863,k=Math.imul(r1,o1),Y=Math.imul(r1,f1),Y=Y+Math.imul(c1,o1)|0,D=Math.imul(c1,f1),k=k+Math.imul(u1,n1)|0,Y=Y+Math.imul(u1,i1)|0,Y=Y+Math.imul(d1,n1)|0,D=D+Math.imul(d1,i1)|0,k=k+Math.imul(l1,a1)|0,Y=Y+Math.imul(l1,s1)|0,Y=Y+Math.imul(p1,a1)|0,D=D+Math.imul(p1,s1)|0,k=k+Math.imul(y1,t1)|0,Y=Y+Math.imul(y1,e1)|0,Y=Y+Math.imul(b1,t1)|0,D=D+Math.imul(b1,e1)|0,k=k+Math.imul(m1,TT)|0,Y=Y+Math.imul(m1,AT)|0,Y=Y+Math.imul(v1,TT)|0,D=D+Math.imul(v1,AT)|0,k=k+Math.imul(h1,PT)|0,Y=Y+Math.imul(h1,QT)|0,Y=Y+Math.imul(g1,PT)|0,D=D+Math.imul(g1,QT)|0,k=k+Math.imul(x1,CT)|0,Y=Y+Math.imul(x1,WT)|0,Y=Y+Math.imul(_1,CT)|0,D=D+Math.imul(_1,WT)|0,k=k+Math.imul($1,GT)|0,Y=Y+Math.imul($1,JT)|0,Y=Y+Math.imul(q1,GT)|0,D=D+Math.imul(q1,JT)|0,k=k+Math.imul(P1,UT)|0,Y=Y+Math.imul(P1,$T)|0,Y=Y+Math.imul(Q1,UT)|0,D=D+Math.imul(Q1,$T)|0,k=k+Math.imul(f,VT)|0,Y=Y+Math.imul(f,YT)|0,Y=Y+Math.imul(d,VT)|0,D=D+Math.imul(d,YT)|0;var QP=(S+k|0)+((Y&8191)<<13)|0;S=(D+(Y>>>13)|0)+(QP>>>26)|0,QP&=67108863,k=Math.imul(r1,n1),Y=Math.imul(r1,i1),Y=Y+Math.imul(c1,n1)|0,D=Math.imul(c1,i1),k=k+Math.imul(u1,a1)|0,Y=Y+Math.imul(u1,s1)|0,Y=Y+Math.imul(d1,a1)|0,D=D+Math.imul(d1,s1)|0,k=k+Math.imul(l1,t1)|0,Y=Y+Math.imul(l1,e1)|0,Y=Y+Math.imul(p1,t1)|0,D=D+Math.imul(p1,e1)|0,k=k+Math.imul(y1,TT)|0,Y=Y+Math.imul(y1,AT)|0,Y=Y+Math.imul(b1,TT)|0,D=D+Math.imul(b1,AT)|0,k=k+Math.imul(m1,PT)|0,Y=Y+Math.imul(m1,QT)|0,Y=Y+Math.imul(v1,PT)|0,D=D+Math.imul(v1,QT)|0,k=k+Math.imul(h1,CT)|0,Y=Y+Math.imul(h1,WT)|0,Y=Y+Math.imul(g1,CT)|0,D=D+Math.imul(g1,WT)|0,k=k+Math.imul(x1,GT)|0,Y=Y+Math.imul(x1,JT)|0,Y=Y+Math.imul(_1,GT)|0,D=D+Math.imul(_1,JT)|0,k=k+Math.imul($1,UT)|0,Y=Y+Math.imul($1,$T)|0,Y=Y+Math.imul(q1,UT)|0,D=D+Math.imul(q1,$T)|0,k=k+Math.imul(P1,VT)|0,Y=Y+Math.imul(P1,YT)|0,Y=Y+Math.imul(Q1,VT)|0,D=D+Math.imul(Q1,YT)|0;var CP=(S+k|0)+((Y&8191)<<13)|0;S=(D+(Y>>>13)|0)+(CP>>>26)|0,CP&=67108863,k=Math.imul(r1,a1),Y=Math.imul(r1,s1),Y=Y+Math.imul(c1,a1)|0,D=Math.imul(c1,s1),k=k+Math.imul(u1,t1)|0,Y=Y+Math.imul(u1,e1)|0,Y=Y+Math.imul(d1,t1)|0,D=D+Math.imul(d1,e1)|0,k=k+Math.imul(l1,TT)|0,Y=Y+Math.imul(l1,AT)|0,Y=Y+Math.imul(p1,TT)|0,D=D+Math.imul(p1,AT)|0,k=k+Math.imul(y1,PT)|0,Y=Y+Math.imul(y1,QT)|0,Y=Y+Math.imul(b1,PT)|0,D=D+Math.imul(b1,QT)|0,k=k+Math.imul(m1,CT)|0,Y=Y+Math.imul(m1,WT)|0,Y=Y+Math.imul(v1,CT)|0,D=D+Math.imul(v1,WT)|0,k=k+Math.imul(h1,GT)|0,Y=Y+Math.imul(h1,JT)|0,Y=Y+Math.imul(g1,GT)|0,D=D+Math.imul(g1,JT)|0,k=k+Math.imul(x1,UT)|0,Y=Y+Math.imul(x1,$T)|0,Y=Y+Math.imul(_1,UT)|0,D=D+Math.imul(_1,$T)|0,k=k+Math.imul($1,VT)|0,Y=Y+Math.imul($1,YT)|0,Y=Y+Math.imul(q1,VT)|0,D=D+Math.imul(q1,YT)|0;var WP=(S+k|0)+((Y&8191)<<13)|0;S=(D+(Y>>>13)|0)+(WP>>>26)|0,WP&=67108863,k=Math.imul(r1,t1),Y=Math.imul(r1,e1),Y=Y+Math.imul(c1,t1)|0,D=Math.imul(c1,e1),k=k+Math.imul(u1,TT)|0,Y=Y+Math.imul(u1,AT)|0,Y=Y+Math.imul(d1,TT)|0,D=D+Math.imul(d1,AT)|0,k=k+Math.imul(l1,PT)|0,Y=Y+Math.imul(l1,QT)|0,Y=Y+Math.imul(p1,PT)|0,D=D+Math.imul(p1,QT)|0,k=k+Math.imul(y1,CT)|0,Y=Y+Math.imul(y1,WT)|0,Y=Y+Math.imul(b1,CT)|0,D=D+Math.imul(b1,WT)|0,k=k+Math.imul(m1,GT)|0,Y=Y+Math.imul(m1,JT)|0,Y=Y+Math.imul(v1,GT)|0,D=D+Math.imul(v1,JT)|0,k=k+Math.imul(h1,UT)|0,Y=Y+Math.imul(h1,$T)|0,Y=Y+Math.imul(g1,UT)|0,D=D+Math.imul(g1,$T)|0,k=k+Math.imul(x1,VT)|0,Y=Y+Math.imul(x1,YT)|0,Y=Y+Math.imul(_1,VT)|0,D=D+Math.imul(_1,YT)|0;var GP=(S+k|0)+((Y&8191)<<13)|0;S=(D+(Y>>>13)|0)+(GP>>>26)|0,GP&=67108863,k=Math.imul(r1,TT),Y=Math.imul(r1,AT),Y=Y+Math.imul(c1,TT)|0,D=Math.imul(c1,AT),k=k+Math.imul(u1,PT)|0,Y=Y+Math.imul(u1,QT)|0,Y=Y+Math.imul(d1,PT)|0,D=D+Math.imul(d1,QT)|0,k=k+Math.imul(l1,CT)|0,Y=Y+Math.imul(l1,WT)|0,Y=Y+Math.imul(p1,CT)|0,D=D+Math.imul(p1,WT)|0,k=k+Math.imul(y1,GT)|0,Y=Y+Math.imul(y1,JT)|0,Y=Y+Math.imul(b1,GT)|0,D=D+Math.imul(b1,JT)|0,k=k+Math.imul(m1,UT)|0,Y=Y+Math.imul(m1,$T)|0,Y=Y+Math.imul(v1,UT)|0,D=D+Math.imul(v1,$T)|0,k=k+Math.imul(h1,VT)|0,Y=Y+Math.imul(h1,YT)|0,Y=Y+Math.imul(g1,VT)|0,D=D+Math.imul(g1,YT)|0;var JP=(S+k|0)+((Y&8191)<<13)|0;S=(D+(Y>>>13)|0)+(JP>>>26)|0,JP&=67108863,k=Math.imul(r1,PT),Y=Math.imul(r1,QT),Y=Y+Math.imul(c1,PT)|0,D=Math.imul(c1,QT),k=k+Math.imul(u1,CT)|0,Y=Y+Math.imul(u1,WT)|0,Y=Y+Math.imul(d1,CT)|0,D=D+Math.imul(d1,WT)|0,k=k+Math.imul(l1,GT)|0,Y=Y+Math.imul(l1,JT)|0,Y=Y+Math.imul(p1,GT)|0,D=D+Math.imul(p1,JT)|0,k=k+Math.imul(y1,UT)|0,Y=Y+Math.imul(y1,$T)|0,Y=Y+Math.imul(b1,UT)|0,D=D+Math.imul(b1,$T)|0,k=k+Math.imul(m1,VT)|0,Y=Y+Math.imul(m1,YT)|0,Y=Y+Math.imul(v1,VT)|0,D=D+Math.imul(v1,YT)|0;var UP=(S+k|0)+((Y&8191)<<13)|0;S=(D+(Y>>>13)|0)+(UP>>>26)|0,UP&=67108863,k=Math.imul(r1,CT),Y=Math.imul(r1,WT),Y=Y+Math.imul(c1,CT)|0,D=Math.imul(c1,WT),k=k+Math.imul(u1,GT)|0,Y=Y+Math.imul(u1,JT)|0,Y=Y+Math.imul(d1,GT)|0,D=D+Math.imul(d1,JT)|0,k=k+Math.imul(l1,UT)|0,Y=Y+Math.imul(l1,$T)|0,Y=Y+Math.imul(p1,UT)|0,D=D+Math.imul(p1,$T)|0,k=k+Math.imul(y1,VT)|0,Y=Y+Math.imul(y1,YT)|0,Y=Y+Math.imul(b1,VT)|0,D=D+Math.imul(b1,YT)|0;var $P=(S+k|0)+((Y&8191)<<13)|0;S=(D+(Y>>>13)|0)+($P>>>26)|0,$P&=67108863,k=Math.imul(r1,GT),Y=Math.imul(r1,JT),Y=Y+Math.imul(c1,GT)|0,D=Math.imul(c1,JT),k=k+Math.imul(u1,UT)|0,Y=Y+Math.imul(u1,$T)|0,Y=Y+Math.imul(d1,UT)|0,D=D+Math.imul(d1,$T)|0,k=k+Math.imul(l1,VT)|0,Y=Y+Math.imul(l1,YT)|0,Y=Y+Math.imul(p1,VT)|0,D=D+Math.imul(p1,YT)|0;var VP=(S+k|0)+((Y&8191)<<13)|0;S=(D+(Y>>>13)|0)+(VP>>>26)|0,VP&=67108863,k=Math.imul(r1,UT),Y=Math.imul(r1,$T),Y=Y+Math.imul(c1,UT)|0,D=Math.imul(c1,$T),k=k+Math.imul(u1,VT)|0,Y=Y+Math.imul(u1,YT)|0,Y=Y+Math.imul(d1,VT)|0,D=D+Math.imul(d1,YT)|0;var YP=(S+k|0)+((Y&8191)<<13)|0;S=(D+(Y>>>13)|0)+(YP>>>26)|0,YP&=67108863,k=Math.imul(r1,VT),Y=Math.imul(r1,YT),Y=Y+Math.imul(c1,VT)|0,D=Math.imul(c1,YT);var ZP=(S+k|0)+((Y&8191)<<13)|0;if(S=(D+(Y>>>13)|0)+(ZP>>>26)|0,ZP&=67108863,z[0]=n4,z[1]=i4,z[2]=a4,z[3]=s4,z[4]=t4,z[5]=e4,z[6]=TP,z[7]=AP,z[8]=PP,z[9]=QP,z[10]=CP,z[11]=WP,z[12]=GP,z[13]=JP,z[14]=UP,z[15]=$P,z[16]=VP,z[17]=YP,z[18]=ZP,S!==0)z[19]=S,Z.length++;return Z};if(!Math.imul)O=L;function m(R,J,V){V.negative=J.negative^R.negative,V.length=R.length+J.length;var Z=0,H=0;for(var j=0;j<V.length-1;j++){var z=H;H=0;var S=Z&67108863,k=Math.min(j,J.length-1);for(var Y=Math.max(0,j-R.length+1);Y<=k;Y++){var D=j-Y,b=R.words[D]|0,f=J.words[Y]|0,d=b*f,T1=d&67108863;z=z+(d/67108864|0)|0,T1=T1+S|0,S=T1&67108863,z=z+(T1>>>26)|0,H+=z>>>26,z&=67108863}V.words[j]=S,Z=z,z=H}if(Z!==0)V.words[j]=Z;else V.length--;return V._strip()}function v(R,J,V){return m(R,J,V)}C.prototype.mulTo=function(J,V){var Z,H=this.length+J.length;if(this.length===10&&J.length===10)Z=O(this,J,V);else if(H<63)Z=L(this,J,V);else if(H<1024)Z=m(this,J,V);else Z=v(this,J,V);return Z};function l(R,J){this.x=R,this.y=J}l.prototype.makeRBT=function(J){var V=Array(J),Z=C.prototype._countBits(J)-1;for(var H=0;H<J;H++)V[H]=this.revBin(H,Z,J);return V},l.prototype.revBin=function(J,V,Z){if(J===0||J===Z-1)return J;var H=0;for(var j=0;j<V;j++)H|=(J&1)<<V-j-1,J>>=1;return H},l.prototype.permute=function(J,V,Z,H,j,z){for(var S=0;S<z;S++)H[S]=V[J[S]],j[S]=Z[J[S]]},l.prototype.transform=function(J,V,Z,H,j,z){this.permute(z,J,V,Z,H,j);for(var S=1;S<j;S<<=1){var k=S<<1,Y=Math.cos(2*Math.PI/k),D=Math.sin(2*Math.PI/k);for(var b=0;b<j;b+=k){var f=Y,d=D;for(var T1=0;T1<S;T1++){var P1=Z[b+T1],Q1=H[b+T1],nT=Z[b+T1+S],$1=H[b+T1+S],q1=f*nT-d*$1;if($1=f*$1+d*nT,nT=q1,Z[b+T1]=P1+nT,H[b+T1]=Q1+$1,Z[b+T1+S]=P1-nT,H[b+T1+S]=Q1-$1,T1!==k)q1=Y*f-D*d,d=Y*d+D*f,f=q1}}}},l.prototype.guessLen13b=function(J,V){var Z=Math.max(V,J)|1,H=Z&1,j=0;for(Z=Z/2|0;Z;Z=Z>>>1)j++;return 1<<j+1+H},l.prototype.conjugate=function(J,V,Z){if(Z<=1)return;for(var H=0;H<Z/2;H++){var j=J[H];J[H]=J[Z-H-1],J[Z-H-1]=j,j=V[H],V[H]=-V[Z-H-1],V[Z-H-1]=-j}},l.prototype.normalize13b=function(J,V){var Z=0;for(var H=0;H<V/2;H++){var j=Math.round(J[2*H+1]/V)*8192+Math.round(J[2*H]/V)+Z;if(J[H]=j&67108863,j<67108864)Z=0;else Z=j/67108864|0}return J},l.prototype.convert13b=function(J,V,Z,H){var j=0;for(var z=0;z<V;z++)j=j+(J[z]|0),Z[2*z]=j&8191,j=j>>>13,Z[2*z+1]=j&8191,j=j>>>13;for(z=2*V;z<H;++z)Z[z]=0;P(j===0),P((j&-8192)===0)},l.prototype.stub=function(J){var V=Array(J);for(var Z=0;Z<J;Z++)V[Z]=0;return V},l.prototype.mulp=function(J,V,Z){var H=2*this.guessLen13b(J.length,V.length),j=this.makeRBT(H),z=this.stub(H),S=Array(H),k=Array(H),Y=Array(H),D=Array(H),b=Array(H),f=Array(H),d=Z.words;d.length=H,this.convert13b(J.words,J.length,S,H),this.convert13b(V.words,V.length,D,H),this.transform(S,z,k,Y,H,j),this.transform(D,z,b,f,H,j);for(var T1=0;T1<H;T1++){var P1=k[T1]*b[T1]-Y[T1]*f[T1];Y[T1]=k[T1]*f[T1]+Y[T1]*b[T1],k[T1]=P1}return this.conjugate(k,Y,H),this.transform(k,Y,d,z,H,j),this.conjugate(d,z,H),this.normalize13b(d,H),Z.negative=J.negative^V.negative,Z.length=J.length+V.length,Z._strip()},C.prototype.mul=function(J){var V=new C(null);return V.words=Array(this.length+J.length),this.mulTo(J,V)},C.prototype.mulf=function(J){var V=new C(null);return V.words=Array(this.length+J.length),v(this,J,V)},C.prototype.imul=function(J){return this.clone().mulTo(J,this)},C.prototype.imuln=function(J){var V=J<0;if(V)J=-J;P(typeof J==="number"),P(J<67108864);var Z=0;for(var H=0;H<this.length;H++){var j=(this.words[H]|0)*J,z=(j&67108863)+(Z&67108863);Z>>=26,Z+=j/67108864|0,Z+=z>>>26,this.words[H]=z&67108863}if(Z!==0)this.words[H]=Z,this.length++;return this.length=J===0?1:this.length,V?this.ineg():this},C.prototype.muln=function(J){return this.clone().imuln(J)},C.prototype.sqr=function(){return this.mul(this)},C.prototype.isqr=function(){return this.imul(this.clone())},C.prototype.pow=function(J){var V=E(J);if(V.length===0)return new C(1);var Z=this;for(var H=0;H<V.length;H++,Z=Z.sqr())if(V[H]!==0)break;if(++H<V.length)for(var j=Z.sqr();H<V.length;H++,j=j.sqr()){if(V[H]===0)continue;Z=Z.mul(j)}return Z},C.prototype.iushln=function(J){P(typeof J==="number"&&J>=0);var V=J%26,Z=(J-V)/26,H=67108863>>>26-V<<26-V,j;if(V!==0){var z=0;for(j=0;j<this.length;j++){var S=this.words[j]&H,k=(this.words[j]|0)-S<<V;this.words[j]=k|z,z=S>>>26-V}if(z)this.words[j]=z,this.length++}if(Z!==0){for(j=this.length-1;j>=0;j--)this.words[j+Z]=this.words[j];for(j=0;j<Z;j++)this.words[j]=0;this.length+=Z}return this._strip()},C.prototype.ishln=function(J){return P(this.negative===0),this.iushln(J)},C.prototype.iushrn=function(J,V,Z){P(typeof J==="number"&&J>=0);var H;if(V)H=(V-V%26)/26;else H=0;var j=J%26,z=Math.min((J-j)/26,this.length),S=67108863^67108863>>>j<<j,k=Z;if(H-=z,H=Math.max(0,H),k){for(var Y=0;Y<z;Y++)k.words[Y]=this.words[Y];k.length=z}if(z===0);else if(this.length>z){this.length-=z;for(Y=0;Y<this.length;Y++)this.words[Y]=this.words[Y+z]}else this.words[0]=0,this.length=1;var D=0;for(Y=this.length-1;Y>=0&&(D!==0||Y>=H);Y--){var b=this.words[Y]|0;this.words[Y]=D<<26-j|b>>>j,D=b&S}if(k&&D!==0)k.words[k.length++]=D;if(this.length===0)this.words[0]=0,this.length=1;return this._strip()},C.prototype.ishrn=function(J,V,Z){return P(this.negative===0),this.iushrn(J,V,Z)},C.prototype.shln=function(J){return this.clone().ishln(J)},C.prototype.ushln=function(J){return this.clone().iushln(J)},C.prototype.shrn=function(J){return this.clone().ishrn(J)},C.prototype.ushrn=function(J){return this.clone().iushrn(J)},C.prototype.testn=function(J){P(typeof J==="number"&&J>=0);var V=J%26,Z=(J-V)/26,H=1<<V;if(this.length<=Z)return!1;var j=this.words[Z];return!!(j&H)},C.prototype.imaskn=function(J){P(typeof J==="number"&&J>=0);var V=J%26,Z=(J-V)/26;if(P(this.negative===0,"imaskn works only with positive numbers"),this.length<=Z)return this;if(V!==0)Z++;if(this.length=Math.min(Z,this.length),V!==0){var H=67108863^67108863>>>V<<V;this.words[this.length-1]&=H}return this._strip()},C.prototype.maskn=function(J){return this.clone().imaskn(J)},C.prototype.iaddn=function(J){if(P(typeof J==="number"),P(J<67108864),J<0)return this.isubn(-J);if(this.negative!==0){if(this.length===1&&(this.words[0]|0)<=J)return this.words[0]=J-(this.words[0]|0),this.negative=0,this;return this.negative=0,this.isubn(J),this.negative=1,this}return this._iaddn(J)},C.prototype._iaddn=function(J){this.words[0]+=J;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(J){if(P(typeof J==="number"),P(J<67108864),J<0)return this.iaddn(-J);if(this.negative!==0)return this.negative=0,this.iaddn(J),this.negative=1,this;if(this.words[0]-=J,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(J){return this.clone().iaddn(J)},C.prototype.subn=function(J){return this.clone().isubn(J)},C.prototype.iabs=function(){return this.negative=0,this},C.prototype.abs=function(){return this.clone().iabs()},C.prototype._ishlnsubmul=function(J,V,Z){var H=J.length+Z,j;this._expand(H);var z,S=0;for(j=0;j<J.length;j++){z=(this.words[j+Z]|0)+S;var k=(J.words[j]|0)*V;z-=k&67108863,S=(z>>26)-(k/67108864|0),this.words[j+Z]=z&67108863}for(;j<this.length-Z;j++)z=(this.words[j+Z]|0)+S,S=z>>26,this.words[j+Z]=z&67108863;if(S===0)return this._strip();P(S===-1),S=0;for(j=0;j<this.length;j++)z=-(this.words[j]|0)+S,S=z>>26,this.words[j]=z&67108863;return this.negative=1,this._strip()},C.prototype._wordDiv=function(J,V){var Z=this.length-J.length,H=this.clone(),j=J,z=j.words[j.length-1]|0,S=this._countBits(z);if(Z=26-S,Z!==0)j=j.ushln(Z),H.iushln(Z),z=j.words[j.length-1]|0;var k=H.length-j.length,Y;if(V!=="mod"){Y=new C(null),Y.length=k+1,Y.words=Array(Y.length);for(var D=0;D<Y.length;D++)Y.words[D]=0}var b=H.clone()._ishlnsubmul(j,1,k);if(b.negative===0){if(H=b,Y)Y.words[k]=1}for(var f=k-1;f>=0;f--){var d=(H.words[j.length+f]|0)*67108864+(H.words[j.length+f-1]|0);d=Math.min(d/z|0,67108863),H._ishlnsubmul(j,d,f);while(H.negative!==0)if(d--,H.negative=0,H._ishlnsubmul(j,1,f),!H.isZero())H.negative^=1;if(Y)Y.words[f]=d}if(Y)Y._strip();if(H._strip(),V!=="div"&&Z!==0)H.iushrn(Z);return{div:Y||null,mod:H}},C.prototype.divmod=function(J,V,Z){if(P(!J.isZero()),this.isZero())return{div:new C(0),mod:new C(0)};var H,j,z;if(this.negative!==0&&J.negative===0){if(z=this.neg().divmod(J,V),V!=="mod")H=z.div.neg();if(V!=="div"){if(j=z.mod.neg(),Z&&j.negative!==0)j.iadd(J)}return{div:H,mod:j}}if(this.negative===0&&J.negative!==0){if(z=this.divmod(J.neg(),V),V!=="mod")H=z.div.neg();return{div:H,mod:z.mod}}if((this.negative&J.negative)!==0){if(z=this.neg().divmod(J.neg(),V),V!=="div"){if(j=z.mod.neg(),Z&&j.negative!==0)j.isub(J)}return{div:z.div,mod:j}}if(J.length>this.length||this.cmp(J)<0)return{div:new C(0),mod:this};if(J.length===1){if(V==="div")return{div:this.divn(J.words[0]),mod:null};if(V==="mod")return{div:null,mod:new C(this.modrn(J.words[0]))};return{div:this.divn(J.words[0]),mod:new C(this.modrn(J.words[0]))}}return this._wordDiv(J,V)},C.prototype.div=function(J){return this.divmod(J,"div",!1).div},C.prototype.mod=function(J){return this.divmod(J,"mod",!1).mod},C.prototype.umod=function(J){return this.divmod(J,"mod",!0).mod},C.prototype.divRound=function(J){var V=this.divmod(J);if(V.mod.isZero())return V.div;var Z=V.div.negative!==0?V.mod.isub(J):V.mod,H=J.ushrn(1),j=J.andln(1),z=Z.cmp(H);if(z<0||j===1&&z===0)return V.div;return V.div.negative!==0?V.div.isubn(1):V.div.iaddn(1)},C.prototype.modrn=function(J){var V=J<0;if(V)J=-J;P(J<=67108863);var Z=67108864%J,H=0;for(var j=this.length-1;j>=0;j--)H=(Z*H+(this.words[j]|0))%J;return V?-H:H},C.prototype.modn=function(J){return this.modrn(J)},C.prototype.idivn=function(J){var V=J<0;if(V)J=-J;P(J<=67108863);var Z=0;for(var H=this.length-1;H>=0;H--){var j=(this.words[H]|0)+Z*67108864;this.words[H]=j/J|0,Z=j%J}return this._strip(),V?this.ineg():this},C.prototype.divn=function(J){return this.clone().idivn(J)},C.prototype.egcd=function(J){P(J.negative===0),P(!J.isZero());var V=this,Z=J.clone();if(V.negative!==0)V=V.umod(J);else V=V.clone();var H=new C(1),j=new C(0),z=new C(0),S=new C(1),k=0;while(V.isEven()&&Z.isEven())V.iushrn(1),Z.iushrn(1),++k;var Y=Z.clone(),D=V.clone();while(!V.isZero()){for(var b=0,f=1;(V.words[0]&f)===0&&b<26;++b,f<<=1);if(b>0){V.iushrn(b);while(b-- >0){if(H.isOdd()||j.isOdd())H.iadd(Y),j.isub(D);H.iushrn(1),j.iushrn(1)}}for(var d=0,T1=1;(Z.words[0]&T1)===0&&d<26;++d,T1<<=1);if(d>0){Z.iushrn(d);while(d-- >0){if(z.isOdd()||S.isOdd())z.iadd(Y),S.isub(D);z.iushrn(1),S.iushrn(1)}}if(V.cmp(Z)>=0)V.isub(Z),H.isub(z),j.isub(S);else Z.isub(V),z.isub(H),S.isub(j)}return{a:z,b:S,gcd:Z.iushln(k)}},C.prototype._invmp=function(J){P(J.negative===0),P(!J.isZero());var V=this,Z=J.clone();if(V.negative!==0)V=V.umod(J);else V=V.clone();var H=new C(1),j=new C(0),z=Z.clone();while(V.cmpn(1)>0&&Z.cmpn(1)>0){for(var S=0,k=1;(V.words[0]&k)===0&&S<26;++S,k<<=1);if(S>0){V.iushrn(S);while(S-- >0){if(H.isOdd())H.iadd(z);H.iushrn(1)}}for(var Y=0,D=1;(Z.words[0]&D)===0&&Y<26;++Y,D<<=1);if(Y>0){Z.iushrn(Y);while(Y-- >0){if(j.isOdd())j.iadd(z);j.iushrn(1)}}if(V.cmp(Z)>=0)V.isub(Z),H.isub(j);else Z.isub(V),j.isub(H)}var b;if(V.cmpn(1)===0)b=H;else b=j;if(b.cmpn(0)<0)b.iadd(J);return b},C.prototype.gcd=function(J){if(this.isZero())return J.abs();if(J.isZero())return this.abs();var V=this.clone(),Z=J.clone();V.negative=0,Z.negative=0;for(var H=0;V.isEven()&&Z.isEven();H++)V.iushrn(1),Z.iushrn(1);do{while(V.isEven())V.iushrn(1);while(Z.isEven())Z.iushrn(1);var j=V.cmp(Z);if(j<0){var z=V;V=Z,Z=z}else if(j===0||Z.cmpn(1)===0)break;V.isub(Z)}while(!0);return Z.iushln(H)},C.prototype.invm=function(J){return this.egcd(J).a.umod(J)},C.prototype.isEven=function(){return(this.words[0]&1)===0},C.prototype.isOdd=function(){return(this.words[0]&1)===1},C.prototype.andln=function(J){return this.words[0]&J},C.prototype.bincn=function(J){P(typeof J==="number");var V=J%26,Z=(J-V)/26,H=1<<V;if(this.length<=Z)return this._expand(Z+1),this.words[Z]|=H,this;var j=H;for(var z=Z;j!==0&&z<this.length;z++){var S=this.words[z]|0;S+=j,j=S>>>26,S&=67108863,this.words[z]=S}if(j!==0)this.words[z]=j,this.length++;return this},C.prototype.isZero=function(){return this.length===1&&this.words[0]===0},C.prototype.cmpn=function(J){var V=J<0;if(this.negative!==0&&!V)return-1;if(this.negative===0&&V)return 1;this._strip();var Z;if(this.length>1)Z=1;else{if(V)J=-J;P(J<=67108863,"Number is too big");var H=this.words[0]|0;Z=H===J?0:H<J?-1:1}if(this.negative!==0)return-Z|0;return Z},C.prototype.cmp=function(J){if(this.negative!==0&&J.negative===0)return-1;if(this.negative===0&&J.negative!==0)return 1;var V=this.ucmp(J);if(this.negative!==0)return-V|0;return V},C.prototype.ucmp=function(J){if(this.length>J.length)return 1;if(this.length<J.length)return-1;var V=0;for(var Z=this.length-1;Z>=0;Z--){var H=this.words[Z]|0,j=J.words[Z]|0;if(H===j)continue;if(H<j)V=-1;else if(H>j)V=1;break}return V},C.prototype.gtn=function(J){return this.cmpn(J)===1},C.prototype.gt=function(J){return this.cmp(J)===1},C.prototype.gten=function(J){return this.cmpn(J)>=0},C.prototype.gte=function(J){return this.cmp(J)>=0},C.prototype.ltn=function(J){return this.cmpn(J)===-1},C.prototype.lt=function(J){return this.cmp(J)===-1},C.prototype.lten=function(J){return this.cmpn(J)<=0},C.prototype.lte=function(J){return this.cmp(J)<=0},C.prototype.eqn=function(J){return this.cmpn(J)===0},C.prototype.eq=function(J){return this.cmp(J)===0},C.red=function(J){return new n(J)},C.prototype.toRed=function(J){return P(!this.red,"Already a number in reduction context"),P(this.negative===0,"red works only with positives"),J.convertTo(this)._forceRed(J)},C.prototype.fromRed=function(){return P(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},C.prototype._forceRed=function(J){return this.red=J,this},C.prototype.forceRed=function(J){return P(!this.red,"Already a number in reduction context"),this._forceRed(J)},C.prototype.redAdd=function(J){return P(this.red,"redAdd works only with red numbers"),this.red.add(this,J)},C.prototype.redIAdd=function(J){return P(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,J)},C.prototype.redSub=function(J){return P(this.red,"redSub works only with red numbers"),this.red.sub(this,J)},C.prototype.redISub=function(J){return P(this.red,"redISub works only with red numbers"),this.red.isub(this,J)},C.prototype.redShl=function(J){return P(this.red,"redShl works only with red numbers"),this.red.shl(this,J)},C.prototype.redMul=function(J){return P(this.red,"redMul works only with red numbers"),this.red._verify2(this,J),this.red.mul(this,J)},C.prototype.redIMul=function(J){return P(this.red,"redMul works only with red numbers"),this.red._verify2(this,J),this.red.imul(this,J)},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(J){return P(this.red&&!J.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,J)};var r={k256:null,p224:null,p192:null,p25519:null};function c(R,J){this.name=R,this.p=new C(J,16),this.n=this.p.bitLength(),this.k=new C(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}c.prototype._tmp=function(){var J=new C(null);return J.words=Array(Math.ceil(this.n/13)),J},c.prototype.ireduce=function(J){var V=J,Z;do this.split(V,this.tmp),V=this.imulK(V),V=V.iadd(this.tmp),Z=V.bitLength();while(Z>this.n);var H=Z<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},c.prototype.split=function(J,V){J.iushrn(this.n,0,V)},c.prototype.imulK=function(J){return J.imul(this.k)};function o(){c.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}Q(o,c),o.prototype.split=function(J,V){var Z=4194303,H=Math.min(J.length,9);for(var j=0;j<H;j++)V.words[j]=J.words[j];if(V.length=H,J.length<=9){J.words[0]=0,J.length=1;return}var z=J.words[9];V.words[V.length++]=z&Z;for(j=10;j<J.length;j++){var S=J.words[j]|0;J.words[j-10]=(S&Z)<<4|z>>>22,z=S}if(z>>>=22,J.words[j-10]=z,z===0&&J.length>10)J.length-=10;else J.length-=9},o.prototype.imulK=function(J){J.words[J.length]=0,J.words[J.length+1]=0,J.length+=2;var V=0;for(var Z=0;Z<J.length;Z++){var H=J.words[Z]|0;V+=H*977,J.words[Z]=V&67108863,V=H*64+(V/67108864|0)}if(J.words[J.length-1]===0){if(J.length--,J.words[J.length-1]===0)J.length--}return J};function u(){c.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}Q(u,c);function h(){c.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}Q(h,c);function a(){c.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}Q(a,c),a.prototype.imulK=function(J){var V=0;for(var Z=0;Z<J.length;Z++){var H=(J.words[Z]|0)*19+V,j=H&67108863;H>>>=26,J.words[Z]=j,V=H}if(V!==0)J.words[J.length++]=V;return J},C._prime=function(J){if(r[J])return r[J];var V;if(J==="k256")V=new o;else if(J==="p224")V=new u;else if(J==="p192")V=new h;else if(J==="p25519")V=new a;else throw Error("Unknown prime "+J);return r[J]=V,V};function n(R){if(typeof R==="string"){var J=C._prime(R);this.m=J.p,this.prime=J}else P(R.gtn(1),"modulus must be greater than 1"),this.m=R,this.prime=null}n.prototype._verify1=function(J){P(J.negative===0,"red works only with positives"),P(J.red,"red works only with red numbers")},n.prototype._verify2=function(J,V){P((J.negative|V.negative)===0,"red works only with positives"),P(J.red&&J.red===V.red,"red works only with red numbers")},n.prototype.imod=function(J){if(this.prime)return this.prime.ireduce(J)._forceRed(this);return q(J,J.umod(this.m)._forceRed(this)),J},n.prototype.neg=function(J){if(J.isZero())return J.clone();return this.m.sub(J)._forceRed(this)},n.prototype.add=function(J,V){this._verify2(J,V);var Z=J.add(V);if(Z.cmp(this.m)>=0)Z.isub(this.m);return Z._forceRed(this)},n.prototype.iadd=function(J,V){this._verify2(J,V);var Z=J.iadd(V);if(Z.cmp(this.m)>=0)Z.isub(this.m);return Z},n.prototype.sub=function(J,V){this._verify2(J,V);var Z=J.sub(V);if(Z.cmpn(0)<0)Z.iadd(this.m);return Z._forceRed(this)},n.prototype.isub=function(J,V){this._verify2(J,V);var Z=J.isub(V);if(Z.cmpn(0)<0)Z.iadd(this.m);return Z},n.prototype.shl=function(J,V){return this._verify1(J),this.imod(J.ushln(V))},n.prototype.imul=function(J,V){return this._verify2(J,V),this.imod(J.imul(V))},n.prototype.mul=function(J,V){return this._verify2(J,V),this.imod(J.mul(V))},n.prototype.isqr=function(J){return this.imul(J,J.clone())},n.prototype.sqr=function(J){return this.mul(J,J)},n.prototype.sqrt=function(J){if(J.isZero())return J.clone();var V=this.m.andln(3);if(P(V%2===1),V===3){var Z=this.m.add(new C(1)).iushrn(2);return this.pow(J,Z)}var H=this.m.subn(1),j=0;while(!H.isZero()&&H.andln(1)===0)j++,H.iushrn(1);P(!H.isZero());var z=new C(1).toRed(this),S=z.redNeg(),k=this.m.subn(1).iushrn(1),Y=this.m.bitLength();Y=new C(2*Y*Y).toRed(this);while(this.pow(Y,k).cmp(S)!==0)Y.redIAdd(S);var D=this.pow(Y,H),b=this.pow(J,H.addn(1).iushrn(1)),f=this.pow(J,H),d=j;while(f.cmp(z)!==0){var T1=f;for(var P1=0;T1.cmp(z)!==0;P1++)T1=T1.redSqr();P(P1<d);var Q1=this.pow(D,new C(1).iushln(d-P1-1));b=b.redMul(Q1),D=Q1.redSqr(),f=f.redMul(D),d=P1}return b},n.prototype.invm=function(J){var V=J._invmp(this.m);if(V.negative!==0)return V.negative=0,this.imod(V).redNeg();else return this.imod(V)},n.prototype.pow=function(J,V){if(V.isZero())return new C(1).toRed(this);if(V.cmpn(1)===0)return J.clone();var Z=4,H=Array(1<<Z);H[0]=new C(1).toRed(this),H[1]=J;for(var j=2;j<H.length;j++)H[j]=this.mul(H[j-1],J);var z=H[0],S=0,k=0,Y=V.bitLength()%26;if(Y===0)Y=26;for(j=V.length-1;j>=0;j--){var D=V.words[j];for(var b=Y-1;b>=0;b--){var f=D>>b&1;if(z!==H[0])z=this.sqr(z);if(f===0&&S===0){k=0;continue}if(S<<=1,S|=f,k++,k!==Z&&(j!==0||b!==0))continue;z=this.mul(z,H[S]),k=0,S=0}Y=26}return z},n.prototype.convertTo=function(J){var V=J.umod(this.m);return V===J?V.clone():V},n.prototype.convertFrom=function(J){var V=J.clone();return V.red=null,V},C.mont=function(J){return new x(J)};function x(R){if(n.call(this,R),this.shift=this.m.bitLength(),this.shift%26!==0)this.shift+=26-this.shift%26;this.r=new 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,n),x.prototype.convertTo=function(J){return this.imod(J.ushln(this.shift))},x.prototype.convertFrom=function(J){var V=this.imod(J.mul(this.rinv));return V.red=null,V},x.prototype.imul=function(J,V){if(J.isZero()||V.isZero())return J.words[0]=0,J.length=1,J;var Z=J.imul(V),H=Z.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),j=Z.isub(H).iushrn(this.shift),z=j;if(j.cmp(this.m)>=0)z=j.isub(this.m);else if(j.cmpn(0)<0)z=j.iadd(this.m);return z._forceRed(this)},x.prototype.mul=function(J,V){if(J.isZero()||V.isZero())return new C(0)._forceRed(this);var Z=J.mul(V),H=Z.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),j=Z.isub(H).iushrn(this.shift),z=j;if(j.cmp(this.m)>=0)z=j.isub(this.m);else if(j.cmpn(0)<0)z=j.iadd(this.m);return z._forceRed(this)},x.prototype.invm=function(J){var V=this.imod(J._invmp(this.m).mul(this.r2));return V._forceRed(this)}})(typeof KC>"u"||KC,k9)});var M9=U0((RC,D9)=>{/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var Q4=(w8(),K8(c6)),m0=Q4.Buffer;function F9(T,A){for(var P in T)A[P]=T[P]}if(m0.from&&m0.alloc&&m0.allocUnsafe&&m0.allocUnsafeSlow)D9.exports=Q4;else F9(Q4,RC),RC.Buffer=W8;function W8(T,A,P){return m0(T,A,P)}W8.prototype=Object.create(m0.prototype);F9(m0,W8);W8.from=function(T,A,P){if(typeof T==="number")throw TypeError("Argument must not be a number");return m0(T,A,P)};W8.alloc=function(T,A,P){if(typeof T!=="number")throw TypeError("Argument must be a number");var Q=m0(T);if(A!==void 0)if(typeof P==="string")Q.fill(A,P);else Q.fill(A);else Q.fill(0);return Q};W8.allocUnsafe=function(T){if(typeof T!=="number")throw TypeError("Argument must be a number");return m0(T)};W8.allocUnsafeSlow=function(T){if(typeof T!=="number")throw TypeError("Argument must be a number");return Q4.SlowBuffer(T)}});var I9=U0((Gx,z9)=>{var C4=M9().Buffer;function Sk(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,U=T.charAt(0),$=Math.log(G)/Math.log(256),q=Math.log(256)/Math.log(G);function X(M){if(Array.isArray(M)||M instanceof Uint8Array)M=C4.from(M);if(!C4.isBuffer(M))throw TypeError("Expected Buffer");if(M.length===0)return"";var I=0,E=0,L=0,O=M.length;while(L!==O&&M[L]===0)L++,I++;var m=(O-L)*q+1>>>0,v=new Uint8Array(m);while(L!==O){var l=M[L],r=0;for(var c=m-1;(l!==0||r<E)&&c!==-1;c--,r++)l+=256*v[c]>>>0,v[c]=l%G>>>0,l=l/G>>>0;if(l!==0)throw Error("Non-zero carry");E=r,L++}var o=m-E;while(o!==m&&v[o]===0)o++;var u=U.repeat(I);for(;o<m;++o)u+=T.charAt(v[o]);return u}function K(M){if(typeof M!=="string")throw TypeError("Expected String");if(M.length===0)return C4.alloc(0);var I=0,E=0,L=0;while(M[I]===U)E++,I++;var O=(M.length-I)*$+1>>>0,m=new Uint8Array(O);while(I<M.length){var v=M.charCodeAt(I);if(v>255)return;var l=A[v];if(l===255)return;var r=0;for(var c=O-1;(l!==0||r<L)&&c!==-1;c--,r++)l+=G*m[c]>>>0,m[c]=l%256>>>0,l=l/256>>>0;if(l!==0)throw Error("Non-zero carry");L=r,I++}var o=O-L;while(o!==O&&m[o]===0)o++;var u=C4.allocUnsafe(E+(O-o));u.fill(0,0,E);var h=E;while(o!==O)u[h++]=m[o++];return u}function F(M){var I=K(M);if(I)return I;throw Error("Non-base"+G+" character")}return{encode:X,decodeUnsafe:K,decode:F}}z9.exports=Sk});var kC=U0((Jx,S9)=>{var Nk=I9(),Lk="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";S9.exports=Nk(Lk)});var N9={};qP(N9,{TextEncoder:()=>U4,TextDecoder:()=>J4});function CA(T,A,P){return A<=T&&T<=P}function $4(T){if(T===void 0)return{};if(T===Object(T))return T;throw TypeError("Could not convert argument to dictionary")}function wk(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 U=W&1023,$=G&1023;C.push(65536+(U<<10)+$),Q+=1}else C.push(65533)}Q+=1}return C}function Ek(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 MC(T){this.tokens=[].slice.call(T)}function DC(T,A){if(T)throw TypeError("Decoder error");return A||65533}function Bk(){}function Ok(){}function J4(T,A){if(!(this instanceof J4))return new J4(T,A);if(T=T!==void 0?String(T).toLowerCase():G4,T!==G4)throw Error("Encoding not supported. Only utf-8 is supported");A=$4(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 U4(T,A){if(!(this instanceof U4))return new U4(T,A);if(T=T!==void 0?String(T).toLowerCase():G4,T!==G4)throw Error("Encoding not supported. Only utf-8 is supported");A=$4(A),this._streaming=!1,this._encoder=null,this._options={fatal:Boolean(A.fatal)},Object.defineProperty(this,"encoding",{value:"utf-8"})}function xk(T){var A=T.fatal,P=0,Q=0,C=0,W=128,G=191;this.handler=function(U,$){if($===W4&&C!==0)return C=0,DC(A);if($===W4)return g8;if(C===0){if(CA($,0,127))return $;if(CA($,194,223))C=1,P=$-192;else if(CA($,224,239)){if($===224)W=160;if($===237)G=159;C=2,P=$-224}else if(CA($,240,244)){if($===240)W=144;if($===244)G=143;C=3,P=$-240}else return DC(A);return P=P<<6*C,null}if(!CA($,W,G))return P=C=Q=0,W=128,G=191,U.prepend($),DC(A);if(W=128,G=191,Q+=1,P+=$-128<<6*(C-Q),Q!==C)return null;var q=P;return P=C=Q=0,q}}function _k(T){var A=T.fatal;this.handler=function(P,Q){if(Q===W4)return g8;if(CA(Q,0,127))return Q;var C,W;if(CA(Q,128,2047))C=1,W=192;else if(CA(Q,2048,65535))C=2,W=224;else if(CA(Q,65536,1114111))C=3,W=240;var G=[(Q>>6*C)+W];while(C>0){var U=Q>>6*(C-1);G.push(128|U&63),C-=1}return G}}var W4=-1,g8=-1,G4="utf-8";var L9=OT(()=>{MC.prototype={endOfStream:function(){return!this.tokens.length},read:function(){if(!this.tokens.length)return W4;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)}};Bk.prototype={handler:function(T,A){}};Ok.prototype={handler:function(T,A){}};J4.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=$4(P),!this._streaming)this._decoder=new xk({fatal:this._fatal}),this._BOMseen=!1;this._streaming=Boolean(P.stream);var C=new MC(Q),W=[],G;while(!C.endOfStream()){if(G=this._decoder.handler(C,C.read()),G===g8)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===g8)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 Ek(W)}};U4.prototype={encode:function(A,P){if(A=A?String(A):"",P=$4(P),!this._streaming)this._encoder=new _k(this._options);this._streaming=Boolean(P.stream);var Q=[],C=new MC(wk(A)),W;while(!C.endOfStream()){if(W=this._encoder.handler(C,C.read()),W===g8)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===g8)break;if(Array.isArray(W))Q.push.apply(Q,W);else Q.push(W)}this._encoder=null}return new Uint8Array(Q)}}});var x9=U0((Z1)=>{var hk=Z1&&Z1.__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]}),gk=Z1&&Z1.__setModuleDefault||(Object.create?function(T,A){Object.defineProperty(T,"default",{enumerable:!0,value:A})}:function(T,A){T.default=A}),v0=Z1&&Z1.__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 U=T.length-1;U>=0;U--)if(G=T[U])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},mk=Z1&&Z1.__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))hk(A,T,P)}return gk(A,T),A},w9=Z1&&Z1.__importDefault||function(T){return T&&T.__esModule?T:{default:T}};Object.defineProperty(Z1,"__esModule",{value:!0});Z1.deserializeUnchecked=Z1.deserialize=Z1.serialize=Z1.BinaryReader=Z1.BinaryWriter=Z1.BorshError=Z1.baseDecode=Z1.baseEncode=void 0;var xA=w9(jC()),E9=w9(kC()),vk=mk((L9(),K8(N9))),yk=typeof TextDecoder!=="function"?vk.TextDecoder:TextDecoder,bk=new yk("utf-8",{fatal:!0});function lk(T){if(typeof T==="string")T=Buffer.from(T,"utf8");return E9.default.encode(Buffer.from(T))}Z1.baseEncode=lk;function pk(T){return Buffer.from(E9.default.decode(T))}Z1.baseDecode=pk;var zC=1024;class _T 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(".")}}Z1.BorshError=_T;class IC{constructor(){this.buf=Buffer.alloc(zC),this.length=0}maybeResize(){if(this.buf.length<16+this.length)this.buf=Buffer.concat([this.buf,Buffer.alloc(zC)])}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 xA.default(T).toArray("le",8)))}writeU128(T){this.maybeResize(),this.writeBuffer(Buffer.from(new xA.default(T).toArray("le",16)))}writeU256(T){this.maybeResize(),this.writeBuffer(Buffer.from(new xA.default(T).toArray("le",32)))}writeU512(T){this.maybeResize(),this.writeBuffer(Buffer.from(new xA.default(T).toArray("le",64)))}writeBuffer(T){this.buf=Buffer.concat([Buffer.from(this.buf.subarray(0,this.length)),T,Buffer.alloc(zC)]),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)}}Z1.BinaryWriter=IC;function y0(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 _T("Reached the end of buffer when deserializing")}throw W}}}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 xA.default(T,"le")}readU128(){let T=this.readBuffer(16);return new xA.default(T,"le")}readU256(){let T=this.readBuffer(32);return new xA.default(T,"le")}readU512(){let T=this.readBuffer(64);return new xA.default(T,"le")}readBuffer(T){if(this.offset+T>this.buf.length)throw new _T(`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 bk.decode(A)}catch(P){throw new _T(`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}}v0([y0],T0.prototype,"readU8",null);v0([y0],T0.prototype,"readU16",null);v0([y0],T0.prototype,"readU32",null);v0([y0],T0.prototype,"readU64",null);v0([y0],T0.prototype,"readU128",null);v0([y0],T0.prototype,"readU256",null);v0([y0],T0.prototype,"readU512",null);v0([y0],T0.prototype,"readString",null);v0([y0],T0.prototype,"readFixedArray",null);v0([y0],T0.prototype,"readArray",null);Z1.BinaryReader=T0;function B9(T){return T.charAt(0).toUpperCase()+T.slice(1)}function G8(T,A,P,Q,C){try{if(typeof Q==="string")C[`write${B9(Q)}`](P);else if(Q instanceof Array)if(typeof Q[0]==="number"){if(P.length!==Q[0])throw new _T(`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 _T(`Expecting byte array of length ${Q[1]}, but got ${P.length} bytes`);for(let W=0;W<Q[1];W++)G8(T,null,P[W],Q[0],C)}else C.writeArray(P,(W)=>{G8(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),G8(T,A,P,Q.type,C);break}case"map":{C.writeU32(P.size),P.forEach((W,G)=>{G8(T,A,G,Q.key,C),G8(T,A,W,Q.value,C)});break}default:throw new _T(`FieldType ${Q} unrecognized`)}else O9(T,P,C)}catch(W){if(W instanceof _T)W.addToFieldPath(A);throw W}}function O9(T,A,P){if(typeof A.borshSerialize==="function"){A.borshSerialize(P);return}let Q=T.get(A.constructor);if(!Q)throw new _T(`Class ${A.constructor.name} is missing in schema`);if(Q.kind==="struct")Q.fields.map(([C,W])=>{G8(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,U]=Q.values[W];if(G===C){P.writeU8(W),G8(T,G,A[G],U,P);break}}}else throw new _T(`Unexpected schema kind: ${Q.kind} for ${A.constructor.name}`)}function uk(T,A,P=IC){let Q=new P;return O9(T,A,Q),Q.toArray()}Z1.serialize=uk;function J8(T,A,P,Q){try{if(typeof P==="string")return Q[`read${B9(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(J8(T,null,P[0],Q));return C}else return Q.readArray(()=>J8(T,A,P[0],Q));if(P.kind==="option"){if(Q.readU8())return J8(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 U=J8(T,A,P.key,Q),$=J8(T,A,P.value,Q);C.set(U,$)}return C}return SC(T,P,Q)}catch(C){if(C instanceof _T)C.addToFieldPath(A);throw C}}function SC(T,A,P){if(typeof A.borshDeserialize==="function")return A.borshDeserialize(P);let Q=T.get(A);if(!Q)throw new _T(`Class ${A.name} is missing in schema`);if(Q.kind==="struct"){let C={};for(let[W,G]of T.get(A).fields)C[W]=J8(T,W,G,P);return new A(C)}if(Q.kind==="enum"){let C=P.readU8();if(C>=Q.values.length)throw new _T(`Enum index: ${C} is out of range`);let[W,G]=Q.values[C],U=J8(T,W,G,P);return new A({[W]:U})}throw new _T(`Unexpected schema kind: ${Q.kind} for ${A.constructor.name}`)}function dk(T,A,P,Q=T0){let C=new Q(P),W=SC(T,A,C);if(C.offset<P.length)throw new _T(`Unexpected ${P.length-C.offset} bytes after deserialized data`);return W}Z1.deserialize=dk;function rk(T,A,P,Q=T0){let C=new Q(P);return SC(T,A,C)}Z1.deserializeUnchecked=rk});var WA=U0((_9)=>{Object.defineProperty(_9,"__esModule",{value:!0});_9.s16=_9.s8=_9.nu64be=_9.u48be=_9.u40be=_9.u32be=_9.u24be=_9.u16be=_9.nu64=_9.u48=_9.u40=_9.u32=_9.u24=_9.u16=_9.u8=_9.offset=_9.greedy=_9.Constant=_9.UTF8=_9.CString=_9.Blob=_9.Boolean=_9.BitField=_9.BitStructure=_9.VariantLayout=_9.Union=_9.UnionLayoutDiscriminator=_9.UnionDiscriminator=_9.Structure=_9.Sequence=_9.DoubleBE=_9.Double=_9.FloatBE=_9.Float=_9.NearInt64BE=_9.NearInt64=_9.NearUInt64BE=_9.NearUInt64=_9.IntBE=_9.Int=_9.UIntBE=_9.UInt=_9.OffsetLayout=_9.GreedyCount=_9.ExternalLayout=_9.bindConstructorLayout=_9.nameWithProperty=_9.Layout=_9.uint8ArrayToBuffer=_9.checkUint8Array=void 0;_9.constant=_9.utf8=_9.cstr=_9.blob=_9.unionLayoutDiscriminator=_9.union=_9.seq=_9.bits=_9.struct=_9.f64be=_9.f64=_9.f32be=_9.f32=_9.ns64be=_9.s48be=_9.s40be=_9.s32be=_9.s24be=_9.s16be=_9.ns64=_9.s48=_9.s40=_9.s32=_9.s24=void 0;var LC=(w8(),K8(c6));function v8(T){if(!(T instanceof Uint8Array))throw TypeError("b must be a Uint8Array")}_9.checkUint8Array=v8;function G1(T){return v8(T),LC.Buffer.from(T.buffer,T.byteOffset,T.length)}_9.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}}_9.Layout=V1;function wC(T,A){if(A.property)return T+"["+A.property+"]";return T}_9.nameWithProperty=wC;function ck(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})}_9.bindConstructorLayout=ck;class oT extends V1{isCount(){throw Error("ExternalLayout is abstract")}}_9.ExternalLayout=oT;class EC extends oT{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){v8(T);let P=T.length-A;return Math.floor(P/this.elementSpan)}encode(T,A,P){return 0}}_9.GreedyCount=EC;class V4 extends oT{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 J0||this.layout instanceof H0}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)}}_9.OffsetLayout=V4;class J0 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}}_9.UInt=J0;class H0 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}}_9.UIntBE=H0;class _A 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}}_9.Int=_A;class U8 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}}_9.IntBE=U8;var NC=Math.pow(2,32);function Y4(T){let A=Math.floor(T/NC),P=T-A*NC;return{hi32:A,lo32:P}}function Z4(T,A){return T*NC+A}class BC 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 Z4(C,Q)}encode(T,A,P=0){let Q=Y4(T),C=G1(A);return C.writeUInt32LE(Q.lo32,P),C.writeUInt32LE(Q.hi32,P+4),8}}_9.NearUInt64=BC;class OC 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 Z4(Q,C)}encode(T,A,P=0){let Q=Y4(T),C=G1(A);return C.writeUInt32BE(Q.hi32,P),C.writeUInt32BE(Q.lo32,P+4),8}}_9.NearUInt64BE=OC;class xC 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 Z4(C,Q)}encode(T,A,P=0){let Q=Y4(T),C=G1(A);return C.writeUInt32LE(Q.lo32,P),C.writeInt32LE(Q.hi32,P+4),8}}_9.NearInt64=xC;class _C 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 Z4(Q,C)}encode(T,A,P=0){let Q=Y4(T),C=G1(A);return C.writeInt32BE(Q.hi32,P),C.writeUInt32BE(Q.lo32,P+4),8}}_9.NearInt64BE=_C;class hC 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}}_9.Float=hC;class gC 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}}_9.FloatBE=gC;class mC 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}}_9.Double=mC;class vC 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}}_9.DoubleBE=vC;class yC extends V1{constructor(T,A,P){if(!(T instanceof V1))throw TypeError("elementLayout must be a Layout");if(!(A instanceof oT&&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 oT)&&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 oT)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 oT)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 oT)this.count.encode(T.length,A,P);return C}}_9.Sequence=yC;class bC 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){v8(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 U=G.span;if(W=0<U?U:0,G.property!==void 0){let $=T[G.property];if($!==void 0){if(W=G.encode($,A,P),0>U)U=G.getSpan(A,P)}}C=P,P+=U}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}}_9.Structure=bC;class q4{constructor(T){this.property=T}decode(T,A){throw Error("UnionDiscriminator is abstract")}encode(T,A,P){throw Error("UnionDiscriminator is abstract")}}_9.UnionDiscriminator=q4;class L2 extends q4{constructor(T,A){if(!(T instanceof oT&&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)}}_9.UnionLayoutDiscriminator=L2;class X4 extends V1{constructor(T,A,P){let Q;if(T instanceof J0||T instanceof H0)Q=new L2(new V4(T));else if(T instanceof oT&&T.isCount())Q=new L2(T);else if(!(T instanceof q4))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 J0||T instanceof H0))C+=Q.layout.span}super(C,P);this.discriminator=Q,this.usesPrefixDiscriminator=T instanceof J0||T instanceof H0,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,U=0;if(this.usesPrefixDiscriminator)U=Q.layout.span;P=this.makeDestinationObject(),P[Q.property]=C,P[G.property]=G.decode(T,A+U)}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]}}_9.Union=X4;class lC extends V1{constructor(T,A,P,Q){if(!(T instanceof X4))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}}_9.VariantLayout=lC;function m8(T){if(0>T)T+=4294967296;return T}class H4 extends V1{constructor(T,A,P){if(!(T instanceof J0||T instanceof H0))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=m8(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 K4(this,T,A);return this.fields.push(P),P}addBoolean(T){let A=new pC(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}}_9.BitStructure=H4;class K4{constructor(T,A,P){if(!(T instanceof H4))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=m8(this.valueMask<<this.start),this.property=P}decode(T,A){let P=this.container._packedGetValue();return m8(P&this.wordMask)>>>this.start}encode(T){if(typeof T!=="number"||!Number.isInteger(T)||T!==m8(T&this.valueMask))throw TypeError(wC("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);let A=this.container._packedGetValue(),P=m8(T<<this.start);this.container._packedSetValue(m8(A&~this.wordMask)|P)}}_9.BitField=K4;class pC extends K4{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)}}_9.Boolean=pC;class uC extends V1{constructor(T,A){if(!(T instanceof oT&&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 oT))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 oT)Q=T.length;if(!(T instanceof Uint8Array&&Q===T.length))throw TypeError(wC("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 oT)this.length.encode(Q,A,P);return Q}}_9.Blob=uC;class dC extends V1{constructor(T){super(-1,T)}getSpan(T,A=0){v8(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=LC.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}}_9.CString=dC;class rC 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 v8(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=LC.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}}_9.UTF8=rC;class cC extends V1{constructor(T,A){super(0,A);this.value=T}decode(T,A){return this.value}encode(T,A,P){return 0}}_9.Constant=cC;_9.greedy=(T,A)=>new EC(T,A);_9.offset=(T,A,P)=>new V4(T,A,P);_9.u8=(T)=>new J0(1,T);_9.u16=(T)=>new J0(2,T);_9.u24=(T)=>new J0(3,T);_9.u32=(T)=>new J0(4,T);_9.u40=(T)=>new J0(5,T);_9.u48=(T)=>new J0(6,T);_9.nu64=(T)=>new BC(T);_9.u16be=(T)=>new H0(2,T);_9.u24be=(T)=>new H0(3,T);_9.u32be=(T)=>new H0(4,T);_9.u40be=(T)=>new H0(5,T);_9.u48be=(T)=>new H0(6,T);_9.nu64be=(T)=>new OC(T);_9.s8=(T)=>new _A(1,T);_9.s16=(T)=>new _A(2,T);_9.s24=(T)=>new _A(3,T);_9.s32=(T)=>new _A(4,T);_9.s40=(T)=>new _A(5,T);_9.s48=(T)=>new _A(6,T);_9.ns64=(T)=>new xC(T);_9.s16be=(T)=>new U8(2,T);_9.s24be=(T)=>new U8(3,T);_9.s32be=(T)=>new U8(4,T);_9.s40be=(T)=>new U8(5,T);_9.s48be=(T)=>new U8(6,T);_9.ns64be=(T)=>new _C(T);_9.f32=(T)=>new hC(T);_9.f32be=(T)=>new gC(T);_9.f64=(T)=>new mC(T);_9.f64be=(T)=>new vC(T);_9.struct=(T,A,P)=>new bC(T,A,P);_9.bits=(T,A,P)=>new H4(T,A,P);_9.seq=(T,A,P)=>new yC(T,A,P);_9.union=(T,A,P)=>new X4(T,A,P);_9.unionLayoutDiscriminator=(T,A)=>new L2(T,A);_9.blob=(T,A)=>new uC(T,A);_9.cstr=(T)=>new dC(T);_9.utf8=(T,A)=>new rC(T,A);_9.constant=(T,A)=>new cC(T,A)});function B2(){if(!F4){if(F4=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues==="function"&&msCrypto.getRandomValues.bind(msCrypto),!F4)throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported")}return F4(zz)}var F4,zz;var AW=OT(()=>{zz=new Uint8Array(16)});var TV;var AV=OT(()=>{TV=/^(?:[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 Iz(T){return typeof T==="string"&&TV.test(T)}var gA;var O2=OT(()=>{AV();gA=Iz});function Sz(T){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,P=(BT[T[A+0]]+BT[T[A+1]]+BT[T[A+2]]+BT[T[A+3]]+"-"+BT[T[A+4]]+BT[T[A+5]]+"-"+BT[T[A+6]]+BT[T[A+7]]+"-"+BT[T[A+8]]+BT[T[A+9]]+"-"+BT[T[A+10]]+BT[T[A+11]]+BT[T[A+12]]+BT[T[A+13]]+BT[T[A+14]]+BT[T[A+15]]).toLowerCase();if(!gA(P))throw TypeError("Stringified UUID is invalid");return P}var BT,x2,mA;var _2=OT(()=>{O2();BT=[];for(x2=0;x2<256;++x2)BT.push((x2+256).toString(16).substr(1));mA=Sz});function Nz(T,A,P){var Q=A&&P||0,C=A||Array(16);T=T||{};var W=T.node||PV,G=T.clockseq!==void 0?T.clockseq:PW;if(W==null||G==null){var U=T.random||(T.rng||B2)();if(W==null)W=PV=[U[0]|1,U[1],U[2],U[3],U[4],U[5]];if(G==null)G=PW=(U[6]<<8|U[7])&16383}var $=T.msecs!==void 0?T.msecs:Date.now(),q=T.nsecs!==void 0?T.nsecs:CW+1,X=$-QW+(q-CW)/1e4;if(X<0&&T.clockseq===void 0)G=G+1&16383;if((X<0||$>QW)&&T.nsecs===void 0)q=0;if(q>=1e4)throw Error("uuid.v1(): Can't create more than 10M uuids/sec");QW=$,CW=q,PW=G,$+=12219292800000;var K=(($&268435455)*1e4+q)%4294967296;C[Q++]=K>>>24&255,C[Q++]=K>>>16&255,C[Q++]=K>>>8&255,C[Q++]=K&255;var F=$/4294967296*1e4&268435455;C[Q++]=F>>>8&255,C[Q++]=F&255,C[Q++]=F>>>24&15|16,C[Q++]=F>>>16&255,C[Q++]=G>>>8|128,C[Q++]=G&255;for(var M=0;M<6;++M)C[Q+M]=W[M];return A||mA(C)}var PV,PW,QW=0,CW=0,QV;var CV=OT(()=>{AW();_2();QV=Nz});function Lz(T){if(!gA(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 D4;var WW=OT(()=>{O2();D4=Lz});function wz(T){T=unescape(encodeURIComponent(T));var A=[];for(var P=0;P<T.length;++P)A.push(T.charCodeAt(P));return A}function h2(T,A,P){function Q(C,W,G,U){if(typeof C==="string")C=wz(C);if(typeof W==="string")W=D4(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){U=U||0;for(var q=0;q<16;++q)G[U+q]=$[q];return G}return mA($)}try{Q.name=T}catch(C){}return Q.DNS=Ez,Q.URL=Bz,Q}var Ez="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Bz="6ba7b811-9dad-11d1-80b4-00c04fd430c8";var GW=OT(()=>{_2();WW()});function Oz(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 xz(_z(hz(T),T.length*8))}function xz(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 WV(T){return(T+64>>>9<<4)+14+1}function _z(T,A){T[A>>5]|=128<<A%32,T[WV(A)-1]=A;var P=1732584193,Q=-271733879,C=-1732584194,W=271733878;for(var G=0;G<T.length;G+=16){var U=P,$=Q,q=C,X=W;P=gT(P,Q,C,W,T[G],7,-680876936),W=gT(W,P,Q,C,T[G+1],12,-389564586),C=gT(C,W,P,Q,T[G+2],17,606105819),Q=gT(Q,C,W,P,T[G+3],22,-1044525330),P=gT(P,Q,C,W,T[G+4],7,-176418897),W=gT(W,P,Q,C,T[G+5],12,1200080426),C=gT(C,W,P,Q,T[G+6],17,-1473231341),Q=gT(Q,C,W,P,T[G+7],22,-45705983),P=gT(P,Q,C,W,T[G+8],7,1770035416),W=gT(W,P,Q,C,T[G+9],12,-1958414417),C=gT(C,W,P,Q,T[G+10],17,-42063),Q=gT(Q,C,W,P,T[G+11],22,-1990404162),P=gT(P,Q,C,W,T[G+12],7,1804603682),W=gT(W,P,Q,C,T[G+13],12,-40341101),C=gT(C,W,P,Q,T[G+14],17,-1502002290),Q=gT(Q,C,W,P,T[G+15],22,1236535329),P=mT(P,Q,C,W,T[G+1],5,-165796510),W=mT(W,P,Q,C,T[G+6],9,-1069501632),C=mT(C,W,P,Q,T[G+11],14,643717713),Q=mT(Q,C,W,P,T[G],20,-373897302),P=mT(P,Q,C,W,T[G+5],5,-701558691),W=mT(W,P,Q,C,T[G+10],9,38016083),C=mT(C,W,P,Q,T[G+15],14,-660478335),Q=mT(Q,C,W,P,T[G+4],20,-405537848),P=mT(P,Q,C,W,T[G+9],5,568446438),W=mT(W,P,Q,C,T[G+14],9,-1019803690),C=mT(C,W,P,Q,T[G+3],14,-187363961),Q=mT(Q,C,W,P,T[G+8],20,1163531501),P=mT(P,Q,C,W,T[G+13],5,-1444681467),W=mT(W,P,Q,C,T[G+2],9,-51403784),C=mT(C,W,P,Q,T[G+7],14,1735328473),Q=mT(Q,C,W,P,T[G+12],20,-1926607734),P=vT(P,Q,C,W,T[G+5],4,-378558),W=vT(W,P,Q,C,T[G+8],11,-2022574463),C=vT(C,W,P,Q,T[G+11],16,1839030562),Q=vT(Q,C,W,P,T[G+14],23,-35309556),P=vT(P,Q,C,W,T[G+1],4,-1530992060),W=vT(W,P,Q,C,T[G+4],11,1272893353),C=vT(C,W,P,Q,T[G+7],16,-155497632),Q=vT(Q,C,W,P,T[G+10],23,-1094730640),P=vT(P,Q,C,W,T[G+13],4,681279174),W=vT(W,P,Q,C,T[G],11,-358537222),C=vT(C,W,P,Q,T[G+3],16,-722521979),Q=vT(Q,C,W,P,T[G+6],23,76029189),P=vT(P,Q,C,W,T[G+9],4,-640364487),W=vT(W,P,Q,C,T[G+12],11,-421815835),C=vT(C,W,P,Q,T[G+15],16,530742520),Q=vT(Q,C,W,P,T[G+2],23,-995338651),P=yT(P,Q,C,W,T[G],6,-198630844),W=yT(W,P,Q,C,T[G+7],10,1126891415),C=yT(C,W,P,Q,T[G+14],15,-1416354905),Q=yT(Q,C,W,P,T[G+5],21,-57434055),P=yT(P,Q,C,W,T[G+12],6,1700485571),W=yT(W,P,Q,C,T[G+3],10,-1894986606),C=yT(C,W,P,Q,T[G+10],15,-1051523),Q=yT(Q,C,W,P,T[G+1],21,-2054922799),P=yT(P,Q,C,W,T[G+8],6,1873313359),W=yT(W,P,Q,C,T[G+15],10,-30611744),C=yT(C,W,P,Q,T[G+6],15,-1560198380),Q=yT(Q,C,W,P,T[G+13],21,1309151649),P=yT(P,Q,C,W,T[G+4],6,-145523070),W=yT(W,P,Q,C,T[G+11],10,-1120210379),C=yT(C,W,P,Q,T[G+2],15,718787259),Q=yT(Q,C,W,P,T[G+9],21,-343485551),P=vA(P,U),Q=vA(Q,$),C=vA(C,q),W=vA(W,X)}return[P,Q,C,W]}function hz(T){if(T.length===0)return[];var A=T.length*8,P=new Uint32Array(WV(A));for(var Q=0;Q<A;Q+=8)P[Q>>5]|=(T[Q/8]&255)<<Q%32;return P}function vA(T,A){var P=(T&65535)+(A&65535),Q=(T>>16)+(A>>16)+(P>>16);return Q<<16|P&65535}function gz(T,A){return T<<A|T>>>32-A}function M4(T,A,P,Q,C,W){return vA(gz(vA(vA(A,T),vA(Q,W)),C),P)}function gT(T,A,P,Q,C,W,G){return M4(A&P|~A&Q,T,A,C,W,G)}function mT(T,A,P,Q,C,W,G){return M4(A&Q|P&~Q,T,A,C,W,G)}function vT(T,A,P,Q,C,W,G){return M4(A^P^Q,T,A,C,W,G)}function yT(T,A,P,Q,C,W,G){return M4(P^(A|~Q),T,A,C,W,G)}var GV;var JV=OT(()=>{GV=Oz});var mz,UV;var $V=OT(()=>{GW();JV();mz=h2("v3",48,GV),UV=mz});function vz(T,A,P){T=T||{};var Q=T.random||(T.rng||B2)();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 mA(Q)}var VV;var YV=OT(()=>{AW();_2();VV=vz});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 JW(T,A){return T<<A|T>>>32-A}function bz(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),U=Array(G);for(var $=0;$<G;++$){var q=new Uint32Array(16);for(var X=0;X<16;++X)q[X]=T[$*64+X*4]<<24|T[$*64+X*4+1]<<16|T[$*64+X*4+2]<<8|T[$*64+X*4+3];U[$]=q}U[G-1][14]=(T.length-1)*8/Math.pow(2,32),U[G-1][14]=Math.floor(U[G-1][14]),U[G-1][15]=(T.length-1)*8&4294967295;for(var K=0;K<G;++K){var F=new Uint32Array(80);for(var M=0;M<16;++M)F[M]=U[K][M];for(var I=16;I<80;++I)F[I]=JW(F[I-3]^F[I-8]^F[I-14]^F[I-16],1);var E=P[0],L=P[1],O=P[2],m=P[3],v=P[4];for(var l=0;l<80;++l){var r=Math.floor(l/20),c=JW(E,5)+yz(r,L,O,m)+v+A[r]+F[l]>>>0;v=m,m=O,O=JW(L,30)>>>0,L=E,E=c}P[0]=P[0]+E>>>0,P[1]=P[1]+L>>>0,P[2]=P[2]+O>>>0,P[3]=P[3]+m>>>0,P[4]=P[4]+v>>>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 ZV;var qV=OT(()=>{ZV=bz});var lz,XV;var HV=OT(()=>{GW();qV();lz=h2("v5",80,ZV),XV=lz});var KV="00000000-0000-0000-0000-000000000000";function uz(T){if(!gA(T))throw TypeError("Invalid UUID");return parseInt(T.substr(14,1),16)}var jV;var RV=OT(()=>{O2();jV=uz});var UW={};qP(UW,{version:()=>jV,validate:()=>gA,v5:()=>XV,v4:()=>VV,v3:()=>UV,v1:()=>QV,stringify:()=>mA,parse:()=>D4,NIL:()=>KV});var $W=OT(()=>{CV();$V();YV();HV();RV();O2();_2();WW()});var FV=U0((W_,kV)=>{var dz=($W(),K8(UW)).v4,rz=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 dz()};W.id=G(W,Q)}else if(C===2&&P===null){if(Q.notificationIdNull)W.id=null}else W.id=P;return W};kV.exports=rz});var MV=U0((G_,DV)=>{var cz=($W(),K8(UW)).v4,oz=FV(),g2=function(T,A){if(!(this instanceof g2))return new g2(T,A);if(!A)A={};this.options={reviver:typeof A.reviver<"u"?A.reviver:null,replacer:typeof A.replacer<"u"?A.replacer:null,generator:typeof A.generator<"u"?A.generator:function(){return cz()},version:typeof A.version<"u"?A.version:2,notificationIdNull:typeof A.notificationIdNull==="boolean"?A.notificationIdNull:!1},this.callServer=T};DV.exports=g2;g2.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 q=typeof Q==="function";try{W=oz(T,A,P,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(X){if(q)return Q(X);throw X}if(!q)return W}let $;try{$=JSON.stringify(W,this.options.replacer)}catch(q){return Q(q)}return this.callServer($,function(q,X){C._parseResponse(q,X,Q)}),W};g2.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 IV=U0((J_,VW)=>{var fz=Object.prototype.hasOwnProperty,fT="~";function m2(){}if(Object.create){if(m2.prototype=Object.create(null),!new m2().__proto__)fT=!1}function nz(T,A,P){this.fn=T,this.context=A,this.once=P||!1}function zV(T,A,P,Q,C){if(typeof P!=="function")throw TypeError("The listener must be a function");var W=new nz(P,Q||T,C),G=fT?fT+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 z4(T,A){if(--T._eventsCount===0)T._events=new m2;else delete T._events[A]}function bT(){this._events=new m2,this._eventsCount=0}bT.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(fT?Q.slice(1):Q);if(Object.getOwnPropertySymbols)return A.concat(Object.getOwnPropertySymbols(P));return A};bT.prototype.listeners=function(A){var P=fT?fT+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};bT.prototype.listenerCount=function(A){var P=fT?fT+A:A,Q=this._events[P];if(!Q)return 0;if(Q.fn)return 1;return Q.length};bT.prototype.emit=function(A,P,Q,C,W,G){var U=fT?fT+A:A;if(!this._events[U])return!1;var $=this._events[U],q=arguments.length,X,K;if($.fn){if($.once)this.removeListener(A,$.fn,void 0,!0);switch(q){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(K=1,X=Array(q-1);K<q;K++)X[K-1]=arguments[K];$.fn.apply($.context,X)}else{var F=$.length,M;for(K=0;K<F;K++){if($[K].once)this.removeListener(A,$[K].fn,void 0,!0);switch(q){case 1:$[K].fn.call($[K].context);break;case 2:$[K].fn.call($[K].context,P);break;case 3:$[K].fn.call($[K].context,P,Q);break;case 4:$[K].fn.call($[K].context,P,Q,C);break;default:if(!X)for(M=1,X=Array(q-1);M<q;M++)X[M-1]=arguments[M];$[K].fn.apply($[K].context,X)}}}return!0};bT.prototype.on=function(A,P,Q){return zV(this,A,P,Q,!1)};bT.prototype.once=function(A,P,Q){return zV(this,A,P,Q,!0)};bT.prototype.removeListener=function(A,P,Q,C){var W=fT?fT+A:A;if(!this._events[W])return this;if(!P)return z4(this,W),this;var G=this._events[W];if(G.fn){if(G.fn===P&&(!C||G.once)&&(!Q||G.context===Q))z4(this,W)}else{for(var U=0,$=[],q=G.length;U<q;U++)if(G[U].fn!==P||C&&!G[U].once||Q&&G[U].context!==Q)$.push(G[U]);if($.length)this._events[W]=$.length===1?$[0]:$;else z4(this,W)}return this};bT.prototype.removeAllListeners=function(A){var P;if(A){if(P=fT?fT+A:A,this._events[P])z4(this,P)}else this._events=new m2,this._eventsCount=0;return this};bT.prototype.off=bT.prototype.removeListener;bT.prototype.addListener=bT.prototype.on;bT.prefixed=fT;bT.EventEmitter=bT;if(typeof VW<"u")VW.exports=bT});var zY=U0((MY)=>{Object.defineProperty(MY,"__esModule",{value:!0});var m4;function WS(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)}MY.toBigIntLE=WS;function GS(T){{let A=T.toString("hex");if(A.length===0)return BigInt(0);return BigInt(`0x${A}`)}return m4.toBigInt(T,!0)}MY.toBigIntBE=GS;function JS(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)}MY.toBufferLE=JS;function US(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)}MY.toBufferBE=US});/*!
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 KP=kG(),R8=FG(),DG=typeof Symbol==="function"&&typeof Symbol.for==="function"?Symbol.for("nodejs.util.inspect.custom"):null;var SP=g;var vG=50;var jP=2147483647;g.TYPED_ARRAY_SUPPORT=EZ();if(!g.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 EZ(){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(g.prototype,"parent",{enumerable:!0,get:function(){if(!g.isBuffer(this))return;return this.buffer}});Object.defineProperty(g.prototype,"offset",{enumerable:!0,get:function(){if(!g.isBuffer(this))return;return this.byteOffset}});function u0(T){if(T>jP)throw RangeError('The value "'+T+'" is invalid for option "size"');let A=new Uint8Array(T);return Object.setPrototypeOf(A,g.prototype),A}function g(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 DP(T)}return SG(T,A,P)}g.poolSize=8192;function SG(T,A,P){if(typeof T==="string")return OZ(T,A);if(ArrayBuffer.isView(T))return xZ(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(S0(T,ArrayBuffer)||T&&S0(T.buffer,ArrayBuffer))return kP(T,A,P);if(typeof SharedArrayBuffer<"u"&&(S0(T,SharedArrayBuffer)||T&&S0(T.buffer,SharedArrayBuffer)))return kP(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 g.from(Q,A,P);let C=_Z(T);if(C)return C;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof T[Symbol.toPrimitive]==="function")return g.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)}g.from=function(T,A,P){return SG(T,A,P)};Object.setPrototypeOf(g.prototype,Uint8Array.prototype);Object.setPrototypeOf(g,Uint8Array);function NG(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 BZ(T,A,P){if(NG(T),T<=0)return u0(T);if(A!==void 0)return typeof P==="string"?u0(T).fill(A,P):u0(T).fill(A);return u0(T)}g.alloc=function(T,A,P){return BZ(T,A,P)};function DP(T){return NG(T),u0(T<0?0:MP(T)|0)}g.allocUnsafe=function(T){return DP(T)};g.allocUnsafeSlow=function(T){return DP(T)};function OZ(T,A){if(typeof A!=="string"||A==="")A="utf8";if(!g.isEncoding(A))throw TypeError("Unknown encoding: "+A);let P=LG(T,A)|0,Q=u0(P),C=Q.write(T,A);if(C!==P)Q=Q.slice(0,C);return Q}function RP(T){let A=T.length<0?0:MP(T.length)|0,P=u0(A);for(let Q=0;Q<A;Q+=1)P[Q]=T[Q]&255;return P}function xZ(T){if(S0(T,Uint8Array)){let A=new Uint8Array(T);return kP(A.buffer,A.byteOffset,A.byteLength)}return RP(T)}function kP(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,g.prototype),Q}function _Z(T){if(g.isBuffer(T)){let A=MP(T.length)|0,P=u0(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"||IP(T.length))return u0(0);return RP(T)}if(T.type==="Buffer"&&Array.isArray(T.data))return RP(T.data)}function MP(T){if(T>=jP)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+jP.toString(16)+" bytes");return T|0}g.isBuffer=function(A){return A!=null&&A._isBuffer===!0&&A!==g.prototype};g.compare=function(A,P){if(S0(A,Uint8Array))A=g.from(A,A.offset,A.byteLength);if(S0(P,Uint8Array))P=g.from(P,P.offset,P.byteLength);if(!g.isBuffer(A)||!g.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};g.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}};g.concat=function(A,P){if(!Array.isArray(A))throw TypeError('"list" argument must be an Array of Buffers');if(A.length===0)return g.alloc(0);let Q;if(P===void 0){P=0;for(Q=0;Q<A.length;++Q)P+=A[Q].length}let C=g.allocUnsafe(P),W=0;for(Q=0;Q<A.length;++Q){let G=A[Q];if(S0(G,Uint8Array))if(W+G.length>C.length){if(!g.isBuffer(G))G=g.from(G);G.copy(C,W)}else Uint8Array.prototype.set.call(C,G,W);else if(!g.isBuffer(G))throw TypeError('"list" argument must be an Array of Buffers');else G.copy(C,W);W+=G.length}return C};function LG(T,A){if(g.isBuffer(T))return T.length;if(ArrayBuffer.isView(T)||S0(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 FP(T).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P*2;case"hex":return P>>>1;case"base64":return mG(T).length;default:if(C)return Q?-1:FP(T).length;A=(""+A).toLowerCase(),C=!0}}g.byteLength=LG;function hZ(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 rZ(this,A,P);case"utf8":case"utf-8":return EG(this,A,P);case"ascii":return uZ(this,A,P);case"latin1":case"binary":return dZ(this,A,P);case"base64":return lZ(this,A,P);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return cZ(this,A,P);default:if(Q)throw TypeError("Unknown encoding: "+T);T=(T+"").toLowerCase(),Q=!0}}g.prototype._isBuffer=!0;function lA(T,A,P){let Q=T[A];T[A]=T[P],T[P]=Q}g.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)lA(this,P,P+1);return this};g.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)lA(this,P,P+3),lA(this,P+1,P+2);return this};g.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)lA(this,P,P+7),lA(this,P+1,P+6),lA(this,P+2,P+5),lA(this,P+3,P+4);return this};g.prototype.toString=function(){let A=this.length;if(A===0)return"";if(arguments.length===0)return EG(this,0,A);return hZ.apply(this,arguments)};g.prototype.toLocaleString=g.prototype.toString;g.prototype.equals=function(A){if(!g.isBuffer(A))throw TypeError("Argument must be a Buffer");if(this===A)return!0;return g.compare(this,A)===0};g.prototype.inspect=function(){let A="",P=vG;if(A=this.toString("hex",0,P).replace(/(.{2})/g,"$1 ").trim(),this.length>P)A+=" ... ";return"<Buffer "+A+">"};if(DG)g.prototype[DG]=g.prototype.inspect;g.prototype.compare=function(A,P,Q,C,W){if(S0(A,Uint8Array))A=g.from(A,A.offset,A.byteLength);if(!g.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,U=Q-P,$=Math.min(G,U),q=this.slice(C,W),X=A.slice(P,Q);for(let K=0;K<$;++K)if(q[K]!==X[K]){G=q[K],U=X[K];break}if(G<U)return-1;if(U<G)return 1;return 0};function wG(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,IP(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=g.from(A,Q);if(g.isBuffer(A)){if(A.length===0)return-1;return MG(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 MG(T,[A],P,Q,C)}throw TypeError("val must be string, number or Buffer")}function MG(T,A,P,Q,C){let W=1,G=T.length,U=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,U/=2,P/=2}}function $(X,K){if(W===1)return X[K];else return X.readUInt16BE(K*W)}let q;if(C){let X=-1;for(q=P;q<G;q++)if($(T,q)===$(A,X===-1?0:q-X)){if(X===-1)X=q;if(q-X+1===U)return X*W}else{if(X!==-1)q-=q-X;X=-1}}else{if(P+U>G)P=G-U;for(q=P;q>=0;q--){let X=!0;for(let K=0;K<U;K++)if($(T,q+K)!==$(A,K)){X=!1;break}if(X)return q}}return-1}g.prototype.includes=function(A,P,Q){return this.indexOf(A,P,Q)!==-1};g.prototype.indexOf=function(A,P,Q){return wG(this,A,P,Q,!0)};g.prototype.lastIndexOf=function(A,P,Q){return wG(this,A,P,Q,!1)};function gZ(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 U=parseInt(A.substr(G*2,2),16);if(IP(U))return G;T[P+G]=U}return G}function mZ(T,A,P,Q){return e2(FP(A,T.length-P),T,P,Q)}function vZ(T,A,P,Q){return e2(iZ(A),T,P,Q)}function yZ(T,A,P,Q){return e2(mG(A),T,P,Q)}function bZ(T,A,P,Q){return e2(aZ(A,T.length-P),T,P,Q)}g.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 gZ(this,A,P,Q);case"utf8":case"utf-8":return mZ(this,A,P,Q);case"ascii":case"latin1":case"binary":return vZ(this,A,P,Q);case"base64":return yZ(this,A,P,Q);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return bZ(this,A,P,Q);default:if(G)throw TypeError("Unknown encoding: "+C);C=(""+C).toLowerCase(),G=!0}};g.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function lZ(T,A,P){if(A===0&&P===T.length)return KP.fromByteArray(T);else return KP.fromByteArray(T.slice(A,P))}function EG(T,A,P){P=Math.min(T.length,P);let Q=[],C=A;while(C<P){let W=T[C],G=null,U=W>239?4:W>223?3:W>191?2:1;if(C+U<=P){let $,q,X,K;switch(U){case 1:if(W<128)G=W;break;case 2:if($=T[C+1],($&192)===128){if(K=(W&31)<<6|$&63,K>127)G=K}break;case 3:if($=T[C+1],q=T[C+2],($&192)===128&&(q&192)===128){if(K=(W&15)<<12|($&63)<<6|q&63,K>2047&&(K<55296||K>57343))G=K}break;case 4:if($=T[C+1],q=T[C+2],X=T[C+3],($&192)===128&&(q&192)===128&&(X&192)===128){if(K=(W&15)<<18|($&63)<<12|(q&63)<<6|X&63,K>65535&&K<1114112)G=K}}}if(G===null)G=65533,U=1;else if(G>65535)G-=65536,Q.push(G>>>10&1023|55296),G=56320|G&1023;Q.push(G),C+=U}return pZ(Q)}var zG=4096;function pZ(T){let A=T.length;if(A<=zG)return String.fromCharCode.apply(String,T);let P="",Q=0;while(Q<A)P+=String.fromCharCode.apply(String,T.slice(Q,Q+=zG));return P}function uZ(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 dZ(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 rZ(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+=sZ[T[W]];return C}function cZ(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}g.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,g.prototype),C};function FT(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")}g.prototype.readUintLE=g.prototype.readUIntLE=function(A,P,Q){if(A=A>>>0,P=P>>>0,!Q)FT(A,P,this.length);let C=this[A],W=1,G=0;while(++G<P&&(W*=256))C+=this[A+G]*W;return C};g.prototype.readUintBE=g.prototype.readUIntBE=function(A,P,Q){if(A=A>>>0,P=P>>>0,!Q)FT(A,P,this.length);let C=this[A+--P],W=1;while(P>0&&(W*=256))C+=this[A+--P]*W;return C};g.prototype.readUint8=g.prototype.readUInt8=function(A,P){if(A=A>>>0,!P)FT(A,1,this.length);return this[A]};g.prototype.readUint16LE=g.prototype.readUInt16LE=function(A,P){if(A=A>>>0,!P)FT(A,2,this.length);return this[A]|this[A+1]<<8};g.prototype.readUint16BE=g.prototype.readUInt16BE=function(A,P){if(A=A>>>0,!P)FT(A,2,this.length);return this[A]<<8|this[A+1]};g.prototype.readUint32LE=g.prototype.readUInt32LE=function(A,P){if(A=A>>>0,!P)FT(A,4,this.length);return(this[A]|this[A+1]<<8|this[A+2]<<16)+this[A+3]*16777216};g.prototype.readUint32BE=g.prototype.readUInt32BE=function(A,P){if(A=A>>>0,!P)FT(A,4,this.length);return this[A]*16777216+(this[A+1]<<16|this[A+2]<<8|this[A+3])};g.prototype.readBigUInt64LE=ZA(function(A){A=A>>>0,k8(A,"offset");let P=this[A],Q=this[A+7];if(P===void 0||Q===void 0)Q2(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))});g.prototype.readBigUInt64BE=ZA(function(A){A=A>>>0,k8(A,"offset");let P=this[A],Q=this[A+7];if(P===void 0||Q===void 0)Q2(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)});g.prototype.readIntLE=function(A,P,Q){if(A=A>>>0,P=P>>>0,!Q)FT(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};g.prototype.readIntBE=function(A,P,Q){if(A=A>>>0,P=P>>>0,!Q)FT(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};g.prototype.readInt8=function(A,P){if(A=A>>>0,!P)FT(A,1,this.length);if(!(this[A]&128))return this[A];return(255-this[A]+1)*-1};g.prototype.readInt16LE=function(A,P){if(A=A>>>0,!P)FT(A,2,this.length);let Q=this[A]|this[A+1]<<8;return Q&32768?Q|4294901760:Q};g.prototype.readInt16BE=function(A,P){if(A=A>>>0,!P)FT(A,2,this.length);let Q=this[A+1]|this[A]<<8;return Q&32768?Q|4294901760:Q};g.prototype.readInt32LE=function(A,P){if(A=A>>>0,!P)FT(A,4,this.length);return this[A]|this[A+1]<<8|this[A+2]<<16|this[A+3]<<24};g.prototype.readInt32BE=function(A,P){if(A=A>>>0,!P)FT(A,4,this.length);return this[A]<<24|this[A+1]<<16|this[A+2]<<8|this[A+3]};g.prototype.readBigInt64LE=ZA(function(A){A=A>>>0,k8(A,"offset");let P=this[A],Q=this[A+7];if(P===void 0||Q===void 0)Q2(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)});g.prototype.readBigInt64BE=ZA(function(A){A=A>>>0,k8(A,"offset");let P=this[A],Q=this[A+7];if(P===void 0||Q===void 0)Q2(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)});g.prototype.readFloatLE=function(A,P){if(A=A>>>0,!P)FT(A,4,this.length);return R8.read(this,A,!0,23,4)};g.prototype.readFloatBE=function(A,P){if(A=A>>>0,!P)FT(A,4,this.length);return R8.read(this,A,!1,23,4)};g.prototype.readDoubleLE=function(A,P){if(A=A>>>0,!P)FT(A,8,this.length);return R8.read(this,A,!0,52,8)};g.prototype.readDoubleBE=function(A,P){if(A=A>>>0,!P)FT(A,8,this.length);return R8.read(this,A,!1,52,8)};function aT(T,A,P,Q,C,W){if(!g.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")}g.prototype.writeUintLE=g.prototype.writeUIntLE=function(A,P,Q,C){if(A=+A,P=P>>>0,Q=Q>>>0,!C){let U=Math.pow(2,8*Q)-1;aT(this,A,P,Q,U,0)}let W=1,G=0;this[P]=A&255;while(++G<Q&&(W*=256))this[P+G]=A/W&255;return P+Q};g.prototype.writeUintBE=g.prototype.writeUIntBE=function(A,P,Q,C){if(A=+A,P=P>>>0,Q=Q>>>0,!C){let U=Math.pow(2,8*Q)-1;aT(this,A,P,Q,U,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};g.prototype.writeUint8=g.prototype.writeUInt8=function(A,P,Q){if(A=+A,P=P>>>0,!Q)aT(this,A,P,1,255,0);return this[P]=A&255,P+1};g.prototype.writeUint16LE=g.prototype.writeUInt16LE=function(A,P,Q){if(A=+A,P=P>>>0,!Q)aT(this,A,P,2,65535,0);return this[P]=A&255,this[P+1]=A>>>8,P+2};g.prototype.writeUint16BE=g.prototype.writeUInt16BE=function(A,P,Q){if(A=+A,P=P>>>0,!Q)aT(this,A,P,2,65535,0);return this[P]=A>>>8,this[P+1]=A&255,P+2};g.prototype.writeUint32LE=g.prototype.writeUInt32LE=function(A,P,Q){if(A=+A,P=P>>>0,!Q)aT(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};g.prototype.writeUint32BE=g.prototype.writeUInt32BE=function(A,P,Q){if(A=+A,P=P>>>0,!Q)aT(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 BG(T,A,P,Q,C){gG(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 OG(T,A,P,Q,C){gG(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}g.prototype.writeBigUInt64LE=ZA(function(A,P=0){return BG(this,A,P,BigInt(0),BigInt("0xffffffffffffffff"))});g.prototype.writeBigUInt64BE=ZA(function(A,P=0){return OG(this,A,P,BigInt(0),BigInt("0xffffffffffffffff"))});g.prototype.writeIntLE=function(A,P,Q,C){if(A=+A,P=P>>>0,!C){let $=Math.pow(2,8*Q-1);aT(this,A,P,Q,$-1,-$)}let W=0,G=1,U=0;this[P]=A&255;while(++W<Q&&(G*=256)){if(A<0&&U===0&&this[P+W-1]!==0)U=1;this[P+W]=(A/G>>0)-U&255}return P+Q};g.prototype.writeIntBE=function(A,P,Q,C){if(A=+A,P=P>>>0,!C){let $=Math.pow(2,8*Q-1);aT(this,A,P,Q,$-1,-$)}let W=Q-1,G=1,U=0;this[P+W]=A&255;while(--W>=0&&(G*=256)){if(A<0&&U===0&&this[P+W+1]!==0)U=1;this[P+W]=(A/G>>0)-U&255}return P+Q};g.prototype.writeInt8=function(A,P,Q){if(A=+A,P=P>>>0,!Q)aT(this,A,P,1,127,-128);if(A<0)A=255+A+1;return this[P]=A&255,P+1};g.prototype.writeInt16LE=function(A,P,Q){if(A=+A,P=P>>>0,!Q)aT(this,A,P,2,32767,-32768);return this[P]=A&255,this[P+1]=A>>>8,P+2};g.prototype.writeInt16BE=function(A,P,Q){if(A=+A,P=P>>>0,!Q)aT(this,A,P,2,32767,-32768);return this[P]=A>>>8,this[P+1]=A&255,P+2};g.prototype.writeInt32LE=function(A,P,Q){if(A=+A,P=P>>>0,!Q)aT(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};g.prototype.writeInt32BE=function(A,P,Q){if(A=+A,P=P>>>0,!Q)aT(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};g.prototype.writeBigInt64LE=ZA(function(A,P=0){return BG(this,A,P,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});g.prototype.writeBigInt64BE=ZA(function(A,P=0){return OG(this,A,P,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function xG(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 _G(T,A,P,Q,C){if(A=+A,P=P>>>0,!C)xG(T,A,P,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return R8.write(T,A,P,Q,23,4),P+4}g.prototype.writeFloatLE=function(A,P,Q){return _G(this,A,P,!0,Q)};g.prototype.writeFloatBE=function(A,P,Q){return _G(this,A,P,!1,Q)};function hG(T,A,P,Q,C){if(A=+A,P=P>>>0,!C)xG(T,A,P,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return R8.write(T,A,P,Q,52,8),P+8}g.prototype.writeDoubleLE=function(A,P,Q){return hG(this,A,P,!0,Q)};g.prototype.writeDoubleBE=function(A,P,Q){return hG(this,A,P,!1,Q)};g.prototype.copy=function(A,P,Q,C){if(!g.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};g.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"&&!g.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=g.isBuffer(A)?A:g.from(A,C),U=G.length;if(U===0)throw TypeError('The value "'+A+'" is invalid for argument "value"');for(W=0;W<Q-P;++W)this[W+P]=G[W%U]}return this};var j8={};function zP(T,A,P){j8[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}`}}}zP("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);zP("ERR_INVALID_ARG_TYPE",function(T,A){return`The "${T}" argument must be of type number. Received type ${typeof A}`},TypeError);zP("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=IG(String(P));else if(typeof P==="bigint"){if(C=String(P),P>BigInt(2)**BigInt(32)||P<-(BigInt(2)**BigInt(32)))C=IG(C);C+="n"}return Q+=` It must be ${A}. Received ${C}`,Q},RangeError);function IG(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 oZ(T,A,P){if(k8(A,"offset"),T[A]===void 0||T[A+P]===void 0)Q2(A,T.length-(P+1))}function gG(T,A,P,Q,C,W){if(T>P||T<A){let G=typeof A==="bigint"?"n":"",U;if(W>3)if(A===0||A===BigInt(0))U=`>= 0${G} and < 2${G} ** ${(W+1)*8}${G}`;else U=`>= -(2${G} ** ${(W+1)*8-1}${G}) and < 2 ** ${(W+1)*8-1}${G}`;else U=`>= ${A}${G} and <= ${P}${G}`;throw new j8.ERR_OUT_OF_RANGE("value",U,T)}oZ(Q,C,W)}function k8(T,A){if(typeof T!=="number")throw new j8.ERR_INVALID_ARG_TYPE(A,"number",T)}function Q2(T,A,P){if(Math.floor(T)!==T)throw k8(T,P),new j8.ERR_OUT_OF_RANGE(P||"offset","an integer",T);if(A<0)throw new j8.ERR_BUFFER_OUT_OF_BOUNDS;throw new j8.ERR_OUT_OF_RANGE(P||"offset",`>= ${P?1:0} and <= ${A}`,T)}var fZ=/[^+/0-9A-Za-z-_]/g;function nZ(T){if(T=T.split("=")[0],T=T.trim().replace(fZ,""),T.length<2)return"";while(T.length%4!==0)T=T+"=";return T}function FP(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 iZ(T){let A=[];for(let P=0;P<T.length;++P)A.push(T.charCodeAt(P)&255);return A}function aZ(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 mG(T){return KP.toByteArray(nZ(T))}function e2(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 S0(T,A){return T instanceof A||T!=null&&T.constructor!=null&&T.constructor.name!=null&&T.constructor.name===A.name}function IP(T){return T!==T}var sZ=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 ZA(T){return typeof BigInt>"u"?tZ:T}function tZ(){throw Error("BigInt not supported")}if(typeof globalThis.Buffer>"u")globalThis.Buffer=SP;var NP=1,yG=2,bG=3,lG=4,pG=5,uG=6,dG=7,rG=8,cG=9,eZ=10,Tq=-32700,Aq=-32603,Pq=-32602,Qq=-32601,Cq=-32600,Wq=-32019,Gq=-32018,Jq=-32017,Uq=-32016,$q=-32015,Vq=-32014,Yq=-32013,Zq=-32012,qq=-32011,Xq=-32010,Hq=-32009,Kq=-32008,jq=-32007,Rq=-32006,kq=-32005,Fq=-32004,Dq=-32003,Mq=-32002,zq=-32001,T6=2800000,A6=2800001,Iq=2800002,LP=2800003,oG=2800004,fG=2800005,wP=2800006,EP=2800007,P6=2800008,BP=2800009,nG=2800010,iG=2800011,OP=3230000,aG=32300001,xP=3230002,sG=3230003,tG=3230004,_P=3610000,hP=3610001,gP=3610002,mP=3610003,vP=3610004,yP=3610005,eG=3610006,Sq=3610007,TJ=3611000,Nq=3704000,Lq=3704001,wq=3704002,Eq=3704003,Bq=3704004,Oq=4128000,xq=4128001,_q=4128002,AJ=4615000,hq=4615001,gq=4615002,mq=4615003,vq=4615004,yq=4615005,bq=4615006,lq=4615007,pq=4615008,uq=4615009,dq=4615010,rq=4615011,cq=4615012,oq=4615013,fq=4615014,nq=4615015,iq=4615016,aq=4615017,sq=4615018,tq=4615019,eq=4615020,TX=4615021,AX=4615022,PX=4615023,QX=4615024,CX=4615025,PJ=4615026,WX=4615027,GX=4615028,JX=4615029,UX=4615030,$X=4615031,VX=4615032,YX=4615033,ZX=4615034,qX=4615035,XX=4615036,HX=4615037,KX=4615038,jX=4615039,RX=4615040,kX=4615041,FX=4615042,DX=4615043,MX=4615044,zX=4615045,IX=4615046,SX=4615047,NX=4615048,LX=4615049,wX=4615050,EX=4615051,BX=4615052,OX=4615053,xX=4615054,bP=5508000,QJ=5508001,CJ=5508002,WJ=5508003,GJ=5508004,JJ=5508005,UJ=5508006,$J=5508007,VJ=5508008,YJ=5508009,ZJ=5508010,_X=5508011,lP=5663000,Q6=5663001,pP=5663002,uP=5663003,dP=5663004,qJ=5663005,XJ=5663006,HJ=5663007,KJ=5663008,rP=5663009,hX=5663010,gX=5663011,cP=5663012,mX=5663013,vX=5663014,oP=5663015,fP=5663016,jJ=5663017,yX=5663018,bX=5663019,RJ=5663020,nP=5663021,kJ=5663022,FJ=7050000,lX=7050001,pX=7050002,uX=7050003,dX=7050004,rX=7050005,cX=7050006,oX=7050007,fX=7050008,nX=7050009,iX=7050010,aX=7050011,sX=7050012,tX=7050013,eX=7050014,TH=7050015,AH=7050016,PH=7050017,QH=7050018,CH=7050019,WH=7050020,GH=7050021,JH=7050022,UH=7050023,$H=7050024,VH=7050025,YH=7050026,ZH=7050027,qH=7050028,XH=7050029,DJ=7050030,MJ=7050031,HH=7050032,KH=7050033,jH=7050034,zJ=7050035,RH=7050036,kH=7618000,FH=7618001,DH=7618002,MH=7618003,C6=8078000,C2=8078001,iP=8078002,aP=8078003,W6=8078004,G6=8078005,J6=8078006,pA=8078007,U6=8078008,$6=8078009,V6=8078010,uA=8078011,qA=8078012,sP=8078013,tP=8078014,Y6=8078015,Z6=8078016,W2=8078017,q6=8078018,zH=8078019,eP=8078020,TQ=8078021,X6=8078022,AQ=8078023,IH=8100000,SH=8100001,NH=8100002,LH=8100003,wH=8190000,EH=8190001,BH=8190002,OH=8190003,xH=8190004,_H=9900000,hH=9900001,gH=9900002,PQ=9900003,mH=9900004,vH=9900005,yH=9900006;var bH={[OP]:"Account not found at address: $address",[tG]:"Not all accounts were decoded. Encoded accounts found at addresses: $addresses.",[sG]:"Expected decoded account at address: $address",[xP]:"Failed to decode account data at address: $address",[aG]:"Accounts not found at addresses: $addresses",[BP]:"Unable to find a viable program address bump seed.",[Iq]:"$putativeAddress is not a base58-encoded address.",[T6]:"Expected base58 encoded address to decode to a byte array of length 32. Actual length: $actualLength.",[LP]:"The `CryptoKey` must be an `Ed25519` public key.",[iG]:"$putativeOffCurveAddress is not a base58-encoded off-curve address.",[P6]:"Invalid seeds; point must fall off the Ed25519 curve.",[oG]:"Expected given program derived address to have the following format: [Address, ProgramDerivedAddressBump].",[wP]:"A maximum of $maxSeeds seeds, including the bump seed, may be supplied when creating an address. Received: $actual.",[EP]:"The seed at index $index with length $actual exceeds the maximum length of $maxSeedLength bytes.",[fG]:"Expected program derived address bump to be in the range [0, 255], got: $bump.",[nG]:"Program address cannot end with PDA marker.",[A6]:"Expected base58-encoded address string of length in the range [32, 44]. Actual length: $actualLength.",[lG]:"Expected base58-encoded blockash string of length in the range [32, 44]. Actual length: $actualLength.",[NP]:"The network has progressed past the last block for which this transaction could have been committed.",[C6]:"Codec [$codecDescription] cannot decode empty byte arrays.",[X6]:"Enum codec cannot use lexical values [$stringValues] as discriminators. Either remove all lexical values or set `useValuesAsDiscriminators` to `false`.",[eP]:"Sentinel [$hexSentinel] must not be present in encoded bytes [$hexEncodedBytes].",[G6]:"Encoder and decoder must have the same fixed size, got [$encoderFixedSize] and [$decoderFixedSize].",[J6]:"Encoder and decoder must have the same max size, got [$encoderMaxSize] and [$decoderMaxSize].",[W6]:"Encoder and decoder must either both be fixed-size or variable-size.",[U6]:"Enum discriminator out of range. Expected a number in [$formattedValidDiscriminators], got $discriminator.",[iP]:"Expected a fixed-size codec, got a variable-size one.",[sP]:"Codec [$codecDescription] expected a positive byte length, got $bytesLength.",[aP]:"Expected a variable-size codec, got a fixed-size one.",[zH]:"Codec [$codecDescription] expected zero-value [$hexZeroValue] to have the same size as the provided fixed-size item [$expectedSize bytes].",[C2]:"Codec [$codecDescription] expected $expected bytes, got $bytesLength.",[q6]:"Expected byte array constant [$hexConstant] to be present in data [$hexData] at offset [$offset].",[$6]:"Invalid discriminated union variant. Expected one of [$variants], got $value.",[V6]:"Invalid enum variant. Expected one of [$stringValues] or a number in [$formattedNumericalValues], got $variant.",[Y6]:"Invalid literal union variant. Expected one of [$variants], got $value.",[pA]:"Expected [$codecDescription] to have $expected items, got $actual.",[qA]:"Invalid value $value for base $base with alphabet $alphabet.",[Z6]:"Literal union discriminator out of range. Expected a number between $minRange and $maxRange, got $discriminator.",[uA]:"Codec [$codecDescription] expected number to be in the range [$min, $max], got $value.",[tP]:"Codec [$codecDescription] expected offset to be in the range [0, $bytesLength], got $offset.",[TQ]:"Expected sentinel [$hexSentinel] to be present in decoded bytes [$hexDecodedBytes].",[W2]:"Union variant out of range. Expected an index between $minRange and $maxRange, got $variant.",[AQ]:"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?",[TJ]:"No random values implementation could be found.",[uq]:"instruction requires an uninitialized account",[PX]:"instruction tries to borrow reference for an account which is already borrowed",[QX]:"instruction left account with an outstanding borrowed reference",[TX]:"program other than the account's owner changed the size of the account data",[yq]:"account data too small for instruction",[AX]:"instruction expected an executable account",[IX]:"An account does not have enough lamports to be rent-exempt",[NX]:"Program arithmetic overflowed",[zX]:"Failed to serialize or deserialize account data: $encodedData",[xX]:"Builtin programs must consume compute units",[VX]:"Cross-program invocation call depth too deep",[KX]:"Computational budget exceeded",[PJ]:"custom program error: #$code",[aq]:"instruction contains duplicate accounts",[CX]:"instruction modifications of multiply-passed account differ",[UX]:"executable accounts must be rent exempt",[GX]:"instruction changed executable accounts data",[JX]:"instruction changed the balance of an executable account",[sq]:"instruction changed executable bit of an account",[fq]:"instruction modified data of an account it does not own",[oq]:"instruction spent from the balance of an account it does not own",[hq]:"generic instruction error",[wX]:"Provided owner is not allowed",[DX]:"Account is immutable",[MX]:"Incorrect authority provided",[lq]:"incorrect program id for instruction",[bq]:"insufficient funds for instruction",[vq]:"invalid account data for instruction",[SX]:"Invalid account owner",[gq]:"invalid program argument",[WX]:"program returned invalid error code",[mq]:"invalid instruction data",[HX]:"Failed to reallocate account data",[XX]:"Provided seeds do not result in a valid address",[EX]:"Accounts data allocations exceeded the maximum allowed per transaction",[BX]:"Max accounts exceeded",[OX]:"Max instruction trace length exceeded",[qX]:"Length of the seed is too long for address generation",[YX]:"An account required by the instruction is missing",[pq]:"missing required signature for instruction",[cq]:"instruction illegally modified the program id of an account",[eq]:"insufficient account keys for instruction",[jX]:"Cross-program invocation with unauthorized signer or writable account",[RX]:"Failed to create program execution environment",[FX]:"Program failed to compile",[kX]:"Program failed to complete",[iq]:"instruction modified data of a read-only account",[nq]:"instruction changed the balance of a read-only account",[ZX]:"Cross-program invocation reentrancy not allowed for this instruction",[tq]:"instruction modified rent epoch of an account",[rq]:"sum of account balances before and after instruction do not match",[dq]:"instruction requires an initialized account",[AJ]:"",[$X]:"Unsupported program id",[LX]:"Unsupported sysvar",[vH]:"Invalid instruction plan kind: $kind.",[DH]:"The provided instruction plan is empty.",[MH]:"The provided transaction plan failed to execute. See the `transactionPlanResult` attribute and the `cause` error for more details.",[kH]:"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).",[yH]:"Invalid transaction plan kind: $kind.",[FH]:"No more instructions to pack; the message packer has completed the instruction plan.",[Oq]:"The instruction does not have any accounts.",[xq]:"The instruction does not have any data.",[_q]:"Expected instruction to have progress address $expectedProgramAddress, got $actualProgramAddress.",[pG]:"Expected base58 encoded blockhash to decode to a byte array of length 32. Actual length: $actualLength.",[yG]:"The nonce `$expectedNonceValue` is no longer valid. It has advanced to `$actualNonceValue`",[gH]:"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",[mH]:"Invariant violation: This data publisher does not publish to the channel named `$channelName`. Supported channels include $supportedChannelNames.",[hH]:"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",[_H]:"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",[PQ]:"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",[Aq]:"JSON-RPC error: Internal JSON-RPC error ($__serverMessage)",[Pq]:"JSON-RPC error: Invalid method parameter(s) ($__serverMessage)",[Cq]:"JSON-RPC error: The JSON sent is not a valid `Request` object ($__serverMessage)",[Qq]:"JSON-RPC error: The method does not exist / is not available ($__serverMessage)",[Tq]:"JSON-RPC error: An error occurred on the server while parsing the JSON text ($__serverMessage)",[Zq]:"$__serverMessage",[zq]:"$__serverMessage",[Fq]:"$__serverMessage",[Vq]:"$__serverMessage",[Jq]:"Epoch rewards period still active at slot $slot",[Xq]:"$__serverMessage",[Hq]:"$__serverMessage",[Wq]:"Failed to query long-term storage; please try again",[Uq]:"Minimum context slot has not been reached",[kq]:"Node is unhealthy; behind by $numSlotsBehind slots",[Kq]:"No snapshot",[Mq]:"Transaction simulation failed",[Gq]:"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",[jq]:"$__serverMessage",[qq]:"Transaction history is not available from this node",[Rq]:"$__serverMessage",[Yq]:"Transaction signature length mismatch",[Dq]:"Transaction signature verification failure",[$q]:"$__serverMessage",[Nq]:"Key pair bytes must be of length 64, got $byteLength.",[Lq]:"Expected private key bytes with length 32. Actual length: $actualLength.",[wq]:"Expected base58-encoded signature to decode to a byte array of length 64. Actual length: $actualLength.",[Bq]:"The provided private key does not match the provided public key.",[Eq]:"Expected base58-encoded signature string of length in the range [64, 88]. Actual length: $actualLength.",[uG]:"Lamports value must be in the range [0, 2e64-1]",[dG]:"`$value` cannot be parsed as a `BigInt`",[eZ]:"$message",[rG]:"`$value` cannot be parsed as a `Number`",[bG]:"No nonce account could be found at address `$nonceAccountAddress`",[wH]:"The notification name must end in 'Notifications' and the API must supply a subscription plan creator function for the notification '$notificationName'.",[BH]:"WebSocket was closed before payload could be added to the send buffer",[OH]:"WebSocket connection closed",[xH]:"WebSocket failed to connect",[EH]:"Failed to obtain a subscription id from the server",[LH]:"Could not find an API plan for RPC method: `$method`",[IH]:"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`.",[NH]:"HTTP error ($statusCode): $message",[SH]:"HTTP header(s) forbidden: $headers. Learn more at https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name.",[bP]:"Multiple distinct signers were identified for address `$address`. Please ensure that you are using the same signer instance for each address.",[QJ]:"The provided value does not implement the `KeyPairSigner` interface",[WJ]:"The provided value does not implement the `MessageModifyingSigner` interface",[GJ]:"The provided value does not implement the `MessagePartialSigner` interface",[CJ]:"The provided value does not implement any of the `MessageSigner` interfaces",[UJ]:"The provided value does not implement the `TransactionModifyingSigner` interface",[$J]:"The provided value does not implement the `TransactionPartialSigner` interface",[VJ]:"The provided value does not implement the `TransactionSendingSigner` interface",[JJ]:"The provided value does not implement any of the `TransactionSigner` interfaces",[YJ]:"More than one `TransactionSendingSigner` was identified.",[ZJ]:"No `TransactionSendingSigner` was identified. Please provide a valid `TransactionWithSingleSendingSigner` transaction.",[_X]:"Wallet account signers do not support signing multiple messages/transactions in a single operation",[Sq]:"Cannot export a non-extractable key.",[hP]:"No digest implementation could be found.",[_P]:"Cryptographic operations are only allowed in secure browser contexts. Read more here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts.",[gP]:`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.`,[mP]:"No signature verification implementation could be found.",[vP]:"No key generation implementation could be found.",[yP]:"No signing implementation could be found.",[eG]:"No key export implementation could be found.",[cG]:"Timestamp value must be in the range [-(2n ** 63n), (2n ** 63n) - 1]. `$value` given",[AH]:"Transaction processing left an account with an outstanding borrowed reference",[lX]:"Account in use",[pX]:"Account loaded twice",[uX]:"Attempt to debit an account but found no record of a prior credit.",[UH]:"Transaction loads an address table account that doesn't exist",[oX]:"This transaction has already been processed",[fX]:"Blockhash not found",[nX]:"Loader call chain is too deep",[TH]:"Transactions are currently disabled due to cluster maintenance",[DJ]:"Transaction contains a duplicate instruction ($index) that is not allowed",[rX]:"Insufficient funds for fee",[MJ]:"Transaction results in an account ($accountIndex) with insufficient funds for rent",[cX]:"This account may not be used to pay transaction fees",[aX]:"Transaction contains an invalid account reference",[VH]:"Transaction loads an address table account with invalid data",[YH]:"Transaction address table lookup uses an invalid index",[$H]:"Transaction loads an address table account with an invalid owner",[KH]:"LoadedAccountsDataSizeLimit set for transaction must be greater than 0.",[tX]:"This program may not be used for executing instructions",[ZH]:"Transaction leaves an account with a lower balance than rent-exempt minimum",[CH]:"Transaction loads a writable account that cannot be written",[HH]:"Transaction exceeded max loaded accounts data size cap",[iX]:"Transaction requires a fee but has no signature present",[dX]:"Attempt to load a program that does not exist",[zJ]:"Execution of the program referenced by account at index $accountIndex is temporarily restricted.",[jH]:"ResanitizationNeeded",[eX]:"Transaction failed to sanitize accounts offsets correctly",[sX]:"Transaction did not pass signature verification",[JH]:"Transaction locked too many accounts",[RH]:"Sum of account balances before and after transaction do not match",[FJ]:"The transaction failed with the error `$errorName`",[QH]:"Transaction version is unsupported",[GH]:"Transaction would exceed account data limit within the block",[XH]:"Transaction would exceed total account data limit",[WH]:"Transaction would exceed max account limit within the block",[PH]:"Transaction would exceed max Block Cost Limit",[qH]:"Transaction would exceed max Vote Cost Limit",[oP]:"Attempted to sign a transaction with an address that is not a signer for it",[hX]:"Transaction is missing an address at index: $index.",[fP]:"Transaction has no expected signers therefore it cannot be encoded",[RJ]:"Transaction size $transactionSize exceeds limit of $transactionSizeLimit bytes",[pP]:"Transaction does not have a blockhash lifetime",[uP]:"Transaction is not a durable nonce transaction",[qJ]:"Contents of these address lookup tables unknown: $lookupTableAddresses",[XJ]:"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",[KJ]:"No fee payer set in CompiledTransaction",[HJ]:"Could not find program address at index $index",[yX]:"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",[bX]:"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",[gX]:"Transaction is missing a fee payer.",[cP]:"Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer.",[vX]:"Transaction first instruction is not advance nonce account instruction.",[mX]:"Transaction with no instructions cannot be durable nonce transaction.",[lP]:"This transaction includes an address (`$programAddress`) which is both invoked and set as the fee payer. Program addresses may not pay fees",[Q6]:"This transaction includes an address (`$programAddress`) which is both invoked and marked writable. Program addresses may not be writable",[jJ]:"The transaction message expected the transaction to have $numRequiredSignatures signatures, got $signaturesLength.",[rP]:"Transaction is missing signatures for addresses: $addresses.",[dP]:"Transaction version must be in the range [0, 127]. `$actualVersion` given",[nP]:"This version of Kit does not support decoding transactions with version $unsupportedVersion. The current max supported version is 0.",[kJ]:"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."},d0="i",N0="t";function lH(T,A={}){let P=bH[T];if(P.length===0)return"";let Q;function C(G){if(Q[N0]===2){let U=P.slice(Q[d0]+1,G);W.push(U in A?`${A[U]}`:`$${U}`)}else if(Q[N0]===1)W.push(P.slice(Q[d0],G))}let W=[];return P.split("").forEach((G,U)=>{if(U===0){Q={[d0]:0,[N0]:P[0]==="\\"?0:P[0]==="$"?2:1};return}let $;switch(Q[N0]){case 0:$={[d0]:U,[N0]:1};break;case 1:if(G==="\\")$={[d0]:U,[N0]:0};else if(G==="$")$={[d0]:U,[N0]:2};break;case 2:if(G==="\\")$={[d0]:U,[N0]:0};else if(G==="$")$={[d0]:U,[N0]:2};else if(!G.match(/\w/))$={[d0]:U,[N0]:1};break}if($){if(Q!==$)C(U);Q=$}}),C(),W.join("")}function pH(T,A={}){return lH(T,A)}function QQ(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=pH(T,P);super(C,Q);this.context=P===void 0?{}:P,this.context.__code=T,this.name="SolanaError"}};function uH(...T){if("captureStackTrace"in Error&&typeof Error.captureStackTrace==="function")Error.captureStackTrace(...T)}function IJ({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 U=P.indexOf(W),$=T+U,q=A($,W,G),X=new e($,q);return uH(X,C),X}var dH=["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 SJ(T,A){let P=Number(T);return IJ({errorCodeBaseOffset:4615001,getErrorContext(Q,C,W){if(Q===AJ)return{errorName:C,index:P,...W!==void 0?{instructionErrorContext:W}:null};else if(Q===PJ)return{code:Number(W),index:P};return{index:P}},orderedErrorNames:dH,rpcEnumError:A},SJ)}var rH=["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 H6(T){if(typeof T==="object"&&"InstructionError"in T)return SJ(...T.InstructionError);return IJ({errorCodeBaseOffset:7050001,getErrorContext(A,P,Q){if(A===FJ)return{errorName:P,...Q!==void 0?{transactionErrorContext:Q}:null};else if(A===DJ)return{index:Number(Q)};else if(A===MJ||A===zJ)return{accountIndex:Number(Q.account_index)}},orderedErrorNames:rH,rpcEnumError:T},H6)}function cH(T,A){return"fixedSize"in A?A.fixedSize:A.getSizeFromValue(T)}function NJ(T){return Object.freeze({...T,encode:(A)=>{let P=new Uint8Array(cH(A,T));return T.write(A,P,0),P}})}var LJ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",wJ=()=>{return NJ({getSizeFromValue:(T)=>{try{return atob(T).length}catch{throw new e(qA,{alphabet:LJ,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:LJ,base:64,value:T})}}})};var{TextDecoder:zN,TextEncoder:IN}=globalThis;function XA(T,A){try{if("exists"in T&&!T.exists)return T;return Object.freeze({...T,data:A.decode(T.data)})}catch{throw new e(xP,{address:T.address})}}function oH(T,A){if(!A)return Object.freeze({address:T,exists:!1});let P=wJ().encode(A.data[0]);return Object.freeze({...fH(A),address:T,data:P,exists:!0})}function fH(T){return Object.freeze({executable:T.executable,lamports:T.lamports,programAddress:T.owner,space:T.space})}async function HA(T,A,P={}){let{abortSignal:Q,...C}=P,W=await T.getAccountInfo(A,{...C,encoding:"base64"}).send({abortSignal:Q});return oH(A,W.value)}function KA(T){if(!T.exists)throw new e(OP,{address:T.address})}function nH(T,A){if(T.length>=A)return T;let P=new Uint8Array(A).fill(0);return P.set(T),P}var iH=(T,A)=>nH(T.length<=A?T:T.slice(0,A),A);function aH(T,A){return"fixedSize"in A?A.fixedSize:A.getSizeFromValue(T)}function K6(T){return Object.freeze({...T,encode:(A)=>{let P=new Uint8Array(aH(A,T));return T.write(A,P,0),P}})}function CQ(T){return Object.freeze({...T,decode:(A,P=0)=>T.read(A,P)[0]})}function jA(T){return"fixedSize"in T&&typeof T.fixedSize==="number"}function sH(T){return!jA(T)}function WQ(T,A){if(jA(T)!==jA(A))throw new e(W6);if(jA(T)&&jA(A)&&T.fixedSize!==A.fixedSize)throw new e(G6,{decoderFixedSize:A.fixedSize,encoderFixedSize:T.fixedSize});if(!jA(T)&&!jA(A)&&T.maxSize!==A.maxSize)throw new e(J6,{decoderMaxSize:A.maxSize,encoderMaxSize:T.maxSize});return{...A,...T,decode:A.decode,encode:T.encode,read:A.read,write:T.write}}function tH(T,A,P,Q=0){let C=P.length-Q;if(C<A)throw new e(C2,{bytesLength:C,codecDescription:T,expected:A})}function EJ(T,A){return K6({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 BJ(T,A){return CQ({fixedSize:A,read:(P,Q)=>{if(tH("fixCodecSize",A,P,Q),Q>0||P.length>A)P=P.slice(Q,Q+A);if(jA(T))P=iH(P,T.fixedSize);let[C]=T.read(P,0);return[C,Q+A]}})}function OJ(T,A){return K6({...sH(T)?{...T,getSizeFromValue:(P)=>T.getSizeFromValue(A(P))}:T,write:(P,Q,C)=>T.write(A(P),Q,C)})}function eH(T,A,P=A){if(!A.match(new RegExp(`^[${T}]*$`)))throw new e(qA,{alphabet:T,base:T.length,value:P})}var TK=(T)=>{return K6({getSizeFromValue:(A)=>{let[P,Q]=xJ(A,T[0]);if(!Q)return A.length;let C=_J(Q,T);return P.length+Math.ceil(C.toString(16).length/2)},write(A,P,Q){if(eH(T,A),A==="")return Q;let[C,W]=xJ(A,T[0]);if(!W)return P.set(new Uint8Array(C.length).fill(0),Q),Q+C.length;let G=_J(W,T),U=[];while(G>0n)U.unshift(Number(G%256n)),G/=256n;let $=[...Array(C.length).fill(0),...U];return P.set($,Q),Q+$.length}})},AK=(T)=>{return CQ({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(($,q)=>$*256n+BigInt(q),0n),U=PK(G,T);return[W+U,A.length]}})};function xJ(T,A){let[P,Q]=T.split(new RegExp(`((?!${A}).*)`));return[P,Q]}function _J(T,A){let P=BigInt(A.length),Q=0n;for(let C of T)Q*=P,Q+=BigInt(A.indexOf(C));return Q}function PK(T,A){let P=BigInt(A.length),Q=[];while(T>0n)Q.unshift(A[Number(T%P)]),T/=P;return Q.join("")}var hJ="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",gJ=()=>TK(hJ),mJ=()=>AK(hJ);var{TextDecoder:hN,TextEncoder:gN}=globalThis;function j6(){if(!globalThis.isSecureContext)throw new e(_P)}var dA;async function QK(T){if(dA===void 0)dA=new Promise((A)=>{T.generateKey("Ed25519",!1,["sign","verify"]).then(()=>{A(dA=!0)}).catch(()=>{A(dA=!1)})});if(typeof dA==="boolean")return dA;else return await dA}function vJ(){if(j6(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.digest!=="function")throw new e(hP)}async function yJ(){if(j6(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.generateKey!=="function")throw new e(vP);if(!await QK(globalThis.crypto.subtle))throw new e(gP)}function GQ(){if(j6(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.exportKey!=="function")throw new e(mP)}function bJ(){if(j6(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.sign!=="function")throw new e(yP)}var JQ,UQ;function $Q(){if(!JQ)JQ=gJ();return JQ}function CK(){if(!UQ)UQ=mJ();return UQ}function R6(T){if(T.length<32||T.length>44)return!1;let A=$Q();try{return A.encode(T).byteLength===32}catch{return!1}}function VQ(T){if(T.length<32||T.length>44)throw new e(A6,{actualLength:T.length});let Q=$Q().encode(T).byteLength;if(Q!==32)throw new e(T6,{actualLength:Q})}function _(T){return VQ(T),T}function O1(){return OJ(EJ($Q(),32),(T)=>_(T))}function S1(){return BJ(CK(),32)}function WK(){return WQ(O1(),S1())}function k6(){return new Intl.Collator("en",{caseFirst:"lower",ignorePunctuation:!1,localeMatcher:"best fit",numeric:!1,sensitivity:"variant",usage:"sort"}).compare}var GK=37095705934669439343138083508754565189542113879843219016388785533085940283555n,lT=57896044618658097711785492504343953926634992332820282019728792003956564819949n,lJ=19681161376707505956807079304988542015446066515923890162744021073123829784752n;function V0(T){let A=T%lT;return A>=0n?A:lT+A}function L0(T,A){let P=T;while(A-- >0n)P*=P,P%=lT;return P}function JK(T){let P=T*T%lT*T%lT,Q=L0(P,2n)*P%lT,C=L0(Q,1n)*T%lT,W=L0(C,5n)*C%lT,G=L0(W,10n)*W%lT,U=L0(G,20n)*G%lT,$=L0(U,40n)*U%lT,q=L0($,80n)*$%lT,X=L0(q,80n)*$%lT,K=L0(X,10n)*W%lT;return L0(K,2n)*T%lT}function UK(T,A){let P=V0(A*A*A),Q=V0(P*P*A),C=JK(T*Q),W=V0(T*P*C),G=V0(A*W*W),U=W,$=V0(W*lJ),q=G===T,X=G===V0(-T),K=G===V0(-T*lJ);if(q)W=U;if(X||K)W=$;if((V0(W)&1n)===1n)W=V0(-W);if(!q&&!X)return null;return W}function $K(T,A){let P=V0(T*T),Q=V0(P-1n),C=V0(GK*P+1n),W=UK(Q,C);if(W===null)return!1;let G=(A&128)!==0;if(W===0n&&G)return!1;return!0}function VK(T){let A=T.toString(16);if(A.length===1)return`0${A}`;else return A}function YK(T){let P=`0x${T.reduce((Q,C,W)=>`${VK(W===31?C&-129:C)}${Q}`,"")}`;return BigInt(P)}function ZK(T){if(T.byteLength!==32)return!1;let A=YK(T);return $K(A,T[31])}var pJ=32,uJ=16,qK=[80,114,111,103,114,97,109,68,101,114,105,118,101,100,65,100,100,114,101,115,115];async function XK({programAddress:T,seeds:A}){if(vJ(),A.length>uJ)throw new e(wP,{actual:A.length,maxSeeds:uJ});let P,Q=A.reduce(($,q,X)=>{let K=typeof q==="string"?(P||=new TextEncoder).encode(q):q;if(K.byteLength>pJ)throw new e(EP,{actual:K.byteLength,index:X,maxSeedLength:pJ});return $.push(...K),$},[]),C=WK(),W=C.encode(T),G=await crypto.subtle.digest("SHA-256",new Uint8Array([...Q,...W,...qK])),U=new Uint8Array(G);if(ZK(U))throw new e(P6);return C.decode(U)}async function X1({programAddress:T,seeds:A}){let P=255;while(P>0)try{return[await XK({programAddress:T,seeds:[...A,new Uint8Array([P])]}),P]}catch(Q){if(QQ(Q,P6))P--;else throw Q}throw new e(BP)}async function F6(T){if(GQ(),T.type!=="public"||T.algorithm.name!=="Ed25519")throw new e(LP);let A=await crypto.subtle.exportKey("raw",T);return S1().decode(new Uint8Array(A))}function HK(T,A){if(T.length>=A)return T;let P=new Uint8Array(A).fill(0);return P.set(T),P}var KK=(T,A)=>HK(T.length<=A?T:T.slice(0,A),A);function F8(T,A){return"fixedSize"in A?A.fixedSize:A.getSizeFromValue(T)}function Y0(T){return Object.freeze({...T,encode:(A)=>{let P=new Uint8Array(F8(A,T));return T.write(A,P,0),P}})}function c0(T){return Object.freeze({...T,decode:(A,P=0)=>T.read(A,P)[0]})}function r0(T){return"fixedSize"in T&&typeof T.fixedSize==="number"}function jK(T){return!r0(T)}function dJ(T,A,P=0){if(A.length-P<=0)throw new e(C6,{codecDescription:T})}function D6(T,A,P,Q=0){let C=P.length-Q;if(C<A)throw new e(C2,{bytesLength:C,codecDescription:T,expected:A})}function M6(T,A){let P=(G,U,$)=>{let q=T.encode(G);return $=A.write(q.length,U,$),U.set(q,$),$+q.length};if(r0(A)&&r0(T))return Y0({...T,fixedSize:A.fixedSize+T.fixedSize,write:P});let Q=r0(A)?A.fixedSize:A.maxSize??null,C=r0(T)?T.fixedSize:T.maxSize??null,W=Q!==null&&C!==null?Q+C:null;return Y0({...T,...W!==null?{maxSize:W}:{},getSizeFromValue:(G)=>{let U=F8(G,T);return F8(U,A)+U},write:P})}function jT(T,A){return Y0({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 xT(T,A){return c0({fixedSize:A,read:(P,Q)=>{if(D6("fixCodecSize",A,P,Q),Q>0||P.length>A)P=P.slice(Q,Q+A);if(r0(T))P=KK(P,T.fixedSize);let[C]=T.read(P,0);return[C,Q+A]}})}function ZT(T,A){return Y0({...jK(T)?{...T,getSizeFromValue:(P)=>T.getSizeFromValue(A(P))}:T,write:(P,Q,C)=>T.write(A(P),Q,C)})}function rJ(T,A){return c0({...T,read:(P,Q)=>{let[C,W]=T.read(P,Q);return[A(C,P,Q),W]}})}function RK(T,A,P,Q){if(Q<A||Q>P)throw new e(uA,{codecDescription:T,max:P,min:A,value:Q})}function cJ(T){return T?.endian===1?!1:!0}function YQ(T){return Y0({fixedSize:T.size,write(A,P,Q){if(T.range)RK(T.name,T.range[0],T.range[1],A);let C=new ArrayBuffer(T.size);return T.set(new DataView(C),A,cJ(T.config)),P.set(new Uint8Array(C),Q),Q+T.size}})}function G2(T){return c0({fixedSize:T.size,read(A,P=0){dJ(T.name,A,P),D6(T.name,T.size,A,P);let Q=new DataView(kK(A,P,T.size));return[T.get(Q,cJ(T.config)),P+T.size]}})}function kK(T,A,P){let Q=T.byteOffset+(A??0),C=P??T.byteLength;return T.buffer.slice(Q,Q+C)}var oJ=(T={})=>G2({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 fJ=(T={})=>G2({config:T,get:(A,P)=>A.getUint16(0,P),name:"u16",size:2});var J2=(T={})=>YQ({config:T,name:"u32",range:[0,Number("0xffffffff")],set:(A,P,Q)=>A.setUint32(0,Number(P),Q),size:4}),ZQ=(T={})=>G2({config:T,get:(A,P)=>A.getUint32(0,P),name:"u32",size:4});var F1=(T={})=>YQ({config:T,name:"u64",range:[0n,BigInt("0xffffffffffffffff")],set:(A,P,Q)=>A.setBigUint64(0,BigInt(P),Q),size:8}),N1=(T={})=>G2({config:T,get:(A,P)=>A.getBigUint64(0,P),name:"u64",size:8});var U2=()=>YQ({name:"u8",range:[0,Number("0xff")],set:(T,A)=>T.setUint8(0,Number(A)),size:1}),RA=()=>G2({get:(T)=>T.getUint8(0),name:"u8",size:1});function FK(T,A,P){if(A!==P)throw new e(pA,{actual:P,codecDescription:T,expected:A})}function D8(T){return T.reduce((A,P)=>A===null||P===null?null:A+P,0)}function z6(T){return r0(T)?T.fixedSize:null}function I6(T){return r0(T)?T.fixedSize:T.maxSize??null}function S6(T,A={}){let P=A.size??ZQ(),Q=z6(T),C=nJ(P,Q),W=nJ(P,I6(T))??void 0;return c0({...C!==null?{fixedSize:C}:{maxSize:W},read:(G,U)=>{let $=[];if(typeof P==="object"&&G.slice(U).length===0)return[$,U];if(P==="remainder"){while(U<G.length){let[K,F]=T.read(G,U);U=F,$.push(K)}return[$,U]}let[q,X]=typeof P==="number"?[P,U]:P.read(G,U);U=X;for(let K=0;K<q;K+=1){let[F,M]=T.read(G,U);U=M,$.push(F)}return[$,U]}})}function nJ(T,A){if(typeof T!=="number")return null;if(T===0)return 0;return A===null?null:A*T}function $2(T={}){return ZT(T.size??U2(),(A)=>A?1:0)}function N6(T={}){return rJ(T.size??RA(),(A)=>Number(A)===1)}function DT(){return Y0({getSizeFromValue:(T)=>T.length,write:(T,A,P)=>{return A.set(T,P),P+T.length}})}function pT(){return c0({read:(T,A)=>{let P=T.slice(A);return[P,A+P.length]}})}function L6(T){let A=D8(T.map(z6)),P=D8(T.map(I6))??void 0;return Y0({...A===null?{getSizeFromValue:(Q)=>T.map((C,W)=>F8(Q[W],C)).reduce((C,W)=>C+W,0),maxSize:P}:{fixedSize:A},write:(Q,C,W)=>{return FK("tuple",T.length,Q.length),T.forEach((G,U)=>{W=G.write(Q[U],C,W)}),W}})}function qT(T){let A=T.map(([,C])=>C),P=D8(A.map(z6)),Q=D8(A.map(I6))??void 0;return Y0({...P===null?{getSizeFromValue:(C)=>T.map(([W,G])=>F8(C[W],G)).reduce((W,G)=>W+G,0),maxSize:Q}:{fixedSize:P},write:(C,W,G)=>{return T.forEach(([U,$])=>{G=$.write(C[U],W,G)}),G}})}function RT(T){let A=T.map(([,C])=>C),P=D8(A.map(z6)),Q=D8(A.map(I6))??void 0;return c0({...P===null?{maxSize:Q}:{fixedSize:P},read:(C,W)=>{let G={};return T.forEach(([U,$])=>{let[q,X]=$.read(C,W);W=X,G[U]=q}),[G,W]}})}var{TextDecoder:P3,TextEncoder:iJ}=globalThis,w6=()=>{let T;return Y0({getSizeFromValue:(A)=>(T||=new iJ).encode(A).length,write:(A,P,Q)=>{let C=(T||=new iJ).encode(A);return P.set(C,Q),Q+C.length}})};var H1=((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})(H1||{}),DK=2,MK=1;function o0(T){return T>=2}function M8(T){return(T&MK)!==0}function qQ(T,A){return T|A}function E6(T){return T|DK}function sJ(T){return R6(T)}function aJ(T){switch(T){case"finalized":return 2;case"confirmed":return 1;case"processed":return 0;default:throw new e(PQ,{unexpectedValue:T})}}function B6(T,A){if(T===A)return 0;return aJ(T)<aJ(A)?-1:1}var J3=-9223372036854775808n;function kA(T,A){return"fixedSize"in A?A.fixedSize:A.getSizeFromValue(T)}function MT(T){return Object.freeze({...T,encode:(A)=>{let P=new Uint8Array(kA(A,T));return T.write(A,P,0),P}})}function w0(T){return"fixedSize"in T&&typeof T.fixedSize==="number"}function zK(T){return!w0(T)}function tJ(T,A){let P=(G,U,$)=>{let q=T.encode(G);return $=A.write(q.length,U,$),U.set(q,$),$+q.length};if(w0(A)&&w0(T))return MT({...T,fixedSize:A.fixedSize+T.fixedSize,write:P});let Q=w0(A)?A.fixedSize:A.maxSize??null,C=w0(T)?T.fixedSize:T.maxSize??null,W=Q!==null&&C!==null?Q+C:null;return MT({...T,...W!==null?{maxSize:W}:{},getSizeFromValue:(G)=>{let U=kA(G,T);return kA(U,A)+U},write:P})}function XQ(T,A){return MT({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 O6(T,A){return MT({...zK(T)?{...T,getSizeFromValue:(P)=>T.getSizeFromValue(A(P))}:T,write:(P,Q,C)=>T.write(A(P),Q,C)})}function AU(T,A,P,Q){if(Q<A||Q>P)throw new e(uA,{codecDescription:T,max:P,min:A,value:Q})}function SK(T){return T?.endian===1?!1:!0}function PU(T){return MT({fixedSize:T.size,write(A,P,Q){if(T.range)AU(T.name,T.range[0],T.range[1],A);let C=new ArrayBuffer(T.size);return T.set(new DataView(C),A,SK(T.config)),P.set(new Uint8Array(C),Q),Q+T.size}})}var rA=()=>MT({getSizeFromValue:(T)=>{if(T<=127)return 1;if(T<=16383)return 2;return 3},maxSize:3,write:(T,A,P)=>{AU("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 QU=(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 EK(T,A,P){if(A!==P)throw new e(pA,{actual:P,codecDescription:T,expected:A})}function BK(T){return T.reduce((A,P)=>A===null||P===null?null:Math.max(A,P),0)}function CU(T){return T.reduce((A,P)=>A===null||P===null?null:A+P,0)}function JU(T){return w0(T)?T.fixedSize:null}function HQ(T){return w0(T)?T.fixedSize:T.maxSize??null}function I8(T,A={}){let P=A.size??QU(),Q=WU(P,JU(T)),C=WU(P,HQ(T))??void 0;return MT({...Q!==null?{fixedSize:Q}:{getSizeFromValue:(W)=>{return(typeof P==="object"?kA(W.length,P):0)+[...W].reduce((U,$)=>U+kA($,T),0)},maxSize:C},write:(W,G,U)=>{if(typeof P==="number")EK("array",P,W.length);if(typeof P==="object")U=P.write(W.length,G,U);return W.forEach(($)=>{U=T.write($,G,U)}),U}})}function WU(T,A){if(typeof T!=="number")return null;if(T===0)return 0;return A===null?null:A*T}function UU(){return MT({getSizeFromValue:(T)=>T.length,write:(T,A,P)=>{return A.set(T,P),P+T.length}})}function $U(T){return MT({fixedSize:T.length,write:(A,P,Q)=>{return P.set(T,Q),Q+T.length}})}function VU(T,A){let P=OK(T),Q=(W,G,U)=>{let $=A(W);return GU(T,$),T[$].write(W,G,U)};if(P!==null)return MT({fixedSize:P,write:Q});let C=xK(T);return MT({...C!==null?{maxSize:C}:{},getSizeFromValue:(W)=>{let G=A(W);return GU(T,G),kA(W,T[G])},write:Q})}function GU(T,A){if(typeof T[A]>"u")throw new e(W2,{maxRange:T.length-1,minRange:0,variant:A})}function OK(T){if(T.length===0)return 0;if(!w0(T[0]))return null;let A=T[0].fixedSize;return T.every((Q)=>w0(Q)&&Q.fixedSize===A)?A:null}function xK(T){return BK(T.map((A)=>HQ(A)))}function S8(T){let A=T.map(([,C])=>C),P=CU(A.map(JU)),Q=CU(A.map(HQ))??void 0;return MT({...P===null?{getSizeFromValue:(C)=>T.map(([W,G])=>kA(C[W],G)).reduce((W,G)=>W+G,0),maxSize:Q}:{fixedSize:P},write:(C,W,G)=>{return T.forEach(([U,$])=>{G=$.write(C[U],W,G)}),G}})}function KU(T){return"lifetimeConstraint"in T&&typeof T.lifetimeConstraint.blockhash==="string"&&typeof T.lifetimeConstraint.lastValidBlockHeight==="bigint"&&sJ(T.lifetimeConstraint.blockhash)}function jU(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 _K(T,A,P=A){if(!A.match(new RegExp(`^[${T}]*$`)))throw new e(qA,{alphabet:T,base:T.length,value:P})}var hK=(T)=>{return MT({getSizeFromValue:(A)=>{let[P,Q]=YU(A,T[0]);if(!Q)return A.length;let C=ZU(Q,T);return P.length+Math.ceil(C.toString(16).length/2)},write(A,P,Q){if(_K(T,A),A==="")return Q;let[C,W]=YU(A,T[0]);if(!W)return P.set(new Uint8Array(C.length).fill(0),Q),Q+C.length;let G=ZU(W,T),U=[];while(G>0n)U.unshift(Number(G%256n)),G/=256n;let $=[...Array(C.length).fill(0),...U];return P.set($,Q),Q+$.length}})};function YU(T,A){let[P,Q]=T.split(new RegExp(`((?!${A}).*)`));return[P,Q]}function ZU(T,A){let P=BigInt(A.length),Q=0n;for(let C of T)Q*=P,Q+=BigInt(A.indexOf(C));return Q}var gK="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",mK=()=>hK(gK);var KQ;function vK(){if(!KQ){let T=I8(z8(),{size:rA()});KQ=S8([["lookupTableAddress",O1()],["writableIndexes",T],["readonlyIndexes",T]])}return KQ}var jQ;function RQ(){if(!jQ)jQ=z8();return jQ}function yK(){return S8([["numSignerAccounts",RQ()],["numReadonlySignerAccounts",RQ()],["numReadonlyNonSignerAccounts",RQ()]])}var kQ;function bK(){if(!kQ)kQ=O6(S8([["programAddressIndex",z8()],["accountIndices",I8(z8(),{size:rA()})],["data",tJ(UU(),rA())]]),(T)=>{if(T.accountIndices!==void 0&&T.data!==void 0)return T;return{...T,accountIndices:T.accountIndices??[],data:T.data??new Uint8Array(0)}});return kQ}var lK=0,pK=128;function uK(){return MT({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(dP,{actualVersion:T});if(T>lK)throw new e(nP,{unsupportedVersion:T});return A.set([T|pK],P),P+1}})}function qU(){return S8(RU())}function XU(){return O6(S8([...RU(),["addressTableLookups",dK()]]),(T)=>{if(T.version==="legacy")return T;return{...T,addressTableLookups:T.addressTableLookups??[]}})}function RU(){let T=VU([$U(new Uint8Array(32)),XQ(mK(),32)],(A)=>A===void 0?0:1);return[["version",uK()],["header",yK()],["staticAccounts",I8(O1(),{size:rA()})],["lifetimeToken",T],["instructions",I8(bK(),{size:rA()})]]}function dK(){return I8(vK(),{size:rA()})}function kU(){return MT({getSizeFromValue:(T)=>{if(T.version==="legacy")return qU().getSizeFromValue(T);else return XU().getSizeFromValue(T)},write:(T,A,P)=>{if(T.version==="legacy")return qU().write(T,A,P);else return XU().write(T,A,P)}})}function HU(T,A,P){T[A]=P(T[A]??{role:H1.READONLY})}var XT=Symbol("AddressMapTypeProperty");function rK(T,A){let P={[T]:{[XT]:0,role:H1.WRITABLE_SIGNER}},Q=new Set;for(let C of A){HU(P,C.programAddress,(G)=>{if(Q.add(C.programAddress),XT in G){if(M8(G.role))switch(G[XT]){case 0:throw new e(lP,{programAddress:C.programAddress});default:throw new e(Q6,{programAddress:C.programAddress})}if(G[XT]===2)return G}return{[XT]:2,role:H1.READONLY}});let W;if(!C.accounts)continue;for(let G of C.accounts)HU(P,G.address,(U)=>{let{address:$,...q}=G;if(XT in U)switch(U[XT]){case 0:return U;case 1:{let X=qQ(U.role,q.role);if("lookupTableAddress"in q){if(U.lookupTableAddress!==q.lookupTableAddress&&(W||=k6())(q.lookupTableAddress,U.lookupTableAddress)<0)return{[XT]:1,...q,role:X}}else if(o0(q.role))return{[XT]:2,role:X};if(U.role!==X)return{...U,role:X};else return U}case 2:{let X=qQ(U.role,q.role);if(Q.has(G.address)){if(M8(q.role))throw new e(Q6,{programAddress:G.address});if(U.role!==X)return{...U,role:X};else return U}else if("lookupTableAddress"in q&&!o0(U.role))return{...q,[XT]:1,role:X};else if(U.role!==X)return{...U,role:X};else return U}}if("lookupTableAddress"in q)return{...q,[XT]:1};else return{...q,[XT]:2}})}return P}function cK(T){let A;return Object.entries(T).sort(([Q,C],[W,G])=>{if(C[XT]!==G[XT]){if(C[XT]===0)return-1;else if(G[XT]===0)return 1;else if(C[XT]===2)return-1;else if(G[XT]===2)return 1}let U=o0(C.role);if(U!==o0(G.role))return U?-1:1;let $=M8(C.role);if($!==M8(G.role))return $?-1:1;if(A||=k6(),C[XT]===1&&G[XT]===1&&C.lookupTableAddress!==G.lookupTableAddress)return A(C.lookupTableAddress,G.lookupTableAddress);else return A(Q,W)}).map(([Q,C])=>({address:Q,...C}))}function oK(T){let A={};for(let P of T){if(!("lookupTableAddress"in P))continue;let Q=A[P.lookupTableAddress]||={readonlyIndexes:[],writableIndexes:[]};if(P.role===H1.WRITABLE)Q.writableIndexes.push(P.addressIndex);else Q.readonlyIndexes.push(P.addressIndex)}return Object.keys(A).sort(k6()).map((P)=>({lookupTableAddress:P,...A[P]}))}function fK(T){let A=0,P=0,Q=0;for(let C of T){if("lookupTableAddress"in C)break;let W=M8(C.role);if(o0(C.role)){if(Q++,!W)P++}else if(!W)A++}return{numReadonlyNonSignerAccounts:A,numReadonlySignerAccounts:P,numSignerAccounts:Q}}function nK(T){let A={};for(let[P,Q]of T.entries())A[Q.address]=P;return A}function iK(T,A){let P=nK(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 aK(T){if("nonce"in T)return T.nonce;return T.blockhash}function sK(T){let A=T.findIndex((Q)=>("lookupTableAddress"in Q));return(A===-1?T:T.slice(0,A)).map(({address:Q})=>Q)}function FU(T){let A=rK(T.feePayer.address,T.instructions),P=cK(A),Q=T.lifetimeConstraint;return{...T.version!=="legacy"?{addressTableLookups:oK(P)}:null,...Q?{lifetimeToken:aK(Q)}:null,header:fK(P),instructions:iK(T.instructions,P),staticAccounts:sK(P),version:T.version}}function DU(T){return Object.freeze({instructions:Object.freeze([]),version:T.version})}var tK="SysvarRecentB1ockHashes11111111111111111111",eK="11111111111111111111111111111111";function Tj(T){return T.programAddress===eK&&T.data!=null&&Aj(T.data)&&T.accounts?.length===3&&T.accounts[0].address!=null&&T.accounts[0].role===H1.WRITABLE&&T.accounts[1].address===tK&&T.accounts[1].role===H1.READONLY&&T.accounts[2].address!=null&&o0(T.accounts[2].role)}function Aj(T){return T.byteLength===4&&T[0]===4&&T[1]===0&&T[2]===0&&T[3]===0}function MU(T){return"lifetimeConstraint"in T&&typeof T.lifetimeConstraint.nonce==="string"&&T.instructions[0]!=null&&Tj(T.instructions[0])}function zU(T,A){if("feePayer"in A&&T===A.feePayer?.address&&Pj(A.feePayer))return A;let P={...A,feePayer:Object.freeze({address:T})};return Object.freeze(P),P}function Pj(T){return!!T&&"address"in T&&typeof T.address==="string"&&Object.keys(T).length===1}function IU(T,A){return Qj([T],A)}function Qj(T,A){return Object.freeze({...A,instructions:Object.freeze([...A.instructions,...T])})}function V2(T,A){return"fixedSize"in A?A.fixedSize:A.getSizeFromValue(T)}function E0(T){return Object.freeze({...T,encode:(A)=>{let P=new Uint8Array(V2(A,T));return T.write(A,P,0),P}})}function Y2(T){return Object.freeze({...T,decode:(A,P=0)=>T.read(A,P)[0]})}function x6(T){return"fixedSize"in T&&typeof T.fixedSize==="number"}function Cj(T){return!x6(T)}function FQ(T,A){return E0({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 DQ(T,A){return E0({...Cj(T)?{...T,getSizeFromValue:(P)=>T.getSizeFromValue(A(P))}:T,write:(P,Q,C)=>T.write(A(P),Q,C)})}function SU(T,A,P,Q){if(Q<A||Q>P)throw new e(uA,{codecDescription:T,max:P,min:A,value:Q})}function Gj(T){return T?.endian===1?!1:!0}function Jj(T){return E0({fixedSize:T.size,write(A,P,Q){if(T.range)SU(T.name,T.range[0],T.range[1],A);let C=new ArrayBuffer(T.size);return T.set(new DataView(C),A,Gj(T.config)),P.set(new Uint8Array(C),Q),Q+T.size}})}var NU=()=>E0({getSizeFromValue:(T)=>{if(T<=127)return 1;if(T<=16383)return 2;return 3},maxSize:3,write:(T,A,P)=>{SU("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 LU=(T={})=>Jj({config:T,name:"u32",range:[0,Number("0xffffffff")],set:(A,P,Q)=>A.setUint32(0,Number(P),Q),size:4});function Yj(T,A,P){if(A!==P)throw new e(pA,{actual:P,codecDescription:T,expected:A})}function wU(T){return T.reduce((A,P)=>A===null||P===null?null:A+P,0)}function BU(T){return x6(T)?T.fixedSize:null}function OU(T){return x6(T)?T.fixedSize:T.maxSize??null}function xU(T,A={}){let P=A.size??LU(),Q=EU(P,BU(T)),C=EU(P,OU(T))??void 0;return E0({...Q!==null?{fixedSize:Q}:{getSizeFromValue:(W)=>{return(typeof P==="object"?V2(W.length,P):0)+[...W].reduce((U,$)=>U+V2($,T),0)},maxSize:C},write:(W,G,U)=>{if(typeof P==="number")Yj("array",P,W.length);if(typeof P==="object")U=P.write(W.length,G,U);return W.forEach(($)=>{U=T.write($,G,U)}),U}})}function EU(T,A){if(typeof T!=="number")return null;if(T===0)return 0;return A===null?null:A*T}function zQ(){return E0({getSizeFromValue:(T)=>T.length,write:(T,A,P)=>{return A.set(T,P),P+T.length}})}function _U(T){let A=T.map(([,C])=>C),P=wU(A.map(BU)),Q=wU(A.map(OU))??void 0;return E0({...P===null?{getSizeFromValue:(C)=>T.map(([W,G])=>V2(C[W],G)).reduce((W,G)=>W+G,0),maxSize:Q}:{fixedSize:P},write:(C,W,G)=>{return T.forEach(([U,$])=>{G=$.write(C[U],W,G)}),G}})}var Zj=(T)=>{return Y2({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(($,q)=>$*256n+BigInt(q),0n),U=qj(G,T);return[W+U,A.length]}})};function qj(T,A){let P=BigInt(A.length),Q=[];while(T>0n)Q.unshift(A[Number(T%P)]),T/=P;return Q.join("")}var Xj="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";var hU=()=>Zj(Xj);var gU=()=>{return Y2({read(T,A=0){let P=T.slice(A);return[btoa(String.fromCharCode(...P)),T.length]}})};var{TextDecoder:n3,TextEncoder:i3}=globalThis;var mU=Object.freeze({name:"Ed25519"});async function _6(T,A){bJ();let P=await crypto.subtle.sign(mU,T,A);return new Uint8Array(P)}async function vU(){return await yJ(),await crypto.subtle.generateKey(mU,!1,["sign","verify"])}function Hj(T){let A=Object.values(T);if(A.length===0)throw new e(fP);return A.map((P)=>{if(!P)return new Uint8Array(64).fill(0);return P})}function Kj(){return DQ(xU(FQ(zQ(),64),{size:NU()}),Hj)}function jj(){return _U([["signatures",Kj()],["messageBytes",zQ()]])}function yU(T){let A=FU(T),P=kU().encode(A),Q=A.staticAccounts.slice(0,A.header.numSignerAccounts),C={};for(let G of Q)C[G]=null;let W;if(KU(T))W={blockhash:T.lifetimeConstraint.blockhash,lastValidBlockHeight:T.lifetimeConstraint.lastValidBlockHeight};else if(MU(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 IQ;function h6(T){if(!IQ)IQ=hU();let A=Object.values(T.signatures)[0];if(!A)throw new e(cP);return IQ.decode(A)}function Rj(T,A){return T.length===A.length&&T.every((P,Q)=>P===A[Q])}async function bU(T,A){let P,Q;if(await Promise.all(T.map(async(C)=>{let W=await F6(C.publicKey),G=A.signatures[W];if(G===void 0){Q||=new Set,Q.add(W);return}if(Q)return;let U=await _6(C.privateKey,A.messageBytes);if(G!==null&&Rj(U,G))return;P||={},P[W]=U})),Q&&Q.size>0){let C=Object.keys(A.signatures);throw new e(oP,{expectedAddresses:C,unexpectedAddresses:[...Q]})}if(!P)return A;return Object.freeze({...A,signatures:Object.freeze({...A.signatures,...P})})}function lU(T){let A=[];if(Object.entries(T.signatures).forEach(([P,Q])=>{if(!Q)A.push(P)}),A.length>0)throw new e(rP,{addresses:A})}function g6(T){let A=jj().encode(T);return gU().decode(A)}var kj=1280,Fj=48,KL=kj-Fj;function pU(T){return T!==null&&(typeof T==="object"||typeof T==="function")}function Dj(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 SQ=new WeakMap;async function NQ(T){let A;return await new Promise((Q,C)=>{A={reject:C,resolve:Q};for(let W of T){if(!pU(W)){Promise.resolve(W).then(Q,C);continue}let G=SQ.get(W);if(G===void 0)G=Dj(W),G.deferreds.add(A),SQ.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(pU(Q))SQ.get(Q).deferreds.delete(A)})}function m6(T){let A={};return T.forEach((P)=>{if(!A[P.address])A[P.address]=P;else if(A[P.address]!==P)throw new e(bP,{address:P.address})}),Object.values(A)}function v6(T){return"modifyAndSignTransactions"in T&&typeof T.modifyAndSignTransactions==="function"}function Z2(T){return"signTransactions"in T&&typeof T.signTransactions==="function"}function uU(T){return"signAndSendTransactions"in T&&typeof T.signAndSendTransactions==="function"}function B0(T){return Z2(T)||v6(T)||uU(T)}function Mj(T){return m6((T.accounts??[]).flatMap((A)=>("signer"in A)?A.signer:[]))}function zj(T){return m6([...T.feePayer&&B0(T.feePayer)?[T.feePayer]:[],...T.instructions.flatMap(Mj)])}function Ij(T,A){if(!A.accounts||A.accounts.length===0)return A;let P=new Map(m6(T).map((Q)=>[Q.address,Q]));return Object.freeze({...A,accounts:A.accounts.map((Q)=>{let C=P.get(Q.address);if(!o0(Q.role)||"signer"in Q||!C)return Q;return Object.freeze({...Q,signer:C})})})}function dU(T,A){let P=Sj(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)=>Ij(T,Q))})}function Sj(T){return!!T&&"feePayer"in T&&!!T.feePayer&&typeof T.feePayer.address==="string"&&!B0(T.feePayer)}function rU(T,A){Object.freeze(T);let P={...A,feePayer:T};return Object.freeze(P),P}async function Nj(T){let A=await F6(T.publicKey);return Object.freeze({address:A,keyPair:T,signMessages:(Q)=>Promise.all(Q.map(async(C)=>Object.freeze({[A]:await _6(T.privateKey,C.content)}))),signTransactions:(Q)=>Promise.all(Q.map(async(C)=>{let W=await bU([T],C);return Object.freeze({[A]:W.signatures[A]})}))})}async function cU(){return await Nj(await vU())}async function Lj(T,A){let{partialSigners:P,modifyingSigners:Q}=wj(m6(zj(T).filter(B0)),{identifySendingSigner:!1});return await Oj(T,Q,P,A)}async function LQ(T,A){let P=await Lj(T,A);return lU(P),P}function wj(T,A={}){let Q=A.identifySendingSigner??!0?Ej(T):null,C=T.filter((U)=>U!==Q&&(v6(U)||Z2(U))),W=Bj(C),G=C.filter(Z2).filter((U)=>!W.includes(U));return Object.freeze({modifyingSigners:W,partialSigners:G,sendingSigner:Q})}function Ej(T){let A=T.filter(uU);if(A.length===0)return null;let P=A.filter((Q)=>!v6(Q)&&!Z2(Q));if(P.length>0)return P[0];return A[0]}function Bj(T){let A=T.filter(v6);if(A.length===0)return[];let P=A.filter((Q)=>!Z2(Q));if(P.length>0)return P;return[A[0]]}async function Oj(T,A=[],P=[],Q){let C=yU(T),W=await A.reduce(async(U,$)=>{Q?.abortSignal?.throwIfAborted();let[q]=await $.modifyAndSignTransactions([await U],Q);return Object.freeze(q)},Promise.resolve(C));Q?.abortSignal?.throwIfAborted();let G=await Promise.all(P.map(async(U)=>{let[$]=await U.signTransactions([W],Q);return $}));return Object.freeze({...W,signatures:Object.freeze(G.reduce((U,$)=>{return{...U,...$}},W.signatures??{}))})}var NL=globalThis.TextEncoder;var wQ=globalThis.AbortController;function oU({rpc:T,rpcSubscriptions:A}){return async function({abortSignal:Q,commitment:C,lastValidBlockHeight:W}){Q.throwIfAborted();let G=new wQ,U=()=>{G.abort()};Q.addEventListener("abort",U,{signal:G.signal});async function $(){let{absoluteSlot:q,blockHeight:X}=await T.getEpochInfo({commitment:C}).send({abortSignal:G.signal});return{blockHeight:X,differenceBetweenSlotHeightAndBlockHeight:q-X}}try{let[q,{blockHeight:X,differenceBetweenSlotHeightAndBlockHeight:K}]=await Promise.all([A.slotNotifications().subscribe({abortSignal:G.signal}),$()]);Q.throwIfAborted();let F=X;if(F<=W){let M=K;for await(let I of q){let{slot:E}=I;if(E-M>W){let{blockHeight:L,differenceBetweenSlotHeightAndBlockHeight:O}=await $();if(F=L,F>W)break;else M=O}}}throw Q.throwIfAborted(),new e(NP,{currentBlockHeight:F,lastValidBlockHeight:W})}finally{G.abort()}}}function fU({rpc:T,rpcSubscriptions:A}){return async function({abortSignal:Q,commitment:C,signature:W}){let G=new wQ;function U(){G.abort()}Q.addEventListener("abort",U,{signal:G.signal});let $=await A.signatureNotifications(W,{commitment:C}).subscribe({abortSignal:G.signal}),q=(async()=>{for await(let K of $)if(K.value.err)throw H6(K.value.err);else return})(),X=(async()=>{let{value:K}=await T.getSignatureStatuses([W]).send({abortSignal:G.signal}),F=K[0];if(F?.confirmationStatus&&B6(F.confirmationStatus,C)>=0)return;else if(F?.err)throw H6(F.err);else await new Promise(()=>{})})();try{return await NQ([q,X])}finally{G.abort()}}}async function xj(T,A,P){let{abortSignal:Q,commitment:C,getRecentSignatureConfirmationPromise:W}=A;Q?.throwIfAborted();let G=new wQ;if(Q){let U=()=>{G.abort()};Q.addEventListener("abort",U,{signal:G.signal})}try{let U=P({...A,abortSignal:G.signal});return await NQ([W({abortSignal:G.signal,commitment:C,signature:T}),...U])}finally{G.abort()}}async function nU(T){await xj(h6(T.transaction),T,function({abortSignal:P,commitment:Q,getBlockHeightExceedencePromise:C,transaction:W}){return[C({abortSignal:P,commitment:Q,lastValidBlockHeight:W.lifetimeConstraint.lastValidBlockHeight})]})}function _j(T,A){if(!A?.preflightCommitment&&B6(T,"finalized")<0)return{...A,preflightCommitment:T};return A}async function hj({abortSignal:T,commitment:A,rpc:P,transaction:Q,...C}){let W=g6(Q);return await P.sendTransaction(W,{..._j(A,C),encoding:"base64"}).send({abortSignal:T})}async function gj({abortSignal:T,commitment:A,confirmRecentTransaction:P,rpc:Q,transaction:C,...W}){let G=await hj({...W,abortSignal:T,commitment:A,rpc:Q,transaction:C});return await P({abortSignal:T,commitment:A,transaction:C}),G}function iU({rpc:T,rpcSubscriptions:A}){let P=oU({rpc:T,rpcSubscriptions:A}),Q=fU({rpc:T,rpcSubscriptions:A});async function C(W){await nU({...W,getBlockHeightExceedencePromise:P,getRecentSignatureConfirmationPromise:Q})}return async function(G,U){await gj({...U,confirmRecentTransaction:C,rpc:T,transaction:G})}}var aU="confirmed";function mj(T){aU=T}function K1(){return aU}var sT="6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P",LT="pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA",cA="11111111111111111111111111111111",HT="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",q2="TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb",X2="ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";var FA="pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ";var EQ=O1(),sU=X2;async function j1({owner:T,mint:A,tokenProgram:P=HT,associatedTokenProgram:Q=sU}){return await X1({programAddress:_(Q),seeds:[EQ.encode(_(T)),EQ.encode(_(P)),EQ.encode(_(A))]})}async function tU(T){return await j1({...T,tokenProgram:T.tokenProgram??q2,associatedTokenProgram:T.associatedTokenProgram??sU})}var oA=new TextEncoder,y6=O1();async function b6(){let[T]=await X1({programAddress:_(sT),seeds:[oA.encode("global")]});return T}async function DA(T){let[A]=await X1({programAddress:_(sT),seeds:[oA.encode("bonding-curve"),y6.encode(_(T))]});return A}async function l6(T,A){let[P]=await j1({owner:_(T),mint:_(A),tokenProgram:_(HT)});return P}async function BQ(T){let[A]=await X1({programAddress:_(sT),seeds:[oA.encode("creator-vault"),y6.encode(_(T))]});return A}async function eU(){let[T]=await X1({programAddress:_(sT),seeds:[oA.encode("global_volume_accumulator")]});return T}async function T$(T){let[A]=await X1({programAddress:_(sT),seeds:[oA.encode("user_volume_accumulator"),y6.encode(_(T))]});return A}async function p6(){let[T]=await X1({programAddress:_(sT),seeds:[oA.encode("__event_authority")]});return T}async function MA(){let[T]=await X1({programAddress:_(FA),seeds:[oA.encode("fee_config"),y6.encode(_(sT))]});return T}var L1="6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P";function uT(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 w1(T,A){return(P)=>{if(!P.value){if(A==="omitted")return;return Object.freeze({address:T,role:H1.READONLY})}let Q=P.isWritable?H1.WRITABLE:H1.READONLY;return Object.freeze({address:uT(P.value),role:A$(P.value)?E6(Q):Q,...A$(P.value)?{signer:P.value}:{}})}}function A$(T){return!!T&&typeof T==="object"&&"address"in T&&B0(T)}var kw=new Uint8Array([69,25,171,142,57,239,13,4]);var zw=new Uint8Array([8,217,96,231,144,104,192,5]);var Lw=new Uint8Array([209,11,115,87,213,23,124,204]);function u6(){return RT([["lpFeeBps",N1()],["protocolFeeBps",N1()],["creatorFeeBps",N1()]])}function P$(){return RT([["marketCapLamportsThreshold",oJ()],["fees",u6()]])}function OQ(){return L6([$2()])}var pj=new Uint8Array([102,6,61,18,1,218,235,234]);function uj(){return ZT(qT([["discriminator",jT(DT(),8)],["amount",F1()],["maxSolCost",F1()],["trackVolume",OQ()]]),(T)=>({...T,discriminator:pj}))}function Q$(T,A){let P=A?.programAddress??L1,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=w1(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:uj().encode(W),programAddress:P})}var EE=new Uint8Array([56,252,116,8,158,223,205,95]);var _E=new Uint8Array([16,4,71,28,204,1,40,27]);var vE=new Uint8Array([249,69,164,218,150,103,84,138]);var pE=new Uint8Array([20,22,86,123,198,28,219,132]);var dj=new Uint8Array([24,30,200,40,5,28,7,119]);function rj(){return ZT(qT([["discriminator",jT(DT(),8)],["name",M6(w6(),J2())],["symbol",M6(w6(),J2())],["uri",M6(w6(),J2())],["creator",O1()]]),(T)=>({...T,discriminator:dj}))}function C$(T,A){let P=A?.programAddress??L1,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=w1(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:rj().encode(W),programAddress:P})}var sE=new Uint8Array([234,102,194,203,150,72,62,229]);var AB=new Uint8Array([175,175,109,31,13,152,155,237]);var WB=new Uint8Array([94,6,202,115,255,96,232,183]);var $B=new Uint8Array([155,234,231,146,236,158,162,30]);var cj=new Uint8Array([51,230,133,164,1,127,131,173]);function oj(){return ZT(qT([["discriminator",jT(DT(),8)],["amount",F1()],["minSolOutput",F1()]]),(T)=>({...T,discriminator:cj}))}function W$(T,A){let P=A?.programAddress??L1,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=w1(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:oj().encode(W),programAddress:P})}var jB=new Uint8Array([254,148,255,112,207,142,170,165]);var DB=new Uint8Array([138,96,174,217,48,85,197,246]);var SB=new Uint8Array([27,234,178,52,147,2,187,141]);var EB=new Uint8Array([86,31,192,87,163,87,79,238]);var _B=new Uint8Array([227,181,74,196,208,21,97,213]);var PO=new Uint8Array([23,183,248,55,96,216,172,96]);function fj(){return RT([["discriminator",xT(pT(),8)],["virtualTokenReserves",N1()],["virtualSolReserves",N1()],["realTokenReserves",N1()],["realSolReserves",N1()],["tokenTotalSupply",N1()],["complete",N6()],["creator",S1()]])}function nj(T){return XA(T,fj())}async function N8(T,A,P){let Q=await ij(T,A,P);return KA(Q),Q}async function ij(T,A,P){let Q=await HA(T,A,P);return nj(Q)}async function H2(T){let{user:A,mint:P,tokenAmount:Q,maxSolCostLamports:C,feeRecipient:W,trackVolume:G=!0,bondingCurveCreator:U,rpc:$,commitment:q=K1()}=T,X=_(P),K=A.address,F=await DA(X),M=MA(),I=b6(),E=p6(),L=eU(),O=T$(K),m=l6(F,X),v=j1({owner:K,mint:X,tokenProgram:_(HT)}),l=await J$({bondingCurve:F,providedCreator:U,rpc:$,commitment:q}),[r,c,[o],u,h,a,n,x]=await Promise.all([I,m,v,BQ(l),E,L,O,M]);return Q$({global:r,feeRecipient:_(W),mint:X,bondingCurve:F,associatedBondingCurve:c,associatedUser:o,user:A,systemProgram:_(cA),tokenProgram:_(HT),creatorVault:u,eventAuthority:h,program:_(sT),globalVolumeAccumulator:a,userVolumeAccumulator:n,feeConfig:x,feeProgram:_(FA),amount:Q,maxSolCost:C,trackVolume:[G]})}async function hQ(T){let{user:A,mint:P,tokenAmount:Q,minSolOutputLamports:C,feeRecipient:W,bondingCurveCreator:G,rpc:U,commitment:$=K1()}=T,q=_(P),X=A.address,K=await DA(q),F=b6(),M=l6(K,q),I=j1({owner:X,mint:q,tokenProgram:_(HT)}),E=MA(),L=p6(),O=await J$({bondingCurve:K,providedCreator:G,rpc:U,commitment:$}),[m,v,[l],r,c,o]=await Promise.all([F,M,I,BQ(O),L,E]);return W$({global:m,feeRecipient:_(W),mint:q,bondingCurve:K,associatedBondingCurve:v,associatedUser:l,user:A,systemProgram:_(cA),creatorVault:r,tokenProgram:_(HT),eventAuthority:c,program:_(sT),feeConfig:o,feeProgram:_(FA),amount:Q,minSolOutput:C})}async function G$(T){let{user:A,mint:P,mintAuthority:Q,name:C,symbol:W,uri:G,creator:U}=T,$=P.address,q=U?_(U):A.address,X=await b6(),K=await DA($),F=await l6(K,$),[M]=await X1({programAddress:_("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),seeds:[new TextEncoder().encode("metadata"),_("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),$]}),I=await p6();return C$({mint:P,mintAuthority:_(Q),bondingCurve:K,associatedBondingCurve:F,global:X,mplTokenMetadata:_("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),metadata:M,user:A,systemProgram:_(cA),tokenProgram:_(HT),associatedTokenProgram:_("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"),rent:_("SysvarRent111111111111111111111111111111111"),eventAuthority:I,program:_(sT),name:C,symbol:W,uri:G,creator:q})}async function J$(T){let{bondingCurve:A,providedCreator:P,rpc:Q,commitment:C}=T;if(P)return _(P);try{return(await N8(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 O0="CebN5WGQ4jvEPvsVU4EoHEpgzq1VV7AbicfhtW4xC9iM";var Q0=50,f0=(T,A=50)=>T+T*BigInt(A)/10000n,fA=(T,A=50)=>T-T*BigInt(A)/10000n;function C0(T){if(T<0)throw Error("Slippage cannot be negative");if(T>1e4)throw Error("Slippage cannot exceed 100%")}function aj(T){if(T<0||T>100)throw Error("Percent must be between 0 and 100");return Math.round(T*100)}function sj(T){return T/100}var tj=1000000000n;function x0(T){if(!Number.isFinite(T)||T<0)throw Error("SOL value must be a non-negative finite number");return BigInt(Math.round(T*Number(tj)))}function nA(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 ej(T){let{user:A,mint:P,tokenAmount:Q,estimatedSolCostSol:C,slippageBps:W=Q0,feeRecipient:G=O0,bondingCurveCreator:U,trackVolume:$=!0,rpc:q,commitment:X=K1()}=T;if(C0(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 K=x0(C),F=f0(K,W);return await H2({user:A,mint:P,tokenAmount:Q,maxSolCostLamports:F,feeRecipient:G,trackVolume:$,bondingCurveCreator:U,rpc:q,commitment:X})}async function gQ(T){let{user:A,mint:P,tokenAmount:Q,maxSolCostSol:C,maxSolCostLamports:W,feeRecipient:G=O0,trackVolume:U=!0,bondingCurveCreator:$,rpc:q,commitment:X=K1()}=T;if(Q<=0n)throw Error("Token amount must be positive");let K=null;if(W!==void 0){if(W<=0n)throw Error("Max SOL cost lamports must be positive");K=W}else if(C!==void 0){if(!Number.isFinite(C)||C<=0)throw Error("Max SOL cost must be a positive number");K=x0(C)}if(K===null)throw Error("Provide either maxSolCostLamports or maxSolCostSol when calling buySimple");return await H2({user:A,mint:P,tokenAmount:Q,maxSolCostLamports:K,feeRecipient:G,trackVolume:U,bondingCurveCreator:$,rpc:q,commitment:X})}var U$=6;async function TR(T){let{user:A,mint:P,tokenAmount:Q,estimatedSolOutSol:C,slippageBps:W=Q0,feeRecipient:G=O0,bondingCurveCreator:U,rpc:$,commitment:q}=T;if(C0(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 X=nA(Q,U$),K=x0(C),F=fA(K,W);return await hQ({user:A,mint:P,tokenAmount:X,minSolOutputLamports:F,feeRecipient:G,bondingCurveCreator:U,rpc:$,commitment:q})}async function mQ(T){let{user:A,mint:P,tokenAmount:Q,tokenAmountRaw:C,minSolOutputSol:W,minSolOutputLamports:G,feeRecipient:U=O0,bondingCurveCreator:$,rpc:q,commitment:X}=T,K=null;if(C!==void 0){if(C<=0n)throw Error("Token amount lamports must be positive");K=C}else if(Q!==void 0){if(!Number.isFinite(Q)||Q<=0)throw Error("Token amount must be a positive number");K=nA(Q,U$)}if(K===null)throw Error("Provide either tokenAmountRaw or tokenAmount when calling sellSimple");let F=null;if(G!==void 0){if(G<0n)throw Error("Min SOL output lamports cannot be negative");F=G}else if(W!==void 0){if(!Number.isFinite(W)||W<0)throw Error("Min SOL output cannot be negative");F=x0(W)}if(F===null)throw Error("Provide either minSolOutputLamports or minSolOutputSol when calling sellSimple");return await hQ({user:A,mint:P,tokenAmount:K,minSolOutputLamports:F,feeRecipient:U,bondingCurveCreator:$,rpc:q,commitment:X})}w8();var sA=typeof globalThis==="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function a0(T){return T instanceof Uint8Array||ArrayBuffer.isView(T)&&T.constructor.name==="Uint8Array"}function IA(T){if(!Number.isSafeInteger(T)||T<0)throw Error("positive integer expected, got "+T)}function wT(T,...A){if(!a0(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 o6(T){if(typeof T!=="function"||typeof T.create!=="function")throw Error("Hash should be wrapped by utils.createHasher");IA(T.outputLen),IA(T.blockLen)}function s0(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 f6(T,A){wT(T);let P=A.outputLen;if(T.length<P)throw Error("digestInto() expects output buffer of length at least "+P)}function O$(T){return new Uint32Array(T.buffer,T.byteOffset,Math.floor(T.byteLength/4))}function q0(...T){for(let A=0;A<T.length;A++)T[A].fill(0)}function n6(T){return new DataView(T.buffer,T.byteOffset,T.byteLength)}function R0(T,A){return T<<32-A|T>>>A}var pR=(()=>new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68)();function uR(T){return T<<24&4278190080|T<<8&16711680|T>>>8&65280|T>>>24&255}function dR(T){for(let A=0;A<T.length;A++)T[A]=uR(T[A]);return T}var oQ=pR?(T)=>T:dR,x$=(()=>typeof Uint8Array.from([]).toHex==="function"&&typeof Uint8Array.fromHex==="function")(),rR=Array.from({length:256},(T,A)=>A.toString(16).padStart(2,"0"));function X0(T){if(wT(T),x$)return T.toHex();let A="";for(let P=0;P<T.length;P++)A+=rR[T[P]];return A}var i0={_0:48,_9:57,A:65,F:70,a:97,f:102};function B$(T){if(T>=i0._0&&T<=i0._9)return T-i0._0;if(T>=i0.A&&T<=i0.F)return T-(i0.A-10);if(T>=i0.a&&T<=i0.f)return T-(i0.a-10);return}function tA(T){if(typeof T!=="string")throw Error("hex string expected, got "+typeof T);if(x$)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=B$(T.charCodeAt(W)),U=B$(T.charCodeAt(W+1));if(G===void 0||U===void 0){let $=T[W]+T[W+1];throw Error('hex string expected, got non-hex character "'+$+'" at index '+W)}Q[C]=G*16+U}return Q}function fQ(T){if(typeof T!=="string")throw Error("string expected");return new Uint8Array(new TextEncoder().encode(T))}function eA(T){if(typeof T==="string")T=fQ(T);return wT(T),T}function dT(...T){let A=0;for(let Q=0;Q<T.length;Q++){let C=T[Q];wT(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 T8{}function R2(T){let A=(Q)=>T().update(eA(Q)).digest(),P=T();return A.outputLen=P.outputLen,A.blockLen=P.blockLen,A.create=()=>T(),A}function E8(T=32){if(sA&&typeof sA.getRandomValues==="function")return sA.getRandomValues(new Uint8Array(T));if(sA&&typeof sA.randomBytes==="function")return Uint8Array.from(sA.randomBytes(T));throw Error("crypto.getRandomValues must be defined")}function cR(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),U=Number(P&W),$=Q?4:0,q=Q?0:4;T.setUint32(A+$,G,Q),T.setUint32(A+q,U,Q)}function _$(T,A,P){return T&A^~T&P}function h$(T,A,P){return T&A^T&P^A&P}class i6 extends T8{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=n6(this.buffer)}update(T){s0(this),T=eA(T),wT(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 U=n6(T);for(;Q<=C-W;W+=Q)this.process(U,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){s0(this),f6(T,this),this.finished=!0;let{buffer:A,view:P,blockLen:Q,isLE:C}=this,{pos:W}=this;if(A[W++]=128,q0(this.buffer.subarray(W)),this.padOffset>Q-W)this.process(P,0),W=0;for(let X=W;X<Q;X++)A[X]=0;cR(P,Q-8,BigInt(this.length*8),C),this.process(P,0);let G=n6(T),U=this.outputLen;if(U%4)throw Error("_sha2: outputLen should be aligned to 32bit");let $=U/4,q=this.get();if($>q.length)throw Error("_sha2: outputLen bigger than state");for(let X=0;X<$;X++)G.setUint32(4*X,q[X],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 t0=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);var ET=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]);var a6=BigInt(4294967295),g$=BigInt(32);function oR(T,A=!1){if(A)return{h:Number(T&a6),l:Number(T>>g$&a6)};return{h:Number(T>>g$&a6)|0,l:Number(T&a6)|0}}function s6(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:U}=oR(T[W],A);[Q[W],C[W]]=[G,U]}return[Q,C]}var nQ=(T,A,P)=>T>>>P,iQ=(T,A,P)=>T<<32-P|A>>>P,A8=(T,A,P)=>T>>>P|A<<32-P,P8=(T,A,P)=>T<<32-P|A>>>P,k2=(T,A,P)=>T<<64-P|A>>>P-32,F2=(T,A,P)=>T>>>P-32|A<<64-P;var m$=(T,A,P)=>T<<P|A>>>32-P,v$=(T,A,P)=>A<<P|T>>>32-P,y$=(T,A,P)=>A<<P-32|T>>>64-P,b$=(T,A,P)=>T<<P-32|A>>>64-P;function g0(T,A,P,Q){let C=(A>>>0)+(Q>>>0);return{h:T+P+(C/4294967296|0)|0,l:C|0}}var l$=(T,A,P)=>(T>>>0)+(A>>>0)+(P>>>0),p$=(T,A,P,Q)=>A+P+Q+(T/4294967296|0)|0,u$=(T,A,P,Q)=>(T>>>0)+(A>>>0)+(P>>>0)+(Q>>>0),d$=(T,A,P,Q,C)=>A+P+Q+C+(T/4294967296|0)|0,r$=(T,A,P,Q,C)=>(T>>>0)+(A>>>0)+(P>>>0)+(Q>>>0)+(C>>>0),c$=(T,A,P,Q,C,W)=>A+P+Q+C+W+(T/4294967296|0)|0;var nR=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]),SA=new Uint32Array(64);class aQ extends i6{constructor(T=32){super(64,T,8,!1);this.A=t0[0]|0,this.B=t0[1]|0,this.C=t0[2]|0,this.D=t0[3]|0,this.E=t0[4]|0,this.F=t0[5]|0,this.G=t0[6]|0,this.H=t0[7]|0}get(){let{A:T,B:A,C:P,D:Q,E:C,F:W,G,H:U}=this;return[T,A,P,Q,C,W,G,U]}set(T,A,P,Q,C,W,G,U){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=U|0}process(T,A){for(let X=0;X<16;X++,A+=4)SA[X]=T.getUint32(A,!1);for(let X=16;X<64;X++){let K=SA[X-15],F=SA[X-2],M=R0(K,7)^R0(K,18)^K>>>3,I=R0(F,17)^R0(F,19)^F>>>10;SA[X]=I+SA[X-7]+M+SA[X-16]|0}let{A:P,B:Q,C,D:W,E:G,F:U,G:$,H:q}=this;for(let X=0;X<64;X++){let K=R0(G,6)^R0(G,11)^R0(G,25),F=q+K+_$(G,U,$)+nR[X]+SA[X]|0,I=(R0(P,2)^R0(P,13)^R0(P,22))+h$(P,Q,C)|0;q=$,$=U,U=G,G=W+F|0,W=C,C=Q,Q=P,P=F+I|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,U=U+this.F|0,$=$+this.G|0,q=q+this.H|0,this.set(P,Q,C,W,G,U,$,q)}roundClean(){q0(SA)}destroy(){this.set(0,0,0,0,0,0,0,0),q0(this.buffer)}}var o$=(()=>s6(["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))))(),iR=(()=>o$[0])(),aR=(()=>o$[1])(),NA=new Uint32Array(80),LA=new Uint32Array(80);class f$ extends i6{constructor(T=64){super(128,T,16,!1);this.Ah=ET[0]|0,this.Al=ET[1]|0,this.Bh=ET[2]|0,this.Bl=ET[3]|0,this.Ch=ET[4]|0,this.Cl=ET[5]|0,this.Dh=ET[6]|0,this.Dl=ET[7]|0,this.Eh=ET[8]|0,this.El=ET[9]|0,this.Fh=ET[10]|0,this.Fl=ET[11]|0,this.Gh=ET[12]|0,this.Gl=ET[13]|0,this.Hh=ET[14]|0,this.Hl=ET[15]|0}get(){let{Ah:T,Al:A,Bh:P,Bl:Q,Ch:C,Cl:W,Dh:G,Dl:U,Eh:$,El:q,Fh:X,Fl:K,Gh:F,Gl:M,Hh:I,Hl:E}=this;return[T,A,P,Q,C,W,G,U,$,q,X,K,F,M,I,E]}set(T,A,P,Q,C,W,G,U,$,q,X,K,F,M,I,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=U|0,this.Eh=$|0,this.El=q|0,this.Fh=X|0,this.Fl=K|0,this.Gh=F|0,this.Gl=M|0,this.Hh=I|0,this.Hl=E|0}process(T,A){for(let m=0;m<16;m++,A+=4)NA[m]=T.getUint32(A),LA[m]=T.getUint32(A+=4);for(let m=16;m<80;m++){let v=NA[m-15]|0,l=LA[m-15]|0,r=A8(v,l,1)^A8(v,l,8)^nQ(v,l,7),c=P8(v,l,1)^P8(v,l,8)^iQ(v,l,7),o=NA[m-2]|0,u=LA[m-2]|0,h=A8(o,u,19)^k2(o,u,61)^nQ(o,u,6),a=P8(o,u,19)^F2(o,u,61)^iQ(o,u,6),n=u$(c,a,LA[m-7],LA[m-16]),x=d$(n,r,h,NA[m-7],NA[m-16]);NA[m]=x|0,LA[m]=n|0}let{Ah:P,Al:Q,Bh:C,Bl:W,Ch:G,Cl:U,Dh:$,Dl:q,Eh:X,El:K,Fh:F,Fl:M,Gh:I,Gl:E,Hh:L,Hl:O}=this;for(let m=0;m<80;m++){let v=A8(X,K,14)^A8(X,K,18)^k2(X,K,41),l=P8(X,K,14)^P8(X,K,18)^F2(X,K,41),r=X&F^~X&I,c=K&M^~K&E,o=r$(O,l,c,aR[m],LA[m]),u=c$(o,L,v,r,iR[m],NA[m]),h=o|0,a=A8(P,Q,28)^k2(P,Q,34)^k2(P,Q,39),n=P8(P,Q,28)^F2(P,Q,34)^F2(P,Q,39),x=P&C^P&G^C&G,R=Q&W^Q&U^W&U;L=I|0,O=E|0,I=F|0,E=M|0,F=X|0,M=K|0,{h:X,l:K}=g0($|0,q|0,u|0,h|0),$=G|0,q=U|0,G=C|0,U=W|0,C=P|0,W=Q|0;let J=l$(h,n,R);P=p$(J,u,a,x),Q=J|0}({h:P,l:Q}=g0(this.Ah|0,this.Al|0,P|0,Q|0)),{h:C,l:W}=g0(this.Bh|0,this.Bl|0,C|0,W|0),{h:G,l:U}=g0(this.Ch|0,this.Cl|0,G|0,U|0),{h:$,l:q}=g0(this.Dh|0,this.Dl|0,$|0,q|0),{h:X,l:K}=g0(this.Eh|0,this.El|0,X|0,K|0),{h:F,l:M}=g0(this.Fh|0,this.Fl|0,F|0,M|0),{h:I,l:E}=g0(this.Gh|0,this.Gl|0,I|0,E|0),{h:L,l:O}=g0(this.Hh|0,this.Hl|0,L|0,O|0),this.set(P,Q,C,W,G,U,$,q,X,K,F,M,I,E,L,O)}roundClean(){q0(NA,LA)}destroy(){q0(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}var t6=R2(()=>new aQ);var n$=R2(()=>new f$);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var eQ=BigInt(0),tQ=BigInt(1);function e0(T,A=""){if(typeof T!=="boolean"){let P=A&&`"${A}"`;throw Error(P+"expected boolean, got type="+typeof T)}return T}function W0(T,A,P=""){let Q=a0(T),C=T?.length,W=A!==void 0;if(!Q||W&&C!==A){let G=P&&`"${P}" `,U=W?` of length ${A}`:"",$=Q?`length=${C}`:`type=${typeof T}`;throw Error(G+"expected Uint8Array"+U+", got "+$)}return T}function D2(T){let A=T.toString(16);return A.length&1?"0"+A:A}function i$(T){if(typeof T!=="string")throw Error("hex string expected, got "+typeof T);return T===""?eQ:BigInt("0x"+T)}function B8(T){return i$(X0(T))}function TA(T){return wT(T),i$(X0(Uint8Array.from(T).reverse()))}function e6(T,A){return tA(T.toString(16).padStart(A*2,"0"))}function TC(T,A){return e6(T,A).reverse()}function Y1(T,A,P){let Q;if(typeof A==="string")try{Q=tA(A)}catch(W){throw Error(T+" must be hex string or Uint8Array, cause: "+W)}else if(a0(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 a$(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 AC(T){return Uint8Array.from(T)}var sQ=(T)=>typeof T==="bigint"&&eQ<=T;function s$(T,A,P){return sQ(T)&&sQ(A)&&sQ(P)&&A<=T&&T<P}function M2(T,A,P,Q){if(!s$(A,P,Q))throw Error("expected valid "+T+": "+P+" <= n < "+Q+", got "+A)}function T4(T){let A;for(A=0;T>eQ;T>>=tQ,A+=1);return A}var wA=(T)=>(tQ<<BigInt(T))-tQ;function t$(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=(M)=>new Uint8Array(M),C=(M)=>Uint8Array.of(M),W=Q(T),G=Q(T),U=0,$=()=>{W.fill(1),G.fill(0),U=0},q=(...M)=>P(G,W,...M),X=(M=Q(0))=>{if(G=q(C(0),M),W=q(),M.length===0)return;G=q(C(1),M),W=q()},K=()=>{if(U++>=1000)throw Error("drbg: tried 1000 values");let M=0,I=[];while(M<A){W=q();let E=W.slice();I.push(E),M+=W.length}return dT(...I)};return(M,I)=>{$(),X(M);let E=void 0;while(!(E=I(K())))X();return $(),E}}function EA(T,A,P={}){if(!T||typeof T!=="object")throw Error("expected valid options object");function Q(C,W,G){let U=T[C];if(G&&U===void 0)return;let $=typeof U;if($!==W||U===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 PC=()=>{throw Error("not implemented")};function O8(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 rT=BigInt(0),IT=BigInt(1),Q8=BigInt(2),A9=BigInt(3),P9=BigInt(4),Q9=BigInt(5),sR=BigInt(7),C9=BigInt(8),tR=BigInt(9),W9=BigInt(16);function E1(T,A){let P=T%A;return P>=rT?P:A+P}function D1(T,A,P){let Q=T;while(A-- >rT)Q*=Q,Q%=P;return Q}function e$(T,A){if(T===rT)throw Error("invert: expected non-zero number");if(A<=rT)throw Error("invert: expected positive modulus, got "+A);let P=E1(T,A),Q=A,C=rT,W=IT,G=IT,U=rT;while(P!==rT){let q=Q/P,X=Q%P,K=C-G*q,F=W-U*q;Q=P,P=X,C=G,W=U,G=K,U=F}if(Q!==IT)throw Error("invert: does not exist");return E1(C,A)}function QC(T,A,P){if(!T.eql(T.sqr(A),P))throw Error("Cannot find square root")}function G9(T,A){let P=(T.ORDER+IT)/P9,Q=T.pow(A,P);return QC(T,Q,A),Q}function eR(T,A){let P=(T.ORDER-Q9)/C9,Q=T.mul(A,Q8),C=T.pow(Q,P),W=T.mul(A,C),G=T.mul(T.mul(W,Q8),C),U=T.mul(W,T.sub(G,T.ONE));return QC(T,U,A),U}function Tk(T){let A=G0(T),P=J9(T),Q=P(A,A.neg(A.ONE)),C=P(A,Q),W=P(A,A.neg(Q)),G=(T+sR)/W9;return(U,$)=>{let q=U.pow($,G),X=U.mul(q,Q),K=U.mul(q,C),F=U.mul(q,W),M=U.eql(U.sqr(X),$),I=U.eql(U.sqr(K),$);q=U.cmov(q,X,M),X=U.cmov(F,K,I);let E=U.eql(U.sqr(X),$),L=U.cmov(q,X,E);return QC(U,L,$),L}}function J9(T){if(T<A9)throw Error("sqrt is not defined for small field");let A=T-IT,P=0;while(A%Q8===rT)A/=Q8,P++;let Q=Q8,C=G0(T);while(T9(C,Q)===1)if(Q++>1000)throw Error("Cannot find square root: probably non-prime P");if(P===1)return G9;let W=C.pow(Q,A),G=(A+IT)/Q8;return function($,q){if($.is0(q))return q;if(T9($,q)!==1)throw Error("Cannot find square root");let X=P,K=$.mul($.ONE,W),F=$.pow(q,A),M=$.pow(q,G);while(!$.eql(F,$.ONE)){if($.is0(F))return $.ZERO;let I=1,E=$.sqr(F);while(!$.eql(E,$.ONE))if(I++,E=$.sqr(E),I===X)throw Error("Cannot find square root");let L=IT<<BigInt(X-I-1),O=$.pow(K,L);X=I,K=$.sqr(O),F=$.mul(F,K),M=$.mul(M,O)}return M}}function Ak(T){if(T%P9===A9)return G9;if(T%C9===Q9)return eR;if(T%W9===tR)return Tk(T);return J9(T)}var AA=(T,A)=>(E1(T,A)&IT)===IT,Pk=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function CC(T){let A={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},P=Pk.reduce((Q,C)=>{return Q[C]="function",Q},A);return EA(T,P),T}function Qk(T,A,P){if(P<rT)throw Error("invalid exponent, negatives unsupported");if(P===rT)return T.ONE;if(P===IT)return A;let Q=T.ONE,C=A;while(P>rT){if(P&IT)Q=T.mul(Q,C);C=T.sqr(C),P>>=IT}return Q}function z2(T,A,P=!1){let Q=Array(A.length).fill(P?T.ZERO:void 0),C=A.reduce((G,U,$)=>{if(T.is0(U))return G;return Q[$]=G,T.mul(G,U)},T.ONE),W=T.inv(C);return A.reduceRight((G,U,$)=>{if(T.is0(U))return G;return Q[$]=T.mul(G,Q[$]),T.mul(G,U)},W),Q}function T9(T,A){let P=(T.ORDER-IT)/Q8,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 A4(T,A){if(A!==void 0)IA(A);let P=A!==void 0?A:T.toString(2).length,Q=Math.ceil(P/8);return{nBitLength:P,nByteLength:Q}}function G0(T,A,P=!1,Q={}){if(T<=rT)throw Error("invalid field: expected ORDER > 0, got "+T);let C=void 0,W=void 0,G=!1,U=void 0;if(typeof A==="object"&&A!=null){if(Q.sqrt||P)throw Error("cannot specify opts in two arguments");let F=A;if(F.BITS)C=F.BITS;if(F.sqrt)W=F.sqrt;if(typeof F.isLE==="boolean")P=F.isLE;if(typeof F.modFromBytes==="boolean")G=F.modFromBytes;U=F.allowedLengths}else{if(typeof A==="number")C=A;if(Q.sqrt)W=Q.sqrt}let{nBitLength:$,nByteLength:q}=A4(T,C);if(q>2048)throw Error("invalid field: expected ORDER of <= 2048 bytes");let X,K=Object.freeze({ORDER:T,isLE:P,BITS:$,BYTES:q,MASK:wA($),ZERO:rT,ONE:IT,allowedLengths:U,create:(F)=>E1(F,T),isValid:(F)=>{if(typeof F!=="bigint")throw Error("invalid field element: expected bigint, got "+typeof F);return rT<=F&&F<T},is0:(F)=>F===rT,isValidNot0:(F)=>!K.is0(F)&&K.isValid(F),isOdd:(F)=>(F&IT)===IT,neg:(F)=>E1(-F,T),eql:(F,M)=>F===M,sqr:(F)=>E1(F*F,T),add:(F,M)=>E1(F+M,T),sub:(F,M)=>E1(F-M,T),mul:(F,M)=>E1(F*M,T),pow:(F,M)=>Qk(K,F,M),div:(F,M)=>E1(F*e$(M,T),T),sqrN:(F)=>F*F,addN:(F,M)=>F+M,subN:(F,M)=>F-M,mulN:(F,M)=>F*M,inv:(F)=>e$(F,T),sqrt:W||((F)=>{if(!X)X=Ak(T);return X(K,F)}),toBytes:(F)=>P?TC(F,q):e6(F,q),fromBytes:(F,M=!0)=>{if(U){if(!U.includes(F.length)||F.length>q)throw Error("Field.fromBytes: expected "+U+" bytes, got "+F.length);let E=new Uint8Array(q);E.set(F,P?0:E.length-F.length),F=E}if(F.length!==q)throw Error("Field.fromBytes: expected "+q+" bytes, got "+F.length);let I=P?TA(F):B8(F);if(G)I=E1(I,T);if(!M){if(!K.isValid(I))throw Error("invalid field element: outside of range 0..ORDER")}return I},invertBatch:(F)=>z2(K,F),cmov:(F,M,I)=>I?M:F});return Object.freeze(K)}function U9(T){if(typeof T!=="bigint")throw Error("field order must be bigint");let A=T.toString(2).length;return Math.ceil(A/8)}function WC(T){let A=U9(T);return A+Math.ceil(A/2)}function GC(T,A,P=!1){let Q=T.length,C=U9(A),W=WC(A);if(Q<16||Q<W||Q>1024)throw Error("expected "+W+"-1024 bytes of input, got "+Q);let G=P?TA(T):B8(T),U=E1(G,A-IT)+IT;return P?TC(U,C):e6(U,C)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var x8=BigInt(0),C8=BigInt(1);function I2(T,A){let P=A.negate();return T?P:A}function PA(T,A){let P=z2(T.Fp,A.map((Q)=>Q.Z));return A.map((Q,C)=>T.fromAffine(Q.toAffine(P[C])))}function Z9(T,A){if(!Number.isSafeInteger(T)||T<=0||T>A)throw Error("invalid window size, expected [1.."+A+"], got W="+T)}function JC(T,A){Z9(T,A);let P=Math.ceil(A/T)+1,Q=2**(T-1),C=2**T,W=wA(T),G=BigInt(T);return{windows:P,windowSize:Q,mask:W,maxNumber:C,shiftBy:G}}function $9(T,A,P){let{windowSize:Q,mask:C,maxNumber:W,shiftBy:G}=P,U=Number(T&C),$=T>>G;if(U>Q)U-=W,$+=C8;let q=A*Q,X=q+Math.abs(U)-1,K=U===0,F=U<0,M=A%2!==0;return{nextN:$,offset:X,isZero:K,isNeg:F,isNegF:M,offsetF:q}}function Ck(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 Wk(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 UC=new WeakMap,q9=new WeakMap;function $C(T){return q9.get(T)||1}function V9(T){if(T!==x8)throw Error("invalid wNAF")}class S2{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>x8){if(A&C8)P=P.add(Q);Q=Q.double(),A>>=C8}return P}precomputeWindow(T,A){let{windows:P,windowSize:Q}=JC(A,this.bits),C=[],W=T,G=W;for(let U=0;U<P;U++){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=JC(T,this.bits);for(let G=0;G<W.windows;G++){let{nextN:U,offset:$,isZero:q,isNeg:X,isNegF:K,offsetF:F}=$9(P,G,W);if(P=U,q)C=C.add(I2(K,A[F]));else Q=Q.add(I2(X,A[$]))}return V9(P),{p:Q,f:C}}wNAFUnsafe(T,A,P,Q=this.ZERO){let C=JC(T,this.bits);for(let W=0;W<C.windows;W++){if(P===x8)break;let{nextN:G,offset:U,isZero:$,isNeg:q}=$9(P,W,C);if(P=G,$)continue;else{let X=A[U];Q=Q.add(q?X.negate():X)}}return V9(P),Q}getPrecomputes(T,A,P){let Q=UC.get(A);if(!Q){if(Q=this.precomputeWindow(A,T),T!==1){if(typeof P==="function")Q=P(Q);UC.set(A,Q)}}return Q}cached(T,A,P){let Q=$C(T);return this.wNAF(Q,this.getPrecomputes(Q,T,P),A)}unsafe(T,A,P,Q){let C=$C(T);if(C===1)return this._unsafeLadder(T,A,Q);return this.wNAFUnsafe(C,this.getPrecomputes(C,T,P),A,Q)}createCache(T,A){Z9(A,this.bits),q9.set(T,A),UC.delete(T)}hasCache(T){return $C(T)!==1}}function X9(T,A,P,Q){let C=A,W=T.ZERO,G=T.ZERO;while(P>x8||Q>x8){if(P&C8)W=W.add(C);if(Q&C8)G=G.add(C);C=C.double(),P>>=C8,Q>>=C8}return{p1:W,p2:G}}function _8(T,A,P,Q){Ck(P,T),Wk(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,U=T4(BigInt(C)),$=1;if(U>12)$=U-3;else if(U>4)$=U-2;else if(U>0)$=2;let q=wA($),X=Array(Number(q)+1).fill(G),K=Math.floor((A.BITS-1)/$)*$,F=G;for(let M=K;M>=0;M-=$){X.fill(G);for(let E=0;E<W;E++){let L=Q[E],O=Number(L>>BigInt(M)&q);X[O]=X[O].add(P[E])}let I=G;for(let E=X.length-1,L=G;E>0;E--)L=L.add(X[E]),I=I.add(L);if(F=F.add(I),M!==0)for(let E=0;E<$;E++)F=F.double()}return F}function Y9(T,A,P){if(A){if(A.ORDER!==T)throw Error("Field.ORDER must match order: Fp == p, Fn == n");return CC(A),A}else return G0(T,{isLE:P})}function P4(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 q=A[$];if(!(typeof q==="bigint"&&q>x8))throw Error(`CURVE.${$} must be positive bigint`)}let C=Y9(A.p,P.Fp,Q),W=Y9(A.n,P.Fn,Q),U=["Gx","Gy","a",T==="weierstrass"?"b":"d"];for(let $ of U)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 BA=BigInt(0),ST=BigInt(1),VC=BigInt(2),Gk=BigInt(8);function Jk(T,A,P,Q){let C=T.sqr(P),W=T.sqr(Q),G=T.add(T.mul(A.a,C),W),U=T.add(T.ONE,T.mul(A.d,T.mul(C,W)));return T.eql(G,U)}function Uk(T,A={}){let P=P4("edwards",T,A,A.FpFnLE),{Fp:Q,Fn:C}=P,W=P.CURVE,{h:G}=W;EA(A,{},{uvRatio:"function"});let U=VC<<BigInt(C.BYTES*8)-ST,$=(L)=>Q.create(L),q=A.uvRatio||((L,O)=>{try{return{isValid:!0,value:Q.sqrt(Q.div(L,O))}}catch(m){return{isValid:!1,value:BA}}});if(!Jk(Q,W,W.Gx,W.Gy))throw Error("bad curve params: generator point");function X(L,O,m=!1){let v=m?ST:BA;return M2("coordinate "+L,O,v,U),O}function K(L){if(!(L instanceof I))throw Error("ExtendedPoint expected")}let F=O8((L,O)=>{let{X:m,Y:v,Z:l}=L,r=L.is0();if(O==null)O=r?Gk:Q.inv(l);let c=$(m*O),o=$(v*O),u=Q.mul(l,O);if(r)return{x:BA,y:ST};if(u!==ST)throw Error("invZ was invalid");return{x:c,y:o}}),M=O8((L)=>{let{a:O,d:m}=W;if(L.is0())throw Error("bad point: ZERO");let{X:v,Y:l,Z:r,T:c}=L,o=$(v*v),u=$(l*l),h=$(r*r),a=$(h*h),n=$(o*O),x=$(h*$(n+u)),R=$(a+$(m*$(o*u)));if(x!==R)throw Error("bad point: equation left != right (1)");let J=$(v*l),V=$(r*c);if(J!==V)throw Error("bad point: equation left != right (2)");return!0});class I{constructor(L,O,m,v){this.X=X("x",L),this.Y=X("y",O),this.Z=X("z",m,!0),this.T=X("t",v),Object.freeze(this)}static CURVE(){return W}static fromAffine(L){if(L instanceof I)throw Error("extended point not allowed");let{x:O,y:m}=L||{};return X("x",O),X("y",m),new I(O,m,ST,$(O*m))}static fromBytes(L,O=!1){let m=Q.BYTES,{a:v,d:l}=W;L=AC(W0(L,m,"point")),e0(O,"zip215");let r=AC(L),c=L[m-1];r[m-1]=c&-129;let o=TA(r),u=O?U:Q.ORDER;M2("point.y",o,BA,u);let h=$(o*o),a=$(h-ST),n=$(l*h-v),{isValid:x,value:R}=q(a,n);if(!x)throw Error("bad point: invalid y coordinate");let J=(R&ST)===ST,V=(c&128)!==0;if(!O&&R===BA&&V)throw Error("bad point: x=0 and x_0=1");if(V!==J)R=$(-R);return I.fromAffine({x:R,y:o})}static fromHex(L,O=!1){return I.fromBytes(Y1("point",L),O)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(L=8,O=!0){if(E.createCache(this,L),!O)this.multiply(VC);return this}assertValidity(){M(this)}equals(L){K(L);let{X:O,Y:m,Z:v}=this,{X:l,Y:r,Z:c}=L,o=$(O*c),u=$(l*v),h=$(m*c),a=$(r*v);return o===u&&h===a}is0(){return this.equals(I.ZERO)}negate(){return new I($(-this.X),this.Y,this.Z,$(-this.T))}double(){let{a:L}=W,{X:O,Y:m,Z:v}=this,l=$(O*O),r=$(m*m),c=$(VC*$(v*v)),o=$(L*l),u=O+m,h=$($(u*u)-l-r),a=o+r,n=a-c,x=o-r,R=$(h*n),J=$(a*x),V=$(h*x),Z=$(n*a);return new I(R,J,Z,V)}add(L){K(L);let{a:O,d:m}=W,{X:v,Y:l,Z:r,T:c}=this,{X:o,Y:u,Z:h,T:a}=L,n=$(v*o),x=$(l*u),R=$(c*m*a),J=$(r*h),V=$((v+l)*(o+u)-n-x),Z=J-R,H=J+R,j=$(x-O*n),z=$(V*Z),S=$(H*j),k=$(V*j),Y=$(Z*H);return new I(z,S,Y,k)}subtract(L){return this.add(L.negate())}multiply(L){if(!C.isValidNot0(L))throw Error("invalid scalar: expected 1 <= sc < curve.n");let{p:O,f:m}=E.cached(this,L,(v)=>PA(I,v));return PA(I,[O,m])[0]}multiplyUnsafe(L,O=I.ZERO){if(!C.isValid(L))throw Error("invalid scalar: expected 0 <= sc < curve.n");if(L===BA)return I.ZERO;if(this.is0()||L===ST)return this;return E.unsafe(this,L,(m)=>PA(I,m),O)}isSmallOrder(){return this.multiplyUnsafe(G).is0()}isTorsionFree(){return E.unsafe(this,W.n).is0()}toAffine(L){return F(this,L)}clearCofactor(){if(G===ST)return this;return this.multiplyUnsafe(G)}toBytes(){let{x:L,y:O}=this.toAffine(),m=Q.toBytes(O);return m[m.length-1]|=L&ST?128:0,m}toHex(){return X0(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 PA(I,L)}static msm(L,O){return _8(I,C,L,O)}_setWindowSize(L){this.precompute(L)}toRawBytes(){return this.toBytes()}}I.BASE=new I(W.Gx,W.Gy,ST,$(W.Gx*W.Gy)),I.ZERO=new I(BA,ST,ST,BA),I.Fp=Q,I.Fn=C;let E=new S2(I,C.BITS);return I.BASE.precompute(8),I}class YC{constructor(T){this.ep=T}static fromBytes(T){PC()}static fromHex(T){PC()}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 X0(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 $k(T,A,P={}){if(typeof A!=="function")throw Error('"hash" function param is required');EA(P,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});let{prehash:Q}=P,{BASE:C,Fp:W,Fn:G}=T,U=P.randomBytes||E8,$=P.adjustScalarBytes||((h)=>h),q=P.domain||((h,a,n)=>{if(e0(n,"phflag"),a.length||n)throw Error("Contexts/pre-hash are not supported");return h});function X(h){return G.create(TA(h))}function K(h){let a=v.secretKey;h=Y1("private key",h,a);let n=Y1("hashed private key",A(h),2*a),x=$(n.slice(0,a)),R=n.slice(a,2*a),J=X(x);return{head:x,prefix:R,scalar:J}}function F(h){let{head:a,prefix:n,scalar:x}=K(h),R=C.multiply(x),J=R.toBytes();return{head:a,prefix:n,scalar:x,point:R,pointBytes:J}}function M(h){return F(h).pointBytes}function I(h=Uint8Array.of(),...a){let n=dT(...a);return X(A(q(n,Y1("context",h),!!Q)))}function E(h,a,n={}){if(h=Y1("message",h),Q)h=Q(h);let{prefix:x,scalar:R,pointBytes:J}=F(a),V=I(n.context,x,h),Z=C.multiply(V).toBytes(),H=I(n.context,Z,J,h),j=G.create(V+H*R);if(!G.isValid(j))throw Error("sign failed: invalid s");let z=dT(Z,G.toBytes(j));return W0(z,v.signature,"result")}let L={zip215:!0};function O(h,a,n,x=L){let{context:R,zip215:J}=x,V=v.signature;if(h=Y1("signature",h,V),a=Y1("message",a),n=Y1("publicKey",n,v.publicKey),J!==void 0)e0(J,"zip215");if(Q)a=Q(a);let Z=V/2,H=h.subarray(0,Z),j=TA(h.subarray(Z,V)),z,S,k;try{z=T.fromBytes(n,J),S=T.fromBytes(H,J),k=C.multiplyUnsafe(j)}catch(b){return!1}if(!J&&z.isSmallOrder())return!1;let Y=I(R,S.toBytes(),z.toBytes(),a);return S.add(z.multiplyUnsafe(Y)).subtract(k).clearCofactor().is0()}let m=W.BYTES,v={secretKey:m,publicKey:m,signature:2*m,seed:m};function l(h=U(v.seed)){return W0(h,v.seed,"seed")}function r(h){let a=u.randomSecretKey(h);return{secretKey:a,publicKey:M(a)}}function c(h){return a0(h)&&h.length===G.BYTES}function o(h,a){try{return!!T.fromBytes(h,a)}catch(n){return!1}}let u={getExtendedPublicKey:F,randomSecretKey:l,isValidSecretKey:c,isValidPublicKey:o,toMontgomery(h){let{y:a}=T.fromBytes(h),n=v.publicKey,x=n===32;if(!x&&n!==57)throw Error("only defined for 25519 and 448");let R=x?W.div(ST+a,ST-a):W.div(a-ST,a+ST);return W.toBytes(R)},toMontgomerySecret(h){let a=v.secretKey;W0(h,a);let n=A(h.subarray(0,a));return $(n).subarray(0,a)},randomPrivateKey:l,precompute(h=8,a=T.BASE){return a.precompute(h,!1)}};return Object.freeze({keygen:r,getPublicKey:M,sign:E,verify:O,utils:u,Point:T,lengths:v})}function Vk(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=G0(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 Yk(T,A){let P=A.Point;return Object.assign({},A,{ExtendedPoint:P,CURVE:T,nBitLength:P.Fn.BITS,nByteLength:P.Fn.BYTES})}function H9(T){let{CURVE:A,curveOpts:P,hash:Q,eddsaOpts:C}=Vk(T),W=Uk(A,P),G=$k(W,Q,C);return Yk(T,G)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var Zk=BigInt(0),QA=BigInt(1),K9=BigInt(2),Cx=BigInt(3),qk=BigInt(5),Xk=BigInt(8),h8=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),N2=(()=>({p:h8,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:Xk,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")}))();function Hk(T){let A=BigInt(10),P=BigInt(20),Q=BigInt(40),C=BigInt(80),W=h8,U=T*T%W*T%W,$=D1(U,K9,W)*U%W,q=D1($,QA,W)*T%W,X=D1(q,qk,W)*q%W,K=D1(X,A,W)*X%W,F=D1(K,P,W)*K%W,M=D1(F,Q,W)*F%W,I=D1(M,C,W)*M%W,E=D1(I,C,W)*M%W,L=D1(E,A,W)*X%W;return{pow_p_5_8:D1(L,K9,W)*T%W,b2:U}}function Kk(T){return T[0]&=248,T[31]&=127,T[31]|=64,T}var ZC=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function HC(T,A){let P=h8,Q=E1(A*A*A,P),C=E1(Q*Q*A,P),W=Hk(T*C).pow_p_5_8,G=E1(T*Q*W,P),U=E1(A*G*G,P),$=G,q=E1(G*ZC,P),X=U===T,K=U===E1(-T,P),F=U===E1(-T*ZC,P);if(X)G=$;if(K||F)G=q;if(AA(G,P))G=E1(-G,P);return{isValid:X||K,value:G}}var OA=(()=>G0(N2.p,{isLE:!0}))(),jk=(()=>G0(N2.n,{isLE:!0}))(),Rk=(()=>({...N2,Fp:OA,hash:n$,adjustScalarBytes:Kk,uvRatio:HC}))(),eT=(()=>H9(Rk))();var qC=ZC,kk=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),Fk=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),Dk=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),Mk=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),j9=(T)=>HC(QA,T),zk=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),XC=(T)=>eT.Point.Fp.create(TA(T)&zk);function R9(T){let{d:A}=N2,P=h8,Q=(O)=>OA.create(O),C=Q(qC*T*T),W=Q((C+QA)*Dk),G=BigInt(-1),U=Q((G-A*C)*Q(C+A)),{isValid:$,value:q}=HC(W,U),X=Q(q*T);if(!AA(X,P))X=Q(-X);if(!$)q=X;if(!$)G=C;let K=Q(G*(C-QA)*Mk-U),F=q*q,M=Q((q+q)*U),I=Q(K*kk),E=Q(QA-F),L=Q(QA+F);return new eT.Point(Q(M*L),Q(E*I),Q(I*L),Q(M*E))}function Ik(T){wT(T,64);let A=XC(T.subarray(0,32)),P=R9(A),Q=XC(T.subarray(32,64)),C=R9(Q);return new cT(P.add(C))}class cT extends YC{constructor(T){super(T)}static fromAffine(T){return new cT(eT.Point.fromAffine(T))}assertSame(T){if(!(T instanceof cT))throw Error("RistrettoPoint expected")}init(T){return new cT(T)}static hashToCurve(T){return Ik(Y1("ristrettoHash",T,64))}static fromBytes(T){wT(T,32);let{a:A,d:P}=N2,Q=h8,C=(v)=>OA.create(v),W=XC(T);if(!a$(OA.toBytes(W),T)||AA(W,Q))throw Error("invalid ristretto255 encoding 1");let G=C(W*W),U=C(QA+A*G),$=C(QA-A*G),q=C(U*U),X=C($*$),K=C(A*P*q-X),{isValid:F,value:M}=j9(C(K*X)),I=C(M*$),E=C(M*I*K),L=C((W+W)*I);if(AA(L,Q))L=C(-L);let O=C(U*E),m=C(L*O);if(!F||AA(m,Q)||O===Zk)throw Error("invalid ristretto255 encoding 2");return new cT(new eT.Point(L,O,QA,m))}static fromHex(T){return cT.fromBytes(Y1("ristrettoHex",T,32))}static msm(T,A){return _8(cT,eT.Point.Fn,T,A)}toBytes(){let{X:T,Y:A,Z:P,T:Q}=this.ep,C=h8,W=(E)=>OA.create(E),G=W(W(P+A)*W(P-A)),U=W(T*A),$=W(U*U),{value:q}=j9(W(G*$)),X=W(q*G),K=W(q*U),F=W(X*K*Q),M;if(AA(Q*F,C)){let E=W(A*qC),L=W(T*qC);T=E,A=L,M=W(X*Fk)}else M=K;if(AA(T*F,C))A=W(-A);let I=W((P-A)*M);if(AA(I,C))I=W(-I);return OA.toBytes(I)}equals(T){this.assertSame(T);let{X:A,Y:P}=this.ep,{X:Q,Y:C}=T.ep,W=($)=>OA.create($),G=W(A*C)===W(P*Q),U=W(P*C)===W(A*Q);return G||U}is0(){return this.equals(cT.ZERO)}}cT.BASE=(()=>new cT(eT.Point.BASE))();cT.ZERO=(()=>new cT(eT.Point.ZERO))();cT.Fp=(()=>OA)();cT.Fn=(()=>jk)();var zW=iT(jC(),1),A0=iT(kC(),1);var FC=t6;var c8=iT(x9(),1),N=iT(WA(),1),tV=iT(WA(),1);var VD=1,YD=2,ZD=3,qD=4,XD=5,HD=6,KD=7,jD=8,RD=9,kD=10,FD=-32700,DD=-32603,MD=-32602,zD=-32601,ID=-32600,SD=-32016,ND=-32015,LD=-32014,wD=-32013,ED=-32012,BD=-32011,OD=-32010,xD=-32009,_D=-32008,hD=-32007,gD=-32006,mD=-32005,vD=-32004,yD=-32003,bD=-32002,lD=-32001,pD=2800000,uD=2800001,dD=2800002,rD=2800003,cD=2800004,oD=2800005,fD=2800006,nD=2800007,iD=2800008,aD=2800009,sD=2800010,tD=2800011,eD=3230000,T5=32300001,A5=3230002,P5=3230003,Q5=3230004,C5=3610000,W5=3610001,G5=3610002,J5=3610003,U5=3610004,$5=3610005,V5=3610006,Y5=3610007,Z5=3611000,q5=3704000,X5=3704001,H5=3704002,K5=3704003,j5=3704004,R5=4128000,k5=4128001,F5=4128002,D5=4615000,M5=4615001,z5=4615002,I5=4615003,S5=4615004,N5=4615005,L5=4615006,w5=4615007,E5=4615008,B5=4615009,O5=4615010,x5=4615011,_5=4615012,h5=4615013,g5=4615014,m5=4615015,v5=4615016,y5=4615017,b5=4615018,l5=4615019,p5=4615020,u5=4615021,d5=4615022,r5=4615023,c5=4615024,o5=4615025,f5=4615026,n5=4615027,i5=4615028,a5=4615029,s5=4615030,t5=4615031,e5=4615032,T7=4615033,A7=4615034,P7=4615035,Q7=4615036,C7=4615037,W7=4615038,G7=4615039,J7=4615040,U7=4615041,$7=4615042,V7=4615043,Y7=4615044,Z7=4615045,q7=4615046,X7=4615047,H7=4615048,K7=4615049,j7=4615050,R7=4615051,k7=4615052,F7=4615053,D7=4615054,M7=5508000,z7=5508001,I7=5508002,S7=5508003,N7=5508004,L7=5508005,w7=5508006,E7=5508007,B7=5508008,O7=5508009,x7=5508010,_7=5508011,h7=5663000,g7=5663001,m7=5663002,v7=5663003,y7=5663004,b7=5663005,l7=5663006,p7=5663007,u7=5663008,d7=5663009,r7=5663010,c7=5663011,o7=5663012,f7=5663013,n7=5663014,i7=5663015,a7=5663016,s7=5663017,t7=5663018,e7=5663019,TM=5663020,AM=7050000,PM=7050001,QM=7050002,CM=7050003,WM=7050004,GM=7050005,JM=7050006,UM=7050007,$M=7050008,VM=7050009,YM=7050010,ZM=7050011,qM=7050012,XM=7050013,HM=7050014,KM=7050015,jM=7050016,RM=7050017,kM=7050018,FM=7050019,DM=7050020,MM=7050021,zM=7050022,IM=7050023,SM=7050024,NM=7050025,LM=7050026,wM=7050027,EM=7050028,BM=7050029,OM=7050030,xM=7050031,_M=7050032,hM=7050033,gM=7050034,mM=7050035,vM=7050036,oC=8078000,fC=8078001,m9=8078002,v9=8078003,nC=8078004,iC=8078005,aC=8078006,yM=8078007,bM=8078008,lM=8078009,pM=8078010,sC=8078011,uM=8078012,y9=8078013,b9=8078014,dM=8078015,rM=8078016,cM=8078017,oM=8078018,fM=8078019,l9=8078020,p9=8078021,nM=8078022,iM=8100000,aM=8100001,sM=8100002,tM=8100003,eM=8190000,Tz=8190001,Az=8190002,Pz=8190003,Qz=8190004,Cz=9900000,Wz=9900001,Gz=9900002,Jz=9900003,Uz=9900004;var $z={[eD]:"Account not found at address: $address",[Q5]:"Not all accounts were decoded. Encoded accounts found at addresses: $addresses.",[P5]:"Expected decoded account at address: $address",[A5]:"Failed to decode account data at address: $address",[T5]:"Accounts not found at addresses: $addresses",[aD]:"Unable to find a viable program address bump seed.",[dD]:"$putativeAddress is not a base58-encoded address.",[pD]:"Expected base58 encoded address to decode to a byte array of length 32. Actual length: $actualLength.",[rD]:"The `CryptoKey` must be an `Ed25519` public key.",[tD]:"$putativeOffCurveAddress is not a base58-encoded off-curve address.",[iD]:"Invalid seeds; point must fall off the Ed25519 curve.",[cD]:"Expected given program derived address to have the following format: [Address, ProgramDerivedAddressBump].",[fD]:"A maximum of $maxSeeds seeds, including the bump seed, may be supplied when creating an address. Received: $actual.",[nD]:"The seed at index $index with length $actual exceeds the maximum length of $maxSeedLength bytes.",[oD]:"Expected program derived address bump to be in the range [0, 255], got: $bump.",[sD]:"Program address cannot end with PDA marker.",[uD]:"Expected base58-encoded address string of length in the range [32, 44]. Actual length: $actualLength.",[qD]:"Expected base58-encoded blockash string of length in the range [32, 44]. Actual length: $actualLength.",[VD]:"The network has progressed past the last block for which this transaction could have been committed.",[oC]:"Codec [$codecDescription] cannot decode empty byte arrays.",[nM]:"Enum codec cannot use lexical values [$stringValues] as discriminators. Either remove all lexical values or set `useValuesAsDiscriminators` to `false`.",[l9]:"Sentinel [$hexSentinel] must not be present in encoded bytes [$hexEncodedBytes].",[iC]:"Encoder and decoder must have the same fixed size, got [$encoderFixedSize] and [$decoderFixedSize].",[aC]:"Encoder and decoder must have the same max size, got [$encoderMaxSize] and [$decoderMaxSize].",[nC]:"Encoder and decoder must either both be fixed-size or variable-size.",[bM]:"Enum discriminator out of range. Expected a number in [$formattedValidDiscriminators], got $discriminator.",[m9]:"Expected a fixed-size codec, got a variable-size one.",[y9]:"Codec [$codecDescription] expected a positive byte length, got $bytesLength.",[v9]:"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].",[fC]:"Codec [$codecDescription] expected $expected bytes, got $bytesLength.",[oM]:"Expected byte array constant [$hexConstant] to be present in data [$hexData] at offset [$offset].",[lM]:"Invalid discriminated union variant. Expected one of [$variants], got $value.",[pM]:"Invalid enum variant. Expected one of [$stringValues] or a number in [$formattedNumericalValues], got $variant.",[dM]:"Invalid literal union variant. Expected one of [$variants], got $value.",[yM]:"Expected [$codecDescription] to have $expected items, got $actual.",[uM]:"Invalid value $value for base $base with alphabet $alphabet.",[rM]:"Literal union discriminator out of range. Expected a number between $minRange and $maxRange, got $discriminator.",[sC]:"Codec [$codecDescription] expected number to be in the range [$min, $max], got $value.",[b9]:"Codec [$codecDescription] expected offset to be in the range [0, $bytesLength], got $offset.",[p9]:"Expected sentinel [$hexSentinel] to be present in decoded bytes [$hexDecodedBytes].",[cM]:"Union variant out of range. Expected an index between $minRange and $maxRange, got $variant.",[Z5]:"No random values implementation could be found.",[B5]:"instruction requires an uninitialized account",[r5]:"instruction tries to borrow reference for an account which is already borrowed",[c5]:"instruction left account with an outstanding borrowed reference",[u5]:"program other than the account's owner changed the size of the account data",[N5]:"account data too small for instruction",[d5]:"instruction expected an executable account",[q7]:"An account does not have enough lamports to be rent-exempt",[H7]:"Program arithmetic overflowed",[Z7]:"Failed to serialize or deserialize account data: $encodedData",[D7]:"Builtin programs must consume compute units",[e5]:"Cross-program invocation call depth too deep",[W7]:"Computational budget exceeded",[f5]:"custom program error: #$code",[y5]:"instruction contains duplicate accounts",[o5]:"instruction modifications of multiply-passed account differ",[s5]:"executable accounts must be rent exempt",[i5]:"instruction changed executable accounts data",[a5]:"instruction changed the balance of an executable account",[b5]:"instruction changed executable bit of an account",[g5]:"instruction modified data of an account it does not own",[h5]:"instruction spent from the balance of an account it does not own",[M5]:"generic instruction error",[j7]:"Provided owner is not allowed",[V7]:"Account is immutable",[Y7]:"Incorrect authority provided",[w5]:"incorrect program id for instruction",[L5]:"insufficient funds for instruction",[S5]:"invalid account data for instruction",[X7]:"Invalid account owner",[z5]:"invalid program argument",[n5]:"program returned invalid error code",[I5]:"invalid instruction data",[C7]:"Failed to reallocate account data",[Q7]:"Provided seeds do not result in a valid address",[R7]:"Accounts data allocations exceeded the maximum allowed per transaction",[k7]:"Max accounts exceeded",[F7]:"Max instruction trace length exceeded",[P7]:"Length of the seed is too long for address generation",[T7]:"An account required by the instruction is missing",[E5]:"missing required signature for instruction",[_5]:"instruction illegally modified the program id of an account",[p5]:"insufficient account keys for instruction",[G7]:"Cross-program invocation with unauthorized signer or writable account",[J7]:"Failed to create program execution environment",[$7]:"Program failed to compile",[U7]:"Program failed to complete",[v5]:"instruction modified data of a read-only account",[m5]:"instruction changed the balance of a read-only account",[A7]:"Cross-program invocation reentrancy not allowed for this instruction",[l5]:"instruction modified rent epoch of an account",[x5]:"sum of account balances before and after instruction do not match",[O5]:"instruction requires an initialized account",[D5]:"",[t5]:"Unsupported program id",[K7]:"Unsupported sysvar",[R5]:"The instruction does not have any accounts.",[k5]:"The instruction does not have any data.",[F5]:"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.",[YD]:"The nonce `$expectedNonceValue` is no longer valid. It has advanced to `$actualNonceValue`",[Gz]:"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",[Uz]:"Invariant violation: This data publisher does not publish to the channel named `$channelName`. Supported channels include $supportedChannelNames.",[Wz]:"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",[Cz]:"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",[Jz]:"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",[DD]:"JSON-RPC error: Internal JSON-RPC error ($__serverMessage)",[MD]:"JSON-RPC error: Invalid method parameter(s) ($__serverMessage)",[ID]:"JSON-RPC error: The JSON sent is not a valid `Request` object ($__serverMessage)",[zD]:"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)",[ED]:"$__serverMessage",[lD]:"$__serverMessage",[vD]:"$__serverMessage",[LD]:"$__serverMessage",[OD]:"$__serverMessage",[xD]:"$__serverMessage",[SD]:"Minimum context slot has not been reached",[mD]:"Node is unhealthy; behind by $numSlotsBehind slots",[_D]:"No snapshot",[bD]:"Transaction simulation failed",[hD]:"$__serverMessage",[BD]:"Transaction history is not available from this node",[gD]:"$__serverMessage",[wD]:"Transaction signature length mismatch",[yD]:"Transaction signature verification failure",[ND]:"$__serverMessage",[q5]:"Key pair bytes must be of length 64, got $byteLength.",[X5]:"Expected private key bytes with length 32. Actual length: $actualLength.",[H5]:"Expected base58-encoded signature to decode to a byte array of length 64. Actual length: $actualLength.",[j5]:"The provided private key does not match the provided public key.",[K5]:"Expected base58-encoded signature string of length in the range [64, 88]. Actual length: $actualLength.",[HD]:"Lamports value must be in the range [0, 2e64-1]",[KD]:"`$value` cannot be parsed as a `BigInt`",[kD]:"$message",[jD]:"`$value` cannot be parsed as a `Number`",[ZD]:"No nonce account could be found at address `$nonceAccountAddress`",[eM]:"The notification name must end in 'Notifications' and the API must supply a subscription plan creator function for the notification '$notificationName'.",[Az]:"WebSocket was closed before payload could be added to the send buffer",[Pz]:"WebSocket connection closed",[Qz]:"WebSocket failed to connect",[Tz]:"Failed to obtain a subscription id from the server",[tM]:"Could not find an API plan for RPC method: `$method`",[iM]:"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",[aM]:"HTTP header(s) forbidden: $headers. Learn more at https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name.",[M7]:"Multiple distinct signers were identified for address `$address`. Please ensure that you are using the same signer instance for each address.",[z7]:"The provided value does not implement the `KeyPairSigner` interface",[S7]:"The provided value does not implement the `MessageModifyingSigner` interface",[N7]:"The provided value does not implement the `MessagePartialSigner` interface",[I7]:"The provided value does not implement any of the `MessageSigner` interfaces",[w7]:"The provided value does not implement the `TransactionModifyingSigner` interface",[E7]:"The provided value does not implement the `TransactionPartialSigner` interface",[B7]:"The provided value does not implement the `TransactionSendingSigner` interface",[L7]:"The provided value does not implement any of the `TransactionSigner` interfaces",[O7]:"More than one `TransactionSendingSigner` was identified.",[x7]:"No `TransactionSendingSigner` was identified. Please provide a valid `TransactionWithSingleSendingSigner` transaction.",[_7]:"Wallet account signers do not support signing multiple messages/transactions in a single operation",[Y5]:"Cannot export a non-extractable key.",[W5]:"No digest implementation could be found.",[C5]:"Cryptographic operations are only allowed in secure browser contexts. Read more here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts.",[G5]:`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)&&LT(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.`,[J5]:"No signature verification implementation could be found.",[U5]:"No key generation implementation could be found.",[$5]:"No signing implementation could be found.",[V5]:"No key export implementation could be found.",[RD]:"Timestamp value must be in the range [-(2n ** 63n), (2n ** 63n) - 1]. `$value` given",[jM]:"Transaction processing left an account with an outstanding borrowed reference",[PM]:"Account in use",[QM]:"Account loaded twice",[CM]:"Attempt to debit an account but found no record of a prior credit.",[IM]:"Transaction loads an address table account that doesn't exist",[UM]:"This transaction has already been processed",[$M]:"Blockhash not found",[VM]:"Loader call chain is too deep",[KM]:"Transactions are currently disabled due to cluster maintenance",[OM]:"Transaction contains a duplicate instruction ($index) that is not allowed",[GM]:"Insufficient funds for fee",[xM]:"Transaction results in an account ($accountIndex) with insufficient funds for rent",[JM]:"This account may not be used to pay transaction fees",[ZM]:"Transaction contains an invalid account reference",[NM]:"Transaction loads an address table account with invalid data",[LM]:"Transaction address table lookup uses an invalid index",[SM]:"Transaction loads an address table account with an invalid owner",[hM]:"LoadedAccountsDataSizeLimit set for transaction must be greater than 0.",[XM]:"This program may not be used for executing instructions",[wM]:"Transaction leaves an account with a lower balance than rent-exempt minimum",[FM]:"Transaction loads a writable account that cannot be written",[_M]:"Transaction exceeded max loaded accounts data size cap",[YM]:"Transaction requires a fee but has no signature present",[WM]:"Attempt to load a program that does not exist",[mM]:"Execution of the program referenced by account at index $accountIndex is temporarily restricted.",[gM]:"ResanitizationNeeded",[HM]:"Transaction failed to sanitize accounts offsets correctly",[qM]:"Transaction did not pass signature verification",[zM]:"Transaction locked too many accounts",[vM]:"Sum of account balances before and after transaction do not match",[AM]:"The transaction failed with the error `$errorName`",[kM]:"Transaction version is unsupported",[MM]:"Transaction would exceed account data limit within the block",[BM]:"Transaction would exceed total account data limit",[DM]:"Transaction would exceed max account limit within the block",[RM]:"Transaction would exceed max Block Cost Limit",[EM]:"Transaction would exceed max Vote Cost Limit",[i7]:"Attempted to sign a transaction with an address that is not a signer for it",[r7]:"Transaction is missing an address at index: $index.",[a7]:"Transaction has no expected signers therefore it cannot be encoded",[TM]:"Transaction size $transactionSize exceeds limit of $transactionSizeLimit bytes",[m7]:"Transaction does not have a blockhash lifetime",[v7]:"Transaction is not a durable nonce transaction",[b7]:"Contents of these address lookup tables unknown: $lookupTableAddresses",[l7]:"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",[u7]:"No fee payer set in CompiledTransaction",[p7]:"Could not find program address at index $index",[t7]:"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",[e7]:"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",[c7]:"Transaction is missing a fee payer.",[o7]:"Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer.",[n7]:"Transaction first instruction is not advance nonce account instruction.",[f7]:"Transaction with no instructions cannot be durable nonce transaction.",[h7]:"This transaction includes an address (`$programAddress`) which is both invoked and set as the fee payer. Program addresses may not pay fees",[g7]:"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.",[d7]:"Transaction is missing signatures for addresses: $addresses.",[y7]:"Transaction version must be in the range [0, 127]. `$actualVersion` given"},GA="i",b0="t";function Vz(T,A={}){let P=$z[T];if(P.length===0)return"";let Q;function C(G){if(Q[b0]===2){let U=P.slice(Q[GA]+1,G);W.push(U in A?`${A[U]}`:`$${U}`)}else if(Q[b0]===1)W.push(P.slice(Q[GA],G))}let W=[];return P.split("").forEach((G,U)=>{if(U===0){Q={[GA]:0,[b0]:P[0]==="\\"?0:P[0]==="$"?2:1};return}let $;switch(Q[b0]){case 0:$={[GA]:U,[b0]:1};break;case 1:if(G==="\\")$={[GA]:U,[b0]:0};else if(G==="$")$={[GA]:U,[b0]:2};break;case 2:if(G==="\\")$={[GA]:U,[b0]:0};else if(G==="$")$={[GA]:U,[b0]:2};else if(!G.match(/\w/))$={[GA]:U,[b0]:1};break}if($){if(Q!==$)C(U);Q=$}}),C(),W.join("")}function Yz(T,A={}){return Vz(T,A)}var hA=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=Yz(T,P);super(C,Q);this.context={__code:T,...P},this.name="SolanaError"}};function Zz(T,A){return"fixedSize"in A?A.fixedSize:A.getSizeFromValue(T)}function u9(T){return Object.freeze({...T,encode:(A)=>{let P=new Uint8Array(Zz(A,T));return T.write(A,P,0),P}})}function d9(T){return Object.freeze({...T,decode:(A,P=0)=>T.read(A,P)[0]})}function y8(T){return"fixedSize"in T&&typeof T.fixedSize==="number"}function r9(T,A){if(y8(T)!==y8(A))throw new hA(nC);if(y8(T)&&y8(A)&&T.fixedSize!==A.fixedSize)throw new hA(iC,{decoderFixedSize:A.fixedSize,encoderFixedSize:T.fixedSize});if(!y8(T)&&!y8(A)&&T.maxSize!==A.maxSize)throw new hA(aC,{decoderMaxSize:A.maxSize,encoderMaxSize:T.maxSize});return{...A,...T,decode:A.decode,encode:T.encode,read:A.read,write:T.write}}function c9(T,A,P=0){if(A.length-P<=0)throw new hA(oC,{codecDescription:T})}function o9(T,A,P,Q=0){let C=P.length-Q;if(C<A)throw new hA(fC,{bytesLength:C,codecDescription:T,expected:A})}function qz(T,A,P,Q){if(Q<A||Q>P)throw new hA(sC,{codecDescription:T,max:P,min:A,value:Q})}function f9(T){return T?.endian===1?!1:!0}function Xz(T){return u9({fixedSize:T.size,write(A,P,Q){if(T.range)qz(T.name,T.range[0],T.range[1],A);let C=new ArrayBuffer(T.size);return T.set(new DataView(C),A,f9(T.config)),P.set(new Uint8Array(C),Q),Q+T.size}})}function Hz(T){return d9({fixedSize:T.size,read(A,P=0){c9(T.name,A,P),o9(T.name,T.size,A,P);let Q=new DataView(Kz(A,P,T.size));return[T.get(Q,f9(T.config)),P+T.size]}})}function Kz(T,A,P){let Q=T.byteOffset+(A??0),C=P??T.byteLength;return T.buffer.slice(Q,Q+C)}var tC=(T={})=>Xz({config:T,name:"u64",range:[0n,BigInt("0xffffffffffffffff")],set:(A,P,Q)=>A.setBigUint64(0,BigInt(P),Q),size:8}),jz=(T={})=>Hz({config:T,get:(A,P)=>A.getBigUint64(0,P),name:"u64",size:8}),n9=(T={})=>r9(tC(T),jz(T));class a9 extends TypeError{constructor(T,A){let P,{message:Q,explanation:C,...W}=T,{path:G}=T,U=G.length===0?Q:`At path: ${G.join(".")} -- ${Q}`;super(C??U);if(C!=null)this.cause=U;Object.assign(this,W),this.name=this.constructor.name,this.failures=()=>{return P??(P=[T,...A()])}}}function Rz(T){return w2(T)&&typeof T[Symbol.iterator]==="function"}function w2(T){return typeof T==="object"&&T!=null}function j4(T){return w2(T)&&!Array.isArray(T)}function k0(T){if(typeof T==="symbol")return T.toString();return typeof T==="string"?JSON.stringify(T):`${T}`}function kz(T){let{done:A,value:P}=T.next();return A?void 0:P}function Fz(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:U,message:$=`Expected a value of type \`${G}\`${U?` with refinement \`${U}\``:""}, but received: \`${k0(Q)}\``}=T;return{value:Q,type:G,refinement:U,key:C[C.length-1],path:C,branch:W,...T,message:$}}function*i9(T,A,P,Q){if(!Rz(T))T=[T];for(let C of T){let W=Fz(C,A,P,Q);if(W)yield W}}function*eC(T,A,P={}){let{path:Q=[],branch:C=[T],coerce:W=!1,mask:G=!1}=P,U={path:Q,branch:C,mask:G};if(W)T=A.coercer(T,U);let $="valid";for(let q of A.validator(T,U))q.explanation=P.message,$="not_valid",yield[q,void 0];for(let[q,X,K]of A.entries(T,U)){let F=eC(X,K,{path:q===void 0?Q:[...Q,q],branch:q===void 0?C:[...C,X],coerce:W,mask:G,message:P.message});for(let M of F)if(M[0])$=M[0].refinement!=null?"not_refined":"not_valid",yield[M[0],void 0];else if(W){if(X=M[1],q===void 0)T=X;else if(T instanceof Map)T.set(q,X);else if(T instanceof Set)T.add(X);else if(w2(T)){if(X!==void 0||q in T)T[q]=X}}}if($!=="not_valid")for(let q of A.refiner(T,U))q.explanation=P.message,$="not_refined",yield[q,void 0];if($==="valid")yield[void 0,T]}class F0{constructor(T){let{type:A,schema:P,validator:Q,refiner:C,coercer:W=(U)=>U,entries:G=function*(){}}=T;if(this.type=A,this.schema=P,this.entries=G,this.coercer=W,Q)this.validator=(U,$)=>{let q=Q(U,$);return i9(q,$,this,U)};else this.validator=()=>[];if(C)this.refiner=(U,$)=>{let q=C(U,$);return i9(q,$,this,U)};else this.refiner=()=>[]}assert(T,A){return s9(T,this,A)}create(T,A){return b8(T,this,A)}is(T){return t9(T,this)}mask(T,A){return Dz(T,this,A)}validate(T,A={}){return E2(T,this,A)}}function s9(T,A,P){let Q=E2(T,A,{message:P});if(Q[0])throw Q[0]}function b8(T,A,P){let Q=E2(T,A,{coerce:!0,message:P});if(Q[0])throw Q[0];else return Q[1]}function Dz(T,A,P){let Q=E2(T,A,{coerce:!0,mask:!0,message:P});if(Q[0])throw Q[0];else return Q[1]}function t9(T,A){return!E2(T,A)[0]}function E2(T,A,P={}){let Q=eC(T,A,P),C=kz(Q);if(C[0])return[new a9(C[0],function*(){for(let G of Q)if(G[0])yield G[0]}),void 0];else return[void 0,C[1]]}function $8(T,A){return new F0({type:T,schema:null,validator:A})}function e9(){return $8("any",()=>!0)}function s(T){return new F0({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: ${k0(A)}`}})}function D0(){return $8("boolean",(T)=>{return typeof T==="boolean"})}function R4(T){return $8("instance",(A)=>{return A instanceof T||`Expected a \`${T.name}\` instance, but received: ${k0(A)}`})}function M1(T){let A=k0(T),P=typeof T;return new F0({type:"literal",schema:P==="string"||P==="number"||P==="boolean"?T:null,validator(Q){return Q===T||`Expected the literal \`${A}\`, but received: ${k0(Q)}`}})}function Mz(){return $8("never",()=>!1)}function t(T){return new F0({...T,validator:(A,P)=>A===null||T.validator(A,P),refiner:(A,P)=>A===null||T.refiner(A,P)})}function B(){return $8("number",(T)=>{return typeof T==="number"&&!isNaN(T)||`Expected a number, but received: ${k0(T)}`})}function A1(T){return new F0({...T,validator:(A,P)=>A===void 0||T.validator(A,P),refiner:(A,P)=>A===void 0||T.refiner(A,P)})}function TW(T,A){return new F0({type:"record",schema:null,*entries(P){if(w2(P))for(let Q in P){let C=P[Q];yield[Q,Q,T],yield[Q,C,A]}},validator(P){return j4(P)||`Expected an object, but received: ${k0(P)}`},coercer(P){return j4(P)?{...P}:P}})}function p(){return $8("string",(T)=>{return typeof T==="string"||`Expected a string, but received: ${k0(T)}`})}function k4(T){let A=Mz();return new F0({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: ${k0(P)}`},coercer(P){return Array.isArray(P)?P.slice():P}})}function y(T){let A=Object.keys(T);return new F0({type:"type",schema:T,*entries(P){if(w2(P))for(let Q of A)yield[Q,P[Q],T[Q]]},validator(P){return j4(P)||`Expected an object, but received: ${k0(P)}`},coercer(P){return j4(P)?{...P}:P}})}function hT(T){let A=T.map((P)=>P.type).join(" | ");return new F0({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]=eC(P,W,Q),[U]=G;if(!U[0])return[];else for(let[$]of G)if($)C.push($)}return[`Expected the value to satisfy a union of \`${A}\`, but received: ${k0(P)}`,...C]}})}function V8(){return $8("unknown",()=>!0)}function l8(T,A,P){return new F0({...T,coercer:(Q,C)=>{return t9(Q,A)?T.coercer(P(Q,C),C):T.coercer(Q,C)}})}var XI=iT(MV(),1);w8();var SV=iT(IV(),1);var iz=BigInt(0),v2=BigInt(1),az=BigInt(2),sz=BigInt(7),tz=BigInt(256),ez=BigInt(113),wV=[],EV=[],BV=[];for(let T=0,A=v2,P=1,Q=0;T<24;T++){[P,Q]=[Q,(2*P+3*Q)%5],wV.push(2*(5*Q+P)),EV.push((T+1)*(T+2)/2%64);let C=iz;for(let W=0;W<7;W++)if(A=(A<<v2^(A>>sz)*ez)%tz,A&az)C^=v2<<(v2<<BigInt(W))-v2;BV.push(C)}var OV=s6(BV,!0),TI=OV[0],AI=OV[1],NV=(T,A,P)=>P>32?y$(T,A,P):m$(T,A,P),LV=(T,A,P)=>P>32?b$(T,A,P):v$(T,A,P);function PI(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 U=(G+8)%10,$=(G+2)%10,q=P[$],X=P[$+1],K=NV(q,X,1)^P[U],F=LV(q,X,1)^P[U+1];for(let M=0;M<50;M+=10)T[G+M]^=K,T[G+M+1]^=F}let C=T[2],W=T[3];for(let G=0;G<24;G++){let U=EV[G],$=NV(C,W,U),q=LV(C,W,U),X=wV[G];C=T[X],W=T[X+1],T[X]=$,T[X+1]=q}for(let G=0;G<50;G+=10){for(let U=0;U<10;U++)P[U]=T[G+U];for(let U=0;U<10;U++)T[G+U]^=~P[(U+2)%10]&P[(U+4)%10]}T[0]^=TI[Q],T[1]^=AI[Q]}q0(P)}class YW extends T8{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,IA(P),!(0<T&&T<200))throw Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=O$(this.state)}clone(){return this._cloneInto()}keccak(){oQ(this.state32),PI(this.state32,this.rounds),oQ(this.state32),this.posOut=0,this.pos=0}update(T){s0(this),T=eA(T),wT(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){s0(this,!1),wT(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 IA(T),this.xofInto(new Uint8Array(T))}digestInto(T){if(f6(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,q0(this.state)}_cloneInto(T){let{blockLen:A,suffix:P,outputLen:Q,rounds:C,enableXOF:W}=this;return T||(T=new YW(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 QI=(T,A,P)=>R2(()=>new YW(A,T,P));var ZW=(()=>QI(1,136,32))();class qW extends T8{constructor(T,A){super();this.finished=!1,this.destroyed=!1,o6(T);let P=eA(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),q0(C)}update(T){return s0(this),this.iHash.update(T),this}digestInto(T){s0(this),wT(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 XW=(T,A,P)=>new qW(T,A).update(P).digest();XW.create=(T,A)=>new qW(T,A);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var xV=(T,A)=>(T+(T>=0?A:-A)/hV)/A;function CI(T,A,P){let[[Q,C],[W,G]]=A,U=xV(G*T,P),$=xV(-C*T,P),q=T-U*Q-$*W,X=-U*C-$*G,K=q<UA,F=X<UA;if(K)q=-q;if(F)X=-X;let M=wA(Math.ceil(T4(P)/2))+u8;if(q<UA||q>=M||X<UA||X>=M)throw Error("splitScalar (endomorphism): failed, k="+T);return{k1neg:K,k1:q,k2neg:F,k2:X}}function KW(T){if(!["compact","recovered","der"].includes(T))throw Error('Signature format must be "compact", "recovered", or "der"');return T}function HW(T,A){let P={};for(let Q of Object.keys(A))P[Q]=T[Q]===void 0?A[Q]:T[Q];if(e0(P.lowS,"lowS"),e0(P.prehash,"prehash"),P.format!==void 0)KW(P.format);return P}class _V extends Error{constructor(T=""){super(T)}}var JA={Err:_V,_tlv:{encode:(T,A)=>{let{Err:P}=JA;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=D2(Q);if(C.length/2&128)throw new P("tlv.encode: long form length too big");let W=Q>127?D2(C.length/2|128):"";return D2(T)+W+C+A},decode(T,A){let{Err:P}=JA,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 q=A.subarray(Q,Q+$);if(q.length!==$)throw new P("tlv.decode: length bytes not complete");if(q[0]===0)throw new P("tlv.decode(long): zero leftmost byte");for(let X of q)G=G<<8|X;if(Q+=$,G<128)throw new P("tlv.decode(long): not minimal encoding")}let U=A.subarray(Q,Q+G);if(U.length!==G)throw new P("tlv.decode: wrong value length");return{v:U,l:A.subarray(Q+G)}}},_int:{encode(T){let{Err:A}=JA;if(T<UA)throw new A("integer: negative integers are not allowed");let P=D2(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}=JA;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 B8(T)}},toSig(T){let{Err:A,_int:P,_tlv:Q}=JA,C=Y1("signature",T),{v:W,l:G}=Q.decode(48,C);if(G.length)throw new A("invalid signature: left bytes after parsing");let{v:U,l:$}=Q.decode(2,W),{v:q,l:X}=Q.decode(2,$);if(X.length)throw new A("invalid signature: left bytes after parsing");return{r:P.decode(U),s:P.decode(q)}},hexFromSig(T){let{_tlv:A,_int:P}=JA,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),u8=BigInt(1),hV=BigInt(2),I4=BigInt(3),WI=BigInt(4);function p8(T,A){let{BYTES:P}=T,Q;if(typeof A==="bigint")Q=A;else{let C=Y1("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 GI(T,A={}){let P=P4("weierstrass",T,A),{Fp:Q,Fn:C}=P,W=P.CURVE,{h:G,n:U}=W;EA(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 q=mV(Q,C);function X(){if(!Q.isOdd)throw Error("compression is not supported: Field does not have .isOdd()")}function K(x,R,J){let{x:V,y:Z}=R.toAffine(),H=Q.toBytes(V);if(e0(J,"isCompressed"),J){X();let j=!Q.isOdd(Z);return dT(gV(j),H)}else return dT(Uint8Array.of(4),H,Q.toBytes(Z))}function F(x){W0(x,void 0,"Point");let{publicKey:R,publicKeyUncompressed:J}=q,V=x.length,Z=x[0],H=x.subarray(1);if(V===R&&(Z===2||Z===3)){let j=Q.fromBytes(H);if(!Q.isValid(j))throw Error("bad point: is not on curve, wrong x");let z=E(j),S;try{S=Q.sqrt(z)}catch(D){let b=D instanceof Error?": "+D.message:"";throw Error("bad point: is not on curve, sqrt error"+b)}X();let k=Q.isOdd(S);if((Z&1)===1!==k)S=Q.neg(S);return{x:j,y:S}}else if(V===J&&Z===4){let j=Q.BYTES,z=Q.fromBytes(H.subarray(0,j)),S=Q.fromBytes(H.subarray(j,j*2));if(!L(z,S))throw Error("bad point: is not on curve");return{x:z,y:S}}else throw Error(`bad point: got length ${V}, expected compressed=${R} or uncompressed=${J}`)}let M=A.toBytes||K,I=A.fromBytes||F;function E(x){let R=Q.sqr(x),J=Q.mul(R,x);return Q.add(Q.add(J,Q.mul(x,W.a)),W.b)}function L(x,R){let J=Q.sqr(R),V=E(x);return Q.eql(J,V)}if(!L(W.Gx,W.Gy))throw Error("bad curve params: generator point");let O=Q.mul(Q.pow(W.a,I4),WI),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 v(x,R,J=!1){if(!Q.isValid(R)||J&&Q.is0(R))throw Error(`bad point coordinate ${x}`);return R}function l(x){if(!(x instanceof h))throw Error("ProjectivePoint expected")}function r(x){if(!$||!$.basises)throw Error("no endo");return CI(x,$.basises,C.ORDER)}let c=O8((x,R)=>{let{X:J,Y:V,Z}=x;if(Q.eql(Z,Q.ONE))return{x:J,y:V};let H=x.is0();if(R==null)R=H?Q.ONE:Q.inv(Z);let j=Q.mul(J,R),z=Q.mul(V,R),S=Q.mul(Z,R);if(H)return{x:Q.ZERO,y:Q.ZERO};if(!Q.eql(S,Q.ONE))throw Error("invZ was invalid");return{x:j,y:z}}),o=O8((x)=>{if(x.is0()){if(A.allowInfinityPoint&&!Q.is0(x.Y))return;throw Error("bad point: ZERO")}let{x:R,y:J}=x.toAffine();if(!Q.isValid(R)||!Q.isValid(J))throw Error("bad point: x or y not field elements");if(!L(R,J))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,J,V,Z){return J=new h(Q.mul(J.X,x),J.Y,J.Z),R=I2(V,R),J=I2(Z,J),R.add(J)}class h{constructor(x,R,J){this.X=v("x",x),this.Y=v("y",R,!0),this.Z=v("z",J),Object.freeze(this)}static CURVE(){return W}static fromAffine(x){let{x:R,y:J}=x||{};if(!x||!Q.isValid(R)||!Q.isValid(J))throw Error("invalid affine point");if(x instanceof h)throw Error("projective point not allowed");if(Q.is0(R)&&Q.is0(J))return h.ZERO;return new h(R,J,Q.ONE)}static fromBytes(x){let R=h.fromAffine(I(W0(x,void 0,"point")));return R.assertValidity(),R}static fromHex(x){return h.fromBytes(Y1("pointHex",x))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(x=8,R=!0){if(n.createCache(this,x),!R)this.multiply(I4);return this}assertValidity(){o(this)}hasEvenY(){let{y:x}=this.toAffine();if(!Q.isOdd)throw Error("Field doesn't support isOdd");return!Q.isOdd(x)}equals(x){l(x);let{X:R,Y:J,Z:V}=this,{X:Z,Y:H,Z:j}=x,z=Q.eql(Q.mul(R,j),Q.mul(Z,V)),S=Q.eql(Q.mul(J,j),Q.mul(H,V));return z&&S}negate(){return new h(this.X,Q.neg(this.Y),this.Z)}double(){let{a:x,b:R}=W,J=Q.mul(R,I4),{X:V,Y:Z,Z:H}=this,j=Q.ZERO,z=Q.ZERO,S=Q.ZERO,k=Q.mul(V,V),Y=Q.mul(Z,Z),D=Q.mul(H,H),b=Q.mul(V,Z);return b=Q.add(b,b),S=Q.mul(V,H),S=Q.add(S,S),j=Q.mul(x,S),z=Q.mul(J,D),z=Q.add(j,z),j=Q.sub(Y,z),z=Q.add(Y,z),z=Q.mul(j,z),j=Q.mul(b,j),S=Q.mul(J,S),D=Q.mul(x,D),b=Q.sub(k,D),b=Q.mul(x,b),b=Q.add(b,S),S=Q.add(k,k),k=Q.add(S,k),k=Q.add(k,D),k=Q.mul(k,b),z=Q.add(z,k),D=Q.mul(Z,H),D=Q.add(D,D),k=Q.mul(D,b),j=Q.sub(j,k),S=Q.mul(D,Y),S=Q.add(S,S),S=Q.add(S,S),new h(j,z,S)}add(x){l(x);let{X:R,Y:J,Z:V}=this,{X:Z,Y:H,Z:j}=x,z=Q.ZERO,S=Q.ZERO,k=Q.ZERO,Y=W.a,D=Q.mul(W.b,I4),b=Q.mul(R,Z),f=Q.mul(J,H),d=Q.mul(V,j),T1=Q.add(R,J),P1=Q.add(Z,H);T1=Q.mul(T1,P1),P1=Q.add(b,f),T1=Q.sub(T1,P1),P1=Q.add(R,V);let Q1=Q.add(Z,j);return P1=Q.mul(P1,Q1),Q1=Q.add(b,d),P1=Q.sub(P1,Q1),Q1=Q.add(J,V),z=Q.add(H,j),Q1=Q.mul(Q1,z),z=Q.add(f,d),Q1=Q.sub(Q1,z),k=Q.mul(Y,P1),z=Q.mul(D,d),k=Q.add(z,k),z=Q.sub(f,k),k=Q.add(f,k),S=Q.mul(z,k),f=Q.add(b,b),f=Q.add(f,b),d=Q.mul(Y,d),P1=Q.mul(D,P1),f=Q.add(f,d),d=Q.sub(b,d),d=Q.mul(Y,d),P1=Q.add(P1,d),b=Q.mul(f,P1),S=Q.add(S,b),b=Q.mul(Q1,P1),z=Q.mul(T1,z),z=Q.sub(z,b),b=Q.mul(T1,f),k=Q.mul(Q1,k),k=Q.add(k,b),new h(z,S,k)}subtract(x){return this.add(x.negate())}is0(){return this.equals(h.ZERO)}multiply(x){let{endo:R}=A;if(!C.isValidNot0(x))throw Error("invalid scalar: out of range");let J,V,Z=(H)=>n.cached(this,H,(j)=>PA(h,j));if(R){let{k1neg:H,k1:j,k2neg:z,k2:S}=r(x),{p:k,f:Y}=Z(j),{p:D,f:b}=Z(S);V=Y.add(b),J=u(R.beta,k,D,H,z)}else{let{p:H,f:j}=Z(x);J=H,V=j}return PA(h,[J,V])[0]}multiplyUnsafe(x){let{endo:R}=A,J=this;if(!C.isValid(x))throw Error("invalid scalar: out of range");if(x===UA||J.is0())return h.ZERO;if(x===u8)return J;if(n.hasCache(this))return this.multiply(x);if(R){let{k1neg:V,k1:Z,k2neg:H,k2:j}=r(x),{p1:z,p2:S}=X9(h,J,Z,j);return u(R.beta,z,S,V,H)}else return n.unsafe(J,x)}multiplyAndAddUnsafe(x,R,J){let V=this.multiplyUnsafe(R).add(x.multiplyUnsafe(J));return V.is0()?void 0:V}toAffine(x){return c(this,x)}isTorsionFree(){let{isTorsionFree:x}=A;if(G===u8)return!0;if(x)return x(h,this);return n.unsafe(this,U).is0()}clearCofactor(){let{clearCofactor:x}=A;if(G===u8)return this;if(x)return x(h,this);return this.multiplyUnsafe(G)}isSmallOrder(){return this.multiplyUnsafe(G).is0()}toBytes(x=!0){return e0(x,"isCompressed"),this.assertValidity(),M(h,this,x)}toHex(x=!0){return X0(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 PA(h,x)}static msm(x,R){return _8(h,C,x,R)}static fromPrivateKey(x){return h.BASE.multiply(p8(C,x))}}h.BASE=new h(W.Gx,W.Gy,Q.ONE),h.ZERO=new h(Q.ZERO,Q.ONE,Q.ZERO),h.Fp=Q,h.Fn=C;let a=C.BITS,n=new S2(h,A.endo?Math.ceil(a/2):a);return h.BASE.precompute(8),h}function gV(T){return Uint8Array.of(T?2:3)}function mV(T,A){return{secretKey:A.BYTES,publicKey:1+T.BYTES,publicKeyUncompressed:1+2*T.BYTES,publicKeyHasPrefix:!0,signature:2*A.BYTES}}function JI(T,A={}){let{Fn:P}=T,Q=A.randomBytes||E8,C=Object.assign(mV(T.Fp,P),{seed:WC(P.ORDER)});function W(M){try{return!!p8(P,M)}catch(I){return!1}}function G(M,I){let{publicKey:E,publicKeyUncompressed:L}=C;try{let O=M.length;if(I===!0&&O!==E)return!1;if(I===!1&&O!==L)return!1;return!!T.fromBytes(M)}catch(O){return!1}}function U(M=Q(C.seed)){return GC(W0(M,C.seed,"seed"),P.ORDER)}function $(M,I=!0){return T.BASE.multiply(p8(P,M)).toBytes(I)}function q(M){let I=U(M);return{secretKey:I,publicKey:$(I)}}function X(M){if(typeof M==="bigint")return!1;if(M instanceof T)return!0;let{secretKey:I,publicKey:E,publicKeyUncompressed:L}=C;if(P.allowedLengths||I===E)return;let O=Y1("key",M).length;return O===E||O===L}function K(M,I,E=!0){if(X(M)===!0)throw Error("first arg must be private key");if(X(I)===!1)throw Error("second arg must be public key");let L=p8(P,M);return T.fromHex(I).multiply(L).toBytes(E)}return Object.freeze({getPublicKey:$,getSharedSecret:K,keygen:q,Point:T,utils:{isValidSecretKey:W,isValidPublicKey:G,randomSecretKey:U,isValidPrivateKey:W,randomPrivateKey:U,normPrivateKeyToScalar:(M)=>p8(P,M),precompute(M=8,I=T.BASE){return I.precompute(M,!1)}},lengths:C})}function UI(T,A,P={}){o6(A),EA(P,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});let Q=P.randomBytes||E8,C=P.hmac||((J,...V)=>XW(A,J,dT(...V))),{Fp:W,Fn:G}=T,{ORDER:U,BITS:$}=G,{keygen:q,getPublicKey:X,getSharedSecret:K,utils:F,lengths:M}=JI(T,P),I={prehash:!1,lowS:typeof P.lowS==="boolean"?P.lowS:!1,format:void 0,extraEntropy:!1},E="compact";function L(J){let V=U>>u8;return J>V}function O(J,V){if(!G.isValidNot0(V))throw Error(`invalid signature ${J}: out of range 1..Point.Fn.ORDER`);return V}function m(J,V){KW(V);let Z=M.signature,H=V==="compact"?Z:V==="recovered"?Z+1:void 0;return W0(J,H,`${V} signature`)}class v{constructor(J,V,Z){if(this.r=O("r",J),this.s=O("s",V),Z!=null)this.recovery=Z;Object.freeze(this)}static fromBytes(J,V=E){m(J,V);let Z;if(V==="der"){let{r:S,s:k}=JA.toSig(W0(J));return new v(S,k)}if(V==="recovered")Z=J[0],V="compact",J=J.subarray(1);let H=G.BYTES,j=J.subarray(0,H),z=J.subarray(H,H*2);return new v(G.fromBytes(j),G.fromBytes(z),Z)}static fromHex(J,V){return this.fromBytes(tA(J),V)}addRecoveryBit(J){return new v(this.r,this.s,J)}recoverPublicKey(J){let V=W.ORDER,{r:Z,s:H,recovery:j}=this;if(j==null||![0,1,2,3].includes(j))throw Error("recovery id invalid");if(U*hV<V&&j>1)throw Error("recovery id is ambiguous for h>1 curve");let S=j===2||j===3?Z+U:Z;if(!W.isValid(S))throw Error("recovery id 2 or 3 invalid");let k=W.toBytes(S),Y=T.fromBytes(dT(gV((j&1)===0),k)),D=G.inv(S),b=r(Y1("msgHash",J)),f=G.create(-b*D),d=G.create(H*D),T1=T.BASE.multiplyUnsafe(f).add(Y.multiplyUnsafe(d));if(T1.is0())throw Error("point at infinify");return T1.assertValidity(),T1}hasHighS(){return L(this.s)}toBytes(J=E){if(KW(J),J==="der")return tA(JA.hexFromSig(this));let V=G.toBytes(this.r),Z=G.toBytes(this.s);if(J==="recovered"){if(this.recovery==null)throw Error("recovery bit must be present");return dT(Uint8Array.of(this.recovery),V,Z)}return dT(V,Z)}toHex(J){return X0(this.toBytes(J))}assertValidity(){}static fromCompact(J){return v.fromBytes(Y1("sig",J),"compact")}static fromDER(J){return v.fromBytes(Y1("sig",J),"der")}normalizeS(){return this.hasHighS()?new v(this.r,G.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return X0(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return X0(this.toBytes("compact"))}}let l=P.bits2int||function(V){if(V.length>8192)throw Error("input is too large");let Z=B8(V),H=V.length*8-$;return H>0?Z>>BigInt(H):Z},r=P.bits2int_modN||function(V){return G.create(l(V))},c=wA($);function o(J){return M2("num < 2^"+$,J,UA,c),G.toBytes(J)}function u(J,V){return W0(J,void 0,"message"),V?W0(A(J),void 0,"prehashed message"):J}function h(J,V,Z){if(["recovered","canonical"].some((d)=>(d in Z)))throw Error("sign() legacy options not supported");let{lowS:H,prehash:j,extraEntropy:z}=HW(Z,I);J=u(J,j);let S=r(J),k=p8(G,V),Y=[o(k),o(S)];if(z!=null&&z!==!1){let d=z===!0?Q(M.secretKey):z;Y.push(Y1("extraEntropy",d))}let D=dT(...Y),b=S;function f(d){let T1=l(d);if(!G.isValidNot0(T1))return;let P1=G.inv(T1),Q1=T.BASE.multiply(T1).toAffine(),nT=G.create(Q1.x);if(nT===UA)return;let $1=G.create(P1*G.create(b+nT*k));if($1===UA)return;let q1=(Q1.x===nT?0:2)|Number(Q1.y&u8),A2=$1;if(H&&L($1))A2=G.neg($1),q1^=1;return new v(nT,A2,q1)}return{seed:D,k2sig:f}}function a(J,V,Z={}){J=Y1("message",J);let{seed:H,k2sig:j}=h(J,V,Z);return t$(A.outputLen,G.BYTES,C)(H,j)}function n(J){let V=void 0,Z=typeof J==="string"||a0(J),H=!Z&&J!==null&&typeof J==="object"&&typeof J.r==="bigint"&&typeof J.s==="bigint";if(!Z&&!H)throw Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(H)V=new v(J.r,J.s);else if(Z){try{V=v.fromBytes(Y1("sig",J),"der")}catch(j){if(!(j instanceof JA.Err))throw j}if(!V)try{V=v.fromBytes(Y1("sig",J),"compact")}catch(j){return!1}}if(!V)return!1;return V}function x(J,V,Z,H={}){let{lowS:j,prehash:z,format:S}=HW(H,I);if(Z=Y1("publicKey",Z),V=u(Y1("message",V),z),"strict"in H)throw Error("options.strict was renamed to lowS");let k=S===void 0?n(J):v.fromBytes(Y1("sig",J),S);if(k===!1)return!1;try{let Y=T.fromBytes(Z);if(j&&k.hasHighS())return!1;let{r:D,s:b}=k,f=r(V),d=G.inv(b),T1=G.create(f*d),P1=G.create(D*d),Q1=T.BASE.multiplyUnsafe(T1).add(Y.multiplyUnsafe(P1));if(Q1.is0())return!1;return G.create(Q1.x)===D}catch(Y){return!1}}function R(J,V,Z={}){let{prehash:H}=HW(Z,I);return V=u(V,H),v.fromBytes(J,"recovered").recoverPublicKey(V).toBytes()}return Object.freeze({keygen:q,getPublicKey:X,getSharedSecret:K,utils:F,lengths:M,Point:T,sign:a,verify:x,recoverPublicKey:R,Signature:v,hash:A})}function $I(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=G0(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 VI(T){let{CURVE:A,curveOpts:P}=$I(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 YI(T,A){let P=A.Point;return Object.assign({},A,{ProjectivePoint:P,CURVE:Object.assign({},T,A4(P.Fn.ORDER,P.Fn.BITS))})}function vV(T){let{CURVE:A,curveOpts:P,hash:Q,ecdsaOpts:C}=VI(T),W=GI(A,P),G=UI(W,Q,C);return YI(T,G)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function yV(T,A){let P=(Q)=>vV({...T,hash:Q});return{...P(A),create:P}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var RW={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},ZI={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]};var bV=BigInt(2);function qI(T){let A=RW.p,P=BigInt(3),Q=BigInt(6),C=BigInt(11),W=BigInt(22),G=BigInt(23),U=BigInt(44),$=BigInt(88),q=T*T*T%A,X=q*q*T%A,K=D1(X,P,A)*X%A,F=D1(K,P,A)*X%A,M=D1(F,bV,A)*q%A,I=D1(M,C,A)*M%A,E=D1(I,W,A)*I%A,L=D1(E,U,A)*E%A,O=D1(L,$,A)*L%A,m=D1(O,U,A)*E%A,v=D1(m,P,A)*X%A,l=D1(v,G,A)*I%A,r=D1(l,Q,A)*q%A,c=D1(r,bV,A);if(!jW.eql(jW.sqr(c),T))throw Error("Cannot find square root");return c}var jW=G0(RW.p,{sqrt:qI}),S4=yV({...RW,Fp:jW,lowS:!0,endo:ZI},t6);var l_=eT.utils.randomPrivateKey,lV=()=>{let T=eT.utils.randomPrivateKey(),A=IW(T),P=new Uint8Array(64);return P.set(T),P.set(A,32),{publicKey:A,secretKey:P}},IW=eT.getPublicKey;function pV(T){try{return eT.ExtendedPoint.fromHex(T),!0}catch{return!1}}var eV=(T,A)=>eT.sign(T,A.slice(0,32)),HI=eT.verify,J1=(T)=>{if(w.isBuffer(T))return T;else if(T instanceof Uint8Array)return w.from(T.buffer,T.byteOffset,T.byteLength);else return w.from(T)};class TY{constructor(T){Object.assign(this,T)}encode(){return w.from(c8.serialize(w4,this))}static decode(T){return c8.deserialize(w4,this,T)}static decodeUnchecked(T){return c8.deserializeUnchecked(w4,this,T)}}var w4=new Map,AY,KI=32,d2=32;function jI(T){return T._bn!==void 0}var uV=1;class i extends TY{constructor(T){super({});if(this._bn=void 0,jI(T))this._bn=T._bn;else{if(typeof T==="string"){let A=A0.default.decode(T);if(A.length!=d2)throw Error("Invalid public key input");this._bn=new zW.default(A)}else this._bn=new zW.default(T);if(this._bn.byteLength()>d2)throw Error("Invalid public key input")}}static unique(){let T=new i(uV);return uV+=1,new i(T.toBuffer())}equals(T){return this._bn.eq(T._bn)}toBase58(){return A0.default.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){let T=this.toBuffer();return new Uint8Array(T.buffer,T.byteOffset,T.byteLength)}toBuffer(){let T=this._bn.toArrayLike(w);if(T.length===d2)return T;let A=w.alloc(32);return T.copy(A,32-T.length),A}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(T,A,P){let Q=w.concat([T.toBuffer(),w.from(A),P.toBuffer()]),C=FC(Q);return new i(C)}static createProgramAddressSync(T,A){let P=w.alloc(0);T.forEach(function(C){if(C.length>KI)throw TypeError("Max seed length exceeded");P=w.concat([P,J1(C)])}),P=w.concat([P,A.toBuffer(),w.from("ProgramDerivedAddress")]);let Q=FC(P);if(pV(Q))throw Error("Invalid seeds, address must fall off the curve");return new i(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(w.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 i(T);return pV(A.toBytes())}}AY=i;i.default=new AY("11111111111111111111111111111111");w4.set(i,{kind:"struct",fields:[["_bn","u256"]]});var p_=new i("BPFLoader1111111111111111111111111111111111"),E4=1232,RI=127,PY=64;class QY extends Error{constructor(T){super(`Signature ${T} has expired: block height exceeded.`);this.signature=void 0,this.signature=T}}Object.defineProperty(QY.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class CY 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(CY.prototype,"name",{value:"TransactionExpiredTimeoutError"});class WY extends Error{constructor(T){super(`Signature ${T} has expired: the nonce is no longer valid.`);this.signature=void 0,this.signature=T}}Object.defineProperty(WY.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class SW{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 d8=(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,U)=>{let $={chars:w.from(W,"utf8")};return Q($,G,U)},C.alloc=(W)=>{return N.u32().span+N.u32().span+w.from(W,"utf8").length},C},kI=(T="authorized")=>{return N.struct([W1("staker"),W1("withdrawer")],T)},FI=(T="lockup")=>{return N.struct([N.ns64("unixTimestamp"),N.ns64("epoch"),W1("custodian")],T)},DI=(T="voteInit")=>{return N.struct([W1("nodePubkey"),W1("authorizedVoter"),W1("authorizedWithdrawer"),N.u8("commission")],T)},MI=(T="voteAuthorizeWithSeedArgs")=>{return N.struct([N.u32("voteAuthorizationType"),W1("currentAuthorityDerivedKeyOwnerPubkey"),d8("currentAuthorityDerivedKeySeed"),W1("newAuthorized")],T)};function GY(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 GY({layout:C},A[C.property]);return 0},Q=0;return T.layout.fields.forEach((C)=>{Q+=P(C)}),Q}function l2(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 p2(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 kT(T,A){if(!T)throw Error(A||"Assertion failed")}class LW{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(),U=P.get(G);if(U===void 0)U={isSigner:!1,isWritable:!1,isInvoked:!1},P.set(G,U);return U},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 U=Q(G.pubkey);U.isSigner||=G.isSigner,U.isWritable||=G.isWritable}}return new LW(A,P)}getMessageComponents(){let T=[...this.keyMetaMap.entries()];kT(T.length<=256,"Max static account keys length exceeded");let A=T.filter(([,U])=>U.isSigner&&U.isWritable),P=T.filter(([,U])=>U.isSigner&&!U.isWritable),Q=T.filter(([,U])=>!U.isSigner&&U.isWritable),C=T.filter(([,U])=>!U.isSigner&&!U.isWritable),W={numRequiredSignatures:A.length+P.length,numReadonlySignedAccounts:P.length,numReadonlyUnsignedAccounts:C.length};{kT(A.length>0,"Expected at least one writable signer key");let[U]=A[0];kT(U===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}let G=[...A.map(([U])=>new i(U)),...P.map(([U])=>new i(U)),...Q.map(([U])=>new i(U)),...C.map(([U])=>new i(U))];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 i(C),U=T.findIndex(($)=>$.equals(G));if(U>=0)kT(U<256,"Max lookup table index exceeded"),P.push(U),Q.push(G),this.keyMetaMap.delete(C)}return[P,Q]}}var JY="Reached end of buffer unexpectedly";function N4(T){if(T.length===0)throw Error(JY);return T.shift()}function u2(T,...A){let[P]=A;if(A.length===2?P+(A[1]??0)>T.length:P>=T.length)throw Error(JY);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 i(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:A0.default.decode(T.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new SW(this.staticAccountKeys)}static compile(T){let A=LW.compile(T.instructions,T.payerKey),[P,Q]=A.getMessageComponents(),W=new SW(Q).compileInstructions(T.instructions).map((G)=>({programIdIndex:G.programIdIndex,accounts:G.accountKeyIndexes,data:A0.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=[];p2(A,T);let P=this.instructions.map((X)=>{let{accounts:K,programIdIndex:F}=X,M=Array.from(A0.default.decode(X.data)),I=[];p2(I,K.length);let E=[];return p2(E,M.length),{programIdIndex:F,keyIndicesCount:w.from(I),keyIndices:K,dataLength:w.from(E),data:M}}),Q=[];p2(Q,P.length);let C=w.alloc(E4);w.from(Q).copy(C);let W=Q.length;P.forEach((X)=>{let F=N.struct([N.u8("programIdIndex"),N.blob(X.keyIndicesCount.length,"keyIndicesCount"),N.seq(N.u8("keyIndex"),X.keyIndices.length,"keyIndices"),N.blob(X.dataLength.length,"dataLength"),N.seq(N.u8("userdatum"),X.data.length,"data")]).encode(X,C,W);W+=F}),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")]),U={numRequiredSignatures:w.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:w.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:w.from([this.header.numReadonlyUnsignedAccounts]),keyCount:w.from(A),keys:this.accountKeys.map((X)=>J1(X.toBytes())),recentBlockhash:A0.default.decode(this.recentBlockhash)},$=w.alloc(2048),q=G.encode(U,$);return C.copy($,q),$.slice(0,q+C.length)}static from(T){let A=[...T],P=N4(A);if(P!==(P&RI))throw Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");let Q=N4(A),C=N4(A),W=l2(A),G=[];for(let K=0;K<W;K++){let F=u2(A,0,d2);G.push(new i(w.from(F)))}let U=u2(A,0,d2),$=l2(A),q=[];for(let K=0;K<$;K++){let F=N4(A),M=l2(A),I=u2(A,0,M),E=l2(A),L=u2(A,0,E),O=A0.default.encode(w.from(L));q.push({programIdIndex:F,accounts:I,data:O})}let X={header:{numRequiredSignatures:P,numReadonlySignedAccounts:Q,numReadonlyUnsignedAccounts:C},recentBlockhash:A0.default.encode(w.from(U)),accountKeys:G,instructions:q};return new o2(X)}}var zI=w.alloc(PY).fill(0);class U1{constructor(T){if(this.keys=void 0,this.programId=void 0,this.data=w.alloc(0),this.programId=T.programId,this.keys=T.keys,T.data)this.data=T.data}toJSON(){return{keys:this.keys.map(({pubkey:T,isSigner:A,isWritable: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 U1(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 I=0;I<A.length;I++)if(A[I].programId===void 0)throw Error(`Transaction instruction index ${I} has undefined program id`);let Q=[],C=[];A.forEach((I)=>{I.keys.forEach((L)=>{C.push({...L})});let E=I.programId.toString();if(!Q.includes(E))Q.push(E)}),Q.forEach((I)=>{C.push({pubkey:new i(I),isSigner:!1,isWritable:!1})});let W=[];C.forEach((I)=>{let E=I.pubkey.toString(),L=W.findIndex((O)=>{return O.pubkey.toString()===E});if(L>-1)W[L].isWritable=W[L].isWritable||I.isWritable,W[L].isSigner=W[L].isSigner||I.isSigner;else W.push(I)}),W.sort(function(I,E){if(I.isSigner!==E.isSigner)return I.isSigner?-1:1;if(I.isWritable!==E.isWritable)return I.isWritable?-1:1;let L={localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"};return I.pubkey.toBase58().localeCompare(E.pubkey.toBase58(),"en",L)});let G=W.findIndex((I)=>{return I.pubkey.equals(P)});if(G>-1){let[I]=W.splice(G,1);I.isSigner=!0,I.isWritable=!0,W.unshift(I)}else W.unshift({pubkey:P,isSigner:!0,isWritable:!0});for(let I of this.signatures){let E=W.findIndex((L)=>{return L.pubkey.equals(I.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: ${I.publicKey.toString()}`)}let U=0,$=0,q=0,X=[],K=[];W.forEach(({pubkey:I,isSigner:E,isWritable:L})=>{if(E){if(X.push(I.toString()),U+=1,!L)$+=1}else if(K.push(I.toString()),!L)q+=1});let F=X.concat(K),M=A.map((I)=>{let{data:E,programId:L}=I;return{programIdIndex:F.indexOf(L.toString()),accounts:I.keys.map((O)=>F.indexOf(O.pubkey.toString())),data:A0.default.encode(E)}});return M.forEach((I)=>{kT(I.programIdIndex>=0),I.accounts.forEach((E)=>kT(E>=0))}),new o2({header:{numRequiredSignatures:U,numReadonlySignedAccounts:$,numReadonlyUnsignedAccounts:q},accountKeys:F,recentBlockhash:T,instructions:M})}_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=eV(P,Q.secretKey);this._addSignature(Q.publicKey,J1(C))})}addSignature(T,A){this._compile(),this._addSignature(T,A)}_addSignature(T,A){kT(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=w.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(!HI(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${C.invalid.length===1?"":"(s)"} [\`${C.invalid.map((G)=>G.toBase58()).join("`, `")}\`].`;if(C.missing)W+=`
16
- Missing signature for public key${C.missing.length===1?"":"(s)"} [\`${C.missing.map((G)=>G.toBase58()).join("`, `")}\`].`;throw Error(W)}}return this._serialize(Q)}_serialize(T){let{signatures:A}=this,P=[];p2(P,A.length);let Q=P.length+A.length*64+T.length,C=w.alloc(Q);return kT(A.length<256),w.from(P).copy(C,0),A.forEach(({signature:W},G)=>{if(W!==null)kT(W.length===64,"signature has invalid length"),w.from(W).copy(C,P.length+G*64)}),T.copy(C,P.length+A.length*64),kT(C.length<=E4,`Transaction too large: ${C.length} > ${E4}`),C}get keys(){return kT(this.instructions.length===1),this.instructions[0].keys.map((T)=>T.pubkey)}get programId(){return kT(this.instructions.length===1),this.instructions[0].programId}get data(){return kT(this.instructions.length===1),this.instructions[0].data}static from(T){let A=[...T],P=l2(A),Q=[];for(let C=0;C<P;C++){let W=u2(A,0,PY);Q.push(A0.default.encode(w.from(W)))}return k1.populate(o2.from(A),Q)}static populate(T,A=[]){let P=new k1;if(P.recentBlockhash=T.recentBlockhash,T.header.numRequiredSignatures>0)P.feePayer=T.accountKeys[0];return A.forEach((Q,C)=>{let W={signature:Q==A0.default.encode(zI)?null:A0.default.decode(Q),publicKey:T.accountKeys[C]};P.signatures.push(W)}),T.instructions.forEach((Q)=>{let C=Q.accounts.map((W)=>{let G=T.accountKeys[W];return{pubkey:G,isSigner:P.signatures.some((U)=>U.publicKey.toString()===G.toString())||T.isAccountSigner(W),isWritable:T.isAccountWritable(W)}});P.instructions.push(new U1({keys:C,programId:T.accountKeys[Q.programIdIndex],data:A0.default.decode(Q.data)}))}),P._message=T,P._json=P.toJSON(),P}}var II=160,SI=64,NI=II/SI,LI=1000/NI,$A=new i("SysvarC1ock11111111111111111111111111111111"),u_=new i("SysvarEpochSchedu1e111111111111111111111111"),d_=new i("Sysvar1nstructions1111111111111111111111111"),kW=new i("SysvarRecentB1ockHashes11111111111111111111"),f2=new i("SysvarRent111111111111111111111111111111111"),r_=new i("SysvarRewards111111111111111111111111111111"),c_=new i("SysvarS1otHashes111111111111111111111111111"),o_=new i("SysvarS1otHistory11111111111111111111111111"),FW=new i("SysvarStakeHistory1111111111111111111111111");class UY extends Error{constructor({action:T,signature:A,transactionMessage:P,logs:Q}){let C=Q?`Logs:
17
- ${JSON.stringify(Q.slice(-10),null,2)}. `:"",W="\nCatch the `SendTransactionError` and call `getLogs()` on it for full details.",G;switch(T){case"send":G=`Transaction ${A} resulted in an error.
18
- ${P}. `+C+"\nCatch the `SendTransactionError` and call `getLogs()` on it for full details.";break;case"simulate":G=`Simulation failed.
19
- Message: ${P}.
20
- `+C+"\nCatch the `SendTransactionError` and call `getLogs()` on it for full details.";break;default:G=`Unknown action '${((U)=>U)(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 dV(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:U}=A.nonceInfo,$=U.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 UY({action:"send",signature:W,transactionMessage:`Status: (${JSON.stringify(G)})`});throw Error(`Transaction ${W} failed (${JSON.stringify(G)})`)}return W}function wI(T){return new Promise((A)=>setTimeout(A,T))}function C1(T,A){let P=T.layout.span>=0?T.layout.span:GY(T,A),Q=w.alloc(P),C=Object.assign({instruction:T.index},A);return T.layout.encode(C,Q),Q}var EI=N.nu64("lamportsPerSignature"),BI=N.struct([N.u32("version"),N.u32("state"),W1("authorizedPubkey"),W1("nonce"),N.struct([EI],"feeCalculator")]),rV=BI.span;function r8(T){let A=tV.blob(8,T),P=A.decode.bind(A),Q=A.encode.bind(A),C=A,W=n9();return C.decode=(G,U)=>{let $=P(G,U);return W.decode($)},C.encode=(G,U,$)=>{let q=W.encode(G);return Q(q,U,$)},C}var K0=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"),r8("lamports")])},CreateWithSeed:{index:3,layout:N.struct([N.u32("instruction"),W1("base"),d8("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"),d8("seed"),N.ns64("space"),W1("programId")])},AssignWithSeed:{index:10,layout:N.struct([N.u32("instruction"),W1("base"),d8("seed"),W1("programId")])},TransferWithSeed:{index:11,layout:N.struct([N.u32("instruction"),r8("lamports"),d8("seed"),W1("programId")])},UpgradeNonceAccount:{index:12,layout:N.struct([N.u32("instruction")])}});class KT{constructor(){}static createAccount(T){let A=K0.Create,P=C1(A,{lamports:T.lamports,space:T.space,programId:J1(T.programId.toBuffer())});return new U1({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=K0.TransferWithSeed;A=C1(Q,{lamports:BigInt(T.lamports),seed:T.seed,programId:J1(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=K0.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 U1({keys:P,programId:this.programId,data:A})}static assign(T){let A,P;if("basePubkey"in T){let Q=K0.AssignWithSeed;A=C1(Q,{base:J1(T.basePubkey.toBuffer()),seed:T.seed,programId:J1(T.programId.toBuffer())}),P=[{pubkey:T.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:T.basePubkey,isSigner:!0,isWritable:!1}]}else{let Q=K0.Assign;A=C1(Q,{programId:J1(T.programId.toBuffer())}),P=[{pubkey:T.accountPubkey,isSigner:!0,isWritable:!0}]}return new U1({keys:P,programId:this.programId,data:A})}static createAccountWithSeed(T){let A=K0.CreateWithSeed,P=C1(A,{base:J1(T.basePubkey.toBuffer()),seed:T.seed,lamports:T.lamports,space:T.space,programId:J1(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 U1({keys:Q,programId:this.programId,data:P})}static createNonceAccount(T){let A=new k1;if("basePubkey"in T&&"seed"in T)A.add(KT.createAccountWithSeed({fromPubkey:T.fromPubkey,newAccountPubkey:T.noncePubkey,basePubkey:T.basePubkey,seed:T.seed,lamports:T.lamports,space:rV,programId:this.programId}));else A.add(KT.createAccount({fromPubkey:T.fromPubkey,newAccountPubkey:T.noncePubkey,lamports:T.lamports,space:rV,programId:this.programId}));let P={noncePubkey:T.noncePubkey,authorizedPubkey:T.authorizedPubkey};return A.add(this.nonceInitialize(P)),A}static nonceInitialize(T){let A=K0.InitializeNonceAccount,P=C1(A,{authorized:J1(T.authorizedPubkey.toBuffer())}),Q={keys:[{pubkey:T.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:kW,isSigner:!1,isWritable:!1},{pubkey:f2,isSigner:!1,isWritable:!1}],programId:this.programId,data:P};return new U1(Q)}static nonceAdvance(T){let A=K0.AdvanceNonceAccount,P=C1(A),Q={keys:[{pubkey:T.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:kW,isSigner:!1,isWritable:!1},{pubkey:T.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:P};return new U1(Q)}static nonceWithdraw(T){let A=K0.WithdrawNonceAccount,P=C1(A,{lamports:T.lamports});return new U1({keys:[{pubkey:T.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:T.toPubkey,isSigner:!1,isWritable:!0},{pubkey:kW,isSigner:!1,isWritable:!1},{pubkey:f2,isSigner:!1,isWritable:!1},{pubkey:T.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:P})}static nonceAuthorize(T){let A=K0.AuthorizeNonceAccount,P=C1(A,{authorized:J1(T.newAuthorizedPubkey.toBuffer())});return new U1({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=K0.AllocateWithSeed;A=C1(Q,{base:J1(T.basePubkey.toBuffer()),seed:T.seed,space:T.space,programId:J1(T.programId.toBuffer())}),P=[{pubkey:T.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:T.basePubkey,isSigner:!0,isWritable:!1}]}else{let Q=K0.Allocate;A=C1(Q,{space:T.space}),P=[{pubkey:T.accountPubkey,isSigner:!0,isWritable:!0}]}return new U1({keys:P,programId:this.programId,data:A})}}KT.programId=new i("11111111111111111111111111111111");var OI=E4-300;class B4{constructor(){}static getMinNumSignatures(T){return 2*(Math.ceil(T/B4.chunkSize)+1+1)}static async load(T,A,P,Q,C){{let X=await T.getMinimumBalanceForRentExemption(C.length),K=await T.getAccountInfo(P.publicKey,"confirmed"),F=null;if(K!==null){if(K.executable)return console.error("Program load failed, account is already executable"),!1;if(K.data.length!==C.length)F=F||new k1,F.add(KT.allocate({accountPubkey:P.publicKey,space:C.length}));if(!K.owner.equals(Q))F=F||new k1,F.add(KT.assign({accountPubkey:P.publicKey,programId:Q}));if(K.lamports<X)F=F||new k1,F.add(KT.transfer({fromPubkey:A.publicKey,toPubkey:P.publicKey,lamports:X-K.lamports}))}else F=new k1().add(KT.createAccount({fromPubkey:A.publicKey,newAccountPubkey:P.publicKey,lamports:X>0?X:1,space:C.length,programId:Q}));if(F!==null)await dV(T,F,[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=B4.chunkSize,U=0,$=C,q=[];while($.length>0){let X=$.slice(0,G),K=w.alloc(G+16);W.encode({instruction:0,offset:U,bytes:X,bytesLength:0,bytesLengthPadding:0},K);let F=new k1().add({keys:[{pubkey:P.publicKey,isSigner:!0,isWritable:!0}],programId:Q,data:K});if(q.push(dV(T,F,[A,P],{commitment:"confirmed"})),T._rpcEndpoint.includes("solana.com"))await wI(250);U+=G,$=$.slice(G)}await Promise.all(q);{let X=N.struct([N.u32("instruction")]),K=w.alloc(X.span);X.encode({instruction:1},K);let F=new k1().add({keys:[{pubkey:P.publicKey,isSigner:!0,isWritable:!0},{pubkey:f2,isSigner:!1,isWritable:!1}],programId:Q,data:K}),M="processed",I=await T.sendTransaction(F,[A,P],{preflightCommitment:M}),{context:E,value:L}=await T.confirmTransaction({signature:I,lastValidBlockHeight:F.lastValidBlockHeight,blockhash:F.recentBlockhash},M);if(L.err)throw Error(`Transaction ${I} failed (${JSON.stringify(L)})`);while(!0){try{if(await T.getSlot({commitment:M})>E.slot)break}catch{}await new Promise((O)=>setTimeout(O,Math.round(LI/2)))}}return!0}}B4.chunkSize=OI;var f_=new i("BPFLoader2111111111111111111111111111111111");var n_=globalThis.fetch;var i_={index:1,layout:N.struct([N.u32("typeIndex"),r8("deactivationSlot"),N.nu64("lastExtendedSlot"),N.u8("lastExtendedStartIndex"),N.u8(),N.seq(W1(),N.offset(N.u8(),-1),"authority")])};var B1=l8(R4(i),p(),(T)=>new i(T)),$Y=k4([p(),M1("base64")]),wW=l8(R4(w),$Y,(T)=>w.from(T[0],"base64"));function VY(T){return hT([y({jsonrpc:M1("2.0"),id:p(),result:T}),y({jsonrpc:M1("2.0"),id:p(),error:y({code:V8(),message:p(),data:A1(e9())})})])}var xI=VY(V8());function R1(T){return l8(VY(T),xI,(A)=>{if("error"in A)return A;else return{...A,result:b8(A.result,T)}})}function M0(T){return R1(y({context:y({slot:B()}),value:T}))}function x4(T){return y({context:y({slot:B()}),value:T})}var _I=y({foundation:B(),foundationTerm:B(),initial:B(),taper:B(),terminal:B()}),a_=R1(s(t(y({epoch:B(),effectiveSlot:B(),amount:B(),postBalance:B(),commission:A1(t(B()))})))),hI=s(y({slot:B(),prioritizationFee:B()})),gI=y({total:B(),validator:B(),foundation:B(),epoch:B()}),mI=y({epoch:B(),slotIndex:B(),slotsInEpoch:B(),absoluteSlot:B(),blockHeight:A1(B()),transactionCount:A1(B())}),vI=y({slotsPerEpoch:B(),leaderScheduleSlotOffset:B(),warmup:D0(),firstNormalEpoch:B(),firstNormalSlot:B()}),yI=TW(p(),s(B())),Y8=t(hT([y({}),p()])),bI=y({err:Y8}),lI=M1("receivedSignature"),s_=y({"solana-core":p(),"feature-set":A1(B())}),pI=y({program:p(),programId:B1,parsed:V8()}),uI=y({programId:B1,accounts:s(B1),data:p()}),t_=M0(y({err:t(hT([y({}),p()])),logs:t(s(p())),accounts:A1(t(s(t(y({executable:D0(),owner:p(),lamports:B(),data:s(p()),rentEpoch:A1(B())}))))),unitsConsumed:A1(B()),returnData:A1(t(y({programId:p(),data:k4([p(),M1("base64")])}))),innerInstructions:A1(t(s(y({index:B(),instructions:s(hT([pI,uI]))}))))})),e_=M0(y({byIdentity:TW(p(),s(B())),range:y({firstSlot:B(),lastSlot:B()})}));var Th=R1(_I),Ah=R1(gI),Ph=R1(hI),Qh=R1(mI),Ch=R1(vI),Wh=R1(yI),Gh=R1(B()),Jh=M0(y({total:B(),circulating:B(),nonCirculating:B(),nonCirculatingAccounts:s(B1)})),dI=y({amount:p(),uiAmount:t(B()),decimals:B(),uiAmountString:A1(p())}),Uh=M0(s(y({address:B1,amount:p(),uiAmount:t(B()),decimals:B(),uiAmountString:A1(p())}))),$h=M0(s(y({pubkey:B1,account:y({executable:D0(),owner:B1,lamports:B(),data:wW,rentEpoch:B()})}))),NW=y({program:p(),parsed:V8(),space:B()}),Vh=M0(s(y({pubkey:B1,account:y({executable:D0(),owner:B1,lamports:B(),data:NW,rentEpoch:B()})}))),Yh=M0(s(y({lamports:B(),address:B1}))),EW=y({executable:D0(),owner:B1,lamports:B(),data:wW,rentEpoch:B()}),Zh=y({pubkey:B1,account:EW}),rI=l8(hT([R4(w),NW]),hT([$Y,NW]),(T)=>{if(Array.isArray(T))return b8(T,wW);else return T}),cI=y({executable:D0(),owner:B1,lamports:B(),data:rI,rentEpoch:B()}),qh=y({pubkey:B1,account:cI}),Xh=y({state:hT([M1("active"),M1("inactive"),M1("activating"),M1("deactivating")]),active:B(),inactive:B()}),Hh=R1(s(y({signature:p(),slot:B(),err:Y8,memo:t(p()),blockTime:A1(t(B()))}))),Kh=R1(s(y({signature:p(),slot:B(),err:Y8,memo:t(p()),blockTime:A1(t(B()))}))),jh=y({subscription:B(),result:x4(EW)}),oI=y({pubkey:B1,account:EW}),Rh=y({subscription:B(),result:x4(oI)}),fI=y({parent:B(),slot:B(),root:B()}),kh=y({subscription:B(),result:fI}),nI=hT([y({type:hT([M1("firstShredReceived"),M1("completed"),M1("optimisticConfirmation"),M1("root")]),slot:B(),timestamp:B()}),y({type:M1("createdBank"),parent:B(),slot:B(),timestamp:B()}),y({type:M1("frozen"),slot:B(),timestamp:B(),stats:y({numTransactionEntries:B(),numSuccessfulTransactions:B(),numFailedTransactions:B(),maxTransactionsPerEntry:B()})}),y({type:M1("dead"),slot:B(),timestamp:B(),err:p()})]),Fh=y({subscription:B(),result:nI}),Dh=y({subscription:B(),result:x4(hT([bI,lI]))}),Mh=y({subscription:B(),result:B()}),zh=y({pubkey:p(),gossip:t(p()),tpu:t(p()),rpc:t(p()),version:t(p())}),cV=y({votePubkey:p(),nodePubkey:p(),activatedStake:B(),epochVoteAccount:D0(),epochCredits:s(k4([B(),B(),B()])),commission:B(),lastVote:B(),rootSlot:t(B())}),Ih=R1(y({current:s(cV),delinquent:s(cV)})),iI=hT([M1("processed"),M1("confirmed"),M1("finalized")]),aI=y({slot:B(),confirmations:t(B()),err:Y8,confirmationStatus:A1(iI)}),Sh=M0(s(t(aI))),Nh=R1(B()),YY=y({accountKey:B1,writableIndexes:s(B()),readonlyIndexes:s(B())}),BW=y({signatures:s(p()),message:y({accountKeys:s(p()),header:y({numRequiredSignatures:B(),numReadonlySignedAccounts:B(),numReadonlyUnsignedAccounts:B()}),instructions:s(y({accounts:s(B()),data:p(),programIdIndex:B()})),recentBlockhash:p(),addressTableLookups:A1(s(YY))})}),ZY=y({pubkey:B1,signer:D0(),writable:D0(),source:A1(hT([M1("transaction"),M1("lookupTable")]))}),qY=y({accountKeys:s(ZY),signatures:s(p())}),XY=y({parsed:V8(),program:p(),programId:B1}),HY=y({accounts:s(B1),data:p(),programId:B1}),sI=hT([HY,XY]),tI=hT([y({parsed:V8(),program:p(),programId:p()}),y({accounts:s(p()),data:p(),programId:p()})]),KY=l8(sI,tI,(T)=>{if("accounts"in T)return b8(T,HY);else return b8(T,XY)}),jY=y({signatures:s(p()),message:y({accountKeys:s(ZY),instructions:s(KY),recentBlockhash:p(),addressTableLookups:A1(t(s(YY)))})}),O4=y({accountIndex:B(),mint:p(),owner:A1(p()),programId:A1(p()),uiTokenAmount:dI}),RY=y({writable:s(B1),readonly:s(B1)}),_4=y({err:Y8,fee:B(),innerInstructions:A1(t(s(y({index:B(),instructions:s(y({accounts:s(B()),data:p(),programIdIndex:B()}))})))),preBalances:s(B()),postBalances:s(B()),logMessages:A1(t(s(p()))),preTokenBalances:A1(t(s(O4))),postTokenBalances:A1(t(s(O4))),loadedAddresses:A1(RY),computeUnitsConsumed:A1(B()),costUnits:A1(B())}),OW=y({err:Y8,fee:B(),innerInstructions:A1(t(s(y({index:B(),instructions:s(KY)})))),preBalances:s(B()),postBalances:s(B()),logMessages:A1(t(s(p()))),preTokenBalances:A1(t(s(O4))),postTokenBalances:A1(t(s(O4))),loadedAddresses:A1(RY),computeUnitsConsumed:A1(B()),costUnits:A1(B())}),o8=hT([M1(0),M1("legacy")]),Z8=y({pubkey:p(),lamports:B(),postBalance:t(B()),rewardType:t(p()),commission:A1(t(B()))}),Lh=R1(t(y({blockhash:p(),previousBlockhash:p(),parentSlot:B(),transactions:s(y({transaction:BW,meta:t(_4),version:A1(o8)})),rewards:A1(s(Z8)),blockTime:t(B()),blockHeight:t(B())}))),wh=R1(t(y({blockhash:p(),previousBlockhash:p(),parentSlot:B(),rewards:A1(s(Z8)),blockTime:t(B()),blockHeight:t(B())}))),Eh=R1(t(y({blockhash:p(),previousBlockhash:p(),parentSlot:B(),transactions:s(y({transaction:qY,meta:t(_4),version:A1(o8)})),rewards:A1(s(Z8)),blockTime:t(B()),blockHeight:t(B())}))),Bh=R1(t(y({blockhash:p(),previousBlockhash:p(),parentSlot:B(),transactions:s(y({transaction:jY,meta:t(OW),version:A1(o8)})),rewards:A1(s(Z8)),blockTime:t(B()),blockHeight:t(B())}))),Oh=R1(t(y({blockhash:p(),previousBlockhash:p(),parentSlot:B(),transactions:s(y({transaction:qY,meta:t(OW),version:A1(o8)})),rewards:A1(s(Z8)),blockTime:t(B()),blockHeight:t(B())}))),xh=R1(t(y({blockhash:p(),previousBlockhash:p(),parentSlot:B(),rewards:A1(s(Z8)),blockTime:t(B()),blockHeight:t(B())}))),_h=R1(t(y({blockhash:p(),previousBlockhash:p(),parentSlot:B(),transactions:s(y({transaction:BW,meta:t(_4)})),rewards:A1(s(Z8)),blockTime:t(B())}))),hh=R1(t(y({blockhash:p(),previousBlockhash:p(),parentSlot:B(),signatures:s(p()),blockTime:t(B())}))),gh=R1(t(y({slot:B(),meta:t(_4),blockTime:A1(t(B())),transaction:BW,version:A1(o8)}))),mh=R1(t(y({slot:B(),transaction:jY,meta:t(OW),blockTime:A1(t(B())),version:A1(o8)}))),vh=M0(y({blockhash:p(),lastValidBlockHeight:B()})),yh=M0(D0()),eI=y({slot:B(),numTransactions:B(),numSlots:B(),samplePeriodSecs:B()}),bh=R1(s(eI)),lh=M0(t(y({feeCalculator:y({lamportsPerSignature:B()})}))),ph=R1(p()),uh=R1(p()),TS=y({err:Y8,logs:s(p()),signature:p()}),dh=y({result:x4(TS),subscription:B()});class r2{constructor(T){this._keypair=void 0,this._keypair=T??lV()}static generate(){return new r2(lV())}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=IW(Q);for(let W=0;W<32;W++)if(P[W]!==C[W])throw Error("provided secretKey is invalid")}return new r2({publicKey:P,secretKey:T})}static fromSeed(T){let A=IW(T),P=new Uint8Array(64);return P.set(T),P.set(A,32),new r2({publicKey:A,secretKey:P})}get publicKey(){return new i(this._keypair.publicKey)}get secretKey(){return new Uint8Array(this._keypair.secretKey)}}var y2=Object.freeze({CreateLookupTable:{index:0,layout:N.struct([N.u32("instruction"),r8("recentSlot"),N.u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:N.struct([N.u32("instruction")])},ExtendLookupTable:{index:2,layout:N.struct([N.u32("instruction"),r8(),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 kY{constructor(){}static createLookupTable(T){let[A,P]=i.findProgramAddressSync([T.authority.toBuffer(),tC().encode(T.recentSlot)],this.programId),Q=y2.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:KT.programId,isSigner:!1,isWritable:!1}];return[new U1({programId:this.programId,keys:W,data:C}),A]}static freezeLookupTable(T){let A=y2.FreezeLookupTable,P=C1(A),Q=[{pubkey:T.lookupTable,isSigner:!1,isWritable:!0},{pubkey:T.authority,isSigner:!0,isWritable:!1}];return new U1({programId:this.programId,keys:Q,data:P})}static extendLookupTable(T){let A=y2.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:KT.programId,isSigner:!1,isWritable:!1});return new U1({programId:this.programId,keys:Q,data:P})}static deactivateLookupTable(T){let A=y2.DeactivateLookupTable,P=C1(A),Q=[{pubkey:T.lookupTable,isSigner:!1,isWritable:!0},{pubkey:T.authority,isSigner:!0,isWritable:!1}];return new U1({programId:this.programId,keys:Q,data:P})}static closeLookupTable(T){let A=y2.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 U1({programId:this.programId,keys:Q,data:P})}}kY.programId=new i("AddressLookupTab1e1111111111111111111111111");var L4=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"),r8("microLamports")])}});class FY{constructor(){}static requestUnits(T){let A=L4.RequestUnits,P=C1(A,T);return new U1({keys:[],programId:this.programId,data:P})}static requestHeapFrame(T){let A=L4.RequestHeapFrame,P=C1(A,T);return new U1({keys:[],programId:this.programId,data:P})}static setComputeUnitLimit(T){let A=L4.SetComputeUnitLimit,P=C1(A,T);return new U1({keys:[],programId:this.programId,data:P})}static setComputeUnitPrice(T){let A=L4.SetComputeUnitPrice,P=C1(A,{microLamports:BigInt(T.microLamports)});return new U1({keys:[],programId:this.programId,data:P})}}FY.programId=new i("ComputeBudget111111111111111111111111111111");var oV=64,fV=32,nV=64,iV=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 xW{constructor(){}static createInstructionWithPublicKey(T){let{publicKey:A,message:P,signature:Q,instructionIndex:C}=T;kT(A.length===fV,`Public Key must be ${fV} bytes but received ${A.length} bytes`),kT(Q.length===nV,`Signature must be ${nV} bytes but received ${Q.length} bytes`);let W=iV.span,G=W+A.length,U=G+Q.length,$=1,q=w.alloc(U+P.length),X=C==null?65535:C;return iV.encode({numSignatures:$,padding:0,signatureOffset:G,signatureInstructionIndex:X,publicKeyOffset:W,publicKeyInstructionIndex:X,messageDataOffset:U,messageDataSize:P.length,messageInstructionIndex:X},q),q.fill(A,W),q.fill(Q,G),q.fill(P,U),new U1({keys:[],programId:xW.programId,data:q})}static createInstructionWithPrivateKey(T){let{privateKey:A,message:P,instructionIndex:Q}=T;kT(A.length===oV,`Private key must be ${oV} bytes but received ${A.length} bytes`);try{let C=r2.fromSecretKey(A),W=C.publicKey.toBytes(),G=eV(P,C.secretKey);return this.createInstructionWithPublicKey({publicKey:W,message:P,signature:G,instructionIndex:Q})}catch(C){throw Error(`Error creating instruction; ${C}`)}}}xW.programId=new i("Ed25519SigVerify111111111111111111111111111");var AS=(T,A)=>{let P=S4.sign(T,A);return[P.toCompactRawBytes(),P.recovery]};S4.utils.isValidPrivateKey;var PS=S4.getPublicKey,aV=32,DW=20,sV=64,QS=11,MW=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 c2{constructor(){}static publicKeyToEthAddress(T){kT(T.length===sV,`Public key must be ${sV} bytes but received ${T.length} bytes`);try{return w.from(ZW(J1(T))).slice(-DW)}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 c2.createInstructionWithEthAddress({ethAddress:c2.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=w.from(A.substr(2),"hex");else G=w.from(A,"hex");else G=A;kT(G.length===DW,`Address must be ${DW} bytes but received ${G.length} bytes`);let U=1+QS,$=U,q=U+G.length,X=q+Q.length+1,K=1,F=w.alloc(MW.span+P.length);return MW.encode({numSignatures:K,signatureOffset:q,signatureInstructionIndex:W,ethAddressOffset:$,ethAddressInstructionIndex:W,messageDataOffset:X,messageDataSize:P.length,messageInstructionIndex:W,signature:J1(Q),ethAddress:J1(G),recoveryId:C},F),F.fill(J1(P),MW.span),new U1({keys:[],programId:c2.programId,data:F})}static createInstructionWithPrivateKey(T){let{privateKey:A,message:P,instructionIndex:Q}=T;kT(A.length===aV,`Private key must be ${aV} bytes but received ${A.length} bytes`);try{let C=J1(A),W=PS(C,!1).slice(1),G=w.from(ZW(J1(P))),[U,$]=AS(G,C);return this.createInstructionWithPublicKey({publicKey:W,message:P,signature:U,recoveryId:$,instructionIndex:Q})}catch(C){throw Error(`Error creating instruction; ${C}`)}}}c2.programId=new i("KeccakSecp256k11111111111111111111111111111");var DY,CS=new i("StakeConfig11111111111111111111111111111111");class h4{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}}DY=h4;h4.default=new DY(0,0,i.default);var yA=Object.freeze({Initialize:{index:0,layout:N.struct([N.u32("instruction"),kI(),FI()])},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"),d8("authoritySeed"),W1("authorityOwner")])}}),rh=Object.freeze({Staker:{index:0},Withdrawer:{index:1}});class _W{constructor(){}static initialize(T){let{stakePubkey:A,authorized:P,lockup:Q}=T,C=Q||h4.default,W=yA.Initialize,G=C1(W,{authorized:{staker:J1(P.staker.toBuffer()),withdrawer:J1(P.withdrawer.toBuffer())},lockup:{unixTimestamp:C.unixTimestamp,epoch:C.epoch,custodian:J1(C.custodian.toBuffer())}}),U={keys:[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:f2,isSigner:!1,isWritable:!1}],programId:this.programId,data:G};return new U1(U)}static createAccountWithSeed(T){let A=new k1;A.add(KT.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(KT.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=yA.Delegate,W=C1(C);return new k1().add({keys:[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:Q,isSigner:!1,isWritable:!1},{pubkey:$A,isSigner:!1,isWritable:!1},{pubkey:FW,isSigner:!1,isWritable:!1},{pubkey:CS,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=yA.Authorize,U=C1(G,{newAuthorized:J1(Q.toBuffer()),stakeAuthorizationType:C.index}),$=[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:$A,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:U})}static authorizeWithSeed(T){let{stakePubkey:A,authorityBase:P,authoritySeed:Q,authorityOwner:C,newAuthorizedPubkey:W,stakeAuthorizationType:G,custodianPubkey:U}=T,$=yA.AuthorizeWithSeed,q=C1($,{newAuthorized:J1(W.toBuffer()),stakeAuthorizationType:G.index,authoritySeed:Q,authorityOwner:J1(C.toBuffer())}),X=[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:P,isSigner:!0,isWritable:!1},{pubkey:$A,isSigner:!1,isWritable:!1}];if(U)X.push({pubkey:U,isSigner:!0,isWritable:!1});return new k1().add({keys:X,programId:this.programId,data:q})}static splitInstruction(T){let{stakePubkey:A,authorizedPubkey:P,splitStakePubkey:Q,lamports:C}=T,W=yA.Split,G=C1(W,{lamports:C});return new U1({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(KT.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:U}=T,$=new k1;if($.add(KT.allocate({accountPubkey:C,basePubkey:W,seed:G,space:this.space,programId:this.programId})),A&&A>0)$.add(KT.transfer({fromPubkey:T.authorizedPubkey,toPubkey:C,lamports:A}));return $.add(this.splitInstruction({stakePubkey:P,authorizedPubkey:Q,splitStakePubkey:C,lamports:U}))}static merge(T){let{stakePubkey:A,sourceStakePubKey:P,authorizedPubkey:Q}=T,C=yA.Merge,W=C1(C);return new k1().add({keys:[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:P,isSigner:!1,isWritable:!0},{pubkey:$A,isSigner:!1,isWritable:!1},{pubkey:FW,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=yA.Withdraw,U=C1(G,{lamports:C}),$=[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:Q,isSigner:!1,isWritable:!0},{pubkey:$A,isSigner:!1,isWritable:!1},{pubkey:FW,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:U})}static deactivate(T){let{stakePubkey:A,authorizedPubkey:P}=T,Q=yA.Deactivate,C=C1(Q);return new k1().add({keys:[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:$A,isSigner:!1,isWritable:!1},{pubkey:P,isSigner:!0,isWritable:!1}],programId:this.programId,data:C})}}_W.programId=new i("Stake11111111111111111111111111111111111111");_W.space=200;var b2=Object.freeze({InitializeAccount:{index:0,layout:N.struct([N.u32("instruction"),DI()])},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"),MI()])}}),ch=Object.freeze({Voter:{index:0},Withdrawer:{index:1}});class g4{constructor(){}static initializeAccount(T){let{votePubkey:A,nodePubkey:P,voteInit:Q}=T,C=b2.InitializeAccount,W=C1(C,{voteInit:{nodePubkey:J1(Q.nodePubkey.toBuffer()),authorizedVoter:J1(Q.authorizedVoter.toBuffer()),authorizedWithdrawer:J1(Q.authorizedWithdrawer.toBuffer()),commission:Q.commission}}),G={keys:[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:f2,isSigner:!1,isWritable:!1},{pubkey:$A,isSigner:!1,isWritable:!1},{pubkey:P,isSigner:!0,isWritable:!1}],programId:this.programId,data:W};return new U1(G)}static createAccount(T){let A=new k1;return A.add(KT.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=b2.Authorize,G=C1(W,{newAuthorized:J1(Q.toBuffer()),voteAuthorizationType:C.index}),U=[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:$A,isSigner:!1,isWritable:!1},{pubkey:P,isSigner:!0,isWritable:!1}];return new k1().add({keys:U,programId:this.programId,data:G})}static authorizeWithSeed(T){let{currentAuthorityDerivedKeyBasePubkey:A,currentAuthorityDerivedKeyOwnerPubkey:P,currentAuthorityDerivedKeySeed:Q,newAuthorizedPubkey:C,voteAuthorizationType:W,votePubkey:G}=T,U=b2.AuthorizeWithSeed,$=C1(U,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:J1(P.toBuffer()),currentAuthorityDerivedKeySeed:Q,newAuthorized:J1(C.toBuffer()),voteAuthorizationType:W.index}}),q=[{pubkey:G,isSigner:!1,isWritable:!0},{pubkey:$A,isSigner:!1,isWritable:!1},{pubkey:A,isSigner:!0,isWritable:!1}];return new k1().add({keys:q,programId:this.programId,data:$})}static withdraw(T){let{votePubkey:A,authorizedWithdrawerPubkey:P,lamports:Q,toPubkey:C}=T,W=b2.Withdraw,G=C1(W,{lamports:Q}),U=[{pubkey:A,isSigner:!1,isWritable:!0},{pubkey:C,isSigner:!1,isWritable:!0},{pubkey:P,isSigner:!0,isWritable:!1}];return new k1().add({keys:U,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 g4.withdraw(T)}static updateValidatorIdentity(T){let{votePubkey:A,authorizedWithdrawerPubkey:P,nodePubkey:Q}=T,C=b2.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})}}g4.programId=new i("Vote111111111111111111111111111111111111111");g4.space=3762;var oh=new i("Va1idator1nfo111111111111111111111111111111"),fh=y({name:p(),website:A1(p()),details:A1(p()),iconUrl:A1(p()),keybaseUsername:A1(p())});var nh=new i("Vote111111111111111111111111111111111111111"),ih=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 P0=new i("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),th=new i("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"),l0=new i("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"),eh=new i("So11111111111111111111111111111111111111112"),Tg=new i("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");var q8=(T)=>{let A=T.decode.bind(T),P=T.encode.bind(T);return{decode:A,encode:P}};var hW=iT(WA(),1),bA=iT(zY(),1);var v4=(T)=>(A)=>{let P=hW.blob(T,A),{encode:Q,decode:C}=q8(P),W=P;return W.decode=(G,U)=>{let $=C(G,U);return bA.toBigIntLE(Buffer.from($))},W.encode=(G,U,$)=>{let q=bA.toBufferLE(G,T);return Q(q,U,$)},W},y4=(T)=>(A)=>{let P=hW.blob(T,A),{encode:Q,decode:C}=q8(P),W=P;return W.decode=(G,U)=>{let $=C(G,U);return bA.toBigIntBE(Buffer.from($))},W.encode=(G,U,$)=>{let q=bA.toBufferBE(G,T);return Q(q,U,$)},W},IY=v4(8),Wg=y4(8),Gg=v4(16),Jg=y4(16),Ug=v4(24),$g=y4(24),Vg=v4(32),Yg=y4(32);var SY=iT(WA(),1);var NY=(T)=>{let A=SY.u8(T),{encode:P,decode:Q}=q8(A),C=A;return C.decode=(W,G)=>{return!!Q(W,G)},C.encode=(W,G,U)=>{let $=Number(W);return P($,G,U)},C};var LY=iT(WA(),1);var gW=(T)=>{let A=LY.blob(32,T),{encode:P,decode:Q}=q8(A),C=A;return C.decode=(W,G)=>{let U=Q(W,G);return new i(U)},C.encode=(W,G,U)=>{let $=W.toBuffer();return P($,G,U)},C};class wY extends Error{constructor(T){super(T)}}class mW extends wY{constructor(){super(...arguments);this.name="TokenOwnerOffCurveError"}}var f8;(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"})(f8||(f8={}));var X8=iT(WA(),1);function EY(T,A,P){if(P.length){T.push({pubkey:A,isSigner:!1,isWritable:!1});for(let Q of P)T.push({pubkey:Q instanceof i?Q:Q.publicKey,isSigner:!0,isWritable:!1})}else T.push({pubkey:A,isSigner:!0,isWritable:!1});return T}var qS=X8.struct([X8.u32("mintAuthorityOption"),gW("mintAuthority"),IY("supply"),X8.u8("decimals"),NY("isInitialized"),X8.u32("freezeAuthorityOption"),gW("freezeAuthority")]),Bg=qS.span;function n2(T,A,P=!1,Q=P0,C=l0){if(!P&&!i.isOnCurve(A.toBuffer()))throw new mW;let[W]=i.findProgramAddressSync([A.toBuffer(),Q.toBuffer(),T.toBuffer()],C);return W}var b4=iT(WA(),1);var BY=b4.struct([b4.u8("instruction")]);function vW(T,A,P,Q=[],C=P0){let W=EY([{pubkey:T,isSigner:!1,isWritable:!0},{pubkey:A,isSigner:!1,isWritable:!0}],P,Q),G=Buffer.alloc(BY.span);return BY.encode({instruction:f8.CloseAccount},G),new U1({keys:W,programId:C,data:G})}function l4(T,A,P,Q,C=P0,W=l0){return XS(T,A,P,Q,Buffer.alloc(0),C,W)}function XS(T,A,P,Q,C,W=P0,G=l0){let U=[{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:KT.programId,isSigner:!1,isWritable:!1},{pubkey:W,isSigner:!1,isWritable:!1}];return new U1({keys:U,programId:G,data:C})}var p4=iT(WA(),1);var OY=p4.struct([p4.u8("instruction")]);function xY(T,A=P0){let P=[{pubkey:T,isSigner:!1,isWritable:!0}],Q=Buffer.alloc(OY.span);return OY.encode({instruction:f8.SyncNative},Q),new U1({keys:P,programId:A,data:Q})}function u4(T){if(typeof T==="string")return new i(T);if(typeof T==="object"&&"address"in T)return new i(T.address);return new i(T)}function _Y(T){if(T instanceof i)return T;return u4(T)}function HS(T){return{programAddress:_(T.programId.toBase58()),accounts:T.keys.map((A)=>({address:_(A.pubkey.toBase58()),role:A.isSigner?A.isWritable?H1.WRITABLE_SIGNER:H1.READONLY_SIGNER:A.isWritable?H1.WRITABLE:H1.READONLY})),data:T.data}}function n8(T){let{payer:A,owner:P,mint:Q,tokenProgram:C=P0,associatedTokenProgram:W=l0}=T,G=u4(A),U=u4(P),$=u4(Q),q=_Y(C),X=_Y(W),K=n2($,U,!1,q,X);return HS(l4(G,K,U,$,q,X))}var eg=new Uint8Array([143,52,146,187,219,123,76,155]);function jS(){return RT([["discriminator",xT(pT(),8)],["bump",RA()],["admin",S1()],["flatFees",u6()],["feeTiers",S6(P$())]])}function RS(T){return XA(T,jS())}async function hY(T,A,P){let Q=await kS(T,A,P);return KA(Q),Q}async function kS(T,A,P){let Q=await HA(T,A,P);return RS(Q)}var VA=10000n,i8=(T,A,P)=>{if(P<=0n)throw Error("Division by zero (floor)");return T*A/P},FS=(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},yW=(T)=>{let A=BigInt(T.lpFeeBps),P=BigInt(T.protocolFeeBps),Q=BigInt(T.creatorFeeBps),C=A+P,W=C+Q;if(W>=VA)throw Error("Total fee basis points must be less than 10_000");return{totalFeeBps:W,combinedFeeBps:C}},bW=(T)=>{let A=T.virtualTokenReserves+T.realTokenReserves,P=T.virtualSolReserves+T.realSolReserves;return A*P};function gY(T,A,P){if(P<=0n)throw Error("Total SOL cost must be positive");let{combinedFeeBps:Q,totalFeeBps:C}=yW(A),W=i8(P,Q,VA),G=i8(P,BigInt(A.creatorFeeBps),VA),U=P-W-G;if(U<=0n)throw Error("Net SOL after fees must be positive");let $=bW(T),q=T.virtualSolReserves+T.realSolReserves,X=T.virtualTokenReserves+T.realTokenReserves,K=q+U,F=$/K,M=X-F,I=M>T.realTokenReserves?T.realTokenReserves:M;if(I<=0n)throw Error("SOL amount is too small to purchase any tokens");let E=d4(T,A,I);while(E.totalSolCostLamports>P&&I>0n)I-=1n,E=d4(T,A,I);if(E.totalSolCostLamports>P)throw Error("Insufficient SOL to purchase any tokens with fees applied");return{tokenAmount:I,totalSolCostLamports:E.totalSolCostLamports,effectiveSolInLamports:E.effectiveSolInLamports,feeLamports:E.feeLamports,creatorFeeLamports:E.creatorFeeLamports}}function d4(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}=yW(A),W=bW(T),G=T.virtualSolReserves+T.realSolReserves,$=T.virtualTokenReserves+T.realTokenReserves-P;if($<=0n)throw Error("Purchase would exhaust token reserves");let X=W/$-G;if(X<=0n)throw Error("Resolved SOL input must be positive");let K=VA-C,F=FS(X,VA,K),M=i8(F,Q,VA),I=i8(F,BigInt(A.creatorFeeBps),VA);return{tokenAmount:P,totalSolCostLamports:F,effectiveSolInLamports:X,feeLamports:M,creatorFeeLamports:I}}function mY(T,A,P){if(P<=0n)throw Error("Token amount must be positive");let Q=bW(T),C=T.virtualSolReserves+T.realSolReserves,G=T.virtualTokenReserves+T.realTokenReserves+P,U=Q/G,$=C-U;if($<=0n)throw Error("No SOL output available for the given token amount");let{combinedFeeBps:q}=yW(A),X=i8($,q,VA),K=i8($,BigInt(A.creatorFeeBps),VA),F=$-X-K;if(F<=0n)throw Error("SOL output after fees is non-positive");return{solOutputLamports:F,preFeeSolOutputLamports:$,feeLamports:X,creatorFeeLamports:K}}var vY=O0,DS=1e4,yY=(T,A)=>{if(!Number.isFinite(T)||T<=0)throw Error(`${A} must be a positive number`)},MS=(T)=>({lpFeeBps:T.lpFeeBps,protocolFeeBps:T.protocolFeeBps,creatorFeeBps:T.creatorFeeBps});async function bY(T,A,P,Q){let C=Q?.curve?Promise.resolve(Q.curve):(async()=>{let G=await DA(T);return(await N8(A,G,{commitment:P})).data})(),W=Q?.fees?Promise.resolve(Q.fees):(async()=>{let G=await MA(),U=await hY(A,G,{commitment:P});return MS(U.data.flatFees)})();try{let[G,U]=await Promise.all([C,W]);return{curve:G,fees:U}}catch(G){throw Error("Failed to load bonding curve state. Provide overrides or ensure the RPC endpoint can access Pump accounts.",{cause:G})}}function zS(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 a8(T){yY(T.solAmount,"solAmount");let A=T.slippageBps??Q0;C0(A);let P=T.feeRecipient??vY,Q=T.rpc,C=T.commitment??K1(),{curve:W,fees:G}=await bY(T.mint,Q,C,{curve:T.curveStateOverride,fees:T.feeStructureOverride});if(W.complete)throw Error("Token has migrated to the AMM. Use ammBuy instead of curveBuy.");let U=T.bondingCurveCreator?_(T.bondingCurveCreator):W.creator,$=x0(T.solAmount),X=gY(W,G,$).tokenAmount,K=d4(W,G,X),M=f0(K.totalSolCostLamports,A)*2n,I=_(T.mint),[E]=await j1({owner:_(T.user.address),mint:I,tokenProgram:_(HT)}),L=null;try{if(!(await Q.getAccountInfo(E).send()).value)L=n8({payer:T.user,owner:T.user,mint:I})}catch{L=n8({payer:T.user,owner:T.user,mint:I})}let O=await gQ({user:T.user,mint:T.mint,tokenAmount:X,maxSolCostLamports:M,feeRecipient:P,trackVolume:T.trackVolume,bondingCurveCreator:U,rpc:Q,commitment:C});if(L){let m=Object.assign({},O);return m.prepend=[L,...m.prepend??[]],m}return O}async function s8(T){let A=T.slippageBps??Q0;C0(A);let P=T.feeRecipient??vY,Q=T.rpc,C=T.commitment??K1(),{curve:W,fees:G}=await bY(T.mint,Q,C,{curve:T.curveStateOverride,fees:T.feeStructureOverride});if(W.complete)throw Error("Token has migrated to the AMM. Use ammSell instead of curveSell.");let U=T.bondingCurveCreator?_(T.bondingCurveCreator):W.creator,$=T.useWalletPercentage??!1,q=_(T.mint),X;if($){let M=T.walletPercentage??100,I=zS(M),[E]=await j1({owner:_(T.user.address),mint:q,tokenProgram:_(HT)}),L=await Q.getTokenAccountBalance(E).send(),O=BigInt(L.value.amount);if(O===0n)throw Error("Wallet token balance is zero; nothing to sell");if(X=O*I/BigInt(DS),X<=0n)X=1n}else{if(T.tokenAmount===void 0)throw Error("tokenAmount is required when useWalletPercentage is false");yY(T.tokenAmount,"tokenAmount");let M=T.tokenDecimals??6;X=nA(T.tokenAmount,M)}let K=mY(W,G,X),F=fA(K.solOutputLamports,A);if(F<=0n)throw Error("Slippage settings would result in zero SOL output");return mQ({user:T.user,mint:T.mint,tokenAmountRaw:X,minSolOutputLamports:F,feeRecipient:P,bondingCurveCreator:U,rpc:Q,commitment:C})}var H8=new TextEncoder,t8=O1();async function e8(T,A,P,Q){let C=new Uint8Array(2);C[0]=T&255,C[1]=T>>8&255;let[W]=await X1({programAddress:_(LT),seeds:[H8.encode("pool"),C,t8.encode(_(A)),t8.encode(_(P)),t8.encode(_(Q))]});return W}async function lW(T){let[A]=await X1({programAddress:_(LT),seeds:[H8.encode("pool_lp_mint"),t8.encode(_(T))]});return A}async function pW(T,A){let[P]=await tU({owner:T,mint:A});return P}async function j0(T,A,P){let[Q]=await j1({owner:T,mint:A,tokenProgram:P});return Q}async function T2(){let[T]=await X1({programAddress:_(LT),seeds:[H8.encode("global_config")]});return T}async function uW(){let[T]=await X1({programAddress:_(LT),seeds:[H8.encode("global_volume_accumulator")]});return T}async function dW(T){let[A]=await X1({programAddress:_(LT),seeds:[H8.encode("user_volume_accumulator"),t8.encode(_(T))]});return A}async function i2(){let[T]=await X1({programAddress:_(LT),seeds:[H8.encode("__event_authority")]});return T}async function rW(T){let[A]=await X1({programAddress:_(LT),seeds:[H8.encode("creator_vault"),t8.encode(_(T))]});return A}async function cW(T,A,P){let[Q]=await j1({owner:T,mint:A,tokenProgram:P});return Q}var z1="pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA";function z0(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 I1(T,A){return(P)=>{if(!P.value){if(A==="omitted")return;return Object.freeze({address:T,role:H1.READONLY})}let Q=P.isWritable?H1.WRITABLE:H1.READONLY;return Object.freeze({address:z0(P.value),role:lY(P.value)?E6(Q):Q,...lY(P.value)?{signer:P.value}:{}})}}function lY(T){return!!T&&typeof T==="object"&&"address"in T&&B0(T)}var wm=new Uint8Array([242,40,117,145,73,96,105,104]);var xm=new Uint8Array([209,11,115,87,213,23,124,204]);function oW(){return L6([$2()])}var SS=new Uint8Array([102,6,61,18,1,218,235,234]);function NS(){return ZT(qT([["discriminator",jT(DT(),8)],["baseAmountOut",F1()],["maxQuoteAmountIn",F1()],["trackVolume",oW()]]),(T)=>({...T,discriminator:SS}))}function pY(T,A){let P=A?.programAddress??z1,C={pool:{value:T.pool??null,isWritable:!0},user:{value:T.user??null,isWritable:!0},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:!0},userQuoteTokenAccount:{value:T.userQuoteTokenAccount??null,isWritable:!0},poolBaseTokenAccount:{value:T.poolBaseTokenAccount??null,isWritable:!0},poolQuoteTokenAccount:{value:T.poolQuoteTokenAccount??null,isWritable:!0},protocolFeeRecipient:{value:T.protocolFeeRecipient??null,isWritable:!1},protocolFeeRecipientTokenAccount:{value:T.protocolFeeRecipientTokenAccount??null,isWritable:!0},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},coinCreatorVaultAta:{value:T.coinCreatorVaultAta??null,isWritable:!0},coinCreatorVaultAuthority:{value:T.coinCreatorVaultAuthority??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.associatedTokenProgram.value)C.associatedTokenProgram.value="ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";if(!C.program.value)C.program.value="pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA";if(!C.feeProgram.value)C.feeProgram.value="pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ";let G=I1(P,"programId");return Object.freeze({accounts:[G(C.pool),G(C.user),G(C.globalConfig),G(C.baseMint),G(C.quoteMint),G(C.userBaseTokenAccount),G(C.userQuoteTokenAccount),G(C.poolBaseTokenAccount),G(C.poolQuoteTokenAccount),G(C.protocolFeeRecipient),G(C.protocolFeeRecipientTokenAccount),G(C.baseTokenProgram),G(C.quoteTokenProgram),G(C.systemProgram),G(C.associatedTokenProgram),G(C.eventAuthority),G(C.program),G(C.coinCreatorVaultAta),G(C.coinCreatorVaultAuthority),G(C.globalVolumeAccumulator),G(C.userVolumeAccumulator),G(C.feeConfig),G(C.feeProgram)],data:NS().encode(W),programAddress:P})}var vv=new Uint8Array([198,46,21,82,180,217,232,112]);var pv=new Uint8Array([16,4,71,28,204,1,40,27]);var cv=new Uint8Array([249,69,164,218,150,103,84,138]);var iv=new Uint8Array([160,57,89,42,181,139,43,66]);var ev=new Uint8Array([201,207,243,114,75,111,47,189]);var Cy=new Uint8Array([233,146,209,142,207,104,64,188]);var LS=new Uint8Array([242,35,198,137,82,225,242,182]);function wS(){return ZT(qT([["discriminator",jT(DT(),8)],["lpTokenAmountOut",F1()],["maxBaseAmountIn",F1()],["maxQuoteAmountIn",F1()]]),(T)=>({...T,discriminator:LS}))}function uY(T,A){let P=A?.programAddress??z1,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=I1(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:wS().encode(W),programAddress:P})}var Zy=new Uint8Array([185,173,187,90,216,15,238,233]);var Ky=new Uint8Array([234,102,194,203,150,72,62,229]);var Fy=new Uint8Array([94,6,202,115,255,96,232,183]);var ES=new Uint8Array([51,230,133,164,1,127,131,173]);function BS(){return ZT(qT([["discriminator",jT(DT(),8)],["baseAmountIn",F1()],["minQuoteAmountOut",F1()]]),(T)=>({...T,discriminator:ES}))}function dY(T,A){let P=A?.programAddress??z1,C={pool:{value:T.pool??null,isWritable:!0},user:{value:T.user??null,isWritable:!0},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:!0},userQuoteTokenAccount:{value:T.userQuoteTokenAccount??null,isWritable:!0},poolBaseTokenAccount:{value:T.poolBaseTokenAccount??null,isWritable:!0},poolQuoteTokenAccount:{value:T.poolQuoteTokenAccount??null,isWritable:!0},protocolFeeRecipient:{value:T.protocolFeeRecipient??null,isWritable:!1},protocolFeeRecipientTokenAccount:{value:T.protocolFeeRecipientTokenAccount??null,isWritable:!0},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},coinCreatorVaultAta:{value:T.coinCreatorVaultAta??null,isWritable:!0},coinCreatorVaultAuthority:{value:T.coinCreatorVaultAuthority??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.associatedTokenProgram.value)C.associatedTokenProgram.value="ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";if(!C.program.value)C.program.value="pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA";if(!C.feeProgram.value)C.feeProgram.value="pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ";let G=I1(P,"programId");return Object.freeze({accounts:[G(C.pool),G(C.user),G(C.globalConfig),G(C.baseMint),G(C.quoteMint),G(C.userBaseTokenAccount),G(C.userQuoteTokenAccount),G(C.poolBaseTokenAccount),G(C.poolQuoteTokenAccount),G(C.protocolFeeRecipient),G(C.protocolFeeRecipientTokenAccount),G(C.baseTokenProgram),G(C.quoteTokenProgram),G(C.systemProgram),G(C.associatedTokenProgram),G(C.eventAuthority),G(C.program),G(C.coinCreatorVaultAta),G(C.coinCreatorVaultAuthority),G(C.feeConfig),G(C.feeProgram)],data:BS().encode(W),programAddress:P})}var wy=new Uint8Array([210,149,128,45,188,58,78,175]);var xy=new Uint8Array([86,31,192,87,163,87,79,238]);var my=new Uint8Array([161,176,40,213,60,184,179,228]);var ly=new Uint8Array([104,184,103,242,88,151,107,20]);var OS=new Uint8Array([183,18,70,156,148,109,161,34]);function xS(){return ZT(qT([["discriminator",jT(DT(),8)],["lpTokenAmountIn",F1()],["minBaseAmountOut",F1()],["minQuoteAmountOut",F1()]]),(T)=>({...T,discriminator:OS}))}function rY(T,A){let P=A?.programAddress??z1,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=I1(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:xS().encode(W),programAddress:P})}var Xb=new Uint8Array([241,154,109,4,17,177,109,188]);function _S(){return RT([["discriminator",xT(pT(),8)],["poolBump",RA()],["index",fJ()],["creator",S1()],["baseMint",S1()],["quoteMint",S1()],["lpMint",S1()],["poolBaseTokenAccount",S1()],["poolQuoteTokenAccount",S1()],["lpSupply",N1()],["coinCreator",S1()]])}function hS(T){return XA(T,_S())}async function r4(T,A,P){let Q=await gS(T,A,P);return KA(Q),Q}async function gS(T,A,P){let Q=await HA(T,A,P);return hS(Q)}var jb=new Uint8Array([149,8,156,202,160,252,176,217]);function mS(){return RT([["discriminator",xT(pT(),8)],["admin",S1()],["lpFeeBasisPoints",N1()],["protocolFeeBasisPoints",N1()],["disableFlags",RA()],["protocolFeeRecipients",S6(S1(),{size:8})],["coinCreatorFeeBasisPoints",N1()],["adminSetCoinCreatorAuthority",S1()]])}function vS(T){return XA(T,mS())}async function c4(T,A,P){let Q=await yS(T,A,P);return KA(Q),Q}async function yS(T,A,P){let Q=await HA(T,A,P);return vS(Q)}var fW=0;async function cY(T){let{user:A,baseMint:P,quoteMint:Q,index:C=fW,poolAddress:W,poolCreator:G,maxBaseIn:U,maxQuoteIn:$,minLpOut:q=0n,tokenProgram:X=HT,token2022Program:K=q2}=T;if(U<=0n)throw Error("maxBaseIn must be positive");if($<=0n)throw Error("maxQuoteIn must be positive");if(q<0n)throw Error("minLpOut cannot be negative");let F=_(A.address),M=_(P),I=_(Q),E=_(X),L=_(K),O=W?_(W):await e8(C,_(G??F),M,I),m=await T2(),v=await lW(O),l=await pW(F,v),[r]=await j1({owner:F,tokenProgram:E,mint:M}),[c]=await j1({owner:F,tokenProgram:E,mint:I}),o=await j0(O,M,E),u=await j0(O,I,E),h=await i2();return uY({pool:O,globalConfig:m,user:A,baseMint:M,quoteMint:I,lpMint:v,userBaseTokenAccount:r,userQuoteTokenAccount:c,userPoolTokenAccount:l,poolBaseTokenAccount:o,poolQuoteTokenAccount:u,tokenProgram:E,token2022Program:L,eventAuthority:h,program:_(LT),lpTokenAmountOut:q,maxBaseAmountIn:U,maxQuoteAmountIn:$},{programAddress:_(LT)})}async function oY(T){let{user:A,baseMint:P,quoteMint:Q,index:C=fW,poolAddress:W,poolCreator:G,lpAmountIn:U,minBaseOut:$=0n,minQuoteOut:q=0n,tokenProgram:X=HT,token2022Program:K=q2}=T;if(U<=0n)throw Error("lpAmountIn must be positive");if($<0n)throw Error("minBaseOut cannot be negative");if(q<0n)throw Error("minQuoteOut cannot be negative");let F=_(A.address),M=_(P),I=_(Q),E=_(X),L=_(K),O=W?_(W):await e8(C,_(G??F),M,I),m=await T2(),v=await lW(O),l=await pW(F,v),[r]=await j1({owner:F,tokenProgram:E,mint:M}),[c]=await j1({owner:F,tokenProgram:E,mint:I}),o=await j0(O,M,E),u=await j0(O,I,E),h=await i2();return rY({pool:O,globalConfig:m,user:A,baseMint:M,quoteMint:I,lpMint:v,userBaseTokenAccount:r,userQuoteTokenAccount:c,userPoolTokenAccount:l,poolBaseTokenAccount:o,poolQuoteTokenAccount:u,tokenProgram:E,token2022Program:L,eventAuthority:h,program:_(LT),lpTokenAmountIn:U,minBaseAmountOut:$,minQuoteAmountOut:q},{programAddress:_(LT)})}async function fY(T){let{user:A,baseMint:P,quoteMint:Q,tokenAmountOut:C,maxQuoteIn:W,rpc:G,allowTrackVolume:U=!0,commitment:$}=T;if(C<=0n)throw Error("tokenAmountOut must be positive");if(W<=0n)throw Error("maxQuoteIn must be positive");let q=$??K1(),X=_(A.address),K=_(P),F=_(Q),M=_(HT),I=await iY(T,X),{poolData:E,globalConfigData:L,globalConfigAddress:O}=await aY(G,I,q),m=sY(L.protocolFeeRecipients);if(!m)throw Error("Global config does not define a protocol fee recipient");let v=await rW(E.coinCreator),l=await cW(v,F,M),[r]=await j1({owner:X,tokenProgram:M,mint:K}),[c]=await j1({owner:X,tokenProgram:M,mint:F}),o=await j0(I,K,M),u=await j0(I,F,M),[h]=await j1({owner:m,tokenProgram:M,mint:F}),a=await uW(),n=await dW(X),x=await i2(),R=await MA();return pY({pool:I,user:A,globalConfig:O,baseMint:K,quoteMint:F,userBaseTokenAccount:r,userQuoteTokenAccount:c,poolBaseTokenAccount:o,poolQuoteTokenAccount:u,protocolFeeRecipient:m,protocolFeeRecipientTokenAccount:h,baseTokenProgram:M,quoteTokenProgram:M,systemProgram:_(cA),associatedTokenProgram:_(X2),eventAuthority:x,program:_(LT),coinCreatorVaultAta:l,coinCreatorVaultAuthority:v,globalVolumeAccumulator:a,userVolumeAccumulator:n,feeConfig:R,feeProgram:_(FA),baseAmountOut:C,maxQuoteAmountIn:W,trackVolume:[U]},{programAddress:_(LT)})}async function nY(T){let{user:A,baseMint:P,quoteMint:Q,tokenAmountIn:C,minQuoteOut:W,rpc:G,allowTrackVolume:U=!0,commitment:$}=T;if(C<=0n)throw Error("tokenAmountIn must be positive");if(W<=0n)throw Error("minQuoteOut must be positive");let q=$??K1(),X=_(A.address),K=_(P),F=_(Q),M=_(HT),I=await iY(T,X),{poolData:E,globalConfigData:L,globalConfigAddress:O}=await aY(G,I,q),m=sY(L.protocolFeeRecipients);if(!m)throw Error("Global config does not define a protocol fee recipient");let v=await rW(E.coinCreator),l=await cW(v,F,M),[r]=await j1({owner:X,tokenProgram:M,mint:K}),[c]=await j1({owner:X,tokenProgram:M,mint:F}),o=await j0(I,K,M),u=await j0(I,F,M),[h]=await j1({owner:m,tokenProgram:M,mint:F}),a=await uW(),n=await dW(X),x=await i2(),R=await MA();return dY({pool:I,user:A,globalConfig:O,baseMint:K,quoteMint:F,userBaseTokenAccount:r,userQuoteTokenAccount:c,poolBaseTokenAccount:o,poolQuoteTokenAccount:u,protocolFeeRecipient:m,protocolFeeRecipientTokenAccount:h,baseTokenProgram:M,quoteTokenProgram:M,systemProgram:_(cA),associatedTokenProgram:_(X2),eventAuthority:x,program:_(LT),coinCreatorVaultAta:l,coinCreatorVaultAuthority:v,feeConfig:R,feeProgram:_(FA),baseAmountIn:C,minQuoteAmountOut:W},{programAddress:_(LT)})}async function iY(T,A){if(T.poolAddress)return _(T.poolAddress);let P=T.index??fW,Q=_(T.poolCreator??A);return await e8(P,Q,_(T.baseMint),_(T.quoteMint))}async function aY(T,A,P){let Q=await T2(),[C,W]=await Promise.all([r4(T,A,{commitment:P}),c4(T,Q,{commitment:P})]);return{poolData:C.data,globalConfigData:W.data,globalConfigAddress:Q}}function sY(T){let A=T.filter(Boolean);return A.length>0?_(A[0]):null}function bS(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 U=nW(A),$=nW(Q),q=C?new i(C):n2(new i(p0),U,!1,P0,l0),X=[],K=[];if(W)X.push(a2(l4($,q,U,new i(p0))));if(X.push(a2(KT.transfer({fromPubkey:$,toPubkey:q,lamports:Number(P)}))),X.push(a2(xY(q))),G)K.push(a2(vW(q,$,U)));return{prepend:X,append:K,associatedTokenAddress:_(q.toBase58())}}function lS(T,A){let P=nW(T),Q=A?new i(A):n2(new i(p0),P,!1,P0,l0);return[a2(vW(Q,P,P))]}function nW(T){if(typeof T==="string")return new i(T);if(typeof T==="object"&&"address"in T)return new i(T.address);return new i(T)}function a2(T){return{programAddress:_(T.programId.toBase58()),accounts:T.keys.map((A)=>({address:_(A.pubkey.toBase58()),role:A.isSigner?A.isWritable?H1.WRITABLE_SIGNER:H1.READONLY_SIGNER:A.isWritable?H1.WRITABLE:H1.READONLY})),data:T.data}}var p0="So11111111111111111111111111111111111111112";var o4=_(HT),f4=10000n,pS=10000n,eY=(T,A)=>{if(!Number.isFinite(T)||T<=0)throw Error(`${A} must be a positive number`)},TZ=(T)=>_(T??p0);async function s2(T){eY(T.solAmount,"solAmount");let A=T.slippageBps??Q0;C0(A);let P=T.commitment??K1(),Q=TZ(T.quoteMint),C=_(T.mint),W=x0(T.solAmount),G=await AZ({rpc:T.rpc,mint:C,quoteMint:Q,commitment:P,poolAddress:T.poolAddress,poolCreator:T.poolCreator,poolIndex:T.poolIndex}),U=PZ(G.globalConfigData),$=QZ(W,U);if($<=0n)throw Error("Effective quote input after fees is zero");let q=rS($,G.baseReserve,G.quoteReserve);if(q<=0n)throw Error("SOL amount is too small to purchase any tokens from the AMM");if(q>=G.baseReserve)q=G.baseReserve-1n;if(q<=0n)throw Error("AMM pool does not have enough base liquidity for this trade");let X=tY(q,G.quoteReserve,G.baseReserve,U);while(X>W&&q>0n)q-=1n,X=tY(q,G.quoteReserve,G.baseReserve,U);if(q<=0n||X<=0n)throw Error("Unable to satisfy AMM buy with the provided SOL budget");let K=f0(X,A),{createInstruction:F}=await oS({rpc:T.rpc,owner:T.user,mint:C}),M=await fY({user:T.user,baseMint:C,quoteMint:Q,tokenAmountOut:q,maxQuoteIn:K,poolAddress:G.poolAddress,poolCreator:G.poolCreator,index:Number(G.poolData.index),allowTrackVolume:T.allowTrackVolume,rpc:T.rpc,commitment:P});if(F){let I=Object.assign({},M);return I.prepend=[F,...I.prepend??[]],I}return M}async function t2(T){let A=T.slippageBps??Q0;C0(A);let P=T.commitment??K1(),Q=TZ(T.quoteMint),C=_(T.mint),W=await AZ({rpc:T.rpc,mint:C,quoteMint:Q,commitment:P,poolAddress:T.poolAddress,poolCreator:T.poolCreator,poolIndex:T.poolIndex}),G=await fS({params:T,rpc:T.rpc,mint:C});if(G<=0n)throw Error("Token amount must be positive");if(G>=W.baseReserve)throw Error("Token amount exceeds available AMM base liquidity");let U=PZ(W.globalConfigData),$=QZ(G,U);if($<=0n)throw Error("Effective base input after fees is zero");let q=cS($,W.baseReserve,W.quoteReserve);if(q<=0n)throw Error("AMM pool produced zero quote output");let X=fA(q,A);if(X<=0n)throw Error("Slippage settings would result in zero SOL output");return nY({user:T.user,baseMint:C,quoteMint:Q,tokenAmountIn:G,minQuoteOut:X,poolAddress:W.poolAddress,poolCreator:W.poolCreator,index:Number(W.poolData.index),allowTrackVolume:T.allowTrackVolume,rpc:T.rpc,commitment:P})}async function AZ(T){let{rpc:A,mint:P,quoteMint:Q,commitment:C,poolAddress:W,poolCreator:G,poolIndex:U}=T,$=await uS({rpc:A,mint:P,quoteMint:Q,commitment:C,poolAddress:W,poolCreator:G,poolIndex:U}),[q,X]=await Promise.all([j0($.poolAddress,P,o4),j0($.poolAddress,Q,o4)]),K=await dS(A,q,X);return{...$,baseReserve:K.baseReserve,quoteReserve:K.quoteReserve}}async function uS(T){let{rpc:A,mint:P,quoteMint:Q,commitment:C,poolAddress:W,poolCreator:G,poolIndex:U}=T,$=W?_(W):void 0,q=G?_(G):void 0;if(!$){if(!q)throw Error("poolCreator or poolAddress is required to resolve the AMM pool");$=await e8(U??0,q,P,Q)}let X=await T2(),[K,F]=await Promise.all([r4(A,$,{commitment:C}),c4(A,X,{commitment:C})]),M=K.data,I=F.data;if(!q)q=M.creator;return{poolAddress:$,poolCreator:q,poolData:M,globalConfigData:I}}async function dS(T,A,P){let[Q,C]=await Promise.all([T.getTokenAccountBalance(A).send(),T.getTokenAccountBalance(P).send()]);return{baseReserve:BigInt(Q.value.amount),quoteReserve:BigInt(C.value.amount)}}function PZ(T){return BigInt(T.lpFeeBasisPoints)+BigInt(T.protocolFeeBasisPoints)+BigInt(T.coinCreatorFeeBasisPoints)}function QZ(T,A){let P=f4-A;if(P<=0n)return 0n;return T*P/f4}function rS(T,A,P){let Q=P+T;if(Q<=0n)throw Error("Invalid AMM reserves (denominator is zero)");return T*A/Q}function tY(T,A,P,Q){if(T<=0n)return 0n;if(T>=P)throw Error("Requested token amount exceeds pool reserves");let C=T*A/(P-T);if(C<=0n)return 0n;let W=f4-Q;if(W<=0n)throw Error("Invalid AMM fee configuration");return(C*f4+(W-1n))/W}function cS(T,A,P){let Q=A+T;if(Q<=0n)throw Error("Invalid AMM reserves (denominator is zero)");return T*P/Q}async function oS({rpc:T,owner:A,mint:P}){let[Q]=await j1({owner:_(A.address),mint:P,tokenProgram:o4}),C;try{if(!(await T.getAccountInfo(Q).send()).value)C=n8({payer:A,owner:A,mint:P})}catch{C=n8({payer:A,owner:A,mint:P})}return{userAta:Q,createInstruction:C}}async function fS({params:T,rpc:A,mint:P}){let Q=T.useWalletPercentage??!1,C=T.tokenDecimals??6;if(Q){let W=T.walletPercentage??100,G=iS(W),U=await nS(A,T.user,P);if(U===0n)throw Error("Wallet token balance is zero; nothing to sell");let $=U*G/pS;if($<=0n)$=1n;return $}if(T.tokenAmount===void 0)throw Error("tokenAmount is required when useWalletPercentage is false");return eY(T.tokenAmount,"tokenAmount"),nA(T.tokenAmount,C)}async function nS(T,A,P){let[Q]=await j1({owner:_(A.address),mint:P,tokenProgram:o4}),C=await T.getTokenAccountBalance(Q).send();return BigInt(C.value.amount)}function iS(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 aS(T){let{route:A="auto",quoteMint:P,poolAddress:Q,poolCreator:C,poolIndex:W,...G}=T;if(A==="curve")return a8(G);if(A==="amm")return s2(CZ(T,{quoteMint:P,poolAddress:Q,poolCreator:C,poolIndex:W}));if(T.curveStateOverride&&T.feeStructureOverride)return a8(G);let U=await JZ(T.rpc,T.mint,T.commitment);if(U.state==="active"||U.state==="unknown")try{return await a8(G)}catch(q){if(!GZ(q))throw q}let $=C??T.bondingCurveCreator??U.creator;if(!$&&!Q)throw Error("Token appears to have migrated to the AMM. Provide poolCreator or poolAddress to complete the swap.");return s2(CZ(T,{quoteMint:P,poolAddress:Q,poolCreator:$,poolIndex:W}))}function GZ(T){if(!(T instanceof Error)||!T.message)return!1;let A=T.message.toLowerCase();return A.includes("token has migrated to amm")||A.includes("bonding curve")||A.includes("doesn't exist")}async function JZ(T,A,P){let Q=P??K1();try{let C=await DA(A),W=await N8(T,C,{commitment:Q});return{state:W.data.complete?"migrated":"active",creator:W.data.creator}}catch{return{state:"unknown"}}}async function sS(T){let{route:A="auto",quoteMint:P,poolAddress:Q,poolCreator:C,poolIndex:W,...G}=T;if(A==="curve")return s8(G);if(A==="amm")return t2(WZ(T,{quoteMint:P,poolAddress:Q,poolCreator:C??T.bondingCurveCreator,poolIndex:W}));if(T.curveStateOverride&&T.feeStructureOverride)return s8(G);let U=await JZ(T.rpc,T.mint,T.commitment);if(U.state==="active"||U.state==="unknown")try{return await s8(G)}catch(q){if(!GZ(q))throw q}let $=C??T.bondingCurveCreator??U.creator;if(!$&&!Q)throw Error("Token appears to have migrated to the AMM. Provide poolCreator or poolAddress to complete the swap.");return t2(WZ(T,{quoteMint:P,poolAddress:Q,poolCreator:$,poolIndex:W}))}function CZ(T,A){return{user:T.user,mint:T.mint,rpc:T.rpc,commitment:T.commitment,solAmount:T.solAmount,slippageBps:T.slippageBps,quoteMint:A.quoteMint,poolAddress:A.poolAddress,poolCreator:A.poolCreator,poolIndex:A.poolIndex,allowTrackVolume:T.trackVolume}}function WZ(T,A){return{user:T.user,mint:T.mint,rpc:T.rpc,commitment:T.commitment,tokenAmount:T.tokenAmount,tokenDecimals:T.tokenDecimals,slippageBps:T.slippageBps,useWalletPercentage:T.useWalletPercentage,walletPercentage:T.walletPercentage,quoteMint:A.quoteMint,poolAddress:A.poolAddress,poolCreator:A.poolCreator,poolIndex:A.poolIndex,allowTrackVolume:T.trackVolume}}async function iW(T){let{user:A,mint:P,mintAuthority:Q,name:C,symbol:W,uri:G,firstBuyTokenAmount:U,estimatedFirstBuyCost:$,slippageBps:q=Q0,feeRecipient:X=O0,bondingCurveCreator:K,trackVolume:F,rpc:M,commitment:I=K1()}=T;if(C0(q),!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(U<=0n)throw Error("First buy token amount must be positive");if($<=0n)throw Error("Estimated first buy cost must be positive");let E=await G$({user:A,mint:P,mintAuthority:Q,name:C,symbol:W,uri:G}),L=f0($,q),O=await H2({user:A,mint:P.address,tokenAmount:U,maxSolCostLamports:L,feeRecipient:X,trackVolume:F??!0,bondingCurveCreator:K??A.address,rpc:M,commitment:I});return{createInstruction:E,buyInstruction:O}}function tS(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 UZ=_("ComputeBudget111111111111111111111111111111");async function aW({instructions:T,payer:A,additionalSigners:P=[],latestBlockhash:Q,lastValidBlockHeight:C,version:W="legacy",rpc:G,commitment:U=K1(),prependInstructions:$=[],appendInstructions:q=[],priorityFees:X}){let K=typeof A==="string"?_(A):A.address,F=DU({version:W}),M=$Z(X),I=[],E=[];for(let u of T)if("prepend"in u&&Array.isArray(u.prepend)){I.push(...u.prepend);let{prepend:h,...a}=u;E.push(a)}else E.push(u);let L=[...M,...I,...$??[],...E,...q??[]],O=new Map;for(let u of L)if(F=IU(u,F),u.accounts){for(let h of u.accounts)if("signer"in h&&h.signer&&typeof h.signer==="object"&&"address"in h.signer){let a=h.signer;O.set(a.address,a)}}let m=zU(K,F),v=[];if(TN(A))m=rU(A,m),v.push(A);for(let u of O.values())if(!v.some((h)=>h.address===u.address))v.push(u);if(P.length>0){for(let u of P)if(B0(u)&&!v.some((h)=>h.address===u.address))v.push(u)}let l=v.length>0?dU(v,m):m,r=Q,c=C!==void 0?BigInt(C):void 0;if(!r||c===void 0){let{value:u}=await G.getLatestBlockhash({commitment:U}).send();if(r=r??u.blockhash,c===void 0)c=BigInt(u.lastValidBlockHeight)}return{transactionMessage:jU({blockhash:r,lastValidBlockHeight:c},l),latestBlockhash:r,lastValidBlockHeight:c}}async function sW({instructions:T,payer:A,additionalSigners:P=[],latestBlockhash:Q,lastValidBlockHeight:C,version:W,prependInstructions:G,appendInstructions:U,priorityFees:$,rpc:q,rpcSubscriptions:X,commitment:K=K1(),sendOptions:F={}}){let M=await aW({instructions:T,payer:A,additionalSigners:P,latestBlockhash:Q,lastValidBlockHeight:C,version:W,prependInstructions:G,appendInstructions:U,priorityFees:$,rpc:q,commitment:K}),I=await LQ(M.transactionMessage),E=h6(I),L=iU({rpc:q,rpcSubscriptions:X}),O={commitment:K};if(F.abortSignal)O.abortSignal=F.abortSignal;if(F.skipPreflight!==void 0)O.skipPreflight=F.skipPreflight;if(F.minContextSlot!==void 0)O.minContextSlot=BigInt(F.minContextSlot);if(F.maxRetries!==void 0)O.maxRetries=F.maxRetries;if(F.preflightCommitment)O.preflightCommitment=F.preflightCommitment;await L(I,O);let v=(await q.getSignatureStatuses([E],{searchTransactionHistory:!1}).send()).value?.[0]??null;if(v?.err)try{let r=await q.getTransaction(E,{commitment:K,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(r?.meta?.err)c=`Transaction failed: ${typeof r.meta.err==="object"?JSON.stringify(r.meta.err,(u,h)=>typeof h==="bigint"?h.toString():h):String(r.meta.err)}`;if(r?.meta?.logMessages){let o=r.meta.logMessages.filter((u)=>u.toLowerCase().includes("error")||u.includes("Program log:"));if(o.length>0)c+=`
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
- ${o.slice(0,10).join(`
23
- `)}`}throw Error(c)}catch(l){let r=v.err&&typeof v.err==="object"?JSON.stringify(v.err,(c,o)=>typeof o==="bigint"?o.toString():o):String(v.err);throw Error(`Transaction failed: ${r}`)}return{signature:E,slot:v?.slot??null}}async function eS({instructions:T,payer:A,additionalSigners:P=[],latestBlockhash:Q,lastValidBlockHeight:C,version:W,prependInstructions:G,appendInstructions:U,priorityFees:$,rpc:q,commitment:X=K1(),options:K={}}){let F=await aW({instructions:T,payer:A,additionalSigners:P,latestBlockhash:Q,lastValidBlockHeight:C,version:W,prependInstructions:G,appendInstructions:U,priorityFees:$,rpc:q,commitment:X}),M=await LQ(F.transactionMessage),I=g6(M),E={commitment:K.commitment??X};if(K.minContextSlot!==void 0)E.minContextSlot=BigInt(K.minContextSlot);if(K.sigVerify!==void 0)E.sigVerify=K.sigVerify;if(K.replaceRecentBlockhash!==void 0){if(K.sigVerify)throw Error("replaceRecentBlockhash cannot be true when sigVerify is enabled.");E.replaceRecentBlockhash=K.replaceRecentBlockhash}if(K.accounts)E.accounts=K.accounts;let L=await q.simulateTransaction(I,E).send();return{context:{slot:Number(L.context.slot)},value:{err:L.value.err,logs:L.value.logs,unitsConsumed:L.value.unitsConsumed!==void 0?Number(L.value.unitsConsumed):void 0,accounts:L.value.accounts,returnData:L.value.returnData??void 0}}}function TN(T){return typeof T!=="string"&&B0(T)}function $Z(T){if(!T)return[];let A=[];if(T.computeUnitLimit!==void 0&&T.computeUnitLimit>0)A.push(AN(T.computeUnitLimit));if(T.computeUnitPriceMicroLamports!==void 0&&BigInt(T.computeUnitPriceMicroLamports)>0n)A.push(PN(BigInt(T.computeUnitPriceMicroLamports)));return A}function AN(T){let A=new Uint8Array(5);return A[0]=0,new DataView(A.buffer).setUint32(1,T,!0),{programAddress:UZ,accounts:[],data:A}}function PN(T){let A=new Uint8Array(9);return A[0]=3,new DataView(A.buffer).setBigUint64(1,T,!0),{programAddress:UZ,accounts:[],data:A}}async function QN(T){let{creator:A,metadata:P,firstBuyTokenAmount:Q,estimatedFirstBuyCost:C,slippageBps:W,feeRecipient:G,bondingCurveCreator:U,mintAuthority:$,mint:q,priorityFees:X,prependInstructions:K,appendInstructions:F,additionalSigners:M,sendOptions:I,commitment:E=K1(),rpc:L,rpcSubscriptions:O}=T,m=q??await cU(),v={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:U??A.address,rpc:L,commitment:E},{createInstruction:l,buyInstruction:r}=await iW(v);return{...await sW({instructions:[l,r],payer:A,commitment:E,priorityFees:X,prependInstructions:K,appendInstructions:F,additionalSigners:CN([m,...M??[]]),sendOptions:I,rpc:L,rpcSubscriptions:O}),mint:m,createInstruction:l,buyInstruction:r}}function CN(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 WN=p0;async function VZ(T){let{user:A,baseMint:P,quoteMint:Q=p0,poolIndex:C,poolAddress:W,poolCreator:G,maxBaseAmountIn:U,maxQuoteAmountIn:$,minLpTokensOut:q,tokenProgram:X,token2022Program:K}=T;if(U<=0n)throw Error("maxBaseAmountIn must be positive");if($<=0n)throw Error("maxQuoteAmountIn must be positive");return await cY({user:A,baseMint:P,quoteMint:Q,index:C,poolAddress:W,poolCreator:G,maxBaseIn:U,maxQuoteIn:$,minLpOut:q??0n,tokenProgram:X,token2022Program:K})}async function YZ(T){let{user:A,baseMint:P,quoteMint:Q=p0,poolIndex:C,poolAddress:W,poolCreator:G,lpAmountIn:U,minBaseAmountOut:$,minQuoteAmountOut:q,tokenProgram:X,token2022Program:K}=T;if(U<=0n)throw Error("lpAmountIn must be positive");return await oY({user:A,baseMint:P,quoteMint:Q,index:C,poolAddress:W,poolCreator:G,lpAmountIn:U,minBaseOut:$??0n,minQuoteOut:q??0n,tokenProgram:X,token2022Program:K})}async function GN(T,A,P,Q,C={}){return VZ({user:T,baseMint:A,maxBaseAmountIn:P,maxQuoteAmountIn:Q,...C})}async function JN(T,A,P,Q={}){return YZ({user:T,baseMint:A,lpAmountIn:P,...Q})}class tW{connection;programId;commitment;listeners=new Map;nextListenerId=1;subscriptionId=null;constructor(T,A={}){this.connection=T,this.programId=new i(A.programId??sT),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=$N(Q,A,P);for(let W of this.listeners.values())if(W.type==="raw"||W.type===C.type)W.callback(C)}}}var UN={create:["createEvent","create_event"],trade:["tradeEvent","trade_event"],complete:["completeEvent","complete_event"],raw:[]};function $N(T,A,P){let Q="raw";for(let[G,U]of Object.entries(UN)){if(G==="raw")continue;if(U.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 VN(T,A={}){return new tW(T,A)}export{C0 as validateSlippage,tS as validateMintParams,fA as subSlippage,eS as simulateTransaction,mj as setDefaultCommitment,sW as sendAndConfirmTransaction,TR as sellWithSlippage,mQ as sellSimple,sS as sell,YZ as removeLiquidity,JN as quickRemoveLiquidity,GN as quickAddLiquidity,aj as percentToBps,iW as mintWithFirstBuy,K1 as getDefaultCommitment,s8 as curveSell,a8 as curveBuy,VN as createPumpEventManager,QN as createAndBuy,ej as buyWithSlippage,gQ as buySimple,aS as buy,bS as buildWrapSolInstructions,lS as buildUnwrapSolInstructions,aW as buildTransaction,$Z as buildPriorityFeeInstructions,sj as bpsToPercent,t2 as ammSell,s2 as ammBuy,f0 as addSlippage,VZ as addLiquidity,p0 as WSOL_ADDRESS,WN as WSOL,tW as PumpEventManager,Q0 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};