UNPKG

test-rrr-sdk

Version:

An SDK for building applications on top of Raydium.

1 lines 54 kB
var _n=Object.create;var Te=Object.defineProperty,Wn=Object.defineProperties,qn=Object.getOwnPropertyDescriptor,Un=Object.getOwnPropertyDescriptors,Gn=Object.getOwnPropertyNames,Ot=Object.getOwnPropertySymbols,Xn=Object.getPrototypeOf,Et=Object.prototype.hasOwnProperty,Hn=Object.prototype.propertyIsEnumerable;var Ft=(e,t,n)=>t in e?Te(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Z=(e,t)=>{for(var n in t||(t={}))Et.call(t,n)&&Ft(e,n,t[n]);if(Ot)for(var n of Ot(t))Hn.call(t,n)&&Ft(e,n,t[n]);return e},Y=(e,t)=>Wn(e,Un(t));var zn=(e,t)=>{for(var n in t)Te(e,n,{get:t[n],enumerable:!0})},vt=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Gn(t))!Et.call(e,r)&&r!==n&&Te(e,r,{get:()=>t[r],enumerable:!(i=qn(t,r))||i.enumerable});return e};var M=(e,t,n)=>(n=e!=null?_n(Xn(e)):{},vt(t||!e||!e.__esModule?Te(n,"default",{value:e,enumerable:!0}):n,e)),Zn=e=>vt(Te({},"__esModule",{value:!0}),e);var no={};zn(no,{LAUNCHPAD_AUTH_SEED:()=>On,LAUNCHPAD_CONFIG_SEED:()=>Fn,LAUNCHPAD_POOL_PLATFORM_SEED:()=>Dn,LAUNCHPAD_POOL_SEED:()=>En,LAUNCHPAD_POOL_VAULT_SEED:()=>vn,LAUNCHPAD_POOL_VESTING_SEED:()=>jr,getPdaCpiEvent:()=>eo,getPdaLaunchpadAuth:()=>Qr,getPdaLaunchpadConfigId:()=>Yr,getPdaLaunchpadPoolId:()=>Jr,getPdaLaunchpadVaultId:()=>$r,getPdaPlatformId:()=>to,u8ToBytes:()=>Vn});module.exports=Zn(no);var Qn=require("@solana/web3.js");var ke=require("lodash");var ot=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}},Dt={},jn={};function W(e){let t=(0,ke.get)(Dt,e);if(!t){let n=(0,ke.get)(jn,e);t=new ot({name:e,logLevel:n}),(0,ke.set)(Dt,e,t)}return t}var De=require("@solana/spl-token"),lo=W("Raydium_accountInfo_util");var ee=M(require("bn.js"));var de=9e15,ce=1e9,st="0123456789abcdef",We="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",qe="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",at={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-de,maxE:de,crypto:!1},Ut,ne,A=!0,Ge="[DecimalError] ",ae=Ge+"Invalid argument: ",Gt=Ge+"Precision limit exceeded",Xt=Ge+"crypto unavailable",Ht="[object Decimal]",D=Math.floor,O=Math.pow,Yn=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Jn=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,$n=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,zt=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Q=1e7,y=7,ei=9007199254740991,ti=We.length-1,ct=qe.length-1,p={toStringTag:Ht};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(ae+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,u=o.s,c=e.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!==e.e)return o.e>e.e^u<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]^u<0?1:-1;return i===r?0:i>r^u<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())+y,i.rounding=1,n=ni(i,Jt(i,n)),i.precision=e,i.rounding=t,f(ne==2||ne==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,u,c,l=this,m=l.constructor;if(!l.isFinite()||l.isZero())return new m(l);for(A=!1,o=l.s*O(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=O(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,u=a.times(a).times(a),c=u.plus(l),i=S(c.plus(l).times(a),c.plus(u),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 A=!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/y))*y,e=t[e],e)for(;e%10==0;e/=10)n--;n<0&&(n=0)}return n};p.dividedBy=p.div=function(e){return S(this,new this.constructor(e))};p.dividedToIntegerBy=p.divToInt=function(e){var t=this,n=t.constructor;return f(S(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/He(4,e)).toString()):(e=16,t="2.3283064365386962890625e-10"),o=pe(s,1,o.times(t),new s(1),!0);for(var u,c=e,l=new s(8);c--;)u=o.times(o),o=a.minus(u.times(l.minus(u.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/He(5,e)),r=pe(o,2,r,r,!0);for(var s,a=new o(5),u=new o(16),c=new o(20);e--;)s=r.times(r),r=r.times(a.plus(s.times(u.times(s).plus(c))))}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,S(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,A=!1,n=n.times(n).minus(1).sqrt().plus(n),A=!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,A=!1,n=n.times(n).plus(1).sqrt().plus(n),A=!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=S(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,u,c=this,l=c.constructor,m=l.precision,d=l.rounding;if(c.isFinite()){if(c.isZero())return new l(c);if(c.abs().eq(1)&&m+4<=ct)return s=j(l,m+4,d).times(.25),s.s=c.s,s}else{if(!c.s)return new l(NaN);if(m+4<=ct)return s=j(l,m+4,d).times(.5),s.s=c.s,s}for(l.precision=a=m+10,l.rounding=1,n=Math.min(28,a/y+2|0),e=n;e;--e)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(A=!1,t=Math.ceil(a/y),i=1,u=c.times(c),s=new l(c),r=c;e!==-1;)if(r=r.times(u),o=s.minus(r.div(i+=2)),r=r.times(u),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)),A=!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/y)>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,u,c=this,l=c.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=c.d,c.s<0||!n||!n[0]||c.eq(1))return new l(n&&!n[0]?-1/0:c.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(A=!1,a=m+b,s=se(c,a),i=t?Ue(l,a+10):se(e,a),u=S(s,i,a,1),he(u.d,r=m,d))do if(a+=10,s=se(c,a),i=t?Ue(l,a+10):se(e,a),u=S(s,i,a,1),!o){+F(u.d).slice(r+1,r+15)+1==1e14&&(u=f(u,m+1,0));break}while(he(u.d,r+=10,d));return A=!0,f(u,m,d)};p.minus=p.sub=function(e){var t,n,i,r,o,s,a,u,c,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(c=b.d,d=e.d,a=h.precision,u=h.rounding,!c[0]||!d[0]){if(d[0])e.s=-e.s;else if(c[0])e=new h(b);else return new h(u===3?-0:0);return A?f(e,a,u):e}if(n=D(e.e/y),l=D(b.e/y),c=c.slice(),o=l-n,o){for(m=o<0,m?(t=c,o=-o,s=d.length):(t=d,n=l,s=c.length),i=Math.max(Math.ceil(a/y),s)+2,o>i&&(o=i,t.length=1),t.reverse(),i=o;i--;)t.push(0);t.reverse()}else{for(i=c.length,s=d.length,m=i<s,m&&(s=i),i=0;i<s;i++)if(c[i]!=d[i]){m=c[i]<d[i];break}o=0}for(m&&(t=c,c=d,d=t,e.s=-e.s),s=c.length,i=d.length-s;i>0;--i)c[s++]=0;for(i=d.length;i>o;){if(c[--i]<d[i]){for(r=i;r&&c[--r]===0;)c[r]=Q-1;--c[r],c[i]+=Q}c[i]-=d[i]}for(;c[--s]===0;)c.pop();for(;c[0]===0;c.shift())--n;return c[0]?(e.d=c,e.e=Xe(c,n),A?f(e,a,u):e):new h(u===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):(A=!1,i.modulo==9?(t=S(n,e.abs(),0,3,1),t.s*=e.s):t=S(n,e,0,i.modulo,1),t=t.times(e),A=!0,n.minus(t))};p.naturalExponential=p.exp=function(){return ut(this)};p.naturalLogarithm=p.ln=function(){return se(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,u,c,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(c=m.d,l=e.d,a=d.precision,u=d.rounding,!c[0]||!l[0])return l[0]||(e=new d(m)),A?f(e,a,u):e;if(o=D(m.e/y),i=D(e.e/y),c=c.slice(),r=o-i,r){for(r<0?(n=c,r=-r,s=l.length):(n=l,i=o,s=c.length),o=Math.ceil(a/y),s=o>s?o+1:s+1,r>s&&(r=s,n.length=1),n.reverse();r--;)n.push(0);n.reverse()}for(s=c.length,r=l.length,s-r<0&&(r=s,n=l,l=c,c=n),t=0;r;)t=(c[--r]=c[r]+l[r]+t)/Q|0,c[r]%=Q;for(t&&(c.unshift(t),++i),s=c.length;c[--s]==0;)c.pop();return e.d=c,e.e=Xe(c,i),A?f(e,a,u):e};p.precision=p.sd=function(e){var t,n=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(ae+e);return n.d?(t=Zt(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())+y,i.rounding=1,n=ri(i,Jt(i,n)),i.precision=e,i.rounding=t,f(ne>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,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(A=!1,c=Math.sqrt(+s),c==0||c==1/0?(t=F(a),(t.length+u)%2==0&&(t+="0"),c=Math.sqrt(t),u=D((u+1)/2)-(u<0||u%2),c==1/0?t="5e"+u:(t=c.toExponential(),t=t.slice(0,t.indexOf("e")+1)+u),i=new l(t)):i=new l(c.toString()),n=(u=l.precision)+3;;)if(o=i,i=o.plus(S(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,u+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,u+1,1),e=!i.times(i).eq(s));break}return A=!0,f(i,u,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=S(n,new i(1).minus(n.times(n)).sqrt(),e+10,0),i.precision=e,i.rounding=t,f(ne==2||ne==4?n.neg():n,e,t,!0)):new i(NaN)};p.times=p.mul=function(e){var t,n,i,r,o,s,a,u,c,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/y)+D(e.e/y),u=d.length,c=b.length,u<c&&(o=d,d=b,b=o,s=u,u=c,c=s),o=[],s=u+c,i=s;i--;)o.push(0);for(i=c;--i>=0;){for(t=0,r=u+i;r>i;)a=o[r]+b[i]*d[r-i-1]+t,o[r--]=a%Q|0,t=a/Q|0;o[r]=(o[r]+t)%Q|0}for(;!o[--s];)o.pop();return t?++n:o.shift(),e.d=o,e.e=Xe(o,n),A?f(e,m.precision,m.rounding):e};p.toBinary=function(e,t){return mt(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:(U(e,0,ce),t===void 0?t=i.rounding:U(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=J(i,!0):(U(e,0,ce),t===void 0?t=r.rounding:U(t,0,8),i=f(new r(i),e+1,t),n=J(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=J(r):(U(e,0,ce),t===void 0?t=o.rounding:U(t,0,8),i=f(new o(r),e+r.e+1,t),n=J(i,!1,e+i.e+1)),r.isNeg()&&!r.isZero()?"-"+n:n};p.toFraction=function(e){var t,n,i,r,o,s,a,u,c,l,m,d,b=this,h=b.d,T=b.constructor;if(!h)return new T(b);if(c=n=new T(1),i=u=new T(0),t=new T(i),o=t.e=Zt(h)-b.e-1,s=o%y,t.d[0]=O(10,s<0?y+s:s),e==null)e=o>0?t:c;else{if(a=new T(e),!a.isInt()||a.lt(c))throw Error(ae+a);e=a.gt(t)?o>0?t:c:a}for(A=!1,a=new T(F(h)),l=T.precision,T.precision=o=h.length*y*2;m=S(a,t,0,1,1),r=n.plus(m.times(i)),r.cmp(e)!=1;)n=i,i=r,r=c,c=u.plus(m.times(r)),u=r,r=t,t=a.minus(m.times(r)),a=r;return r=S(e.minus(n),i,0,1,1),u=u.plus(r.times(c)),n=n.plus(r.times(i)),u.s=c.s=b.s,d=S(c,i,o,1).minus(b).abs().cmp(S(u,n,o,1).minus(b).abs())<1?[c,i]:[u,n],T.precision=l,A=!0,d};p.toHexadecimal=p.toHex=function(e,t){return mt(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:U(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]?(A=!1,n=S(n,e,0,t,1).times(e),A=!0,f(n)):(e.s=n.s,n=e),n};p.toNumber=function(){return+this};p.toOctal=function(e,t){return mt(this,8,e,t)};p.toPower=p.pow=function(e){var t,n,i,r,o,s,a=this,u=a.constructor,c=+(e=new u(e));if(!a.d||!e.d||!a.d[0]||!e.d[0])return new u(O(+a,c));if(a=new u(a),a.eq(1))return a;if(i=u.precision,o=u.rounding,e.eq(1))return f(a,i,o);if(t=D(e.e/y),t>=e.d.length-1&&(n=c<0?-c:c)<=ei)return r=jt(u,a,n,i),e.s<0?new u(1).div(r):f(r,i,o);if(s=a.s,s<0){if(t<e.d.length-1)return new u(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=O(+a,c),t=n==0||!isFinite(n)?D(c*(Math.log("0."+F(a.d))/Math.LN10+a.e+1)):new u(n+"").e,t>u.maxE+1||t<u.minE-1?new u(t>0?s/0:0):(A=!1,u.rounding=a.s=1,n=Math.min(12,(t+"").length),r=ut(e.times(se(a,i+n)),i),r.d&&(r=f(r,i+5,1),he(r.d,i,o)&&(t=i+10,r=f(ut(e.times(se(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,A=!0,u.rounding=o,f(r,i,o))};p.toPrecision=function(e,t){var n,i=this,r=i.constructor;return e===void 0?n=J(i,i.e<=r.toExpNeg||i.e>=r.toExpPos):(U(e,1,ce),t===void 0?t=r.rounding:U(t,0,8),i=f(new r(i),e,t),n=J(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):(U(e,1,ce),t===void 0?t=i.rounding:U(t,0,8)),f(new i(n),e,t)};p.toString=function(){var e=this,t=e.constructor,n=J(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=J(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=y-i.length,n&&(o+=oe(n)),o+=i;s=e[t],i=s+"",n=y-i.length,n&&(o+=oe(n))}else if(s===0)return"0";for(;s%10===0;)s/=10;return o+s}function U(e,t,n){if(e!==~~e||e<t||e>n)throw Error(ae+e)}function he(e,t,n,i){var r,o,s,a;for(o=e[0];o>=10;o/=10)--t;return--t<0?(t+=y,r=0):(r=Math.ceil((t+1)/y),t%=y),o=O(10,y-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)==O(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)==O(10,t-3)-1,s}function _e(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]+=st.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 ni(e,t){var n,i,r;if(t.isZero())return t;i=t.d.length,i<32?(n=Math.ceil(i/3),r=(1/He(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 S=function(){function e(i,r,o){var s,a=0,u=i.length;for(i=i.slice();u--;)s=i[u]*r+a,i[u]=s%o|0,a=s/o|0;return a&&i.unshift(a),i}function t(i,r,o,s){var a,u;if(o!=s)u=o>s?1:-1;else for(a=u=0;a<o;a++)if(i[a]!=r[a]){u=i[a]>r[a]?1:-1;break}return u}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,u){var c,l,m,d,b,h,T,_,R,H,I,E,Oe,te,nt,Fe,Ae,it,z,Ee,ve=i.constructor,rt=i.s==r.s?1:-1,v=i.d,C=r.d;if(!v||!v[0]||!C||!C[0])return new ve(!i.s||!r.s||(v?C&&v[0]==C[0]:!C)?NaN:v&&v[0]==0||!C?rt*0:rt/0);for(u?(b=1,l=i.e-r.e):(u=Q,b=y,l=D(i.e/b)-D(r.e/b)),z=C.length,Ae=v.length,R=new ve(rt),H=R.d=[],m=0;C[m]==(v[m]||0);m++);if(C[m]>(v[m]||0)&&l--,o==null?(te=o=ve.precision,s=ve.rounding):a?te=o+(i.e-r.e)+1:te=o,te<0)H.push(1),h=!0;else{if(te=te/b+2|0,m=0,z==1){for(d=0,C=C[0],te++;(m<Ae||d)&&te--;m++)nt=d*u+(v[m]||0),H[m]=nt/C|0,d=nt%C|0;h=d||m<Ae}else{for(d=u/(C[0]+1)|0,d>1&&(C=e(C,d,u),v=e(v,d,u),z=C.length,Ae=v.length),Fe=z,I=v.slice(0,z),E=I.length;E<z;)I[E++]=0;Ee=C.slice(),Ee.unshift(0),it=C[0],C[1]>=u/2&&++it;do d=0,c=t(C,I,z,E),c<0?(Oe=I[0],z!=E&&(Oe=Oe*u+(I[1]||0)),d=Oe/it|0,d>1?(d>=u&&(d=u-1),T=e(C,d,u),_=T.length,E=I.length,c=t(T,I,_,E),c==1&&(d--,n(T,z<_?Ee:C,_,u))):(d==0&&(c=d=1),T=C.slice()),_=T.length,_<E&&T.unshift(0),n(I,T,E,u),c==-1&&(E=I.length,c=t(C,I,z,E),c<1&&(d++,n(I,z<E?Ee:C,E,u))),E=I.length):c===0&&(d++,I=[0]),H[m++]=d,c&&I[0]?I[E++]=v[Fe]||0:(I=[v[Fe]],E=1);while((Fe++<Ae||I[0]!==void 0)&&te--);h=I[0]!==void 0}H[0]||H.shift()}if(b==1)R.e=l,Ut=h;else{for(m=1,d=H[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,u,c,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+=y,s=t,l=m[d=0],u=l/O(10,r-s-1)%10|0;else if(d=Math.ceil((o+1)/y),a=m.length,d>=a)if(i){for(;a++<=d;)m.push(0);l=u=0,r=1,o%=y,s=o-y+1}else break e;else{for(l=a=m[d],r=1;a>=10;a/=10)r++;o%=y,s=o-y+r,u=s<0?0:l/O(10,r-s-1)%10|0}if(i=i||t<0||m[d+1]!==void 0||(s<0?l:l%O(10,r-s-1)),c=n<4?(u||i)&&(n==0||n==(e.s<0?3:2)):u>5||u==5&&(n==4||i||n==6&&(o>0?s>0?l/O(10,r-s):0:m[d-1])%10&1||n==(e.s<0?8:7)),t<1||!m[0])return m.length=0,c?(t-=e.e+1,m[0]=O(10,(y-t%y)%y),e.e=-t||0):m[0]=e.e=0,e;if(o==0?(m.length=d,a=1,d--):(m.length=d+1,a=O(10,y-o),m[d]=s>0?(l/O(10,r-s)%O(10,s)|0)*a:0),c)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]==Q&&(m[0]=1));break}else{if(m[d]+=a,m[d]!=Q)break;m[d--]=0,a=1}for(o=m.length;m[--o]===0;)m.pop()}return A&&(e.e>b.maxE?(e.d=null,e.e=NaN):e.e<b.minE&&(e.e=0,e.d=[0])),e}function J(e,t,n){if(!e.isFinite())return Yt(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)+oe(i):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(e.e<0?"e":"e+")+e.e):r<0?(o="0."+oe(-r-1)+o,n&&(i=n-s)>0&&(o+=oe(i))):r>=s?(o+=oe(r+1-s),n&&(i=n-r-1)>0&&(o=o+"."+oe(i))):((i=r+1)<s&&(o=o.slice(0,i)+"."+o.slice(i)),n&&(i=n-s)>0&&(r+1===s&&(o+="."),o+=oe(i))),o}function Xe(e,t){var n=e[0];for(t*=y;n>=10;n/=10)t++;return t}function Ue(e,t,n){if(t>ti)throw A=!0,n&&(e.precision=n),Error(Gt);return f(new e(We),t,1,!0)}function j(e,t,n){if(t>ct)throw Error(Gt);return f(new e(qe),t,n,!0)}function Zt(e){var t=e.length-1,n=t*y+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 oe(e){for(var t="";e--;)t+="0";return t}function jt(e,t,n,i){var r,o=new e(1),s=Math.ceil(i/y+4);for(A=!1;;){if(n%2&&(o=o.times(t),Wt(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),Wt(t.d,s)}return A=!0,o}function _t(e){return e.d[e.d.length-1]&1}function Qt(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 ut(e,t){var n,i,r,o,s,a,u,c=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?(A=!1,u=h):u=t,a=new d(.03125);e.e>-2;)e=e.times(a),m+=5;for(i=Math.log(O(2,m))/Math.LN10*2+5|0,u+=i,n=o=s=new d(1),d.precision=u;;){if(o=f(o.times(e),u,1),n=n.times(++l),a=s.plus(S(o,n,u,1)),F(a.d).slice(0,u)===F(s.d).slice(0,u)){for(r=m;r--;)s=f(s.times(s),u,1);if(t==null)if(c<3&&he(s.d,u-i,b,c))d.precision=u+=10,n=o=a=new d(1),l=0,c++;else return f(s,d.precision=h,b,A=!0);else return d.precision=h,s}s=a}}function se(e,t){var n,i,r,o,s,a,u,c,l,m,d,b=1,h=10,T=e,_=T.d,R=T.constructor,H=R.rounding,I=R.precision;if(T.s<0||!_||!_[0]||!T.e&&_[0]==1&&_.length==1)return new R(_&&!_[0]?-1/0:T.s!=1?NaN:_?0:T);if(t==null?(A=!1,l=I):l=t,R.precision=l+=h,n=F(_),i=n.charAt(0),Math.abs(o=T.e)<15e14){for(;i<7&&i!=1||i==1&&n.charAt(1)>3;)T=T.times(e),n=F(T.d),i=n.charAt(0),b++;o=T.e,i>1?(T=new R("0."+n),o++):T=new R(i+"."+n.slice(1))}else return c=Ue(R,l+2,I).times(o+""),T=se(new R(i+"."+n.slice(1)),l-h).plus(c),R.precision=I,t==null?f(T,I,H,A=!0):T;for(m=T,u=s=T=S(T.minus(1),T.plus(1),l,1),d=f(T.times(T),l,1),r=3;;){if(s=f(s.times(d),l,1),c=u.plus(S(s,new R(r),l,1)),F(c.d).slice(0,l)===F(u.d).slice(0,l))if(u=u.times(2),o!==0&&(u=u.plus(Ue(R,l+2,I).times(o+""))),u=S(u,new R(b),l,1),t==null)if(he(u.d,l-h,H,a))R.precision=l+=h,c=s=T=S(m.minus(1),m.plus(1),l,1),d=f(T.times(T),l,1),r=a=1;else return f(u,R.precision=I,H,A=!0);else return R.precision=I,u;u=c,r+=2}}function Yt(e){return String(e.s*e.s/0)}function lt(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)%y,n<0&&(i+=y),i<r){for(i&&e.d.push(+t.slice(0,i)),r-=y;i<r;)e.d.push(+t.slice(i,i+=y));t=t.slice(i),i=y-t.length}else i-=r;for(;i--;)t+="0";e.d.push(+t),A&&(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 ii(e,t){var n,i,r,o,s,a,u,c,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),zt.test(t))return lt(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(Jn.test(t))n=16,t=t.toLowerCase();else if(Yn.test(t))n=2;else if($n.test(t))n=8;else throw Error(ae+t);for(o=t.search(/p/i),o>0?(u=+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=jt(i,new i(n),o,o*2)),c=_e(t,n,Q),l=c.length-1,o=l;c[o]===0;--o)c.pop();return o<0?new i(e.s*0):(e.e=Xe(c,l),e.d=c,A=!1,s&&(e=S(e,r,a*4)),u&&(e=e.times(Math.abs(u)<54?O(2,u):ze.pow(2,u))),A=!0,e)}function ri(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/He(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,u,c=1,l=e.precision,m=Math.ceil(l/y);for(A=!1,u=n.times(n),a=new e(i);;){if(s=S(a.times(u),new e(t++*t++),l,1),a=r?i.plus(s):i.minus(s),i=S(s.times(u),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,c++}return A=!0,s.d.length=m+1,s}function He(e,t){for(var n=e;--t;)n*=e;return n}function Jt(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 ne=i?4:1,t;if(n=t.divToInt(r),n.isZero())ne=i?3:2;else{if(t=t.minus(n.times(r)),t.lte(o))return ne=_t(n)?i?2:3:i?4:1,t;ne=_t(n)?i?1:4:i?3:2}return t.minus(r).abs()}function mt(e,t,n,i){var r,o,s,a,u,c,l,m,d,b=e.constructor,h=n!==void 0;if(h?(U(n,1,ce),i===void 0?i=b.rounding:U(i,0,8)):(n=b.precision,i=b.rounding),!e.isFinite())l=Yt(e);else{for(l=J(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=_e(J(d),10,r),d.e=d.d.length),m=_e(l,10,r),o=u=m.length;m[--u]==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=S(e,d,n,i,0,r),m=e.d,o=e.e,c=Ut),s=m[n],a=r/2,c=c||m[n+1]!==void 0,c=i<4?(s!==void 0||c)&&(i===0||i===(e.s<0?3:2)):s>a||s===a&&(i===4||c||i===6&&m[n-1]&1||i===(e.s<0?8:7)),m.length=n,c)for(;++m[--n]>r-1;)m[n]=0,n||(++o,m.unshift(1));for(u=m.length;!m[u-1];--u);for(s=0,l="";s<u;s++)l+=st.charAt(m[s]);if(h){if(u>1)if(t==16||t==8){for(s=t==16?4:3,--u;u%s;u++)l+="0";for(m=_e(l,r,t),u=m.length;!m[u-1];--u);for(s=1,l="1.";s<u;s++)l+=st.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=(t==16?"0x":t==2?"0b":t==8?"0o":"")+l}return e.s<0?"-"+l:l}function Wt(e,t){if(e.length>t)return e.length=t,!0}function oi(e){return new this(e).abs()}function si(e){return new this(e).acos()}function ai(e){return new this(e).acosh()}function ci(e,t){return new this(e).plus(t)}function ui(e){return new this(e).asin()}function li(e){return new this(e).asinh()}function mi(e){return new this(e).atan()}function di(e){return new this(e).atanh()}function pi(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(S(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(S(e,t,o,1)),n}function fi(e){return new this(e).cbrt()}function bi(e){return f(e=new this(e),e.e+1,2)}function gi(e,t,n){return new this(e).clamp(t,n)}function yi(e){if(!e||typeof e!="object")throw Error(Ge+"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]=at[n]),(i=e[n])!==void 0)if(D(i)===i&&i>=o[t+1]&&i<=o[t+2])this[n]=i;else throw Error(ae+n+": "+i);if(n="crypto",r&&(this[n]=at[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(Xt);else this[n]=!1;else throw Error(ae+n+": "+i);return this}function wi(e){return new this(e).cos()}function Pi(e){return new this(e).cosh()}function $t(e){var t,n,i;function r(o){var s,a,u,c=this;if(!(c instanceof r))return new r(o);if(c.constructor=r,qt(o)){c.s=o.s,A?!o.d||o.e>r.maxE?(c.e=NaN,c.d=null):o.e<r.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++;A?s>r.maxE?(c.e=NaN,c.d=null):s<r.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 lt(c,o.toString())}else if(u!=="string")throw Error(ae+o);return(a=o.charCodeAt(0))===45?(o=o.slice(1),c.s=-1):(a===43&&(o=o.slice(1)),c.s=1),zt.test(o)?lt(c,o):ii(c,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=yi,r.clone=$t,r.isDecimal=qt,r.abs=oi,r.acos=si,r.acosh=ai,r.add=ci,r.asin=ui,r.asinh=li,r.atan=mi,r.atanh=di,r.atan2=pi,r.cbrt=fi,r.ceil=bi,r.clamp=gi,r.cos=wi,r.cosh=Pi,r.div=Ai,r.exp=Ti,r.floor=ki,r.hypot=hi,r.ln=xi,r.log=Bi,r.log10=Si,r.log2=Ii,r.max=Ci,r.min=Ki,r.mod=Ni,r.mul=Li,r.pow=Ri,r.random=Mi,r.round=Oi,r.sign=Fi,r.sin=Ei,r.sinh=vi,r.sqrt=Di,r.sub=Vi,r.sum=_i,r.tan=Wi,r.tanh=qi,r.trunc=Ui,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 Ai(e,t){return new this(e).div(t)}function Ti(e){return new this(e).exp()}function ki(e){return f(e=new this(e),e.e+1,3)}function hi(){var e,t,n=new this(0);for(A=!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 A=!0,new this(1/0);n=t}return A=!0,n.sqrt()}function qt(e){return e instanceof ze||e&&e.toStringTag===Ht||!1}function xi(e){return new this(e).ln()}function Bi(e,t){return new this(e).log(t)}function Ii(e){return new this(e).log(2)}function Si(e){return new this(e).log(10)}function Ci(){return Qt(this,arguments,"lt")}function Ki(){return Qt(this,arguments,"gt")}function Ni(e,t){return new this(e).mod(t)}function Li(e,t){return new this(e).mul(t)}function Ri(e,t){return new this(e).pow(t)}function Mi(e){var t,n,i,r,o=0,s=new this(1),a=[];if(e===void 0?e=this.precision:U(e,1,ce),i=Math.ceil(e/y),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(Xt);else for(;o<i;)a[o++]=Math.random()*1e7|0;for(i=a[--o],e%=y,i&&e&&(r=O(10,y-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-=y)a.shift();for(i=1,r=a[0];r>=10;r/=10)i++;i<y&&(n-=y-i)}return s.e=n,s.d=a,s}function Oi(e){return f(e=new this(e),e.e+1,this.rounding)}function Fi(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function Ei(e){return new this(e).sin()}function vi(e){return new this(e).sinh()}function Di(e){return new this(e).sqrt()}function Vi(e,t){return new this(e).sub(t)}function _i(){var e=0,t=arguments,n=new this(t[e]);for(A=!1;n.s&&++e<t.length;)n=n.plus(t[e]);return A=!0,f(n,this.precision,this.rounding)}function Wi(e){return new this(e).tan()}function qi(e){return new this(e).tanh()}function Ui(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 ze=p.constructor=$t(at);We=new ze(We);qe=new ze(qe);var on=M(require("big.js")),Zi=M(require("bn.js"));var en=M(require("toformat")),Gi=en.default,xe=Gi;var Be=M(require("big.js")),nn=M(require("bn.js")),rn=M(require("decimal.js-light"));var fe=M(require("bn.js"));var tn=9007199254740991;function $(e){let t=W("Raydium_parseBigNumberish");if(e instanceof fe.default)return e;if(typeof e=="string"){if(e.match(/^-?[0-9]+$/))return new fe.default(e);t.logWithError(`invalid BigNumberish string: ${e}`)}return typeof e=="number"?(e%1&&t.logWithError(`BigNumberish number underflow: ${e}`),(e>=tn||e<=-tn)&&t.logWithError(`BigNumberish number overflow: ${e}`),new fe.default(String(e))):typeof e=="bigint"?new fe.default(e.toString()):(t.error(`invalid BigNumberish value: ${e}`),new fe.default(0))}var Ze=W("module/fraction"),dt=xe(Be.default),Ie=xe(rn.default),Hi={[0]:Ie.ROUND_DOWN,[1]:Ie.ROUND_HALF_UP,[2]:Ie.ROUND_UP},zi={[0]:Be.default.roundDown,[1]:Be.default.roundHalfUp,[2]:Be.default.roundUp},K=class{constructor(t,n=new nn.default(1)){this.numerator=$(t),this.denominator=$(n)}get quotient(){return this.numerator.div(this.denominator)}invert(){return new K(this.denominator,this.numerator)}add(t){let n=t instanceof K?t:new K($(t));return this.denominator.eq(n.denominator)?new K(this.numerator.add(n.numerator),this.denominator):new K(this.numerator.mul(n.denominator).add(n.numerator.mul(this.denominator)),this.denominator.mul(n.denominator))}sub(t){let n=t instanceof K?t:new K($(t));return this.denominator.eq(n.denominator)?new K(this.numerator.sub(n.numerator),this.denominator):new K(this.numerator.mul(n.denominator).sub(n.numerator.mul(this.denominator)),this.denominator.mul(n.denominator))}mul(t){let n=t instanceof K?t:new K($(t));return new K(this.numerator.mul(n.numerator),this.denominator.mul(n.denominator))}div(t){let n=t instanceof K?t:new K($(t));return new K(this.numerator.mul(n.denominator),this.denominator.mul(n.numerator))}toSignificant(t,n={groupSeparator:""},i=1){Number.isInteger(t)||Ze.logWithError(`${t} is not an integer.`),t<=0&&Ze.logWithError(`${t} is not positive.`),Ie.set({precision:t+1,rounding:Hi[i]});let r=new Ie(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)||Ze.logWithError(`${t} is not an integer.`),t<0&&Ze.logWithError(`${t} is negative.`),dt.DP=t,dt.RM=zi[i]||1,new dt(this.numerator.toString()).div(this.denominator.toString()).toFormat(t,n)}isZero(){return this.numerator.isZero()}};var Lo=W("Raydium_amount"),Ro=xe(on.default);var sn=require("@solana/web3.js"),pt=require("@solana/spl-token"),ft={chainId:101,address:sn.PublicKey.default.toBase58(),programId:pt.TOKEN_PROGRAM_ID.toBase58(),decimals:9,symbol:"SOL",name:"solana",logoURI:"https://img-v1.raydium.io/icon/So11111111111111111111111111111111111111112.png",tags:[],priority:2,type:"raydium",extensions:{coingeckoId:"solana"}},ue={chainId:101,address:"So11111111111111111111111111111111111111112",programId:pt.TOKEN_PROGRAM_ID.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"}};var je=require("@solana/web3.js");var x=require("@solana/web3.js"),an=require("@solana/spl-token");function bt({pubkey:e,isSigner:t=!1,isWritable:n=!0}){return{pubkey:e,isWritable:n,isSigner:t}}var Eo=[bt({pubkey:an.TOKEN_PROGRAM_ID,isWritable:!1}),bt({pubkey:x.SystemProgram.programId,isWritable:!1}),bt({pubkey:x.SYSVAR_RENT_PUBKEY,isWritable:!1})];function cn({publicKey:e,transformSol:t}){let n=un(e.toString());if(n instanceof x.PublicKey)return t&&n.equals(Se)?Ve:n;if(t&&n.toString()===Se.toBase58())return Ve;if(typeof n=="string"){if(n===x.PublicKey.default.toBase58())return x.PublicKey.default;try{return new x.PublicKey(n)}catch{throw new Error("invalid public key")}}throw new Error("invalid public key")}function un(e){try{return new x.PublicKey(e)}catch{return e}}var Qi=new x.PublicKey("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),Yi=new x.PublicKey("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),Ji=new x.PublicKey("SysvarRent111111111111111111111111111111111"),vo=new x.PublicKey("SysvarC1ock11111111111111111111111111111111"),ln=new x.PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),Do=new x.PublicKey("Sysvar1nstructions1111111111111111111111111"),Vo=x.SystemProgram.programId,_o=new x.PublicKey("4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R"),Wo=new x.PublicKey("Ea5SjE2Y6yvCeW5dYTn7PYMuW5ikXkvbGdcmSnXeaLjS"),qo=new x.PublicKey("SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt"),Uo=new x.PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"),Go=new x.PublicKey("Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"),Xo=new x.PublicKey("mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So"),Ho=new x.PublicKey("7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj"),zo=new x.PublicKey("USDH1SM1ojwWUga67PGrgFWUHibbjqMvuMaDkRJTgkX"),Zo=new x.PublicKey("NRVwhjBQiUPYtfDT5zRBVJajzFQHaBUNtC7SNVvqRFa"),jo=new x.PublicKey("ANAxByE6G2WjFp7A4NqtWYXb3mgruyzZYg3spfxe6Lbo"),Qo=new x.PublicKey("7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs"),Ve=new x.PublicKey("So11111111111111111111111111111111111111112"),Se=x.PublicKey.default;var gt=class{constructor({mint:t,decimals:n,symbol:i,name:r,skipMint:o=!1,isToken2022:s=!1}){if(t===Se.toBase58()||t instanceof je.PublicKey&&Se.equals(t)){this.decimals=ue.decimals,this.symbol=ue.symbol,this.name=ue.name,this.mint=new je.PublicKey(ue.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?je.PublicKey.default:cn({publicKey:t}),this.isToken2022=s}equals(t){return this===t?!0:this.mint.equals(t.mint)}},le=gt;le.WSOL=new gt(Y(Z({},ue),{mint:ue.address}));var yt=class{constructor({decimals:t,symbol:n="UNKNOWN",name:i="UNKNOWN"}){this.decimals=t,this.symbol=n,this.name=i}equals(t){return this===t}},Qe=yt;Qe.SOL=new yt(ft);var mn=M(require("bn.js"));var ss=new K(new mn.default(100));var ds=W("Raydium_price");var er=require("@solana/web3.js"),tr=M(require("bn.js"));var $i=new ee.default(0),Gs=new ee.default(1),Xs=new ee.default(2),Hs=new ee.default(3),zs=new ee.default(5),ji=new ee.default(10),Zs=new ee.default(100),js=new ee.default(1e3),Qs=new ee.default(1e4);var ir=require("@solana/web3.js"),rr=require("@solana/spl-token");var me=require("@solana/web3.js");var nr=require("@solana/spl-token"),ua=W("Raydium_txUtil");function ie(e,t){let[n,i]=me.PublicKey.findProgramAddressSync(e,t);return{publicKey:n,nonce:i}}var P=require("@solana/web3.js"),pa=new P.PublicKey("EhhTKczWMGQt46ynNeRX1WfeagwwJd7ufHvCDjRxjo5Q"),fa=new P.PublicKey("CBuCnLe26faBpcBP2fktp4rp8abpcAnTWft6ZrP5Q4T"),ba=new P.PublicKey("9KEPoZmtHUrBbhWN1v1KWLMkkvwY6WLtAVUCPRtRjP4z"),ga=new P.PublicKey("FarmqiPv5eAj3j1GMdMCMUGXqPUvmquZtMy86QH6rzhG"),ya=new P.PublicKey("CLaimxFqjHzgTJtAGHU47NPhg6qrc5sCnpC4tBLyABQS"),wa=new P.PublicKey("srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX"),Pa=new P.PublicKey("9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin"),Aa=new P.PublicKey("675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8"),Ta=new P.PublicKey("5quBtoiQqxF9Jv6KYKctB59NT3gtJD2Y65kdnB1Uev3h"),ka=new P.PublicKey("CDSr3ssLcRB6XYPJwAfFt18MZvEZp4LjHcvzBVZ45duo"),or=new P.PublicKey("CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK"),sr=new P.PublicKey("LockrWmn6K5twhz3y9w1dQERbmgSaRkfnTeTKbpofwE"),ar=new P.PublicKey("kN1kEznaF5Xbd8LYuqtEFcxzWSBk5Fv6ygX6SqEGJVy"),ha=new P.PublicKey("routeUGWgWzqBWFcrCfv8tritsqukccJPu3q5GPP3xS"),xa=new P.PublicKey("7YttLkHDoNj9wyDur5pM1ejNaAvT9X4eqaYcHQqtj2G5"),Ba=new P.PublicKey("6FJon3QE27qgPVggARueB22hLvoh22VzJpXv4rBEoSLF"),Ia=new P.PublicKey("CC12se5To1CdEuw7fDS27B7Geo5jJyL7t5UK2B44NgiH"),Sa=new P.PublicKey("9HzJyW1qZsEiSfMUf6L2jo3CcTKAyBmSyKdwQeYisHrC"),Ca=new P.PublicKey("DropEU8AvevN3UrXWXTMuz3rqnMczQVNjq3kcSdW2SQi"),Ka=new P.PublicKey("CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C"),Na=new P.PublicKey("GpMZbSM2GgvTKHJirzeGfMFoaZ8UR2X7F4v8vHTvxFbL"),La=new P.PublicKey("DNXgeM9EiiaAbaWvwjHj9fQQLAX5ZsfHyvmYUNRAdNC8"),cr=new P.PublicKey("CPMDWBwJDtYax9qW7AyRuVC19Cc4L4Vcy4n2BHAbHkCW"),ur=new P.PublicKey("7rQ1QFNosMkUCuh7Z7fPbTHvh73b68sQYdirycEzJVuw"),lr=new P.PublicKey("G11FKBRaAkHAKuLCgLM6K6NUc9rTjPAznRCjZifrTQe2"),Ra=new P.PublicKey("LockrWmn6K5twhz3y9w1dQERbmgSaRkfnTeTKbpofwE"),mr=new P.PublicKey("DLockwT7X7sxtLmGH9g5kmfcjaBtncdbUmi738m5bvQC"),Ma=new P.PublicKey("3f7GcQFG397GAaEnv51zR6tsTVihYRydnydDD1cXekxH"),dr=new P.PublicKey("7AFUeLVRjBfzqK3tTGw8hN48KLQWSk6DTE8xprWdPqix"),Oa=new P.PublicKey("LanMkFSVSncjWqWAM8MUHenZzt9xTcT3DcAp949ZwbF"),Fa=new P.PublicKey("495mQpkX8mHAv18yGsfubCXbFQ9Jok1L1BvMrV9KvCHr"),pr=new P.PublicKey("7soRSLviCKHCKzCbRuVpZDif76NWLVqFtbjt8LpyxWSq"),fr=new P.PublicKey("DG6kZFFCqxdtWXw53Zc28hLs3MTr28Efkm2FrsNERNSQ");var Ea={SERUM_MARKET:P.PublicKey.default,OPENBOOK_MARKET:new P.PublicKey("EoTcMgcDRTJVZDMZWBoU6rhYHZfkNTVEAfz3uUJRcYGj"),UTIL1216:P.PublicKey.default,FarmV3:new P.PublicKey("85BFyr98MbCUU9MVTEgzx1nbhWACbJqLzho6zd6DZcWL"),FarmV5:new P.PublicKey("EcLzTrNg9V7qhcdyXDe2qjtPkiGzDM2UbdRaeaadU5r2"),FarmV6:new P.PublicKey("Farm2hJLcqPtPg8M4rR6DMrsRNc5TPm5Cs4bVQrMe2T7"),AmmV4:new P.PublicKey("HWy1jotHpo6UqeQxx49dpYYdQB8wj9Qk9MdxwjLvDHB8"),AmmStable:new P.PublicKey("DDg4VmQaJV9ogWce7LpcjBA9bv22wRp5uaTPa5pGjijF"),CLMM:new P.PublicKey("devi51mZmdwUJGU9hjN27vEz64Gps7uUefqxg27EAtH"),CLMM_LOCK_PROGRAM_ID:new P.PublicKey("DLockwT7X7sxtLmGH9g5kmfcjaBtncdbUmi738m5bvQC"),CLMM_LOCK_AUTH_ID:new P.PublicKey("8qmHNvu2Kr2C7U8mJL4Vz1vTDxMhVuXKREwU7TNoaVEo"),Router:new P.PublicKey("BVChZ3XFEwTMUk1o9i3HAf91H6mFxSwa5X2wFAWhYPhU"),CREATE_CPMM_POOL_PROGRAM:cr,CREATE_CPMM_POOL_AUTH:ur,CREATE_CPMM_POOL_FEE_ACC:lr,FEE_DESTINATION_ID:new P.PublicKey("3XMrhbv989VxAMi3DErLV9eJht1pHppW5LbKxe9fkEFR"),LOCK_CPMM_PROGRAM:mr,LCOK_CPMM_AUTH:dr,LAUNCHPAD_PROGRAM:pr,LAUNCHPAD_AUTH:fr};var br=M(require("bn.js"));var Ke=require("@solana/web3.js");var gr={AcL1Vo8oy1ULiavEcjSUcwfBSForXMudcZvDZy5nzJkU:new Ke.AddressLookupTableAccount({key:new Ke.PublicKey("AcL1Vo8oy1ULiavEcjSUcwfBSForXMudcZvDZy5nzJkU"),state:Ke.AddressLookupTableAccount.deserialize(Buffer.from("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","base64"))})};var be=require("@solana/web3.js"),Pr=M(require("axios"));var pn=M(require("bn.js")),oc=new pn.default(1e6);var zr=require("@solana/web3.js"),Zr=M(require("bn.js"));var Mt=require("@solana/spl-token");var Ar=require("@solana/web3.js"),fn=require("@solana/spl-token");var tt=require("@solana/web3.js"),Hr=M(require("bn.js"));var Rt=require("@solana/spl-token");var wn=require("@solana/web3.js"),ge=M(require("bn.js"));var g=require("@solana/buffer-layout"),Tt=g.Layout,bn=g.Structure;var kt=g.UInt;var gn=g.u8,Ne=g.u16;var re=g.s32;var yn=g.seq;var G=g.blob;var ye=class extends Tt{constructor(n,i,r){super(n,r);this.blob=G(n),this.signed=i}decode(n,i=0){let r=new ge.default(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 ge.default(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 kt(1,e)}function we(e){return new kt(4,e)}function k(e){return new ye(8,!1,e)}function N(e){return new ye(16,!1,e)}function Pn(e){return new ye(8,!0,e)}function An(e){return new ye(16,!0,e)}var Je=class extends Tt{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 Je(G(32),t=>new wn.PublicKey(t),t=>t.toBuffer(),e)}function xt(e){return new Je(gn(),Tr,kr,e)}function Tr(e){if(e===0)return!1;if(e===1)return!0;throw new Error("Invalid bool: "+e)}function kr(e){return e?1:0}var ht=class extends bn{decode(t,n){return super.decode(t,n)}};function V(e,t,n){return new ht(e,t,n)}function L(e,t,n){let i,r=typeof t=="number"?t:(0,ge.isBN)(t)?t.toNumber():new Proxy(t,{get(o,s){if(!i){let a=Reflect.get(o,"count");i=(0,ge.isBN)(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 yn(e,r,n)}var Fr=M(require("bn.js"));var X=M(require("bn.js")),Bt=new X.default(0),Tn=new X.default(1),kn=new X.default(-1),$e=new X.default(1).shln(64),hn=new X.default(1).shln(128),hr=$e.sub(Tn);var xr=hn.subn(1),Pe=-443636,Le=-Pe,It=new X.default("4295048016"),St=new X.default("79226673521066979257578248091"),Zc=new X.default("4295048017"),jc=new X.default("79226673521066979257578248090");var Br=new X.default(10).pow(new X.default(6));var Qc=new X.default("18446744073700000000");var Or=M(require("bn.js"));function Ct(e){le