@solana/kit
Version:
Solana Javascript API
5 lines (4 loc) • 123 kB
JavaScript
this.globalThis = this.globalThis || {};
this.globalThis.solanaWeb3 = (function (exports) {
'use strict';
var Qa=Object.defineProperty;var es=(e,t,n)=>t in e?Qa(e,t,{enumerable:true,configurable:true,writable:true,value:n}):e[t]=n;var pt=(e,t,n)=>es(e,typeof t!="symbol"?t+"":t,n);var Ct=1,Fe=2,ht=3,Lt=4,bt=5,Dt=6,yt=7,wt=8,vt=9,No=10,mo=-32700,go=-32603,To=-32602,po=-32601,Io=-32600,ts=-32016,Co=-32015,ho=-32014,ns=-32013,Lo=-32012,rs=-32011,bo=-32010,Do=-32009,os=-32008,yo=-32007,wo=-32006,is=-32005,vo=-32004,as=-32003,It=-32002,Po=-32001,Pt=28e5,xt=2800001,ss=2800002,Ut=2800003,Bt=2800004,Mt=2800005,Ft=2800006,ze=2800007,ke=2800008,zt=2800009,kt=2800010,Vt=323e4,Gt=32300001,Ht=3230002,$t=3230003,Wt=3230004,jt=361e4,Kt=3610001,Xt=3610002,Yt=3610003,Jt=3610004,qt=3610005,Zt=3610006,Qt=3610007,en=3611e3,tn=3704e3,nn=3704001,rn=3704002,on=3704003,an=3704004,sn=4128e3,cn=4128001,un=4128002,xo=4615e3,cs=4615001,us=4615002,_s=4615003,ds=4615004,ls=4615005,Rs=4615006,fs=4615007,As=4615008,Es=4615009,Ss=4615010,Os=4615011,Ns=4615012,ms=4615013,gs=4615014,Ts=4615015,ps=4615016,Is=4615017,Cs=4615018,hs=4615019,Ls=4615020,bs=4615021,Ds=4615022,ys=4615023,ws=4615024,vs=4615025,Ve=4615026,Ps=4615027,xs=4615028,Us=4615029,Bs=4615030,Ms=4615031,Fs=4615032,zs=4615033,ks=4615034,Vs=4615035,Gs=4615036,Hs=4615037,$s=4615038,Ws=4615039,js=4615040,Ks=4615041,Xs=4615042,Ys=4615043,Js=4615044,Uo=4615045,qs=4615046,Zs=4615047,Qs=4615048,ec=4615049,tc=4615050,nc=4615051,rc=4615052,oc=4615053,ic=4615054,_n=5508e3,dn=5508001,ln=5508002,Rn=5508003,fn=5508004,An=5508005,En=5508006,Sn=5508007,On=5508008,Nn=5508009,Ge=5508010,ac=5508011,mn=5663e3,He=5663001,gn=5663002,Tn=5663003,pn=5663004,In=5663005,Cn=5663006,hn=5663007,Ln=5663008,bn=5663009,sc=5663010,cc=5663011,Dn=5663012,uc=5663013,_c=5663014,yn=5663015,wn=5663016,vn=5663017,$e=5663018,We=5663019,Bo=705e4,dc=7050001,lc=7050002,Rc=7050003,fc=7050004,Ac=7050005,Ec=7050006,Sc=7050007,Oc=7050008,Nc=7050009,mc=7050010,gc=7050011,Tc=7050012,pc=7050013,Ic=7050014,Cc=7050015,hc=7050016,Lc=7050017,bc=7050018,Dc=7050019,yc=7050020,wc=7050021,vc=7050022,Pc=7050023,xc=7050024,Uc=7050025,Bc=7050026,Mc=7050027,Fc=7050028,zc=7050029,Mo=7050030,Fo=7050031,kc=7050032,Vc=7050033,Gc=7050034,zo=7050035,Hc=7050036,Pn=8078e3,xn=8078001,Un=8078002,Bn=8078003,Mn=8078004,Fn=8078005,zn=8078006,kn=8078007,Vn=8078008,Gn=8078009,Hn=8078010,$n=8078011,K=8078012,ge=8078013,Wn=8078014,jn=8078015,Kn=8078016,Xn=8078017,Yn=8078018,$c=8078019,Jn=8078020,qn=8078021,je=8078022,Te=81e5,ko=8100001,Zn=8100002,Qn=8100003,er=819e4,tr=8190001,nr=8190002,ce=8190003,rr=8190004,or=99e5,ir=9900001,Wc=9900002,ar=9900003,sr=9900004;function Vo(e){return Array.isArray(e)?"%5B"+e.map(Vo).join("%2C%20")+"%5D":typeof e=="bigint"?`${e}n`:encodeURIComponent(String(e!=null&&Object.getPrototypeOf(e)===null?{...e}:e))}function jc([e,t]){return `${e}=${Vo(t)}`}function Kc(e){let t=Object.entries(e).map(jc).join("&");return btoa(t)}function Xc(e,t={}){{let n=`Solana error #${e}; Decode this error by running \`npx @solana/errors decode -- ${e}`;return Object.keys(t).length&&(n+=` '${Kc(t)}'`),`${n}\``}}function J(e,t){return e instanceof Error&&e.name==="SolanaError"?t!==void 0?e.context.__code===t:true:false}var _=class extends Error{constructor(...[t,n]){let r,o;if(n){let{cause:a,...s}=n;a&&(o={cause:a}),Object.keys(s).length>0&&(r=s);}let i=Xc(t,r);super(i,o);pt(this,"cause",this.cause);pt(this,"context");this.context={__code:t,...r},this.name="SolanaError";}};function ue(...e){"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(...e);}function Go({errorCodeBaseOffset:e,getErrorContext:t,orderedErrorNames:n,rpcEnumError:r},o){let i,a;typeof r=="string"?i=r:(i=Object.keys(r)[0],a=r[i]);let s=n.indexOf(i),c=e+s,u=t(c,i,a),d=new _(c,u);return ue(d,o),d}var Yc=["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 Ho(e,t){let n=Number(e);return Go({errorCodeBaseOffset:4615001,getErrorContext(r,o,i){return r===xo?{errorName:o,index:n,...i!==void 0?{instructionErrorContext:i}:null}:r===Ve?{code:Number(i),index:n}:r===Uo?{encodedData:i,index:n}:{index:n}},orderedErrorNames:Yc,rpcEnumError:t},Ho)}var Jc=["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 Ke(e){return typeof e=="object"&&"InstructionError"in e?Ho(...e.InstructionError):Go({errorCodeBaseOffset:7050001,getErrorContext(t,n,r){if(t===Bo)return {errorName:n,...r!==void 0?{transactionErrorContext:r}:null};if(t===Mo)return {index:Number(r)};if(t===Fo||t===zo)return {accountIndex:Number(r.account_index)}},orderedErrorNames:Jc,rpcEnumError:e},Ke)}function pe(e){let t;if(qc(e)){let{code:n,data:r,message:o}=e,i=Number(n);if(i===It){let{err:a,...s}=r,c=a?{cause:Ke(a)}:null;t=new _(It,{...s,...c});}else {let a;switch(i){case go:case To:case Io:case po:case mo:case Lo:case Po:case vo:case ho:case bo:case Do:case yo:case wo:case Co:a={__serverMessage:o};break;default:typeof r=="object"&&!Array.isArray(r)&&(a=r);}t=new _(i,a);}}else {let n=typeof e=="object"&&e!==null&&"message"in e&&typeof e.message=="string"?e.message:"Malformed JSON-RPC error with no message attribute";t=new _(No,{error:e,message:n});}return ue(t,pe),t}function qc(e){return typeof e=="object"&&e!==null&&"code"in e&&"message"in e&&(typeof e.code=="number"||typeof e.code=="bigint")&&typeof e.message=="string"}var jl=e=>{let t=e.filter(i=>i.length);if(t.length===0)return e.length?e[0]:new Uint8Array;if(t.length===1)return t[0];let n=t.reduce((i,a)=>i+a.length,0),r=new Uint8Array(n),o=0;return t.forEach(i=>{r.set(i,o),o+=i.length;}),r},Zc=(e,t)=>{if(e.length>=t)return e;let n=new Uint8Array(t).fill(0);return n.set(e),n},Qc=(e,t)=>Zc(e.length<=t?e:e.slice(0,t),t);function _e(e,t,n){let r=n===0&&e.length===t.length?e:e.slice(n,n+t.length);return r.length!==t.length?false:t.every((o,i)=>o===r[i])}function V(e,t){return "fixedSize"in t?t.fixedSize:t.getSizeFromValue(e)}function O(e){return Object.freeze({...e,encode:t=>{let n=new Uint8Array(V(t,e));return e.write(t,n,0),n}})}function m(e){return Object.freeze({...e,decode:(t,n=0)=>e.read(t,n)[0]})}function eu(e){return Object.freeze({...e,decode:(t,n=0)=>e.read(t,n)[0],encode:t=>{let n=new Uint8Array(V(t,e));return e.write(t,n,0),n}})}function g(e){return "fixedSize"in e&&typeof e.fixedSize=="number"}function q(e){if(!g(e))throw new _(Un)}function $o(e){return !g(e)}function Kl(e){if(!$o(e))throw new _(Bn)}function A(e,t){if(g(e)!==g(t))throw new _(Mn);if(g(e)&&g(t)&&e.fixedSize!==t.fixedSize)throw new _(Fn,{decoderFixedSize:t.fixedSize,encoderFixedSize:e.fixedSize});if(!g(e)&&!g(t)&&e.maxSize!==t.maxSize)throw new _(zn,{decoderMaxSize:t.maxSize,encoderMaxSize:e.maxSize});return {...t,...e,decode:t.decode,encode:e.encode,read:t.read,write:e.write}}function tu(e,t){let n=(r,o,i)=>{let a=e.encode(r);if(Wo(a,t)>=0)throw new _(Jn,{encodedBytes:a,hexEncodedBytes:Xe(a),hexSentinel:Xe(t),sentinel:t});return o.set(a,i),i+=a.length,o.set(t,i),i+=t.length,i};return g(e)?O({...e,fixedSize:e.fixedSize+t.length,write:n}):O({...e,...e.maxSize!=null?{maxSize:e.maxSize+t.length}:{},getSizeFromValue:r=>e.getSizeFromValue(r)+t.length,write:n})}function nu(e,t){let n=(r,o)=>{let i=o===0?r:r.slice(o),a=Wo(i,t);if(a===-1)throw new _(qn,{decodedBytes:i,hexDecodedBytes:Xe(i),hexSentinel:Xe(t),sentinel:t});let s=i.slice(0,a);return [e.decode(s),o+s.length+t.length]};return g(e)?m({...e,fixedSize:e.fixedSize+t.length,read:n}):m({...e,...e.maxSize!=null?{maxSize:e.maxSize+t.length}:{},read:n})}function Xl(e,t){return A(tu(e,t),nu(e,t))}function Wo(e,t){return e.findIndex((n,r,o)=>t.length===1?n===t[0]:_e(o,t,r))}function Xe(e){return e.reduce((t,n)=>t+n.toString(16).padStart(2,"0"),"")}function jo(e,t,n=0){if(t.length-n<=0)throw new _(Pn,{codecDescription:e})}function de(e,t,n,r=0){let o=n.length-r;if(o<t)throw new _(xn,{bytesLength:o,codecDescription:e,expected:t})}function Ye(e,t,n){if(t<0||t>n)throw new _(Wn,{bytesLength:n,codecDescription:e,offset:t})}function cr(e,t){var a,s;let n=(c,u,d)=>{let l=e.encode(c);return d=t.write(l.length,u,d),u.set(l,d),d+l.length};if(g(t)&&g(e))return O({...e,fixedSize:t.fixedSize+e.fixedSize,write:n});let r=g(t)?t.fixedSize:(a=t.maxSize)!=null?a:null,o=g(e)?e.fixedSize:(s=e.maxSize)!=null?s:null,i=r!==null&&o!==null?r+o:null;return O({...e,...i!==null?{maxSize:i}:{},getSizeFromValue:c=>{let u=V(c,e);return V(u,t)+u},write:n})}function ur(e,t){var a,s;let n=(c,u)=>{let[d,l]=t.read(c,u),f=Number(d);return u=l,(u>0||c.length>f)&&(c=c.slice(u,u+f)),de("addDecoderSizePrefix",f,c),[e.decode(c),u+f]};if(g(t)&&g(e))return m({...e,fixedSize:t.fixedSize+e.fixedSize,read:n});let r=g(t)?t.fixedSize:(a=t.maxSize)!=null?a:null,o=g(e)?e.fixedSize:(s=e.maxSize)!=null?s:null,i=r!==null&&o!==null?r+o:null;return m({...e,...i!==null?{maxSize:i}:{},read:n})}function Yl(e,t){return A(cr(e,t),ur(e,t))}function w(e,t){return O({fixedSize:t,write:(n,r,o)=>{let i=e.encode(n),a=i.length>t?i.slice(0,t):i;return r.set(a,o),o+t}})}function v(e,t){return m({fixedSize:t,read:(n,r)=>{de("fixCodecSize",t,n,r),(r>0||n.length>t)&&(n=n.slice(r,r+t)),g(e)&&(n=Qc(n,e.fixedSize));let[o]=e.read(n,0);return [o,r+t]}})}function Jl(e,t){return A(w(e,t),v(e,t))}function _r(e,t){return O({...e,write:(n,r,o)=>{let i=u=>Ko(u,r.length),a=t.preOffset?t.preOffset({bytes:r,preOffset:o,wrapBytes:i}):o;Ye("offsetEncoder",a,r.length);let s=e.write(n,r,a),c=t.postOffset?t.postOffset({bytes:r,newPreOffset:a,postOffset:s,preOffset:o,wrapBytes:i}):s;return Ye("offsetEncoder",c,r.length),c}})}function dr(e,t){return m({...e,read:(n,r)=>{let o=u=>Ko(u,n.length),i=t.preOffset?t.preOffset({bytes:n,preOffset:r,wrapBytes:o}):r;Ye("offsetDecoder",i,n.length);let[a,s]=e.read(n,i),c=t.postOffset?t.postOffset({bytes:n,newPreOffset:i,postOffset:s,preOffset:r,wrapBytes:o}):s;return Ye("offsetDecoder",c,n.length),[a,c]}})}function ql(e,t){return A(_r(e,t),dr(e,t))}function Ko(e,t){return t===0?0:(e%t+t)%t}function lr(e,t){if(g(e)){let n=t(e.fixedSize);if(n<0)throw new _(ge,{bytesLength:n,codecDescription:"resizeEncoder"});return O({...e,fixedSize:n})}return O({...e,getSizeFromValue:n=>{let r=t(e.getSizeFromValue(n));if(r<0)throw new _(ge,{bytesLength:r,codecDescription:"resizeEncoder"});return r}})}function Rr(e,t){if(g(e)){let n=t(e.fixedSize);if(n<0)throw new _(ge,{bytesLength:n,codecDescription:"resizeDecoder"});return m({...e,fixedSize:n})}return e}function Zl(e,t){return A(lr(e,t),Rr(e,t))}function ru(e,t){return _r(lr(e,n=>n+t),{preOffset:({preOffset:n})=>n+t})}function ou(e,t){return _r(lr(e,n=>n+t),{postOffset:({postOffset:n})=>n+t})}function iu(e,t){return dr(Rr(e,n=>n+t),{preOffset:({preOffset:n})=>n+t})}function fr(e,t){return dr(Rr(e,n=>n+t),{postOffset:({postOffset:n})=>n+t})}function Ql(e,t){return A(ru(e,t),iu(e,t))}function eR(e,t){return A(ou(e,t),fr(e,t))}function Xo(e,t,n,r,o=0){for(;n<--r;){let i=e[n];t[n+o]=e[r],t[r+o]=i,n++;}n===r&&(t[n+o]=e[n]);}function au(e){return q(e),O({...e,write:(t,n,r)=>{let o=e.write(t,n,r);return Xo(n,n,r,r+e.fixedSize),o}})}function su(e){return q(e),m({...e,read:(t,n)=>{let r=t.slice();return Xo(t,r,n,n+e.fixedSize),e.read(r,n)}})}function tR(e){return A(au(e),su(e))}function T(e,t){return O({...$o(e)?{...e,getSizeFromValue:n=>e.getSizeFromValue(t(n))}:e,write:(n,r,o)=>e.write(t(n),r,o)})}function p(e,t){return m({...e,read:(n,r)=>{let[o,i]=e.read(n,r);return [t(o,n,r),i]}})}function nR(e,t,n){return eu({...T(e,t),read:n?p(e,n).read:e.read})}function ei(e,t,n=t){if(!t.match(new RegExp(`^[${e}]*$`)))throw new _(K,{alphabet:e,base:e.length,value:n})}var Er=e=>O({getSizeFromValue:t=>{let[n,r]=Yo(t,e[0]);if(!r)return t.length;let o=Jo(r,e);return n.length+Math.ceil(o.toString(16).length/2)},write(t,n,r){if(ei(e,t),t==="")return r;let[o,i]=Yo(t,e[0]);if(!i)return n.set(new Uint8Array(o.length).fill(0),r),r+o.length;let a=Jo(i,e),s=[];for(;a>0n;)s.unshift(Number(a%256n)),a/=256n;let c=[...Array(o.length).fill(0),...s];return n.set(c,r),r+c.length}}),Sr=e=>m({read(t,n){let r=n===0?t:t.slice(n);if(r.length===0)return ["",0];let o=r.findIndex(c=>c!==0);o=o===-1?r.length:o;let i=e[0].repeat(o);if(o===r.length)return [i,t.length];let a=r.slice(o).reduce((c,u)=>c*256n+BigInt(u),0n),s=cu(a,e);return [i+s,t.length]}}),ti=e=>A(Er(e),Sr(e));function Yo(e,t){let[n,r]=e.split(new RegExp(`((?!${t}).*)`));return [n,r]}function Jo(e,t){let n=BigInt(t.length),r=0n;for(let o of e)r*=n,r+=BigInt(t.indexOf(o));return r}function cu(e,t){let n=BigInt(t.length),r=[];for(;e>0n;)r.unshift(t[Number(e%n)]),e/=n;return r.join("")}var Or="0123456789",aR=()=>Er(Or),sR=()=>Sr(Or),cR=()=>ti(Or),qo={alphabet:"0123456789abcdef",base:16};function Ar(e){if(e>=48&&e<=57)return e-48;if(e>=65&&e<=70)return e-55;if(e>=97&&e<=102)return e-87}var uu=()=>O({getSizeFromValue:e=>Math.ceil(e.length/2),write(e,t,n){let r=e.length,o=r/2;if(r===1){let a=e.charCodeAt(0),s=Ar(a);if(s===void 0)throw new _(K,{...qo,value:e});return t.set([s],n),1+n}let i=new Uint8Array(o);for(let a=0,s=0;a<o;a++){let c=e.charCodeAt(s++),u=e.charCodeAt(s++),d=Ar(c),l=Ar(u);if(d===void 0||l===void 0&&!Number.isNaN(u))throw new _(K,{...qo,value:e});i[a]=Number.isNaN(u)?d:d<<4|(l!=null?l:0);}return t.set(i,n),i.length+n}}),_u=()=>m({read(e,t){return [e.slice(t).reduce((r,o)=>r+o.toString(16).padStart(2,"0"),""),e.length]}}),uR=()=>A(uu(),_u()),Nr="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",X=()=>Er(Nr),Z=()=>Sr(Nr),_R=()=>ti(Nr),du=(e,t)=>O({getSizeFromValue:n=>Math.floor(n.length*t/8),write(n,r,o){if(ei(e,n),n==="")return o;let i=[...n].map(s=>e.indexOf(s)),a=ni(i,t,8,false);return r.set(a,o),a.length+o}}),lu=(e,t)=>m({read(n,r=0){let o=r===0?n:n.slice(r);return o.length===0?["",n.length]:[ni([...o],8,t,true).map(a=>e[a]).join(""),n.length]}}),dR=(e,t)=>A(du(e,t),lu(e,t));function ni(e,t,n,r){let o=[],i=0,a=0,s=(1<<n)-1;for(let c of e)for(i=i<<t|c,a+=t;a>=n;)a-=n,o.push(i>>a&s);return r&&a>0&&o.push(i<<n-a&s),o}var Zo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ie=()=>O({getSizeFromValue:e=>{try{return atob(e).length}catch{throw new _(K,{alphabet:Zo,base:64,value:e})}},write(e,t,n){try{let r=atob(e).split("").map(o=>o.charCodeAt(0));return t.set(r,n),r.length+n}catch{throw new _(K,{alphabet:Zo,base:64,value:e})}}}),mr=()=>m({read(e,t=0){let n=e.slice(t);return [btoa(String.fromCharCode(...n)),e.length]}}),lR=()=>A(Ie(),mr()),Ru=e=>e.replace(/\u0000/g,""),RR=(e,t)=>e.padEnd(t,"\0"),fu=globalThis.TextDecoder,Qo=globalThis.TextEncoder,Au=()=>{let e;return O({getSizeFromValue:t=>(e||(e=new Qo)).encode(t).length,write:(t,n,r)=>{let o=(e||(e=new Qo)).encode(t);return n.set(o,r),r+o.length}})},Eu=()=>{let e;return m({read(t,n){let r=(e||(e=new fu)).decode(t.slice(n));return [Ru(r),t.length]}})},fR=()=>A(Au(),Eu());var OR=128;function NR(e,t){try{return "exists"in e&&!e.exists?e:Object.freeze({...e,data:t.decode(e.data)})}catch{throw new _(Ht,{address:e.address})}}function ri(e){return !("exists"in e)||"exists"in e&&e.exists}function mR(e){if(ri(e)&&e.data instanceof Uint8Array)throw new _($t,{address:e.address})}function oi(e){let t=e.filter(n=>ri(n)&&n.data instanceof Uint8Array);if(t.length>0){let n=t.map(r=>r.address);throw new _(Wt,{addresses:n})}}function Je(e,t){if(!t)return Object.freeze({address:e,exists:false});let n=Ie().encode(t.data[0]);return Object.freeze({...gr(t),address:e,data:n,exists:true})}function gR(e,t){if(!t)return Object.freeze({address:e,exists:false});let n=X().encode(typeof t.data=="string"?t.data:t.data[0]);return Object.freeze({...gr(t),address:e,data:n,exists:true})}function ii(e,t){if(!t)return Object.freeze({address:e,exists:false});let n=t.data.parsed.info;return Object.freeze({...gr(t),address:e,data:n,exists:true})}function gr(e){return Object.freeze({executable:e.executable,lamports:e.lamports,programAddress:e.owner,space:e.space})}async function TR(e,t,n={}){let{abortSignal:r,...o}=n,i=await e.getAccountInfo(t,{...o,encoding:"base64"}).send({abortSignal:r});return Je(t,i.value)}async function pR(e,t,n={}){let{abortSignal:r,...o}=n,{value:i}=await e.getAccountInfo(t,{...o,encoding:"jsonParsed"}).send({abortSignal:r});return i&&typeof i=="object"&&"parsed"in i.data?ii(t,i):Je(t,i)}async function IR(e,t,n={}){let{abortSignal:r,...o}=n;return (await e.getMultipleAccounts(t,{...o,encoding:"base64"}).send({abortSignal:r})).value.map((a,s)=>Je(t[s],a))}async function ai(e,t,n={}){let{abortSignal:r,...o}=n;return (await e.getMultipleAccounts(t,{...o,encoding:"jsonParsed"}).send({abortSignal:r})).value.map((a,s)=>a&&typeof a=="object"&&"parsed"in a.data?ii(t[s],a):Je(t[s],a))}function CR(e){if(!e.exists)throw new _(Vt,{address:e.address})}function si(e){let t=e.filter(n=>!n.exists);if(t.length>0){let n=t.map(r=>r.address);throw new _(Gt,{addresses:n})}}function ci(){if(typeof globalThis.crypto>"u"||typeof globalThis.crypto.getRandomValues!="function")throw new _(en)}function Ce(){if(!globalThis.isSecureContext)throw new _(jt)}var ie;async function Su(e){return ie===void 0&&(ie=new Promise(t=>{e.generateKey("Ed25519",false,["sign","verify"]).then(()=>{t(ie=true);}).catch(()=>{t(ie=false);});})),typeof ie=="boolean"?ie:await ie}function ui(){var e;if(Ce(),typeof globalThis.crypto>"u"||typeof((e=globalThis.crypto.subtle)==null?void 0:e.digest)!="function")throw new _(Kt)}async function _i(){var e;if(Ce(),typeof globalThis.crypto>"u"||typeof((e=globalThis.crypto.subtle)==null?void 0:e.generateKey)!="function")throw new _(Jt);if(!await Su(globalThis.crypto.subtle))throw new _(Xt)}function qe(){var e;if(Ce(),typeof globalThis.crypto>"u"||typeof((e=globalThis.crypto.subtle)==null?void 0:e.exportKey)!="function")throw new _(Yt)}function di(){var e;if(Ce(),typeof globalThis.crypto>"u"||typeof((e=globalThis.crypto.subtle)==null?void 0:e.sign)!="function")throw new _(qt)}function li(){var e;if(Ce(),typeof globalThis.crypto>"u"||typeof((e=globalThis.crypto.subtle)==null?void 0:e.verify)!="function")throw new _(Zt)}var Tr,pr;function Ir(){return Tr||(Tr=X()),Tr}function Ou(){return pr||(pr=Z()),pr}function Cr(e){if(e.length<32||e.length>44)return false;let t=Ir();try{return t.encode(e).byteLength===32}catch{return false}}function he(e){if(e.length<32||e.length>44)throw new _(xt,{actualLength:e.length});let r=Ir().encode(e).byteLength;if(r!==32)throw new _(Pt,{actualLength:r})}function Nu(e){return he(e),e}function Le(){return T(w(Ir(),32),e=>Nu(e))}function ae(){return v(Ou(),32)}function Ai(){return A(Le(),ae())}function et(){return new Intl.Collator("en",{caseFirst:"lower",ignorePunctuation:false,localeMatcher:"best fit",numeric:false,sensitivity:"variant",usage:"sort"}).compare}var mu=37095705934669439343138083508754565189542113879843219016388785533085940283555n,b=57896044618658097711785492504343953926634992332820282019728792003956564819949n,Ri=19681161376707505956807079304988542015446066515923890162744021073123829784752n;function P(e){let t=e%b;return t>=0n?t:b+t}function G(e,t){let n=e;for(;t-- >0n;)n*=n,n%=b;return n}function gu(e){let n=e*e%b*e%b,r=G(n,2n)*n%b,o=G(r,1n)*e%b,i=G(o,5n)*o%b,a=G(i,10n)*i%b,s=G(a,20n)*a%b,c=G(s,40n)*s%b,u=G(c,80n)*c%b,d=G(u,80n)*c%b,l=G(d,10n)*i%b;return G(l,2n)*e%b}function Tu(e,t){let n=P(t*t*t),r=P(n*n*t),o=gu(e*r),i=P(e*n*o),a=P(t*i*i),s=i,c=P(i*Ri),u=a===e,d=a===P(-e),l=a===P(-e*Ri);return u&&(i=s),(d||l)&&(i=c),(P(i)&1n)===1n&&(i=P(-i)),!u&&!d?null:i}function pu(e,t){let n=P(e*e),r=P(n-1n),o=P(mu*n+1n),i=Tu(r,o);if(i===null)return false;let a=(t&128)!==0;return !(i===0n&&a)}function Iu(e){let t=e.toString(16);return t.length===1?`0${t}`:t}function Cu(e){let n=`0x${e.reduce((r,o,i)=>`${Iu(i===31?o&-129:o)}${r}`,"")}`;return BigInt(n)}function hu(e){if(e.byteLength!==32)return false;let t=Cu(e);return pu(t,e[31])}function PR(e){return Array.isArray(e)&&e.length===2&&typeof e[0]=="string"&&typeof e[1]=="number"&&e[1]>=0&&e[1]<=255&&Cr(e[0])}function xR(e){if(!(Array.isArray(e)&&e.length===2&&typeof e[0]=="string"&&typeof e[1]=="number"))throw new _(Bt);if(e[1]<0||e[1]>255)throw new _(Mt,{bump:e[1]});he(e[0]);}var Qe=32,fi=16,Ze=[80,114,111,103,114,97,109,68,101,114,105,118,101,100,65,100,100,114,101,115,115];async function Lu({programAddress:e,seeds:t}){if(ui(),t.length>fi)throw new _(Ft,{actual:t.length,maxSeeds:fi});let n,r=t.reduce((c,u,d)=>{let l=typeof u=="string"?(n||(n=new TextEncoder)).encode(u):u;if(l.byteLength>Qe)throw new _(ze,{actual:l.byteLength,index:d,maxSeedLength:Qe});return c.push(...l),c},[]),o=Ai(),i=o.encode(e),a=await crypto.subtle.digest("SHA-256",new Uint8Array([...r,...i,...Ze])),s=new Uint8Array(a);if(hu(s))throw new _(ke);return o.decode(s)}async function UR({programAddress:e,seeds:t}){let n=255;for(;n>0;)try{return [await Lu({programAddress:e,seeds:[...t,new Uint8Array([n])]}),n]}catch(r){if(J(r,ke))n--;else throw r}throw new _(zt)}async function BR({baseAddress:e,programAddress:t,seed:n}){let{encode:r,decode:o}=Ai(),i=typeof n=="string"?new TextEncoder().encode(n):n;if(i.byteLength>Qe)throw new _(ze,{actual:i.byteLength,index:0,maxSeedLength:Qe});let a=r(t);if(a.length>=Ze.length&&a.slice(-Ze.length).every((u,d)=>u===Ze[d]))throw new _(kt);let s=await crypto.subtle.digest("SHA-256",new Uint8Array([...r(e),...i,...a])),c=new Uint8Array(s);return o(c)}async function tt(e){if(qe(),e.type!=="public"||e.algorithm.name!=="Ed25519")throw new _(Ut);let t=await crypto.subtle.exportKey("raw",e);return ae().decode(new Uint8Array(t))}async function MR(e){let t=Le().encode(e);return await crypto.subtle.importKey("raw",t,{name:"Ed25519"},true,["verify"])}function Ei(e,t,n,r){if(r<t||r>n)throw new _($n,{codecDescription:e,max:n,min:t,value:r})}var bu=(e=>(e[e.Little=0]="Little",e[e.Big=1]="Big",e))(bu||{});function Si(e){return (e==null?void 0:e.endian)!==1}function x(e){return O({fixedSize:e.size,write(t,n,r){e.range&&Ei(e.name,e.range[0],e.range[1],t);let o=new ArrayBuffer(e.size);return e.set(new DataView(o),t,Si(e.config)),n.set(new Uint8Array(o),r),r+e.size}})}function U(e){return m({fixedSize:e.size,read(t,n=0){jo(e.name,t,n),de(e.name,e.size,t,n);let r=new DataView(Du(t,n,e.size));return [e.get(r,Si(e.config)),n+e.size]}})}function Du(e,t,n){let r=e.byteOffset+(t!=null?t:0),o=n!=null?n:e.byteLength;return e.buffer.slice(r,r+o)}var yu=(e={})=>x({config:e,name:"f32",set:(t,n,r)=>t.setFloat32(0,Number(n),r),size:4}),wu=(e={})=>U({config:e,get:(t,n)=>t.getFloat32(0,n),name:"f32",size:4}),VR=(e={})=>A(yu(e),wu(e)),vu=(e={})=>x({config:e,name:"f64",set:(t,n,r)=>t.setFloat64(0,Number(n),r),size:8}),Pu=(e={})=>U({config:e,get:(t,n)=>t.getFloat64(0,n),name:"f64",size:8}),GR=(e={})=>A(vu(e),Pu(e)),xu=(e={})=>x({config:e,name:"i128",range:[-BigInt("0x7fffffffffffffffffffffffffffffff")-1n,BigInt("0x7fffffffffffffffffffffffffffffff")],set:(t,n,r)=>{let o=r?8:0,i=r?0:8,a=0xffffffffffffffffn;t.setBigInt64(o,BigInt(n)>>64n,r),t.setBigUint64(i,BigInt(n)&a,r);},size:16}),Uu=(e={})=>U({config:e,get:(t,n)=>{let r=n?8:0,o=n?0:8,i=t.getBigInt64(r,n),a=t.getBigUint64(o,n);return (i<<64n)+a},name:"i128",size:16}),HR=(e={})=>A(xu(e),Uu(e)),Bu=(e={})=>x({config:e,name:"i16",range:[-32767-1,32767],set:(t,n,r)=>t.setInt16(0,Number(n),r),size:2}),Mu=(e={})=>U({config:e,get:(t,n)=>t.getInt16(0,n),name:"i16",size:2}),$R=(e={})=>A(Bu(e),Mu(e)),Fu=(e={})=>x({config:e,name:"i32",range:[-2147483647-1,2147483647],set:(t,n,r)=>t.setInt32(0,Number(n),r),size:4}),zu=(e={})=>U({config:e,get:(t,n)=>t.getInt32(0,n),name:"i32",size:4}),WR=(e={})=>A(Fu(e),zu(e)),ku=(e={})=>x({config:e,name:"i64",range:[-BigInt("0x7fffffffffffffff")-1n,BigInt("0x7fffffffffffffff")],set:(t,n,r)=>t.setBigInt64(0,BigInt(n),r),size:8}),Vu=(e={})=>U({config:e,get:(t,n)=>t.getBigInt64(0,n),name:"i64",size:8}),jR=(e={})=>A(ku(e),Vu(e)),Gu=()=>x({name:"i8",range:[-127-1,127],set:(e,t)=>e.setInt8(0,Number(t)),size:1}),Hu=()=>U({get:e=>e.getInt8(0),name:"i8",size:1}),KR=()=>A(Gu(),Hu()),H=()=>O({getSizeFromValue:e=>e<=127?1:e<=16383?2:3,maxSize:3,write:(e,t,n)=>{Ei("shortU16",0,65535,e);let r=[0];for(let o=0;;o+=1){let i=Number(e)>>o*7;if(i===0)break;let a=127&i;r[o]=a,o>0&&(r[o-1]|=128);}return t.set(r,n),n+r.length}}),z=()=>m({maxSize:3,read:(e,t)=>{let n=0,r=0;for(;++r;){let o=r-1,i=e[t+o],a=127&i;if(n|=a<<o*7,(i&128)===0)break}return [n,t+r]}}),XR=()=>A(H(),z()),$u=(e={})=>x({config:e,name:"u128",range:[0n,BigInt("0xffffffffffffffffffffffffffffffff")],set:(t,n,r)=>{let o=r?8:0,i=r?0:8,a=0xffffffffffffffffn;t.setBigUint64(o,BigInt(n)>>64n,r),t.setBigUint64(i,BigInt(n)&a,r);},size:16}),Wu=(e={})=>U({config:e,get:(t,n)=>{let r=n?8:0,o=n?0:8,i=t.getBigUint64(r,n),a=t.getBigUint64(o,n);return (i<<64n)+a},name:"u128",size:16}),YR=(e={})=>A($u(e),Wu(e)),ju=(e={})=>x({config:e,name:"u16",range:[0,65535],set:(t,n,r)=>t.setUint16(0,Number(n),r),size:2}),Ku=(e={})=>U({config:e,get:(t,n)=>t.getUint16(0,n),name:"u16",size:2}),JR=(e={})=>A(ju(e),Ku(e)),be=(e={})=>x({config:e,name:"u32",range:[0,4294967295],set:(t,n,r)=>t.setUint32(0,Number(n),r),size:4}),hr=(e={})=>U({config:e,get:(t,n)=>t.getUint32(0,n),name:"u32",size:4}),qR=(e={})=>A(be(e),hr(e)),Lr=(e={})=>x({config:e,name:"u64",range:[0n,BigInt("0xffffffffffffffff")],set:(t,n,r)=>t.setBigUint64(0,BigInt(n),r),size:8}),br=(e={})=>U({config:e,get:(t,n)=>t.getBigUint64(0,n),name:"u64",size:8}),ZR=(e={})=>A(Lr(e),br(e)),D=()=>x({name:"u8",range:[0,255],set:(e,t)=>e.setUint8(0,Number(t)),size:1}),L=()=>U({get:e=>e.getUint8(0),name:"u8",size:1}),QR=()=>A(D(),L());function Oi(e,t,n){if(t!==n)throw new _(kn,{actual:n,codecDescription:e,expected:t})}function Xu(e){return e.reduce((t,n)=>t===null||n===null?null:Math.max(t,n),0)}function te(e){return e.reduce((t,n)=>t===null||n===null?null:t+n,0)}function le(e){return g(e)?e.fixedSize:null}function se(e){var t;return g(e)?e.fixedSize:(t=e.maxSize)!=null?t:null}function k(e,t={}){var i,a;let n=(i=t.size)!=null?i:be(),r=nt(n,le(e)),o=(a=nt(n,se(e)))!=null?a:void 0;return O({...r!==null?{fixedSize:r}:{getSizeFromValue:s=>(typeof n=="object"?V(s.length,n):0)+[...s].reduce((u,d)=>u+V(d,e),0),maxSize:o},write:(s,c,u)=>(typeof n=="number"&&Oi("array",n,s.length),typeof n=="object"&&(u=n.write(s.length,c,u)),s.forEach(d=>{u=e.write(d,c,u);}),u)})}function M(e,t={}){var a,s;let n=(a=t.size)!=null?a:hr(),r=le(e),o=nt(n,r),i=(s=nt(n,se(e)))!=null?s:void 0;return m({...o!==null?{fixedSize:o}:{maxSize:i},read:(c,u)=>{let d=[];if(typeof n=="object"&&c.slice(u).length===0)return [d,u];if(n==="remainder"){for(;u<c.length;){let[E,S]=e.read(c,u);u=S,d.push(E);}return [d,u]}let[l,f]=typeof n=="number"?[n,u]:n.read(c,u);u=f;for(let E=0;E<l;E+=1){let[S,N]=e.read(c,u);u=N,d.push(S);}return [d,u]}})}function of(e,t={}){return A(k(e,t),M(e,t))}function nt(e,t){return typeof e!="number"?null:e===0?0:t===null?null:t*e}function Yu(e,t={}){var o;let r=(o=(typeof t=="boolean"?{backward:t}:t).backward)!=null?o:false;return O({fixedSize:e,write(i,a,s){var u;let c=[];for(let d=0;d<e;d+=1){let l=0;for(let f=0;f<8;f+=1){let E=Number((u=i[d*8+f])!=null?u:0);l|=E<<(r?f:7-f);}r?c.unshift(l):c.push(l);}return a.set(c,s),e}})}function Ju(e,t={}){var o;let r=(o=(typeof t=="boolean"?{backward:t}:t).backward)!=null?o:false;return m({fixedSize:e,read(i,a){de("bitArray",e,i,a);let s=[],c=i.slice(a,a+e);return c=r?c.reverse():c,c.forEach(u=>{for(let d=0;d<8;d+=1)r?(s.push(!!(u&1)),u>>=1):(s.push(!!(u&128)),u<<=1);}),[s,a+e]}})}function af(e,t={}){return A(Yu(e,t),Ju(e,t))}function rt(e={}){var t;return T((t=e.size)!=null?t:D(),n=>n?1:0)}function ot(e={}){var t;return p((t=e.size)!=null?t:L(),n=>Number(n)===1)}function sf(e={}){return A(rt(e),ot(e))}function Re(){return O({getSizeFromValue:e=>e.length,write:(e,t,n)=>(t.set(e,n),n+e.length)})}function fe(){return m({read:(e,t)=>{let n=e.slice(t);return [n,t+n.length]}})}function cf(){return A(Re(),fe())}var qu=()=>m({read(e,t){return [e.slice(t).reduce((r,o)=>r+o.toString(16).padStart(2,"0"),""),e.length]}});function it(e){return O({fixedSize:e.length,write:(t,n,r)=>(n.set(e,r),r+e.length)})}function at(e){return m({fixedSize:e.length,read:(t,n)=>{let r=qu();if(!_e(t,e,n))throw new _(Yn,{constant:e,data:t,hexConstant:r.decode(e),hexData:r.decode(t),offset:n});return [void 0,n+e.length]}})}function uf(e){return A(it(e),at(e))}function $(e){var r;let t=te(e.map(le)),n=(r=te(e.map(se)))!=null?r:void 0;return O({...t===null?{getSizeFromValue:o=>e.map((i,a)=>V(o[a],i)).reduce((i,a)=>i+a,0),maxSize:n}:{fixedSize:t},write:(o,i,a)=>(Oi("tuple",e.length,o.length),e.forEach((s,c)=>{a=s.write(o[c],i,a);}),a)})}function B(e){var r;let t=te(e.map(le)),n=(r=te(e.map(se)))!=null?r:void 0;return m({...t===null?{maxSize:n}:{fixedSize:t},read:(o,i)=>{let a=[];return e.forEach(s=>{let[c,u]=s.read(o,i);a.push(c),i=u;}),[a,i]}})}function _f(e){return A($(e),B(e))}function De(e,t){let n=Ni(e),r=(i,a,s)=>{let c=t(i);return Dr(e,c),e[c].write(i,a,s)};if(n!==null)return O({fixedSize:n,write:r});let o=mi(e);return O({...o!==null?{maxSize:o}:{},getSizeFromValue:i=>{let a=t(i);return Dr(e,a),V(i,e[a])},write:r})}function ye(e,t){let n=Ni(e),r=(i,a)=>{let s=t(i,a);return Dr(e,s),e[s].read(i,a)};if(n!==null)return m({fixedSize:n,read:r});let o=mi(e);return m({...o!==null?{maxSize:o}:{},read:r})}function df(e,t,n){return A(De(e,t),ye(e,n))}function Dr(e,t){if(typeof e[t]>"u")throw new _(Xn,{maxRange:e.length-1,minRange:0,variant:t})}function Ni(e){if(e.length===0)return 0;if(!g(e[0]))return null;let t=e[0].fixedSize;return e.every(r=>g(r)&&r.fixedSize===t)?t:null}function mi(e){return Xu(e.map(t=>se(t)))}function gi(e,t={}){var o,i;let n=(o=t.discriminator)!=null?o:"__kind",r=(i=t.size)!=null?i:D();return De(e.map(([,a],s)=>T($([r,a]),c=>[s,c])),a=>Qu(e,a[n]))}function Ti(e,t={}){var o,i;let n=(o=t.discriminator)!=null?o:"__kind",r=(i=t.size)!=null?i:L();return ye(e.map(([a,s])=>p(B([r,s]),([,c])=>({[n]:a,...c}))),(a,s)=>Number(r.read(a,s)[0]))}function Zu(e,t={}){return A(gi(e,t),Ti(e,t))}function Qu(e,t){let n=e.findIndex(([r])=>t===r);if(n<0)throw new _(Gn,{value:t,variants:e.map(([r])=>r)});return n}var lf=gi,Rf=Ti,ff=Zu;function pi(e){let t=[...new Set(Object.values(e).filter(a=>typeof a=="number"))].sort(),n=Object.fromEntries(Object.entries(e).slice(t.length)),r=Object.keys(n),o=Object.values(n),i=[...new Set([...r,...o.filter(a=>typeof a=="string")])];return {enumKeys:r,enumRecord:n,enumValues:o,numericalValues:t,stringValues:i}}function e_({enumKeys:e,enumValues:t,variant:n}){let r=Ii(t,o=>o===n);return r>=0?r:e.findIndex(o=>o===n)}function t_({discriminator:e,enumKeys:t,enumValues:n,useValuesAsDiscriminators:r}){return r?Ii(n,o=>o===e):e>=0&&e<t.length?e:-1}function Ii(e,t){let n=e.length;for(;n--;)if(t(e[n],n,e))return n;return -1}function Ci(e){if(e.length===0)return "";let t=[e[0],e[0]],n=[];for(let r=1;r<e.length;r++){let o=e[r];t[1]+1===o?t[1]=o:(n.push(t[0]===t[1]?`${t[0]}`:`${t[0]}-${t[1]}`),t=[o,o]);}return n.push(t[0]===t[1]?`${t[0]}`:`${t[0]}-${t[1]}`),n.join(", ")}function hi(e,t={}){var c,u;let n=(c=t.size)!=null?c:D(),r=(u=t.useValuesAsDiscriminators)!=null?u:false,{enumKeys:o,enumValues:i,numericalValues:a,stringValues:s}=pi(e);if(r&&i.some(d=>typeof d=="string"))throw new _(je,{stringValues:i.filter(d=>typeof d=="string")});return T(n,d=>{let l=e_({enumKeys:o,enumValues:i,variant:d});if(l<0)throw new _(Hn,{formattedNumericalValues:Ci(a),numericalValues:a,stringValues:s,variant:d});return r?i[l]:l})}function Li(e,t={}){var s,c;let n=(s=t.size)!=null?s:L(),r=(c=t.useValuesAsDiscriminators)!=null?c:false,{enumKeys:o,enumValues:i,numericalValues:a}=pi(e);if(r&&i.some(u=>typeof u=="string"))throw new _(je,{stringValues:i.filter(u=>typeof u=="string")});return p(n,u=>{let d=Number(u),l=t_({discriminator:d,enumKeys:o,enumValues:i,useValuesAsDiscriminators:r});if(l<0){let f=r?a:[...Array(o.length).keys()];throw new _(Vn,{discriminator:d,formattedValidDiscriminators:Ci(f),validDiscriminators:f})}return i[l]})}function n_(e,t={}){return A(hi(e,t),Li(e,t))}var Af=hi,Ef=Li,Sf=n_;function r_(e,t){return T($([...t,e]),n=>[...t.map(()=>{}),n])}function o_(e,t){return p(B([...t,e]),n=>n[n.length-1])}function Of(e,t){return A(r_(e,t),o_(e,t))}function i_(e,t){return T($([e,...t]),n=>[n,...t.map(()=>{})])}function a_(e,t){return p(B([e,...t]),n=>n[0])}function Nf(e,t){return A(i_(e,t),a_(e,t))}function s_(e,t={}){var r;let n=(r=t.size)!=null?r:D();return T(n,o=>{let i=e.indexOf(o);if(i<0)throw new _(jn,{value:o,variants:e});return i})}function c_(e,t={}){var r;let n=(r=t.size)!=null?r:L();return p(n,o=>{if(o<0||o>=e.length)throw new _(Kn,{discriminator:o,maxRange:e.length-1,minRange:0});return e[Number(o)]})}function mf(e,t={}){return A(s_(e,t),c_(e,t))}function u_(e,t,n={}){return T(k($([e,t]),n),r=>[...r.entries()])}function __(e,t,n={}){return p(M(B([e,t]),n),r=>new Map(r))}function gf(e,t,n={}){return A(u_(e,t,n),__(e,t,n))}function Q(){return O({fixedSize:0,write:(e,t,n)=>n})}function ee(){return m({fixedSize:0,read:(e,t)=>[void 0,t]})}function Tf(){return A(Q(),ee())}function d_(e,t={}){let n=(()=>{var o;return t.prefix===null?T(Q(),i=>{}):rt({size:(o=t.prefix)!=null?o:D()})})(),r=t.noneValue==="zeroes"?(q(e),w(Q(),e.fixedSize)):t.noneValue?it(t.noneValue):Q();return De([T($([n,r]),o=>[false,void 0]),T($([n,e]),o=>[true,o])],o=>+(o!==null))}function l_(e,t={}){let n=(()=>{var o;return t.prefix===null?p(ee(),()=>false):ot({size:(o=t.prefix)!=null?o:L()})})(),r=t.noneValue==="zeroes"?(q(e),v(ee(),e.fixedSize)):t.noneValue?at(t.noneValue):ee();return ye([p(B([n,r]),()=>null),p(B([n,e]),([,o])=>o)],(o,i)=>{if(t.prefix===null&&!t.noneValue)return +(i<o.length);if(t.prefix===null&&t.noneValue!=null){let a=t.noneValue==="zeroes"?new Uint8Array(r.fixedSize).fill(0):t.noneValue;return _e(o,a,i)?0:1}return Number(n.read(o,i)[0])})}function pf(e,t={}){return A(d_(e,t),l_(e,t))}function R_(e,t={}){return T(k(e,t),n=>[...n])}function f_(e,t={}){return p(M(e,t),n=>new Set(n))}function If(e,t={}){return A(R_(e,t),f_(e,t))}function Y(e){var o;let t=e.map(([,i])=>i),n=te(t.map(le)),r=(o=te(t.map(se)))!=null?o:void 0;return O({...n===null?{getSizeFromValue:i=>e.map(([a,s])=>V(i[a],s)).reduce((a,s)=>a+s,0),maxSize:r}:{fixedSize:n},write:(i,a,s)=>(e.forEach(([c,u])=>{s=u.write(i[c],a,s);}),s)})}function ne(e){var o;let t=e.map(([,i])=>i),n=te(t.map(le)),r=(o=te(t.map(se)))!=null?o:void 0;return m({...n===null?{maxSize:r}:{fixedSize:n},read:(i,a)=>{let s={};return e.forEach(([c,u])=>{let[d,l]=u.read(i,a);a=l,s[c]=d;}),[s,a]}})}function Cf(e){return A(Y(e),ne(e))}var Di=e=>({__option:"Some",value:e}),yi=()=>({__option:"None"}),yr=e=>!!(e&&typeof e=="object"&&"__option"in e&&(e.__option==="Some"&&"value"in e||e.__option==="None")),st=e=>e.__option==="Some",yf=e=>e.__option==="None";function wf(e,t){return st(e)?e.value:t?t():null}var A_=e=>e!==null?Di(e):yi();function E_(e,t={}){let n=(()=>{var o;return t.prefix===null?T(Q(),i=>{}):rt({size:(o=t.prefix)!=null?o:D()})})(),r=t.noneValue==="zeroes"?(q(e),w(Q(),e.fixedSize)):t.noneValue?it(t.noneValue):Q();return De([T($([n,r]),o=>[false,void 0]),T($([n,e]),o=>[true,yr(o)&&st(o)?o.value:o])],o=>{let i=yr(o)?o:A_(o);return Number(st(i))})}function S_(e,t={}){let n=(()=>{var o;return t.prefix===null?p(ee(),()=>false):ot({size:(o=t.prefix)!=null?o:L()})})(),r=t.noneValue==="zeroes"?(q(e),v(ee(),e.fixedSize)):t.noneValue?at(t.noneValue):ee();return ye([p(B([n,r]),()=>yi()),p(B([n,e]),([,o])=>Di(o))],(o,i)=>{if(t.prefix===null&&!t.noneValue)return +(i<o.length);if(t.prefix===null&&t.noneValue!=null){let a=t.noneValue==="zeroes"?new Uint8Array(r.fixedSize).fill(0):t.noneValue;return _e(o,a,i)?0:1}return Number(n.read(o,i)[0])})}function vf(e,t={}){return A(E_(e,t),S_(e,t))}function bi(e,t){if(!e||ArrayBuffer.isView(e))return e;let n=r=>t?bi(r,t):bi(r);return yr(e)?st(e)?n(e.value):t?t():null:Array.isArray(e)?e.map(n):typeof e=="object"?Object.fromEntries(Object.entries(e).map(([r,o])=>[r,n(o)])):e}function F(e,...t){return t.reduce((n,r)=>r(n),e)}function wi(e,t){return e.programAddress===t}function Bf(e,t){if(e.programAddress!==t)throw new _(un,{actualProgramAddress:e.programAddress,expectedProgramAddress:t})}function Mf(e){return e.accounts!==void 0}function Ff(e){if(e.accounts===void 0)throw new _(sn,{data:e.data,programAddress:e.programAddress})}function vi(e){return e.data!==void 0}function zf(e){var t;if(e.data===void 0)throw new _(cn,{accountAddresses:(t=e.accounts)==null?void 0:t.map(n=>n.address),programAddress:e.programAddress})}var h=(e=>(e[e.WRITABLE_SIGNER=3]="WRITABLE_SIGNER",e[e.READONLY_SIGNER=2]="READONLY_SIGNER",e[e.WRITABLE=1]="WRITABLE",e[e.READONLY=0]="READONLY",e))(h||{}),O_=2,Pi=1;function kf(e){return e&-3}function Vf(e){return e&-2}function W(e){return e>=2}function Ae(e){return (e&Pi)!==0}function wr(e,t){return e|t}function Gf(e){return e|O_}function Hf(e){return e|Pi}var we=Object.freeze({name:"Ed25519"});function N_(e){return new Uint8Array([48,46,2,1,0,48,5,6,3,43,101,112,4,34,4,32,...e])}async function vr(e,t=false){let n=e.byteLength;if(n!==32)throw new _(nn,{actualLength:n});let r=N_(e);return await crypto.subtle.importKey("pkcs8",r,we,t,["sign"])}async function m_(e,t=false){if(qe(),e.extractable===false)throw new _(Qt,{key:e});let n=await crypto.subtle.exportKey("jwk",e);return await crypto.subtle.importKey("jwk",{crv:"Ed25519",ext:t,key_ops:["verify"],kty:"OKP",x:n.x},"Ed25519",t,["verify"])}var Ee;function g_(e){if(Ee||(Ee=X()),e.length<64||e.length>88)throw new _(on,{actualLength:e.length});let n=Ee.encode(e).byteLength;if(n!==64)throw new _(rn,{actualLength:n})}function Xf(e){return Ee||(Ee=X()),!(e.length<64||e.length>88||Ee.encode(e).byteLength!==64)}async function ve(e,t){di();let n=await crypto.subtle.sign(we,e,t);return new Uint8Array(n)}function Yf(e){return g_(e),e}async function T_(e,t,n){return li(),await crypto.subtle.verify(we,e,t,n)}async function xi(){return await _i(),await crypto.subtle.generateKey(we,false,["sign","verify"])}async function Ui(e,t=false){if(ci(),e.byteLength!==64)throw new _(tn,{byteLength:e.byteLength});let[n,r]=await Promise.all([crypto.subtle.importKey("raw",e.slice(32),we,true,["verify"]),vr(e.slice(0,32),t)]),o=new Uint8Array(32);crypto.getRandomValues(o);let i=await ve(r,o);if(!await T_(n,i,o))throw new _(an);return {privateKey:r,publicKey:n}}async function Bi(e,t=false){let n=vr(e,t),[r,o]=await Promise.all([(t?n:vr(e,true)).then(async i=>await m_(i,true)),n]);return {privateKey:o,publicKey:r}}function Zf(e,t,n,r){var i;if(!J(e,Ve))return false;let o=(i=t.instructions[e.context.index])==null?void 0:i.programAddress;return !o||o!==n?false:typeof r>"u"||e.context.code===r}function ct(e){return JSON.parse(p_(e),(t,n)=>L_(n)?h_(n):n)}function p_(e){let t=[],n=false;for(let r=0;r<e.length;r++){let o=false;if(e[r]==="\\"&&(t.push(e[r++]),o=!o),e[r]==='"'){t.push(e[r]),o||(n=!n);continue}if(!n){let i=I_(e,r);if(i!=null&&i.length){r+=i.length-1,i.match(/\.|[eE]-/)?t.push(i):t.push(C_(i));continue}}t.push(e[r]);}return t.join("")}function I_(e,t){var o;let n=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/;if(!((o=e[t])!=null&&o.match(/[-\d]/)))return null;let r=e.slice(t).match(n);return r?r[0]:null}function C_(e){return `{"$n":"${e}"}`}function h_({$n:e}){if(e.match(/[eE]/)){let[t,n]=e.split(/[eE]/);return BigInt(t)*BigInt(10)**BigInt(n)}return BigInt(e)}function L_(e){return !!e&&typeof e=="object"&&"$n"in e&&typeof e.$n=="string"}var Mi=0n;function b_(){let e=Mi;return Mi++,e.toString()}function Se(e){return {id:b_(),jsonrpc:"2.0",method:e.methodName,params:e.params}}function ut(e,t){return y_(JSON.stringify(e,(n,r)=>typeof r=="bigint"?D_(r):r,t))}function D_(e){return {$n:`${e}`}}function y_(e){return e.replace(/\{\s*"\$n"\s*:\s*"(-?\d+)"\s*\}/g,"$1")}function Fi(e){return w_(e)}function w_(e){return new Proxy(e.api,{defineProperty(){return false},deleteProperty(){return false},get(t,n,r){return function(...o){let i=n.toString(),a=Reflect.get(t,i,r);if(!a)throw new _(Qn,{method:i,params:o});let s=a(...o);return v_(e,s)}}})}function v_({transport:e},t){return {async send(n){return await t.execute({signal:n==null?void 0:n.abortSignal,transport:e})}}}function zi(e){return new Proxy({},{defineProperty(){return false},deleteProperty(){return false},get(...t){let[n,r]=t,o=r.toString();return function(...i){let a=Object.freeze({methodName:o,params:i}),s=e!=null&&e.requestTransformer?e==null?void 0:e.requestTransformer(a):a;return Object.freeze({execute:async({signal:c,transport:u})=>{let d=Se(s),l=await u({payload:d,signal:c});return e!=null&&e.responseTransformer?e.responseTransformer(l,s):l}})}}})}function _t(e){return e==null||typeof e!="object"||Array.isArray(e)?false:"jsonrpc"in e&&e.jsonrpc==="2.0"&&"method"in e&&typeof e.method=="string"&&"params"in e}function P_(e){return typeof e=="bigint"?Number(e):e}var R={};function ki(e){return function t(n,r){if(Array.isArray(n))return n.map((o,i)=>{let a={...r,keyPath:[...r.keyPath,i]};return t(o,a)});if(typeof n=="object"&&n!==null){let o={};for(let i in n){if(!Object.prototype.hasOwnProperty.call(n,i))continue;let a={...r,keyPath:[...r.keyPath,i]};o[i]=t(n[i],a);}return o}else return e.reduce((o,i)=>i(o,r),n)}}function Vi(e,t){return n=>{let r=ki(e);return Object.freeze({...n,params:r(n.params,t)})}}function x_(e,t){return n=>ki(e)(n,t)}function U_(){return Vi([P_],{keyPath:[]})}function B_({commitmentPropertyName:e,params:t,optionsObjectPositionInParams:n,overrideCommitment:r}){let o=t[n];if(o===void 0||o&&typeof o=="object"&&!Array.isArray(o)){if(o&&e in o){if(!o[e]||o[e]==="finalized"){let i=[...t],{[e]:a,...s}=o;return Object.keys(s).length>0?i[n]=s:n===i.length-1?i.length--:i[n]=void 0,i}}else if(r!=="finalized"){let i=[...t];return i[n]={...o,[e]:r},i}}return t}function M_({defaultCommitment:e,optionsObjectPositionByMethod:t}){return n=>{let{params:r,methodName:o}=n;if(!Array.isArray(r))return n;let i=t[o];return i==null?n:Object.freeze({methodName:o,params:B_({commitmentPropertyName:o==="sendTransaction"?"preflightCommitment":"commitment",optionsObjectPositionInParams:i,overrideCommitment:e,params:r})})}}function F_(e){return (t,{keyPath:n})=>(typeof t=="bigint"&&e&&(t>Number.MAX_SAFE_INTEGER||t<-Number.MAX_SAFE_INTEGER)&&e(n,t),t)}function z_(e){return t=>Vi([F_((...r)=>e(t,...r))],{keyPath:[]})(t)}var k_={accountNotifications:1,blockNotifications:1,getAccountInfo:1,getBalance:1,getBlock:1,getBlockHeight:0,getBlockProduction:0,getBlocks:2,getBlocksWithLimit:2,getEpochInfo:0,getFeeForMessage:1,getInflationGovernor:0,getInflationReward:1,getLargestAccounts:0,getLatestBlockhash:0,getLeaderSchedule:1,getMinimumBalanceForRentExemption:1,getMultipleAccounts:1,getProgramAccounts:1,getSignaturesForAddress:1,getSlot:0,getSlotLeader:0,getStakeMinimumDelegation:0,getSupply:0,getTokenAccountBalance:1,getTokenAccountsByDelegate:2,getTokenAccountsByOwner:2,getTokenLargestAccounts:1,getTokenSupply:1,getTransaction:1,getTransactionCount:0,getVoteAccounts:0,isBlockhashValid:1,logsNotifications:1,programNotifications:1,requestAirdrop:2,sendTransaction:1,signatureNotifications:1,simulateTransaction:1};function dt(e){let t=e==null?void 0:e.onIntegerOverflow;return n=>F(n,t?z_(t):r=>r,U_(),M_({defaultCommitment:e==null?void 0:e.defaultCommitment,optionsObjectPositionByMethod:k_}))}function V_(e){return function(n,{keyPath:r}){return typeof n=="number"&&Number.isInteger(n)||typeof n=="bigint"?G_(r,e)?Number(n):BigInt(n):n}}function G_(e,t){return t.some(n=>{if(n.length!==e.length)return false;for(let r=e.length-1;r>=0;r--){let o=e[r],i=n[r];if(i!==o&&(i!==R||typeof o!="number"))return false}return true})}function Gi(e){return x_([V_(e)],{keyPath:[]})}function H_(){return e=>e.result}function $_(){return e=>{let t=e;if("error"in t)throw pe(t.error);return t}}function Hi(e){return (t,n)=>{let r=n.methodName,o=e!=null&&e.allowedNumericKeyPaths&&r?e.allowedNumericKeyPaths[r]:void 0;return F(t,i=>$_()(i,n),i=>H_()(i,n),i=>Gi(o!=null?o:[])(i,n))}}function $i(e){return (t,n)=>{let r=n.methodName,o=e!=null&&e.allowedNumericKeyPaths&&r?e.allowedNumericKeyPaths[r]:void 0;return F(t,i=>Gi(o!=null?o:[])(i,n))}}var lt=[["data","parsed","info","tokenAmount","decimals"],["data","parsed","info","tokenAmount","uiAmount"],["data","parsed","info","rentExemptReserve","decimals"],["data","parsed","info","rentExemptReserve","uiAmount"],["data","parsed","info","delegatedAmount","decimals"],["data","parsed","info","delegatedAmount","uiAmount"],["data","parsed","info","extensions",R,"state","olderTransferFee","transferFeeBasisPoints"],["data","parsed","info","extensions",R,"state","newerTransferFee","transferFeeBasisPoints"],["data","parsed","info","extensions",R,"state","preUpdateAverageRate"],["data","parsed","info","extensions",R,"state","currentRate"]],re=[...lt,["data","parsed","info","lastExtendedSlotStartIndex"],["data","parsed","info","slashPenalty"],["data","parsed","info","warmupCooldownRate"],["data","parsed","info","decimals"],["data","parsed","info","numRequiredSigners"],["data","parsed","info","numValidSigners"],["data","parsed","info","stake","delegation","warmupCooldownRate"],["data","parsed","info","exemptionThreshold"],["data","parsed","info","burnPercent"],["data","parsed","info","commission"],["data","parsed","info","votes",R,"confirmationCount"]],Rt=[["index"],["instructions",R,"accounts",R],["instructions",R,"programIdIndex"],["instructions",R,"stackHeight"]],Pr=[["addressTableLookups",R,"writableIndexes",R],["addressTableLookups",R,"readonlyIndexes",R],["header","numReadonlySignedAccounts"],["header","numReadonlyUnsignedAccounts"],["header","numRequiredSignatures"],["instructions",R,"accounts",R],["instructions",R,"programIdIndex"],["instructions",R,"stackHeight"]];function Wi(e){return zi({requestTransformer:dt(e),responseTransformer:Hi({allowedNumericKeyPaths:W_()})})}var xr;function W_(){return xr||(xr={getAccountInfo:re.map(e=>["value",...e]),getBlock:[["transactions",R,"meta","preTokenBalances",R,"accountIndex"],["transactions",R,"meta","preTokenBalances",R,"uiTokenAmount","decimals"],["transactions",R,"meta","postTokenBalances",R,"accountIndex"],["transactions",R,"meta","postTokenBalances",R,"uiTokenAmount","decimals"],["transactions",R,"meta","rewards",R,"commission"],...Rt.map(e=>["transactions",R,"meta","innerInstructions",R,...e]),...Pr.map(e=>["transactions",R,"transaction","message",...e]),["rewards",R,"commission"]],getClusterNodes:[[R,"featureSet"],[R,"shredVersion"]],getInflationGovernor:[["initial"],["foundation"],["foundationTerm"],["taper"],["terminal"]],getInflationRate:[["foundation"],["total"],["validator"]],getInflationReward:[[R,"commission"]],getMultipleAccounts:re.map(e=>["value",R,...e]),getProgramAccounts:re.flatMap(e=>[["value",R,"account",...e],[R,"account",...e]]),getRecentPerformanceSamples:[[R,"samplePeriodSecs"]],getTokenAccountBalance:[["value","decimals"],["value","uiAmount"]],getTokenAccountsByDelegate:lt.map(e=>["value",R,"account",...e]),getTokenAccountsByOwner:lt.map(e=>["value",R,"account",...e]),getTokenLargestAccounts:[["value",R,"decimals"],["value",R,"uiAmount"]],getTokenSupply:[["value","decimals"],["value","uiAmount"]],getTransaction:[["meta","preTokenBalances",R,"accountIndex"],["meta","preTokenBalances",R,"uiTokenAmount","decimals"],["meta","postTokenBalances",R,"accountIndex"],["meta","postTokenBalances",R,"uiTokenAmount","decimals"],["meta","rewards",R,"commission"],...Rt.map(e=>["meta","innerInstructions",R,...e]),...Pr.map(e=>["transaction","message",...e])],getVersion:[["feature-set"]],getVoteAccounts:[["current",R,"commission"],["delinquent",R,"commission"]],simulateTransaction:[...re.map(e=>["value","accounts",R,...e]),...Rt.map(e=>["value","innerInstructions",R,...e])]}),xr}function j_(e){let t={};for(let n in e)t[n.toLowerCase()]=e[n];return t}function K_(e){let{fromJson:t,headers:n,toJson:r,url:o}=e,i,a=n&&j_(n);return async function({payload:c,signal:u}){let d=r?r(c):JSON.stringify(c),l={...i,body:d,headers:{...a,accept:"application/json","content-length":d.length.toString(),"content-type":"application/json; charset=utf-8"},method:"POST",signal:u},f=await fetch(o,l);if(!f.ok)throw new