UNPKG

@raydium-io/raydium-sdk-v2

Version:

An SDK for building applications on top of Raydium.

1 lines 55.3 kB
var An=Object.defineProperty,kn=Object.defineProperties;var Tn=Object.getOwnPropertyDescriptors;var Bt=Object.getOwnPropertySymbols;var hn=Object.prototype.hasOwnProperty,Bn=Object.prototype.propertyIsEnumerable;var xt=(e,t,n)=>t in e?An(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Q=(e,t)=>{for(var n in t||(t={}))hn.call(t,n)&&xt(e,n,t[n]);if(Bt)for(var n of Bt(t))Bn.call(t,n)&&xt(e,n,t[n]);return e},$=(e,t)=>kn(e,Tn(t));import U from"bn.js";var de=9e15,ce=1e9,Ye="0123456789abcdef",Fe="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Ee="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Je={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-de,maxE:de,crypto:!1},Kt,ie,P=!0,De="[DecimalError] ",ue=De+"Invalid argument: ",Nt=De+"Precision limit exceeded",Lt=De+"crypto unavailable",Rt="[object Decimal]",D=Math.floor,M=Math.pow,xn=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,In=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Sn=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,Mt=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Y=1e7,g=7,Cn=9007199254740991,Kn=Fe.length-1,$e=Ee.length-1,p={toStringTag:Rt};p.absoluteValue=p.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),f(e)};p.ceil=function(){return f(new this.constructor(this),this.e+1,2)};p.clampedTo=p.clamp=function(e,t){var n,i=this,r=i.constructor;if(e=new r(e),t=new r(t),!e.s||!t.s)return new r(NaN);if(e.gt(t))throw Error(ue+t);return n=i.cmp(e),n<0?e:i.cmp(t)>0?t:new r(i)};p.comparedTo=p.cmp=function(e){var t,n,i,r,o=this,s=o.d,a=(e=new o.constructor(e)).d,c=o.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(o.e!==e.e)return o.e>e.e^c<0?1:-1;for(i=s.length,r=a.length,t=0,n=i<r?i:r;t<n;++t)if(s[t]!==a[t])return s[t]>a[t]^c<0?1:-1;return i===r?0:i>r^c<0?1:-1};p.cosine=p.cos=function(){var e,t,n=this,i=n.constructor;return n.d?n.d[0]?(e=i.precision,t=i.rounding,i.precision=e+Math.max(n.e,n.sd())+g,i.rounding=1,n=Nn(i,Dt(i,n)),i.precision=e,i.rounding=t,f(ie==2||ie==3?n.neg():n,e,t,!0)):new i(1):new i(NaN)};p.cubeRoot=p.cbrt=function(){var e,t,n,i,r,o,s,a,c,u,l=this,m=l.constructor;if(!l.isFinite()||l.isZero())return new m(l);for(P=!1,o=l.s*M(l.s*l,1/3),!o||Math.abs(o)==1/0?(n=F(l.d),e=l.e,(o=(e-n.length+1)%3)&&(n+=o==1||o==-2?"0":"00"),o=M(n,1/3),e=D((e+1)/3)-(e%3==(e<0?-1:2)),o==1/0?n="5e"+e:(n=o.toExponential(),n=n.slice(0,n.indexOf("e")+1)+e),i=new m(n),i.s=l.s):i=new m(o.toString()),s=(e=m.precision)+3;;)if(a=i,c=a.times(a).times(a),u=c.plus(l),i=I(u.plus(l).times(a),u.plus(c),s+2,1),F(a.d).slice(0,s)===(n=F(i.d)).slice(0,s))if(n=n.slice(s-3,s+1),n=="9999"||!r&&n=="4999"){if(!r&&(f(a,e+1,0),a.times(a).times(a).eq(l))){i=a;break}s+=4,r=1}else{(!+n||!+n.slice(1)&&n.charAt(0)=="5")&&(f(i,e+1,1),t=!i.times(i).times(i).eq(l));break}return P=!0,f(i,e,m.rounding,t)};p.decimalPlaces=p.dp=function(){var e,t=this.d,n=NaN;if(t){if(e=t.length-1,n=(e-D(this.e/g))*g,e=t[e],e)for(;e%10==0;e/=10)n--;n<0&&(n=0)}return n};p.dividedBy=p.div=function(e){return I(this,new this.constructor(e))};p.dividedToIntegerBy=p.divToInt=function(e){var t=this,n=t.constructor;return f(I(t,new n(e),0,1,1),n.precision,n.rounding)};p.equals=p.eq=function(e){return this.cmp(e)===0};p.floor=function(){return f(new this.constructor(this),this.e+1,3)};p.greaterThan=p.gt=function(e){return this.cmp(e)>0};p.greaterThanOrEqualTo=p.gte=function(e){var t=this.cmp(e);return t==1||t===0};p.hyperbolicCosine=p.cosh=function(){var e,t,n,i,r,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;n=s.precision,i=s.rounding,s.precision=n+Math.max(o.e,o.sd())+4,s.rounding=1,r=o.d.length,r<32?(e=Math.ceil(r/3),t=(1/_e(4,e)).toString()):(e=16,t="2.3283064365386962890625e-10"),o=pe(s,1,o.times(t),new s(1),!0);for(var c,u=e,l=new s(8);u--;)c=o.times(o),o=a.minus(c.times(l.minus(c.times(l))));return f(o,s.precision=n,s.rounding=i,!0)};p.hyperbolicSine=p.sinh=function(){var e,t,n,i,r=this,o=r.constructor;if(!r.isFinite()||r.isZero())return new o(r);if(t=o.precision,n=o.rounding,o.precision=t+Math.max(r.e,r.sd())+4,o.rounding=1,i=r.d.length,i<3)r=pe(o,2,r,r,!0);else{e=1.4*Math.sqrt(i),e=e>16?16:e|0,r=r.times(1/_e(5,e)),r=pe(o,2,r,r,!0);for(var s,a=new o(5),c=new o(16),u=new o(20);e--;)s=r.times(r),r=r.times(a.plus(s.times(c.times(s).plus(u))))}return o.precision=t,o.rounding=n,f(r,t,n,!0)};p.hyperbolicTangent=p.tanh=function(){var e,t,n=this,i=n.constructor;return n.isFinite()?n.isZero()?new i(n):(e=i.precision,t=i.rounding,i.precision=e+7,i.rounding=1,I(n.sinh(),n.cosh(),i.precision=e,i.rounding=t)):new i(n.s)};p.inverseCosine=p.acos=function(){var e,t=this,n=t.constructor,i=t.abs().cmp(1),r=n.precision,o=n.rounding;return i!==-1?i===0?t.isNeg()?j(n,r,o):new n(0):new n(NaN):t.isZero()?j(n,r+4,o).times(.5):(n.precision=r+6,n.rounding=1,t=t.asin(),e=j(n,r+4,o).times(.5),n.precision=r,n.rounding=o,e.minus(t))};p.inverseHyperbolicCosine=p.acosh=function(){var e,t,n=this,i=n.constructor;return n.lte(1)?new i(n.eq(1)?0:NaN):n.isFinite()?(e=i.precision,t=i.rounding,i.precision=e+Math.max(Math.abs(n.e),n.sd())+4,i.rounding=1,P=!1,n=n.times(n).minus(1).sqrt().plus(n),P=!0,i.precision=e,i.rounding=t,n.ln()):new i(n)};p.inverseHyperbolicSine=p.asinh=function(){var e,t,n=this,i=n.constructor;return!n.isFinite()||n.isZero()?new i(n):(e=i.precision,t=i.rounding,i.precision=e+2*Math.max(Math.abs(n.e),n.sd())+6,i.rounding=1,P=!1,n=n.times(n).plus(1).sqrt().plus(n),P=!0,i.precision=e,i.rounding=t,n.ln())};p.inverseHyperbolicTangent=p.atanh=function(){var e,t,n,i,r=this,o=r.constructor;return r.isFinite()?r.e>=0?new o(r.abs().eq(1)?r.s/0:r.isZero()?r:NaN):(e=o.precision,t=o.rounding,i=r.sd(),Math.max(i,e)<2*-r.e-1?f(new o(r),e,t,!0):(o.precision=n=i-r.e,r=I(r.plus(1),new o(1).minus(r),n+e,1),o.precision=e+4,o.rounding=1,r=r.ln(),o.precision=e,o.rounding=t,r.times(.5))):new o(NaN)};p.inverseSine=p.asin=function(){var e,t,n,i,r=this,o=r.constructor;return r.isZero()?new o(r):(t=r.abs().cmp(1),n=o.precision,i=o.rounding,t!==-1?t===0?(e=j(o,n+4,i).times(.5),e.s=r.s,e):new o(NaN):(o.precision=n+6,o.rounding=1,r=r.div(new o(1).minus(r.times(r)).sqrt().plus(1)).atan(),o.precision=n,o.rounding=i,r.times(2)))};p.inverseTangent=p.atan=function(){var e,t,n,i,r,o,s,a,c,u=this,l=u.constructor,m=l.precision,d=l.rounding;if(u.isFinite()){if(u.isZero())return new l(u);if(u.abs().eq(1)&&m+4<=$e)return s=j(l,m+4,d).times(.25),s.s=u.s,s}else{if(!u.s)return new l(NaN);if(m+4<=$e)return s=j(l,m+4,d).times(.5),s.s=u.s,s}for(l.precision=a=m+10,l.rounding=1,n=Math.min(28,a/g+2|0),e=n;e;--e)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(P=!1,t=Math.ceil(a/g),i=1,c=u.times(u),s=new l(u),r=u;e!==-1;)if(r=r.times(c),o=s.minus(r.div(i+=2)),r=r.times(c),s=o.plus(r.div(i+=2)),s.d[t]!==void 0)for(e=t;s.d[e]===o.d[e]&&e--;);return n&&(s=s.times(2<<n-1)),P=!0,f(s,l.precision=m,l.rounding=d,!0)};p.isFinite=function(){return!!this.d};p.isInteger=p.isInt=function(){return!!this.d&&D(this.e/g)>this.d.length-2};p.isNaN=function(){return!this.s};p.isNegative=p.isNeg=function(){return this.s<0};p.isPositive=p.isPos=function(){return this.s>0};p.isZero=function(){return!!this.d&&this.d[0]===0};p.lessThan=p.lt=function(e){return this.cmp(e)<0};p.lessThanOrEqualTo=p.lte=function(e){return this.cmp(e)<1};p.logarithm=p.log=function(e){var t,n,i,r,o,s,a,c,u=this,l=u.constructor,m=l.precision,d=l.rounding,b=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)o=!0;else{for(r=n[0];r%10===0;)r/=10;o=r!==1}if(P=!1,a=m+b,s=ae(u,a),i=t?ve(l,a+10):ae(e,a),c=I(s,i,a,1),we(c.d,r=m,d))do if(a+=10,s=ae(u,a),i=t?ve(l,a+10):ae(e,a),c=I(s,i,a,1),!o){+F(c.d).slice(r+1,r+15)+1==1e14&&(c=f(c,m+1,0));break}while(we(c.d,r+=10,d));return P=!0,f(c,m,d)};p.minus=p.sub=function(e){var t,n,i,r,o,s,a,c,u,l,m,d,b=this,h=b.constructor;if(e=new h(e),!b.d||!e.d)return!b.s||!e.s?e=new h(NaN):b.d?e.s=-e.s:e=new h(e.d||b.s!==e.s?b:NaN),e;if(b.s!=e.s)return e.s=-e.s,b.plus(e);if(u=b.d,d=e.d,a=h.precision,c=h.rounding,!u[0]||!d[0]){if(d[0])e.s=-e.s;else if(u[0])e=new h(b);else return new h(c===3?-0:0);return P?f(e,a,c):e}if(n=D(e.e/g),l=D(b.e/g),u=u.slice(),o=l-n,o){for(m=o<0,m?(t=u,o=-o,s=d.length):(t=d,n=l,s=u.length),i=Math.max(Math.ceil(a/g),s)+2,o>i&&(o=i,t.length=1),t.reverse(),i=o;i--;)t.push(0);t.reverse()}else{for(i=u.length,s=d.length,m=i<s,m&&(s=i),i=0;i<s;i++)if(u[i]!=d[i]){m=u[i]<d[i];break}o=0}for(m&&(t=u,u=d,d=t,e.s=-e.s),s=u.length,i=d.length-s;i>0;--i)u[s++]=0;for(i=d.length;i>o;){if(u[--i]<d[i]){for(r=i;r&&u[--r]===0;)u[r]=Y-1;--u[r],u[i]+=Y}u[i]-=d[i]}for(;u[--s]===0;)u.pop();for(;u[0]===0;u.shift())--n;return u[0]?(e.d=u,e.e=Ve(u,n),P?f(e,a,c):e):new h(c===3?-0:0)};p.modulo=p.mod=function(e){var t,n=this,i=n.constructor;return e=new i(e),!n.d||!e.s||e.d&&!e.d[0]?new i(NaN):!e.d||n.d&&!n.d[0]?f(new i(n),i.precision,i.rounding):(P=!1,i.modulo==9?(t=I(n,e.abs(),0,3,1),t.s*=e.s):t=I(n,e,0,i.modulo,1),t=t.times(e),P=!0,n.minus(t))};p.naturalExponential=p.exp=function(){return et(this)};p.naturalLogarithm=p.ln=function(){return ae(this)};p.negated=p.neg=function(){var e=new this.constructor(this);return e.s=-e.s,f(e)};p.plus=p.add=function(e){var t,n,i,r,o,s,a,c,u,l,m=this,d=m.constructor;if(e=new d(e),!m.d||!e.d)return!m.s||!e.s?e=new d(NaN):m.d||(e=new d(e.d||m.s===e.s?m:NaN)),e;if(m.s!=e.s)return e.s=-e.s,m.minus(e);if(u=m.d,l=e.d,a=d.precision,c=d.rounding,!u[0]||!l[0])return l[0]||(e=new d(m)),P?f(e,a,c):e;if(o=D(m.e/g),i=D(e.e/g),u=u.slice(),r=o-i,r){for(r<0?(n=u,r=-r,s=l.length):(n=l,i=o,s=u.length),o=Math.ceil(a/g),s=o>s?o+1:s+1,r>s&&(r=s,n.length=1),n.reverse();r--;)n.push(0);n.reverse()}for(s=u.length,r=l.length,s-r<0&&(r=s,n=l,l=u,u=n),t=0;r;)t=(u[--r]=u[r]+l[r]+t)/Y|0,u[r]%=Y;for(t&&(u.unshift(t),++i),s=u.length;u[--s]==0;)u.pop();return e.d=u,e.e=Ve(u,i),P?f(e,a,c):e};p.precision=p.sd=function(e){var t,n=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(ue+e);return n.d?(t=Ot(n.d),e&&n.e+1>t&&(t=n.e+1)):t=NaN,t};p.round=function(){var e=this,t=e.constructor;return f(new t(e),e.e+1,t.rounding)};p.sine=p.sin=function(){var e,t,n=this,i=n.constructor;return n.isFinite()?n.isZero()?new i(n):(e=i.precision,t=i.rounding,i.precision=e+Math.max(n.e,n.sd())+g,i.rounding=1,n=Rn(i,Dt(i,n)),i.precision=e,i.rounding=t,f(ie>2?n.neg():n,e,t,!0)):new i(NaN)};p.squareRoot=p.sqrt=function(){var e,t,n,i,r,o,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(P=!1,u=Math.sqrt(+s),u==0||u==1/0?(t=F(a),(t.length+c)%2==0&&(t+="0"),u=Math.sqrt(t),c=D((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),i=new l(t)):i=new l(u.toString()),n=(c=l.precision)+3;;)if(o=i,i=o.plus(I(s,o,n+2,1)).times(.5),F(o.d).slice(0,n)===(t=F(i.d)).slice(0,n))if(t=t.slice(n-3,n+1),t=="9999"||!r&&t=="4999"){if(!r&&(f(o,c+1,0),o.times(o).eq(s))){i=o;break}n+=4,r=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(f(i,c+1,1),e=!i.times(i).eq(s));break}return P=!0,f(i,c,l.rounding,e)};p.tangent=p.tan=function(){var e,t,n=this,i=n.constructor;return n.isFinite()?n.isZero()?new i(n):(e=i.precision,t=i.rounding,i.precision=e+10,i.rounding=1,n=n.sin(),n.s=1,n=I(n,new i(1).minus(n.times(n)).sqrt(),e+10,0),i.precision=e,i.rounding=t,f(ie==2||ie==4?n.neg():n,e,t,!0)):new i(NaN)};p.times=p.mul=function(e){var t,n,i,r,o,s,a,c,u,l=this,m=l.constructor,d=l.d,b=(e=new m(e)).d;if(e.s*=l.s,!d||!d[0]||!b||!b[0])return new m(!e.s||d&&!d[0]&&!b||b&&!b[0]&&!d?NaN:!d||!b?e.s/0:e.s*0);for(n=D(l.e/g)+D(e.e/g),c=d.length,u=b.length,c<u&&(o=d,d=b,b=o,s=c,c=u,u=s),o=[],s=c+u,i=s;i--;)o.push(0);for(i=u;--i>=0;){for(t=0,r=c+i;r>i;)a=o[r]+b[i]*d[r-i-1]+t,o[r--]=a%Y|0,t=a/Y|0;o[r]=(o[r]+t)%Y|0}for(;!o[--s];)o.pop();return t?++n:o.shift(),e.d=o,e.e=Ve(o,n),P?f(e,m.precision,m.rounding):e};p.toBinary=function(e,t){return nt(this,2,e,t)};p.toDecimalPlaces=p.toDP=function(e,t){var n=this,i=n.constructor;return n=new i(n),e===void 0?n:(G(e,0,ce),t===void 0?t=i.rounding:G(t,0,8),f(n,e+n.e+1,t))};p.toExponential=function(e,t){var n,i=this,r=i.constructor;return e===void 0?n=ee(i,!0):(G(e,0,ce),t===void 0?t=r.rounding:G(t,0,8),i=f(new r(i),e+1,t),n=ee(i,!0,e+1)),i.isNeg()&&!i.isZero()?"-"+n:n};p.toFixed=function(e,t){var n,i,r=this,o=r.constructor;return e===void 0?n=ee(r):(G(e,0,ce),t===void 0?t=o.rounding:G(t,0,8),i=f(new o(r),e+r.e+1,t),n=ee(i,!1,e+i.e+1)),r.isNeg()&&!r.isZero()?"-"+n:n};p.toFraction=function(e){var t,n,i,r,o,s,a,c,u,l,m,d,b=this,h=b.d,k=b.constructor;if(!h)return new k(b);if(u=n=new k(1),i=c=new k(0),t=new k(i),o=t.e=Ot(h)-b.e-1,s=o%g,t.d[0]=M(10,s<0?g+s:s),e==null)e=o>0?t:u;else{if(a=new k(e),!a.isInt()||a.lt(u))throw Error(ue+a);e=a.gt(t)?o>0?t:u:a}for(P=!1,a=new k(F(h)),l=k.precision,k.precision=o=h.length*g*2;m=I(a,t,0,1,1),r=n.plus(m.times(i)),r.cmp(e)!=1;)n=i,i=r,r=u,u=c.plus(m.times(r)),c=r,r=t,t=a.minus(m.times(r)),a=r;return r=I(e.minus(n),i,0,1,1),c=c.plus(r.times(u)),n=n.plus(r.times(i)),c.s=u.s=b.s,d=I(u,i,o,1).minus(b).abs().cmp(I(c,n,o,1).minus(b).abs())<1?[u,i]:[c,n],k.precision=l,P=!0,d};p.toHexadecimal=p.toHex=function(e,t){return nt(this,16,e,t)};p.toNearest=function(e,t){var n=this,i=n.constructor;if(n=new i(n),e==null){if(!n.d)return n;e=new i(1),t=i.rounding}else{if(e=new i(e),t===void 0?t=i.rounding:G(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]?(P=!1,n=I(n,e,0,t,1).times(e),P=!0,f(n)):(e.s=n.s,n=e),n};p.toNumber=function(){return+this};p.toOctal=function(e,t){return nt(this,8,e,t)};p.toPower=p.pow=function(e){var t,n,i,r,o,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(M(+a,u));if(a=new c(a),a.eq(1))return a;if(i=c.precision,o=c.rounding,e.eq(1))return f(a,i,o);if(t=D(e.e/g),t>=e.d.length-1&&(n=u<0?-u:u)<=Cn)return r=Ft(c,a,n,i),e.s<0?new c(1).div(r):f(r,i,o);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=M(+a,u),t=n==0||!isFinite(n)?D(u*(Math.log("0."+F(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):(P=!1,c.rounding=a.s=1,n=Math.min(12,(t+"").length),r=et(e.times(ae(a,i+n)),i),r.d&&(r=f(r,i+5,1),we(r.d,i,o)&&(t=i+10,r=f(et(e.times(ae(a,t+n)),t),t+5,1),+F(r.d).slice(i+1,i+15)+1==1e14&&(r=f(r,i+1,0)))),r.s=s,P=!0,c.rounding=o,f(r,i,o))};p.toPrecision=function(e,t){var n,i=this,r=i.constructor;return e===void 0?n=ee(i,i.e<=r.toExpNeg||i.e>=r.toExpPos):(G(e,1,ce),t===void 0?t=r.rounding:G(t,0,8),i=f(new r(i),e,t),n=ee(i,e<=i.e||i.e<=r.toExpNeg,e)),i.isNeg()&&!i.isZero()?"-"+n:n};p.toSignificantDigits=p.toSD=function(e,t){var n=this,i=n.constructor;return e===void 0?(e=i.precision,t=i.rounding):(G(e,1,ce),t===void 0?t=i.rounding:G(t,0,8)),f(new i(n),e,t)};p.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};p.truncated=p.trunc=function(){return f(new this.constructor(this),this.e+1,1)};p.valueOf=p.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 F(e){var t,n,i,r=e.length-1,o="",s=e[0];if(r>0){for(o+=s,t=1;t<r;t++)i=e[t]+"",n=g-i.length,n&&(o+=se(n)),o+=i;s=e[t],i=s+"",n=g-i.length,n&&(o+=se(n))}else if(s===0)return"0";for(;s%10===0;)s/=10;return o+s}function G(e,t,n){if(e!==~~e||e<t||e>n)throw Error(ue+e)}function we(e,t,n,i){var r,o,s,a;for(o=e[0];o>=10;o/=10)--t;return--t<0?(t+=g,r=0):(r=Math.ceil((t+1)/g),t%=g),o=M(10,g-t),a=e[r]%o|0,i==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==o||n>3&&a+1==o/2)&&(e[r+1]/o/100|0)==M(10,t-2)-1||(a==o/2||a==0)&&(e[r+1]/o/100|0)==0:t<4?(t==0?a=a/1e3|0:t==1?a=a/100|0:t==2&&(a=a/10|0),s=(i||n<4)&&a==9999||!i&&n>3&&a==4999):s=((i||n<4)&&a+1==o||!i&&n>3&&a+1==o/2)&&(e[r+1]/o/1e3|0)==M(10,t-3)-1,s}function Oe(e,t,n){for(var i,r=[0],o,s=0,a=e.length;s<a;){for(o=r.length;o--;)r[o]*=t;for(r[0]+=Ye.indexOf(e.charAt(s++)),i=0;i<r.length;i++)r[i]>n-1&&(r[i+1]===void 0&&(r[i+1]=0),r[i+1]+=r[i]/n|0,r[i]%=n)}return r.reverse()}function Nn(e,t){var n,i,r;if(t.isZero())return t;i=t.d.length,i<32?(n=Math.ceil(i/3),r=(1/_e(4,n)).toString()):(n=16,r="2.3283064365386962890625e-10"),e.precision+=n,t=pe(e,1,t.times(r),new e(1));for(var o=n;o--;){var s=t.times(t);t=s.times(s).minus(s).times(8).plus(1)}return e.precision-=n,t}var I=function(){function e(i,r,o){var s,a=0,c=i.length;for(i=i.slice();c--;)s=i[c]*r+a,i[c]=s%o|0,a=s/o|0;return a&&i.unshift(a),i}function t(i,r,o,s){var a,c;if(o!=s)c=o>s?1:-1;else for(a=c=0;a<o;a++)if(i[a]!=r[a]){c=i[a]>r[a]?1:-1;break}return c}function n(i,r,o,s){for(var a=0;o--;)i[o]-=a,a=i[o]<r[o]?1:0,i[o]=a*s+i[o]-r[o];for(;!i[0]&&i.length>1;)i.shift()}return function(i,r,o,s,a,c){var u,l,m,d,b,h,k,_,R,Z,x,E,Ne,ne,ze,Le,ye,Qe,z,Re,Me=i.constructor,je=i.s==r.s?1:-1,v=i.d,S=r.d;if(!v||!v[0]||!S||!S[0])return new Me(!i.s||!r.s||(v?S&&v[0]==S[0]:!S)?NaN:v&&v[0]==0||!S?je*0:je/0);for(c?(b=1,l=i.e-r.e):(c=Y,b=g,l=D(i.e/b)-D(r.e/b)),z=S.length,ye=v.length,R=new Me(je),Z=R.d=[],m=0;S[m]==(v[m]||0);m++);if(S[m]>(v[m]||0)&&l--,o==null?(ne=o=Me.precision,s=Me.rounding):a?ne=o+(i.e-r.e)+1:ne=o,ne<0)Z.push(1),h=!0;else{if(ne=ne/b+2|0,m=0,z==1){for(d=0,S=S[0],ne++;(m<ye||d)&&ne--;m++)ze=d*c+(v[m]||0),Z[m]=ze/S|0,d=ze%S|0;h=d||m<ye}else{for(d=c/(S[0]+1)|0,d>1&&(S=e(S,d,c),v=e(v,d,c),z=S.length,ye=v.length),Le=z,x=v.slice(0,z),E=x.length;E<z;)x[E++]=0;Re=S.slice(),Re.unshift(0),Qe=S[0],S[1]>=c/2&&++Qe;do d=0,u=t(S,x,z,E),u<0?(Ne=x[0],z!=E&&(Ne=Ne*c+(x[1]||0)),d=Ne/Qe|0,d>1?(d>=c&&(d=c-1),k=e(S,d,c),_=k.length,E=x.length,u=t(k,x,_,E),u==1&&(d--,n(k,z<_?Re:S,_,c))):(d==0&&(u=d=1),k=S.slice()),_=k.length,_<E&&k.unshift(0),n(x,k,E,c),u==-1&&(E=x.length,u=t(S,x,z,E),u<1&&(d++,n(x,z<E?Re:S,E,c))),E=x.length):u===0&&(d++,x=[0]),Z[m++]=d,u&&x[0]?x[E++]=v[Le]||0:(x=[v[Le]],E=1);while((Le++<ye||x[0]!==void 0)&&ne--);h=x[0]!==void 0}Z[0]||Z.shift()}if(b==1)R.e=l,Kt=h;else{for(m=1,d=Z[0];d>=10;d/=10)m++;R.e=m+l*b-1,f(R,a?o+R.e+1:o,s,h)}return R}}();function f(e,t,n,i){var r,o,s,a,c,u,l,m,d,b=e.constructor;e:if(t!=null){if(m=e.d,!m)return e;for(r=1,a=m[0];a>=10;a/=10)r++;if(o=t-r,o<0)o+=g,s=t,l=m[d=0],c=l/M(10,r-s-1)%10|0;else if(d=Math.ceil((o+1)/g),a=m.length,d>=a)if(i){for(;a++<=d;)m.push(0);l=c=0,r=1,o%=g,s=o-g+1}else break e;else{for(l=a=m[d],r=1;a>=10;a/=10)r++;o%=g,s=o-g+r,c=s<0?0:l/M(10,r-s-1)%10|0}if(i=i||t<0||m[d+1]!==void 0||(s<0?l:l%M(10,r-s-1)),u=n<4?(c||i)&&(n==0||n==(e.s<0?3:2)):c>5||c==5&&(n==4||i||n==6&&(o>0?s>0?l/M(10,r-s):0:m[d-1])%10&1||n==(e.s<0?8:7)),t<1||!m[0])return m.length=0,u?(t-=e.e+1,m[0]=M(10,(g-t%g)%g),e.e=-t||0):m[0]=e.e=0,e;if(o==0?(m.length=d,a=1,d--):(m.length=d+1,a=M(10,g-o),m[d]=s>0?(l/M(10,r-s)%M(10,s)|0)*a:0),u)for(;;)if(d==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&&(e.e++,m[0]==Y&&(m[0]=1));break}else{if(m[d]+=a,m[d]!=Y)break;m[d--]=0,a=1}for(o=m.length;m[--o]===0;)m.pop()}return P&&(e.e>b.maxE?(e.d=null,e.e=NaN):e.e<b.minE&&(e.e=0,e.d=[0])),e}function ee(e,t,n){if(!e.isFinite())return vt(e);var i,r=e.e,o=F(e.d),s=o.length;return t?(n&&(i=n-s)>0?o=o.charAt(0)+"."+o.slice(1)+se(i):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(e.e<0?"e":"e+")+e.e):r<0?(o="0."+se(-r-1)+o,n&&(i=n-s)>0&&(o+=se(i))):r>=s?(o+=se(r+1-s),n&&(i=n-r-1)>0&&(o=o+"."+se(i))):((i=r+1)<s&&(o=o.slice(0,i)+"."+o.slice(i)),n&&(i=n-s)>0&&(r+1===s&&(o+="."),o+=se(i))),o}function Ve(e,t){var n=e[0];for(t*=g;n>=10;n/=10)t++;return t}function ve(e,t,n){if(t>Kn)throw P=!0,n&&(e.precision=n),Error(Nt);return f(new e(Fe),t,1,!0)}function j(e,t,n){if(t>$e)throw Error(Nt);return f(new e(Ee),t,n,!0)}function Ot(e){var t=e.length-1,n=t*g+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 Ft(e,t,n,i){var r,o=new e(1),s=Math.ceil(i/g+4);for(P=!1;;){if(n%2&&(o=o.times(t),St(o.d,s)&&(r=!0)),n=D(n/2),n===0){n=o.d.length-1,r&&o.d[n]===0&&++o.d[n];break}t=t.times(t),St(t.d,s)}return P=!0,o}function It(e){return e.d[e.d.length-1]&1}function Et(e,t,n){for(var i,r=new e(t[0]),o=0;++o<t.length;)if(i=new e(t[o]),i.s)r[n](i)&&(r=i);else{r=i;break}return r}function et(e,t){var n,i,r,o,s,a,c,u=0,l=0,m=0,d=e.constructor,b=d.rounding,h=d.precision;if(!e.d||!e.d[0]||e.e>17)return new d(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:0/0);for(t==null?(P=!1,c=h):c=t,a=new d(.03125);e.e>-2;)e=e.times(a),m+=5;for(i=Math.log(M(2,m))/Math.LN10*2+5|0,c+=i,n=o=s=new d(1),d.precision=c;;){if(o=f(o.times(e),c,1),n=n.times(++l),a=s.plus(I(o,n,c,1)),F(a.d).slice(0,c)===F(s.d).slice(0,c)){for(r=m;r--;)s=f(s.times(s),c,1);if(t==null)if(u<3&&we(s.d,c-i,b,u))d.precision=c+=10,n=o=a=new d(1),l=0,u++;else return f(s,d.precision=h,b,P=!0);else return d.precision=h,s}s=a}}function ae(e,t){var n,i,r,o,s,a,c,u,l,m,d,b=1,h=10,k=e,_=k.d,R=k.constructor,Z=R.rounding,x=R.precision;if(k.s<0||!_||!_[0]||!k.e&&_[0]==1&&_.length==1)return new R(_&&!_[0]?-1/0:k.s!=1?NaN:_?0:k);if(t==null?(P=!1,l=x):l=t,R.precision=l+=h,n=F(_),i=n.charAt(0),Math.abs(o=k.e)<15e14){for(;i<7&&i!=1||i==1&&n.charAt(1)>3;)k=k.times(e),n=F(k.d),i=n.charAt(0),b++;o=k.e,i>1?(k=new R("0."+n),o++):k=new R(i+"."+n.slice(1))}else return u=ve(R,l+2,x).times(o+""),k=ae(new R(i+"."+n.slice(1)),l-h).plus(u),R.precision=x,t==null?f(k,x,Z,P=!0):k;for(m=k,c=s=k=I(k.minus(1),k.plus(1),l,1),d=f(k.times(k),l,1),r=3;;){if(s=f(s.times(d),l,1),u=c.plus(I(s,new R(r),l,1)),F(u.d).slice(0,l)===F(c.d).slice(0,l))if(c=c.times(2),o!==0&&(c=c.plus(ve(R,l+2,x).times(o+""))),c=I(c,new R(b),l,1),t==null)if(we(c.d,l-h,Z,a))R.precision=l+=h,u=s=k=I(m.minus(1),m.plus(1),l,1),d=f(k.times(k),l,1),r=a=1;else return f(c,R.precision=x,Z,P=!0);else return R.precision=x,c;c=u,r+=2}}function vt(e){return String(e.s*e.s/0)}function tt(e,t){var n,i,r;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(i=t.search(/e/i))>0?(n<0&&(n=i),n+=+t.slice(i+1),t=t.substring(0,i)):n<0&&(n=t.length),i=0;t.charCodeAt(i)===48;i++);for(r=t.length;t.charCodeAt(r-1)===48;--r);if(t=t.slice(i,r),t){if(r-=i,e.e=n=n-i-1,e.d=[],i=(n+1)%g,n<0&&(i+=g),i<r){for(i&&e.d.push(+t.slice(0,i)),r-=g;i<r;)e.d.push(+t.slice(i,i+=g));t=t.slice(i),i=g-t.length}else i-=r;for(;i--;)t+="0";e.d.push(+t),P&&(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 Ln(e,t){var n,i,r,o,s,a,c,u,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),Mt.test(t))return tt(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(In.test(t))n=16,t=t.toLowerCase();else if(xn.test(t))n=2;else if(Sn.test(t))n=8;else throw Error(ue+t);for(o=t.search(/p/i),o>0?(c=+t.slice(o+1),t=t.substring(2,o)):t=t.slice(2),o=t.indexOf("."),s=o>=0,i=e.constructor,s&&(t=t.replace(".",""),a=t.length,o=a-o,r=Ft(i,new i(n),o,o*2)),u=Oe(t,n,Y),l=u.length-1,o=l;u[o]===0;--o)u.pop();return o<0?new i(e.s*0):(e.e=Ve(u,l),e.d=u,P=!1,s&&(e=I(e,r,a*4)),c&&(e=e.times(Math.abs(c)<54?M(2,c):Pe.pow(2,c))),P=!0,e)}function Rn(e,t){var n,i=t.d.length;if(i<3)return t.isZero()?t:pe(e,2,t,t);n=1.4*Math.sqrt(i),n=n>16?16:n|0,t=t.times(1/_e(5,n)),t=pe(e,2,t,t);for(var r,o=new e(5),s=new e(16),a=new e(20);n--;)r=t.times(t),t=t.times(o.plus(r.times(s.times(r).minus(a))));return t}function pe(e,t,n,i,r){var o,s,a,c,u=1,l=e.precision,m=Math.ceil(l/g);for(P=!1,c=n.times(n),a=new e(i);;){if(s=I(a.times(c),new e(t++*t++),l,1),a=r?i.plus(s):i.minus(s),i=I(s.times(c),new e(t++*t++),l,1),s=a.plus(i),s.d[m]!==void 0){for(o=m;s.d[o]===a.d[o]&&o--;);if(o==-1)break}o=a,a=i,i=s,s=o,u++}return P=!0,s.d.length=m+1,s}function _e(e,t){for(var n=e;--t;)n*=e;return n}function Dt(e,t){var n,i=t.s<0,r=j(e,e.precision,1),o=r.times(.5);if(t=t.abs(),t.lte(o))return ie=i?4:1,t;if(n=t.divToInt(r),n.isZero())ie=i?3:2;else{if(t=t.minus(n.times(r)),t.lte(o))return ie=It(n)?i?2:3:i?4:1,t;ie=It(n)?i?1:4:i?3:2}return t.minus(r).abs()}function nt(e,t,n,i){var r,o,s,a,c,u,l,m,d,b=e.constructor,h=n!==void 0;if(h?(G(n,1,ce),i===void 0?i=b.rounding:G(i,0,8)):(n=b.precision,i=b.rounding),!e.isFinite())l=vt(e);else{for(l=ee(e),s=l.indexOf("."),h?(r=2,t==16?n=n*4-3:t==8&&(n=n*3-2)):r=t,s>=0&&(l=l.replace(".",""),d=new b(1),d.e=l.length-s,d.d=Oe(ee(d),10,r),d.e=d.d.length),m=Oe(l,10,r),o=c=m.length;m[--c]==0;)m.pop();if(!m[0])l=h?"0p+0":"0";else{if(s<0?o--:(e=new b(e),e.d=m,e.e=o,e=I(e,d,n,i,0,r),m=e.d,o=e.e,u=Kt),s=m[n],a=r/2,u=u||m[n+1]!==void 0,u=i<4?(s!==void 0||u)&&(i===0||i===(e.s<0?3:2)):s>a||s===a&&(i===4||u||i===6&&m[n-1]&1||i===(e.s<0?8:7)),m.length=n,u)for(;++m[--n]>r-1;)m[n]=0,n||(++o,m.unshift(1));for(c=m.length;!m[c-1];--c);for(s=0,l="";s<c;s++)l+=Ye.charAt(m[s]);if(h){if(c>1)if(t==16||t==8){for(s=t==16?4:3,--c;c%s;c++)l+="0";for(m=Oe(l,r,t),c=m.length;!m[c-1];--c);for(s=1,l="1.";s<c;s++)l+=Ye.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>c)for(o-=c;o--;)l+="0";else o<c&&(l=l.slice(0,o)+"."+l.slice(o))}l=(t==16?"0x":t==2?"0b":t==8?"0o":"")+l}return e.s<0?"-"+l:l}function St(e,t){if(e.length>t)return e.length=t,!0}function Mn(e){return new this(e).abs()}function On(e){return new this(e).acos()}function Fn(e){return new this(e).acosh()}function En(e,t){return new this(e).plus(t)}function vn(e){return new this(e).asin()}function Dn(e){return new this(e).asinh()}function Vn(e){return new this(e).atan()}function _n(e){return new this(e).atanh()}function Wn(e,t){e=new this(e),t=new this(t);var n,i=this.precision,r=this.rounding,o=i+4;return!e.s||!t.s?n=new this(NaN):!e.d&&!t.d?(n=j(this,o,1).times(t.s>0?.25:.75),n.s=e.s):!t.d||e.isZero()?(n=t.s<0?j(this,i,r):new this(0),n.s=e.s):!e.d||t.isZero()?(n=j(this,o,1).times(.5),n.s=e.s):t.s<0?(this.precision=o,this.rounding=1,n=this.atan(I(e,t,o,1)),t=j(this,o,1),this.precision=i,this.rounding=r,n=e.s<0?n.minus(t):n.plus(t)):n=this.atan(I(e,t,o,1)),n}function qn(e){return new this(e).cbrt()}function Gn(e){return f(e=new this(e),e.e+1,2)}function Un(e,t,n){return new this(e).clamp(t,n)}function Xn(e){if(!e||typeof e!="object")throw Error(De+"Object expected");var t,n,i,r=e.defaults===!0,o=["precision",1,ce,"rounding",0,8,"toExpNeg",-de,0,"toExpPos",0,de,"maxE",0,de,"minE",-de,0,"modulo",0,9];for(t=0;t<o.length;t+=3)if(n=o[t],r&&(this[n]=Je[n]),(i=e[n])!==void 0)if(D(i)===i&&i>=o[t+1]&&i<=o[t+2])this[n]=i;else throw Error(ue+n+": "+i);if(n="crypto",r&&(this[n]=Je[n]),(i=e[n])!==void 0)if(i===!0||i===!1||i===0||i===1)if(i)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[n]=!0;else throw Error(Lt);else this[n]=!1;else throw Error(ue+n+": "+i);return this}function Hn(e){return new this(e).cos()}function Zn(e){return new this(e).cosh()}function Vt(e){var t,n,i;function r(o){var s,a,c,u=this;if(!(u instanceof r))return new r(o);if(u.constructor=r,Ct(o)){u.s=o.s,P?!o.d||o.e>r.maxE?(u.e=NaN,u.d=null):o.e<r.minE?(u.e=0,u.d=[0]):(u.e=o.e,u.d=o.d.slice()):(u.e=o.e,u.d=o.d?o.d.slice():o.d);return}if(c=typeof o,c==="number"){if(o===0){u.s=1/o<0?-1:1,u.e=0,u.d=[0];return}if(o<0?(o=-o,u.s=-1):u.s=1,o===~~o&&o<1e7){for(s=0,a=o;a>=10;a/=10)s++;P?s>r.maxE?(u.e=NaN,u.d=null):s<r.minE?(u.e=0,u.d=[0]):(u.e=s,u.d=[o]):(u.e=s,u.d=[o]);return}else if(o*0!==0){o||(u.s=NaN),u.e=NaN,u.d=null;return}return tt(u,o.toString())}else if(c!=="string")throw Error(ue+o);return(a=o.charCodeAt(0))===45?(o=o.slice(1),u.s=-1):(a===43&&(o=o.slice(1)),u.s=1),Mt.test(o)?tt(u,o):Ln(u,o)}if(r.prototype=p,r.ROUND_UP=0,r.ROUND_DOWN=1,r.ROUND_CEIL=2,r.ROUND_FLOOR=3,r.ROUND_HALF_UP=4,r.ROUND_HALF_DOWN=5,r.ROUND_HALF_EVEN=6,r.ROUND_HALF_CEIL=7,r.ROUND_HALF_FLOOR=8,r.EUCLID=9,r.config=r.set=Xn,r.clone=Vt,r.isDecimal=Ct,r.abs=Mn,r.acos=On,r.acosh=Fn,r.add=En,r.asin=vn,r.asinh=Dn,r.atan=Vn,r.atanh=_n,r.atan2=Wn,r.cbrt=qn,r.ceil=Gn,r.clamp=Un,r.cos=Hn,r.cosh=Zn,r.div=zn,r.exp=Qn,r.floor=jn,r.hypot=Yn,r.ln=Jn,r.log=$n,r.log10=ti,r.log2=ei,r.max=ni,r.min=ii,r.mod=ri,r.mul=oi,r.pow=si,r.random=ai,r.round=ui,r.sign=ci,r.sin=li,r.sinh=mi,r.sqrt=di,r.sub=pi,r.sum=fi,r.tan=bi,r.tanh=gi,r.trunc=yi,e===void 0&&(e={}),e&&e.defaults!==!0)for(i=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],t=0;t<i.length;)e.hasOwnProperty(n=i[t++])||(e[n]=this[n]);return r.config(e),r}function zn(e,t){return new this(e).div(t)}function Qn(e){return new this(e).exp()}function jn(e){return f(e=new this(e),e.e+1,3)}function Yn(){var e,t,n=new this(0);for(P=!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 P=!0,new this(1/0);n=t}return P=!0,n.sqrt()}function Ct(e){return e instanceof Pe||e&&e.toStringTag===Rt||!1}function Jn(e){return new this(e).ln()}function $n(e,t){return new this(e).log(t)}function ei(e){return new this(e).log(2)}function ti(e){return new this(e).log(10)}function ni(){return Et(this,arguments,"lt")}function ii(){return Et(this,arguments,"gt")}function ri(e,t){return new this(e).mod(t)}function oi(e,t){return new this(e).mul(t)}function si(e,t){return new this(e).pow(t)}function ai(e){var t,n,i,r,o=0,s=new this(1),a=[];if(e===void 0?e=this.precision:G(e,1,ce),i=Math.ceil(e/g),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(i));o<i;)r=t[o],r>=429e7?t[o]=crypto.getRandomValues(new Uint32Array(1))[0]:a[o++]=r%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(i*=4);o<i;)r=t[o]+(t[o+1]<<8)+(t[o+2]<<16)+((t[o+3]&127)<<24),r>=214e7?crypto.randomBytes(4).copy(t,o):(a.push(r%1e7),o+=4);o=i/4}else throw Error(Lt);else for(;o<i;)a[o++]=Math.random()*1e7|0;for(i=a[--o],e%=g,i&&e&&(r=M(10,g-e),a[o]=(i/r|0)*r);a[o]===0;o--)a.pop();if(o<0)n=0,a=[0];else{for(n=-1;a[0]===0;n-=g)a.shift();for(i=1,r=a[0];r>=10;r/=10)i++;i<g&&(n-=g-i)}return s.e=n,s.d=a,s}function ui(e){return f(e=new this(e),e.e+1,this.rounding)}function ci(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function li(e){return new this(e).sin()}function mi(e){return new this(e).sinh()}function di(e){return new this(e).sqrt()}function pi(e,t){return new this(e).sub(t)}function fi(){var e=0,t=arguments,n=new this(t[e]);for(P=!1;n.s&&++e<t.length;)n=n.plus(t[e]);return P=!0,f(n,this.precision,this.rounding)}function bi(e){return new this(e).tan()}function gi(e){return new this(e).tanh()}function yi(e){return f(e=new this(e),e.e+1,1)}p[Symbol.for("nodejs.util.inspect.custom")]=p.toString;p[Symbol.toStringTag]="Decimal";var Pe=p.constructor=Vt(Je);Fe=new Pe(Fe);Ee=new Pe(Ee);var O=Pe;import _p from"bn.js";import{PublicKey as Or}from"@solana/web3.js";import{get as _t,set as wi}from"lodash";var it=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(i=>typeof i=="object"?JSON.stringify(i):i).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}},Wt={},Pi={};function W(e){let t=_t(Wt,e);if(!t){let n=_t(Pi,e);t=new it({name:e,logLevel:n}),wi(Wt,e,t)}return t}import{MINT_SIZE as Dr,TOKEN_PROGRAM_ID as Vr,getTransferFeeConfig as _r,unpackMint as Wr}from"@solana/spl-token";var qr=W("Raydium_accountInfo_util");import re from"bn.js";import Si from"big.js";import so from"bn.js";import Ai from"toformat";var ki=Ai,Ae=ki;import Ge from"big.js";import hi from"bn.js";import Bi from"decimal.js-light";import ke from"bn.js";var Gt=9007199254740991;function te(e){let t=W("Raydium_parseBigNumberish");if(e instanceof ke)return e;if(typeof e=="string"){if(e.match(/^-?[0-9]+$/))return new ke(e);t.logWithError(`invalid BigNumberish string: ${e}`)}return typeof e=="number"?(e%1&&t.logWithError(`BigNumberish number underflow: ${e}`),(e>=Gt||e<=-Gt)&&t.logWithError(`BigNumberish number overflow: ${e}`),new ke(String(e))):typeof e=="bigint"?new ke(e.toString()):(t.error(`invalid BigNumberish value: ${e}`),new ke(0))}var qe=W("module/fraction"),rt=Ae(Ge),Te=Ae(Bi),xi={[0]:Te.ROUND_DOWN,[1]:Te.ROUND_HALF_UP,[2]:Te.ROUND_UP},Ii={[0]:Ge.roundDown,[1]:Ge.roundHalfUp,[2]:Ge.roundUp},C=class{constructor(t,n=new hi(1)){this.numerator=te(t),this.denominator=te(n)}get quotient(){return this.numerator.div(this.denominator)}invert(){return new C(this.denominator,this.numerator)}add(t){let n=t instanceof C?t:new C(te(t));return this.denominator.eq(n.denominator)?new C(this.numerator.add(n.numerator),this.denominator):new C(this.numerator.mul(n.denominator).add(n.numerator.mul(this.denominator)),this.denominator.mul(n.denominator))}sub(t){let n=t instanceof C?t:new C(te(t));return this.denominator.eq(n.denominator)?new C(this.numerator.sub(n.numerator),this.denominator):new C(this.numerator.mul(n.denominator).sub(n.numerator.mul(this.denominator)),this.denominator.mul(n.denominator))}mul(t){let n=t instanceof C?t:new C(te(t));return new C(this.numerator.mul(n.numerator),this.denominator.mul(n.denominator))}div(t){let n=t instanceof C?t:new C(te(t));return new C(this.numerator.mul(n.denominator),this.denominator.mul(n.numerator))}toSignificant(t,n={groupSeparator:""},i=1){Number.isInteger(t)||qe.logWithError(`${t} is not an integer.`),t<=0&&qe.logWithError(`${t} is not positive.`),Te.set({precision:t+1,rounding:xi[i]});let r=new Te(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(t);return r.toFormat(r.decimalPlaces(),n)}toFixed(t,n={groupSeparator:""},i=1){return Number.isInteger(t)||qe.logWithError(`${t} is not an integer.`),t<0&&qe.logWithError(`${t} is negative.`),rt.DP=t,rt.RM=Ii[i]||1,new rt(this.numerator.toString()).div(this.denominator.toString()).toFormat(t,n)}isZero(){return this.numerator.isZero()}};var go=W("Raydium_amount"),yo=Ae(Si);import{PublicKey as Ki}from"@solana/web3.js";import{TOKEN_PROGRAM_ID as Ut}from"@solana/spl-token";var ot={chainId:101,address:Ki.default.toBase58(),programId:Ut.toBase58(),decimals:9,symbol:"SOL",name:"solana",logoURI:"https://img-v1.raydium.io/icon/So11111111111111111111111111111111111111112.png",tags:[],priority:2,type:"raydium",extensions:{coingeckoId:"solana"}},le={chainId:101,address:"So11111111111111111111111111111111111111112",programId:Ut.toBase58(),decimals:9,symbol:"WSOL",name:"Wrapped SOL",logoURI:"https://img-v1.raydium.io/icon/So11111111111111111111111111111111111111112.png",tags:[],priority:2,type:"raydium",extensions:{coingeckoId:"solana"}};import{PublicKey as at}from"@solana/web3.js";import{PublicKey as K,SystemProgram as Xt,SYSVAR_RENT_PUBKEY as Ni}from"@solana/web3.js";import{TOKEN_PROGRAM_ID as Li}from"@solana/spl-token";function st({pubkey:e,isSigner:t=!1,isWritable:n=!0}){return{pubkey:e,isWritable:n,isSigner:t}}var xo=[st({pubkey:Li,isWritable:!1}),st({pubkey:Xt.programId,isWritable:!1}),st({pubkey:Ni,isWritable:!1})];function Ht({publicKey:e,transformSol:t}){let n=Zt(e.toString());if(n instanceof K)return t&&n.equals(he)?We:n;if(t&&n.toString()===he.toBase58())return We;if(typeof n=="string"){if(n===K.default.toBase58())return K.default;try{return new K(n)}catch{throw new Error("invalid public key")}}throw new Error("invalid public key")}function Zt(e){try{return new K(e)}catch{return e}}var Ri=new K("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),Mi=new K("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),Oi=new K("SysvarRent111111111111111111111111111111111"),Io=new K("SysvarC1ock11111111111111111111111111111111"),zt=new K("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),So=new K("Sysvar1nstructions1111111111111111111111111"),Co=Xt.programId,Ko=new K("4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R"),No=new K("Ea5SjE2Y6yvCeW5dYTn7PYMuW5ikXkvbGdcmSnXeaLjS"),Lo=new K("SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt"),Ro=new K("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"),Mo=new K("Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"),Oo=new K("mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So"),Fo=new K("7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj"),Eo=new K("USDH1SM1ojwWUga67PGrgFWUHibbjqMvuMaDkRJTgkX"),vo=new K("NRVwhjBQiUPYtfDT5zRBVJajzFQHaBUNtC7SNVvqRFa"),Do=new K("ANAxByE6G2WjFp7A4NqtWYXb3mgruyzZYg3spfxe6Lbo"),Vo=new K("7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs"),We=new K("So11111111111111111111111111111111111111112"),he=K.default;var ut=class{constructor({mint:t,decimals:n,symbol:i,name:r,skipMint:o=!1,isToken2022:s=!1}){if(t===he.toBase58()||t instanceof at&&he.equals(t)){this.decimals=le.decimals,this.symbol=le.symbol,this.name=le.name,this.mint=new at(le.address),this.isToken2022=!1;return}this.decimals=n,this.symbol=i||t.toString().substring(0,6),this.name=r||t.toString().substring(0,6),this.mint=o?at.default:Ht({publicKey:t}),this.isToken2022=s}equals(t){return this===t?!0:this.mint.equals(t.mint)}},me=ut;me.WSOL=new ut($(Q({},le),{mint:le.address}));var ct=class{constructor({decimals:t,symbol:n="UNKNOWN",name:i="UNKNOWN"}){this.decimals=t,this.symbol=n,this.name=i}equals(t){return this===t}},Ue=ct;Ue.SOL=new ct(ot);import Fi from"bn.js";var Yo=new C(new Fi(100));var is=W("Raydium_price");import{PublicKey as As}from"@solana/web3.js";import Ts from"bn.js";var Ei=new re(0),_s=new re(1),Ws=new re(2),qs=new re(3),Gs=new re(5),Ci=new re(10),Us=new re(100),Xs=new re(1e3),Hs=new re(1e4);import{PublicKey as ya}from"@solana/web3.js";import{TOKEN_PROGRAM_ID as Pa}from"@solana/spl-token";import{ComputeBudgetProgram as ea,Keypair as ia,PublicKey as ra,Transaction as sa,TransactionMessage as ua,VersionedTransaction as ca}from"@solana/web3.js";import{TOKEN_PROGRAM_ID as pa}from"@solana/spl-token";var fa=W("Raydium_txUtil");import{PublicKey as A}from"@solana/web3.js";var ha=new A("EhhTKczWMGQt46ynNeRX1WfeagwwJd7ufHvCDjRxjo5Q"),Ba=new A("CBuCnLe26faBpcBP2fktp4rp8abpcAnTWft6ZrP5Q4T"),xa=new A("9KEPoZmtHUrBbhWN1v1KWLMkkvwY6WLtAVUCPRtRjP4z"),Ia=new A("FarmqiPv5eAj3j1GMdMCMUGXqPUvmquZtMy86QH6rzhG"),Sa=new A("CLaimxFqjHzgTJtAGHU47NPhg6qrc5sCnpC4tBLyABQS"),Ca=new A("srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX"),Ka=new A("9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin"),Na=new A("675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8"),La=new A("5quBtoiQqxF9Jv6KYKctB59NT3gtJD2Y65kdnB1Uev3h"),Ra=new A("CDSr3ssLcRB6XYPJwAfFt18MZvEZp4LjHcvzBVZ45duo"),Di=new A("CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK"),Vi=new A("LockrWmn6K5twhz3y9w1dQERbmgSaRkfnTeTKbpofwE"),_i=new A("kN1kEznaF5Xbd8LYuqtEFcxzWSBk5Fv6ygX6SqEGJVy"),Ma=new A("routeUGWgWzqBWFcrCfv8tritsqukccJPu3q5GPP3xS"),Oa=new A("7YttLkHDoNj9wyDur5pM1ejNaAvT9X4eqaYcHQqtj2G5"),Fa=new A("6FJon3QE27qgPVggARueB22hLvoh22VzJpXv4rBEoSLF"),Ea=new A("CC12se5To1CdEuw7fDS27B7Geo5jJyL7t5UK2B44NgiH"),va=new A("9HzJyW1qZsEiSfMUf6L2jo3CcTKAyBmSyKdwQeYisHrC"),Da=new A("DropEU8AvevN3UrXWXTMuz3rqnMczQVNjq3kcSdW2SQi"),Va=new A("CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C"),_a=new A("GpMZbSM2GgvTKHJirzeGfMFoaZ8UR2X7F4v8vHTvxFbL"),Wa=new A("DNXgeM9EiiaAbaWvwjHj9fQQLAX5ZsfHyvmYUNRAdNC8"),Wi=new A("CPMDWBwJDtYax9qW7AyRuVC19Cc4L4Vcy4n2BHAbHkCW"),qi=new A("7rQ1QFNosMkUCuh7Z7fPbTHvh73b68sQYdirycEzJVuw"),Gi=new A("G11FKBRaAkHAKuLCgLM6K6NUc9rTjPAznRCjZifrTQe2"),qa=new A("LockrWmn6K5twhz3y9w1dQERbmgSaRkfnTeTKbpofwE"),Ui=new A("DLockwT7X7sxtLmGH9g5kmfcjaBtncdbUmi738m5bvQC"),Ga=new A("3f7GcQFG397GAaEnv51zR6tsTVihYRydnydDD1cXekxH"),Xi=new A("7AFUeLVRjBfzqK3tTGw8hN48KLQWSk6DTE8xprWdPqix"),Ua=new A("LanMV9sAd7wArD4vJFi2qDdfnVhFxYSUg6eADduJ3uj"),Xa=new A("WLHv2UAZm6z4KyaaELi5pjdbJh6RESMva1Rnn8pJVVh"),Hi=new A("7soRSLviCKHCKzCbRuVpZDif76NWLVqFtbjt8LpyxWSq"),Zi=new A("DG6kZFFCqxdtWXw53Zc28hLs3MTr28Efkm2FrsNERNSQ");var Ha={SERUM_MARKET:A.default,OPENBOOK_MARKET:new A("EoTcMgcDRTJVZDMZWBoU6rhYHZfkNTVEAfz3uUJRcYGj"),UTIL1216:A.default,FarmV3:new A("85BFyr98MbCUU9MVTEgzx1nbhWACbJqLzho6zd6DZcWL"),FarmV5:new A("EcLzTrNg9V7qhcdyXDe2qjtPkiGzDM2UbdRaeaadU5r2"),FarmV6:new A("Farm2hJLcqPtPg8M4rR6DMrsRNc5TPm5Cs4bVQrMe2T7"),AmmV4:new A("HWy1jotHpo6UqeQxx49dpYYdQB8wj9Qk9MdxwjLvDHB8"),AmmStable:new A("DDg4VmQaJV9ogWce7LpcjBA9bv22wRp5uaTPa5pGjijF"),CLMM:new A("devi51mZmdwUJGU9hjN27vEz64Gps7uUefqxg27EAtH"),CLMM_LOCK_PROGRAM_ID:new A("DLockwT7X7sxtLmGH9g5kmfcjaBtncdbUmi738m5bvQC"),CLMM_LOCK_AUTH_ID:new A("8qmHNvu2Kr2C7U8mJL4Vz1vTDxMhVuXKREwU7TNoaVEo"),Router:new A("BVChZ3XFEwTMUk1o9i3HAf91H6mFxSwa5X2wFAWhYPhU"),CREATE_CPMM_POOL_PROGRAM:Wi,CREATE_CPMM_POOL_AUTH:qi,CREATE_CPMM_POOL_FEE_ACC:Gi,FEE_DESTINATION_ID:new A("3XMrhbv989VxAMi3DErLV9eJht1pHppW5LbKxe9fkEFR"),LOCK_CPMM_PROGRAM:Ui,LCOK_CPMM_AUTH:Xi,LAUNCHPAD_PROGRAM:Hi,LAUNCHPAD_AUTH:Zi};import Qa from"bn.js";import{PublicKey as zi,AddressLookupTableAccount as Qt}from"@solana/web3.js";var Qi={AcL1Vo8oy1ULiavEcjSUcwfBSForXMudcZvDZy5nzJkU:new Qt({key:new zi("AcL1Vo8oy1ULiavEcjSUcwfBSForXMudcZvDZy5nzJkU"),state:Qt.deserialize(Buffer.from("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","base64"))})};import{PublicKey as mu,sendAndConfirmTransaction as du,SystemProgram as bu,Transaction as gu,TransactionMessage as wu,VersionedTransaction as Pu}from"@solana/web3.js";import ku from"axios";import Ji from"bn.js";var Cu=new Ji(1e6);var Be=class{static getPoolInitPriceByPool({poolInfo:t,decimalA:n,decimalB:i}){throw Error()}static getPoolInitPriceByInit({a:t,b:n,decimalA:i,decimalB:r}){throw Error()}static getPoolPrice({poolInfo:t,decimalA:n,decimalB:i}){throw Error()}static getPoolEndPrice({supply:t,totalSell:n,totalLockedAmount:i,totalFundRaising:r,migrateFee:o,decimalA:s,decimalB:a}){throw Error()}static getPoolEndPriceReal({poolInfo:t,decimalA:n,decimalB:i}){throw Error()}static getInitParam({supply:t,totalFundRaising:n,totalSell:i,totalLockedAmount:r,migrateFee:o}){throw Error()}static buyExactIn({poolInfo:t,amount:n}){throw Error()}static buyExactOut({poolInfo:t,amount:n}){throw Error()}static sellExactIn({poolInfo:t,amount:n}){throw Error()}static sellExactOut({poolInfo:t,amount:n}){throw Error()}};import{PublicKey as zd}from"@solana/web3.js";import jd from"bn.js";import{AccountLayout as ep,TOKEN_2022_PROGRAM_ID as tp,TOKEN_PROGRAM_ID as np}from"@solana/spl-token";import{PublicKey as Ju}from"@solana/web3.js";import{MintLayout as ec,TOKEN_PROGRAM_ID as nc}from"@solana/spl-token";import{Keypair as yd,PublicKey as wd,SystemProgram as Ad,TransactionInstruction as kd}from"@solana/web3.js";import hd from"bn.js";import{ASSOCIATED_TOKEN_PROGRAM_ID as Id,TOKEN_2022_PROGRAM_ID as Sd,TOKEN_PROGRAM_ID as Cd}from"@solana/spl-token";import{PublicKey as ar}from"@solana/web3.js";import en,{isBN as tn}from"bn.js";import{bits as fc,BitStructure as bc,blob as $i,Blob as gc,cstr as yc,f32 as wc,f32be as Pc,f64 as Ac,f64be as kc,greedy as Tc,Layout as er,ns64 as hc,ns64be as Bc,nu64 as xc,nu64be as Ic,offset as Sc,s16 as Cc,s16be as Kc,s24 as Nc,s24be as Lc,s32 as tr,s32be as Rc,s40 as Mc,s40be as Oc,s48 as Fc,s48be as Ec,s8 as vc,seq as nr,struct as Dc,Structure as ir,u16 as rr,u16be as Vc,u24 as _c,u24be as Wc,u32 as qc,u32be as Gc,u40 as Uc,u40be as Xc,u48 as Hc,u48be as Zc,u8 as or,UInt as sr,union as zc,Union as Qc,unionLayoutDiscriminator as jc,utf8 as Yc}from"@solana/buffer-layout";var pt=er,Yt=ir;var ft=sr;var Jt=or,xe=rr;var oe=tr;var $t=nr;var X=$i;var fe=class extends pt{constructor(n,i,r){super(n,r);this.blob=X(n),this.signed=i}decode(n,i=0){let r=new en(this.blob.decode(n,i),10,"le");return this.signed?r.fromTwos(this.span*8).clone():r}encode(n,i,r=0){return typeof n=="number"&&(n=new en(n)),this.signed&&(n=n.toTwos(this.span*8)),this.blob.encode(n.toArrayLike(Buffer,"le",this.span),i,r)}};function q(e){return new ft(1,e)}function be(e){return new ft(4,e)}function T(e){return new fe(8,!1,e)}function N(e){return new fe(16,!1,e)}function nn(e){return new fe(8,!0,e)}function rn(e){return new fe(16,!0,e)}var He=class extends pt{constructor(n,i,r,o){super(n.span,o);this.layout=n,this.decoder=i,this.encoder=r}decode(n,i){return this.decoder(this.layout.decode(n,i))}encode(n,i,r){return this.layout.encode(this.encoder(n),i,r)}getSpan(n,i){return this.layout.getSpan(n,i)}};function B(e){return new He(X(32),t=>new ar(t),t=>t.toBuffer(),e)}function gt(e){return new He(Jt(),ur,cr,e)}function ur(e){if(e===0)return!1;if(e===1)return!0;throw new Error("Invalid bool: "+e)}function cr(e){return e?1:0}var bt=class extends Yt{decode(t,n){return super.decode(t,n)}};function V(e,t,n){return new bt(e,t,n)}function L(e,t,n){let i,r=typeof t=="number"?t:tn(t)?t.toNumber():new Proxy(t,{get(o,s){if(!i){let a=Reflect.get(o,"count");i=tn(a)?a.toNumber():a,Reflect.set(o,"count",i)}return Reflect.get(o,s)},set(o,s,a){return s==="count"&&(i=a),Reflect.set(o,s,a)}});return $t(e,r,n)}import Qm from"bn.js";import H from"bn.js";var yt=new H(0),on=new H(1),sn=new H(-1),J=new H(1).shln(64),an=new H(1).shln(128),wt=J.sub(on);var lr=an.subn(1),ge=-443636,Ie=-ge,Pt=new H("4295048016"),At=new H("79226673521066979257578248091"),ml=new H("4295048017"),dl=new H("79226673521066979257578248090");var mr=new H(10).pow(new H(6));var pl=new H("18446744073700000000");import Fm from"bn.js";var Al=Buffer.from("amm_con