snapper-sdk
Version:
An SDK for building applications on top of Snapper.
1 lines • 82.2 kB
JavaScript
"use strict";var On=Object.create;var Ke=Object.defineProperty;var vn=Object.getOwnPropertyDescriptor;var Fn=Object.getOwnPropertyNames;var Vn=Object.getPrototypeOf,Un=Object.prototype.hasOwnProperty;var Wn=(e,t)=>{for(var n in t)Ke(e,n,{get:t[n],enumerable:!0})},Ot=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Fn(t))!Un.call(e,o)&&o!==n&&Ke(e,o,{get:()=>t[o],enumerable:!(r=vn(t,o))||r.enumerable});return e};var z=(e,t,n)=>(n=e!=null?On(Vn(e)):{},Ot(t||!e||!e.__esModule?Ke(n,"default",{value:e,enumerable:!0}):n,e)),qn=e=>Ot(Ke({},"__esModule",{value:!0}),e);var ao={};Wn(ao,{default:()=>ct});module.exports=qn(ao);var ge=require("@solana/web3.js");var Ft=require("@solana/web3.js");var Ae=require("lodash");var ut=class{constructor(t){this.logLevel=t.logLevel!==void 0?t.logLevel:0,this.name=t.name}set level(t){this.logLevel=t}get time(){return Date.now().toString()}get moduleName(){return this.name}isLogLevel(t){return t<=this.logLevel}error(...t){return this.isLogLevel(0)?(console.error(this.time,this.name,"sdk logger error",...t),this):this}logWithError(...t){let n=t.map(r=>typeof r=="object"?JSON.stringify(r):r).join(", ");throw new Error(n)}warning(...t){return this.isLogLevel(1)?(console.warn(this.time,this.name,"sdk logger warning",...t),this):this}info(...t){return this.isLogLevel(2)?(console.info(this.time,this.name,"sdk logger info",...t),this):this}debug(...t){return this.isLogLevel(3)?(console.debug(this.time,this.name,"sdk logger debug",...t),this):this}},vt={},Gn={};function G(e){let t=(0,Ae.get)(vt,e);if(!t){let n=(0,Ae.get)(Gn,e);t=new ut({name:e,logLevel:n}),(0,Ae.set)(vt,e,t)}return t}var Oe=require("@solana/spl-token"),lt=G("Raydium_accountInfo_util");async function Vt(e,t,n){let{batchRequest:r,commitment:o="confirmed",chunkCount:i=100}={batchRequest:!1,...n},s=ft(t,i),a=new Array(s.length).fill([]);if(r){let c=s.map(f=>{let p=e._buildArgs([f.map(m=>m.toBase58())],o,"base64");return{methodName:"getMultipleAccounts",args:p}}),u=ft(c,10);a=(await(await Promise.all(u.map(async f=>await e._rpcBatchRequest(f)))).flat()).map(f=>(f.error&<.logWithError(`failed to get info for multiple accounts, RPC_ERROR, ${f.error.message}`),f.result.value.map(p=>{if(p){let{data:m,executable:w,lamports:h,owner:x,rentEpoch:b}=p;return m.length!==2&&m[1]!=="base64"&<.logWithError("info must be base64 encoded, RPC_ERROR"),{data:Buffer.from(m[0],"base64"),executable:w,lamports:h,owner:new Ft.PublicKey(x),rentEpoch:b}}return null})))}else try{a=await Promise.all(s.map(c=>e.getMultipleAccountsInfo(c,o)))}catch(c){c instanceof Error&<.logWithError(`failed to get info for multiple accounts, RPC_ERROR, ${c.message}`)}return a.flat()}var te=z(require("bn.js"));var be=9e15,ue=1e9,pt="0123456789abcdef",Fe="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Ve="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",mt={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-be,maxE:be,crypto:!1},Gt,ne,B=!0,We="[DecimalError] ",ce=We+"Invalid argument: ",Ht=We+"Precision limit exceeded",jt=We+"crypto unavailable",zt="[object Decimal]",H=Math.floor,F=Math.pow,Hn=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,jn=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,zn=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,Yt=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Q=1e7,A=7,Yn=9007199254740991,Zn=Fe.length-1,dt=Ve.length-1,d={toStringTag:zt};d.absoluteValue=d.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),T(e)};d.ceil=function(){return T(new this.constructor(this),this.e+1,2)};d.clampedTo=d.clamp=function(e,t){var n,r=this,o=r.constructor;if(e=new o(e),t=new o(t),!e.s||!t.s)return new o(NaN);if(e.gt(t))throw Error(ce+t);return n=r.cmp(e),n<0?e:r.cmp(t)>0?t:new o(r)};d.comparedTo=d.cmp=function(e){var t,n,r,o,i=this,s=i.d,a=(e=new i.constructor(e)).d,c=i.s,u=e.s;if(!s||!a)return!c||!u?NaN:c!==u?c:s===a?0:!s^c<0?1:-1;if(!s[0]||!a[0])return s[0]?c:a[0]?-u:0;if(c!==u)return c;if(i.e!==e.e)return i.e>e.e^c<0?1:-1;for(r=s.length,o=a.length,t=0,n=r<o?r:o;t<n;++t)if(s[t]!==a[t])return s[t]>a[t]^c<0?1:-1;return r===o?0:r>o^c<0?1:-1};d.cosine=d.cos=function(){var e,t,n=this,r=n.constructor;return n.d?n.d[0]?(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+A,r.rounding=1,n=Xn(r,$t(r,n)),r.precision=e,r.rounding=t,T(ne==2||ne==3?n.neg():n,e,t,!0)):new r(1):new r(NaN)};d.cubeRoot=d.cbrt=function(){var e,t,n,r,o,i,s,a,c,u,l=this,f=l.constructor;if(!l.isFinite()||l.isZero())return new f(l);for(B=!1,i=l.s*F(l.s*l,1/3),!i||Math.abs(i)==1/0?(n=U(l.d),e=l.e,(i=(e-n.length+1)%3)&&(n+=i==1||i==-2?"0":"00"),i=F(n,1/3),e=H((e+1)/3)-(e%3==(e<0?-1:2)),i==1/0?n="5e"+e:(n=i.toExponential(),n=n.slice(0,n.indexOf("e")+1)+e),r=new f(n),r.s=l.s):r=new f(i.toString()),s=(e=f.precision)+3;;)if(a=r,c=a.times(a).times(a),u=c.plus(l),r=R(u.plus(l).times(a),u.plus(c),s+2,1),U(a.d).slice(0,s)===(n=U(r.d)).slice(0,s))if(n=n.slice(s-3,s+1),n=="9999"||!o&&n=="4999"){if(!o&&(T(a,e+1,0),a.times(a).times(a).eq(l))){r=a;break}s+=4,o=1}else{(!+n||!+n.slice(1)&&n.charAt(0)=="5")&&(T(r,e+1,1),t=!r.times(r).times(r).eq(l));break}return B=!0,T(r,e,f.rounding,t)};d.decimalPlaces=d.dp=function(){var e,t=this.d,n=NaN;if(t){if(e=t.length-1,n=(e-H(this.e/A))*A,e=t[e],e)for(;e%10==0;e/=10)n--;n<0&&(n=0)}return n};d.dividedBy=d.div=function(e){return R(this,new this.constructor(e))};d.dividedToIntegerBy=d.divToInt=function(e){var t=this,n=t.constructor;return T(R(t,new n(e),0,1,1),n.precision,n.rounding)};d.equals=d.eq=function(e){return this.cmp(e)===0};d.floor=function(){return T(new this.constructor(this),this.e+1,3)};d.greaterThan=d.gt=function(e){return this.cmp(e)>0};d.greaterThanOrEqualTo=d.gte=function(e){var t=this.cmp(e);return t==1||t===0};d.hyperbolicCosine=d.cosh=function(){var e,t,n,r,o,i=this,s=i.constructor,a=new s(1);if(!i.isFinite())return new s(i.s?1/0:NaN);if(i.isZero())return a;n=s.precision,r=s.rounding,s.precision=n+Math.max(i.e,i.sd())+4,s.rounding=1,o=i.d.length,o<32?(e=Math.ceil(o/3),t=(1/Ge(4,e)).toString()):(e=16,t="2.3283064365386962890625e-10"),i=ye(s,1,i.times(t),new s(1),!0);for(var c,u=e,l=new s(8);u--;)c=i.times(i),i=a.minus(c.times(l.minus(c.times(l))));return T(i,s.precision=n,s.rounding=r,!0)};d.hyperbolicSine=d.sinh=function(){var e,t,n,r,o=this,i=o.constructor;if(!o.isFinite()||o.isZero())return new i(o);if(t=i.precision,n=i.rounding,i.precision=t+Math.max(o.e,o.sd())+4,i.rounding=1,r=o.d.length,r<3)o=ye(i,2,o,o,!0);else{e=1.4*Math.sqrt(r),e=e>16?16:e|0,o=o.times(1/Ge(5,e)),o=ye(i,2,o,o,!0);for(var s,a=new i(5),c=new i(16),u=new i(20);e--;)s=o.times(o),o=o.times(a.plus(s.times(c.times(s).plus(u))))}return i.precision=t,i.rounding=n,T(o,t,n,!0)};d.hyperbolicTangent=d.tanh=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+7,r.rounding=1,R(n.sinh(),n.cosh(),r.precision=e,r.rounding=t)):new r(n.s)};d.inverseCosine=d.acos=function(){var e,t=this,n=t.constructor,r=t.abs().cmp(1),o=n.precision,i=n.rounding;return r!==-1?r===0?t.isNeg()?X(n,o,i):new n(0):new n(NaN):t.isZero()?X(n,o+4,i).times(.5):(n.precision=o+6,n.rounding=1,t=t.asin(),e=X(n,o+4,i).times(.5),n.precision=o,n.rounding=i,e.minus(t))};d.inverseHyperbolicCosine=d.acosh=function(){var e,t,n=this,r=n.constructor;return n.lte(1)?new r(n.eq(1)?0:NaN):n.isFinite()?(e=r.precision,t=r.rounding,r.precision=e+Math.max(Math.abs(n.e),n.sd())+4,r.rounding=1,B=!1,n=n.times(n).minus(1).sqrt().plus(n),B=!0,r.precision=e,r.rounding=t,n.ln()):new r(n)};d.inverseHyperbolicSine=d.asinh=function(){var e,t,n=this,r=n.constructor;return!n.isFinite()||n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+2*Math.max(Math.abs(n.e),n.sd())+6,r.rounding=1,B=!1,n=n.times(n).plus(1).sqrt().plus(n),B=!0,r.precision=e,r.rounding=t,n.ln())};d.inverseHyperbolicTangent=d.atanh=function(){var e,t,n,r,o=this,i=o.constructor;return o.isFinite()?o.e>=0?new i(o.abs().eq(1)?o.s/0:o.isZero()?o:NaN):(e=i.precision,t=i.rounding,r=o.sd(),Math.max(r,e)<2*-o.e-1?T(new i(o),e,t,!0):(i.precision=n=r-o.e,o=R(o.plus(1),new i(1).minus(o),n+e,1),i.precision=e+4,i.rounding=1,o=o.ln(),i.precision=e,i.rounding=t,o.times(.5))):new i(NaN)};d.inverseSine=d.asin=function(){var e,t,n,r,o=this,i=o.constructor;return o.isZero()?new i(o):(t=o.abs().cmp(1),n=i.precision,r=i.rounding,t!==-1?t===0?(e=X(i,n+4,r).times(.5),e.s=o.s,e):new i(NaN):(i.precision=n+6,i.rounding=1,o=o.div(new i(1).minus(o.times(o)).sqrt().plus(1)).atan(),i.precision=n,i.rounding=r,o.times(2)))};d.inverseTangent=d.atan=function(){var e,t,n,r,o,i,s,a,c,u=this,l=u.constructor,f=l.precision,p=l.rounding;if(u.isFinite()){if(u.isZero())return new l(u);if(u.abs().eq(1)&&f+4<=dt)return s=X(l,f+4,p).times(.25),s.s=u.s,s}else{if(!u.s)return new l(NaN);if(f+4<=dt)return s=X(l,f+4,p).times(.5),s.s=u.s,s}for(l.precision=a=f+10,l.rounding=1,n=Math.min(28,a/A+2|0),e=n;e;--e)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(B=!1,t=Math.ceil(a/A),r=1,c=u.times(u),s=new l(u),o=u;e!==-1;)if(o=o.times(c),i=s.minus(o.div(r+=2)),o=o.times(c),s=i.plus(o.div(r+=2)),s.d[t]!==void 0)for(e=t;s.d[e]===i.d[e]&&e--;);return n&&(s=s.times(2<<n-1)),B=!0,T(s,l.precision=f,l.rounding=p,!0)};d.isFinite=function(){return!!this.d};d.isInteger=d.isInt=function(){return!!this.d&&H(this.e/A)>this.d.length-2};d.isNaN=function(){return!this.s};d.isNegative=d.isNeg=function(){return this.s<0};d.isPositive=d.isPos=function(){return this.s>0};d.isZero=function(){return!!this.d&&this.d[0]===0};d.lessThan=d.lt=function(e){return this.cmp(e)<0};d.lessThanOrEqualTo=d.lte=function(e){return this.cmp(e)<1};d.logarithm=d.log=function(e){var t,n,r,o,i,s,a,c,u=this,l=u.constructor,f=l.precision,p=l.rounding,m=5;if(e==null)e=new l(10),t=!0;else{if(e=new l(e),n=e.d,e.s<0||!n||!n[0]||e.eq(1))return new l(NaN);t=e.eq(10)}if(n=u.d,u.s<0||!n||!n[0]||u.eq(1))return new l(n&&!n[0]?-1/0:u.s!=1?NaN:n?0:1/0);if(t)if(n.length>1)i=!0;else{for(o=n[0];o%10===0;)o/=10;i=o!==1}if(B=!1,a=f+m,s=ae(u,a),r=t?Ue(l,a+10):ae(e,a),c=R(s,r,a,1),ke(c.d,o=f,p))do if(a+=10,s=ae(u,a),r=t?Ue(l,a+10):ae(e,a),c=R(s,r,a,1),!i){+U(c.d).slice(o+1,o+15)+1==1e14&&(c=T(c,f+1,0));break}while(ke(c.d,o+=10,p));return B=!0,T(c,f,p)};d.minus=d.sub=function(e){var t,n,r,o,i,s,a,c,u,l,f,p,m=this,w=m.constructor;if(e=new w(e),!m.d||!e.d)return!m.s||!e.s?e=new w(NaN):m.d?e.s=-e.s:e=new w(e.d||m.s!==e.s?m:NaN),e;if(m.s!=e.s)return e.s=-e.s,m.plus(e);if(u=m.d,p=e.d,a=w.precision,c=w.rounding,!u[0]||!p[0]){if(p[0])e.s=-e.s;else if(u[0])e=new w(m);else return new w(c===3?-0:0);return B?T(e,a,c):e}if(n=H(e.e/A),l=H(m.e/A),u=u.slice(),i=l-n,i){for(f=i<0,f?(t=u,i=-i,s=p.length):(t=p,n=l,s=u.length),r=Math.max(Math.ceil(a/A),s)+2,i>r&&(i=r,t.length=1),t.reverse(),r=i;r--;)t.push(0);t.reverse()}else{for(r=u.length,s=p.length,f=r<s,f&&(s=r),r=0;r<s;r++)if(u[r]!=p[r]){f=u[r]<p[r];break}i=0}for(f&&(t=u,u=p,p=t,e.s=-e.s),s=u.length,r=p.length-s;r>0;--r)u[s++]=0;for(r=p.length;r>i;){if(u[--r]<p[r]){for(o=r;o&&u[--o]===0;)u[o]=Q-1;--u[o],u[r]+=Q}u[r]-=p[r]}for(;u[--s]===0;)u.pop();for(;u[0]===0;u.shift())--n;return u[0]?(e.d=u,e.e=qe(u,n),B?T(e,a,c):e):new w(c===3?-0:0)};d.modulo=d.mod=function(e){var t,n=this,r=n.constructor;return e=new r(e),!n.d||!e.s||e.d&&!e.d[0]?new r(NaN):!e.d||n.d&&!n.d[0]?T(new r(n),r.precision,r.rounding):(B=!1,r.modulo==9?(t=R(n,e.abs(),0,3,1),t.s*=e.s):t=R(n,e,0,r.modulo,1),t=t.times(e),B=!0,n.minus(t))};d.naturalExponential=d.exp=function(){return ht(this)};d.naturalLogarithm=d.ln=function(){return ae(this)};d.negated=d.neg=function(){var e=new this.constructor(this);return e.s=-e.s,T(e)};d.plus=d.add=function(e){var t,n,r,o,i,s,a,c,u,l,f=this,p=f.constructor;if(e=new p(e),!f.d||!e.d)return!f.s||!e.s?e=new p(NaN):f.d||(e=new p(e.d||f.s===e.s?f:NaN)),e;if(f.s!=e.s)return e.s=-e.s,f.minus(e);if(u=f.d,l=e.d,a=p.precision,c=p.rounding,!u[0]||!l[0])return l[0]||(e=new p(f)),B?T(e,a,c):e;if(i=H(f.e/A),r=H(e.e/A),u=u.slice(),o=i-r,o){for(o<0?(n=u,o=-o,s=l.length):(n=l,r=i,s=u.length),i=Math.ceil(a/A),s=i>s?i+1:s+1,o>s&&(o=s,n.length=1),n.reverse();o--;)n.push(0);n.reverse()}for(s=u.length,o=l.length,s-o<0&&(o=s,n=l,l=u,u=n),t=0;o;)t=(u[--o]=u[o]+l[o]+t)/Q|0,u[o]%=Q;for(t&&(u.unshift(t),++r),s=u.length;u[--s]==0;)u.pop();return e.d=u,e.e=qe(u,r),B?T(e,a,c):e};d.precision=d.sd=function(e){var t,n=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(ce+e);return n.d?(t=Zt(n.d),e&&n.e+1>t&&(t=n.e+1)):t=NaN,t};d.round=function(){var e=this,t=e.constructor;return T(new t(e),e.e+1,t.rounding)};d.sine=d.sin=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+A,r.rounding=1,n=Jn(r,$t(r,n)),r.precision=e,r.rounding=t,T(ne>2?n.neg():n,e,t,!0)):new r(NaN)};d.squareRoot=d.sqrt=function(){var e,t,n,r,o,i,s=this,a=s.d,c=s.e,u=s.s,l=s.constructor;if(u!==1||!a||!a[0])return new l(!u||u<0&&(!a||a[0])?NaN:a?s:1/0);for(B=!1,u=Math.sqrt(+s),u==0||u==1/0?(t=U(a),(t.length+c)%2==0&&(t+="0"),u=Math.sqrt(t),c=H((c+1)/2)-(c<0||c%2),u==1/0?t="5e"+c:(t=u.toExponential(),t=t.slice(0,t.indexOf("e")+1)+c),r=new l(t)):r=new l(u.toString()),n=(c=l.precision)+3;;)if(i=r,r=i.plus(R(s,i,n+2,1)).times(.5),U(i.d).slice(0,n)===(t=U(r.d)).slice(0,n))if(t=t.slice(n-3,n+1),t=="9999"||!o&&t=="4999"){if(!o&&(T(i,c+1,0),i.times(i).eq(s))){r=i;break}n+=4,o=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(T(r,c+1,1),e=!r.times(r).eq(s));break}return B=!0,T(r,c,l.rounding,e)};d.tangent=d.tan=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+10,r.rounding=1,n=n.sin(),n.s=1,n=R(n,new r(1).minus(n.times(n)).sqrt(),e+10,0),r.precision=e,r.rounding=t,T(ne==2||ne==4?n.neg():n,e,t,!0)):new r(NaN)};d.times=d.mul=function(e){var t,n,r,o,i,s,a,c,u,l=this,f=l.constructor,p=l.d,m=(e=new f(e)).d;if(e.s*=l.s,!p||!p[0]||!m||!m[0])return new f(!e.s||p&&!p[0]&&!m||m&&!m[0]&&!p?NaN:!p||!m?e.s/0:e.s*0);for(n=H(l.e/A)+H(e.e/A),c=p.length,u=m.length,c<u&&(i=p,p=m,m=i,s=c,c=u,u=s),i=[],s=c+u,r=s;r--;)i.push(0);for(r=u;--r>=0;){for(t=0,o=c+r;o>r;)a=i[o]+m[r]*p[o-r-1]+t,i[o--]=a%Q|0,t=a/Q|0;i[o]=(i[o]+t)%Q|0}for(;!i[--s];)i.pop();return t?++n:i.shift(),e.d=i,e.e=qe(i,n),B?T(e,f.precision,f.rounding):e};d.toBinary=function(e,t){return bt(this,2,e,t)};d.toDecimalPlaces=d.toDP=function(e,t){var n=this,r=n.constructor;return n=new r(n),e===void 0?n:(Y(e,0,ue),t===void 0?t=r.rounding:Y(t,0,8),T(n,e+n.e+1,t))};d.toExponential=function(e,t){var n,r=this,o=r.constructor;return e===void 0?n=ee(r,!0):(Y(e,0,ue),t===void 0?t=o.rounding:Y(t,0,8),r=T(new o(r),e+1,t),n=ee(r,!0,e+1)),r.isNeg()&&!r.isZero()?"-"+n:n};d.toFixed=function(e,t){var n,r,o=this,i=o.constructor;return e===void 0?n=ee(o):(Y(e,0,ue),t===void 0?t=i.rounding:Y(t,0,8),r=T(new i(o),e+o.e+1,t),n=ee(r,!1,e+r.e+1)),o.isNeg()&&!o.isZero()?"-"+n:n};d.toFraction=function(e){var t,n,r,o,i,s,a,c,u,l,f,p,m=this,w=m.d,h=m.constructor;if(!w)return new h(m);if(u=n=new h(1),r=c=new h(0),t=new h(r),i=t.e=Zt(w)-m.e-1,s=i%A,t.d[0]=F(10,s<0?A+s:s),e==null)e=i>0?t:u;else{if(a=new h(e),!a.isInt()||a.lt(u))throw Error(ce+a);e=a.gt(t)?i>0?t:u:a}for(B=!1,a=new h(U(w)),l=h.precision,h.precision=i=w.length*A*2;f=R(a,t,0,1,1),o=n.plus(f.times(r)),o.cmp(e)!=1;)n=r,r=o,o=u,u=c.plus(f.times(o)),c=o,o=t,t=a.minus(f.times(o)),a=o;return o=R(e.minus(n),r,0,1,1),c=c.plus(o.times(u)),n=n.plus(o.times(r)),c.s=u.s=m.s,p=R(u,r,i,1).minus(m).abs().cmp(R(c,n,i,1).minus(m).abs())<1?[u,r]:[c,n],h.precision=l,B=!0,p};d.toHexadecimal=d.toHex=function(e,t){return bt(this,16,e,t)};d.toNearest=function(e,t){var n=this,r=n.constructor;if(n=new r(n),e==null){if(!n.d)return n;e=new r(1),t=r.rounding}else{if(e=new r(e),t===void 0?t=r.rounding:Y(t,0,8),!n.d)return e.s?n:e;if(!e.d)return e.s&&(e.s=n.s),e}return e.d[0]?(B=!1,n=R(n,e,0,t,1).times(e),B=!0,T(n)):(e.s=n.s,n=e),n};d.toNumber=function(){return+this};d.toOctal=function(e,t){return bt(this,8,e,t)};d.toPower=d.pow=function(e){var t,n,r,o,i,s,a=this,c=a.constructor,u=+(e=new c(e));if(!a.d||!e.d||!a.d[0]||!e.d[0])return new c(F(+a,u));if(a=new c(a),a.eq(1))return a;if(r=c.precision,i=c.rounding,e.eq(1))return T(a,r,i);if(t=H(e.e/A),t>=e.d.length-1&&(n=u<0?-u:u)<=Yn)return o=Xt(c,a,n,r),e.s<0?new c(1).div(o):T(o,r,i);if(s=a.s,s<0){if(t<e.d.length-1)return new c(NaN);if((e.d[t]&1)==0&&(s=1),a.e==0&&a.d[0]==1&&a.d.length==1)return a.s=s,a}return n=F(+a,u),t=n==0||!isFinite(n)?H(u*(Math.log("0."+U(a.d))/Math.LN10+a.e+1)):new c(n+"").e,t>c.maxE+1||t<c.minE-1?new c(t>0?s/0:0):(B=!1,c.rounding=a.s=1,n=Math.min(12,(t+"").length),o=ht(e.times(ae(a,r+n)),r),o.d&&(o=T(o,r+5,1),ke(o.d,r,i)&&(t=r+10,o=T(ht(e.times(ae(a,t+n)),t),t+5,1),+U(o.d).slice(r+1,r+15)+1==1e14&&(o=T(o,r+1,0)))),o.s=s,B=!0,c.rounding=i,T(o,r,i))};d.toPrecision=function(e,t){var n,r=this,o=r.constructor;return e===void 0?n=ee(r,r.e<=o.toExpNeg||r.e>=o.toExpPos):(Y(e,1,ue),t===void 0?t=o.rounding:Y(t,0,8),r=T(new o(r),e,t),n=ee(r,e<=r.e||r.e<=o.toExpNeg,e)),r.isNeg()&&!r.isZero()?"-"+n:n};d.toSignificantDigits=d.toSD=function(e,t){var n=this,r=n.constructor;return e===void 0?(e=r.precision,t=r.rounding):(Y(e,1,ue),t===void 0?t=r.rounding:Y(t,0,8)),T(new r(n),e,t)};d.toString=function(){var e=this,t=e.constructor,n=ee(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+n:n};d.truncated=d.trunc=function(){return T(new this.constructor(this),this.e+1,1)};d.valueOf=d.toJSON=function(){var e=this,t=e.constructor,n=ee(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+n:n};function U(e){var t,n,r,o=e.length-1,i="",s=e[0];if(o>0){for(i+=s,t=1;t<o;t++)r=e[t]+"",n=A-r.length,n&&(i+=se(n)),i+=r;s=e[t],r=s+"",n=A-r.length,n&&(i+=se(n))}else if(s===0)return"0";for(;s%10===0;)s/=10;return i+s}function Y(e,t,n){if(e!==~~e||e<t||e>n)throw Error(ce+e)}function ke(e,t,n,r){var o,i,s,a;for(i=e[0];i>=10;i/=10)--t;return--t<0?(t+=A,o=0):(o=Math.ceil((t+1)/A),t%=A),i=F(10,A-t),a=e[o]%i|0,r==null?t<3?(t==0?a=a/100|0:t==1&&(a=a/10|0),s=n<4&&a==99999||n>3&&a==49999||a==5e4||a==0):s=(n<4&&a+1==i||n>3&&a+1==i/2)&&(e[o+1]/i/100|0)==F(10,t-2)-1||(a==i/2||a==0)&&(e[o+1]/i/100|0)==0:t<4?(t==0?a=a/1e3|0:t==1?a=a/100|0:t==2&&(a=a/10|0),s=(r||n<4)&&a==9999||!r&&n>3&&a==4999):s=((r||n<4)&&a+1==i||!r&&n>3&&a+1==i/2)&&(e[o+1]/i/1e3|0)==F(10,t-3)-1,s}function ve(e,t,n){for(var r,o=[0],i,s=0,a=e.length;s<a;){for(i=o.length;i--;)o[i]*=t;for(o[0]+=pt.indexOf(e.charAt(s++)),r=0;r<o.length;r++)o[r]>n-1&&(o[r+1]===void 0&&(o[r+1]=0),o[r+1]+=o[r]/n|0,o[r]%=n)}return o.reverse()}function Xn(e,t){var n,r,o;if(t.isZero())return t;r=t.d.length,r<32?(n=Math.ceil(r/3),o=(1/Ge(4,n)).toString()):(n=16,o="2.3283064365386962890625e-10"),e.precision+=n,t=ye(e,1,t.times(o),new e(1));for(var i=n;i--;){var s=t.times(t);t=s.times(s).minus(s).times(8).plus(1)}return e.precision-=n,t}var R=function(){function e(r,o,i){var s,a=0,c=r.length;for(r=r.slice();c--;)s=r[c]*o+a,r[c]=s%i|0,a=s/i|0;return a&&r.unshift(a),r}function t(r,o,i,s){var a,c;if(i!=s)c=i>s?1:-1;else for(a=c=0;a<i;a++)if(r[a]!=o[a]){c=r[a]>o[a]?1:-1;break}return c}function n(r,o,i,s){for(var a=0;i--;)r[i]-=a,a=r[i]<o[i]?1:0,r[i]=a*s+r[i]-o[i];for(;!r[0]&&r.length>1;)r.shift()}return function(r,o,i,s,a,c){var u,l,f,p,m,w,h,x,b,y,g,P,S,N,_,K,v,oe,W,me,de=r.constructor,Pe=r.s==o.s?1:-1,q=r.d,M=o.d;if(!q||!q[0]||!M||!M[0])return new de(!r.s||!o.s||(q?M&&q[0]==M[0]:!M)?NaN:q&&q[0]==0||!M?Pe*0:Pe/0);for(c?(m=1,l=r.e-o.e):(c=Q,m=A,l=H(r.e/m)-H(o.e/m)),W=M.length,v=q.length,b=new de(Pe),y=b.d=[],f=0;M[f]==(q[f]||0);f++);if(M[f]>(q[f]||0)&&l--,i==null?(N=i=de.precision,s=de.rounding):a?N=i+(r.e-o.e)+1:N=i,N<0)y.push(1),w=!0;else{if(N=N/m+2|0,f=0,W==1){for(p=0,M=M[0],N++;(f<v||p)&&N--;f++)_=p*c+(q[f]||0),y[f]=_/M|0,p=_%M|0;w=p||f<v}else{for(p=c/(M[0]+1)|0,p>1&&(M=e(M,p,c),q=e(q,p,c),W=M.length,v=q.length),K=W,g=q.slice(0,W),P=g.length;P<W;)g[P++]=0;me=M.slice(),me.unshift(0),oe=M[0],M[1]>=c/2&&++oe;do p=0,u=t(M,g,W,P),u<0?(S=g[0],W!=P&&(S=S*c+(g[1]||0)),p=S/oe|0,p>1?(p>=c&&(p=c-1),h=e(M,p,c),x=h.length,P=g.length,u=t(h,g,x,P),u==1&&(p--,n(h,W<x?me:M,x,c))):(p==0&&(u=p=1),h=M.slice()),x=h.length,x<P&&h.unshift(0),n(g,h,P,c),u==-1&&(P=g.length,u=t(M,g,W,P),u<1&&(p++,n(g,W<P?me:M,P,c))),P=g.length):u===0&&(p++,g=[0]),y[f++]=p,u&&g[0]?g[P++]=q[K]||0:(g=[q[K]],P=1);while((K++<v||g[0]!==void 0)&&N--);w=g[0]!==void 0}y[0]||y.shift()}if(m==1)b.e=l,Gt=w;else{for(f=1,p=y[0];p>=10;p/=10)f++;b.e=f+l*m-1,T(b,a?i+b.e+1:i,s,w)}return b}}();function T(e,t,n,r){var o,i,s,a,c,u,l,f,p,m=e.constructor;e:if(t!=null){if(f=e.d,!f)return e;for(o=1,a=f[0];a>=10;a/=10)o++;if(i=t-o,i<0)i+=A,s=t,l=f[p=0],c=l/F(10,o-s-1)%10|0;else if(p=Math.ceil((i+1)/A),a=f.length,p>=a)if(r){for(;a++<=p;)f.push(0);l=c=0,o=1,i%=A,s=i-A+1}else break e;else{for(l=a=f[p],o=1;a>=10;a/=10)o++;i%=A,s=i-A+o,c=s<0?0:l/F(10,o-s-1)%10|0}if(r=r||t<0||f[p+1]!==void 0||(s<0?l:l%F(10,o-s-1)),u=n<4?(c||r)&&(n==0||n==(e.s<0?3:2)):c>5||c==5&&(n==4||r||n==6&&(i>0?s>0?l/F(10,o-s):0:f[p-1])%10&1||n==(e.s<0?8:7)),t<1||!f[0])return f.length=0,u?(t-=e.e+1,f[0]=F(10,(A-t%A)%A),e.e=-t||0):f[0]=e.e=0,e;if(i==0?(f.length=p,a=1,p--):(f.length=p+1,a=F(10,A-i),f[p]=s>0?(l/F(10,o-s)%F(10,s)|0)*a:0),u)for(;;)if(p==0){for(i=1,s=f[0];s>=10;s/=10)i++;for(s=f[0]+=a,a=1;s>=10;s/=10)a++;i!=a&&(e.e++,f[0]==Q&&(f[0]=1));break}else{if(f[p]+=a,f[p]!=Q)break;f[p--]=0,a=1}for(i=f.length;f[--i]===0;)f.pop()}return B&&(e.e>m.maxE?(e.d=null,e.e=NaN):e.e<m.minE&&(e.e=0,e.d=[0])),e}function ee(e,t,n){if(!e.isFinite())return Jt(e);var r,o=e.e,i=U(e.d),s=i.length;return t?(n&&(r=n-s)>0?i=i.charAt(0)+"."+i.slice(1)+se(r):s>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(e.e<0?"e":"e+")+e.e):o<0?(i="0."+se(-o-1)+i,n&&(r=n-s)>0&&(i+=se(r))):o>=s?(i+=se(o+1-s),n&&(r=n-o-1)>0&&(i=i+"."+se(r))):((r=o+1)<s&&(i=i.slice(0,r)+"."+i.slice(r)),n&&(r=n-s)>0&&(o+1===s&&(i+="."),i+=se(r))),i}function qe(e,t){var n=e[0];for(t*=A;n>=10;n/=10)t++;return t}function Ue(e,t,n){if(t>Zn)throw B=!0,n&&(e.precision=n),Error(Ht);return T(new e(Fe),t,1,!0)}function X(e,t,n){if(t>dt)throw Error(Ht);return T(new e(Ve),t,n,!0)}function Zt(e){var t=e.length-1,n=t*A+1;if(t=e[t],t){for(;t%10==0;t/=10)n--;for(t=e[0];t>=10;t/=10)n++}return n}function se(e){for(var t="";e--;)t+="0";return t}function Xt(e,t,n,r){var o,i=new e(1),s=Math.ceil(r/A+4);for(B=!1;;){if(n%2&&(i=i.times(t),Wt(i.d,s)&&(o=!0)),n=H(n/2),n===0){n=i.d.length-1,o&&i.d[n]===0&&++i.d[n];break}t=t.times(t),Wt(t.d,s)}return B=!0,i}function Ut(e){return e.d[e.d.length-1]&1}function Qt(e,t,n){for(var r,o=new e(t[0]),i=0;++i<t.length;)if(r=new e(t[i]),r.s)o[n](r)&&(o=r);else{o=r;break}return o}function ht(e,t){var n,r,o,i,s,a,c,u=0,l=0,f=0,p=e.constructor,m=p.rounding,w=p.precision;if(!e.d||!e.d[0]||e.e>17)return new p(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:0/0);for(t==null?(B=!1,c=w):c=t,a=new p(.03125);e.e>-2;)e=e.times(a),f+=5;for(r=Math.log(F(2,f))/Math.LN10*2+5|0,c+=r,n=i=s=new p(1),p.precision=c;;){if(i=T(i.times(e),c,1),n=n.times(++l),a=s.plus(R(i,n,c,1)),U(a.d).slice(0,c)===U(s.d).slice(0,c)){for(o=f;o--;)s=T(s.times(s),c,1);if(t==null)if(u<3&&ke(s.d,c-r,m,u))p.precision=c+=10,n=i=a=new p(1),l=0,u++;else return T(s,p.precision=w,m,B=!0);else return p.precision=w,s}s=a}}function ae(e,t){var n,r,o,i,s,a,c,u,l,f,p,m=1,w=10,h=e,x=h.d,b=h.constructor,y=b.rounding,g=b.precision;if(h.s<0||!x||!x[0]||!h.e&&x[0]==1&&x.length==1)return new b(x&&!x[0]?-1/0:h.s!=1?NaN:x?0:h);if(t==null?(B=!1,l=g):l=t,b.precision=l+=w,n=U(x),r=n.charAt(0),Math.abs(i=h.e)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)h=h.times(e),n=U(h.d),r=n.charAt(0),m++;i=h.e,r>1?(h=new b("0."+n),i++):h=new b(r+"."+n.slice(1))}else return u=Ue(b,l+2,g).times(i+""),h=ae(new b(r+"."+n.slice(1)),l-w).plus(u),b.precision=g,t==null?T(h,g,y,B=!0):h;for(f=h,c=s=h=R(h.minus(1),h.plus(1),l,1),p=T(h.times(h),l,1),o=3;;){if(s=T(s.times(p),l,1),u=c.plus(R(s,new b(o),l,1)),U(u.d).slice(0,l)===U(c.d).slice(0,l))if(c=c.times(2),i!==0&&(c=c.plus(Ue(b,l+2,g).times(i+""))),c=R(c,new b(m),l,1),t==null)if(ke(c.d,l-w,y,a))b.precision=l+=w,u=s=h=R(f.minus(1),f.plus(1),l,1),p=T(h.times(h),l,1),o=a=1;else return T(c,b.precision=g,y,B=!0);else return b.precision=g,c;c=u,o+=2}}function Jt(e){return String(e.s*e.s/0)}function gt(e,t){var n,r,o;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;r++);for(o=t.length;t.charCodeAt(o-1)===48;--o);if(t=t.slice(r,o),t){if(o-=r,e.e=n=n-r-1,e.d=[],r=(n+1)%A,n<0&&(r+=A),r<o){for(r&&e.d.push(+t.slice(0,r)),o-=A;r<o;)e.d.push(+t.slice(r,r+=A));t=t.slice(r),r=A-t.length}else r-=o;for(;r--;)t+="0";e.d.push(+t),B&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function Qn(e,t){var n,r,o,i,s,a,c,u,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),Yt.test(t))return gt(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(jn.test(t))n=16,t=t.toLowerCase();else if(Hn.test(t))n=2;else if(zn.test(t))n=8;else throw Error(ce+t);for(i=t.search(/p/i),i>0?(c=+t.slice(i+1),t=t.substring(2,i)):t=t.slice(2),i=t.indexOf("."),s=i>=0,r=e.constructor,s&&(t=t.replace(".",""),a=t.length,i=a-i,o=Xt(r,new r(n),i,i*2)),u=ve(t,n,Q),l=u.length-1,i=l;u[i]===0;--i)u.pop();return i<0?new r(e.s*0):(e.e=qe(u,l),e.d=u,B=!1,s&&(e=R(e,o,a*4)),c&&(e=e.times(Math.abs(c)<54?F(2,c):He.pow(2,c))),B=!0,e)}function Jn(e,t){var n,r=t.d.length;if(r<3)return t.isZero()?t:ye(e,2,t,t);n=1.4*Math.sqrt(r),n=n>16?16:n|0,t=t.times(1/Ge(5,n)),t=ye(e,2,t,t);for(var o,i=new e(5),s=new e(16),a=new e(20);n--;)o=t.times(t),t=t.times(i.plus(o.times(s.times(o).minus(a))));return t}function ye(e,t,n,r,o){var i,s,a,c,u=1,l=e.precision,f=Math.ceil(l/A);for(B=!1,c=n.times(n),a=new e(r);;){if(s=R(a.times(c),new e(t++*t++),l,1),a=o?r.plus(s):r.minus(s),r=R(s.times(c),new e(t++*t++),l,1),s=a.plus(r),s.d[f]!==void 0){for(i=f;s.d[i]===a.d[i]&&i--;);if(i==-1)break}i=a,a=r,r=s,s=i,u++}return B=!0,s.d.length=f+1,s}function Ge(e,t){for(var n=e;--t;)n*=e;return n}function $t(e,t){var n,r=t.s<0,o=X(e,e.precision,1),i=o.times(.5);if(t=t.abs(),t.lte(i))return ne=r?4:1,t;if(n=t.divToInt(o),n.isZero())ne=r?3:2;else{if(t=t.minus(n.times(o)),t.lte(i))return ne=Ut(n)?r?2:3:r?4:1,t;ne=Ut(n)?r?1:4:r?3:2}return t.minus(o).abs()}function bt(e,t,n,r){var o,i,s,a,c,u,l,f,p,m=e.constructor,w=n!==void 0;if(w?(Y(n,1,ue),r===void 0?r=m.rounding:Y(r,0,8)):(n=m.precision,r=m.rounding),!e.isFinite())l=Jt(e);else{for(l=ee(e),s=l.indexOf("."),w?(o=2,t==16?n=n*4-3:t==8&&(n=n*3-2)):o=t,s>=0&&(l=l.replace(".",""),p=new m(1),p.e=l.length-s,p.d=ve(ee(p),10,o),p.e=p.d.length),f=ve(l,10,o),i=c=f.length;f[--c]==0;)f.pop();if(!f[0])l=w?"0p+0":"0";else{if(s<0?i--:(e=new m(e),e.d=f,e.e=i,e=R(e,p,n,r,0,o),f=e.d,i=e.e,u=Gt),s=f[n],a=o/2,u=u||f[n+1]!==void 0,u=r<4?(s!==void 0||u)&&(r===0||r===(e.s<0?3:2)):s>a||s===a&&(r===4||u||r===6&&f[n-1]&1||r===(e.s<0?8:7)),f.length=n,u)for(;++f[--n]>o-1;)f[n]=0,n||(++i,f.unshift(1));for(c=f.length;!f[c-1];--c);for(s=0,l="";s<c;s++)l+=pt.charAt(f[s]);if(w){if(c>1)if(t==16||t==8){for(s=t==16?4:3,--c;c%s;c++)l+="0";for(f=ve(l,o,t),c=f.length;!f[c-1];--c);for(s=1,l="1.";s<c;s++)l+=pt.charAt(f[s])}else l=l.charAt(0)+"."+l.slice(1);l=l+(i<0?"p":"p+")+i}else if(i<0){for(;++i;)l="0"+l;l="0."+l}else if(++i>c)for(i-=c;i--;)l+="0";else i<c&&(l=l.slice(0,i)+"."+l.slice(i))}l=(t==16?"0x":t==2?"0b":t==8?"0o":"")+l}return e.s<0?"-"+l:l}function Wt(e,t){if(e.length>t)return e.length=t,!0}function $n(e){return new this(e).abs()}function er(e){return new this(e).acos()}function tr(e){return new this(e).acosh()}function nr(e,t){return new this(e).plus(t)}function rr(e){return new this(e).asin()}function or(e){return new this(e).asinh()}function ir(e){return new this(e).atan()}function sr(e){return new this(e).atanh()}function ar(e,t){e=new this(e),t=new this(t);var n,r=this.precision,o=this.rounding,i=r+4;return!e.s||!t.s?n=new this(NaN):!e.d&&!t.d?(n=X(this,i,1).times(t.s>0?.25:.75),n.s=e.s):!t.d||e.isZero()?(n=t.s<0?X(this,r,o):new this(0),n.s=e.s):!e.d||t.isZero()?(n=X(this,i,1).times(.5),n.s=e.s):t.s<0?(this.precision=i,this.rounding=1,n=this.atan(R(e,t,i,1)),t=X(this,i,1),this.precision=r,this.rounding=o,n=e.s<0?n.minus(t):n.plus(t)):n=this.atan(R(e,t,i,1)),n}function cr(e){return new this(e).cbrt()}function ur(e){return T(e=new this(e),e.e+1,2)}function lr(e,t,n){return new this(e).clamp(t,n)}function fr(e){if(!e||typeof e!="object")throw Error(We+"Object expected");var t,n,r,o=e.defaults===!0,i=["precision",1,ue,"rounding",0,8,"toExpNeg",-be,0,"toExpPos",0,be,"maxE",0,be,"minE",-be,0,"modulo",0,9];for(t=0;t<i.length;t+=3)if(n=i[t],o&&(this[n]=mt[n]),(r=e[n])!==void 0)if(H(r)===r&&r>=i[t+1]&&r<=i[t+2])this[n]=r;else throw Error(ce+n+": "+r);if(n="crypto",o&&(this[n]=mt[n]),(r=e[n])!==void 0)if(r===!0||r===!1||r===0||r===1)if(r)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[n]=!0;else throw Error(jt);else this[n]=!1;else throw Error(ce+n+": "+r);return this}function pr(e){return new this(e).cos()}function mr(e){return new this(e).cosh()}function en(e){var t,n,r;function o(i){var s,a,c,u=this;if(!(u instanceof o))return new o(i);if(u.constructor=o,qt(i)){u.s=i.s,B?!i.d||i.e>o.maxE?(u.e=NaN,u.d=null):i.e<o.minE?(u.e=0,u.d=[0]):(u.e=i.e,u.d=i.d.slice()):(u.e=i.e,u.d=i.d?i.d.slice():i.d);return}if(c=typeof i,c==="number"){if(i===0){u.s=1/i<0?-1:1,u.e=0,u.d=[0];return}if(i<0?(i=-i,u.s=-1):u.s=1,i===~~i&&i<1e7){for(s=0,a=i;a>=10;a/=10)s++;B?s>o.maxE?(u.e=NaN,u.d=null):s<o.minE?(u.e=0,u.d=[0]):(u.e=s,u.d=[i]):(u.e=s,u.d=[i]);return}else if(i*0!==0){i||(u.s=NaN),u.e=NaN,u.d=null;return}return gt(u,i.toString())}else if(c!=="string")throw Error(ce+i);return(a=i.charCodeAt(0))===45?(i=i.slice(1),u.s=-1):(a===43&&(i=i.slice(1)),u.s=1),Yt.test(i)?gt(u,i):Qn(u,i)}if(o.prototype=d,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=fr,o.clone=en,o.isDecimal=qt,o.abs=$n,o.acos=er,o.acosh=tr,o.add=nr,o.asin=rr,o.asinh=or,o.atan=ir,o.atanh=sr,o.atan2=ar,o.cbrt=cr,o.ceil=ur,o.clamp=lr,o.cos=pr,o.cosh=mr,o.div=dr,o.exp=hr,o.floor=gr,o.hypot=br,o.ln=yr,o.log=wr,o.log10=Tr,o.log2=xr,o.max=Pr,o.min=Ar,o.mod=kr,o.mul=Br,o.pow=Cr,o.random=Sr,o.round=Lr,o.sign=Ir,o.sin=Nr,o.sinh=Er,o.sqrt=_r,o.sub=Rr,o.sum=Mr,o.tan=Dr,o.tanh=Kr,o.trunc=Or,e===void 0&&(e={}),e&&e.defaults!==!0)for(r=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],t=0;t<r.length;)e.hasOwnProperty(n=r[t++])||(e[n]=this[n]);return o.config(e),o}function dr(e,t){return new this(e).div(t)}function hr(e){return new this(e).exp()}function gr(e){return T(e=new this(e),e.e+1,3)}function br(){var e,t,n=new this(0);for(B=!1,e=0;e<arguments.length;)if(t=new this(arguments[e++]),t.d)n.d&&(n=n.plus(t.times(t)));else{if(t.s)return B=!0,new this(1/0);n=t}return B=!0,n.sqrt()}function qt(e){return e instanceof He||e&&e.toStringTag===zt||!1}function yr(e){return new this(e).ln()}function wr(e,t){return new this(e).log(t)}function xr(e){return new this(e).log(2)}function Tr(e){return new this(e).log(10)}function Pr(){return Qt(this,arguments,"lt")}function Ar(){return Qt(this,arguments,"gt")}function kr(e,t){return new this(e).mod(t)}function Br(e,t){return new this(e).mul(t)}function Cr(e,t){return new this(e).pow(t)}function Sr(e){var t,n,r,o,i=0,s=new this(1),a=[];if(e===void 0?e=this.precision:Y(e,1,ue),r=Math.ceil(e/A),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(r));i<r;)o=t[i],o>=429e7?t[i]=crypto.getRandomValues(new Uint32Array(1))[0]:a[i++]=o%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(r*=4);i<r;)o=t[i]+(t[i+1]<<8)+(t[i+2]<<16)+((t[i+3]&127)<<24),o>=214e7?crypto.randomBytes(4).copy(t,i):(a.push(o%1e7),i+=4);i=r/4}else throw Error(jt);else for(;i<r;)a[i++]=Math.random()*1e7|0;for(r=a[--i],e%=A,r&&e&&(o=F(10,A-e),a[i]=(r/o|0)*o);a[i]===0;i--)a.pop();if(i<0)n=0,a=[0];else{for(n=-1;a[0]===0;n-=A)a.shift();for(r=1,o=a[0];o>=10;o/=10)r++;r<A&&(n-=A-r)}return s.e=n,s.d=a,s}function Lr(e){return T(e=new this(e),e.e+1,this.rounding)}function Ir(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function Nr(e){return new this(e).sin()}function Er(e){return new this(e).sinh()}function _r(e){return new this(e).sqrt()}function Rr(e,t){return new this(e).sub(t)}function Mr(){var e=0,t=arguments,n=new this(t[e]);for(B=!1;n.s&&++e<t.length;)n=n.plus(t[e]);return B=!0,T(n,this.precision,this.rounding)}function Dr(e){return new this(e).tan()}function Kr(e){return new this(e).tanh()}function Or(e){return T(e=new this(e),e.e+1,1)}d[Symbol.for("nodejs.util.inspect.custom")]=d.toString;d[Symbol.toStringTag]="Decimal";var He=d.constructor=en(mt);Fe=new He(Fe);Ve=new He(Ve);var sn=z(require("big.js")),Wr=z(require("bn.js"));var tn=z(require("toformat")),vr=tn.default,Be=vr;var Ce=z(require("big.js")),rn=z(require("bn.js")),on=z(require("decimal.js-light"));var we=z(require("bn.js"));var nn=9007199254740991;function J(e){let t=G("Raydium_parseBigNumberish");if(e instanceof we.default)return e;if(typeof e=="string"){if(e.match(/^-?[0-9]+$/))return new we.default(e);t.logWithError(`invalid BigNumberish string: ${e}`)}return typeof e=="number"?(e%1&&t.logWithError(`BigNumberish number underflow: ${e}`),(e>=nn||e<=-nn)&&t.logWithError(`BigNumberish number overflow: ${e}`),new we.default(String(e))):typeof e=="bigint"?new we.default(e.toString()):(t.error(`invalid BigNumberish value: ${e}`),new we.default(0))}var je=G("module/fraction"),yt=Be(Ce.default),Se=Be(on.default),Vr={[0]:Se.ROUND_DOWN,[1]:Se.ROUND_HALF_UP,[2]:Se.ROUND_UP},Ur={[0]:Ce.default.roundDown,[1]:Ce.default.roundHalfUp,[2]:Ce.default.roundUp},D=class{constructor(t,n=new rn.default(1)){this.numerator=J(t),this.denominator=J(n)}get quotient(){return this.numerator.div(this.denominator)}invert(){return new D(this.denominator,this.numerator)}add(t){let n=t instanceof D?t:new D(J(t));return this.denominator.eq(n.denominator)?new D(this.numerator.add(n.numerator),this.denominator):new D(this.numerator.mul(n.denominator).add(n.numerator.mul(this.denominator)),this.denominator.mul(n.denominator))}sub(t){let n=t instanceof D?t:new D(J(t));return this.denominator.eq(n.denominator)?new D(this.numerator.sub(n.numerator),this.denominator):new D(this.numerator.mul(n.denominator).sub(n.numerator.mul(this.denominator)),this.denominator.mul(n.denominator))}mul(t){let n=t instanceof D?t:new D(J(t));return new D(this.numerator.mul(n.numerator),this.denominator.mul(n.denominator))}div(t){let n=t instanceof D?t:new D(J(t));return new D(this.numerator.mul(n.denominator),this.denominator.mul(n.numerator))}toSignificant(t,n={groupSeparator:""},r=1){Number.isInteger(t)||je.logWithError(`${t} is not an integer.`),t<=0&&je.logWithError(`${t} is not positive.`),Se.set({precision:t+1,rounding:Vr[r]});let o=new Se(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(t);return o.toFormat(o.decimalPlaces(),n)}toFixed(t,n={groupSeparator:""},r=1){return Number.isInteger(t)||je.logWithError(`${t} is not an integer.`),t<0&&je.logWithError(`${t} is negative.`),yt.DP=t,yt.RM=Ur[r]||1,new yt(this.numerator.toString()).div(this.denominator.toString()).toFormat(t,n)}isZero(){return this.numerator.isZero()}};var Do=G("Raydium_amount"),Ko=Be(sn.default);var an=require("@solana/web3.js"),wt=require("@solana/spl-token"),cn={chainId:101,address:an.PublicKey.default.toBase58(),programId:wt.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"}},re={chainId:101,address:"So11111111111111111111111111111111111111112",programId:wt.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 ze=require("@solana/web3.js");var I=require("@solana/web3.js"),un=require("@solana/spl-token");function xt({pubkey:e,isSigner:t=!1,isWritable:n=!0}){return{pubkey:e,isWritable:n,isSigner:t}}var Vo=[xt({pubkey:un.TOKEN_PROGRAM_ID,isWritable:!1}),xt({pubkey:I.SystemProgram.programId,isWritable:!1}),xt({pubkey:I.SYSVAR_RENT_PUBKEY,isWritable:!1})];function ln({publicKey:e,transformSol:t}){let n=fn(e.toString());if(n instanceof I.PublicKey)return t&&n.equals(Le)?ie:n;if(t&&n.toString()===Le.toBase58())return ie;if(typeof n=="string"){if(n===I.PublicKey.default.toBase58())return I.PublicKey.default;try{return new I.PublicKey(n)}catch{throw new Error("invalid public key")}}throw new Error("invalid public key")}function fn(e){try{return new I.PublicKey(e)}catch{return e}}var Uo=new I.PublicKey("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),Wo=new I.PublicKey("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),qo=new I.PublicKey("SysvarRent111111111111111111111111111111111"),Go=new I.PublicKey("SysvarC1ock11111111111111111111111111111111"),Ho=new I.PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),jo=new I.PublicKey("Sysvar1nstructions1111111111111111111111111"),zo=I.SystemProgram.programId,Yo=new I.PublicKey("2cpMA1jNS4obgRz8XNg38QuSP83L1AXpUgfxPNcvnAGj"),Zo=new I.PublicKey("Ea5SjE2Y6yvCeW5dYTn7PYMuW5ikXkvbGdcmSnXeaLjS"),Xo=new I.PublicKey("SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt"),Qo=new I.PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"),Jo=new I.PublicKey("Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"),$o=new I.PublicKey("mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So"),ei=new I.PublicKey("7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj"),ti=new I.PublicKey("USDH1SM1ojwWUga67PGrgFWUHibbjqMvuMaDkRJTgkX"),ni=new I.PublicKey("NRVwhjBQiUPYtfDT5zRBVJajzFQHaBUNtC7SNVvqRFa"),ri=new I.PublicKey("ANAxByE6G2WjFp7A4NqtWYXb3mgruyzZYg3spfxe6Lbo"),oi=new I.PublicKey("7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs"),ie=new I.PublicKey("So11111111111111111111111111111111111111112"),Le=I.PublicKey.default;var Tt=class{constructor({mint:t,decimals:n,symbol:r,name:o,skipMint:i=!1,isToken2022:s=!1}){if(t===Le.toBase58()||t instanceof ze.PublicKey&&Le.equals(t)){this.decimals=re.decimals,this.symbol=re.symbol,this.name=re.name,this.mint=new ze.PublicKey(re.address),this.isToken2022=!1;return}this.decimals=n,this.symbol=r||t.toString().substring(0,6),this.name=o||t.toString().substring(0,6),this.mint=i?ze.PublicKey.default:ln({publicKey:t}),this.isToken2022=s}equals(t){return this===t?!0:this.mint.equals(t.mint)}},xe=Tt;xe.WSOL=new Tt({...re,mint:re.address});var Pt=class{constructor({decimals:t,symbol:n="UNKNOWN",name:r="UNKNOWN"}){this.decimals=t,this.symbol=n,this.name=r}equals(t){return this===t}},Ye=Pt;Ye.SOL=new Pt(cn);var pn=z(require("bn.js"));var di=new D(new pn.default(100));var xi=G("Raydium_price");var Hr=require("@solana/web3.js"),jr=z(require("bn.js"));var Gr=new te.default(0),$i=new te.default(1),es=new te.default(2),ts=new te.default(3),ns=new te.default(5),qr=new te.default(10),rs=new te.default(100),os=new te.default(1e3),is=new te.default(1e4);function ft(e,t=1,n=[]){let r=[...e];if(t<=0)return n;for(;r.length;)n.push(r.splice(0,t));return n}var xn=require("@solana/web3.js"),Tn=require("@solana/spl-token");var j=require("@solana/web3.js");var V={CreateAccount:"CreateAccount",InitAccount:"InitAccount",CreateATA:"CreateATA",CloseAccount:"CloseAccount",TransferAmount:"TransferAmount",InitMint:"InitMint",MintTo:"MintTo",InitMarket:"InitMarket",Util1216OwnerClaim:"Util1216OwnerClaim",SetComputeUnitPrice:"SetComputeUnitPrice",SetComputeUnitLimit:"SetComputeUnitLimit",ClmmCreatePool:"ClmmCreatePool",ClmmOpenPosition:"ClmmOpenPosition",ClmmIncreasePosition:"ClmmIncreasePosition",ClmmDecreasePosition:"ClmmDecreasePosition",ClmmClosePosition:"ClmmClosePosition",ClmmSwapBaseIn:"ClmmSwapBaseIn",ClmmSwapBaseOut:"ClmmSwapBaseOut",ClmmInitReward:"ClmmInitReward",ClmmSetReward:"ClmmSetReward",ClmmCollectReward:"ClmmCollectReward",ClmmLockPosition:"ClmmLockPosition",ClmmHarvestLockPosition:"ClmmHarvestLockPosition",AmmV4Swap:"AmmV4Swap",AmmV4AddLiquidity:"AmmV4AddLiquidity",AmmV4RemoveLiquidity:"AmmV4RemoveLiquidity",AmmV4SimulatePoolInfo:"AmmV4SimulatePoolInfo",AmmV4SwapBaseIn:"AmmV4SwapBaseIn",AmmV4SwapBaseOut:"AmmV4SwapBaseOut",AmmV4CreatePool:"AmmV4CreatePool",AmmV4InitPool:"AmmV4InitPool",AmmV5AddLiquidity:"AmmV5AddLiquidity",AmmV5RemoveLiquidity:"AmmV5RemoveLiquidity",AmmV5SimulatePoolInfo:"AmmV5SimulatePoolInfo",AmmV5SwapBaseIn:"AmmV5SwapBaseIn",AmmV5SwapBaseOut:"AmmV5SwapBaseOut",RouteSwap:"RouteSwap",RouteSwap1:"RouteSwap1",RouteSwap2:"RouteSwap2",FarmV3Deposit:"FarmV3Deposit",FarmV3Withdraw:"FarmV3Withdraw",FarmV3CreateLedger:"FarmV3CreateLedger",FarmV5Deposit:"FarmV5Deposit",FarmV5Withdraw:"FarmV5Withdraw",FarmV5CreateLedger:"FarmV5CreateLedger",FarmV6Deposit:"FarmV6Deposit",FarmV6Withdraw:"FarmV6Withdraw",FarmV6Create:"FarmV6Create",FarmV6Restart:"FarmV6Restart",FarmV6CreatorAddReward:"FarmV6CreatorAddReward",FarmV6CreatorWithdraw:"FarmV6CreatorWithdraw",CpmmCreatePool:"CpmmCreatePool",CpmmCreateConfig:"CpmmCreateConfig",CpmmAddLiquidity:"CpmmAddLiquidity",CpmmWithdrawLiquidity:"CpmmWithdrawLiquidity",CpmmSwapBaseIn:"CpmmSwapBaseIn",CpmmSwapBaseOut:"CpmmSwapBaseOut",CpmmLockLp:"CpmmLockLp",CpmmCollectLockFee:"CpmmCollectLockFee"};var bn=require("@solana/spl-token"),gn=G("Raydium_txUtil"),yn=1644;function Ze(e){let t=[],n=[];return e.microLamports&&(t.push(j.ComputeBudgetProgram.setComputeUnitPrice({microLamports:e.microLamports})),n.push(V.SetComputeUnitPrice)),e.units&&(t.push(j.ComputeBudgetProgram.setComputeUnitLimit({units:e.units})),n.push(V.SetComputeUnitLimit)),{instructions:t,instructionTypes:n}}async function Te(e,t){var r,o;let n=t!=null?t:"confirmed";return(o=await((r=e.getLatestBlockhash)==null?void 0:r.call(e,{commitment:n})))==null?void 0:o.blockhash}async function Xe(e,t){return e.getSignatureStatuses([t]),new Promise((n,r)=>{let o=setTimeout(r,6e4);e.onSignature(t,i=>{if(clearTimeout(o),!i.err){n("");return}r(i.err.toString())},"confirmed")})}function zr(e,t){e.length<1&&gn.logWithError(`no instructions provided: ${e.toString()}`),t.length<1&&gn.logWithError(`no signers provided:, ${t.toString()}`);let n=new j.Transaction;n.recentBlockhash="11111111111111111111111111111111",n.feePayer=t[0],n.add(...e);try{return Buffer.from(n.serialize({verifySignatures:!1})).toString("base64").length<yn}catch{return!1}}function wn(e,t){let[n,r]=j.PublicKey.findProgramAddressSync(e,t);return{publicKey:n,nonce:r}}function Ie({instructions:e,payer:t,signers:n}){return zr(e,[t,...n])}function Ne({instructions:e,payer:t,lookupTableAddressAccount:n,recentBlockhash:r=j.Keypair.generate().publicKey.toString()}){let i=new j.TransactionMessage({payerKey:t,recentBlockhash:r,instructions:e}).compileToV0Message(Object.values(n!=null?n:{}));try{return Buffer.from(new j.VersionedTransaction(i).serialize()).toString("base64").length<yn}catch{return!1}}var Yr=e=>Buffer.isBuffer(e)?e:e instanceof Uint8Array?Buffer.from(e.buffer,e.byteOffset,e.byteLength):Buffer.from(e),Zr=e=>{let t=e.serialize({requireAllSignatures:!1,verifySignatures:!1});e instanceof j.VersionedTransaction&&(t=Yr(t));try{return t instanceof Buffer?t.toString("base64"):Buffer.from(t).toString("base64")}catch{return t.toString("base64")}};function he(e){let t=[];return e.forEach(n=>{n instanceof j.Transaction&&(n.recentBlockhash||(n.recentBlockhash=bn.TOKEN_PROGRAM_ID.toBase58()),n.feePayer||(n.feePayer=j.Keypair.generate().publicKey)),t.push(Zr(n))}),console.log("simulate tx string:",t),t}function Qe(e,t,n){return wn([e.toBuffer(),(n!=null?n:Tn.TOKEN_PROGRAM_ID).toBuffer(),t.toBuffer()],new xn.PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"))}var C=require("@solana/web3.js"),Ts=new C.PublicKey("EhhTKczWMGQt46ynNeRX1WfeagwwJd7ufHvCDjRxjo5Q"),Ps=new C.PublicKey("9KEPoZmtHUrBbhWN1v1KWLMkkvwY6WLtAVUCPRtRjP4z"),As=new C.PublicKey("FarmqiPv5eAj3j1GMdMCMUGXqPUvmquZtMy86QH6rzhG"),ks=new C.PublicKey("CLaimxFqjHzgTJtAGHU47NPhg6qrc5sCnpC4tBLyABQS"),Bs=new C.PublicKey("srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX"),Cs=new C.PublicKey("9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin"),Ss=new C.PublicKey("675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8"),Ls=new C.PublicKey("5quBtoiQqxF9Jv6KYKctB59NT3gtJD2Y65kdnB1Uev3h"),Is=new C.PublicKey("CDSr3ssLcRB6XYPJwAfFt18MZvEZp4LjHcvzBVZ45duo"),Ns=new C.PublicKey("CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK"),Es=new C.PublicKey("LockrWmn6K5twhz3y9w1dQERbmgSaRkfnTeTKbpofwE"),_s=new C.PublicKey("kN1kEznaF5Xbd8LYuqtEFcxzWSBk5Fv6ygX6SqEGJVy"),Rs=new C.PublicKey("routeUGWgWzqBWFcrCfv8tritsqukccJPu3q5GPP3xS"),Ms=new C.PublicKey("7YttLkHDoNj9wyDur5pM1ejNaAvT9X4eqaYcHQqtj2G5"),Ds=new C.PublicKey("6FJon3QE27qgPVggARueB22hLvoh22VzJpXv4rBEoSLF"),Ks=new C.PublicKey("CC12se5To1CdEuw7fDS27B7Geo5jJyL7t5UK2B44NgiH"),Os=new C.PublicKey("9HzJyW1qZsEiSfMUf6L2jo3CcTKAyBmSyKdwQeYisHrC"),vs=new C.PublicKey("DropEU8AvevN3UrXWXTMuz3rqnMczQVNjq3kcSdW2SQi"),Fs=new C.PublicKey("SNaPnpKUY656VPwbKmKT8FG4T85g4VWhRH1B4TQUfKs"),Vs=new C.PublicKey("9pR79Lqe6wDNjag3v8MeVYUostoXjY2ognTydor6AtEZ"),Us=new C.PublicKey("DNXgeM9EiiaAbaWvwjHj9fQQLAX5ZsfHyvmYUNRAdNC8"),Xr=new C.PublicKey("4AscABy58S62owbByjUUkQfZsP7fxYH1rDYb69V58HPM"),Qr=new C.PublicKey("7rQ1QFNosMkUCuh7Z7fPbTHvh73b68sQYdirycEzJVuw"),Jr=new C.PublicKey("G11FKBRaAkHAKuLCgLM6K6NUc9rTjPAznRCjZifrTQe2"),Ws=new C.PublicKey("LockrWmn6K5twhz3y9w1dQERbmgSaRkfnTeTKbpofwE"),$r=new C.PublicKey("DLockwT7X7sxtLmGH9g5kmfcjaBtncdbUmi738m5bvQC"),qs=new C.PublicKey("3f7GcQFG397GAaEnv51zR6tsTVihYRydnydDD1cXekxH"),eo=new C.PublicKey("7AFUeLVRjBfzqK3tTGw8hN48KLQWSk6DTE8xprWdPqix");var Gs={SERUM_MARKET:C.PublicKey.default,OPENBOOK_MARKET:new C.PublicKey("EoTcMgcDRTJVZDMZWBoU6rhYHZfkNTVEAfz3uUJRcYGj"),UTIL1216:C.PublicKey.default,FarmV3:new C.PublicKey("85BFyr98MbCUU9MVTEgzx1nbhWACbJqLzho6zd6DZcWL"),FarmV5:new C.PublicKey("EcLzTrNg9V7qhcdyXDe2qjtPkiGzDM2UbdRaeaadU5r2"),FarmV6:new C.PublicKey("Farm2hJLcqPtPg8M4rR6DMrsRNc5TPm5Cs4bVQrMe2T7"),AmmV4:new C.PublicKey("HWy1jotHpo6UqeQxx49dpYYdQB8wj9Qk9MdxwjLvDHB8"),AmmStable:new C.PublicKey("DDg4VmQaJV9ogWce7LpcjBA9bv22wRp5uaTPa5pGjijF"),CLMM:new C.PublicKey("devi51mZmdwUJGU9hjN27vEz64Gps7uUefqxg27EAtH"),CLMM_LOCK_PROGRAM_ID:new C.PublicKey("DLockwT7X7sxtLmGH9g5kmfcjaBtncdbUmi738m5bvQC"),CLMM_LOCK_AUTH_ID:new C.PublicKey("8qmHNvu2Kr2C7U8mJL4Vz1vTDxMhVuXKREwU7TNoaVEo"),Router:new C.PublicKey("BVChZ3XFEwTMUk1o9i3HAf91H6mFxSwa5X2wFAWhYPhU"),CREATE_CPMM_POOL_PROGRAM:Xr,CREATE_CPMM_POOL_AUTH:Qr,CREATE_CPMM_POOL_FEE_ACC:Jr,FEE_DESTINATION_ID:new C.PublicKey("3XMrhbv989VxAMi3DErLV9eJht1pHppW5LbKxe9fkEFR"),LOCK_CPMM_PROGRAM:$r,LCOK_CPMM_AUTH:eo};var to=z(require("bn.js"));var le=require("@solana/web3.js");async function At({connection:e,address:t}){let n=await Vt(e,[...new Set(t.map(o=>o.toString()))].map(o=>new le.PublicKey(o))),r={};for(let o=0;o<t.length;o++){let i=n[o],s=t[o];if(!i)continue;let a=new le.AddressLookupTableAccount({key:s,state:le.AddressLookupTableAccount.deserialize(i.data)});r[s.toString()]=a,Je[s.toString()]=a}return r}var Je={"2immgwYNHBbyVQKVGCEkgWpi53bLwWNRMB5G2nbgYV17":new le.AddressLookupTableAccount({key:new le.PublicKey("2immgwYNHBbyVQKVGCEkgWpi53bLwWNRMB5G2nbgYV17"),state:le.AddressLookupTableAccount.deserialize(Buffer.from("AQAAAP//////////d49+DAAAAAAAAQZMWvw7GUNJdaccNBVnb57OKakxL2BHLYvhRwVILRsgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMGRm/lIRcy/+ytunLDm+e8jOW7xfcSayxDmzpAAAAABt324ddloZPZy+FGzut5rBy0he1fWzeROoz1hX7/AKkG3fbh7nWP3hhCXbzkbM3athr8TYO5DSf+vfko2KGL/AVKU1D4XciC1hSlVnJ4iilt3x6rq9CmBniISTL07vagBqfVFxksXFEhjMlMPUrxf1ja7gibof1E49vZigAAAAAGp9UXGMd0yShWY5hpHV62i164o5tLbVxzVVshAAAAAIyXJY9OJInxuz0QKRSODYMLWhOZ2v8QhASOe9jb6fhZC3BlsePRfEU4nVJ/awTDzVi4bHMaoP21SbbRvAP4KUbIScv+6Yw2LHF/6K0ZjUPibbSWXCirYPGuuVl7zT789IUPLW4CpHr4JNCatp3ELXDLKMv6JJ+37le50lbBJ2LvDQdRqCgtphMF/imcN7mY5YRx2xE1A3MQ+L4QRaYK9u4GRfZP3LsAd00a+IkCpA22UNQMKdq5BFbJuwuOLqc8zxCTDlqxBG8J0HcxtfogQHDK06ukzfaXiNDKAob1MqBHS9lJxDYCwz8gd5DtFqNSTKG5l1zxIaKpDP/sffi2is1H9aKveyXSu5StXElYRl9SD