snapper-sdk
Version:
An SDK for building applications on top of Snapper.
1 lines • 388 kB
JavaScript
"use strict";var cl=Object.create;var wi=Object.defineProperty;var ll=Object.getOwnPropertyDescriptor;var ml=Object.getOwnPropertyNames;var dl=Object.getPrototypeOf,pl=Object.prototype.hasOwnProperty;var fl=(i,e)=>{for(var t in e)wi(i,t,{get:e[t],enumerable:!0})},Qa=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ml(e))!pl.call(i,o)&&o!==t&&wi(i,o,{get:()=>e[o],enumerable:!(n=ll(e,o))||n.enumerable});return i};var le=(i,e,t)=>(t=i!=null?cl(dl(i)):{},Qa(e||!i||!i.__esModule?wi(t,"default",{value:i,enumerable:!0}):t,i)),yl=i=>Qa(wi({},"__esModule",{value:!0}),i);var Wd={};fl(Wd,{AMM_CONFIG_SEED:()=>Ac,BIT_PRECISION:()=>Us,Clmm:()=>fo,ClmmConfigLayout:()=>aa,ClmmInstrument:()=>he,ConstantProductCurve:()=>oi,CpmmConfigInfoLayout:()=>_a,CpmmFee:()=>ii,CpmmPoolInfoLayout:()=>mi,CurveCalculator:()=>si,DataElement:()=>Fc,EXTENSION_TICKARRAY_BITMAP_SIZE:()=>hr,FARM_LOCK_MINT:()=>Ls,FARM_LOCK_VAULT:()=>Os,FARM_PROGRAM_TO_VERSION:()=>Pt,FARM_VERSION_TO_LEDGER_LAYOUT:()=>Ms,FARM_VERSION_TO_STATE_LAYOUT:()=>Ns,FEE_RATE_DENOMINATOR:()=>jo,FEE_RATE_DENOMINATOR_VALUE:()=>Or,FETCH_TICKARRAY_COUNT:()=>xc,Fee:()=>gc,LIQUIDITY_FEES_DENOMINATOR:()=>$o,LIQUIDITY_FEES_NUMERATOR:()=>Tr,LIQUIDITY_VERSION_TO_SERUM_VERSION:()=>Vc,LIQUIDITY_VERSION_TO_STATE_LAYOUT:()=>cd,LOCK_LIQUIDITY_SEED:()=>el,LOG_B_2_X32:()=>Gs,LOG_B_P_ERR_MARGIN_LOWER_X64:()=>Xs,LOG_B_P_ERR_MARGIN_UPPER_X64:()=>zs,LiquidityMath:()=>pe,LockClPositionLayoutV2:()=>nd,LockPositionLayout:()=>td,MARKET_STATE_LAYOUT_V2:()=>vr,MARKET_STATE_LAYOUT_V3:()=>_r,MARKET_VERSION_TO_STATE_LAYOUT:()=>Ea,MAX_SQRT_PRICE_X64:()=>Tt,MAX_SQRT_PRICE_X64_SUB_ONE:()=>Qo,MAX_TICK:()=>rt,MIN_SQRT_PRICE_X64:()=>ht,MIN_SQRT_PRICE_X64_ADD_ONE:()=>zo,MIN_TICK:()=>Je,MODEL_DATA_PUBKEY:()=>Vn,Market:()=>pi,MathUtil:()=>ne,MaxU64:()=>gr,MaxUint128:()=>qs,NEGATIVE_ONE:()=>jt,OBSERVATION_SEED:()=>Bc,ONE:()=>bt,OPERATION_SEED:()=>Tc,ObservationInfoLayout:()=>ua,ObservationLayout:()=>Kc,OperationLayout:()=>ca,POOL_LOCK_ID_SEED:()=>ta,POOL_REWARD_VAULT_SEED:()=>kc,POOL_SEED:()=>wc,POOL_TICK_ARRAY_BITMAP_SEED:()=>Ic,POOL_VAULT_SEED:()=>Pc,POSITION_SEED:()=>Zs,PoolInfoLayout:()=>hn,PoolUtils:()=>Le,PositionInfoLayout:()=>co,PositionRewardInfoLayout:()=>Rc,PositionUtils:()=>so,ProtocolPositionLayout:()=>ed,Q128:()=>Xo,Q64:()=>gt,Raydium:()=>Ai,RewardInfo:()=>Cc,RoundDirection:()=>Ta,SERUM_PROGRAMID_TO_VERSION:()=>Va,SERUM_VERSION_TO_PROGRAMID:()=>va,SOL_INFO:()=>Vt,SPL_MINT_LAYOUT:()=>od,SqrtPriceMath:()=>ee,StableLayout:()=>_n,SwapMath:()=>kn,TICK_ARRAY_BITMAP_SIZE:()=>Pn,TICK_ARRAY_SEED:()=>hc,TICK_ARRAY_SIZE:()=>ve,TICK_SPACINGS:()=>zm,TOKEN_WSOL:()=>_e,TickArrayBitmap:()=>Yt,TickArrayBitmapExtensionLayout:()=>ra,TickArrayBitmapExtensionUtils:()=>uo,TickArrayLayout:()=>ao,TickLayout:()=>Lc,TickMath:()=>Tn,TickQuery:()=>fe,TickUtils:()=>X,U64Resolution:()=>no,U64_IGNORE_RANGE:()=>jm,Voter:()=>Cs,VoterDepositEntry:()=>ac,VoterLockup:()=>sc,VoterRegistrar:()=>Ks,VoterVotingMintConfig:()=>rc,ZERO:()=>ye,addLiquidityLayout:()=>Sr,associatedLedgerAccountLayout:()=>er,calFarmRewardAmount:()=>pr,ceilDiv:()=>$c,claimLayout:()=>ko,clmmComputeInfoToApiInfo:()=>ia,closeAccountInstruction:()=>zt,collectCpFeeInstruction:()=>Ma,cpmmLockPositionInstruction:()=>tl,createAssociatedLedgerAccountInstruction:()=>$n,createPoolFeeLayout:()=>da,createPoolV4InstructionV2:()=>Aa,createPoolV4Layout:()=>ud,createWSolAccountInstructions:()=>Qt,dwLayout:()=>it,farmAddRewardLayout:()=>ir,farmLedgerLayoutV3_1:()=>Em,farmLedgerLayoutV3_2:()=>Hn,farmLedgerLayoutV5_1:()=>Fm,farmLedgerLayoutV5_2:()=>xs,farmLedgerLayoutV6_1:()=>Ss,farmRewardInfoToConfig:()=>Vs,farmRewardLayout:()=>nr,farmRewardRestartLayout:()=>or,farmRewardTimeInfoLayout:()=>ic,farmStateV3Layout:()=>Is,farmStateV5Layout:()=>Bs,farmStateV6Layout:()=>Yn,fetchMultipleFarmInfoAndUpdate:()=>Dm,fetchMultipleInfo:()=>kd,fixedSwapInLayout:()=>Ir,fixedSwapOutLayout:()=>Br,floorDiv:()=>Ia,formatLayout:()=>Uc,generatePubKey:()=>ct,getAssociatedAuthority:()=>_s,getAssociatedConfigId:()=>ei,getAssociatedLedgerAccount:()=>$e,getAssociatedLedgerPoolAccount:()=>Zn,getAssociatedOpenOrders:()=>Zc,getAssociatedPoolKeys:()=>ha,getCpLockPda:()=>ci,getCpmmPdaAmmConfigId:()=>Rd,getCpmmPdaPoolId:()=>Mr,getCreatePoolKeys:()=>Sa,getDepositEntryIndex:()=>fr,getDxByDyBaseIn:()=>ya,getDyByDxBaseIn:()=>fa,getFarmLedgerLayout:()=>Nn,getFarmStateLayout:()=>uc,getLiquidityAssociatedAuthority:()=>Rr,getLiquidityAssociatedId:()=>In,getLiquidityFromAmounts:()=>$m,getPdaAmmConfigId:()=>Zm,getPdaExBitmapAccount:()=>mt,getPdaLockClPositionIdV2:()=>ro,getPdaLockPositionId:()=>kr,getPdaLpMint:()=>Jc,getPdaMetadataKey:()=>wn,getPdaObservationAccount:()=>ea,getPdaObservationId:()=>ui,getPdaOperationAccount:()=>io,getPdaPersonalPositionAddress:()=>st,getPdaPoolAuthority:()=>En,getPdaPoolId:()=>$s,getPdaPoolRewardVaulId:()=>Js,getPdaPoolVaultId:()=>Pr,getPdaProtocolPositionAddress:()=>St,getPdaTickArrayAddress:()=>de,getPdaUser:()=>ai,getPdaVault:()=>xa,getRegistrarAddress:()=>ar,getStablePrice:()=>ba,getTokenOwnerRecordAddress:()=>dr,getVoterAddress:()=>lr,getVoterWeightRecordAddress:()=>mr,getVotingMintAuthority:()=>cr,getVotingTokenMint:()=>ur,governanceCreateTokenOwnerRecord:()=>pc,i16ToBytes:()=>Ym,i32ToBytes:()=>Yo,initPoolLayout:()=>xr,initTokenAccountInstruction:()=>Ji,initializeMarket:()=>il,isValidFarmVersion:()=>rr,isZero:()=>oo,judgeFarmType:()=>Wm,leadingZeros:()=>Ar,leastSignificantBit:()=>Hs,liquidityStateV4Layout:()=>mo,liquidityStateV5Layout:()=>vc,makeAMMSwapInstruction:()=>Jo,makeAddLiquidityInstruction:()=>ga,makeAddNewRewardInstruction:()=>br,makeClaimInstruction:()=>bi,makeClaimInstructionV4:()=>Dr,makeCpmmCreateAmmConfigInstruction:()=>Ka,makeCpmmLockInstruction:()=>Na,makeCreateCpmmPoolInInstruction:()=>Ca,makeCreateFarmInstruction:()=>vs,makeCreateMarketInstruction:()=>qa,makeCreatorWithdrawFarmRewardInstruction:()=>Es,makeDepositCpmmInInstruction:()=>Ra,makeDepositInstructionV3:()=>Fs,makeDepositInstructionV5:()=>Ds,makeDepositInstructionV6:()=>Ws,makeDepositTokenInstruction:()=>Um,makeDepositWithdrawInstruction:()=>Xm,makeInitPoolInstructionV4:()=>wd,makePurchaseInstruction:()=>Ed,makeRestartRewardInstruction:()=>yr,makeSimulatePoolInfoInstruction:()=>wa,makeSwapCpmmBaseInInInstruction:()=>li,makeSwapCpmmBaseOutInInstruction:()=>Oa,makeSwapFixedInInstruction:()=>Xc,makeSwapFixedOutInstruction:()=>zc,makeSwapInstruction:()=>Da,makeTransferInstruction:()=>Ts,makeWithdrawCpmmInInstruction:()=>La,makeWithdrawInstructionV3:()=>to,makeWithdrawInstructionV5:()=>eo,makeWithdrawInstructionV6:()=>Jn,makeWithdrawTokenInstruction:()=>Gm,mockCreatePoolInfo:()=>Qm,mockV3CreatePoolInfo:()=>Qs,modelDataInfoLayout:()=>Dc,mostSignificantBit:()=>Ys,parseTokenAccountResp:()=>hs,parseTokenInfo:()=>id,poolTypeV6:()=>nn,purchaseLayout:()=>Er,realFarmStateV3Layout:()=>tc,realFarmStateV5Layout:()=>nc,realFarmV6Layout:()=>oc,removeLiquidityInstruction:()=>Cr,removeLiquidityLayout:()=>Kr,route1Instruction:()=>Md,route2Instruction:()=>_d,routeInstruction:()=>nl,simulatePoolInfoInstruction:()=>Ad,solToWSolToken:()=>sd,splAccountLayout:()=>tn,toAmmComputePoolInfo:()=>ti,toApiV3Token:()=>et,toFeeConfig:()=>on,toToken:()=>Zo,toTokenAmount:()=>lo,toTokenInfo:()=>rd,trailingZeros:()=>wr,u16ToBytes:()=>js,u32ToBytes:()=>Hm,unionArr:()=>Dd,updateFarmPoolInfo:()=>cc,validateFarmRewards:()=>sr,voterStakeRegistryCreateDepositEntry:()=>yc,voterStakeRegistryCreateVoter:()=>fc,voterStakeRegistryDeposit:()=>lc,voterStakeRegistryUpdateVoterWeightRecord:()=>mc,voterStakeRegistryWithdraw:()=>dc,wSolToSolToken:()=>ad,withdrawRewardLayout:()=>tr});module.exports=yl(Wd);var sl=require("lodash");var ds=le(require("axios"));var Xr=require("@solana/web3.js");var Bo=require("lodash");var qr=class{constructor(e){this.logLevel=e.logLevel!==void 0?e.logLevel:0,this.name=e.name}set level(e){this.logLevel=e}get time(){return Date.now().toString()}get moduleName(){return this.name}isLogLevel(e){return e<=this.logLevel}error(...e){return this.isLogLevel(0)?(console.error(this.time,this.name,"sdk logger error",...e),this):this}logWithError(...e){let t=e.map(n=>typeof n=="object"?JSON.stringify(n):n).join(", ");throw new Error(t)}warning(...e){return this.isLogLevel(1)?(console.warn(this.time,this.name,"sdk logger warning",...e),this):this}info(...e){return this.isLogLevel(2)?(console.info(this.time,this.name,"sdk logger info",...e),this):this}debug(...e){return this.isLogLevel(3)?(console.debug(this.time,this.name,"sdk logger debug",...e),this):this}},ja={},bl={};function me(i){let e=(0,Bo.get)(ja,i);if(!e){let t=(0,Bo.get)(bl,i);e=new qr({name:i,logLevel:t}),(0,Bo.set)(ja,i,e)}return e}var cn=require("@solana/spl-token"),Ur=me("Raydium_accountInfo_util");async function Nt(i,e,t){let{batchRequest:n,commitment:o="confirmed",chunkCount:r=100}={batchRequest:!1,...t},s=Gr(e,r),a=new Array(s.length).fill([]);if(n){let u=s.map(m=>{let d=i._buildArgs([m.map(p=>p.toBase58())],o,"base64");return{methodName:"getMultipleAccounts",args:d}}),c=Gr(u,10);a=(await(await Promise.all(c.map(async m=>await i._rpcBatchRequest(m)))).flat()).map(m=>(m.error&&Ur.logWithError(`failed to get info for multiple accounts, RPC_ERROR, ${m.error.message}`),m.result.value.map(d=>{if(d){let{data:p,executable:y,lamports:f,owner:b,rentEpoch:g}=d;return p.length!==2&&p[1]!=="base64"&&Ur.logWithError("info must be base64 encoded, RPC_ERROR"),{data:Buffer.from(p[0],"base64"),executable:y,lamports:f,owner:new Xr.PublicKey(b),rentEpoch:g}}return null})))}else try{a=await Promise.all(s.map(u=>i.getMultipleAccountsInfo(u,o)))}catch(u){u instanceof Error&&Ur.logWithError(`failed to get info for multiple accounts, RPC_ERROR, ${u.message}`)}return a.flat()}async function Fe(i,e,t){let n=await Nt(i,e.map(o=>o.pubkey),t);return e.map((o,r)=>({...o,accountInfo:n[r]}))}async function Dn({connection:i,mints:e,config:t}){var r,s,a;if(e.length===0)return{};let n=await Fe(i,e.map(u=>({pubkey:At(u)})),t),o={};for(let u of n){if(!u.accountInfo||u.accountInfo.data.length<cn.MINT_SIZE){console.log("invalid mint account",u.pubkey.toBase58());continue}let c=(0,cn.unpackMint)(u.pubkey,u.accountInfo,(r=u.accountInfo)==null?void 0:r.owner);o[u.pubkey.toString()]={...c,programId:((s=u.accountInfo)==null?void 0:s.owner)||cn.TOKEN_PROGRAM_ID,feeConfig:(a=(0,cn.getTransferFeeConfig)(c))!=null?a:void 0}}return o[Xr.PublicKey.default.toBase58()]=o[Q.toBase58()],o}var Xt=le(require("bn.js"));var Wn=9e15,pn=1e9,zr="0123456789abcdef",ki="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",hi="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Qr={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Wn,maxE:Wn,crypto:!1},$a,Ht,oe=!0,Ii="[DecimalError] ",dn=Ii+"Invalid argument: ",Ja=Ii+"Precision limit exceeded",eu=Ii+"crypto unavailable",tu="[object Decimal]",nt=Math.floor,De=Math.pow,gl=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Al=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,wl=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,nu=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,_t=1e7,te=7,Pl=9007199254740991,kl=ki.length-1,jr=hi.length-1,_={toStringTag:tu};_.absoluteValue=_.abs=function(){var i=new this.constructor(this);return i.s<0&&(i.s=1),Z(i)};_.ceil=function(){return Z(new this.constructor(this),this.e+1,2)};_.clampedTo=_.clamp=function(i,e){var t,n=this,o=n.constructor;if(i=new o(i),e=new o(e),!i.s||!e.s)return new o(NaN);if(i.gt(e))throw Error(dn+e);return t=n.cmp(i),t<0?i:n.cmp(e)>0?e:new o(n)};_.comparedTo=_.cmp=function(i){var e,t,n,o,r=this,s=r.d,a=(i=new r.constructor(i)).d,u=r.s,c=i.s;if(!s||!a)return!u||!c?NaN:u!==c?u:s===a?0:!s^u<0?1:-1;if(!s[0]||!a[0])return s[0]?u:a[0]?-c:0;if(u!==c)return u;if(r.e!==i.e)return r.e>i.e^u<0?1:-1;for(n=s.length,o=a.length,e=0,t=n<o?n:o;e<t;++e)if(s[e]!==a[e])return s[e]>a[e]^u<0?1:-1;return n===o?0:n>o^u<0?1:-1};_.cosine=_.cos=function(){var i,e,t=this,n=t.constructor;return t.d?t.d[0]?(i=n.precision,e=n.rounding,n.precision=i+Math.max(t.e,t.sd())+te,n.rounding=1,t=hl(n,au(n,t)),n.precision=i,n.rounding=e,Z(Ht==2||Ht==3?t.neg():t,i,e,!0)):new n(1):new n(NaN)};_.cubeRoot=_.cbrt=function(){var i,e,t,n,o,r,s,a,u,c,l=this,m=l.constructor;if(!l.isFinite()||l.isZero())return new m(l);for(oe=!1,r=l.s*De(l.s*l,1/3),!r||Math.abs(r)==1/0?(t=Ye(l.d),i=l.e,(r=(i-t.length+1)%3)&&(t+=r==1||r==-2?"0":"00"),r=De(t,1/3),i=nt((i+1)/3)-(i%3==(i<0?-1:2)),r==1/0?t="5e"+i:(t=r.toExponential(),t=t.slice(0,t.indexOf("e")+1)+i),n=new m(t),n.s=l.s):n=new m(r.toString()),s=(i=m.precision)+3;;)if(a=n,u=a.times(a).times(a),c=u.plus(l),n=Be(c.plus(l).times(a),c.plus(u),s+2,1),Ye(a.d).slice(0,s)===(t=Ye(n.d)).slice(0,s))if(t=t.slice(s-3,s+1),t=="9999"||!o&&t=="4999"){if(!o&&(Z(a,i+1,0),a.times(a).times(a).eq(l))){n=a;break}s+=4,o=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(Z(n,i+1,1),e=!n.times(n).times(n).eq(l));break}return oe=!0,Z(n,i,m.rounding,e)};_.decimalPlaces=_.dp=function(){var i,e=this.d,t=NaN;if(e){if(i=e.length-1,t=(i-nt(this.e/te))*te,i=e[i],i)for(;i%10==0;i/=10)t--;t<0&&(t=0)}return t};_.dividedBy=_.div=function(i){return Be(this,new this.constructor(i))};_.dividedToIntegerBy=_.divToInt=function(i){var e=this,t=e.constructor;return Z(Be(e,new t(i),0,1,1),t.precision,t.rounding)};_.equals=_.eq=function(i){return this.cmp(i)===0};_.floor=function(){return Z(new this.constructor(this),this.e+1,3)};_.greaterThan=_.gt=function(i){return this.cmp(i)>0};_.greaterThanOrEqualTo=_.gte=function(i){var e=this.cmp(i);return e==1||e===0};_.hyperbolicCosine=_.cosh=function(){var i,e,t,n,o,r=this,s=r.constructor,a=new s(1);if(!r.isFinite())return new s(r.s?1/0:NaN);if(r.isZero())return a;t=s.precision,n=s.rounding,s.precision=t+Math.max(r.e,r.sd())+4,s.rounding=1,o=r.d.length,o<32?(i=Math.ceil(o/3),e=(1/xi(4,i)).toString()):(i=16,e="2.3283064365386962890625e-10"),r=qn(s,1,r.times(e),new s(1),!0);for(var u,c=i,l=new s(8);c--;)u=r.times(r),r=a.minus(u.times(l.minus(u.times(l))));return Z(r,s.precision=t,s.rounding=n,!0)};_.hyperbolicSine=_.sinh=function(){var i,e,t,n,o=this,r=o.constructor;if(!o.isFinite()||o.isZero())return new r(o);if(e=r.precision,t=r.rounding,r.precision=e+Math.max(o.e,o.sd())+4,r.rounding=1,n=o.d.length,n<3)o=qn(r,2,o,o,!0);else{i=1.4*Math.sqrt(n),i=i>16?16:i|0,o=o.times(1/xi(5,i)),o=qn(r,2,o,o,!0);for(var s,a=new r(5),u=new r(16),c=new r(20);i--;)s=o.times(o),o=o.times(a.plus(s.times(u.times(s).plus(c))))}return r.precision=e,r.rounding=t,Z(o,e,t,!0)};_.hyperbolicTangent=_.tanh=function(){var i,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(i=n.precision,e=n.rounding,n.precision=i+7,n.rounding=1,Be(t.sinh(),t.cosh(),n.precision=i,n.rounding=e)):new n(t.s)};_.inverseCosine=_.acos=function(){var i,e=this,t=e.constructor,n=e.abs().cmp(1),o=t.precision,r=t.rounding;return n!==-1?n===0?e.isNeg()?Mt(t,o,r):new t(0):new t(NaN):e.isZero()?Mt(t,o+4,r).times(.5):(t.precision=o+6,t.rounding=1,e=e.asin(),i=Mt(t,o+4,r).times(.5),t.precision=o,t.rounding=r,i.minus(e))};_.inverseHyperbolicCosine=_.acosh=function(){var i,e,t=this,n=t.constructor;return t.lte(1)?new n(t.eq(1)?0:NaN):t.isFinite()?(i=n.precision,e=n.rounding,n.precision=i+Math.max(Math.abs(t.e),t.sd())+4,n.rounding=1,oe=!1,t=t.times(t).minus(1).sqrt().plus(t),oe=!0,n.precision=i,n.rounding=e,t.ln()):new n(t)};_.inverseHyperbolicSine=_.asinh=function(){var i,e,t=this,n=t.constructor;return!t.isFinite()||t.isZero()?new n(t):(i=n.precision,e=n.rounding,n.precision=i+2*Math.max(Math.abs(t.e),t.sd())+6,n.rounding=1,oe=!1,t=t.times(t).plus(1).sqrt().plus(t),oe=!0,n.precision=i,n.rounding=e,t.ln())};_.inverseHyperbolicTangent=_.atanh=function(){var i,e,t,n,o=this,r=o.constructor;return o.isFinite()?o.e>=0?new r(o.abs().eq(1)?o.s/0:o.isZero()?o:NaN):(i=r.precision,e=r.rounding,n=o.sd(),Math.max(n,i)<2*-o.e-1?Z(new r(o),i,e,!0):(r.precision=t=n-o.e,o=Be(o.plus(1),new r(1).minus(o),t+i,1),r.precision=i+4,r.rounding=1,o=o.ln(),r.precision=i,r.rounding=e,o.times(.5))):new r(NaN)};_.inverseSine=_.asin=function(){var i,e,t,n,o=this,r=o.constructor;return o.isZero()?new r(o):(e=o.abs().cmp(1),t=r.precision,n=r.rounding,e!==-1?e===0?(i=Mt(r,t+4,n).times(.5),i.s=o.s,i):new r(NaN):(r.precision=t+6,r.rounding=1,o=o.div(new r(1).minus(o.times(o)).sqrt().plus(1)).atan(),r.precision=t,r.rounding=n,o.times(2)))};_.inverseTangent=_.atan=function(){var i,e,t,n,o,r,s,a,u,c=this,l=c.constructor,m=l.precision,d=l.rounding;if(c.isFinite()){if(c.isZero())return new l(c);if(c.abs().eq(1)&&m+4<=jr)return s=Mt(l,m+4,d).times(.25),s.s=c.s,s}else{if(!c.s)return new l(NaN);if(m+4<=jr)return s=Mt(l,m+4,d).times(.5),s.s=c.s,s}for(l.precision=a=m+10,l.rounding=1,t=Math.min(28,a/te+2|0),i=t;i;--i)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(oe=!1,e=Math.ceil(a/te),n=1,u=c.times(c),s=new l(c),o=c;i!==-1;)if(o=o.times(u),r=s.minus(o.div(n+=2)),o=o.times(u),s=r.plus(o.div(n+=2)),s.d[e]!==void 0)for(i=e;s.d[i]===r.d[i]&&i--;);return t&&(s=s.times(2<<t-1)),oe=!0,Z(s,l.precision=m,l.rounding=d,!0)};_.isFinite=function(){return!!this.d};_.isInteger=_.isInt=function(){return!!this.d&&nt(this.e/te)>this.d.length-2};_.isNaN=function(){return!this.s};_.isNegative=_.isNeg=function(){return this.s<0};_.isPositive=_.isPos=function(){return this.s>0};_.isZero=function(){return!!this.d&&this.d[0]===0};_.lessThan=_.lt=function(i){return this.cmp(i)<0};_.lessThanOrEqualTo=_.lte=function(i){return this.cmp(i)<1};_.logarithm=_.log=function(i){var e,t,n,o,r,s,a,u,c=this,l=c.constructor,m=l.precision,d=l.rounding,p=5;if(i==null)i=new l(10),e=!0;else{if(i=new l(i),t=i.d,i.s<0||!t||!t[0]||i.eq(1))return new l(NaN);e=i.eq(10)}if(t=c.d,c.s<0||!t||!t[0]||c.eq(1))return new l(t&&!t[0]?-1/0:c.s!=1?NaN:t?0:1/0);if(e)if(t.length>1)r=!0;else{for(o=t[0];o%10===0;)o/=10;r=o!==1}if(oe=!1,a=m+p,s=mn(c,a),n=e?Ti(l,a+10):mn(i,a),u=Be(s,n,a,1),xo(u.d,o=m,d))do if(a+=10,s=mn(c,a),n=e?Ti(l,a+10):mn(i,a),u=Be(s,n,a,1),!r){+Ye(u.d).slice(o+1,o+15)+1==1e14&&(u=Z(u,m+1,0));break}while(xo(u.d,o+=10,d));return oe=!0,Z(u,m,d)};_.minus=_.sub=function(i){var e,t,n,o,r,s,a,u,c,l,m,d,p=this,y=p.constructor;if(i=new y(i),!p.d||!i.d)return!p.s||!i.s?i=new y(NaN):p.d?i.s=-i.s:i=new y(i.d||p.s!==i.s?p:NaN),i;if(p.s!=i.s)return i.s=-i.s,p.plus(i);if(c=p.d,d=i.d,a=y.precision,u=y.rounding,!c[0]||!d[0]){if(d[0])i.s=-i.s;else if(c[0])i=new y(p);else return new y(u===3?-0:0);return oe?Z(i,a,u):i}if(t=nt(i.e/te),l=nt(p.e/te),c=c.slice(),r=l-t,r){for(m=r<0,m?(e=c,r=-r,s=d.length):(e=d,t=l,s=c.length),n=Math.max(Math.ceil(a/te),s)+2,r>n&&(r=n,e.length=1),e.reverse(),n=r;n--;)e.push(0);e.reverse()}else{for(n=c.length,s=d.length,m=n<s,m&&(s=n),n=0;n<s;n++)if(c[n]!=d[n]){m=c[n]<d[n];break}r=0}for(m&&(e=c,c=d,d=e,i.s=-i.s),s=c.length,n=d.length-s;n>0;--n)c[s++]=0;for(n=d.length;n>r;){if(c[--n]<d[n]){for(o=n;o&&c[--o]===0;)c[o]=_t-1;--c[o],c[n]+=_t}c[n]-=d[n]}for(;c[--s]===0;)c.pop();for(;c[0]===0;c.shift())--t;return c[0]?(i.d=c,i.e=Bi(c,t),oe?Z(i,a,u):i):new y(u===3?-0:0)};_.modulo=_.mod=function(i){var e,t=this,n=t.constructor;return i=new n(i),!t.d||!i.s||i.d&&!i.d[0]?new n(NaN):!i.d||t.d&&!t.d[0]?Z(new n(t),n.precision,n.rounding):(oe=!1,n.modulo==9?(e=Be(t,i.abs(),0,3,1),e.s*=i.s):e=Be(t,i,0,n.modulo,1),e=e.times(i),oe=!0,t.minus(e))};_.naturalExponential=_.exp=function(){return Yr(this)};_.naturalLogarithm=_.ln=function(){return mn(this)};_.negated=_.neg=function(){var i=new this.constructor(this);return i.s=-i.s,Z(i)};_.plus=_.add=function(i){var e,t,n,o,r,s,a,u,c,l,m=this,d=m.constructor;if(i=new d(i),!m.d||!i.d)return!m.s||!i.s?i=new d(NaN):m.d||(i=new d(i.d||m.s===i.s?m:NaN)),i;if(m.s!=i.s)return i.s=-i.s,m.minus(i);if(c=m.d,l=i.d,a=d.precision,u=d.rounding,!c[0]||!l[0])return l[0]||(i=new d(m)),oe?Z(i,a,u):i;if(r=nt(m.e/te),n=nt(i.e/te),c=c.slice(),o=r-n,o){for(o<0?(t=c,o=-o,s=l.length):(t=l,n=r,s=c.length),r=Math.ceil(a/te),s=r>s?r+1:s+1,o>s&&(o=s,t.length=1),t.reverse();o--;)t.push(0);t.reverse()}for(s=c.length,o=l.length,s-o<0&&(o=s,t=l,l=c,c=t),e=0;o;)e=(c[--o]=c[o]+l[o]+e)/_t|0,c[o]%=_t;for(e&&(c.unshift(e),++n),s=c.length;c[--s]==0;)c.pop();return i.d=c,i.e=Bi(c,n),oe?Z(i,a,u):i};_.precision=_.sd=function(i){var e,t=this;if(i!==void 0&&i!==!!i&&i!==1&&i!==0)throw Error(dn+i);return t.d?(e=ou(t.d),i&&t.e+1>e&&(e=t.e+1)):e=NaN,e};_.round=function(){var i=this,e=i.constructor;return Z(new e(i),i.e+1,e.rounding)};_.sine=_.sin=function(){var i,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(i=n.precision,e=n.rounding,n.precision=i+Math.max(t.e,t.sd())+te,n.rounding=1,t=Il(n,au(n,t)),n.precision=i,n.rounding=e,Z(Ht>2?t.neg():t,i,e,!0)):new n(NaN)};_.squareRoot=_.sqrt=function(){var i,e,t,n,o,r,s=this,a=s.d,u=s.e,c=s.s,l=s.constructor;if(c!==1||!a||!a[0])return new l(!c||c<0&&(!a||a[0])?NaN:a?s:1/0);for(oe=!1,c=Math.sqrt(+s),c==0||c==1/0?(e=Ye(a),(e.length+u)%2==0&&(e+="0"),c=Math.sqrt(e),u=nt((u+1)/2)-(u<0||u%2),c==1/0?e="5e"+u:(e=c.toExponential(),e=e.slice(0,e.indexOf("e")+1)+u),n=new l(e)):n=new l(c.toString()),t=(u=l.precision)+3;;)if(r=n,n=r.plus(Be(s,r,t+2,1)).times(.5),Ye(r.d).slice(0,t)===(e=Ye(n.d)).slice(0,t))if(e=e.slice(t-3,t+1),e=="9999"||!o&&e=="4999"){if(!o&&(Z(r,u+1,0),r.times(r).eq(s))){n=r;break}t+=4,o=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(Z(n,u+1,1),i=!n.times(n).eq(s));break}return oe=!0,Z(n,u,l.rounding,i)};_.tangent=_.tan=function(){var i,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(i=n.precision,e=n.rounding,n.precision=i+10,n.rounding=1,t=t.sin(),t.s=1,t=Be(t,new n(1).minus(t.times(t)).sqrt(),i+10,0),n.precision=i,n.rounding=e,Z(Ht==2||Ht==4?t.neg():t,i,e,!0)):new n(NaN)};_.times=_.mul=function(i){var e,t,n,o,r,s,a,u,c,l=this,m=l.constructor,d=l.d,p=(i=new m(i)).d;if(i.s*=l.s,!d||!d[0]||!p||!p[0])return new m(!i.s||d&&!d[0]&&!p||p&&!p[0]&&!d?NaN:!d||!p?i.s/0:i.s*0);for(t=nt(l.e/te)+nt(i.e/te),u=d.length,c=p.length,u<c&&(r=d,d=p,p=r,s=u,u=c,c=s),r=[],s=u+c,n=s;n--;)r.push(0);for(n=c;--n>=0;){for(e=0,o=u+n;o>n;)a=r[o]+p[n]*d[o-n-1]+e,r[o--]=a%_t|0,e=a/_t|0;r[o]=(r[o]+e)%_t|0}for(;!r[--s];)r.pop();return e?++t:r.shift(),i.d=r,i.e=Bi(r,t),oe?Z(i,m.precision,m.rounding):i};_.toBinary=function(i,e){return Zr(this,2,i,e)};_.toDecimalPlaces=_.toDP=function(i,e){var t=this,n=t.constructor;return t=new n(t),i===void 0?t:(ft(i,0,pn),e===void 0?e=n.rounding:ft(e,0,8),Z(t,i+t.e+1,e))};_.toExponential=function(i,e){var t,n=this,o=n.constructor;return i===void 0?t=Gt(n,!0):(ft(i,0,pn),e===void 0?e=o.rounding:ft(e,0,8),n=Z(new o(n),i+1,e),t=Gt(n,!0,i+1)),n.isNeg()&&!n.isZero()?"-"+t:t};_.toFixed=function(i,e){var t,n,o=this,r=o.constructor;return i===void 0?t=Gt(o):(ft(i,0,pn),e===void 0?e=r.rounding:ft(e,0,8),n=Z(new r(o),i+o.e+1,e),t=Gt(n,!1,i+n.e+1)),o.isNeg()&&!o.isZero()?"-"+t:t};_.toFraction=function(i){var e,t,n,o,r,s,a,u,c,l,m,d,p=this,y=p.d,f=p.constructor;if(!y)return new f(p);if(c=t=new f(1),n=u=new f(0),e=new f(n),r=e.e=ou(y)-p.e-1,s=r%te,e.d[0]=De(10,s<0?te+s:s),i==null)i=r>0?e:c;else{if(a=new f(i),!a.isInt()||a.lt(c))throw Error(dn+a);i=a.gt(e)?r>0?e:c:a}for(oe=!1,a=new f(Ye(y)),l=f.precision,f.precision=r=y.length*te*2;m=Be(a,e,0,1,1),o=t.plus(m.times(n)),o.cmp(i)!=1;)t=n,n=o,o=c,c=u.plus(m.times(o)),u=o,o=e,e=a.minus(m.times(o)),a=o;return o=Be(i.minus(t),n,0,1,1),u=u.plus(o.times(c)),t=t.plus(o.times(n)),u.s=c.s=p.s,d=Be(c,n,r,1).minus(p).abs().cmp(Be(u,t,r,1).minus(p).abs())<1?[c,n]:[u,t],f.precision=l,oe=!0,d};_.toHexadecimal=_.toHex=function(i,e){return Zr(this,16,i,e)};_.toNearest=function(i,e){var t=this,n=t.constructor;if(t=new n(t),i==null){if(!t.d)return t;i=new n(1),e=n.rounding}else{if(i=new n(i),e===void 0?e=n.rounding:ft(e,0,8),!t.d)return i.s?t:i;if(!i.d)return i.s&&(i.s=t.s),i}return i.d[0]?(oe=!1,t=Be(t,i,0,e,1).times(i),oe=!0,Z(t)):(i.s=t.s,t=i),t};_.toNumber=function(){return+this};_.toOctal=function(i,e){return Zr(this,8,i,e)};_.toPower=_.pow=function(i){var e,t,n,o,r,s,a=this,u=a.constructor,c=+(i=new u(i));if(!a.d||!i.d||!a.d[0]||!i.d[0])return new u(De(+a,c));if(a=new u(a),a.eq(1))return a;if(n=u.precision,r=u.rounding,i.eq(1))return Z(a,n,r);if(e=nt(i.e/te),e>=i.d.length-1&&(t=c<0?-c:c)<=Pl)return o=iu(u,a,t,n),i.s<0?new u(1).div(o):Z(o,n,r);if(s=a.s,s<0){if(e<i.d.length-1)return new u(NaN);if((i.d[e]&1)==0&&(s=1),a.e==0&&a.d[0]==1&&a.d.length==1)return a.s=s,a}return t=De(+a,c),e=t==0||!isFinite(t)?nt(c*(Math.log("0."+Ye(a.d))/Math.LN10+a.e+1)):new u(t+"").e,e>u.maxE+1||e<u.minE-1?new u(e>0?s/0:0):(oe=!1,u.rounding=a.s=1,t=Math.min(12,(e+"").length),o=Yr(i.times(mn(a,n+t)),n),o.d&&(o=Z(o,n+5,1),xo(o.d,n,r)&&(e=n+10,o=Z(Yr(i.times(mn(a,e+t)),e),e+5,1),+Ye(o.d).slice(n+1,n+15)+1==1e14&&(o=Z(o,n+1,0)))),o.s=s,oe=!0,u.rounding=r,Z(o,n,r))};_.toPrecision=function(i,e){var t,n=this,o=n.constructor;return i===void 0?t=Gt(n,n.e<=o.toExpNeg||n.e>=o.toExpPos):(ft(i,1,pn),e===void 0?e=o.rounding:ft(e,0,8),n=Z(new o(n),i,e),t=Gt(n,i<=n.e||n.e<=o.toExpNeg,i)),n.isNeg()&&!n.isZero()?"-"+t:t};_.toSignificantDigits=_.toSD=function(i,e){var t=this,n=t.constructor;return i===void 0?(i=n.precision,e=n.rounding):(ft(i,1,pn),e===void 0?e=n.rounding:ft(e,0,8)),Z(new n(t),i,e)};_.toString=function(){var i=this,e=i.constructor,t=Gt(i,i.e<=e.toExpNeg||i.e>=e.toExpPos);return i.isNeg()&&!i.isZero()?"-"+t:t};_.truncated=_.trunc=function(){return Z(new this.constructor(this),this.e+1,1)};_.valueOf=_.toJSON=function(){var i=this,e=i.constructor,t=Gt(i,i.e<=e.toExpNeg||i.e>=e.toExpPos);return i.isNeg()?"-"+t:t};function Ye(i){var e,t,n,o=i.length-1,r="",s=i[0];if(o>0){for(r+=s,e=1;e<o;e++)n=i[e]+"",t=te-n.length,t&&(r+=ln(t)),r+=n;s=i[e],n=s+"",t=te-n.length,t&&(r+=ln(t))}else if(s===0)return"0";for(;s%10===0;)s/=10;return r+s}function ft(i,e,t){if(i!==~~i||i<e||i>t)throw Error(dn+i)}function xo(i,e,t,n){var o,r,s,a;for(r=i[0];r>=10;r/=10)--e;return--e<0?(e+=te,o=0):(o=Math.ceil((e+1)/te),e%=te),r=De(10,te-e),a=i[o]%r|0,n==null?e<3?(e==0?a=a/100|0:e==1&&(a=a/10|0),s=t<4&&a==99999||t>3&&a==49999||a==5e4||a==0):s=(t<4&&a+1==r||t>3&&a+1==r/2)&&(i[o+1]/r/100|0)==De(10,e-2)-1||(a==r/2||a==0)&&(i[o+1]/r/100|0)==0:e<4?(e==0?a=a/1e3|0:e==1?a=a/100|0:e==2&&(a=a/10|0),s=(n||t<4)&&a==9999||!n&&t>3&&a==4999):s=((n||t<4)&&a+1==r||!n&&t>3&&a+1==r/2)&&(i[o+1]/r/1e3|0)==De(10,e-3)-1,s}function Pi(i,e,t){for(var n,o=[0],r,s=0,a=i.length;s<a;){for(r=o.length;r--;)o[r]*=e;for(o[0]+=zr.indexOf(i.charAt(s++)),n=0;n<o.length;n++)o[n]>t-1&&(o[n+1]===void 0&&(o[n+1]=0),o[n+1]+=o[n]/t|0,o[n]%=t)}return o.reverse()}function hl(i,e){var t,n,o;if(e.isZero())return e;n=e.d.length,n<32?(t=Math.ceil(n/3),o=(1/xi(4,t)).toString()):(t=16,o="2.3283064365386962890625e-10"),i.precision+=t,e=qn(i,1,e.times(o),new i(1));for(var r=t;r--;){var s=e.times(e);e=s.times(s).minus(s).times(8).plus(1)}return i.precision-=t,e}var Be=function(){function i(n,o,r){var s,a=0,u=n.length;for(n=n.slice();u--;)s=n[u]*o+a,n[u]=s%r|0,a=s/r|0;return a&&n.unshift(a),n}function e(n,o,r,s){var a,u;if(r!=s)u=r>s?1:-1;else for(a=u=0;a<r;a++)if(n[a]!=o[a]){u=n[a]>o[a]?1:-1;break}return u}function t(n,o,r,s){for(var a=0;r--;)n[r]-=a,a=n[r]<o[r]?1:0,n[r]=a*s+n[r]-o[r];for(;!n[0]&&n.length>1;)n.shift()}return function(n,o,r,s,a,u){var c,l,m,d,p,y,f,b,g,A,w,h,I,T,B,x,C,S,R,F,V=n.constructor,$=n.s==o.s?1:-1,Y=n.d,D=o.d;if(!Y||!Y[0]||!D||!D[0])return new V(!n.s||!o.s||(Y?D&&Y[0]==D[0]:!D)?NaN:Y&&Y[0]==0||!D?$*0:$/0);for(u?(p=1,l=n.e-o.e):(u=_t,p=te,l=nt(n.e/p)-nt(o.e/p)),R=D.length,C=Y.length,g=new V($),A=g.d=[],m=0;D[m]==(Y[m]||0);m++);if(D[m]>(Y[m]||0)&&l--,r==null?(T=r=V.precision,s=V.rounding):a?T=r+(n.e-o.e)+1:T=r,T<0)A.push(1),y=!0;else{if(T=T/p+2|0,m=0,R==1){for(d=0,D=D[0],T++;(m<C||d)&&T--;m++)B=d*u+(Y[m]||0),A[m]=B/D|0,d=B%D|0;y=d||m<C}else{for(d=u/(D[0]+1)|0,d>1&&(D=i(D,d,u),Y=i(Y,d,u),R=D.length,C=Y.length),x=R,w=Y.slice(0,R),h=w.length;h<R;)w[h++]=0;F=D.slice(),F.unshift(0),S=D[0],D[1]>=u/2&&++S;do d=0,c=e(D,w,R,h),c<0?(I=w[0],R!=h&&(I=I*u+(w[1]||0)),d=I/S|0,d>1?(d>=u&&(d=u-1),f=i(D,d,u),b=f.length,h=w.length,c=e(f,w,b,h),c==1&&(d--,t(f,R<b?F:D,b,u))):(d==0&&(c=d=1),f=D.slice()),b=f.length,b<h&&f.unshift(0),t(w,f,h,u),c==-1&&(h=w.length,c=e(D,w,R,h),c<1&&(d++,t(w,R<h?F:D,h,u))),h=w.length):c===0&&(d++,w=[0]),A[m++]=d,c&&w[0]?w[h++]=Y[x]||0:(w=[Y[x]],h=1);while((x++<C||w[0]!==void 0)&&T--);y=w[0]!==void 0}A[0]||A.shift()}if(p==1)g.e=l,$a=y;else{for(m=1,d=A[0];d>=10;d/=10)m++;g.e=m+l*p-1,Z(g,a?r+g.e+1:r,s,y)}return g}}();function Z(i,e,t,n){var o,r,s,a,u,c,l,m,d,p=i.constructor;e:if(e!=null){if(m=i.d,!m)return i;for(o=1,a=m[0];a>=10;a/=10)o++;if(r=e-o,r<0)r+=te,s=e,l=m[d=0],u=l/De(10,o-s-1)%10|0;else if(d=Math.ceil((r+1)/te),a=m.length,d>=a)if(n){for(;a++<=d;)m.push(0);l=u=0,o=1,r%=te,s=r-te+1}else break e;else{for(l=a=m[d],o=1;a>=10;a/=10)o++;r%=te,s=r-te+o,u=s<0?0:l/De(10,o-s-1)%10|0}if(n=n||e<0||m[d+1]!==void 0||(s<0?l:l%De(10,o-s-1)),c=t<4?(u||n)&&(t==0||t==(i.s<0?3:2)):u>5||u==5&&(t==4||n||t==6&&(r>0?s>0?l/De(10,o-s):0:m[d-1])%10&1||t==(i.s<0?8:7)),e<1||!m[0])return m.length=0,c?(e-=i.e+1,m[0]=De(10,(te-e%te)%te),i.e=-e||0):m[0]=i.e=0,i;if(r==0?(m.length=d,a=1,d--):(m.length=d+1,a=De(10,te-r),m[d]=s>0?(l/De(10,o-s)%De(10,s)|0)*a:0),c)for(;;)if(d==0){for(r=1,s=m[0];s>=10;s/=10)r++;for(s=m[0]+=a,a=1;s>=10;s/=10)a++;r!=a&&(i.e++,m[0]==_t&&(m[0]=1));break}else{if(m[d]+=a,m[d]!=_t)break;m[d--]=0,a=1}for(r=m.length;m[--r]===0;)m.pop()}return oe&&(i.e>p.maxE?(i.d=null,i.e=NaN):i.e<p.minE&&(i.e=0,i.d=[0])),i}function Gt(i,e,t){if(!i.isFinite())return su(i);var n,o=i.e,r=Ye(i.d),s=r.length;return e?(t&&(n=t-s)>0?r=r.charAt(0)+"."+r.slice(1)+ln(n):s>1&&(r=r.charAt(0)+"."+r.slice(1)),r=r+(i.e<0?"e":"e+")+i.e):o<0?(r="0."+ln(-o-1)+r,t&&(n=t-s)>0&&(r+=ln(n))):o>=s?(r+=ln(o+1-s),t&&(n=t-o-1)>0&&(r=r+"."+ln(n))):((n=o+1)<s&&(r=r.slice(0,n)+"."+r.slice(n)),t&&(n=t-s)>0&&(o+1===s&&(r+="."),r+=ln(n))),r}function Bi(i,e){var t=i[0];for(e*=te;t>=10;t/=10)e++;return e}function Ti(i,e,t){if(e>kl)throw oe=!0,t&&(i.precision=t),Error(Ja);return Z(new i(ki),e,1,!0)}function Mt(i,e,t){if(e>jr)throw Error(Ja);return Z(new i(hi),e,t,!0)}function ou(i){var e=i.length-1,t=e*te+1;if(e=i[e],e){for(;e%10==0;e/=10)t--;for(e=i[0];e>=10;e/=10)t++}return t}function ln(i){for(var e="";i--;)e+="0";return e}function iu(i,e,t,n){var o,r=new i(1),s=Math.ceil(n/te+4);for(oe=!1;;){if(t%2&&(r=r.times(e),Ha(r.d,s)&&(o=!0)),t=nt(t/2),t===0){t=r.d.length-1,o&&r.d[t]===0&&++r.d[t];break}e=e.times(e),Ha(e.d,s)}return oe=!0,r}function Ya(i){return i.d[i.d.length-1]&1}function ru(i,e,t){for(var n,o=new i(e[0]),r=0;++r<e.length;)if(n=new i(e[r]),n.s)o[t](n)&&(o=n);else{o=n;break}return o}function Yr(i,e){var t,n,o,r,s,a,u,c=0,l=0,m=0,d=i.constructor,p=d.rounding,y=d.precision;if(!i.d||!i.d[0]||i.e>17)return new d(i.d?i.d[0]?i.s<0?0:1/0:1:i.s?i.s<0?0:i:0/0);for(e==null?(oe=!1,u=y):u=e,a=new d(.03125);i.e>-2;)i=i.times(a),m+=5;for(n=Math.log(De(2,m))/Math.LN10*2+5|0,u+=n,t=r=s=new d(1),d.precision=u;;){if(r=Z(r.times(i),u,1),t=t.times(++l),a=s.plus(Be(r,t,u,1)),Ye(a.d).slice(0,u)===Ye(s.d).slice(0,u)){for(o=m;o--;)s=Z(s.times(s),u,1);if(e==null)if(c<3&&xo(s.d,u-n,p,c))d.precision=u+=10,t=r=a=new d(1),l=0,c++;else return Z(s,d.precision=y,p,oe=!0);else return d.precision=y,s}s=a}}function mn(i,e){var t,n,o,r,s,a,u,c,l,m,d,p=1,y=10,f=i,b=f.d,g=f.constructor,A=g.rounding,w=g.precision;if(f.s<0||!b||!b[0]||!f.e&&b[0]==1&&b.length==1)return new g(b&&!b[0]?-1/0:f.s!=1?NaN:b?0:f);if(e==null?(oe=!1,l=w):l=e,g.precision=l+=y,t=Ye(b),n=t.charAt(0),Math.abs(r=f.e)<15e14){for(;n<7&&n!=1||n==1&&t.charAt(1)>3;)f=f.times(i),t=Ye(f.d),n=t.charAt(0),p++;r=f.e,n>1?(f=new g("0."+t),r++):f=new g(n+"."+t.slice(1))}else return c=Ti(g,l+2,w).times(r+""),f=mn(new g(n+"."+t.slice(1)),l-y).plus(c),g.precision=w,e==null?Z(f,w,A,oe=!0):f;for(m=f,u=s=f=Be(f.minus(1),f.plus(1),l,1),d=Z(f.times(f),l,1),o=3;;){if(s=Z(s.times(d),l,1),c=u.plus(Be(s,new g(o),l,1)),Ye(c.d).slice(0,l)===Ye(u.d).slice(0,l))if(u=u.times(2),r!==0&&(u=u.plus(Ti(g,l+2,w).times(r+""))),u=Be(u,new g(p),l,1),e==null)if(xo(u.d,l-y,A,a))g.precision=l+=y,c=s=f=Be(m.minus(1),m.plus(1),l,1),d=Z(f.times(f),l,1),o=a=1;else return Z(u,g.precision=w,A,oe=!0);else return g.precision=w,u;u=c,o+=2}}function su(i){return String(i.s*i.s/0)}function Hr(i,e){var t,n,o;for((t=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(t<0&&(t=n),t+=+e.slice(n+1),e=e.substring(0,n)):t<0&&(t=e.length),n=0;e.charCodeAt(n)===48;n++);for(o=e.length;e.charCodeAt(o-1)===48;--o);if(e=e.slice(n,o),e){if(o-=n,i.e=t=t-n-1,i.d=[],n=(t+1)%te,t<0&&(n+=te),n<o){for(n&&i.d.push(+e.slice(0,n)),o-=te;n<o;)i.d.push(+e.slice(n,n+=te));e=e.slice(n),n=te-e.length}else n-=o;for(;n--;)e+="0";i.d.push(+e),oe&&(i.e>i.constructor.maxE?(i.d=null,i.e=NaN):i.e<i.constructor.minE&&(i.e=0,i.d=[0]))}else i.e=0,i.d=[0];return i}function Tl(i,e){var t,n,o,r,s,a,u,c,l;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),nu.test(e))return Hr(i,e)}else if(e==="Infinity"||e==="NaN")return+e||(i.s=NaN),i.e=NaN,i.d=null,i;if(Al.test(e))t=16,e=e.toLowerCase();else if(gl.test(e))t=2;else if(wl.test(e))t=8;else throw Error(dn+e);for(r=e.search(/p/i),r>0?(u=+e.slice(r+1),e=e.substring(2,r)):e=e.slice(2),r=e.indexOf("."),s=r>=0,n=i.constructor,s&&(e=e.replace(".",""),a=e.length,r=a-r,o=iu(n,new n(t),r,r*2)),c=Pi(e,t,_t),l=c.length-1,r=l;c[r]===0;--r)c.pop();return r<0?new n(i.s*0):(i.e=Bi(c,l),i.d=c,oe=!1,s&&(i=Be(i,o,a*4)),u&&(i=i.times(Math.abs(u)<54?De(2,u):So.pow(2,u))),oe=!0,i)}function Il(i,e){var t,n=e.d.length;if(n<3)return e.isZero()?e:qn(i,2,e,e);t=1.4*Math.sqrt(n),t=t>16?16:t|0,e=e.times(1/xi(5,t)),e=qn(i,2,e,e);for(var o,r=new i(5),s=new i(16),a=new i(20);t--;)o=e.times(e),e=e.times(r.plus(o.times(s.times(o).minus(a))));return e}function qn(i,e,t,n,o){var r,s,a,u,c=1,l=i.precision,m=Math.ceil(l/te);for(oe=!1,u=t.times(t),a=new i(n);;){if(s=Be(a.times(u),new i(e++*e++),l,1),a=o?n.plus(s):n.minus(s),n=Be(s.times(u),new i(e++*e++),l,1),s=a.plus(n),s.d[m]!==void 0){for(r=m;s.d[r]===a.d[r]&&r--;);if(r==-1)break}r=a,a=n,n=s,s=r,c++}return oe=!0,s.d.length=m+1,s}function xi(i,e){for(var t=i;--e;)t*=i;return t}function au(i,e){var t,n=e.s<0,o=Mt(i,i.precision,1),r=o.times(.5);if(e=e.abs(),e.lte(r))return Ht=n?4:1,e;if(t=e.divToInt(o),t.isZero())Ht=n?3:2;else{if(e=e.minus(t.times(o)),e.lte(r))return Ht=Ya(t)?n?2:3:n?4:1,e;Ht=Ya(t)?n?1:4:n?3:2}return e.minus(o).abs()}function Zr(i,e,t,n){var o,r,s,a,u,c,l,m,d,p=i.constructor,y=t!==void 0;if(y?(ft(t,1,pn),n===void 0?n=p.rounding:ft(n,0,8)):(t=p.precision,n=p.rounding),!i.isFinite())l=su(i);else{for(l=Gt(i),s=l.indexOf("."),y?(o=2,e==16?t=t*4-3:e==8&&(t=t*3-2)):o=e,s>=0&&(l=l.replace(".",""),d=new p(1),d.e=l.length-s,d.d=Pi(Gt(d),10,o),d.e=d.d.length),m=Pi(l,10,o),r=u=m.length;m[--u]==0;)m.pop();if(!m[0])l=y?"0p+0":"0";else{if(s<0?r--:(i=new p(i),i.d=m,i.e=r,i=Be(i,d,t,n,0,o),m=i.d,r=i.e,c=$a),s=m[t],a=o/2,c=c||m[t+1]!==void 0,c=n<4?(s!==void 0||c)&&(n===0||n===(i.s<0?3:2)):s>a||s===a&&(n===4||c||n===6&&m[t-1]&1||n===(i.s<0?8:7)),m.length=t,c)for(;++m[--t]>o-1;)m[t]=0,t||(++r,m.unshift(1));for(u=m.length;!m[u-1];--u);for(s=0,l="";s<u;s++)l+=zr.charAt(m[s]);if(y){if(u>1)if(e==16||e==8){for(s=e==16?4:3,--u;u%s;u++)l+="0";for(m=Pi(l,o,e),u=m.length;!m[u-1];--u);for(s=1,l="1.";s<u;s++)l+=zr.charAt(m[s])}else l=l.charAt(0)+"."+l.slice(1);l=l+(r<0?"p":"p+")+r}else if(r<0){for(;++r;)l="0"+l;l="0."+l}else if(++r>u)for(r-=u;r--;)l+="0";else r<u&&(l=l.slice(0,r)+"."+l.slice(r))}l=(e==16?"0x":e==2?"0b":e==8?"0o":"")+l}return i.s<0?"-"+l:l}function Ha(i,e){if(i.length>e)return i.length=e,!0}function Bl(i){return new this(i).abs()}function xl(i){return new this(i).acos()}function Sl(i){return new this(i).acosh()}function Kl(i,e){return new this(i).plus(e)}function Cl(i){return new this(i).asin()}function Rl(i){return new this(i).asinh()}function Ll(i){return new this(i).atan()}function Ol(i){return new this(i).atanh()}function Nl(i,e){i=new this(i),e=new this(e);var t,n=this.precision,o=this.rounding,r=n+4;return!i.s||!e.s?t=new this(NaN):!i.d&&!e.d?(t=Mt(this,r,1).times(e.s>0?.25:.75),t.s=i.s):!e.d||i.isZero()?(t=e.s<0?Mt(this,n,o):new this(0),t.s=i.s):!i.d||e.isZero()?(t=Mt(this,r,1).times(.5),t.s=i.s):e.s<0?(this.precision=r,this.rounding=1,t=this.atan(Be(i,e,r,1)),e=Mt(this,r,1),this.precision=n,this.rounding=o,t=i.s<0?t.minus(e):t.plus(e)):t=this.atan(Be(i,e,r,1)),t}function Ml(i){return new this(i).cbrt()}function _l(i){return Z(i=new this(i),i.e+1,2)}function Vl(i,e,t){return new this(i).clamp(e,t)}function vl(i){if(!i||typeof i!="object")throw Error(Ii+"Object expected");var e,t,n,o=i.defaults===!0,r=["precision",1,pn,"rounding",0,8,"toExpNeg",-Wn,0,"toExpPos",0,Wn,"maxE",0,Wn,"minE",-Wn,0,"modulo",0,9];for(e=0;e<r.length;e+=3)if(t=r[e],o&&(this[t]=Qr[t]),(n=i[t])!==void 0)if(nt(n)===n&&n>=r[e+1]&&n<=r[e+2])this[t]=n;else throw Error(dn+t+": "+n);if(t="crypto",o&&(this[t]=Qr[t]),(n=i[t])!==void 0)if(n===!0||n===!1||n===0||n===1)if(n)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[t]=!0;else throw Error(eu);else this[t]=!1;else throw Error(dn+t+": "+n);return this}function El(i){return new this(i).cos()}function Fl(i){return new this(i).cosh()}function uu(i){var e,t,n;function o(r){var s,a,u,c=this;if(!(c instanceof o))return new o(r);if(c.constructor=o,Za(r)){c.s=r.s,oe?!r.d||r.e>o.maxE?(c.e=NaN,c.d=null):r.e<o.minE?(c.e=0,c.d=[0]):(c.e=r.e,c.d=r.d.slice()):(c.e=r.e,c.d=r.d?r.d.slice():r.d);return}if(u=typeof r,u==="number"){if(r===0){c.s=1/r<0?-1:1,c.e=0,c.d=[0];return}if(r<0?(r=-r,c.s=-1):c.s=1,r===~~r&&r<1e7){for(s=0,a=r;a>=10;a/=10)s++;oe?s>o.maxE?(c.e=NaN,c.d=null):s<o.minE?(c.e=0,c.d=[0]):(c.e=s,c.d=[r]):(c.e=s,c.d=[r]);return}else if(r*0!==0){r||(c.s=NaN),c.e=NaN,c.d=null;return}return Hr(c,r.toString())}else if(u!=="string")throw Error(dn+r);return(a=r.charCodeAt(0))===45?(r=r.slice(1),c.s=-1):(a===43&&(r=r.slice(1)),c.s=1),nu.test(r)?Hr(c,r):Tl(c,r)}if(o.prototype=_,o.ROUND_UP=0,o.ROUND_DOWN=1,o.ROUND_CEIL=2,o.ROUND_FLOOR=3,o.ROUND_HALF_UP=4,o.ROUND_HALF_DOWN=5,o.ROUND_HALF_EVEN=6,o.ROUND_HALF_CEIL=7,o.ROUND_HALF_FLOOR=8,o.EUCLID=9,o.config=o.set=vl,o.clone=uu,o.isDecimal=Za,o.abs=Bl,o.acos=xl,o.acosh=Sl,o.add=Kl,o.asin=Cl,o.asinh=Rl,o.atan=Ll,o.atanh=Ol,o.atan2=Nl,o.cbrt=Ml,o.ceil=_l,o.clamp=Vl,o.cos=El,o.cosh=Fl,o.div=Dl,o.exp=Wl,o.floor=ql,o.hypot=Ul,o.ln=Gl,o.log=Xl,o.log10=Ql,o.log2=zl,o.max=jl,o.min=Yl,o.mod=Hl,o.mul=Zl,o.pow=$l,o.random=Jl,o.round=em,o.sign=tm,o.sin=nm,o.sinh=om,o.sqrt=im,o.sub=rm,o.sum=sm,o.tan=am,o.tanh=um,o.trunc=cm,i===void 0&&(i={}),i&&i.defaults!==!0)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],e=0;e<n.length;)i.hasOwnProperty(t=n[e++])||(i[t]=this[t]);return o.config(i),o}function Dl(i,e){return new this(i).div(e)}function Wl(i){return new this(i).exp()}function ql(i){return Z(i=new this(i),i.e+1,3)}function Ul(){var i,e,t=new this(0);for(oe=!1,i=0;i<arguments.length;)if(e=new this(arguments[i++]),e.d)t.d&&(t=t.plus(e.times(e)));else{if(e.s)return oe=!0,new this(1/0);t=e}return oe=!0,t.sqrt()}function Za(i){return i instanceof So||i&&i.toStringTag===tu||!1}function Gl(i){return new this(i).ln()}function Xl(i,e){return new this(i).log(e)}function zl(i){return new this(i).log(2)}function Ql(i){return new this(i).log(10)}function jl(){return ru(this,arguments,"lt")}function Yl(){return ru(this,arguments,"gt")}function Hl(i,e){return new this(i).mod(e)}function Zl(i,e){return new this(i).mul(e)}function $l(i,e){return new this(i).pow(e)}function Jl(i){var e,t,n,o,r=0,s=new this(1),a=[];if(i===void 0?i=this.precision:ft(i,1,pn),n=Math.ceil(i/te),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(n));r<n;)o=e[r],o>=429e7?e[r]=crypto.getRandomValues(new Uint32Array(1))[0]:a[r++]=o%1e7;else if(crypto.randomBytes){for(e=crypto.randomBytes(n*=4);r<n;)o=e[r]+(e[r+1]<<8)+(e[r+2]<<16)+((e[r+3]&127)<<24),o>=214e7?crypto.randomBytes(4).copy(e,r):(a.push(o%1e7),r+=4);r=n/4}else throw Error(eu);else for(;r<n;)a[r++]=Math.random()*1e7|0;for(n=a[--r],i%=te,n&&i&&(o=De(10,te-i),a[r]=(n/o|0)*o);a[r]===0;r--)a.pop();if(r<0)t=0,a=[0];else{for(t=-1;a[0]===0;t-=te)a.shift();for(n=1,o=a[0];o>=10;o/=10)n++;n<te&&(t-=te-n)}return s.e=t,s.d=a,s}function em(i){return Z(i=new this(i),i.e+1,this.rounding)}function tm(i){return i=new this(i),i.d?i.d[0]?i.s:0*i.s:i.s||NaN}function nm(i){return new this(i).sin()}function om(i){return new this(i).sinh()}function im(i){return new this(i).sqrt()}function rm(i,e){return new this(i).sub(e)}function sm(){var i=0,e=arguments,t=new this(e[i]);for(oe=!1;t.s&&++i<e.length;)t=t.plus(e[i]);return oe=!0,Z(t,this.precision,this.rounding)}function am(i){return new this(i).tan()}function um(i){return new this(i).tanh()}function cm(i){return Z(i=new this(i),i.e+1,1)}_[Symbol.for("nodejs.util.inspect.custom")]=_.toString;_[Symbol.toStringTag]="Decimal";var So=_.constructor=uu(Qr);ki=new So(ki);hi=new So(hi);var L=So;var fu=le(require("big.js")),Lo=le(require("bn.js"));var cu=le(require("toformat")),lm=cu.default,Ko=lm;var Co=le(require("big.js")),mu=le(require("bn.js")),du=le(require("decimal.js-light"));var Un=le(require("bn.js"));var lu=9007199254740991;function j(i){let e=me("Raydium_parseBigNumberish");if(i instanceof Un.default)return i;if(typeof i=="string"){if(i.match(/^-?[0-9]+$/))return new Un.default(i);e.logWithError(`invalid BigNumberish string: ${i}`)}return typeof i=="number"?(i%1&&e.logWithError(`BigNumberish number underflow: ${i}`),(i>=lu||i<=-lu)&&e.logWithError(`BigNumberish number overflow: ${i}`),new Un.default(String(i))):typeof i=="bigint"?new Un.default(i.toString()):(e.error(`invalid BigNumberish value: ${i}`),new Un.default(0))}var Si=me("module/fraction"),$r=Ko(Co.default),Ro=Ko(du.default),dm={[0]:Ro.ROUND_DOWN,[1]:Ro.ROUND_HALF_UP,[2]:Ro.ROUND_UP},pm={[0]:Co.default.roundDown,[1]:Co.default.roundHalfUp,[2]:Co.default.roundUp},ge=class{constructor(e,t=new mu.default(1)){this.numerator=j(e),this.denominator=j(t)}get quotient(){return this.numerator.div(this.denominator)}invert(){return new ge(this.denominator,this.numerator)}add(e){let t=e instanceof ge?e:new ge(j(e));return this.denominator.eq(t.denominator)?new ge(this.numerator.add(t.numerator),this.denominator):new ge(this.numerator.mul(t.denominator).add(t.numerator.mul(this.denominator)),this.denominator.mul(t.denominator))}sub(e){let t=e instanceof ge?e:new ge(j(e));return this.denominator.eq(t.denominator)?new ge(this.numerator.sub(t.numerator),this.denominator):new ge(this.numerator.mul(t.denominator).sub(t.numerator.mul(this.denominator)),this.denominator.mul(t.denominator))}mul(e){let t=e instanceof ge?e:new ge(j(e));return new ge(this.numerator.mul(t.numerator),this.denominator.mul(t.denominator))}div(e){let t=e instanceof ge?e:new ge(j(e));return new ge(this.numerator.mul(t.denominator),this.denominator.mul(t.numerator))}toSignificant(e,t={groupSeparator:""},n=1){Number.isInteger(e)||Si.logWithError(`${e} is not an integer.`),e<=0&&Si.logWithError(`${e} is not positive.`),Ro.set({precision:e+1,rounding:dm[n]});let o=new Ro(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(e);return o.toFormat(o.decimalPlaces(),t)}toFixed(e,t={groupSeparator:""},n=1){return Number.isInteger(e)||Si.logWithError(`${e} is not an integer.`),e<0&&Si.logWithError(`${e} is negative.`),$r.DP=e,$r.RM=pm[n]||1,new $r(this.numerator.toString()).div(this.denominator.toString()).toFormat(e,t)}isZero(){return this.numerator.isZero()}};var fm=me("Raydium_amount"),pu=Ko(fu.default);function ym(i,e){let t="0",n="0";if(i.includes(".")){let o=i.split(".");o.length===2?([t,n]=o,n=n.padEnd(e,"0")):fm.logWithError(`invalid number string, num: ${i}`)}else t=i;return[t,n.slice(0,e)||n]}var Te=class extends ge{constructor(t,n,o=!0,r){let s=new Lo.default(0),a=Jr.pow(new Lo.default(t.decimals));if(o)s=j(n);else{let u=new Lo.default(0),c=new Lo.default(0);if(typeof n=="string"||typeof n=="number"||typeof n=="bigint"){let[l,m]=ym(n.toString(),t.decimals);u=j(l),c=j(m)}u=u.mul(a),s=u.add(c)}super(s,a);this.logger=me(r||"TokenAmount"),this.token=t}get raw(){return this.numerator}isZero(){return this.raw.isZero()}gt(t){return this.token.equals(t.token)||this.logger.logWithError("gt token not equals"),this.raw.gt(t.raw)}lt(t){return this.token.equals(t.token)||this.logger.logWithError("lt token not equals"),this.raw.lt(t.raw)}add(t){return this.token.equals(t.token)||this.logger.logWithError("add token not equals"),new Te(this.token,this.raw.add(t.raw))}subtract(t){return this.token.equals(t.token)||this.logger.logWithError("sub token not equals"),new Te(this.token,this.raw.sub(t.raw))}toSignificant(t=this.token.decimals,n,o=0){return super.toSignificant(t,n,o)}toFixed(t=this.token.decimals,n,o=0){return t>this.token.decimals&&this.logger.logWithError("decimals overflow"),super.toFixed(t,n,o)}toExact(t={groupSeparator:""}){return pu.DP=this.token.decimals,new pu(this.numerator.toString()).div(this.denominator.toString()).toFormat(t)}};var yu=require("@solana/web3.js"),es=require("@solana/spl-token"),Vt={chainId:101,address:yu.PublicKey.default.toBase58(),programId:es.TOKEN_PROGRAM_ID.toBase58(),decimals:9,symbol:"SOL",name:"solana",logoURI:"https://img.raydium.io/icon/So11111111111111111111111111111111111111112.png",tags:[],priority:2,type:"raydium",extensions:{coingeckoId:"solana"}},_e={chainId:101,address:"So11111111111111111111111111111111111111112",programId:es.TOKEN_PROGRAM_ID.toBase58(),decimals:9,symbol:"WSOL",name:"Wrapped SOL",logoURI:"https://img.raydium.io/icon/So11111111111111111111111111111111111111112.png",tags:[],priority:2,type:"raydium",extensions:{coingeckoId:"solana"}};var Ri=require("@solana/web3.js");var Pe=require("@solana/web3.js"),bu=require("@solana/spl-token");function k({pubkey:i,isSigner:e=!1,isWritable:t=!0}){return{pubkey:i,isWritable:t,isSigner:e}}var ts=[k({pubkey:bu.TOKEN_PROGRAM_ID,isWritable:!1}),k({pubkey:Pe.SystemProgram.programId,isWritable:!1}),k({pubkey:Pe.SYSVAR_RENT_PUBKEY,isWritable:!1})];function ns({publicKey:i,transformSol:e}){let t=os(i.toString());if(t instanceof Pe.PublicKey)return e&&t.equals(We)?Q:t;if(e&&t.toString()===We.toBase58())return Q;if(typeof t=="string"){if(t===Pe.PublicKey.default.toBase58())return Pe.PublicKey.default;try{return new Pe.PublicKey(t)}catch{throw new Error("invalid public key")}}throw new Error("invalid public key")}function os(i){try{return new Pe.PublicKey(i)}catch{return i}}var Ki=new Pe.PublicKey("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),fn=new Pe.PublicKey("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),ot=new Pe.PublicKey("SysvarRent111111111111111111111111111111111"),is=new Pe.PublicKey("SysvarC1ock11111111111111111111111111111111"),Zt=new Pe.PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),Ci=new Pe.PublicKey("Sysvar1nstructions1111111111111111111111111"),Gn=Pe.SystemProgram.programId,bp=new Pe.PublicKey("2cpMA1jNS4obgRz8XNg38QuSP83L1AXpUgfxPNcvnAGj"),gp=new Pe.PublicKey("Ea5SjE2Y6yvCeW5dYTn7PYMuW5ikXkvbGdcmSnXeaLjS"),Ap=new Pe.PublicKey("SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt"),wp=new Pe.PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"),Pp=new Pe.PublicKey("Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"),kp=new Pe.PublicKey("mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So"),hp=new Pe.PublicKey("7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj"),Tp=new Pe.PublicKey("USDH1SM1ojwWUga67PGrgFWUHibbjqMvuMaDkRJTgkX"),Ip=new Pe.PublicKey("NRVwhjBQiUPYtfDT5zRBVJajzFQHaBUNtC7SNVvqRFa"),Bp=new Pe.PublicKey("ANAxByE6G2WjFp7A4NqtWYXb3mgruyzZYg3spfxe6Lbo"),xp=new Pe.PublicKey("7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs"),Q=new Pe.PublicKey("So11111111111111111111111111111111111111112"),We=Pe.PublicKey.default;function At(i){return ns({publicKey:i,transformSol:!0})}var rs=class{constructor({mint:e,decimals:t,symbol:n,name:o,skipMint:r=!1,isToken2022:s=!1}){if(e===We.toBase58()||e instanceof Ri.PublicKey&&We.equals(e)){this.decimals=_e.decimals,this.symbol=_e.symbol,this.name=_e.name,this.mint=new Ri.PublicKey(_e.address),this.isToken2022=!1;return}this.decimals=t,this.symbol=n||e.toString().substring(0,6),this.name=o||e.toString().substring(0,6),this.mint=r?Ri.PublicKey.default:ns({publicKey:e}),this.isToken2022=s}equals(e){return this===e?!0:this.mint.equals(e.mint)}},Ke=rs;Ke.WSOL=ne