1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5349],{71180:(t,e,r)=>{let n;r.d(e,{BN:()=>p.a,BP:()=>rx,NQ:()=>to});var i,o,s,a,c,u,l,d,h,_=r(86892),p=r.n(_),f=r(99960),R=r(8133),y=r(84297),E=r.n(y),O=r(44175),A=r.n(O),m=r(74968),N=(r(67494),r(14061)),T=r(53983),g=r.n(T),I=r(8133).Buffer;let v=t=>"version"in t;function w(t){return new TextDecoder("utf-8").decode(t)}function C(t){return E().encode(t)}function S(t){return R.Buffer.from(t,"base64")}function b(t){return"accounts"in t}async function D(t){let e=(await f.PublicKey.findProgramAddress([],t))[0];return await f.PublicKey.createWithSeed(e,"anchor:idl",t)}let L=m.struct([m.publicKey("authority"),m.vecU8("data")]);function H(t,e,r,n){return(null==t?void 0:t.length)?t[0].name?r(t):n(t):e()}function x(t){return t instanceof f.PublicKey?t:new f.PublicKey(t)}class P extends TypeError{constructor(t,e){let r;const{message:n,...i}=t,{path:o}=t;super(0===o.length?n:"At path: "+o.join(".")+" -- "+n),this.value=void 0,this.key=void 0,this.type=void 0,this.refinement=void 0,this.path=void 0,this.branch=void 0,this.failures=void 0,Object.assign(this,i),this.name=this.constructor.name,this.failures=()=>{var n;return null!=(n=r)?n:r=[t,...e()]}}}function U(t){return"object"==typeof t&&null!=t}function M(t){return"string"==typeof t?JSON.stringify(t):""+t}function*k(t,e,r,n){var i;for(let o of(U(i=t)&&"function"==typeof i[Symbol.iterator]||(t=[t]),t)){let t=function(t,e,r,n){if(!0===t)return;!1===t?t={}:"string"==typeof t&&(t={message:t});let{path:i,branch:o}=e,{type:s}=r,{refinement:a,message:c="Expected a value of type `"+s+"`"+(a?" with refinement `"+a+"`":"")+", but received: `"+M(n)+"`"}=t;return{value:n,type:s,refinement:a,key:i[i.length-1],path:i,branch:o,...t,message:c}}(o,e,r,n);t&&(yield t)}}function*B(t,e,r){void 0===r&&(r={});let{path:n=[],branch:i=[t],coerce:o=!1,mask:s=!1}=r,a={path:n,branch:i};if(o&&(t=e.coercer(t,a),s&&"type"!==e.type&&U(e.schema)&&U(t)&&!Array.isArray(t)))for(let r in t)void 0===e.schema[r]&&delete t[r];let c=!0;for(let r of e.validator(t,a))c=!1,yield[r,void 0];for(let[r,u,l]of e.entries(t,a))for(let e of B(u,l,{path:void 0===r?n:[...n,r],branch:void 0===r?i:[...i,u],coerce:o,mask:s}))e[0]?(c=!1,yield[e[0],void 0]):o&&(u=e[1],void 0===r?t=u:t instanceof Map?t.set(r,u):t instanceof Set?t.add(u):U(t)&&(t[r]=u));if(c)for(let r of e.refiner(t,a))c=!1,yield[r,void 0];c&&(yield[void 0,t])}class G{constructor(t){this.TYPE=void 0,this.type=void 0,this.schema=void 0,this.coercer=void 0,this.validator=void 0,this.refiner=void 0,this.entries=void 0;const{type:e,schema:r,validator:n,refiner:i,coercer:o=t=>t,entries:s=function*(){}}=t;this.type=e,this.schema=r,this.entries=s,this.coercer=o,n?this.validator=(t,e)=>k(n(t,e),e,this,t):this.validator=()=>[],i?this.refiner=(t,e)=>k(i(t,e),e,this,t):this.refiner=()=>[]}assert(t){var e=t,r=this;let n=$(e,r);if(n[0])throw n[0]}create(t){return K(t,this)}is(t){var e,r;return e=t,r=this,!$(e,r)[0]}mask(t){var e=t,r=this;let n=$(e,r,{coerce:!0,mask:!0});if(!n[0])return n[1];throw n[0]}validate(t,e){return void 0===e&&(e={}),$(t,this,e)}}function K(t,e){let r=$(t,e,{coerce:!0});if(!r[0])return r[1];throw r[0]}function $(t,e,r){void 0===r&&(r={});let n=B(t,e,r),i=function(t){let{done:e,value:r}=t.next();return e?void 0:r}(n);return i[0]?[new P(i[0],function*(){for(let t of n)t[0]&&(yield t[0])}),void 0]:[void 0,i[1]]}function V(t,e){return new G({type:t,schema:null,validator:e})}function j(t){return new G({type:"array",schema:t,*entries(e){if(t&&Array.isArray(e))for(let[r,n]of e.entries())yield[r,n,t]},coercer:t=>Array.isArray(t)?t.slice():t,validator:t=>Array.isArray(t)||"Expected an array value, but received: "+M(t)})}function F(t){let e=M(t),r=typeof t;return new G({type:"literal",schema:"string"===r||"number"===r||"boolean"===r?t:null,validator:r=>r===t||"Expected the literal `"+e+"`, but received: "+M(r)})}function z(t){return new G({...t,validator:(e,r)=>null===e||t.validator(e,r),refiner:(e,r)=>null===e||t.refiner(e,r)})}function X(){return V("number",t=>"number"==typeof t&&!isNaN(t)||"Expected a number, but received: "+M(t))}function Y(t){return new G({...t,validator:(e,r)=>void 0===e||t.validator(e,r),refiner:(e,r)=>void 0===e||t.refiner(e,r)})}function q(){return V("string",t=>"string"==typeof t||"Expected a string, but received: "+M(t))}function W(t){let e=Object.keys(t);return new G({type:"type",schema:t,*entries(r){if(U(r))for(let n of e)yield[n,r[n],t[n]]},validator:t=>U(t)||"Expected an object, but received: "+M(t)})}function Q(t){let e=t.map(t=>t.type).join(" | ");return new G({type:"union",schema:null,coercer:(e,r)=>(t.find(t=>{let[r]=t.validate(e,{coerce:!0});return!r})||Z()).coercer(e,r),validator(r,n){let i=[];for(let e of t){let[...t]=B(r,e,n),[o]=t;if(!o[0])return[];for(let[e]of t)e&&i.push(e)}return["Expected the value to satisfy a union of `"+e+"`, but received: "+M(r),...i]}})}function Z(){return V("unknown",()=>!0)}async function J(t,e,r){if(e.length<=99)return await tt(t,e,r);{let n=Array.apply(0,Array(Math.ceil(e.length/99))).map((t,r)=>e.slice(99*r,(r+1)*99));return(await Promise.all(n.map(e=>tt(t,e,r)))).flat()}}async function tt(t,e,r){let n=null!=r?r:t.commitment,{value:i,context:o}=await t.getMultipleAccountsInfoAndContext(e,n);return i.map((t,r)=>null===t?null:{publicKey:e[r],account:t,context:o})}async function te(t,e,r,n,i){var o;r&&r.length>0&&e.sign(...r);let s=e._compile(),a=s.serialize(),c=e._serialize(a).toString("base64"),u={encoding:"base64",commitment:null!=n?n:t.commitment};i&&(u.accounts={encoding:"base64",addresses:(Array.isArray(i)?i:s.nonProgramIds()).map(t=>
1t.toBase58())}),r&&r.length>0&&(u.sigVerify=!0);let l=[c,u],d=K(await t._rpcRequest("simulateTransaction",l),ti);if("error"in d){let t;if("data"in d.error&&(t=null==(o=d.error.data)?void 0:o.logs)&&Array.isArray(t)){let e="\n ",r=e+t.join(e);console.error(d.error.message,r)}throw new f.SendTransactionError("failed to simulate transaction: "+d.error.message,t)}return d.result}let tr=tn(Z());function tn(t){return Q([W({jsonrpc:F("2.0"),id:q(),result:t}),W({jsonrpc:F("2.0"),id:q(),error:W({code:Z(),message:q(),data:Y(V("any",()=>!0))})})])}let ti=(i=W({err:z(Q([W({}),q()])),logs:z(j(q())),accounts:Y(z(j(z(W({executable:V("boolean",t=>"boolean"==typeof t),owner:q(),lamports:X(),data:j(q()),rentEpoch:Y(X())}))))),unitsConsumed:Y(X())}),s=tn(o=W({context:W({slot:X()}),value:i})),a=t=>"error"in t?t:{...t,result:K(t.result,o)},new G({...s,coercer:(t,e)=>$(t,tr)[0]?s.coercer(t,e):s.coercer(a(t,e),e)}));class to{constructor(t,e,r=to.defaultOptions()){this.connection=t,this.wallet=e,this.opts=r,this.publicKey=null==e?void 0:e.publicKey}static defaultOptions(){return{preflightCommitment:"processed",commitment:"processed"}}static local(t,e=to.defaultOptions()){throw Error("Provider local is not available on browser.")}static env(){throw Error("Provider env is not available on browser.")}async sendAndConfirm(t,e,r){var n,i,o,s;if(void 0===r&&(r=this.opts),v(t))e&&t.sign(e);else if(t.feePayer=null!=(n=t.feePayer)?n:this.wallet.publicKey,t.recentBlockhash=(await this.connection.getLatestBlockhash(r.preflightCommitment)).blockhash,e)for(let r of e)t.partialSign(r);let a=(t=await this.wallet.signTransaction(t)).serialize();try{return await ta(this.connection,a,r)}catch(e){if(e instanceof tc){let r=C(v(t)?(null==(i=t.signatures)?void 0:i[0])||new Uint8Array:null!=(o=t.signature)?o:new Uint8Array),n=v(t)?0:void 0,a=await this.connection.getTransaction(r,{commitment:"confirmed",maxSupportedTransactionVersion:n});if(a){let t=null==(s=a.meta)?void 0:s.logMessages;throw t?new f.SendTransactionError(e.message,t):e}}throw e}}async sendAll(t,e){var r,n,i;void 0===e&&(e=this.opts);let o=(await this.connection.getLatestBlockhash(e.preflightCommitment)).blockhash,s=t.map(t=>{var e,r;if(v(t.tx)){let e=t.tx;return t.signers&&e.sign(t.signers),e}{let n=t.tx,i=null!=(e=t.signers)?e:[];return n.feePayer=null!=(r=n.feePayer)?r:this.wallet.publicKey,n.recentBlockhash=o,i.forEach(t=>{n.partialSign(t)}),n}}),a=await this.wallet.signAllTransactions(s),c=[];for(let t=0;t<s.length;t+=1){let o=a[t],s=o.serialize();try{c.push(await ta(this.connection,s,e))}catch(t){if(t instanceof tc){let e=C(v(o)?(null==(r=o.signatures)?void 0:r[0])||new Uint8Array:null!=(n=o.signature)?n:new Uint8Array),s=v(o)?0:void 0,a=await this.connection.getTransaction(e,{commitment:"confirmed",maxSupportedTransactionVersion:s});if(a){let e=null==(i=a.meta)?void 0:i.logMessages;throw e?new f.SendTransactionError(t.message,e):t}}throw t}}return c}async simulate(t,e,r,n){let i,o=(await this.connection.getLatestBlockhash(null!=r?r:this.connection.commitment)).blockhash;if(v(t)?(e&&e.length>0&&(t.sign(e),t=await this.wallet.signTransaction(t)),i=await this.connection.simulateTransaction(t,{commitment:r})):(t.feePayer=t.feePayer||this.wallet.publicKey,t.recentBlockhash=o,e&&e.length>0&&(t=await this.wallet.signTransaction(t)),i=await te(this.connection,t,e,r,n)),i.value.err)throw new ts(i.value);return i.value}}class ts extends Error{constructor(t,e){super(e),this.simulationResponse=t}}async function ta(t,e,r){let n,i=r?{skipPreflight:r.skipPreflight,preflightCommitment:r.preflightCommitment||r.commitment,maxRetries:r.maxRetries,minContextSlot:r.minContextSlot}:{},o=Date.now();for(;Date.now()-o<6e4;)try{let o=await t.sendRawTransaction(e,i);if(null==r?void 0:r.blockhash)if(0===i.maxRetries){let e=AbortSignal.timeout(15e3);n=(await t.confirmTransaction({abortSignal:e,signature:o,...r.blockhash},r&&r.commitment)).value}else n=(await t.confirmTransaction({signature:o,...r.blockhash},r&&r.commitment)).value;else n=(await t.confirmTransaction(o,r&&r.commitment)).value;if(n.err)throw new tc(`Raw transaction ${o} failed (${JSON.stringify(n)})`);return o}catch(t){if("TimeoutError"===t.name)continue;throw t}throw Error("Transaction failed to confirm in 60s")}
1class tc extends Error{constructor(t){super(t)}}function tu(){return null===tl?to.local():tl}let tl=null;var td="u">typeof globalThis?globalThis:"u">typeof window?window:void 0!==r.g?r.g:"u">typeof self?self:{},th={};Object.defineProperty(th,"__esModule",{value:!0});var t_=th.ANCHOR_ERROR__REQUIRE_EQ_VIOLATED=t7=th.ANCHOR_ERROR__REQUIRE_VIOLATED=t9=th.ANCHOR_ERROR__CONSTRAINT_MINT_TRANSFER_HOOK_EXTENSION_PROGRAM_ID=t5=th.ANCHOR_ERROR__CONSTRAINT_MINT_TRANSFER_HOOK_EXTENSION_AUTHORITY=t4=th.ANCHOR_ERROR__CONSTRAINT_MINT_TRANSFER_HOOK_EXTENSION=t6=th.ANCHOR_ERROR__CONSTRAINT_MINT_PERMANENT_DELEGATE_EXTENSION_DELEGATE=t8=th.ANCHOR_ERROR__CONSTRAINT_MINT_PERMANENT_DELEGATE_EXTENSION=t3=th.ANCHOR_ERROR__CONSTRAINT_MINT_CLOSE_AUTHORITY_EXTENSION_AUTHORITY=t2=th.ANCHOR_ERROR__CONSTRAINT_MINT_CLOSE_AUTHORITY_EXTENSION=t1=th.ANCHOR_ERROR__CONSTRAINT_MINT_METADATA_POINTER_EXTENSION_METADATA_ADDRESS=t0=th.ANCHOR_ERROR__CONSTRAINT_MINT_METADATA_POINTER_EXTENSION_AUTHORITY=tJ=th.ANCHOR_ERROR__CONSTRAINT_MINT_METADATA_POINTER_EXTENSION=tZ=th.ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_MEMBER_POINTER_EXTENSION_MEMBER_ADDRESS=tQ=th.ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_MEMBER_POINTER_EXTENSION_AUTHORITY=tW=th.ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_MEMBER_POINTER_EXTENSION=tq=th.ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_POINTER_EXTENSION_GROUP_ADDRESS=tY=th.ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_POINTER_EXTENSION_AUTHORITY=tX=th.ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_POINTER_EXTENSION=tz=th.ANCHOR_ERROR__CONSTRAINT_ASSOCIATED_TOKEN_TOKEN_PROGRAM=tF=th.ANCHOR_ERROR__CONSTRAINT_MINT_TOKEN_PROGRAM=tj=th.ANCHOR_ERROR__CONSTRAINT_TOKEN_TOKEN_PROGRAM=tV=th.ANCHOR_ERROR__CONSTRAINT_ACCOUNT_IS_NONE=t$=th.ANCHOR_ERROR__CONSTRAINT_SPACE=tK=th.ANCHOR_ERROR__CONSTRAINT_MINT_DECIMALS=tG=th.ANCHOR_ERROR__CONSTRAINT_MINT_FREEZE_AUTHORITY=tB=th.ANCHOR_ERROR__CONSTRAINT_MINT_MINT_AUTHORITY=tk=th.ANCHOR_ERROR__CONSTRAINT_TOKEN_OWNER=tM=th.ANCHOR_ERROR__CONSTRAINT_TOKEN_MINT=tU=th.ANCHOR_ERROR__CONSTRAINT_ZERO=tP=th.ANCHOR_ERROR__CONSTRAINT_ADDRESS=tx=th.ANCHOR_ERROR__CONSTRAINT_CLOSE=tH=th.ANCHOR_ERROR__CONSTRAINT_ASSOCIATED_INIT=tL=th.ANCHOR_ERROR__CONSTRAINT_ASSOCIATED=tD=th.ANCHOR_ERROR__CONSTRAINT_STATE=tb=th.ANCHOR_ERROR__CONSTRAINT_EXECUTABLE=tS=th.ANCHOR_ERROR__CONSTRAINT_SEEDS=tC=th.ANCHOR_ERROR__CONSTRAINT_RENT_EXEMPT=tw=th.ANCHOR_ERROR__CONSTRAINT_OWNER=tv=th.ANCHOR_ERROR__CONSTRAINT_RAW=tI=th.ANCHOR_ERROR__CONSTRAINT_SIGNER=tg=th.ANCHOR_ERROR__CONSTRAINT_HAS_ONE=tT=th.ANCHOR_ERROR__CONSTRAINT_MUT=tN=th.ANCHOR_ERROR__EVENT_INSTRUCTION_STUB=tm=th.ANCHOR_ERROR__IDL_ACCOUNT_NOT_EMPTY=tA=th.ANCHOR_ERROR__IDL_INSTRUCTION_INVALID_PROGRAM=tO=th.ANCHOR_ERROR__IDL_INSTRUCTION_STUB=tE=th.ANCHOR_ERROR__INSTRUCTION_DID_NOT_SERIALIZE=ty=th.ANCHOR_ERROR__INSTRUCTION_DID_NOT_DESERIALIZE=tR=th.ANCHOR_ERROR__INSTRUCTION_FALLBACK_NOT_FOUND=tf=th.ANCHOR_ERROR__INSTRUCTION_MISSING=void 0,tp=th.ANCHOR_ERROR__DEPRECATED=eI=th.ANCHOR_ERROR__INVALID_NUMERIC_CONVERSION=eg=th.ANCHOR_ERROR__TRYING_TO_INIT_PAYER_AS_PROGRAM_ACCOUNT=eT=th.ANCHOR_ERROR__DECLARED_PROGRAM_ID_MISMATCH=eN=th.ANCHOR_ERROR__ACCOUNT_DUPLICATE_REALLOCS=em=th.ANCHOR_ERROR__ACCOUNT_REALLOC_EXCEEDS_LIMIT=eA=th.ANCHOR_ERROR__ACCOUNT_SYSVAR_MISMATCH=eO=th.ANCHOR_ERROR__ACCOUNT_NOT_ASSOCIATED_TOKEN_ACCOUNT=eE=th.ANCHOR_ERROR__ACCOUNT_NOT_PROGRAM_DATA=ey=th.ANCHOR_ERROR__ACCOUNT_NOT_INITIALIZED=eR=th.ANCHOR_ERROR__ACCOUNT_NOT_SYSTEM_OWNED=ef=th.ANCHOR_ERROR__ACCOUNT_NOT_SIGNER=ep=th.ANCHOR_ERROR__INVALID_PROGRAM_EXECUTABLE=e_=th.ANCHOR_ERROR__INVALID_PROGRAM_ID=eh=th.ANCHOR_ERROR__ACCOUNT_OWNED_BY_WRONG_PROGRAM=ed=th.ANCHOR_ERROR__ACCOUNT_NOT_MUTABLE=el=th.ANCHOR_ERROR__ACCOUNT_NOT_ENOUGH_KEYS=eu=th.ANCHOR_ERROR__ACCOUNT_DID_NOT_SERIALIZE=ec=th.ANCHOR_ERROR__ACCOUNT_DID_NOT_DESERIALIZE=ea=th.ANCHOR_ERROR__ACCOUNT_DISCRIMINATOR_MISMATCH=es=th.ANCHOR_ERROR__ACCOUNT_DISCRIMINATOR_NOT_FOUND=eo=th.ANCHOR_ERROR__ACCOUNT_DISCRIMINATOR_ALREADY_SET=ei=th.ANCHOR_ERROR__REQUIRE_GTE_VIOLATED=en=th.ANCHOR_ERROR__REQUIRE_GT_VIOLATED=er=th.ANCHOR_ERROR__REQUIRE_KEYS_NEQ_VIOLATED=ee=th.ANCHOR_ERROR__REQUIRE_NEQ_VIOLATED=et=th.ANCHOR_ERROR__REQUIRE_KEYS_EQ_VIOLATED=void 0,tf=th.ANCHOR_ERROR__INSTRUCTION_MISSING=100,tR=th.ANCHOR_ERROR__INSTRUCTION_FALLBACK_NOT_FOUND=101,t
1y=th.ANCHOR_ERROR__INSTRUCTION_DID_NOT_DESERIALIZE=102,tE=th.ANCHOR_ERROR__INSTRUCTION_DID_NOT_SERIALIZE=103,tO=th.ANCHOR_ERROR__IDL_INSTRUCTION_STUB=1e3,tA=th.ANCHOR_ERROR__IDL_INSTRUCTION_INVALID_PROGRAM=1001,tm=th.ANCHOR_ERROR__IDL_ACCOUNT_NOT_EMPTY=1002,tN=th.ANCHOR_ERROR__EVENT_INSTRUCTION_STUB=1500,tT=th.ANCHOR_ERROR__CONSTRAINT_MUT=2e3,tg=th.ANCHOR_ERROR__CONSTRAINT_HAS_ONE=2001,tI=th.ANCHOR_ERROR__CONSTRAINT_SIGNER=2002,tv=th.ANCHOR_ERROR__CONSTRAINT_RAW=2003,tw=th.ANCHOR_ERROR__CONSTRAINT_OWNER=2004,tC=th.ANCHOR_ERROR__CONSTRAINT_RENT_EXEMPT=2005,tS=th.ANCHOR_ERROR__CONSTRAINT_SEEDS=2006,tb=th.ANCHOR_ERROR__CONSTRAINT_EXECUTABLE=2007,tD=th.ANCHOR_ERROR__CONSTRAINT_STATE=2008,tL=th.ANCHOR_ERROR__CONSTRAINT_ASSOCIATED=2009,tH=th.ANCHOR_ERROR__CONSTRAINT_ASSOCIATED_INIT=2010,tx=th.ANCHOR_ERROR__CONSTRAINT_CLOSE=2011,tP=th.ANCHOR_ERROR__CONSTRAINT_ADDRESS=2012,tU=th.ANCHOR_ERROR__CONSTRAINT_ZERO=2013,tM=th.ANCHOR_ERROR__CONSTRAINT_TOKEN_MINT=2014,tk=th.ANCHOR_ERROR__CONSTRAINT_TOKEN_OWNER=2015,tB=th.ANCHOR_ERROR__CONSTRAINT_MINT_MINT_AUTHORITY=2016,tG=th.ANCHOR_ERROR__CONSTRAINT_MINT_FREEZE_AUTHORITY=2017,tK=th.ANCHOR_ERROR__CONSTRAINT_MINT_DECIMALS=2018,t$=th.ANCHOR_ERROR__CONSTRAINT_SPACE=2019,tV=th.ANCHOR_ERROR__CONSTRAINT_ACCOUNT_IS_NONE=2020,tj=th.ANCHOR_ERROR__CONSTRAINT_TOKEN_TOKEN_PROGRAM=2021,tF=th.ANCHOR_ERROR__CONSTRAINT_MINT_TOKEN_PROGRAM=2022,tz=th.ANCHOR_ERROR__CONSTRAINT_ASSOCIATED_TOKEN_TOKEN_PROGRAM=2023,tX=th.ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_POINTER_EXTENSION=2024,tY=th.ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_POINTER_EXTENSION_AUTHORITY=2025,tq=th.ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_POINTER_EXTENSION_GROUP_ADDRESS=2026,tW=th.ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_MEMBER_POINTER_EXTENSION=2027,tQ=th.ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_MEMBER_POINTER_EXTENSION_AUTHORITY=2028,tZ=th.ANCHOR_ERROR__CONSTRAINT_MINT_GROUP_MEMBER_POINTER_EXTENSION_MEMBER_ADDRESS=2029,tJ=th.ANCHOR_ERROR__CONSTRAINT_MINT_METADATA_POINTER_EXTENSION=2030,t0=th.ANCHOR_ERROR__CONSTRAINT_MINT_METADATA_POINTER_EXTENSION_AUTHORITY=2031,t1=th.ANCHOR_ERROR__CONSTRAINT_MINT_METADATA_POINTER_EXTENSION_METADATA_ADDRESS=2032,t2=th.ANCHOR_ERROR__CONSTRAINT_MINT_CLOSE_AUTHORITY_EXTENSION=2033,t3=th.ANCHOR_ERROR__CONSTRAINT_MINT_CLOSE_AUTHORITY_EXTENSION_AUTHORITY=2034,t8=th.ANCHOR_ERROR__CONSTRAINT_MINT_PERMANENT_DELEGATE_EXTENSION=2035,t6=th.ANCHOR_ERROR__CONSTRAINT_MINT_PERMANENT_DELEGATE_EXTENSION_DELEGATE=2036,t4=th.ANCHOR_ERROR__CONSTRAINT_MINT_TRANSFER_HOOK_EXTENSION=2037,t5=th.ANCHOR_ERROR__CONSTRAINT_MINT_TRANSFER_HOOK_EXTENSION_AUTHORITY=2038,t9=th.ANCHOR_ERROR__CONSTRAINT_MINT_TRANSFER_HOOK_EXTENSION_PROGRAM_ID=2039,t7=th.ANCHOR_ERROR__REQUIRE_VIOLATED=2500;t_=th.ANCHOR_ERROR__REQUIRE_EQ_VIOLATED=2501;var et=th.ANCHOR_ERROR__REQUIRE_KEYS_EQ_VIOLATED=2502,ee=th.ANCHOR_ERROR__REQUIRE_NEQ_VIOLATED=2503,er=th.ANCHOR_ERROR__REQUIRE_KEYS_NEQ_VIOLATED=2504,en=th.ANCHOR_ERROR__REQUIRE_GT_VIOLATED=2505,ei=th.ANCHOR_ERROR__REQUIRE_GTE_VIOLATED=2506,eo=th.ANCHOR_ERROR__ACCOUNT_DISCRIMINATOR_ALREADY_SET=3e3,es=th.ANCHOR_ERROR__ACCOUNT_DISCRIMINATOR_NOT_FOUND=3001,ea=th.ANCHOR_ERROR__ACCOUNT_DISCRIMINATOR_MISMATCH=3002,ec=th.ANCHOR_ERROR__ACCOUNT_DID_NOT_DESERIALIZE=3003,eu=th.ANCHOR_ERROR__ACCOUNT_DID_NOT_SERIALIZE=3004,el=th.ANCHOR_ERROR__ACCOUNT_NOT_ENOUGH_KEYS=3005,ed=th.ANCHOR_ERROR__ACCOUNT_NOT_MUTABLE=3006,eh=th.ANCHOR_ERROR__ACCOUNT_OWNED_BY_WRONG_PROGRAM=3007,e_=th.ANCHOR_ERROR__INVALID_PROGRAM_ID=3008,ep=th.ANCHOR_ERROR__INVALID_PROGRAM_EXECUTABLE=3009,ef=th.ANCHOR_ERROR__ACCOUNT_NOT_SIGNER=3010,eR=th.ANCHOR_ERROR__ACCOUNT_NOT_SYSTEM_OWNED=3011,ey=th.ANCHOR_ERROR__ACCOUNT_NOT_INITIALIZED=3012,eE=th.ANCHOR_ERROR__ACCOUNT_NOT_PROGRAM_DATA=3013,eO=th.ANCHOR_ERROR__ACCOUNT_NOT_ASSOCIATED_TOKEN_ACCOUNT=3014,eA=th.ANCHOR_ERROR__ACCOUNT_SYSVAR_MISMATCH=3015,em=th.ANCHOR_ERROR__ACCOUNT_REALLOC_EXCEEDS_LIMIT=3016,eN=th.ANCHOR_ERROR__ACCOUNT_DUPLICATE_REALLOCS=3017,eT=th.ANCHOR_ERROR__DECLARED_PROGRAM_ID_MISMATCH=4100,eg=th.ANCHOR_ERROR__TRYING_TO_INIT_PAYER_AS_PROGRAM_ACCOUNT=4101,eI=th.ANCHOR_ERROR__INVALID_NUMERIC_CONVERSION=4102;tp=th.ANCHOR_ERROR__DEPRECATED=5e3;let ev=new Map;function ew(t){return void 0!==ev.get(t)}
1class eC extends Error{constructor(t){super(t),this.name="IdlError"}}class eS{constructor(t){this.stack=t}static parse(t){var e;let r=/^Program (\w*) invoke/,n=/^Program \w* success/,i=[];for(let o=0;o<t.length;o++){if(n.exec(t[o])){i.pop();continue}let s=null==(e=r.exec(t[o]))?void 0:e[1];s&&i.push(new f.PublicKey(s))}return new eS(i)}}class eb extends Error{constructor(t,e,r,n,i,o){super(r.join("\n").replace("Program log: ","")),this.errorLogs=r,this.logs=n,this.error={errorCode:t,errorMessage:e,comparedValues:o,origin:i},this._programErrorStack=eS.parse(n)}static parse(t){let e;if(!t)return null;let r=t.findIndex(t=>t.startsWith("Program log: AnchorError"));if(-1===r)return null;let n=t[r],i=[n];if(r+1<t.length){if("Program log: Left:"===t[r+1]){let n=/^Program log: (.*)$/,o=n.exec(t[r+2])[1],s=n.exec(t[r+4])[1];e=[new f.PublicKey(o),new f.PublicKey(s)],i.push(...t.slice(r+1,r+5))}else if(t[r+1].startsWith("Program log: Left:")){let n=/^Program log: (Left|Right): (.*)$/,o=n.exec(t[r+1])[2],s=n.exec(t[r+2])[2];i.push(...t.slice(r+1,r+3)),e=[o,s]}}let o=/^Program log: AnchorError occurred\. Error Code: (.*)\. Error Number: (\d*)\. Error Message: (.*)\./.exec(n),s=/^Program log: AnchorError thrown in (.*):(\d*)\. Error Code: (.*)\. Error Number: (\d*)\. Error Message: (.*)\./.exec(n),a=/^Program log: AnchorError caused by account: (.*)\. Error Code: (.*)\. Error Number: (\d*)\. Error Message: (.*)\./.exec(n);if(o){let[r,n,s]=o.slice(1,4);return new eb({code:r,number:parseInt(n)},s,i,t,void 0,e)}if(s){let[r,n,o,a,c]=s.slice(1,6);return new eb({code:o,number:parseInt(a)},c,i,t,{file:r,line:parseInt(n)},e)}if(!a)return null;{let[r,n,o,s]=a.slice(1,5);return new eb({code:n,number:parseInt(o)},s,i,t,r,e)}}get program(){return this._programErrorStack.stack[this._programErrorStack.stack.length-1]}get programErrorStack(){return this._programErrorStack.stack}toString(){return this.message}}class eD extends Error{constructor(t,e,r){super(),this.code=t,this.msg=e,this.logs=r,r&&(this._programErrorStack=eS.parse(r))}static parse(t,e){let r,n,i=t.toString();if(i.includes("custom program error:")){let t=i.split("custom program error: ");if(2!==t.length)return null;r=t[1]}else{let t=i.match(/"Custom":([0-9]+)}/g);if(!t||t.length>1)return null;r=t[0].match(/([0-9]+)/g)[0]}try{n=parseInt(r)}catch(t){return null}let o=e.get(n);return void 0!==o||void 0!==(o=eH.get(n))?new eD(n,o,t.logs):null}get program(){var t;return null==(t=this._programErrorStack)?void 0:t.stack[this._programErrorStack.stack.length-1]}get programErrorStack(){var t;return null==(t=this._programErrorStack)?void 0:t.stack}toString(){return this.msg}}function eL(t,e){ew("debug-logs")&&console.log("Translating error:",t);let r=eb.parse(t.logs);if(r)return r;let n=eD.parse(t,e);return n||(t.logs?(t.programErrorStack=eS.parse(t.logs),new Proxy(t,{get:function(e,r){return"programErrorStack"===r?e.programErrorStack.stack:"program"===r?e.programErrorStack.stack[t.programErrorStack.stack.length-1]:Reflect.get(...arguments)}})):t)}let eH=new Map([[tf,"Instruction discriminator not provided"],[tR,"Fallback functions are not supported"],[ty,"The program could not deserialize the given instruction"],[tE,"The program could not serialize the given instruction"],[tO,"The program was compiled without idl instructions"],[tA,"The transaction was given an invalid program for the IDL instruction"],[tm,"IDL account must be empty in order to resize, try closing first"],[tN,"The program was compiled without `event-cpi` feature"],[tT,"A mut constraint was violated"],[tg,"A has one constraint was violated"],[tI,"A signer constraint was violated"],[tv,"A raw constraint was violated"],[tw,"An owner constraint was violated"],[tC,"A rent exemption constraint was violated"],[tS,"A seeds constraint was violated"],[tb,"An executable constraint was violated"],[tD,"Deprecated Error, feel free to replace with something else"],[tL,"An associated constraint was violated"],[tH,"An associated init constraint was violated"],[tx,"A close constraint was violated"],[tP,"An address constraint was violated"],[tU,"Expected zero account discriminant"],[tM,"A token mint constraint was violated"],[tk,"A token owner constraint was violated"],[tB,"A mint mint authority constraint was violated"],[tG,"A mint freeze authority constraint was violated"],[tK,"A mint decimals constraint was violated"],[t$,"A space constraint was violated"],[tV,"A required account for the constraint is None"],[t
1j,"A token account token program constraint was violated"],[tF,"A mint token program constraint was violated"],[tz,"An associated token account token program constraint was violated"],[tX,"A group pointer extension constraint was violated"],[tY,"A group pointer extension authority constraint was violated"],[tq,"A group pointer extension group address constraint was violated"],[tW,"A group member pointer extension constraint was violated"],[tQ,"A group member pointer extension authority constraint was violated"],[tZ,"A group member pointer extension group address constraint was violated"],[tJ,"A metadata pointer extension constraint was violated"],[t0,"A metadata pointer extension authority constraint was violated"],[t1,"A metadata pointer extension metadata address constraint was violated"],[t2,"A close authority constraint was violated"],[t3,"A close authority extension authority constraint was violated"],[t8,"A permanent delegate extension constraint was violated"],[t6,"A permanent delegate extension delegate constraint was violated"],[t4,"A transfer hook extension constraint was violated"],[t5,"A transfer hook extension authority constraint was violated"],[t9,"A transfer hook extension transfer hook program id constraint was violated"],[t7,"A require expression was violated"],[t_,"A require_eq expression was violated"],[et,"A require_keys_eq expression was violated"],[ee,"A require_neq expression was violated"],[er,"A require_keys_neq expression was violated"],[en,"A require_gt expression was violated"],[ei,"A require_gte expression was violated"],[eo,"The account discriminator was already set on this account"],[es,"No discriminator was found on the account"],[ea,"Account discriminator did not match what was expected"],[ec,"Failed to deserialize the account"],[eu,"Failed to serialize the account"],[el,"Not enough account keys given to the instruction"],[ed,"The given account is not mutable"],[eh,"The given account is owned by a different program than expected"],[e_,"Program ID was not as expected"],[ep,"Program account is not executable"],[ef,"The given account did not sign"],[eR,"The given account is not owned by the system program"],[ey,"The program expected this account to be already initialized"],[eE,"The given account is not a program data account"],[eO,"The given account is not the associated token account"],[eA,"The given public key does not match the required sysvar"],[em,"The account reallocation exceeds the MAX_PERMITTED_DATA_INCREASE limit"],[eN,"The account was duplicated for more than one reallocation"],[eT,"The declared program id does not match the actual program id"],[eg,"You cannot/should not initialize the payer account as a program account"],[eI,"The program could not perform the numeric conversion, out of range integral type conversion attempted"],[tp,"The API being used is deprecated and should no longer be used"]]);class ex{static fieldLayout(t,e=[],r){let n=t.name;switch(t.type){case"bool":return m.bool(n);case"u8":return m.u8(n);case"i8":return m.i8(n);case"u16":return m.u16(n);case"i16":return m.i16(n);case"u32":return m.u32(n);case"i32":return m.i32(n);case"f32":return m.f32(n);case"u64":return m.u64(n);case"i64":return m.i64(n);case"f64":return m.f64(n);case"u128":return m.u128(n);case"i128":return m.i128(n);case"u256":return m.u256(n);case"i256":return m.i256(n);case"bytes":return m.vecU8(n);case"string":return m.str(n);case"pubkey":return m.publicKey(n);default:if("option"in t.type)return m.option(ex.fieldLayout({type:t.type.option},e,r),n);if("vec"in t.type)return m.vec(ex.fieldLayout({type:t.type.vec},e,r),n);if("array"in t.type){let[i,o]=t.type.array;return o=ex.resolveArrayLen(o,r),m.array(ex.fieldLayout({type:i},e,r),o,n)}if("defined"in t.type){if(!e)throw new eC("User defined types not provided");let i=t.type.defined.name,o=e.find(t=>t.name===i);if(!o)throw new eC(`Type not found: ${t.name}`);return ex.typeDefLayout({typeDef:o,types:e,genericArgs:null!=r?r:t.type.defined.generics,name:n})}if("generic"in t.type){let n=null==r?void 0:r.at(0);if((null==n?void 0:n.kind)!=="type")throw new eC(`Invalid generic field: ${t.name}`);return ex.fieldLayout({...t,type:n.type},e)}throw new eC(`Not yet implemented: ${JSON.stringify(t.type)}`)}}static typeDefLayout({typeDef:t,types:e,name:r,genericArgs:n}){switch(t.type.kind){case"struct":{let i=H(t.type.fields,()=>[],r=>r.map(r=>{let i=n?ex.resolveGenericArgs({type:r.type,typeDef:t,genericArgs:n}):n;return ex.fieldLayout(r,e,i)}),r=>r.map((r,i)=>{let o=n?ex.resolveGenericArgs({type:r,typeDef:t,genericArgs:n}):n;return ex.fieldLayout({name:i.toString(),type:r},e,o)}));return m.struct(i,r)}case"enum":{let i=t.type.variants.map(r=>{let i=H(r.fields,()=>[],r=>r.map(r=>{let i=n?ex.resolveGenericArgs({type:r.type,typeDef:t,genericArgs:n}):n;return ex.fieldLayout(r,e,i)}),r=>r.map((r,i)=>{let o=n?ex.resolveGenericArgs({type:r,typeDef:t,genericArgs:n}):n;return ex.fieldLayout({name:i.toString(),type:r},e,o)}));return m.struct(i,r.name)});if(void 0!==r)return m.rustEnum(i).replicate(r);return m.rustEnum(i,r)}case"type":return ex.fieldLayout({type:t.type.alias,name:r},e)}}static typeSize(t,e,r){var n;switch(t){case"bool":case"u8":case"i8":case"bytes":case"string":return 1;case"i16":case"u16":return 2;case"u32":case"i32":case"f32":return 4;case"u64":case"i64":case"f64":return 8;case"u128":case"i128":return 16;case"u256":case"i256":case"pubkey":return 32;default:if("option"in t)return 1+ex.typeSize(t.option,e,r);if("coption"in t)return 4+ex.typeSize(t.coption,e,r);if("vec"in t)return 1;if("array"in t){let[n,i]=t.array;
1return i=ex.resolveArrayLen(i,r),ex.typeSize(n,e,r)*i}if("defined"in t){let i=null==(n=e.types)?void 0:n.find(e=>e.name===t.defined.name);if(!i)throw new eC(`Type not found: ${JSON.stringify(t)}`);let o=n=>{let o=null!=r?r:t.defined.generics,s=o?ex.resolveGenericArgs({type:n,typeDef:i,genericArgs:o}):o;return ex.typeSize(n,e,s)};switch(i.type.kind){case"struct":return H(i.type.fields,()=>[0],t=>t.map(t=>o(t.type)),t=>t.map(t=>o(t))).reduce((t,e)=>t+e,0);case"enum":return Math.max(...i.type.variants.map(t=>H(t.fields,()=>[0],t=>t.map(t=>o(t.type)),t=>t.map(t=>o(t))).reduce((t,e)=>t+e,0)))+1;case"type":return ex.typeSize(i.type.alias,e,r)}}if("generic"in t){let n=null==r?void 0:r.at(0);if((null==n?void 0:n.kind)!=="type")throw new eC(`Invalid generic: ${t.generic}`);return ex.typeSize(n.type,e,r)}throw Error(`Invalid type ${JSON.stringify(t)}`)}}static resolveArrayLen(t,e){if("number"==typeof t)return t;if(e){let r=e.find(t=>"const"===t.kind);(null==r?void 0:r.kind)==="const"&&(t=+r.value)}if("number"!=typeof t)throw new eC("Generic array length did not resolve");return t}static resolveGenericArgs({type:t,typeDef:e,genericArgs:r,isDefined:n}){if("object"!=typeof t)return null;for(let i in e.generics){let o=e.generics[i];if("generic"in t&&o.name===t.generic)return[r[i]];if("option"in t){let i=ex.resolveGenericArgs({type:t.option,typeDef:e,genericArgs:r,isDefined:n});if(!i||!n)return i;if("type"===i[0].kind)return[{kind:"type",type:{option:i[0].type}}]}if("vec"in t){let i=ex.resolveGenericArgs({type:t.vec,typeDef:e,genericArgs:r,isDefined:n});if(!i||!n)return i;if("type"===i[0].kind)return[{kind:"type",type:{vec:i[0].type}}]}if("array"in t){let[s,a]=t.array,c="object"==typeof a,u=ex.resolveGenericArgs({type:s,typeDef:e,genericArgs:r,isDefined:n})||[];if(c){let t=e.generics.findIndex(t=>t.name===a.generic);-1!==t&&u.push(r[t])}if(u.length>0){if(!n)return u;if("type"===u[0].kind&&"const"===u[1].kind)return[{kind:"type",type:{array:[u[0].type,+u[1].value]}}]}if(c&&o.name===a.generic){let t=r[i];if(!n)return[t];return[{kind:"type",type:{array:[s,+t.value]}}]}break}if("defined"in t){if(!t.defined.generics)return null;return t.defined.generics.flatMap(t=>{switch(t.kind){case"type":return ex.resolveGenericArgs({type:t.type,typeDef:e,genericArgs:r,isDefined:!0});case"const":return[t]}}).filter(t=>null!==t)}}return null}}class eP{constructor(t){this.idl=t;const e=t.instructions.map(e=>{let r=e.name,n=e.args.map(e=>ex.fieldLayout(e,t.types)),i=m.struct(n,r);return[r,{discriminator:e.discriminator,layout:i}]});this.ixLayouts=new Map(e)}encode(t,e){let r=R.Buffer.alloc(1e3),n=this.ixLayouts.get(t);if(!n)throw Error(`Unknown method: ${t}`);let i=n.layout.encode(e,r),o=r.slice(0,i);return R.Buffer.concat([R.Buffer.from(n.discriminator),o])}decode(t,e="hex"){for(let[r,n]of("string"==typeof t&&(t="hex"===e?R.Buffer.from(t,"hex"):E().decode(t)),this.ixLayouts)){let e=t.subarray(0,n.discriminator.length);if(e.equals(R.Buffer.from(n.discriminator)))return{name:r,data:n.layout.decode(t.subarray(e.length))}}return null}format(t,e){return eU.format(t,e,this.idl)}}class eU{static format(t,e,r){let n=r.instructions.find(e=>t.name===e.name);if(!n)return console.error("Invalid instruction given"),null;let i=n.args.map(e=>({name:e.name,type:eU.formatIdlType(e.type),data:eU.formatIdlData(e,t.data[e.name],r.types)})),o=eU.flattenIdlAccounts(n.accounts);return{args:i,accounts:e.map((t,e)=>e<o.length?{name:o[e].name,...t}:{name:void 0,...t})}}static formatIdlType(t){if("string"==typeof t)return t;if("option"in t)return`Option<${this.formatIdlType(t.option)}>`;if("coption"in t)return`COption<${this.formatIdlType(t.coption)}>`;if("vec"in t)return`Vec<${this.formatIdlType(t.vec)}>`;if("array"in t)return`Array<${t.array[0]}; ${t.array[1]}>`;if("defined"in t){let e=t.defined.name;if(t.defined.generics){let r=t.defined.generics.map(t=>{switch(t.kind){case"type":return eU.formatIdlType(t.type);case"const":return t.value}}).join(", ");return`${e}<${r}>`}return e}throw Error(`Unknown IDL type: ${t}`)}static formatIdlData(t,e,r){if("string"==typeof t.type)return e.toString();if("vec"in t.type)return"["+e.map(e=>this.formatIdlData({name:"",type:t.type.vec},e,r)).join(", ")+"]";if("option"in t.type)return null===e?"null":this.formatIdlData({name:"",type:t.type.option},e,r);if("defined"in t.type){if(!r)throw Error("User defined types not provided");let n=t.type.defined.name,i=r.find(t=>t.name===n);if(!i)throw Error(`Type not found: ${n}`);return eU.formatIdlDataDefined(i,e,r)}return"unknown"}static formatIdlDataDefined(t,e,r){switch(t.type.kind){case"struct":return"{ "+H(t.type.fields,()=>"",t=>Object.entries(e).map(([e,n])=>{let i=t.find(t=>t.name===e);if(!i)throw Error(`Field not found: ${e}`);return e+": "+eU.formatIdlData(i,n,r)}).join(", "),t=>Object.entries(e).map(([e,n])=>e+": "+eU.formatIdlData({name:"",type:t[e]},n,r)).join(", "))+" }";case"enum":{let n=Object.keys(e)[0],i=t.type.variants.find(t=>t.name===n);if(!i)throw Error(`Unable to find variant: ${n}`);let o=e[n];
1return H(i.fields,()=>n,t=>{let e=Object.keys(o).map(e=>{let n=o[e],i=t.find(t=>t.name===e);if(!i)throw Error(`Field not found: ${e}`);return e+": "+eU.formatIdlData(i,n,r)}).join(", ");return`${n} { ${e} }`},t=>{let e=Object.entries(o).map(([e,n])=>e+": "+eU.formatIdlData({name:"",type:t[e]},n,r)).join(", ");return`${n} { ${e} }`})}case"type":return eU.formatIdlType(t.type.alias)}}static flattenIdlAccounts(t,e){return t.map(t=>{let r,n=(r=t.name.replace(/([A-Z])/g," $1")).charAt(0).toUpperCase()+r.slice(1);if(!t.hasOwnProperty("accounts"))return{...t,name:e?`${e} > ${n}`:n};{let r=e?`${e} > ${n}`:n;return eU.flattenIdlAccounts(t.accounts,r)}}).flat()}}class eM{constructor(t){if(this.idl=t,!t.accounts){this.accountLayouts=new Map;return}const e=t.types;if(!e)throw Error("Accounts require `idl.types`");const r=t.accounts.map(t=>{let r=e.find(e=>e.name===t.name);if(!r)throw Error(`Account not found: ${t.name}`);return[t.name,{discriminator:t.discriminator,layout:ex.typeDefLayout({typeDef:r,types:e})}]});this.accountLayouts=new Map(r)}async encode(t,e){let r=R.Buffer.alloc(1e3),n=this.accountLayouts.get(t);if(!n)throw Error(`Unknown account: ${t}`);let i=n.layout.encode(e,r),o=r.slice(0,i),s=this.accountDiscriminator(t);return R.Buffer.concat([s,o])}decode(t,e){let r=this.accountDiscriminator(t);if(r.compare(e.slice(0,r.length)))throw Error("Invalid account discriminator");return this.decodeUnchecked(t,e)}decodeAny(t){for(let[e,r]of this.accountLayouts)if(t.subarray(0,r.discriminator.length).equals(R.Buffer.from(r.discriminator)))return this.decodeUnchecked(e,t);throw Error("Account not found")}decodeUnchecked(t,e){let r=this.accountDiscriminator(t),n=e.subarray(r.length),i=this.accountLayouts.get(t);if(!i)throw Error(`Unknown account: ${t}`);return i.layout.decode(n)}memcmp(t,e){let r=this.accountDiscriminator(t);return{offset:0,bytes:E().encode(e?R.Buffer.concat([r,e]):r)}}size(t){return this.accountDiscriminator(t).length+ex.typeSize({defined:{name:t}},this.idl)}accountDiscriminator(t){var e;let r=null==(e=this.idl.accounts)?void 0:e.find(e=>e.name===t);if(!r)throw Error(`Account not found: ${t}`);return R.Buffer.from(r.discriminator)}}class ek{constructor(t){if(!t.events){this.layouts=new Map;return}const e=t.types;if(!e)throw Error("Events require `idl.types`");const r=t.events.map(t=>{let r=e.find(e=>e.name===t.name);if(!r)throw Error(`Event not found: ${t.name}`);return[t.name,{discriminator:t.discriminator,layout:ex.typeDefLayout({typeDef:r,types:e})}]});this.layouts=new Map(r)}decode(t){let e;try{e=S(t)}catch(t){return null}for(let[t,r]of this.layouts){let n=e.subarray(0,r.discriminator.length);if(n.equals(R.Buffer.from(r.discriminator)))return{name:t,data:r.layout.decode(e.subarray(n.length))}}return null}}class eB{constructor(t){const e=t.types;if(!e){this.typeLayouts=new Map;return}const r=e.filter(t=>!t.generics).map(t=>[t.name,ex.typeDefLayout({typeDef:t,types:e})]);this.typeLayouts=new Map(r)}encode(t,e){let r=R.Buffer.alloc(1e3),n=this.typeLayouts.get(t);if(!n)throw Error(`Unknown type: ${t}`);let i=n.encode(e,r);return r.slice(0,i)}decode(t,e){let r=this.typeLayouts.get(t);if(!r)throw Error(`Unknown type: ${t}`);return r.decode(e)}}class eG{constructor(t){this.instruction=new eP(t),this.accounts=new eM(t),this.events=new ek(t),this.types=new eB(t)}}class eK{constructor(t,e){if(!Number.isInteger(t))throw TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}decode(t,e){throw Error("Layout is abstract")}encode(t,e,r){throw Error("Layout is abstract")}getSpan(t,e){if(0>this.span)throw RangeError("indeterminate span");return this.span}replicate(t){let e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}}var e$=eK;class eV extends eK{isCount(){throw Error("ExternalLayout is abstract")}}class ej extends eV{constructor(t,e,r){if(!(t instanceof eK))throw TypeError("layout must be a Layout");if(void 0===e)e=0;else if(!Number.isInteger(e))throw TypeError("offset must be integer or undefined");super(t.span,r||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof eF||this.layout instanceof ez}decode(t,e){return void 0===e&&(e=0),this.layout.decode(t,e+this.offset)}encode(t,e,r){return void 0===r&&(r=0),this.layout.encode(t,e,r+this.offset)}}class eF extends eK{constructor(t,e){if(super(t,e),6<this.span)throw RangeError("span must not exceed 6 bytes")}decode(t,e){return void 0===e&&(e=0),t.readUIntLE(e,this.span)}encode(t,e,r){return void 0===r&&(r=0),e.writeUIntLE(t,r,this.span),this.span}}class ez extends eK{constructor(t,e){if(super(t,e),6<this.span)throw RangeError("span must not exceed 6 bytes")}decode(t,e){return void 0===e&&(e=0),t.readUIntBE(e,this.span)}encode(t,e,r){return void 0===r&&(r=0),e.writeUIntBE(t,r,this.span),this.span}}function eX(t){let e=Math.floor(t/0x100000000);return{hi32:e,lo32:t-0x100000000*e}}function eY(t,e){return 0x100000000*t+e}class eq extends eK{constructor(t){super(8,t)}decode(t,e){void 0===e&&(e=0);let r=t.readUInt32LE(e);return eY(t.readUInt32LE(e+4),r)}encode(t,e,r){void 0===r&&(r=0);let n=eX(t);return e.writeUInt32LE(n.lo32,r),e.writeUInt32LE(n.hi32,r+4),8}}class eW extends eK{constructor(t){super(8,t)}decode(t,e){void 0===e&&(e=0);let r=t.readUInt32LE(e);return eY(t.readInt32LE(e+4),r)}encode(t,e,r){void 0===r&&(r=0);let n=eX(t);return e.writeUInt32LE(n.lo32,r),e.writeInt32LE(n.hi32,r+4),8}}class eQ extends eK{constructor(t,e,r){if(!(Array.isArray(t)&&t.reduce((t,e)=>t&&e instanceof eK,!0)))throw TypeError("fields must be array of Layout instances");for(const n of("boolean"==typeof e&&void 0===r&&(r=e,e=void 0),t))if(0>
1n.span&&void 0===n.property)throw Error("fields cannot contain unnamed variable-length layout");let n=-1;try{n=t.reduce((t,e)=>t+e.getSpan(),0)}catch(t){}super(n,e),this.fields=t,this.decodePrefixes=!!r}getSpan(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);let r=0;try{r=this.fields.reduce((r,n)=>{let i=n.getSpan(t,e);return e+=i,r+i},0)}catch(t){throw RangeError("indeterminate span")}return r}decode(t,e){void 0===e&&(e=0);let r=this.makeDestinationObject();for(let n of this.fields)if(void 0!==n.property&&(r[n.property]=n.decode(t,e)),e+=n.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return r}encode(t,e,r){void 0===r&&(r=0);let n=r,i=0,o=0;for(let n of this.fields){let s=n.span;if(o=0<s?s:0,void 0!==n.property){let i=t[n.property];void 0!==i&&(o=n.encode(i,e,r),0>s&&(s=n.getSpan(e,r)))}i=r,r+=s}return i+o-n}fromArray(t){let e=this.makeDestinationObject();for(let r of this.fields)void 0!==r.property&&0<t.length&&(e[r.property]=t.shift());return e}layoutFor(t){if("string"!=typeof t)throw TypeError("property must be string");for(let e of this.fields)if(e.property===t)return e}offsetOf(t){if("string"!=typeof t)throw TypeError("property must be string");let e=0;for(let r of this.fields){if(r.property===t)return e;0>r.span?e=-1:0<=e&&(e+=r.span)}}}class eZ{constructor(t){this.property=t}decode(){throw Error("UnionDiscriminator is abstract")}encode(){throw Error("UnionDiscriminator is abstract")}}class eJ extends eZ{constructor(t,e){if(!(t instanceof eV&&t.isCount()))throw TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,r){return this.layout.encode(t,e,r)}}class e0 extends eK{constructor(t,e,r){const n=t instanceof eF||t instanceof ez;if(n)t=new eJ(new ej(t));else if(t instanceof eV&&t.isCount())t=new eJ(t);else if(!(t instanceof eZ))throw TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(void 0===e&&(e=null),!(null===e||e instanceof eK))throw TypeError("defaultLayout must be null or a Layout");if(null!==e){if(0>e.span)throw Error("defaultLayout must have constant span");void 0===e.property&&(e=e.replicate("content"))}let i=-1;e&&0<=(i=e.span)&&n&&(i+=t.layout.span),super(i,r),this.discriminator=t,this.usesPrefixDiscriminator=n,this.defaultLayout=e,this.registry={};let o=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(t){return o(t)},this.configGetSourceVariant=function(t){o=t.bind(this)}}getSpan(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);let r=this.getVariant(t,e);if(!r)throw Error("unable to determine span for unrecognized variant");return r.getSpan(t,e)}defaultGetSourceVariant(t){if(t.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&t.hasOwnProperty(this.defaultLayout.property))return;let e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||t.hasOwnProperty(e.property)))return e}else for(let e in this.registry){let r=this.registry[e];if(t.hasOwnProperty(r.property))return r}throw Error("unable to infer src variant")}decode(t,e){let r;void 0===e&&(e=0);let n=this.discriminator,i=n.decode(t,e),o=this.registry[i];if(void 0===o){let s=0;o=this.defaultLayout,this.usesPrefixDiscriminator&&(s=n.layout.span),(r=this.makeDestinationObject())[n.property]=i,r[o.property]=this.defaultLayout.decode(t,e+s)}else r=o.decode(t,e);return r}encode(t,e,r){void 0===r&&(r=0);let n=this.getSourceVariant(t);if(void 0===n){let n=this.discriminator,i=this.defaultLayout,o=0;return this.usesPrefixDiscriminator&&(o=n.layout.span),n.encode(t[n.property],e,r),o+i.encode(t[i.property],e,r+o)}return n.encode(t,e,r)}addVariant(t,e,r){let n=new e1(this,t,e,r);return this.registry[t]=n,n}getVariant(t,e){let r=t;return I.isBuffer(t)&&(void 0===e&&(e=0),r=this.discriminator.decode(t,e)),this.registry[r]}}class e1 extends eK{constructor(t,e,r,n){if(!(t instanceof e0))throw TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw TypeError("variant must be a (non-negative) integer");if("string"==typeof r&&void 0===n&&(n=r,r=null),r){if(!(r instanceof eK))throw TypeError("layout must be a Layout");
1if(null!==t.defaultLayout&&0<=r.span&&r.span>t.defaultLayout.span)throw Error("variant span exceeds span of containing union");if("string"!=typeof n)throw TypeError("variant must have a String property")}let i=t.span;0>t.span&&0<=(i=r?r.span:0)&&t.usesPrefixDiscriminator&&(i+=t.discriminator.layout.span),super(i,n),this.union=t,this.variant=e,this.layout=r||null}getSpan(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);let r=0;return this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),r+this.layout.getSpan(t,e+r)}decode(t,e){let r=this.makeDestinationObject();if(void 0===e&&(e=0),this!==this.union.getVariant(t,e))throw Error("variant mismatch");let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),this.layout?r[this.property]=this.layout.decode(t,e+n):this.property?r[this.property]=!0:this.union.usesPrefixDiscriminator&&(r[this.union.discriminator.property]=this.variant),r}encode(t,e,r){void 0===r&&(r=0);let n=0;if(this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),this.layout&&!t.hasOwnProperty(this.property))throw TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,r);let i=n;if(this.layout&&(this.layout.encode(t[this.property],e,r+n),i+=this.layout.getSpan(e,r+n),0<=this.union.span&&i>this.union.span))throw Error("encoded variant overruns containing union");return i}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}class e2 extends eK{constructor(t,e){if(!(t instanceof eV&&t.isCount()||Number.isInteger(t)&&0<=t))throw TypeError("length must be positive integer or an unsigned integer ExternalLayout");let r=-1;t instanceof eV||(r=t),super(r,e),this.length=t}getSpan(t,e){let r=this.span;return 0>r&&(r=this.length.decode(t,e)),r}decode(t,e){void 0===e&&(e=0);let r=this.span;return 0>r&&(r=this.length.decode(t,e)),t.slice(e,e+r)}encode(t,e,r){let n=this.length;if(this.length instanceof eV&&(n=t.length),!(I.isBuffer(t)&&n===t.length)){var i;throw TypeError((i="Blob.encode",(this.property?i+"["+this.property+"]":i)+" requires (length "+n+") Buffer as src"))}if(r+n>e.length)throw RangeError("encoding overruns Buffer");return e.write(t.toString("hex"),r,n,"hex"),this.length instanceof eV&&this.length.encode(n,e,r),n}}var e3=t=>new eF(4,t),e8=t=>new eW(t),e6=(t,e,r)=>new eQ(t,e,r),e4=(t,e,r)=>new e0(t,e,r),e5=(t,e)=>new e2(t,e);class e9 extends e${constructor(t){super(-1,t),this.property=t,this.layout=e6([e3("length"),e3("lengthPadding"),e5(((t,e,r)=>new ej(t,e,r))(e3(),-8),"chars")],this.property)}encode(t,e,r=0){if(null==t)return this.layout.span;let n={chars:I.from(t,"utf8")};return this.layout.encode(n,e,r)}decode(t,e=0){return this.layout.decode(t,e).chars.toString()}getSpan(t,e=0){return e3().span+e3().span+new(p())(new Uint8Array(t).slice(e,e+4),10,"le").toNumber()}}function e7(t){return new e9(t)}function rt(t){return e5(32,t)}let re=e4(e3("instruction"));re.addVariant(0,e6([e8("lamports"),e8("space"),rt("owner")]),"createAccount"),re.addVariant(1,e6([rt("owner")]),"assign"),re.addVariant(2,e6([e8("lamports")]),"transfer"),re.addVariant(3,e6([rt("base"),e7("seed"),e8("lamports"),e8("space"),rt("owner")]),"createAccountWithSeed"),re.addVariant(4,e6([rt("authorized")]),"advanceNonceAccount"),re.addVariant(5,e6([e8("lamports")]),"withdrawNonceAccount"),re.addVariant(6,e6([rt("authorized")]),"initializeNonceAccount"),re.addVariant(7,e6([rt("authorized")]),"authorizeNonceAccount"),re.addVariant(8,e6([e8("space")]),"allocate"),re.addVariant(9,e6([rt("base"),e7("seed"),e8("space"),rt("owner")]),"allocateWithSeed"),re.addVariant(10,e6([rt("base"),e7("seed"),rt("owner")]),"assignWithSeed"),re.addVariant(11,e6([e8("lamports"),e7("seed"),rt("owner")]),"transferWithSeed"),Object.values(re.registry).map(t=>t.span);class rr extends e${constructor(t,e,r,n){super(t.span,n),this.layout=t,this.decoder=e,this.encoder=r}decode(t,e){return this.decoder(this.layout.decode(t,e))}encode(t,e,r){return this.layout.encode(this.encoder(t),e,r)}getSpan(t,e){return this.layout.getSpan(t,e)}}function rn(t){return new rr(e5(32),t=>new f.PublicKey(t),t=>t.toBuffer(),t)}e6([e3("version"),e3("state"),rn("authorizedPubkey"),rn("nonce"),e6([new eq("lamportsPerSignature")
1],"feeCalculator")]),new f.PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),new f.PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");var ri={exports:{}};c=ri.exports,u="u">typeof self?self:td,d=l=function(){function t(){this.fetch=!1,this.DOMException=u.DOMException}return t.prototype=u,new t}(),function(t){var e={searchParams:"URLSearchParams"in d,iterable:"Symbol"in d&&"iterator"in Symbol,blob:"FileReader"in d&&"Blob"in d&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in d,arrayBuffer:"ArrayBuffer"in d};if(e.arrayBuffer)var r=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],n=ArrayBuffer.isView||function(t){return t&&r.indexOf(Object.prototype.toString.call(t))>-1};function i(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw TypeError("Invalid character in header field name");return t.toLowerCase()}function o(t){return"string"!=typeof t&&(t=String(t)),t}function s(t){var r={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return e.iterable&&(r[Symbol.iterator]=function(){return r}),r}function a(t){this.map={},t instanceof a?t.forEach(function(t,e){this.append(e,t)},this):Array.isArray(t)?t.forEach(function(t){this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function c(t){if(t.bodyUsed)return Promise.reject(TypeError("Already read"));t.bodyUsed=!0}function u(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})}function l(t){var e=new FileReader,r=u(e);return e.readAsArrayBuffer(t),r}function h(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function _(){return this.bodyUsed=!1,this._initBody=function(t){if(this._bodyInit=t,t)if("string"==typeof t)this._bodyText=t;else if(e.blob&&Blob.prototype.isPrototypeOf(t))this._bodyBlob=t;else if(e.formData&&FormData.prototype.isPrototypeOf(t))this._bodyFormData=t;else if(e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t))this._bodyText=t.toString();else{var r;e.arrayBuffer&&e.blob&&(r=t)&&DataView.prototype.isPrototypeOf(r)?(this._bodyArrayBuffer=h(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):e.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||n(t))?this._bodyArrayBuffer=h(t):this._bodyText=t=Object.prototype.toString.call(t)}else this._bodyText="";!this.headers.get("content-type")&&("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},e.blob&&(this.blob=function(){var t=c(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(!this._bodyFormData)return Promise.resolve(new Blob([this._bodyText]));throw Error("could not read FormData body as blob")},this.arrayBuffer=function(){return this._bodyArrayBuffer?c(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(l)}),this.text=function(){var t,e,r,n=c(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,r=u(e=new FileReader),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(!this._bodyFormData)return Promise.resolve(this._bodyText);throw Error("could not read FormData body as text")},e.formData&&(this.formData=function(){return this.text().then(R)}),this.json=function(){return this.text().then(JSON.parse)},this}a.prototype.append=function(t,e){t=i(t),e=o(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},a.prototype.delete=function(t){delete this.map[i(t)]},a.prototype.get=function(t){return t=i(t),this.has(t)?this.map[t]:null},a.prototype.has=function(t){return this.map.hasOwnProperty(i(t))},a.prototype.set=function(t,e){this.map[i(t)]=o(e)},a.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},a.prototype.keys=function(){var t=[];return this.forEach(function(e,r){t.push(r)}),s(t)},a.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),s(t)},a.prototype.entries=function(){var t=[];return this.forEach(function(e,r){t.push([r,e])}),s(t)},e.iterable&&(a.prototype[Symbol.iterator]=a.prototype.entries);
1var p=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function f(t,e){var r,n,i=(e=e||{}).body;if(t instanceof f){if(t.bodyUsed)throw TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new a(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",(e.headers||!this.headers)&&(this.headers=new a(e.headers)),this.method=(n=(r=e.method||this.method||"GET").toUpperCase(),p.indexOf(n)>-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function R(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(i))}}),e}function y(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new a(e.headers),this.url=e.url||"",this._initBody(t)}f.prototype.clone=function(){return new f(this,{body:this._bodyInit})},_.call(f.prototype),_.call(y.prototype),y.prototype.clone=function(){return new y(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new a(this.headers),url:this.url})},y.error=function(){var t=new y(null,{status:0,statusText:""});return t.type="error",t};var E=[301,302,303,307,308];y.redirect=function(t,e){if(-1===E.indexOf(e))throw RangeError("Invalid status code");return new y(null,{status:e,headers:{location:t}})},t.DOMException=d.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function O(r,n){return new Promise(function(i,o){var s=new f(r,n);if(s.signal&&s.signal.aborted)return o(new t.DOMException("Aborted","AbortError"));var c=new XMLHttpRequest;function u(){c.abort()}c.onload=function(){var t,e,r={status:c.status,statusText:c.statusText,headers:(t=c.getAllResponseHeaders()||"",e=new a,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(t){var r=t.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();e.append(n,i)}}),e)};r.url="responseURL"in c?c.responseURL:r.headers.get("X-Request-URL"),i(new y("response"in c?c.response:c.responseText,r))},c.onerror=function(){o(TypeError("Network request failed"))},c.ontimeout=function(){o(TypeError("Network request failed"))},c.onabort=function(){o(new t.DOMException("Aborted","AbortError"))},c.open(s.method,s.url,!0),"include"===s.credentials?c.withCredentials=!0:"omit"===s.credentials&&(c.withCredentials=!1),"responseType"in c&&e.blob&&(c.responseType="blob"),s.headers.forEach(function(t,e){c.setRequestHeader(e,t)}),s.signal&&(s.signal.addEventListener("abort",u),c.onreadystatechange=function(){4===c.readyState&&s.signal.removeEventListener("abort",u)}),c.send(void 0===s._bodyInit?null:s._bodyInit)})}O.polyfill=!0,d.fetch||(d.fetch=O,d.Headers=a,d.Request=f,d.Response=y),t.Headers=a,t.Request=f,t.Response=y,t.fetch=O,Object.defineProperty(t,"__esModule",{value:!0})}({}),l.fetch.ponyfill=!0,delete l.fetch.polyfill,(c=l.fetch).default=l.fetch,c.fetch=l.fetch,c.Headers=l.Headers,c.Request=l.Request,c.Response=l.Response,ri.exports=c;(h=ri.exports)&&h.__esModule&&Object.prototype.hasOwnProperty.call(h,"default")&&h.default;m.rustEnum([m.struct([],"uninitialized"),m.struct([m.option(m.publicKey(),"authorityAddress")],"buffer"),m.struct([m.publicKey("programdataAddress")],"program"),m.struct([m.u64("slot"),m.option(m.publicKey(),"upgradeAuthorityAddress")],"programData")],void 0,m.u32());let ro="Program log: ",rs="Program data: ",ra=ro.length,rc=rs.length;class ru{constructor(t,e,r){this._programId=t,this._provider=e,this._eventParser=new rl(t,r),this._eventCallbacks=new Map,this._eventListeners=new Map,this._listenerIdCount=0}
1addEventListener(t,e,r){var n;let i=this._listenerIdCount;return this._listenerIdCount+=1,this._eventListeners.has(t)||this._eventListeners.set(t,[]),this._eventListeners.set(t,(null!=(n=this._eventListeners.get(t))?n:[]).concat(i)),this._eventCallbacks.set(i,[t,e]),void 0!==this._onLogsSubscriptionId||(this._onLogsSubscriptionId=this._provider.connection.onLogs(this._programId,(t,e)=>{if(!t.err)for(let r of this._eventParser.parseLogs(t.logs)){let n=this._eventListeners.get(r.name);n&&n.forEach(n=>{let i=this._eventCallbacks.get(n);if(i){let[,n]=i;n(r.data,e.slot,t.signature)}})}},r)),i}async removeEventListener(t){let e=this._eventCallbacks.get(t);if(!e)throw Error(`Event listener ${t} doesn't exist!`);let[r]=e,n=this._eventListeners.get(r);if(!n)throw Error(`Event listeners don't exist for ${r}!`);if(this._eventCallbacks.delete(t),n=n.filter(e=>e!==t),this._eventListeners.set(r,n),0===n.length&&this._eventListeners.delete(r),0===this._eventCallbacks.size){if(0!==this._eventListeners.size)throw Error(`Expected event listeners size to be 0 but got ${this._eventListeners.size}`);void 0!==this._onLogsSubscriptionId&&(await this._provider.connection.removeOnLogsListener(this._onLogsSubscriptionId),this._onLogsSubscriptionId=void 0)}}}class rl{constructor(t,e){this.coder=e,this.programId=t}*parseLogs(t,e=!1){let r=new rh(t),n=new rd,i=r.next();for(;null!==i;){let[t,o,s]=this.handleLog(n,i,e);t&&(yield t),o&&n.push(o),s&&n.pop(),i=r.next()}}handleLog(t,e,r){return t.stack.length>0&&t.program()===this.programId.toString()?this.handleProgramLog(e,r):[null,...this.handleSystemLog(e)]}handleProgramLog(t,e){if(!(t.startsWith(ro)||t.startsWith(rs)))return[null,...this.handleSystemLog(t)];{let r=t.startsWith(ro)?t.slice(ra):t.slice(rc),n=this.coder.events.decode(r);if(e&&null===n)throw Error(`Unable to decode event ${r}`);return[n,null,!1]}}handleSystemLog(t){let e=t.split(":")[0];return null!==e.match(/^Program (.*) success/g)?[null,!0]:e.startsWith(`Program ${this.programId.toString()} invoke`)?[this.programId.toString(),!1]:e.includes("invoke")?["cpi",!1]:[null,!1]}}class rd{constructor(){this.stack=[]}program(){if(!this.stack.length)throw Error("Expected the stack to have elements");return this.stack[this.stack.length-1]}push(t){this.stack.push(t)}pop(){if(!this.stack.length)throw Error("Expected the stack to have elements");this.stack.pop()}}class rh{constructor(t){this.logs=t}next(){if(0===this.logs.length)return null;let t=this.logs[0];return this.logs=this.logs.slice(1),t}}function r_(t,e){var r,n;let i={},o=t.args?t.args.length:0;if(e.length>o){if(e.length!==o+1)throw Error(`provided too many arguments ${e} to instruction ${null==t?void 0:t.name} expecting: ${null!=(n=null==(r=t.args)?void 0:r.map(t=>t.name))?n:[]}`);i=e.pop()}return[e,i]}class rp{static build(t,e,r){if("_inner"===t.name)throw new eC("the _inner name is reserved");let n=(...i)=>{let[o,s]=r_(t,[...i]);!function t(e,r={}){e.forEach(e=>{if(b(e))t(e.accounts,r[e.name]);else if(!r[e.name])throw Error(`Account \`${e.name}\` not provided.`)})}(t.accounts,s.accounts),[...i];let a=n.accounts(s.accounts);return void 0!==s.remainingAccounts&&a.push(...s.remainingAccounts),ew("debug-logs")&&console.log("Outgoing account metas:",a),new f.TransactionInstruction({keys:a,programId:r,data:e(t.name,function(t,...e){if(t.args.length!=e.length)throw Error("Invalid argument length");let r={},n=0;return t.args.forEach(t=>{r[t.name]=e[n],n+=1}),r}(t,...o))})};return n.accounts=e=>rp.accountsArray(e,t.accounts,r,t.name),n}static accountsArray(t,e,r,n){return t?e.map(e=>{let i;if(b(e)){let i=t[e.name];return rp.accountsArray(i,e.accounts,r,n).flat()}try{i=x(t[e.name])}catch(t){throw Error(`Wrong input type for account "${e.name}" in the instruction accounts object${void 0!==n?' for instruction "'+n+'"':""}. Expected PublicKey or string.`)}let o=e.optional&&i.equals(r);return{pubkey:i,isWritable:!!(e.writable&&!o),isSigner:!!(e.signer&&!o)}}).flat():[]}}class rf{static build(t,e){return(...r)=>{var n,i,o;let[,s]=r_(t,[...r]),a=new f.Transaction;if(s.preInstructions&&s.instructions)throw Error("instructions is deprecated, use preInstructions");
1return null==(n=s.preInstructions)||n.forEach(t=>a.add(t)),null==(i=s.instructions)||i.forEach(t=>a.add(t)),a.add(e(...r)),null==(o=s.postInstructions)||o.forEach(t=>a.add(t)),a}}}class rR{static build(t,e,r,n){return async(...i)=>{var o;let s=e(...i),[,a]=r_(t,[...i]);if(void 0===n.sendAndConfirm)throw Error("This function requires 'Provider.sendAndConfirm' to be implemented.");try{return await n.sendAndConfirm(s,null!=(o=a.signers)?o:[],a.options)}catch(t){throw eL(t,r)}}}}class ry{static build(t,e,r,n){var i;return(null!=(i=t.accounts)?i:[]).reduce((i,o)=>(i[o.name]=new rE(t,o,r,n,e),i),{})}}class rE{get size(){return this._size}get programId(){return this._programId}get provider(){return this._provider}get coder(){return this._coder}constructor(t,e,r,n,i){this._idlAccount=e,this._programId=r,this._provider=null!=n?n:tu(),this._coder=null!=i?i:new eG(t),this._size=this._coder.accounts.size(e.name)}async fetchNullable(t,e){let{data:r}=await this.fetchNullableAndContext(t,e);return r}async fetchNullableAndContext(t,e){let{value:r,context:n}=await this.getAccountInfoAndContext(t,e);return{data:r&&0!==r.data.length?this._coder.accounts.decode(this._idlAccount.name,r.data):null,context:n}}async fetch(t,e){let{data:r}=await this.fetchNullableAndContext(t,e);if(null===r)throw Error(`Account does not exist or has no data ${t.toString()}`);return r}async fetchAndContext(t,e){let{data:r,context:n}=await this.fetchNullableAndContext(t,e);if(null===r)throw Error(`Account does not exist ${t.toString()}`);return{data:r,context:n}}async fetchMultiple(t,e){return(await this.fetchMultipleAndContext(t,e)).map(t=>t?t.data:null)}async fetchMultipleAndContext(t,e){return(await J(this._provider.connection,t.map(t=>x(t)),e)).map(t=>{if(null==t)return null;let{account:e,context:r}=t;return{data:this._coder.accounts.decode(this._idlAccount.name,e.data),context:r}})}async all(t){let e=this.coder.accounts.memcmp(this._idlAccount.name,t instanceof I?t:void 0),r=[];return(null==e?void 0:e.offset)!=void 0&&(null==e?void 0:e.bytes)!=void 0&&r.push({memcmp:{offset:e.offset,bytes:e.bytes}}),(null==e?void 0:e.dataSize)!=void 0&&r.push({dataSize:e.dataSize}),(await this._provider.connection.getProgramAccounts(this._programId,{commitment:this._provider.connection.commitment,filters:[...r,...Array.isArray(t)?t:[]]})).map(({pubkey:t,account:e})=>({publicKey:t,account:this._coder.accounts.decode(this._idlAccount.name,e.data)}))}subscribe(t,e){let r=rO.get(t.toString());if(r)return r.ee;let n=new(g());t=x(t);let i=this._provider.connection.onAccountChange(t,t=>{let e=this._coder.accounts.decode(this._idlAccount.name,t.data);n.emit("change",e)},e);return rO.set(t.toString(),{ee:n,listener:i}),n}async unsubscribe(t){let e=rO.get(t.toString());e?rO&&await this._provider.connection.removeAccountChangeListener(e.listener).then(()=>{rO.delete(t.toString())}).catch(console.error):console.warn("Address is not subscribed")}async createInstruction(t,e){let r=this.size;if(void 0===this._provider.publicKey)throw Error("This function requires the Provider interface implementor to have a 'publicKey' field.");return f.SystemProgram.createAccount({fromPubkey:this._provider.publicKey,newAccountPubkey:t.publicKey,space:null!=e?e:r,lamports:await this._provider.connection.getMinimumBalanceForRentExemption(null!=e?e:r),programId:this._programId})}async getAccountInfo(t,e){return await this._provider.connection.getAccountInfo(x(t),e)}async getAccountInfoAndContext(t,e){return await this._provider.connection.getAccountInfoAndContext(x(t),e)}}let rO=new Map;class rA{static build(t,e,r,n,i,o,s){return async(...a)=>{var c;let u,l=e(...a),[,d]=r_(t,[...a]);if(void 0===n.simulate)throw Error("This function requires 'Provider.simulate' to be implemented.");try{u=await n.simulate(l,d.signers,null==(c=d.options)?void 0:c.commitment)}catch(t){throw eL(t,r)}if(void 0===u)throw Error("Unable to simulate transaction");let h=u.logs;if(!h)throw Error("Simulated logs not found");let _=[];if(s.events)for(let t of new rl(o,i).parseLogs(h))_.push(t);return{events:_,raw:h}}}}function rm(t){return new rT(e5(8),t=>rI.fromBuffer(t),t=>t.toBuffer(),t)}function rN(t){return new rT(e5(32),t=>new f.PublicKey(t),t=>t.toBuffer(),t)}class rT extends e${constructor(t,e,r,n){super(t.span,n),this.layout=t,this.decoder=e,this.encoder=r}decode(t,e){return this.decoder(this.layout.decode(t,e))}encode(t,e,r){return this.layout.encode(this.encoder(t),e,r)}getSpan(t,e){return this.layout.getSpan(t,e)}}class rg extends e${constructor(t,e){super(-1,e),this.layout=t,this.discriminator=e3()}encode(t,e,r=0){return null==t?this.layout.span+this.discriminator.encode(0,e,r):(this.discriminator.encode(1,e,r),this.layout.encode(t,e,r+4)+4)}decode(t,e=0){let r=this.discriminator.decode(t,e);if(0===r)return null;if(1===r)return this.layout.decode(t,e+4);throw Error("Invalid coption "+this.layout.property)}getSpan(t,e=0){return this.layout.getSpan(t,e+4)+4}}class rI extends p(){toBuffer(){let t=super.toArray().reverse(),e=I.from(t);if(8===e.length)return e;if(e.length>=8)throw Error("u64 too large");let r=I.alloc(8);return e.copy(r),r}static fromBuffer(t){if(8!==t.length)throw Error(`Invalid buffer length: ${t.length}`);return new rI([...t].reverse().map(t=>`00${t.toString(16)}`.slice(-2)).join(""),16)}}let rv=e6([rN("mint"),rN("owner"),rm("amount"),new rg(rN(),"delegate"),
1((n=e4(new eF(1,"discriminator"),null,"state")).addVariant(0,e6([]),"uninitialized"),n.addVariant(1,e6([]),"initialized"),n.addVariant(2,e6([]),"frozen"),n),new rg(rm(),"isNative"),rm("delegatedAmount"),new rg(rN(),"closeAuthority")]);class rw{constructor(t,e,r,n,i,o,s,a){this._args=t,this._accounts=e,this._provider=r,this._programId=n,this._idlIx=i,this._idlTypes=s,this._customResolver=a,this._accountStore=new rC(r,o,n)}args(t){this._args=t}async resolve(){this.resolveEventCpi(this._idlIx.accounts),this.resolveConst(this._idlIx.accounts);let t=0;for(;await this.resolvePdasAndRelations(this._idlIx.accounts)+await this.resolveCustom()>0;)if(16==++t){let t=e=>b(e)?e.accounts.some(t):!!(e.address||e.pda||e.relations),e=(t,r=[],n=[])=>{for(let i of t)b(i)?n.push(...e(i.accounts,[...r,i.name])):n.push([...r,i.name]);return n},r=e(this._idlIx.accounts.filter(t)).filter(t=>!this.get(t)).map(t=>t.reduce((t,e)=>t+"."+e)).map(t=>`\`${t}\``).join(", ");throw Error(`Reached maximum depth for account resolution. Unresolved accounts: ${r}`)}}resolveOptionals(t){Object.assign(this._accounts,this.resolveOptionalsHelper(t,this._idlIx.accounts))}get(t){let e=t.reduce((t,e)=>t&&t[e],this._accounts);if(e&&e.toBase58)return e}set(t,e){let r=this._accounts;t.forEach((n,i)=>{var o;i===t.length-1&&(r[n]=e),r[n]=null!=(o=r[n])?o:{},r=r[n]})}resolveOptionalsHelper(t,e){let r={};for(let n of e){let e=n.name,i=t[e];void 0!==i&&(rb(i)?b(n)?r[e]=this.resolveOptionalsHelper(i,n.accounts):r[e]=function t(e,r){let n={};for(let i in e){let o=e[i];if(null===o){if(r)throw Error("Failed to resolve optionals due to IDL type mismatch with input accounts!");continue}n[i]=rb(o)?t(o,!0):x(o)}return n}(i,!0):null!==i?r[e]=x(i):n.optional&&(r[e]=this._programId))}return r}async resolveCustom(){if(this._customResolver){let{accounts:t,resolved:e}=await this._customResolver({args:this._args,accounts:this._accounts,provider:this._provider,programId:this._programId,idlIx:this._idlIx});return this._accounts=t,e}return 0}resolveEventCpi(t,e=[]){for(let r in t){let n=t[r];b(n)&&this.resolveEventCpi(n.accounts,[...e,n.name]);let i=+r+1;if(i===t.length)return;let o=t[r].name,s=t[i].name;if("eventAuthority"===o&&"program"===s){let t=[...e,o],r=[...e,s];this.get(t)||this.set(t,f.PublicKey.findProgramAddressSync([I.from("__event_authority")],this._programId)[0]),this.get(r)||this.set(r,this._programId);return}}}resolveConst(t,e=[]){for(let r of t){let t=r.name;if(b(r))this.resolveConst(r.accounts,[...e,t]);else if((r.signer||r.address)&&!this.get([...e,t])){if(r.signer){if(!this._provider.publicKey)throw Error("This function requires the `Provider` interface implementor to have a `publicKey` field.");this.set([...e,t],this._provider.publicKey)}r.address&&this.set([...e,t],x(r.address))}}}async resolvePdasAndRelations(t,e=[]){let r=0;for(let n of t){let t=n.name;if(b(n))r+=await this.resolvePdasAndRelations(n.accounts,[...e,t]);else if((n.pda||n.relations)&&!this.get([...e,t])){r++;try{if(n.pda){let r=await Promise.all(n.pda.seeds.map(t=>this.toBuffer(t,e)));if(r.some(t=>!t))continue;let i=await this.parseProgramId(n,e),[o]=f.PublicKey.findProgramAddressSync(r,i);this.set([...e,t],o)}}catch{}try{if(n.relations){let r=this.get([...e,n.relations[0]]);if(r){let n=await this._accountStore.fetchAccount({publicKey:r});this.set([...e,t],n[t])}}}catch{}}}return r}async parseProgramId(t,e=[]){var r;if(!(null==(r=t.pda)?void 0:r.program))return this._programId;let n=await this.toBuffer(t.pda.program,e);if(!n)throw Error(`Program seed not resolved: ${t.name}`);return new f.PublicKey(n)}async toBuffer(t,e=[]){switch(t.kind){case"const":return this.toBufferConst(t);case"arg":return await this.toBufferArg(t);case"account":return await this.toBufferAccount(t,e);default:throw Error(`Unexpected seed: ${t}`)}}toBufferConst(t){return this.toBufferValue("bytes",t.value)}async toBufferArg(t){let[e,...r]=t.path.split("."),n=this._idlIx.args.findIndex(t=>t.name===e);if(-1===n)throw Error(`Unable to find argument for seed: ${e}`);let i=r.reduce((t,e)=>(null!=t?t:{})[e],this._args[n]);if(void 0===i)return;let o=this.getType(this._idlIx.args[n].type,r);return this.toBufferValue(o,i)}async toBufferAccount(t,e=[]){let[r,...n]=t.path.split("."),i=this.get([...e,r]);if(!i)return;if(!n.length)return this.toBufferValue("pubkey",i);if(!t.account)throw Error(`Seed account is required in order to resolve type: ${t.path}`);let o=await this._accountStore.fetchAccount({publicKey:i,name:t.account}),s=n;for(;s.length>0;)o=o[s[0]],s=s.slice(1);if(void 0===o)return;let a=this.getType({defined:{name:t.account}},n);return this.toBufferValue(a,o)}toBufferValue(t,e){switch(t){case"u8":case"i8":return I.from([e]);case"u16":case"i16":return new(p())(e).toArrayLike(I,"le",2);case"u32":case"i32":return new(p())(e).toArrayLike(I,"le",4);case"u64":case"i64":return new(p())(e).toArrayLike(I,"le",8);case"u128":case"i128":return new(p())(e).toArrayLike(I,"le",16);case"u256":case"i256":return new(p())(e).toArrayLike(I,"le",32);case"string":case"bytes":return I.from(e);case"pubkey":return e.toBuffer();default:if(null==t?void 0:t.array)return I.from(e);throw Error(`Unexpected seed type: ${t}`)}}getType(t,e=[]){var r;let n=null==(r=null==t?void 0:t.defined)?void 0:r.name;if(n){if("tokenAccount"===n)switch(e.at(0)){case"mint":case"owner":return"pubkey";case"amount":case"delagatedAmount":return"u64";default:throw Error(`Unknown token account path: ${e}`)}let t=this._idlTypes.find(t=>t.name===n);if(!t)throw Error(`Type not found: ${n}`);let[r,...i]=e,o=t.type.fields.find(t=>t.name===r);if(!o)throw Error(`Field not found: ${r}`);return this.getType(o.type,i)}return t}}class rC{constructor(t,e,r){this._provider=t,this._cache=new Map,this._idls={},this._idls[r.toBase58()]=e}async fetchAccount({publicKey:t,name:e}){let r=t.toBase58();if(!this._cache.has(r)){let i=await this._provider.connection.getAccountInfo(t);if(null===i)throw Error(`Account not found: ${r}`);if("tokenAccount"===e){var n;let t=(n=i.data,rv.decode(n));this._cache.set(r,t)}else{let t=await this.getAccountsNs(i.owner);if(t){let e=Object.values(t)[0];if(e){let t=e.coder.accounts.decodeAny(i.data);this._cache.set(r,t)}}}}return this._cache.get(r)}async getAccountsNs(t){let e=t.toBase58();if(!this._idls[e]){let r=await rx.fetchIdl(t,this._provider);if(r){let t=new rx(r,this._provider);this._idls[e]=t.account}}return this._idls[e]}}class rS{static build(t,e,r,n,i,o,s,a,c,u,l){return(...d)=>new rD(d,n,i,o,s,a,t,e,r,c,u,l)}}function rb(t){return"object"==typeof t&&null!==t&&!("_bn"in t)}class rD{constructor(t,e,r,n,i,o,s,a,c,u,l,d){this._args=t,this._ixFn=e,this._txFn=r,this._rpcFn=n,this._simulateFn=i,this._viewFn=o,this._accounts={},this._remainingAccounts=[],this._signers=[],this._preInstructions=[],this._postInstructions=[],this._resolveAccounts=!0,this._accountsResolver=new rw(t,this._accounts,s,a,c,u,l,d)}args(t){this._args=t,this._accountsResolver.args(t)}accounts(t){return this.accountsPartial(t)}accountsPartial(t){return this._resolveAccounts=!0,this._accountsResolver.resolveOptionals(t),this}accountsStrict(t){return this._resolveAccounts=!1,this._accountsResolver.resolveOptionals(t),this}signers(t){return this._signers=this._signers.concat(t),this}remainingAccounts(t){return this._remainingAccounts=this._remainingAccounts.concat(t),this}preInstructions(t,e=!1){return e?this._preInstructions=t.concat(this._preInstructions):this._preInstructions=this._preInstructions.concat(t),this}postInstructions(t){return this._postInstructions=this._postInstructions.concat(t),this}async pubkeys(){return this._resolveAccounts&&await this._accountsResolver.resolve(),this._accounts}async instruction(){return this._resolveAccounts&&await this._accountsResolver.resolve(),this._ixFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions})}async transaction(){return this._resolveAccounts&&await this._accountsResolver.resolve(),this._txFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions})}async simulate(t){return this._resolveAccounts&&await this._accountsResolver.resolve(),this._simulateFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:t})}async view(t){if(this._resolveAccounts&&await this._accountsResolver.resolve(),!this._viewFn)throw Error("Method does not support views. The instruction should return a value, and its accounts must be read-only");return this._viewFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:t})}async rpc(t){return this._resolveAccounts&&await this._accountsResolver.resolve(),this._rpcFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:t})}async rpcAndKeys(t){return{signature:await this.rpc(t),pubkeys:await this.pubkeys()}}async prepare(){return{instruction:await this.instruction(),signers:this._signers,pubkeys:await this.pubkeys()}}}class rL{static build(t,e,r,n){let i=e.accounts.find(t=>t.writable),o=!!e.returns;if(!i&&o)return async(...i)=>{let o=await r(...i),s=`Program return: ${t} `,a=o.raw.find(t=>t.startsWith(s));if(!a)throw Error("View expected return log");let c=S(a.slice(s.length)),u=e.returns;if(!u)throw Error("View expected return type");return ex.fieldLayout({type:u},n.types).decode(c)}}}class rH{static build(t,e,r,n,i){let o,s={},a={},c={},u={},l={},d={}
1,h=(o=new Map,t.errors&&t.errors.forEach(t=>{var e;let r=null!=(e=t.msg)?e:t.name;o.set(t.code,r)}),o),_=t.accounts?ry.build(t,e,r,n):{};return t.instructions.forEach(o=>{let p=rp.build(o,(t,r)=>e.instruction.encode(t,r),r),f=rf.build(o,p),R=rR.build(o,f,h,n),y=rA.build(o,f,h,n,e,r,t),E=rL.build(r,o,y,t),O=rS.build(n,r,o,p,f,R,y,E,_,t.types||[],null==i?void 0:i(o)),A=o.name;a[A]=p,c[A]=f,s[A]=R,u[A]=y,l[A]=O,E&&(d[A]=E)}),[s,a,c,_,u,l,d]}}class rx{get programId(){return this._programId}get idl(){return this._idl}get rawIdl(){return this._rawIdl}get coder(){return this._coder}get provider(){return this._provider}constructor(t,e=tu(),r,n){this._idl=function(t){let e=["name","path","account","relations","generic"],r=t=>t.split(".").map(A()).join("."),n=t=>{for(let i in t){let o=t[i];e.includes(i)?t[i]=Array.isArray(o)?o.map(r):r(o):"object"==typeof o&&n(o)}},i=structuredClone(t);return n(i),i}(t),this._rawIdl=t,this._provider=e,this._programId=x(t.address),this._coder=null!=r?r:new eG(this._idl),this._events=new ru(this._programId,e,this._coder);const[i,o,s,a,c,u,l]=rH.build(this._idl,this._coder,this._programId,e,n);this.rpc=i,this.instruction=o,this.transaction=s,this.account=a,this.simulate=c,this.methods=u,this.views=l}static async at(t,e){let r=x(t),n=await rx.fetchIdl(r,e);if(!n)throw Error(`IDL not found for program: ${t.toString()}`);return new rx(n,e)}static async fetchIdl(t,e){var r;e=null!=e?e:tu();let n=x(t),i=await D(n),o=await e.connection.getAccountInfo(i);if(!o)return null;let s=(r=o.data.slice(8),L.decode(r));return JSON.parse(w((0,N.UD)(s.data)))}addEventListener(t,e,r){return this._events.addEventListener(t,e,r)}async removeEventListener(t){return await this._events.removeEventListener(t)}}new f.PublicKey("11111111111111111111111111111111")}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.