test-raydium-sdk-v2
Version:
An SDK for building applications on top of Raydium.
1 lines • 305 kB
JavaScript
var gu=Object.defineProperty,wu=Object.defineProperties;var ku=Object.getOwnPropertyDescriptors;var xr=Object.getOwnPropertySymbols;var $o=Object.prototype.hasOwnProperty,es=Object.prototype.propertyIsEnumerable;var Jo=(r,e,t)=>e in r?gu(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,M=(r,e)=>{for(var t in e||(e={}))$o.call(e,t)&&Jo(r,t,e[t]);if(xr)for(var t of xr(e))es.call(e,t)&&Jo(r,t,e[t]);return r},D=(r,e)=>wu(r,ku(e));var _e=(r,e)=>{var t={};for(var n in r)$o.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&xr)for(var n of xr(r))e.indexOf(n)<0&&es.call(r,n)&&(t[n]=r[n]);return t};import sl from"axios";import{get as yi,set as ts}from"lodash";import ns from"dayjs";import Au from"dayjs/plugin/utc";ns.extend(Au);var hu=(i=>(i[i.Error=0]="Error",i[i.Warning=1]="Warning",i[i.Info=2]="Info",i[i.Debug=3]="Debug",i))(hu||{}),bi=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 ns().utc().format("YYYY/MM/DD HH:mm:ss UTC")}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}},gi={},rs={};function se(r){let e=yi(gi,r);if(!e){let t=yi(rs,r);e=new bi({name:r,logLevel:t}),ts(gi,r,e)}return e}function zd(r,e){ts(rs,r,e);let t=yi(gi,r);t&&(t.level=e)}import{PublicKey as Mc}from"@solana/web3.js";import _c from"bn.js";import Oc from"big.js";import Ut from"bn.js";import ke from"bn.js";var yn=9e15,Dt=1e9,wi="0123456789abcdef",Sr="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Kr="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",ki={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-yn,maxE:yn,crypto:!1},as,Ct,J=!0,Rr="[DecimalError] ",Wt=Rr+"Invalid argument: ",us=Rr+"Precision limit exceeded",cs=Rr+"crypto unavailable",ls="[object Decimal]",We=Math.floor,Ce=Math.pow,Pu=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Tu=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Iu=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,ms=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,lt=1e7,Y=7,xu=9007199254740991,Bu=Sr.length-1,Ai=Kr.length-1,C={toStringTag:ls};C.absoluteValue=C.abs=function(){var r=new this.constructor(this);return r.s<0&&(r.s=1),X(r)};C.ceil=function(){return X(new this.constructor(this),this.e+1,2)};C.clampedTo=C.clamp=function(r,e){var t,n=this,i=n.constructor;if(r=new i(r),e=new i(e),!r.s||!e.s)return new i(NaN);if(r.gt(e))throw Error(Wt+e);return t=n.cmp(r),t<0?r:n.cmp(e)>0?e:new i(n)};C.comparedTo=C.cmp=function(r){var e,t,n,i,o=this,s=o.d,a=(r=new o.constructor(r)).d,u=o.s,c=r.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(o.e!==r.e)return o.e>r.e^u<0?1:-1;for(n=s.length,i=a.length,e=0,t=n<i?n:i;e<t;++e)if(s[e]!==a[e])return s[e]>a[e]^u<0?1:-1;return n===i?0:n>i^u<0?1:-1};C.cosine=C.cos=function(){var r,e,t=this,n=t.constructor;return t.d?t.d[0]?(r=n.precision,e=n.rounding,n.precision=r+Math.max(t.e,t.sd())+Y,n.rounding=1,t=Su(n,bs(n,t)),n.precision=r,n.rounding=e,X(Ct==2||Ct==3?t.neg():t,r,e,!0)):new n(1):new n(NaN)};C.cubeRoot=C.cbrt=function(){var r,e,t,n,i,o,s,a,u,c,l=this,m=l.constructor;if(!l.isFinite()||l.isZero())return new m(l);for(J=!1,o=l.s*Ce(l.s*l,1/3),!o||Math.abs(o)==1/0?(t=Ve(l.d),r=l.e,(o=(r-t.length+1)%3)&&(t+=o==1||o==-2?"0":"00"),o=Ce(t,1/3),r=We((r+1)/3)-(r%3==(r<0?-1:2)),o==1/0?t="5e"+r:(t=o.toExponential(),t=t.slice(0,t.indexOf("e")+1)+r),n=new m(t),n.s=l.s):n=new m(o.toString()),s=(r=m.precision)+3;;)if(a=n,u=a.times(a).times(a),c=u.plus(l),n=ge(c.plus(l).times(a),c.plus(u),s+2,1),Ve(a.d).slice(0,s)===(t=Ve(n.d)).slice(0,s))if(t=t.slice(s-3,s+1),t=="9999"||!i&&t=="4999"){if(!i&&(X(a,r+1,0),a.times(a).times(a).eq(l))){n=a;break}s+=4,i=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(X(n,r+1,1),e=!n.times(n).times(n).eq(l));break}return J=!0,X(n,r,m.rounding,e)};C.decimalPlaces=C.dp=function(){var r,e=this.d,t=NaN;if(e){if(r=e.length-1,t=(r-We(this.e/Y))*Y,r=e[r],r)for(;r%10==0;r/=10)t--;t<0&&(t=0)}return t};C.dividedBy=C.div=function(r){return ge(this,new this.constructor(r))};C.dividedToIntegerBy=C.divToInt=function(r){var e=this,t=e.constructor;return X(ge(e,new t(r),0,1,1),t.precision,t.rounding)};C.equals=C.eq=function(r){return this.cmp(r)===0};C.floor=function(){return X(new this.constructor(this),this.e+1,3)};C.greaterThan=C.gt=function(r){return this.cmp(r)>0};C.greaterThanOrEqualTo=C.gte=function(r){var e=this.cmp(r);return e==1||e===0};C.hyperbolicCosine=C.cosh=function(){var r,e,t,n,i,o=this,s=o.constructor,a=new s(1);if(!o.isFinite())return new s(o.s?1/0:NaN);if(o.isZero())return a;t=s.precision,n=s.rounding,s.precision=t+Math.max(o.e,o.sd())+4,s.rounding=1,i=o.d.length,i<32?(r=Math.ceil(i/3),e=(1/Or(4,r)).toString()):(r=16,e="2.3283064365386962890625e-10"),o=bn(s,1,o.times(e),new s(1),!0);for(var u,c=r,l=new s(8);c--;)u=o.times(o),o=a.minus(u.times(l.minus(u.times(l))));return X(o,s.precision=t,s.rounding=n,!0)};C.hyperbolicSine=C.sinh=function(){var r,e,t,n,i=this,o=i.constructor;if(!i.isFinite()||i.isZero())return new o(i);if(e=o.precision,t=o.rounding,o.precision=e+Math.max(i.e,i.sd())+4,o.rounding=1,n=i.d.length,n<3)i=bn(o,2,i,i,!0);else{r=1.4*Math.sqrt(n),r=r>16?16:r|0,i=i.times(1/Or(5,r)),i=bn(o,2,i,i,!0);for(var s,a=new o(5),u=new o(16),c=new o(20);r--;)s=i.times(i),i=i.times(a.plus(s.times(u.times(s).plus(c))))}return o.precision=e,o.rounding=t,X(i,e,t,!0)};C.hyperbolicTangent=C.tanh=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+7,n.rounding=1,ge(t.sinh(),t.cosh(),n.precision=r,n.rounding=e)):new n(t.s)};C.inverseCosine=C.acos=function(){var r,e=this,t=e.constructor,n=e.abs().cmp(1),i=t.precision,o=t.rounding;return n!==-1?n===0?e.isNeg()?ct(t,i,o):new t(0):new t(NaN):e.isZero()?ct(t,i+4,o).times(.5):(t.precision=i+6,t.rounding=1,e=e.asin(),r=ct(t,i+4,o).times(.5),t.precision=i,t.rounding=o,r.minus(e))};C.inverseHyperbolicCosine=C.acosh=function(){var r,e,t=this,n=t.constructor;return t.lte(1)?new n(t.eq(1)?0:NaN):t.isFinite()?(r=n.precision,e=n.rounding,n.precision=r+Math.max(Math.abs(t.e),t.sd())+4,n.rounding=1,J=!1,t=t.times(t).minus(1).sqrt().plus(t),J=!0,n.precision=r,n.rounding=e,t.ln()):new n(t)};C.inverseHyperbolicSine=C.asinh=function(){var r,e,t=this,n=t.constructor;return!t.isFinite()||t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+2*Math.max(Math.abs(t.e),t.sd())+6,n.rounding=1,J=!1,t=t.times(t).plus(1).sqrt().plus(t),J=!0,n.precision=r,n.rounding=e,t.ln())};C.inverseHyperbolicTangent=C.atanh=function(){var r,e,t,n,i=this,o=i.constructor;return i.isFinite()?i.e>=0?new o(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(r=o.precision,e=o.rounding,n=i.sd(),Math.max(n,r)<2*-i.e-1?X(new o(i),r,e,!0):(o.precision=t=n-i.e,i=ge(i.plus(1),new o(1).minus(i),t+r,1),o.precision=r+4,o.rounding=1,i=i.ln(),o.precision=r,o.rounding=e,i.times(.5))):new o(NaN)};C.inverseSine=C.asin=function(){var r,e,t,n,i=this,o=i.constructor;return i.isZero()?new o(i):(e=i.abs().cmp(1),t=o.precision,n=o.rounding,e!==-1?e===0?(r=ct(o,t+4,n).times(.5),r.s=i.s,r):new o(NaN):(o.precision=t+6,o.rounding=1,i=i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(),o.precision=t,o.rounding=n,i.times(2)))};C.inverseTangent=C.atan=function(){var r,e,t,n,i,o,s,a,u,c=this,l=c.constructor,m=l.precision,p=l.rounding;if(c.isFinite()){if(c.isZero())return new l(c);if(c.abs().eq(1)&&m+4<=Ai)return s=ct(l,m+4,p).times(.25),s.s=c.s,s}else{if(!c.s)return new l(NaN);if(m+4<=Ai)return s=ct(l,m+4,p).times(.5),s.s=c.s,s}for(l.precision=a=m+10,l.rounding=1,t=Math.min(28,a/Y+2|0),r=t;r;--r)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(J=!1,e=Math.ceil(a/Y),n=1,u=c.times(c),s=new l(c),i=c;r!==-1;)if(i=i.times(u),o=s.minus(i.div(n+=2)),i=i.times(u),s=o.plus(i.div(n+=2)),s.d[e]!==void 0)for(r=e;s.d[r]===o.d[r]&&r--;);return t&&(s=s.times(2<<t-1)),J=!0,X(s,l.precision=m,l.rounding=p,!0)};C.isFinite=function(){return!!this.d};C.isInteger=C.isInt=function(){return!!this.d&&We(this.e/Y)>this.d.length-2};C.isNaN=function(){return!this.s};C.isNegative=C.isNeg=function(){return this.s<0};C.isPositive=C.isPos=function(){return this.s>0};C.isZero=function(){return!!this.d&&this.d[0]===0};C.lessThan=C.lt=function(r){return this.cmp(r)<0};C.lessThanOrEqualTo=C.lte=function(r){return this.cmp(r)<1};C.logarithm=C.log=function(r){var e,t,n,i,o,s,a,u,c=this,l=c.constructor,m=l.precision,p=l.rounding,d=5;if(r==null)r=new l(10),e=!0;else{if(r=new l(r),t=r.d,r.s<0||!t||!t[0]||r.eq(1))return new l(NaN);e=r.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)o=!0;else{for(i=t[0];i%10===0;)i/=10;o=i!==1}if(J=!1,a=m+d,s=vt(c,a),n=e?Cr(l,a+10):vt(r,a),u=ge(s,n,a,1),Vn(u.d,i=m,p))do if(a+=10,s=vt(c,a),n=e?Cr(l,a+10):vt(r,a),u=ge(s,n,a,1),!o){+Ve(u.d).slice(i+1,i+15)+1==1e14&&(u=X(u,m+1,0));break}while(Vn(u.d,i+=10,p));return J=!0,X(u,m,p)};C.minus=C.sub=function(r){var e,t,n,i,o,s,a,u,c,l,m,p,d=this,y=d.constructor;if(r=new y(r),!d.d||!r.d)return!d.s||!r.s?r=new y(NaN):d.d?r.s=-r.s:r=new y(r.d||d.s!==r.s?d:NaN),r;if(d.s!=r.s)return r.s=-r.s,d.plus(r);if(c=d.d,p=r.d,a=y.precision,u=y.rounding,!c[0]||!p[0]){if(p[0])r.s=-r.s;else if(c[0])r=new y(d);else return new y(u===3?-0:0);return J?X(r,a,u):r}if(t=We(r.e/Y),l=We(d.e/Y),c=c.slice(),o=l-t,o){for(m=o<0,m?(e=c,o=-o,s=p.length):(e=p,t=l,s=c.length),n=Math.max(Math.ceil(a/Y),s)+2,o>n&&(o=n,e.length=1),e.reverse(),n=o;n--;)e.push(0);e.reverse()}else{for(n=c.length,s=p.length,m=n<s,m&&(s=n),n=0;n<s;n++)if(c[n]!=p[n]){m=c[n]<p[n];break}o=0}for(m&&(e=c,c=p,p=e,r.s=-r.s),s=c.length,n=p.length-s;n>0;--n)c[s++]=0;for(n=p.length;n>o;){if(c[--n]<p[n]){for(i=n;i&&c[--i]===0;)c[i]=lt-1;--c[i],c[n]+=lt}c[n]-=p[n]}for(;c[--s]===0;)c.pop();for(;c[0]===0;c.shift())--t;return c[0]?(r.d=c,r.e=Lr(c,t),J?X(r,a,u):r):new y(u===3?-0:0)};C.modulo=C.mod=function(r){var e,t=this,n=t.constructor;return r=new n(r),!t.d||!r.s||r.d&&!r.d[0]?new n(NaN):!r.d||t.d&&!t.d[0]?X(new n(t),n.precision,n.rounding):(J=!1,n.modulo==9?(e=ge(t,r.abs(),0,3,1),e.s*=r.s):e=ge(t,r,0,n.modulo,1),e=e.times(r),J=!0,t.minus(e))};C.naturalExponential=C.exp=function(){return hi(this)};C.naturalLogarithm=C.ln=function(){return vt(this)};C.negated=C.neg=function(){var r=new this.constructor(this);return r.s=-r.s,X(r)};C.plus=C.add=function(r){var e,t,n,i,o,s,a,u,c,l,m=this,p=m.constructor;if(r=new p(r),!m.d||!r.d)return!m.s||!r.s?r=new p(NaN):m.d||(r=new p(r.d||m.s===r.s?m:NaN)),r;if(m.s!=r.s)return r.s=-r.s,m.minus(r);if(c=m.d,l=r.d,a=p.precision,u=p.rounding,!c[0]||!l[0])return l[0]||(r=new p(m)),J?X(r,a,u):r;if(o=We(m.e/Y),n=We(r.e/Y),c=c.slice(),i=o-n,i){for(i<0?(t=c,i=-i,s=l.length):(t=l,n=o,s=c.length),o=Math.ceil(a/Y),s=o>s?o+1:s+1,i>s&&(i=s,t.length=1),t.reverse();i--;)t.push(0);t.reverse()}for(s=c.length,i=l.length,s-i<0&&(i=s,t=l,l=c,c=t),e=0;i;)e=(c[--i]=c[i]+l[i]+e)/lt|0,c[i]%=lt;for(e&&(c.unshift(e),++n),s=c.length;c[--s]==0;)c.pop();return r.d=c,r.e=Lr(c,n),J?X(r,a,u):r};C.precision=C.sd=function(r){var e,t=this;if(r!==void 0&&r!==!!r&&r!==1&&r!==0)throw Error(Wt+r);return t.d?(e=ds(t.d),r&&t.e+1>e&&(e=t.e+1)):e=NaN,e};C.round=function(){var r=this,e=r.constructor;return X(new e(r),r.e+1,e.rounding)};C.sine=C.sin=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+Math.max(t.e,t.sd())+Y,n.rounding=1,t=Cu(n,bs(n,t)),n.precision=r,n.rounding=e,X(Ct>2?t.neg():t,r,e,!0)):new n(NaN)};C.squareRoot=C.sqrt=function(){var r,e,t,n,i,o,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(J=!1,c=Math.sqrt(+s),c==0||c==1/0?(e=Ve(a),(e.length+u)%2==0&&(e+="0"),c=Math.sqrt(e),u=We((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(o=n,n=o.plus(ge(s,o,t+2,1)).times(.5),Ve(o.d).slice(0,t)===(e=Ve(n.d)).slice(0,t))if(e=e.slice(t-3,t+1),e=="9999"||!i&&e=="4999"){if(!i&&(X(o,u+1,0),o.times(o).eq(s))){n=o;break}t+=4,i=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(X(n,u+1,1),r=!n.times(n).eq(s));break}return J=!0,X(n,u,l.rounding,r)};C.tangent=C.tan=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+10,n.rounding=1,t=t.sin(),t.s=1,t=ge(t,new n(1).minus(t.times(t)).sqrt(),r+10,0),n.precision=r,n.rounding=e,X(Ct==2||Ct==4?t.neg():t,r,e,!0)):new n(NaN)};C.times=C.mul=function(r){var e,t,n,i,o,s,a,u,c,l=this,m=l.constructor,p=l.d,d=(r=new m(r)).d;if(r.s*=l.s,!p||!p[0]||!d||!d[0])return new m(!r.s||p&&!p[0]&&!d||d&&!d[0]&&!p?NaN:!p||!d?r.s/0:r.s*0);for(t=We(l.e/Y)+We(r.e/Y),u=p.length,c=d.length,u<c&&(o=p,p=d,d=o,s=u,u=c,c=s),o=[],s=u+c,n=s;n--;)o.push(0);for(n=c;--n>=0;){for(e=0,i=u+n;i>n;)a=o[i]+d[n]*p[i-n-1]+e,o[i--]=a%lt|0,e=a/lt|0;o[i]=(o[i]+e)%lt|0}for(;!o[--s];)o.pop();return e?++t:o.shift(),r.d=o,r.e=Lr(o,t),J?X(r,m.precision,m.rounding):r};C.toBinary=function(r,e){return Ti(this,2,r,e)};C.toDecimalPlaces=C.toDP=function(r,e){var t=this,n=t.constructor;return t=new n(t),r===void 0?t:(Je(r,0,Dt),e===void 0?e=n.rounding:Je(e,0,8),X(t,r+t.e+1,e))};C.toExponential=function(r,e){var t,n=this,i=n.constructor;return r===void 0?t=wt(n,!0):(Je(r,0,Dt),e===void 0?e=i.rounding:Je(e,0,8),n=X(new i(n),r+1,e),t=wt(n,!0,r+1)),n.isNeg()&&!n.isZero()?"-"+t:t};C.toFixed=function(r,e){var t,n,i=this,o=i.constructor;return r===void 0?t=wt(i):(Je(r,0,Dt),e===void 0?e=o.rounding:Je(e,0,8),n=X(new o(i),r+i.e+1,e),t=wt(n,!1,r+n.e+1)),i.isNeg()&&!i.isZero()?"-"+t:t};C.toFraction=function(r){var e,t,n,i,o,s,a,u,c,l,m,p,d=this,y=d.d,f=d.constructor;if(!y)return new f(d);if(c=t=new f(1),n=u=new f(0),e=new f(n),o=e.e=ds(y)-d.e-1,s=o%Y,e.d[0]=Ce(10,s<0?Y+s:s),r==null)r=o>0?e:c;else{if(a=new f(r),!a.isInt()||a.lt(c))throw Error(Wt+a);r=a.gt(e)?o>0?e:c:a}for(J=!1,a=new f(Ve(y)),l=f.precision,f.precision=o=y.length*Y*2;m=ge(a,e,0,1,1),i=t.plus(m.times(n)),i.cmp(r)!=1;)t=n,n=i,i=c,c=u.plus(m.times(i)),u=i,i=e,e=a.minus(m.times(i)),a=i;return i=ge(r.minus(t),n,0,1,1),u=u.plus(i.times(c)),t=t.plus(i.times(n)),u.s=c.s=d.s,p=ge(c,n,o,1).minus(d).abs().cmp(ge(u,t,o,1).minus(d).abs())<1?[c,n]:[u,t],f.precision=l,J=!0,p};C.toHexadecimal=C.toHex=function(r,e){return Ti(this,16,r,e)};C.toNearest=function(r,e){var t=this,n=t.constructor;if(t=new n(t),r==null){if(!t.d)return t;r=new n(1),e=n.rounding}else{if(r=new n(r),e===void 0?e=n.rounding:Je(e,0,8),!t.d)return r.s?t:r;if(!r.d)return r.s&&(r.s=t.s),r}return r.d[0]?(J=!1,t=ge(t,r,0,e,1).times(r),J=!0,X(t)):(r.s=t.s,t=r),t};C.toNumber=function(){return+this};C.toOctal=function(r,e){return Ti(this,8,r,e)};C.toPower=C.pow=function(r){var e,t,n,i,o,s,a=this,u=a.constructor,c=+(r=new u(r));if(!a.d||!r.d||!a.d[0]||!r.d[0])return new u(Ce(+a,c));if(a=new u(a),a.eq(1))return a;if(n=u.precision,o=u.rounding,r.eq(1))return X(a,n,o);if(e=We(r.e/Y),e>=r.d.length-1&&(t=c<0?-c:c)<=xu)return i=ps(u,a,t,n),r.s<0?new u(1).div(i):X(i,n,o);if(s=a.s,s<0){if(e<r.d.length-1)return new u(NaN);if((r.d[e]&1)==0&&(s=1),a.e==0&&a.d[0]==1&&a.d.length==1)return a.s=s,a}return t=Ce(+a,c),e=t==0||!isFinite(t)?We(c*(Math.log("0."+Ve(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):(J=!1,u.rounding=a.s=1,t=Math.min(12,(e+"").length),i=hi(r.times(vt(a,n+t)),n),i.d&&(i=X(i,n+5,1),Vn(i.d,n,o)&&(e=n+10,i=X(hi(r.times(vt(a,e+t)),e),e+5,1),+Ve(i.d).slice(n+1,n+15)+1==1e14&&(i=X(i,n+1,0)))),i.s=s,J=!0,u.rounding=o,X(i,n,o))};C.toPrecision=function(r,e){var t,n=this,i=n.constructor;return r===void 0?t=wt(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(Je(r,1,Dt),e===void 0?e=i.rounding:Je(e,0,8),n=X(new i(n),r,e),t=wt(n,r<=n.e||n.e<=i.toExpNeg,r)),n.isNeg()&&!n.isZero()?"-"+t:t};C.toSignificantDigits=C.toSD=function(r,e){var t=this,n=t.constructor;return r===void 0?(r=n.precision,e=n.rounding):(Je(r,1,Dt),e===void 0?e=n.rounding:Je(e,0,8)),X(new n(t),r,e)};C.toString=function(){var r=this,e=r.constructor,t=wt(r,r.e<=e.toExpNeg||r.e>=e.toExpPos);return r.isNeg()&&!r.isZero()?"-"+t:t};C.truncated=C.trunc=function(){return X(new this.constructor(this),this.e+1,1)};C.valueOf=C.toJSON=function(){var r=this,e=r.constructor,t=wt(r,r.e<=e.toExpNeg||r.e>=e.toExpPos);return r.isNeg()?"-"+t:t};function Ve(r){var e,t,n,i=r.length-1,o="",s=r[0];if(i>0){for(o+=s,e=1;e<i;e++)n=r[e]+"",t=Y-n.length,t&&(o+=Ft(t)),o+=n;s=r[e],n=s+"",t=Y-n.length,t&&(o+=Ft(t))}else if(s===0)return"0";for(;s%10===0;)s/=10;return o+s}function Je(r,e,t){if(r!==~~r||r<e||r>t)throw Error(Wt+r)}function Vn(r,e,t,n){var i,o,s,a;for(o=r[0];o>=10;o/=10)--e;return--e<0?(e+=Y,i=0):(i=Math.ceil((e+1)/Y),e%=Y),o=Ce(10,Y-e),a=r[i]%o|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==o||t>3&&a+1==o/2)&&(r[i+1]/o/100|0)==Ce(10,e-2)-1||(a==o/2||a==0)&&(r[i+1]/o/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==o||!n&&t>3&&a+1==o/2)&&(r[i+1]/o/1e3|0)==Ce(10,e-3)-1,s}function Br(r,e,t){for(var n,i=[0],o,s=0,a=r.length;s<a;){for(o=i.length;o--;)i[o]*=e;for(i[0]+=wi.indexOf(r.charAt(s++)),n=0;n<i.length;n++)i[n]>t-1&&(i[n+1]===void 0&&(i[n+1]=0),i[n+1]+=i[n]/t|0,i[n]%=t)}return i.reverse()}function Su(r,e){var t,n,i;if(e.isZero())return e;n=e.d.length,n<32?(t=Math.ceil(n/3),i=(1/Or(4,t)).toString()):(t=16,i="2.3283064365386962890625e-10"),r.precision+=t,e=bn(r,1,e.times(i),new r(1));for(var o=t;o--;){var s=e.times(e);e=s.times(s).minus(s).times(8).plus(1)}return r.precision-=t,e}var ge=function(){function r(n,i,o){var s,a=0,u=n.length;for(n=n.slice();u--;)s=n[u]*i+a,n[u]=s%o|0,a=s/o|0;return a&&n.unshift(a),n}function e(n,i,o,s){var a,u;if(o!=s)u=o>s?1:-1;else for(a=u=0;a<o;a++)if(n[a]!=i[a]){u=n[a]>i[a]?1:-1;break}return u}function t(n,i,o,s){for(var a=0;o--;)n[o]-=a,a=n[o]<i[o]?1:0,n[o]=a*s+n[o]-i[o];for(;!n[0]&&n.length>1;)n.shift()}return function(n,i,o,s,a,u){var c,l,m,p,d,y,f,b,w,h,A,P,T,I,x,O,L,N,v,te,W=n.constructor,ee=n.s==i.s?1:-1,Q=n.d,ne=i.d;if(!Q||!Q[0]||!ne||!ne[0])return new W(!n.s||!i.s||(Q?ne&&Q[0]==ne[0]:!ne)?NaN:Q&&Q[0]==0||!ne?ee*0:ee/0);for(u?(d=1,l=n.e-i.e):(u=lt,d=Y,l=We(n.e/d)-We(i.e/d)),v=ne.length,L=Q.length,w=new W(ee),h=w.d=[],m=0;ne[m]==(Q[m]||0);m++);if(ne[m]>(Q[m]||0)&&l--,o==null?(I=o=W.precision,s=W.rounding):a?I=o+(n.e-i.e)+1:I=o,I<0)h.push(1),y=!0;else{if(I=I/d+2|0,m=0,v==1){for(p=0,ne=ne[0],I++;(m<L||p)&&I--;m++)x=p*u+(Q[m]||0),h[m]=x/ne|0,p=x%ne|0;y=p||m<L}else{for(p=u/(ne[0]+1)|0,p>1&&(ne=r(ne,p,u),Q=r(Q,p,u),v=ne.length,L=Q.length),O=v,A=Q.slice(0,v),P=A.length;P<v;)A[P++]=0;te=ne.slice(),te.unshift(0),N=ne[0],ne[1]>=u/2&&++N;do p=0,c=e(ne,A,v,P),c<0?(T=A[0],v!=P&&(T=T*u+(A[1]||0)),p=T/N|0,p>1?(p>=u&&(p=u-1),f=r(ne,p,u),b=f.length,P=A.length,c=e(f,A,b,P),c==1&&(p--,t(f,v<b?te:ne,b,u))):(p==0&&(c=p=1),f=ne.slice()),b=f.length,b<P&&f.unshift(0),t(A,f,P,u),c==-1&&(P=A.length,c=e(ne,A,v,P),c<1&&(p++,t(A,v<P?te:ne,P,u))),P=A.length):c===0&&(p++,A=[0]),h[m++]=p,c&&A[0]?A[P++]=Q[O]||0:(A=[Q[O]],P=1);while((O++<L||A[0]!==void 0)&&I--);y=A[0]!==void 0}h[0]||h.shift()}if(d==1)w.e=l,as=y;else{for(m=1,p=h[0];p>=10;p/=10)m++;w.e=m+l*d-1,X(w,a?o+w.e+1:o,s,y)}return w}}();function X(r,e,t,n){var i,o,s,a,u,c,l,m,p,d=r.constructor;e:if(e!=null){if(m=r.d,!m)return r;for(i=1,a=m[0];a>=10;a/=10)i++;if(o=e-i,o<0)o+=Y,s=e,l=m[p=0],u=l/Ce(10,i-s-1)%10|0;else if(p=Math.ceil((o+1)/Y),a=m.length,p>=a)if(n){for(;a++<=p;)m.push(0);l=u=0,i=1,o%=Y,s=o-Y+1}else break e;else{for(l=a=m[p],i=1;a>=10;a/=10)i++;o%=Y,s=o-Y+i,u=s<0?0:l/Ce(10,i-s-1)%10|0}if(n=n||e<0||m[p+1]!==void 0||(s<0?l:l%Ce(10,i-s-1)),c=t<4?(u||n)&&(t==0||t==(r.s<0?3:2)):u>5||u==5&&(t==4||n||t==6&&(o>0?s>0?l/Ce(10,i-s):0:m[p-1])%10&1||t==(r.s<0?8:7)),e<1||!m[0])return m.length=0,c?(e-=r.e+1,m[0]=Ce(10,(Y-e%Y)%Y),r.e=-e||0):m[0]=r.e=0,r;if(o==0?(m.length=p,a=1,p--):(m.length=p+1,a=Ce(10,Y-o),m[p]=s>0?(l/Ce(10,i-s)%Ce(10,s)|0)*a:0),c)for(;;)if(p==0){for(o=1,s=m[0];s>=10;s/=10)o++;for(s=m[0]+=a,a=1;s>=10;s/=10)a++;o!=a&&(r.e++,m[0]==lt&&(m[0]=1));break}else{if(m[p]+=a,m[p]!=lt)break;m[p--]=0,a=1}for(o=m.length;m[--o]===0;)m.pop()}return J&&(r.e>d.maxE?(r.d=null,r.e=NaN):r.e<d.minE&&(r.e=0,r.d=[0])),r}function wt(r,e,t){if(!r.isFinite())return ys(r);var n,i=r.e,o=Ve(r.d),s=o.length;return e?(t&&(n=t-s)>0?o=o.charAt(0)+"."+o.slice(1)+Ft(n):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(r.e<0?"e":"e+")+r.e):i<0?(o="0."+Ft(-i-1)+o,t&&(n=t-s)>0&&(o+=Ft(n))):i>=s?(o+=Ft(i+1-s),t&&(n=t-i-1)>0&&(o=o+"."+Ft(n))):((n=i+1)<s&&(o=o.slice(0,n)+"."+o.slice(n)),t&&(n=t-s)>0&&(i+1===s&&(o+="."),o+=Ft(n))),o}function Lr(r,e){var t=r[0];for(e*=Y;t>=10;t/=10)e++;return e}function Cr(r,e,t){if(e>Bu)throw J=!0,t&&(r.precision=t),Error(us);return X(new r(Sr),e,1,!0)}function ct(r,e,t){if(e>Ai)throw Error(us);return X(new r(Kr),e,t,!0)}function ds(r){var e=r.length-1,t=e*Y+1;if(e=r[e],e){for(;e%10==0;e/=10)t--;for(e=r[0];e>=10;e/=10)t++}return t}function Ft(r){for(var e="";r--;)e+="0";return e}function ps(r,e,t,n){var i,o=new r(1),s=Math.ceil(n/Y+4);for(J=!1;;){if(t%2&&(o=o.times(e),os(o.d,s)&&(i=!0)),t=We(t/2),t===0){t=o.d.length-1,i&&o.d[t]===0&&++o.d[t];break}e=e.times(e),os(e.d,s)}return J=!0,o}function is(r){return r.d[r.d.length-1]&1}function fs(r,e,t){for(var n,i=new r(e[0]),o=0;++o<e.length;)if(n=new r(e[o]),n.s)i[t](n)&&(i=n);else{i=n;break}return i}function hi(r,e){var t,n,i,o,s,a,u,c=0,l=0,m=0,p=r.constructor,d=p.rounding,y=p.precision;if(!r.d||!r.d[0]||r.e>17)return new p(r.d?r.d[0]?r.s<0?0:1/0:1:r.s?r.s<0?0:r:0/0);for(e==null?(J=!1,u=y):u=e,a=new p(.03125);r.e>-2;)r=r.times(a),m+=5;for(n=Math.log(Ce(2,m))/Math.LN10*2+5|0,u+=n,t=o=s=new p(1),p.precision=u;;){if(o=X(o.times(r),u,1),t=t.times(++l),a=s.plus(ge(o,t,u,1)),Ve(a.d).slice(0,u)===Ve(s.d).slice(0,u)){for(i=m;i--;)s=X(s.times(s),u,1);if(e==null)if(c<3&&Vn(s.d,u-n,d,c))p.precision=u+=10,t=o=a=new p(1),l=0,c++;else return X(s,p.precision=y,d,J=!0);else return p.precision=y,s}s=a}}function vt(r,e){var t,n,i,o,s,a,u,c,l,m,p,d=1,y=10,f=r,b=f.d,w=f.constructor,h=w.rounding,A=w.precision;if(f.s<0||!b||!b[0]||!f.e&&b[0]==1&&b.length==1)return new w(b&&!b[0]?-1/0:f.s!=1?NaN:b?0:f);if(e==null?(J=!1,l=A):l=e,w.precision=l+=y,t=Ve(b),n=t.charAt(0),Math.abs(o=f.e)<15e14){for(;n<7&&n!=1||n==1&&t.charAt(1)>3;)f=f.times(r),t=Ve(f.d),n=t.charAt(0),d++;o=f.e,n>1?(f=new w("0."+t),o++):f=new w(n+"."+t.slice(1))}else return c=Cr(w,l+2,A).times(o+""),f=vt(new w(n+"."+t.slice(1)),l-y).plus(c),w.precision=A,e==null?X(f,A,h,J=!0):f;for(m=f,u=s=f=ge(f.minus(1),f.plus(1),l,1),p=X(f.times(f),l,1),i=3;;){if(s=X(s.times(p),l,1),c=u.plus(ge(s,new w(i),l,1)),Ve(c.d).slice(0,l)===Ve(u.d).slice(0,l))if(u=u.times(2),o!==0&&(u=u.plus(Cr(w,l+2,A).times(o+""))),u=ge(u,new w(d),l,1),e==null)if(Vn(u.d,l-y,h,a))w.precision=l+=y,c=s=f=ge(m.minus(1),m.plus(1),l,1),p=X(f.times(f),l,1),i=a=1;else return X(u,w.precision=A,h,J=!0);else return w.precision=A,u;u=c,i+=2}}function ys(r){return String(r.s*r.s/0)}function Pi(r,e){var t,n,i;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(i=e.length;e.charCodeAt(i-1)===48;--i);if(e=e.slice(n,i),e){if(i-=n,r.e=t=t-n-1,r.d=[],n=(t+1)%Y,t<0&&(n+=Y),n<i){for(n&&r.d.push(+e.slice(0,n)),i-=Y;n<i;)r.d.push(+e.slice(n,n+=Y));e=e.slice(n),n=Y-e.length}else n-=i;for(;n--;)e+="0";r.d.push(+e),J&&(r.e>r.constructor.maxE?(r.d=null,r.e=NaN):r.e<r.constructor.minE&&(r.e=0,r.d=[0]))}else r.e=0,r.d=[0];return r}function Ku(r,e){var t,n,i,o,s,a,u,c,l;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),ms.test(e))return Pi(r,e)}else if(e==="Infinity"||e==="NaN")return+e||(r.s=NaN),r.e=NaN,r.d=null,r;if(Tu.test(e))t=16,e=e.toLowerCase();else if(Pu.test(e))t=2;else if(Iu.test(e))t=8;else throw Error(Wt+e);for(o=e.search(/p/i),o>0?(u=+e.slice(o+1),e=e.substring(2,o)):e=e.slice(2),o=e.indexOf("."),s=o>=0,n=r.constructor,s&&(e=e.replace(".",""),a=e.length,o=a-o,i=ps(n,new n(t),o,o*2)),c=Br(e,t,lt),l=c.length-1,o=l;c[o]===0;--o)c.pop();return o<0?new n(r.s*0):(r.e=Lr(c,l),r.d=c,J=!1,s&&(r=ge(r,i,a*4)),u&&(r=r.times(Math.abs(u)<54?Ce(2,u):En.pow(2,u))),J=!0,r)}function Cu(r,e){var t,n=e.d.length;if(n<3)return e.isZero()?e:bn(r,2,e,e);t=1.4*Math.sqrt(n),t=t>16?16:t|0,e=e.times(1/Or(5,t)),e=bn(r,2,e,e);for(var i,o=new r(5),s=new r(16),a=new r(20);t--;)i=e.times(e),e=e.times(o.plus(i.times(s.times(i).minus(a))));return e}function bn(r,e,t,n,i){var o,s,a,u,c=1,l=r.precision,m=Math.ceil(l/Y);for(J=!1,u=t.times(t),a=new r(n);;){if(s=ge(a.times(u),new r(e++*e++),l,1),a=i?n.plus(s):n.minus(s),n=ge(s.times(u),new r(e++*e++),l,1),s=a.plus(n),s.d[m]!==void 0){for(o=m;s.d[o]===a.d[o]&&o--;);if(o==-1)break}o=a,a=n,n=s,s=o,c++}return J=!0,s.d.length=m+1,s}function Or(r,e){for(var t=r;--e;)t*=r;return t}function bs(r,e){var t,n=e.s<0,i=ct(r,r.precision,1),o=i.times(.5);if(e=e.abs(),e.lte(o))return Ct=n?4:1,e;if(t=e.divToInt(i),t.isZero())Ct=n?3:2;else{if(e=e.minus(t.times(i)),e.lte(o))return Ct=is(t)?n?2:3:n?4:1,e;Ct=is(t)?n?1:4:n?3:2}return e.minus(i).abs()}function Ti(r,e,t,n){var i,o,s,a,u,c,l,m,p,d=r.constructor,y=t!==void 0;if(y?(Je(t,1,Dt),n===void 0?n=d.rounding:Je(n,0,8)):(t=d.precision,n=d.rounding),!r.isFinite())l=ys(r);else{for(l=wt(r),s=l.indexOf("."),y?(i=2,e==16?t=t*4-3:e==8&&(t=t*3-2)):i=e,s>=0&&(l=l.replace(".",""),p=new d(1),p.e=l.length-s,p.d=Br(wt(p),10,i),p.e=p.d.length),m=Br(l,10,i),o=u=m.length;m[--u]==0;)m.pop();if(!m[0])l=y?"0p+0":"0";else{if(s<0?o--:(r=new d(r),r.d=m,r.e=o,r=ge(r,p,t,n,0,i),m=r.d,o=r.e,c=as),s=m[t],a=i/2,c=c||m[t+1]!==void 0,c=n<4?(s!==void 0||c)&&(n===0||n===(r.s<0?3:2)):s>a||s===a&&(n===4||c||n===6&&m[t-1]&1||n===(r.s<0?8:7)),m.length=t,c)for(;++m[--t]>i-1;)m[t]=0,t||(++o,m.unshift(1));for(u=m.length;!m[u-1];--u);for(s=0,l="";s<u;s++)l+=wi.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=Br(l,i,e),u=m.length;!m[u-1];--u);for(s=1,l="1.";s<u;s++)l+=wi.charAt(m[s])}else l=l.charAt(0)+"."+l.slice(1);l=l+(o<0?"p":"p+")+o}else if(o<0){for(;++o;)l="0"+l;l="0."+l}else if(++o>u)for(o-=u;o--;)l+="0";else o<u&&(l=l.slice(0,o)+"."+l.slice(o))}l=(e==16?"0x":e==2?"0b":e==8?"0o":"")+l}return r.s<0?"-"+l:l}function os(r,e){if(r.length>e)return r.length=e,!0}function Ru(r){return new this(r).abs()}function Lu(r){return new this(r).acos()}function Ou(r){return new this(r).acosh()}function Nu(r,e){return new this(r).plus(e)}function Mu(r){return new this(r).asin()}function _u(r){return new this(r).asinh()}function Vu(r){return new this(r).atan()}function Eu(r){return new this(r).atanh()}function Fu(r,e){r=new this(r),e=new this(e);var t,n=this.precision,i=this.rounding,o=n+4;return!r.s||!e.s?t=new this(NaN):!r.d&&!e.d?(t=ct(this,o,1).times(e.s>0?.25:.75),t.s=r.s):!e.d||r.isZero()?(t=e.s<0?ct(this,n,i):new this(0),t.s=r.s):!r.d||e.isZero()?(t=ct(this,o,1).times(.5),t.s=r.s):e.s<0?(this.precision=o,this.rounding=1,t=this.atan(ge(r,e,o,1)),e=ct(this,o,1),this.precision=n,this.rounding=i,t=r.s<0?t.minus(e):t.plus(e)):t=this.atan(ge(r,e,o,1)),t}function vu(r){return new this(r).cbrt()}function Wu(r){return X(r=new this(r),r.e+1,2)}function Du(r,e,t){return new this(r).clamp(e,t)}function qu(r){if(!r||typeof r!="object")throw Error(Rr+"Object expected");var e,t,n,i=r.defaults===!0,o=["precision",1,Dt,"rounding",0,8,"toExpNeg",-yn,0,"toExpPos",0,yn,"maxE",0,yn,"minE",-yn,0,"modulo",0,9];for(e=0;e<o.length;e+=3)if(t=o[e],i&&(this[t]=ki[t]),(n=r[t])!==void 0)if(We(n)===n&&n>=o[e+1]&&n<=o[e+2])this[t]=n;else throw Error(Wt+t+": "+n);if(t="crypto",i&&(this[t]=ki[t]),(n=r[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(cs);else this[t]=!1;else throw Error(Wt+t+": "+n);return this}function Uu(r){return new this(r).cos()}function Gu(r){return new this(r).cosh()}function gs(r){var e,t,n;function i(o){var s,a,u,c=this;if(!(c instanceof i))return new i(o);if(c.constructor=i,ss(o)){c.s=o.s,J?!o.d||o.e>i.maxE?(c.e=NaN,c.d=null):o.e<i.minE?(c.e=0,c.d=[0]):(c.e=o.e,c.d=o.d.slice()):(c.e=o.e,c.d=o.d?o.d.slice():o.d);return}if(u=typeof o,u==="number"){if(o===0){c.s=1/o<0?-1:1,c.e=0,c.d=[0];return}if(o<0?(o=-o,c.s=-1):c.s=1,o===~~o&&o<1e7){for(s=0,a=o;a>=10;a/=10)s++;J?s>i.maxE?(c.e=NaN,c.d=null):s<i.minE?(c.e=0,c.d=[0]):(c.e=s,c.d=[o]):(c.e=s,c.d=[o]);return}else if(o*0!==0){o||(c.s=NaN),c.e=NaN,c.d=null;return}return Pi(c,o.toString())}else if(u!=="string")throw Error(Wt+o);return(a=o.charCodeAt(0))===45?(o=o.slice(1),c.s=-1):(a===43&&(o=o.slice(1)),c.s=1),ms.test(o)?Pi(c,o):Ku(c,o)}if(i.prototype=C,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.EUCLID=9,i.config=i.set=qu,i.clone=gs,i.isDecimal=ss,i.abs=Ru,i.acos=Lu,i.acosh=Ou,i.add=Nu,i.asin=Mu,i.asinh=_u,i.atan=Vu,i.atanh=Eu,i.atan2=Fu,i.cbrt=vu,i.ceil=Wu,i.clamp=Du,i.cos=Uu,i.cosh=Gu,i.div=Xu,i.exp=zu,i.floor=Yu,i.hypot=Qu,i.ln=ju,i.log=Hu,i.log10=Ju,i.log2=Zu,i.max=$u,i.min=ec,i.mod=tc,i.mul=nc,i.pow=rc,i.random=ic,i.round=oc,i.sign=sc,i.sin=ac,i.sinh=uc,i.sqrt=cc,i.sub=lc,i.sum=mc,i.tan=dc,i.tanh=pc,i.trunc=fc,r===void 0&&(r={}),r&&r.defaults!==!0)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],e=0;e<n.length;)r.hasOwnProperty(t=n[e++])||(r[t]=this[t]);return i.config(r),i}function Xu(r,e){return new this(r).div(e)}function zu(r){return new this(r).exp()}function Yu(r){return X(r=new this(r),r.e+1,3)}function Qu(){var r,e,t=new this(0);for(J=!1,r=0;r<arguments.length;)if(e=new this(arguments[r++]),e.d)t.d&&(t=t.plus(e.times(e)));else{if(e.s)return J=!0,new this(1/0);t=e}return J=!0,t.sqrt()}function ss(r){return r instanceof En||r&&r.toStringTag===ls||!1}function ju(r){return new this(r).ln()}function Hu(r,e){return new this(r).log(e)}function Zu(r){return new this(r).log(2)}function Ju(r){return new this(r).log(10)}function $u(){return fs(this,arguments,"lt")}function ec(){return fs(this,arguments,"gt")}function tc(r,e){return new this(r).mod(e)}function nc(r,e){return new this(r).mul(e)}function rc(r,e){return new this(r).pow(e)}function ic(r){var e,t,n,i,o=0,s=new this(1),a=[];if(r===void 0?r=this.precision:Je(r,1,Dt),n=Math.ceil(r/Y),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(n));o<n;)i=e[o],i>=429e7?e[o]=crypto.getRandomValues(new Uint32Array(1))[0]:a[o++]=i%1e7;else if(crypto.randomBytes){for(e=crypto.randomBytes(n*=4);o<n;)i=e[o]+(e[o+1]<<8)+(e[o+2]<<16)+((e[o+3]&127)<<24),i>=214e7?crypto.randomBytes(4).copy(e,o):(a.push(i%1e7),o+=4);o=n/4}else throw Error(cs);else for(;o<n;)a[o++]=Math.random()*1e7|0;for(n=a[--o],r%=Y,n&&r&&(i=Ce(10,Y-r),a[o]=(n/i|0)*i);a[o]===0;o--)a.pop();if(o<0)t=0,a=[0];else{for(t=-1;a[0]===0;t-=Y)a.shift();for(n=1,i=a[0];i>=10;i/=10)n++;n<Y&&(t-=Y-n)}return s.e=t,s.d=a,s}function oc(r){return X(r=new this(r),r.e+1,this.rounding)}function sc(r){return r=new this(r),r.d?r.d[0]?r.s:0*r.s:r.s||NaN}function ac(r){return new this(r).sin()}function uc(r){return new this(r).sinh()}function cc(r){return new this(r).sqrt()}function lc(r,e){return new this(r).sub(e)}function mc(){var r=0,e=arguments,t=new this(e[r]);for(J=!1;t.s&&++r<e.length;)t=t.plus(e[r]);return J=!0,X(t,this.precision,this.rounding)}function dc(r){return new this(r).tan()}function pc(r){return new this(r).tanh()}function fc(r){return X(r=new this(r),r.e+1,1)}C[Symbol.for("nodejs.util.inspect.custom")]=C.toString;C[Symbol.toStringTag]="Decimal";var En=C.constructor=gs(ki);Sr=new En(Sr);Kr=new En(Kr);var E=En;import{PublicKey as Si}from"@solana/web3.js";import{TOKEN_PROGRAM_ID as yc}from"@solana/spl-token";import{PublicKey as Pe,SystemProgram as bc,SYSVAR_RENT_PUBKEY as gc}from"@solana/web3.js";function k({pubkey:r,isSigner:e=!1,isWritable:t=!0}){return{pubkey:r,isWritable:t,isSigner:e}}var Ii=[k({pubkey:yc,isWritable:!1}),k({pubkey:bc.programId,isWritable:!1}),k({pubkey:gc,isWritable:!1})];function gn({publicKey:r,transformSol:e}){let t=xi(r.toString());if(t instanceof Pe)return e&&t.equals(de)?$:t;if(e&&t.toString()===de.toBase58())return $;if(typeof t=="string"){if(t===Pe.default.toBase58())return Pe.default;try{return new Pe(t)}catch{throw new Error("invalid public key")}}throw new Error("invalid public key")}function xi(r){try{return new Pe(r)}catch{return r}}var wn=new Pe("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),it=new Pe("SysvarRent111111111111111111111111111111111"),Bi=new Pe("SysvarC1ock11111111111111111111111111111111"),kn=new Pe("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),Nr=new Pe("Sysvar1nstructions1111111111111111111111111"),Jd=new Pe("4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R"),$d=new Pe("Ea5SjE2Y6yvCeW5dYTn7PYMuW5ikXkvbGdcmSnXeaLjS"),ep=new Pe("SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt"),tp=new Pe("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"),np=new Pe("Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"),rp=new Pe("mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So"),ip=new Pe("7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj"),op=new Pe("USDH1SM1ojwWUga67PGrgFWUHibbjqMvuMaDkRJTgkX"),sp=new Pe("NRVwhjBQiUPYtfDT5zRBVJajzFQHaBUNtC7SNVvqRFa"),ap=new Pe("ANAxByE6G2WjFp7A4NqtWYXb3mgruyzZYg3spfxe6Lbo"),up=new Pe("7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs"),$=new Pe("So11111111111111111111111111111111111111112"),de=Pe.default;function qt(r){return gn({publicKey:r,transformSol:!0})}import{PublicKey as wc}from"@solana/web3.js";import{TOKEN_PROGRAM_ID as ws}from"@solana/spl-token";var Qe={chainId:101,address:wc.default.toBase58(),programId:ws.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:ws.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 Ki=class{constructor({mint:e,decimals:t,symbol:n,name:i,skipMint:o=!1,isToken2022:s=!1}){if(e===de.toBase58()||e instanceof Si&&de.equals(e)){this.decimals=Re.decimals,this.symbol=Re.symbol,this.name=Re.name,this.mint=new Si(Re.address),this.isToken2022=!1;return}this.decimals=t,this.symbol=n||e.toString().substring(0,6),this.name=i||e.toString().substring(0,6),this.mint=o?Si.default:gn({publicKey:e}),this.isToken2022=s}equals(e){return this===e?!0:this.mint.equals(e.mint)}},oe=Ki;oe.WSOL=new Ki(D(M({},Re),{mint:Re.address}));import _r from"big.js";import hc from"bn.js";import Pc from"decimal.js-light";import kc from"toformat";var Ac=kc,Fn=Ac;var Mr=se("module/fraction"),Ci=Fn(_r),vn=Fn(Pc),Tc={[0]:vn.ROUND_DOWN,[1]:vn.ROUND_HALF_UP,[2]:vn.ROUND_UP},Ic={[0]:_r.roundDown,[1]:_r.roundHalfUp,[2]:_r.roundUp},j=class{constructor(e,t=new hc(1)){this.numerator=q(e),this.denominator=q(t)}get quotient(){return this.numerator.div(this.denominator)}invert(){return new j(this.denominator,this.numerator)}add(e){let t=e instanceof j?e:new j(q(e));return this.denominator.eq(t.denominator)?new j(this.numerator.add(t.numerator),this.denominator):new j(this.numerator.mul(t.denominator).add(t.numerator.mul(this.denominator)),this.denominator.mul(t.denominator))}sub(e){let t=e instanceof j?e:new j(q(e));return this.denominator.eq(t.denominator)?new j(this.numerator.sub(t.numerator),this.denominator):new j(this.numerator.mul(t.denominator).sub(t.numerator.mul(this.denominator)),this.denominator.mul(t.denominator))}mul(e){let t=e instanceof j?e:new j(q(e));return new j(this.numerator.mul(t.numerator),this.denominator.mul(t.denominator))}div(e){let t=e instanceof j?e:new j(q(e));return new j(this.numerator.mul(t.denominator),this.denominator.mul(t.numerator))}toSignificant(e,t={groupSeparator:""},n=1){Number.isInteger(e)||Mr.logWithError(`${e} is not an integer.`),e<=0&&Mr.logWithError(`${e} is not positive.`),vn.set({precision:e+1,rounding:Tc[n]});let i=new vn(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(e);return i.toFormat(i.decimalPlaces(),t)}toFixed(e,t={groupSeparator:""},n=1){return Number.isInteger(e)||Mr.logWithError(`${e} is not an integer.`),e<0&&Mr.logWithError(`${e} is negative.`),Ci.DP=e,Ci.RM=Ic[n]||1,new Ci(this.numerator.toString()).div(this.denominator.toString()).toFormat(e,t)}isZero(){return this.numerator.isZero()}};var xc=se("Raydium_price"),De=class extends j{constructor(t){let{baseToken:n,quoteToken:i,numerator:o,denominator:s}=t;super(o,s);this.baseToken=n,this.quoteToken=i,this.scalar=new j(Li(n.decimals),Li(i.decimals))}get raw(){return new j(this.numerator,this.denominator)}get adjusted(){return super.mul(this.scalar)}invert(){return new De({baseToken:this.quoteToken,quoteToken:this.baseToken,denominator:this.numerator,numerator:this.denominator})}mul(t){this.quoteToken!==t.baseToken&&xc.logWithError("mul token not equals");let n=super.mul(t);return new De({baseToken:this.baseToken,quoteToken:t.quoteToken,denominator:n.denominator,numerator:n.numerator})}toSignificant(t=this.quoteToken.decimals,n,i){return this.adjusted.toSignificant(t,n,i)}toFixed(t=this.quoteToken.decimals,n,i){return this.adjusted.toFixed(t,n,i)}};var Oi=class{constructor({decimals:e,symbol:t="UNKNOWN",name:n="UNKNOWN"}){this.decimals=e,this.symbol=t,this.name=n}equals(e){return this===e}},Wn=Oi;Wn.SOL=new Oi(Qe);function Ep(r,e){return r instanceof oe&&e instanceof oe?r.equals(e):r instanceof oe||e instanceof oe?!1:r===e}import Bc from"bn.js";var ks=new j(new Bc(100)),qe=class extends j{toSignificant(e=5,t,n){return this.mul(ks).toSignificant(e,t,n)}toFixed(e=2,t,n){return this.mul(ks).toFixed(e,t,n)}};function Ie(r){if(r instanceof qe)return new j(r.numerator,r.denominator);if(r instanceof De)return r.adjusted;if(r instanceof pe)try{return Ie(r.toExact())}catch{return new j(Se)}if(r instanceof j)return r;let e=String(r),t=mt(e);return new j(t.numerator,t.denominator)}function Xp(r){var n;if(r instanceof qe)return{fr:new j(r.numerator,r.denominator)};if(r instanceof De)return{fr:r.adjusted};if(r instanceof pe)return{fr:Ie(r.toExact()),decimals:r.token.decimals};if(r instanceof j)return{fr:r};let e=String(r),t=mt(e);return{fr:new j(t.numerator,t.denominator),decimals:(n=t.dec)==null?void 0:n.length}}function zp(r,e){if(r==null||e==null)return!1;let t=Ie(r),n=Ie(e);return t.sub(n).numerator,t.sub(n).numerator.lt(Se)}function Sc(r,e){if(r==null||e==null)return!1;let t=Ie(r),n=Ie(e);return t.sub(n).numerator.gt(Se)}function Yp(r,e){if(r==null||e==null)return!1;let t=Ie(r),n=Ie(e);return t.sub(n).numerator.lte(Se)}function Qp(r,e){if(r==null||e==null)return!1;let t=Ie(r),n=Ie(e);return t.sub(n).numerator.gte(Se)}function Kc(r,e){if(r==null||e==null)return!1;let t=Ie(r),n=Ie(e);return t.sub(n).numerator.eq(Se)}function jp(r,e){if(r==null||e==null)return;let t=Ie(r),n=Ie(e);try{return t.div(n)}catch{return t}}function Hp(r,e){if(r==null||e==null)return;let t=Ie(r),n=Ie(e);return t.sub(n)}function Zp(r){return r==null?!1:!Kc(r,0)}function Jp(r,e){return Sc(e,r)?e:r}function Ni(r,e){if(r==null||e==null)return;let t=Ie(r),n=Ie(e);return t.mul(n)}function $p(r,e){if(r==null||e==null)return;let t=Ie(r),n=Ie(e);return t.add(n)}var Ri=(n=>(n[n.ROUND_DOWN=0]="ROUND_DOWN",n[n.ROUND_HALF_UP=1]="ROUND_HALF_UP",n[n.ROUND_UP=2]="ROUND_UP",n))(Ri||{}),Se=new ke(0),Vr=new ke(1),pf=new ke(2),ff=new ke(3),yf=new ke(5),en=new ke(10),bf=new ke(100),gf=new ke(1e3),wf=new ke(1e4),As=9007199254740991;function q(r){let e=se("Raydium_parseBigNumberish");if(r instanceof ke)return r;if(typeof r=="string"){if(r.match(/^-?[0-9]+$/))return new ke(r);e.logWithError(`invalid BigNumberish string: ${r}`)}return typeof r=="number"?(r%1&&e.logWithError(`BigNumberish number underflow: ${r}`),(r>=As||r<=-As)&&e.logWithError(`BigNumberish number overflow: ${r}`),new ke(String(r))):typeof r=="bigint"?new ke(r.toString()):(e.error(`invalid BigNumberish value: ${r}`),new ke(0))}function Li(r){return en.pow(q(r))}function mt(r){var a;if(r===void 0)return{denominator:"1",numerator:"0"};if(r instanceof ke)return{numerator:r.toString(),denominator:"1"};if(r instanceof j)return{denominator:r.denominator.toString(),numerator:r.numerator.toString()};let e=String(r),[,t="",n="",i=""]=(a=e.replace(",","").match(/(-?)(\d*)\.?(\d*)/))!=null?a:[],o="1"+"0".repeat(i.length),s=t+(n==="0"?"":n)+i||"0";return{denominator:o,numerator:s,sign:t,int:n,dec:i}}function Er(r,e){let t=r.divmod(e);return t.mod.isZero()?t.div:t.div.isNeg()?t.div.isubn(1):t.div.iaddn(1)}function Cc(r){var n;let[,e="",t=""]=(n=r.toFixed(2).match(/(-?)(\d*)\.?(\d*)/))!=null?n:[];return`${e}${t}`}function Fr(r,e=0){return r instanceof ke?r:new ke(Cc(Ts(r).mul(en.pow(new ke(String(e))))))}function Ts(r){if(r instanceof qe)return new j(r.numerator,r.denominator);if(r instanceof De)return r.adjusted;if(r instanceof pe)try{return Ts(r.toExact())}catch{return new j(Se)}if(r instanceof j)return r;let e=String(r),t=mt(e);return new j(t.numerator,t.denominator)}function kf(r,e){let{numerator:t,denominator:n}=mt(r);return new qe(new ke(t),new ke(n).mul(e!=null&&e.alreadyDecimaled?new ke(100):new ke(1)))}function Af(r){let{token:e,numberPrice:t,decimalDone:n}=r,i=new oe({mint:"",decimals:6,symbol:"usd",name:"usd",skipMint:!0}),{numerator:o,denominator:s}=mt(t),a=n?new ke(o).mul(en.pow(new ke(e.decimals))):o,u=new ke(s).mul(en.pow(new ke(i.decimals)));return new De({baseToken:i,denominator:u.toString(),quoteToken:new oe(D(M({},e),{skipMint:!0,mint:""})),numerator:a.toString()})}function hs(r){let e=new Wn({decimals:6,symbol:"usd",name:"usd"}),t=Fr(Ni(r,10**e.decimals));return new tn(e,t)}function hf(r,e){return hs(!e||!r?0:Ni(r,e))}function Rc(r){if(r==null)return;let{numerator:e,denominator:t}=mt(r.toString());return new j(e,t)}function Lc(r){return r instanceof E}function Ps(r){return Lc(r)?Rc(r):Array.isArray(r)?r.map(e=>Ps(e)):Mi(r)?Object.fromEntries(Object.entries(r).map(([e,t])=>[e,Ps(t)])):r}var Nc=se("Raydium_amount"),vr=Fn(Oc);function Is(r,e){let t="0",n="0";if(r.includes(".")){let i=r.split(".");i.length===2?([t,n]=i,n=n.padEnd(e,"0")):Nc.logWithError(`invalid number string, num: ${r}`)}else t=r;return[t,n.slice(0,e)||n]}var pe=class extends j{constructor(t,n,i=!0,o){let s=new Ut(0),a=en.pow(new Ut(t.decimals));if(i)s=q(n);else{let u=new Ut(0),c=new Ut(0);if(typeof n=="string"||typeof n=="number"||typeof n=="bigint"){let[l,m]=Is(n.toString(),t.decimals);u=q(l),c=q(m)}u=u.mul(a),s=u.add(c)}super(s,a);this.logger=se(o||"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 pe(this.token,this.raw.add(t.raw))}subtract(t){return this.token.equals(t.token)||this.logger.logWithError("sub token not equals"),new pe(this.token,this.raw.sub(t.raw))}toSignificant(t=this.token.decimals,n,i=0){return super.toSignificant(t,n,i)}toFixed(t=this.token.decimals,n,i=0){return t>this.token.decimals&&this.logger.logWithError("decimals overflow"),super.toFixed(t,n,i)}toExact(t={groupSeparator:""}){return vr.DP=this.token.decimals,new vr(this.numerator.toString()).div(this.denominator.toString()).toFormat(t)}},tn=class extends j{constructor(t,n,i=!0,o){let s=new Ut(0),a=en.pow(new Ut(t.decimals));if(i)s=q(n);else{let u=new Ut(0),c=new Ut(0);if(typeof n=="string"||typeof n=="number"||typeof n=="bigint"){let[l,m]=Is(n.toString(),t.decimals);u=q(l),c=q(m)}u=u.mul(a),s=u.add(c)}super(s,a);this.logger=se(o||"TokenAmount"),this.currency=t}get raw(){return this.numerator}isZero(){return this.raw.isZero()}gt(t){return this.currency.equals(t.currency)||this.logger.logWithError("gt currency not equals"),this.raw.gt(t.raw)}lt(t){return this.currency.equals(t.currency)||this.logger.logWithError("lt currency not equals"),this.raw.lt(t.raw)}add(t){return this.currency.equals(t.currency)||this.logger.logWithError("add currency not equals"),new tn(this.currency,this.raw.add(t.raw))}sub(t){return this.currency.equals(t.currency)||this.logger.logWithError("sub currency not equals"),new tn(this.currency,this.raw.sub(t.raw))}toSignificant(t=this.currency.decimals,n,i=0){return super.toSignificant(t,n,i)}toFixed(t=this.currency.decimals,n,i=0){return t>this.currency.decimals&&this.logger.logWithError("decimals overflow"),super.toFixed(t,n,i)}toExact(t={groupSeparator:""}){return vr.DP=this.currency.decimals,new vr(this.numerator.toString()).div(this.denominator.toString()).toFormat(t)}};async function xs(r){new Promise(e=>setTimeout(e,r))}function Xf(){return new Date().getTime()}function Mi(r){return typeof r=="object"&&r!==null&&![oe,pe,Mc,j,_c,De,qe].some(e=>typeof e=="object"&&r instanceof e)}function fe(r){return typeof r=="string"?xi(r):Array.isArray(r)?r.map(e=>fe(e)):Mi(r)?Object.fromEntries(Object.entries(r).map(([e,t])=>[e,fe(t)])):r}import{PublicKey as Gn,sendAndConfirmTransaction as Fi,Transaction as Xn,TransactionMessage as zn,VersionedTransaction as Yn}from"@solana/web3.js";import Gc from"axios";var Dn=(t=>(t[t.V0=0]="V0",t[t.LEGACY=1]="LEGACY",t))(Dn||{}),_={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",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"};import{PublicKey as Ss,ComputeBudgetProgram as Bs,Transaction as Dr,TransactionMessage as Vc,Keypair as Ks,VersionedTransaction as Cs}from"@solana/web3.js";import{TOKEN_PROGRAM_ID as Ec}from"@solana/spl-token";var Rt=se("Raydium_txUtil"),Rs=1644;function An(r){let e=[],t=[];return r.microLamports&&(e.push(Bs.setComputeUnitPrice({microLamports:r.microLamports})),t.push(_.SetComputeUnitPrice)),r.units&&(e.push(Bs.setComputeUnitLimit({units:r.u