@powrldgr/raydium-sdk-v2
Version:
An SDK for building applications on top of Raydium.
1 lines • 87.6 kB
JavaScript
var Gn=Object.defineProperty,Hn=Object.defineProperties;var jn=Object.getOwnPropertyDescriptors;var je=Object.getOwnPropertySymbols;var Zt=Object.prototype.hasOwnProperty,Xt=Object.prototype.propertyIsEnumerable;var Qt=(t,e,n)=>e in t?Gn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,W=(t,e)=>{for(var n in e||(e={}))Zt.call(e,n)&&Qt(t,n,e[n]);if(je)for(var n of je(e))Xt.call(e,n)&&Qt(t,n,e[n]);return t},ue=(t,e)=>Hn(t,jn(e));var Ee=(t,e)=>{var n={};for(var r in t)Zt.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&je)for(var r of je(t))e.indexOf(r)<0&&Xt.call(t,r)&&(n[r]=t[r]);return n};import{PublicKey as We}from"@solana/web3.js";import Ge from"bn.js";import{TOKEN_PROGRAM_ID as Un}from"@solana/spl-token";import se from"bn.js";var Pe=9e15,pe=1e9,yt="0123456789abcdef",Qe="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Ze="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",wt={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Pe,maxE:Pe,crypto:!1},en,ie,M=!0,Ye="[DecimalError] ",fe=Ye+"Invalid argument: ",tn=Ye+"Precision limit exceeded",nn=Ye+"crypto unavailable",rn="[object Decimal]",Q=Math.floor,H=Math.pow,zn=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Qn=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Zn=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,on=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,ee=1e7,L=7,Xn=9007199254740991,Yn=Qe.length-1,xt=Ze.length-1,m={toStringTag:rn};m.absoluteValue=m.abs=function(){var t=new this.constructor(this);return t.s<0&&(t.s=1),S(t)};m.ceil=function(){return S(new this.constructor(this),this.e+1,2)};m.clampedTo=m.clamp=function(t,e){var n,r=this,i=r.constructor;if(t=new i(t),e=new i(e),!t.s||!e.s)return new i(NaN);if(t.gt(e))throw Error(fe+e);return n=r.cmp(t),n<0?t:r.cmp(e)>0?e:new i(r)};m.comparedTo=m.cmp=function(t){var e,n,r,i,o=this,s=o.d,a=(t=new o.constructor(t)).d,c=o.s,u=t.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!==t.e)return o.e>t.e^c<0?1:-1;for(r=s.length,i=a.length,e=0,n=r<i?r:i;e<n;++e)if(s[e]!==a[e])return s[e]>a[e]^c<0?1:-1;return r===i?0:r>i^c<0?1:-1};m.cosine=m.cos=function(){var t,e,n=this,r=n.constructor;return n.d?n.d[0]?(t=r.precision,e=r.rounding,r.precision=t+Math.max(n.e,n.sd())+L,r.rounding=1,n=Jn(r,ln(r,n)),r.precision=t,r.rounding=e,S(ie==2||ie==3?n.neg():n,t,e,!0)):new r(1):new r(NaN)};m.cubeRoot=m.cbrt=function(){var t,e,n,r,i,o,s,a,c,u,l=this,f=l.constructor;if(!l.isFinite()||l.isZero())return new f(l);for(M=!1,o=l.s*H(l.s*l,1/3),!o||Math.abs(o)==1/0?(n=j(l.d),t=l.e,(o=(t-n.length+1)%3)&&(n+=o==1||o==-2?"0":"00"),o=H(n,1/3),t=Q((t+1)/3)-(t%3==(t<0?-1:2)),o==1/0?n="5e"+t:(n=o.toExponential(),n=n.slice(0,n.indexOf("e")+1)+t),r=new f(n),r.s=l.s):r=new f(o.toString()),s=(t=f.precision)+3;;)if(a=r,c=a.times(a).times(a),u=c.plus(l),r=V(u.plus(l).times(a),u.plus(c),s+2,1),j(a.d).slice(0,s)===(n=j(r.d)).slice(0,s))if(n=n.slice(s-3,s+1),n=="9999"||!i&&n=="4999"){if(!i&&(S(a,t+1,0),a.times(a).times(a).eq(l))){r=a;break}s+=4,i=1}else{(!+n||!+n.slice(1)&&n.charAt(0)=="5")&&(S(r,t+1,1),e=!r.times(r).times(r).eq(l));break}return M=!0,S(r,t,f.rounding,e)};m.decimalPlaces=m.dp=function(){var t,e=this.d,n=NaN;if(e){if(t=e.length-1,n=(t-Q(this.e/L))*L,t=e[t],t)for(;t%10==0;t/=10)n--;n<0&&(n=0)}return n};m.dividedBy=m.div=function(t){return V(this,new this.constructor(t))};m.dividedToIntegerBy=m.divToInt=function(t){var e=this,n=e.constructor;return S(V(e,new n(t),0,1,1),n.precision,n.rounding)};m.equals=m.eq=function(t){return this.cmp(t)===0};m.floor=function(){return S(new this.constructor(this),this.e+1,3)};m.greaterThan=m.gt=function(t){return this.cmp(t)>0};m.greaterThanOrEqualTo=m.gte=function(t){var e=this.cmp(t);return e==1||e===0};m.hyperbolicCosine=m.cosh=function(){var t,e,n,r,i,o=this,s=o.constructor,a=new s(1);if(!o.isFinite())return new s(o.s?1/0:NaN);if(o.isZero())return a;n=s.precision,r=s.rounding,s.precision=n+Math.max(o.e,o.sd())+4,s.rounding=1,i=o.d.length,i<32?(t=Math.ceil(i/3),e=(1/$e(4,t)).toString()):(t=16,e="2.3283064365386962890625e-10"),o=Ae(s,1,o.times(e),new s(1),!0);for(var c,u=t,l=new s(8);u--;)c=o.times(o),o=a.minus(c.times(l.minus(c.times(l))));return S(o,s.precision=n,s.rounding=r,!0)};m.hyperbolicSine=m.sinh=function(){var t,e,n,r,i=this,o=i.constructor;if(!i.isFinite()||i.isZero())return new o(i);if(e=o.precision,n=o.rounding,o.precision=e+Math.max(i.e,i.sd())+4,o.rounding=1,r=i.d.length,r<3)i=Ae(o,2,i,i,!0);else{t=1.4*Math.sqrt(r),t=t>16?16:t|0,i=i.times(1/$e(5,t)),i=Ae(o,2,i,i,!0);for(var s,a=new o(5),c=new o(16),u=new o(20);t--;)s=i.times(i),i=i.times(a.plus(s.times(c.times(s).plus(u))))}return o.precision=e,o.rounding=n,S(i,e,n,!0)};m.hyperbolicTangent=m.tanh=function(){var t,e,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(t=r.precision,e=r.rounding,r.precision=t+7,r.rounding=1,V(n.sinh(),n.cosh(),r.precision=t,r.rounding=e)):new r(n.s)};m.inverseCosine=m.acos=function(){var t,e=this,n=e.constructor,r=e.abs().cmp(1),i=n.precision,o=n.rounding;return r!==-1?r===0?e.isNeg()?$(n,i,o):new n(0):new n(NaN):e.isZero()?$(n,i+4,o).times(.5):(n.precision=i+6,n.rounding=1,e=e.asin(),t=$(n,i+4,o).times(.5),n.precision=i,n.rounding=o,t.minus(e))};m.inverseHyperbolicCosine=m.acosh=function(){var t,e,n=this,r=n.constructor;return n.lte(1)?new r(n.eq(1)?0:NaN):n.isFinite()?(t=r.precision,e=r.rounding,r.precision=t+Math.max(Math.abs(n.e),n.sd())+4,r.rounding=1,M=!1,n=n.times(n).minus(1).sqrt().plus(n),M=!0,r.precision=t,r.rounding=e,n.ln()):new r(n)};m.inverseHyperbolicSine=m.asinh=function(){var t,e,n=this,r=n.constructor;return!n.isFinite()||n.isZero()?new r(n):(t=r.precision,e=r.rounding,r.precision=t+2*Math.max(Math.abs(n.e),n.sd())+6,r.rounding=1,M=!1,n=n.times(n).plus(1).sqrt().plus(n),M=!0,r.precision=t,r.rounding=e,n.ln())};m.inverseHyperbolicTangent=m.atanh=function(){var t,e,n,r,i=this,o=i.constructor;return i.isFinite()?i.e>=0?new o(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(t=o.precision,e=o.rounding,r=i.sd(),Math.max(r,t)<2*-i.e-1?S(new o(i),t,e,!0):(o.precision=n=r-i.e,i=V(i.plus(1),new o(1).minus(i),n+t,1),o.precision=t+4,o.rounding=1,i=i.ln(),o.precision=t,o.rounding=e,i.times(.5))):new o(NaN)};m.inverseSine=m.asin=function(){var t,e,n,r,i=this,o=i.constructor;return i.isZero()?new o(i):(e=i.abs().cmp(1),n=o.precision,r=o.rounding,e!==-1?e===0?(t=$(o,n+4,r).times(.5),t.s=i.s,t):new o(NaN):(o.precision=n+6,o.rounding=1,i=i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(),o.precision=n,o.rounding=r,i.times(2)))};m.inverseTangent=m.atan=function(){var t,e,n,r,i,o,s,a,c,u=this,l=u.constructor,f=l.precision,p=l.rounding;if(u.isFinite()){if(u.isZero())return new l(u);if(u.abs().eq(1)&&f+4<=xt)return s=$(l,f+4,p).times(.25),s.s=u.s,s}else{if(!u.s)return new l(NaN);if(f+4<=xt)return s=$(l,f+4,p).times(.5),s.s=u.s,s}for(l.precision=a=f+10,l.rounding=1,n=Math.min(28,a/L+2|0),t=n;t;--t)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(M=!1,e=Math.ceil(a/L),r=1,c=u.times(u),s=new l(u),i=u;t!==-1;)if(i=i.times(c),o=s.minus(i.div(r+=2)),i=i.times(c),s=o.plus(i.div(r+=2)),s.d[e]!==void 0)for(t=e;s.d[t]===o.d[t]&&t--;);return n&&(s=s.times(2<<n-1)),M=!0,S(s,l.precision=f,l.rounding=p,!0)};m.isFinite=function(){return!!this.d};m.isInteger=m.isInt=function(){return!!this.d&&Q(this.e/L)>this.d.length-2};m.isNaN=function(){return!this.s};m.isNegative=m.isNeg=function(){return this.s<0};m.isPositive=m.isPos=function(){return this.s>0};m.isZero=function(){return!!this.d&&this.d[0]===0};m.lessThan=m.lt=function(t){return this.cmp(t)<0};m.lessThanOrEqualTo=m.lte=function(t){return this.cmp(t)<1};m.logarithm=m.log=function(t){var e,n,r,i,o,s,a,c,u=this,l=u.constructor,f=l.precision,p=l.rounding,d=5;if(t==null)t=new l(10),e=!0;else{if(t=new l(t),n=t.d,t.s<0||!n||!n[0]||t.eq(1))return new l(NaN);e=t.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(e)if(n.length>1)o=!0;else{for(i=n[0];i%10===0;)i/=10;o=i!==1}if(M=!1,a=f+d,s=le(u,a),r=e?Xe(l,a+10):le(t,a),c=V(s,r,a,1),De(c.d,i=f,p))do if(a+=10,s=le(u,a),r=e?Xe(l,a+10):le(t,a),c=V(s,r,a,1),!o){+j(c.d).slice(i+1,i+15)+1==1e14&&(c=S(c,f+1,0));break}while(De(c.d,i+=10,p));return M=!0,S(c,f,p)};m.minus=m.sub=function(t){var e,n,r,i,o,s,a,c,u,l,f,p,d=this,b=d.constructor;if(t=new b(t),!d.d||!t.d)return!d.s||!t.s?t=new b(NaN):d.d?t.s=-t.s:t=new b(t.d||d.s!==t.s?d:NaN),t;if(d.s!=t.s)return t.s=-t.s,d.plus(t);if(u=d.d,p=t.d,a=b.precision,c=b.rounding,!u[0]||!p[0]){if(p[0])t.s=-t.s;else if(u[0])t=new b(d);else return new b(c===3?-0:0);return M?S(t,a,c):t}if(n=Q(t.e/L),l=Q(d.e/L),u=u.slice(),o=l-n,o){for(f=o<0,f?(e=u,o=-o,s=p.length):(e=p,n=l,s=u.length),r=Math.max(Math.ceil(a/L),s)+2,o>r&&(o=r,e.length=1),e.reverse(),r=o;r--;)e.push(0);e.reverse()}else{for(r=u.length,s=p.length,f=r<s,f&&(s=r),r=0;r<s;r++)if(u[r]!=p[r]){f=u[r]<p[r];break}o=0}for(f&&(e=u,u=p,p=e,t.s=-t.s),s=u.length,r=p.length-s;r>0;--r)u[s++]=0;for(r=p.length;r>o;){if(u[--r]<p[r]){for(i=r;i&&u[--i]===0;)u[i]=ee-1;--u[i],u[r]+=ee}u[r]-=p[r]}for(;u[--s]===0;)u.pop();for(;u[0]===0;u.shift())--n;return u[0]?(t.d=u,t.e=Je(u,n),M?S(t,a,c):t):new b(c===3?-0:0)};m.modulo=m.mod=function(t){var e,n=this,r=n.constructor;return t=new r(t),!n.d||!t.s||t.d&&!t.d[0]?new r(NaN):!t.d||n.d&&!n.d[0]?S(new r(n),r.precision,r.rounding):(M=!1,r.modulo==9?(e=V(n,t.abs(),0,3,1),e.s*=t.s):e=V(n,t,0,r.modulo,1),e=e.times(t),M=!0,n.minus(e))};m.naturalExponential=m.exp=function(){return Tt(this)};m.naturalLogarithm=m.ln=function(){return le(this)};m.negated=m.neg=function(){var t=new this.constructor(this);return t.s=-t.s,S(t)};m.plus=m.add=function(t){var e,n,r,i,o,s,a,c,u,l,f=this,p=f.constructor;if(t=new p(t),!f.d||!t.d)return!f.s||!t.s?t=new p(NaN):f.d||(t=new p(t.d||f.s===t.s?f:NaN)),t;if(f.s!=t.s)return t.s=-t.s,f.minus(t);if(u=f.d,l=t.d,a=p.precision,c=p.rounding,!u[0]||!l[0])return l[0]||(t=new p(f)),M?S(t,a,c):t;if(o=Q(f.e/L),r=Q(t.e/L),u=u.slice(),i=o-r,i){for(i<0?(n=u,i=-i,s=l.length):(n=l,r=o,s=u.length),o=Math.ceil(a/L),s=o>s?o+1:s+1,i>s&&(i=s,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for(s=u.length,i=l.length,s-i<0&&(i=s,n=l,l=u,u=n),e=0;i;)e=(u[--i]=u[i]+l[i]+e)/ee|0,u[i]%=ee;for(e&&(u.unshift(e),++r),s=u.length;u[--s]==0;)u.pop();return t.d=u,t.e=Je(u,r),M?S(t,a,c):t};m.precision=m.sd=function(t){var e,n=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(fe+t);return n.d?(e=sn(n.d),t&&n.e+1>e&&(e=n.e+1)):e=NaN,e};m.round=function(){var t=this,e=t.constructor;return S(new e(t),t.e+1,e.rounding)};m.sine=m.sin=function(){var t,e,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(t=r.precision,e=r.rounding,r.precision=t+Math.max(n.e,n.sd())+L,r.rounding=1,n=er(r,ln(r,n)),r.precision=t,r.rounding=e,S(ie>2?n.neg():n,t,e,!0)):new r(NaN)};m.squareRoot=m.sqrt=function(){var t,e,n,r,i,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(M=!1,u=Math.sqrt(+s),u==0||u==1/0?(e=j(a),(e.length+c)%2==0&&(e+="0"),u=Math.sqrt(e),c=Q((c+1)/2)-(c<0||c%2),u==1/0?e="5e"+c:(e=u.toExponential(),e=e.slice(0,e.indexOf("e")+1)+c),r=new l(e)):r=new l(u.toString()),n=(c=l.precision)+3;;)if(o=r,r=o.plus(V(s,o,n+2,1)).times(.5),j(o.d).slice(0,n)===(e=j(r.d)).slice(0,n))if(e=e.slice(n-3,n+1),e=="9999"||!i&&e=="4999"){if(!i&&(S(o,c+1,0),o.times(o).eq(s))){r=o;break}n+=4,i=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(S(r,c+1,1),t=!r.times(r).eq(s));break}return M=!0,S(r,c,l.rounding,t)};m.tangent=m.tan=function(){var t,e,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(t=r.precision,e=r.rounding,r.precision=t+10,r.rounding=1,n=n.sin(),n.s=1,n=V(n,new r(1).minus(n.times(n)).sqrt(),t+10,0),r.precision=t,r.rounding=e,S(ie==2||ie==4?n.neg():n,t,e,!0)):new r(NaN)};m.times=m.mul=function(t){var e,n,r,i,o,s,a,c,u,l=this,f=l.constructor,p=l.d,d=(t=new f(t)).d;if(t.s*=l.s,!p||!p[0]||!d||!d[0])return new f(!t.s||p&&!p[0]&&!d||d&&!d[0]&&!p?NaN:!p||!d?t.s/0:t.s*0);for(n=Q(l.e/L)+Q(t.e/L),c=p.length,u=d.length,c<u&&(o=p,p=d,d=o,s=c,c=u,u=s),o=[],s=c+u,r=s;r--;)o.push(0);for(r=u;--r>=0;){for(e=0,i=c+r;i>r;)a=o[i]+d[r]*p[i-r-1]+e,o[i--]=a%ee|0,e=a/ee|0;o[i]=(o[i]+e)%ee|0}for(;!o[--s];)o.pop();return e?++n:o.shift(),t.d=o,t.e=Je(o,n),M?S(t,f.precision,f.rounding):t};m.toBinary=function(t,e){return At(this,2,t,e)};m.toDecimalPlaces=m.toDP=function(t,e){var n=this,r=n.constructor;return n=new r(n),t===void 0?n:(J(t,0,pe),e===void 0?e=r.rounding:J(e,0,8),S(n,t+n.e+1,e))};m.toExponential=function(t,e){var n,r=this,i=r.constructor;return t===void 0?n=ne(r,!0):(J(t,0,pe),e===void 0?e=i.rounding:J(e,0,8),r=S(new i(r),t+1,e),n=ne(r,!0,t+1)),r.isNeg()&&!r.isZero()?"-"+n:n};m.toFixed=function(t,e){var n,r,i=this,o=i.constructor;return t===void 0?n=ne(i):(J(t,0,pe),e===void 0?e=o.rounding:J(e,0,8),r=S(new o(i),t+i.e+1,e),n=ne(r,!1,t+r.e+1)),i.isNeg()&&!i.isZero()?"-"+n:n};m.toFraction=function(t){var e,n,r,i,o,s,a,c,u,l,f,p,d=this,b=d.d,g=d.constructor;if(!b)return new g(d);if(u=n=new g(1),r=c=new g(0),e=new g(r),o=e.e=sn(b)-d.e-1,s=o%L,e.d[0]=H(10,s<0?L+s:s),t==null)t=o>0?e:u;else{if(a=new g(t),!a.isInt()||a.lt(u))throw Error(fe+a);t=a.gt(e)?o>0?e:u:a}for(M=!1,a=new g(j(b)),l=g.precision,g.precision=o=b.length*L*2;f=V(a,e,0,1,1),i=n.plus(f.times(r)),i.cmp(t)!=1;)n=r,r=i,i=u,u=c.plus(f.times(i)),c=i,i=e,e=a.minus(f.times(i)),a=i;return i=V(t.minus(n),r,0,1,1),c=c.plus(i.times(u)),n=n.plus(i.times(r)),c.s=u.s=d.s,p=V(u,r,o,1).minus(d).abs().cmp(V(c,n,o,1).minus(d).abs())<1?[u,r]:[c,n],g.precision=l,M=!0,p};m.toHexadecimal=m.toHex=function(t,e){return At(this,16,t,e)};m.toNearest=function(t,e){var n=this,r=n.constructor;if(n=new r(n),t==null){if(!n.d)return n;t=new r(1),e=r.rounding}else{if(t=new r(t),e===void 0?e=r.rounding:J(e,0,8),!n.d)return t.s?n:t;if(!t.d)return t.s&&(t.s=n.s),t}return t.d[0]?(M=!1,n=V(n,t,0,e,1).times(t),M=!0,S(n)):(t.s=n.s,n=t),n};m.toNumber=function(){return+this};m.toOctal=function(t,e){return At(this,8,t,e)};m.toPower=m.pow=function(t){var e,n,r,i,o,s,a=this,c=a.constructor,u=+(t=new c(t));if(!a.d||!t.d||!a.d[0]||!t.d[0])return new c(H(+a,u));if(a=new c(a),a.eq(1))return a;if(r=c.precision,o=c.rounding,t.eq(1))return S(a,r,o);if(e=Q(t.e/L),e>=t.d.length-1&&(n=u<0?-u:u)<=Xn)return i=an(c,a,n,r),t.s<0?new c(1).div(i):S(i,r,o);if(s=a.s,s<0){if(e<t.d.length-1)return new c(NaN);if((t.d[e]&1)==0&&(s=1),a.e==0&&a.d[0]==1&&a.d.length==1)return a.s=s,a}return n=H(+a,u),e=n==0||!isFinite(n)?Q(u*(Math.log("0."+j(a.d))/Math.LN10+a.e+1)):new c(n+"").e,e>c.maxE+1||e<c.minE-1?new c(e>0?s/0:0):(M=!1,c.rounding=a.s=1,n=Math.min(12,(e+"").length),i=Tt(t.times(le(a,r+n)),r),i.d&&(i=S(i,r+5,1),De(i.d,r,o)&&(e=r+10,i=S(Tt(t.times(le(a,e+n)),e),e+5,1),+j(i.d).slice(r+1,r+15)+1==1e14&&(i=S(i,r+1,0)))),i.s=s,M=!0,c.rounding=o,S(i,r,o))};m.toPrecision=function(t,e){var n,r=this,i=r.constructor;return t===void 0?n=ne(r,r.e<=i.toExpNeg||r.e>=i.toExpPos):(J(t,1,pe),e===void 0?e=i.rounding:J(e,0,8),r=S(new i(r),t,e),n=ne(r,t<=r.e||r.e<=i.toExpNeg,t)),r.isNeg()&&!r.isZero()?"-"+n:n};m.toSignificantDigits=m.toSD=function(t,e){var n=this,r=n.constructor;return t===void 0?(t=r.precision,e=r.rounding):(J(t,1,pe),e===void 0?e=r.rounding:J(e,0,8)),S(new r(n),t,e)};m.toString=function(){var t=this,e=t.constructor,n=ne(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()&&!t.isZero()?"-"+n:n};m.truncated=m.trunc=function(){return S(new this.constructor(this),this.e+1,1)};m.valueOf=m.toJSON=function(){var t=this,e=t.constructor,n=ne(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()?"-"+n:n};function j(t){var e,n,r,i=t.length-1,o="",s=t[0];if(i>0){for(o+=s,e=1;e<i;e++)r=t[e]+"",n=L-r.length,n&&(o+=ce(n)),o+=r;s=t[e],r=s+"",n=L-r.length,n&&(o+=ce(n))}else if(s===0)return"0";for(;s%10===0;)s/=10;return o+s}function J(t,e,n){if(t!==~~t||t<e||t>n)throw Error(fe+t)}function De(t,e,n,r){var i,o,s,a;for(o=t[0];o>=10;o/=10)--e;return--e<0?(e+=L,i=0):(i=Math.ceil((e+1)/L),e%=L),o=H(10,L-e),a=t[i]%o|0,r==null?e<3?(e==0?a=a/100|0:e==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)&&(t[i+1]/o/100|0)==H(10,e-2)-1||(a==o/2||a==0)&&(t[i+1]/o/100|0)==0:e<4?(e==0?a=a/1e3|0:e==1?a=a/100|0:e==2&&(a=a/10|0),s=(r||n<4)&&a==9999||!r&&n>3&&a==4999):s=((r||n<4)&&a+1==o||!r&&n>3&&a+1==o/2)&&(t[i+1]/o/1e3|0)==H(10,e-3)-1,s}function ze(t,e,n){for(var r,i=[0],o,s=0,a=t.length;s<a;){for(o=i.length;o--;)i[o]*=e;for(i[0]+=yt.indexOf(t.charAt(s++)),r=0;r<i.length;r++)i[r]>n-1&&(i[r+1]===void 0&&(i[r+1]=0),i[r+1]+=i[r]/n|0,i[r]%=n)}return i.reverse()}function Jn(t,e){var n,r,i;if(e.isZero())return e;r=e.d.length,r<32?(n=Math.ceil(r/3),i=(1/$e(4,n)).toString()):(n=16,i="2.3283064365386962890625e-10"),t.precision+=n,e=Ae(t,1,e.times(i),new t(1));for(var o=n;o--;){var s=e.times(e);e=s.times(s).minus(s).times(8).plus(1)}return t.precision-=n,e}var V=function(){function t(r,i,o){var s,a=0,c=r.length;for(r=r.slice();c--;)s=r[c]*i+a,r[c]=s%o|0,a=s/o|0;return a&&r.unshift(a),r}function e(r,i,o,s){var a,c;if(o!=s)c=o>s?1:-1;else for(a=c=0;a<o;a++)if(r[a]!=i[a]){c=r[a]>i[a]?1:-1;break}return c}function n(r,i,o,s){for(var a=0;o--;)r[o]-=a,a=r[o]<i[o]?1:0,r[o]=a*s+r[o]-i[o];for(;!r[0]&&r.length>1;)r.shift()}return function(r,i,o,s,a,c){var u,l,f,p,d,b,g,h,T,A,P,y,w,x,N,k,D,O,I,v,K=r.constructor,F=r.s==i.s?1:-1,_=r.d,C=i.d;if(!_||!_[0]||!C||!C[0])return new K(!r.s||!i.s||(_?C&&_[0]==C[0]:!C)?NaN:_&&_[0]==0||!C?F*0:F/0);for(c?(d=1,l=r.e-i.e):(c=ee,d=L,l=Q(r.e/d)-Q(i.e/d)),I=C.length,D=_.length,T=new K(F),A=T.d=[],f=0;C[f]==(_[f]||0);f++);if(C[f]>(_[f]||0)&&l--,o==null?(x=o=K.precision,s=K.rounding):a?x=o+(r.e-i.e)+1:x=o,x<0)A.push(1),b=!0;else{if(x=x/d+2|0,f=0,I==1){for(p=0,C=C[0],x++;(f<D||p)&&x--;f++)N=p*c+(_[f]||0),A[f]=N/C|0,p=N%C|0;b=p||f<D}else{for(p=c/(C[0]+1)|0,p>1&&(C=t(C,p,c),_=t(_,p,c),I=C.length,D=_.length),k=I,P=_.slice(0,I),y=P.length;y<I;)P[y++]=0;v=C.slice(),v.unshift(0),O=C[0],C[1]>=c/2&&++O;do p=0,u=e(C,P,I,y),u<0?(w=P[0],I!=y&&(w=w*c+(P[1]||0)),p=w/O|0,p>1?(p>=c&&(p=c-1),g=t(C,p,c),h=g.length,y=P.length,u=e(g,P,h,y),u==1&&(p--,n(g,I<h?v:C,h,c))):(p==0&&(u=p=1),g=C.slice()),h=g.length,h<y&&g.unshift(0),n(P,g,y,c),u==-1&&(y=P.length,u=e(C,P,I,y),u<1&&(p++,n(P,I<y?v:C,y,c))),y=P.length):u===0&&(p++,P=[0]),A[f++]=p,u&&P[0]?P[y++]=_[k]||0:(P=[_[k]],y=1);while((k++<D||P[0]!==void 0)&&x--);b=P[0]!==void 0}A[0]||A.shift()}if(d==1)T.e=l,en=b;else{for(f=1,p=A[0];p>=10;p/=10)f++;T.e=f+l*d-1,S(T,a?o+T.e+1:o,s,b)}return T}}();function S(t,e,n,r){var i,o,s,a,c,u,l,f,p,d=t.constructor;e:if(e!=null){if(f=t.d,!f)return t;for(i=1,a=f[0];a>=10;a/=10)i++;if(o=e-i,o<0)o+=L,s=e,l=f[p=0],c=l/H(10,i-s-1)%10|0;else if(p=Math.ceil((o+1)/L),a=f.length,p>=a)if(r){for(;a++<=p;)f.push(0);l=c=0,i=1,o%=L,s=o-L+1}else break e;else{for(l=a=f[p],i=1;a>=10;a/=10)i++;o%=L,s=o-L+i,c=s<0?0:l/H(10,i-s-1)%10|0}if(r=r||e<0||f[p+1]!==void 0||(s<0?l:l%H(10,i-s-1)),u=n<4?(c||r)&&(n==0||n==(t.s<0?3:2)):c>5||c==5&&(n==4||r||n==6&&(o>0?s>0?l/H(10,i-s):0:f[p-1])%10&1||n==(t.s<0?8:7)),e<1||!f[0])return f.length=0,u?(e-=t.e+1,f[0]=H(10,(L-e%L)%L),t.e=-e||0):f[0]=t.e=0,t;if(o==0?(f.length=p,a=1,p--):(f.length=p+1,a=H(10,L-o),f[p]=s>0?(l/H(10,i-s)%H(10,s)|0)*a:0),u)for(;;)if(p==0){for(o=1,s=f[0];s>=10;s/=10)o++;for(s=f[0]+=a,a=1;s>=10;s/=10)a++;o!=a&&(t.e++,f[0]==ee&&(f[0]=1));break}else{if(f[p]+=a,f[p]!=ee)break;f[p--]=0,a=1}for(o=f.length;f[--o]===0;)f.pop()}return M&&(t.e>d.maxE?(t.d=null,t.e=NaN):t.e<d.minE&&(t.e=0,t.d=[0])),t}function ne(t,e,n){if(!t.isFinite())return cn(t);var r,i=t.e,o=j(t.d),s=o.length;return e?(n&&(r=n-s)>0?o=o.charAt(0)+"."+o.slice(1)+ce(r):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(t.e<0?"e":"e+")+t.e):i<0?(o="0."+ce(-i-1)+o,n&&(r=n-s)>0&&(o+=ce(r))):i>=s?(o+=ce(i+1-s),n&&(r=n-i-1)>0&&(o=o+"."+ce(r))):((r=i+1)<s&&(o=o.slice(0,r)+"."+o.slice(r)),n&&(r=n-s)>0&&(i+1===s&&(o+="."),o+=ce(r))),o}function Je(t,e){var n=t[0];for(e*=L;n>=10;n/=10)e++;return e}function Xe(t,e,n){if(e>Yn)throw M=!0,n&&(t.precision=n),Error(tn);return S(new t(Qe),e,1,!0)}function $(t,e,n){if(e>xt)throw Error(tn);return S(new t(Ze),e,n,!0)}function sn(t){var e=t.length-1,n=e*L+1;if(e=t[e],e){for(;e%10==0;e/=10)n--;for(e=t[0];e>=10;e/=10)n++}return n}function ce(t){for(var e="";t--;)e+="0";return e}function an(t,e,n,r){var i,o=new t(1),s=Math.ceil(r/L+4);for(M=!1;;){if(n%2&&(o=o.times(e),Jt(o.d,s)&&(i=!0)),n=Q(n/2),n===0){n=o.d.length-1,i&&o.d[n]===0&&++o.d[n];break}e=e.times(e),Jt(e.d,s)}return M=!0,o}function Yt(t){return t.d[t.d.length-1]&1}function un(t,e,n){for(var r,i=new t(e[0]),o=0;++o<e.length;)if(r=new t(e[o]),r.s)i[n](r)&&(i=r);else{i=r;break}return i}function Tt(t,e){var n,r,i,o,s,a,c,u=0,l=0,f=0,p=t.constructor,d=p.rounding,b=p.precision;if(!t.d||!t.d[0]||t.e>17)return new p(t.d?t.d[0]?t.s<0?0:1/0:1:t.s?t.s<0?0:t:0/0);for(e==null?(M=!1,c=b):c=e,a=new p(.03125);t.e>-2;)t=t.times(a),f+=5;for(r=Math.log(H(2,f))/Math.LN10*2+5|0,c+=r,n=o=s=new p(1),p.precision=c;;){if(o=S(o.times(t),c,1),n=n.times(++l),a=s.plus(V(o,n,c,1)),j(a.d).slice(0,c)===j(s.d).slice(0,c)){for(i=f;i--;)s=S(s.times(s),c,1);if(e==null)if(u<3&&De(s.d,c-r,d,u))p.precision=c+=10,n=o=a=new p(1),l=0,u++;else return S(s,p.precision=b,d,M=!0);else return p.precision=b,s}s=a}}function le(t,e){var n,r,i,o,s,a,c,u,l,f,p,d=1,b=10,g=t,h=g.d,T=g.constructor,A=T.rounding,P=T.precision;if(g.s<0||!h||!h[0]||!g.e&&h[0]==1&&h.length==1)return new T(h&&!h[0]?-1/0:g.s!=1?NaN:h?0:g);if(e==null?(M=!1,l=P):l=e,T.precision=l+=b,n=j(h),r=n.charAt(0),Math.abs(o=g.e)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)g=g.times(t),n=j(g.d),r=n.charAt(0),d++;o=g.e,r>1?(g=new T("0."+n),o++):g=new T(r+"."+n.slice(1))}else return u=Xe(T,l+2,P).times(o+""),g=le(new T(r+"."+n.slice(1)),l-b).plus(u),T.precision=P,e==null?S(g,P,A,M=!0):g;for(f=g,c=s=g=V(g.minus(1),g.plus(1),l,1),p=S(g.times(g),l,1),i=3;;){if(s=S(s.times(p),l,1),u=c.plus(V(s,new T(i),l,1)),j(u.d).slice(0,l)===j(c.d).slice(0,l))if(c=c.times(2),o!==0&&(c=c.plus(Xe(T,l+2,P).times(o+""))),c=V(c,new T(d),l,1),e==null)if(De(c.d,l-b,A,a))T.precision=l+=b,u=s=g=V(f.minus(1),f.plus(1),l,1),p=S(g.times(g),l,1),i=a=1;else return S(c,T.precision=P,A,M=!0);else return T.precision=P,c;c=u,i+=2}}function cn(t){return String(t.s*t.s/0)}function Pt(t,e){var n,r,i;for((n=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(n<0&&(n=r),n+=+e.slice(r+1),e=e.substring(0,r)):n<0&&(n=e.length),r=0;e.charCodeAt(r)===48;r++);for(i=e.length;e.charCodeAt(i-1)===48;--i);if(e=e.slice(r,i),e){if(i-=r,t.e=n=n-r-1,t.d=[],r=(n+1)%L,n<0&&(r+=L),r<i){for(r&&t.d.push(+e.slice(0,r)),i-=L;r<i;)t.d.push(+e.slice(r,r+=L));e=e.slice(r),r=L-e.length}else r-=i;for(;r--;)e+="0";t.d.push(+e),M&&(t.e>t.constructor.maxE?(t.d=null,t.e=NaN):t.e<t.constructor.minE&&(t.e=0,t.d=[0]))}else t.e=0,t.d=[0];return t}function $n(t,e){var n,r,i,o,s,a,c,u,l;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),on.test(e))return Pt(t,e)}else if(e==="Infinity"||e==="NaN")return+e||(t.s=NaN),t.e=NaN,t.d=null,t;if(Qn.test(e))n=16,e=e.toLowerCase();else if(zn.test(e))n=2;else if(Zn.test(e))n=8;else throw Error(fe+e);for(o=e.search(/p/i),o>0?(c=+e.slice(o+1),e=e.substring(2,o)):e=e.slice(2),o=e.indexOf("."),s=o>=0,r=t.constructor,s&&(e=e.replace(".",""),a=e.length,o=a-o,i=an(r,new r(n),o,o*2)),u=ze(e,n,ee),l=u.length-1,o=l;u[o]===0;--o)u.pop();return o<0?new r(t.s*0):(t.e=Je(u,l),t.d=u,M=!1,s&&(t=V(t,i,a*4)),c&&(t=t.times(Math.abs(c)<54?H(2,c):et.pow(2,c))),M=!0,t)}function er(t,e){var n,r=e.d.length;if(r<3)return e.isZero()?e:Ae(t,2,e,e);n=1.4*Math.sqrt(r),n=n>16?16:n|0,e=e.times(1/$e(5,n)),e=Ae(t,2,e,e);for(var i,o=new t(5),s=new t(16),a=new t(20);n--;)i=e.times(e),e=e.times(o.plus(i.times(s.times(i).minus(a))));return e}function Ae(t,e,n,r,i){var o,s,a,c,u=1,l=t.precision,f=Math.ceil(l/L);for(M=!1,c=n.times(n),a=new t(r);;){if(s=V(a.times(c),new t(e++*e++),l,1),a=i?r.plus(s):r.minus(s),r=V(s.times(c),new t(e++*e++),l,1),s=a.plus(r),s.d[f]!==void 0){for(o=f;s.d[o]===a.d[o]&&o--;);if(o==-1)break}o=a,a=r,r=s,s=o,u++}return M=!0,s.d.length=f+1,s}function $e(t,e){for(var n=t;--e;)n*=t;return n}function ln(t,e){var n,r=e.s<0,i=$(t,t.precision,1),o=i.times(.5);if(e=e.abs(),e.lte(o))return ie=r?4:1,e;if(n=e.divToInt(i),n.isZero())ie=r?3:2;else{if(e=e.minus(n.times(i)),e.lte(o))return ie=Yt(n)?r?2:3:r?4:1,e;ie=Yt(n)?r?1:4:r?3:2}return e.minus(i).abs()}function At(t,e,n,r){var i,o,s,a,c,u,l,f,p,d=t.constructor,b=n!==void 0;if(b?(J(n,1,pe),r===void 0?r=d.rounding:J(r,0,8)):(n=d.precision,r=d.rounding),!t.isFinite())l=cn(t);else{for(l=ne(t),s=l.indexOf("."),b?(i=2,e==16?n=n*4-3:e==8&&(n=n*3-2)):i=e,s>=0&&(l=l.replace(".",""),p=new d(1),p.e=l.length-s,p.d=ze(ne(p),10,i),p.e=p.d.length),f=ze(l,10,i),o=c=f.length;f[--c]==0;)f.pop();if(!f[0])l=b?"0p+0":"0";else{if(s<0?o--:(t=new d(t),t.d=f,t.e=o,t=V(t,p,n,r,0,i),f=t.d,o=t.e,u=en),s=f[n],a=i/2,u=u||f[n+1]!==void 0,u=r<4?(s!==void 0||u)&&(r===0||r===(t.s<0?3:2)):s>a||s===a&&(r===4||u||r===6&&f[n-1]&1||r===(t.s<0?8:7)),f.length=n,u)for(;++f[--n]>i-1;)f[n]=0,n||(++o,f.unshift(1));for(c=f.length;!f[c-1];--c);for(s=0,l="";s<c;s++)l+=yt.charAt(f[s]);if(b){if(c>1)if(e==16||e==8){for(s=e==16?4:3,--c;c%s;c++)l+="0";for(f=ze(l,i,e),c=f.length;!f[c-1];--c);for(s=1,l="1.";s<c;s++)l+=yt.charAt(f[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=(e==16?"0x":e==2?"0b":e==8?"0o":"")+l}return t.s<0?"-"+l:l}function Jt(t,e){if(t.length>e)return t.length=e,!0}function tr(t){return new this(t).abs()}function nr(t){return new this(t).acos()}function rr(t){return new this(t).acosh()}function ir(t,e){return new this(t).plus(e)}function or(t){return new this(t).asin()}function sr(t){return new this(t).asinh()}function ar(t){return new this(t).atan()}function ur(t){return new this(t).atanh()}function cr(t,e){t=new this(t),e=new this(e);var n,r=this.precision,i=this.rounding,o=r+4;return!t.s||!e.s?n=new this(NaN):!t.d&&!e.d?(n=$(this,o,1).times(e.s>0?.25:.75),n.s=t.s):!e.d||t.isZero()?(n=e.s<0?$(this,r,i):new this(0),n.s=t.s):!t.d||e.isZero()?(n=$(this,o,1).times(.5),n.s=t.s):e.s<0?(this.precision=o,this.rounding=1,n=this.atan(V(t,e,o,1)),e=$(this,o,1),this.precision=r,this.rounding=i,n=t.s<0?n.minus(e):n.plus(e)):n=this.atan(V(t,e,o,1)),n}function lr(t){return new this(t).cbrt()}function fr(t){return S(t=new this(t),t.e+1,2)}function pr(t,e,n){return new this(t).clamp(e,n)}function dr(t){if(!t||typeof t!="object")throw Error(Ye+"Object expected");var e,n,r,i=t.defaults===!0,o=["precision",1,pe,"rounding",0,8,"toExpNeg",-Pe,0,"toExpPos",0,Pe,"maxE",0,Pe,"minE",-Pe,0,"modulo",0,9];for(e=0;e<o.length;e+=3)if(n=o[e],i&&(this[n]=wt[n]),(r=t[n])!==void 0)if(Q(r)===r&&r>=o[e+1]&&r<=o[e+2])this[n]=r;else throw Error(fe+n+": "+r);if(n="crypto",i&&(this[n]=wt[n]),(r=t[n])!==void 0)if(r===!0||r===!1||r===0||r===1)if(r)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[n]=!0;else throw Error(nn);else this[n]=!1;else throw Error(fe+n+": "+r);return this}function mr(t){return new this(t).cos()}function gr(t){return new this(t).cosh()}function fn(t){var e,n,r;function i(o){var s,a,c,u=this;if(!(u instanceof i))return new i(o);if(u.constructor=i,$t(o)){u.s=o.s,M?!o.d||o.e>i.maxE?(u.e=NaN,u.d=null):o.e<i.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++;M?s>i.maxE?(u.e=NaN,u.d=null):s<i.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 Pt(u,o.toString())}else if(c!=="string")throw Error(fe+o);return(a=o.charCodeAt(0))===45?(o=o.slice(1),u.s=-1):(a===43&&(o=o.slice(1)),u.s=1),on.test(o)?Pt(u,o):$n(u,o)}if(i.prototype=m,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.EUCLID=9,i.config=i.set=dr,i.clone=fn,i.isDecimal=$t,i.abs=tr,i.acos=nr,i.acosh=rr,i.add=ir,i.asin=or,i.asinh=sr,i.atan=ar,i.atanh=ur,i.atan2=cr,i.cbrt=lr,i.ceil=fr,i.clamp=pr,i.cos=mr,i.cosh=gr,i.div=hr,i.exp=br,i.floor=yr,i.hypot=wr,i.ln=xr,i.log=Tr,i.log10=Ar,i.log2=Pr,i.max=Sr,i.min=Br,i.mod=Lr,i.mul=kr,i.pow=Cr,i.random=Nr,i.round=Mr,i.sign=Rr,i.sin=Er,i.sinh=Dr,i.sqrt=vr,i.sub=Ir,i.sum=Kr,i.tan=_r,i.tanh=Or,i.trunc=Fr,t===void 0&&(t={}),t&&t.defaults!==!0)for(r=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],e=0;e<r.length;)t.hasOwnProperty(n=r[e++])||(t[n]=this[n]);return i.config(t),i}function hr(t,e){return new this(t).div(e)}function br(t){return new this(t).exp()}function yr(t){return S(t=new this(t),t.e+1,3)}function wr(){var t,e,n=new this(0);for(M=!1,t=0;t<arguments.length;)if(e=new this(arguments[t++]),e.d)n.d&&(n=n.plus(e.times(e)));else{if(e.s)return M=!0,new this(1/0);n=e}return M=!0,n.sqrt()}function $t(t){return t instanceof et||t&&t.toStringTag===rn||!1}function xr(t){return new this(t).ln()}function Tr(t,e){return new this(t).log(e)}function Pr(t){return new this(t).log(2)}function Ar(t){return new this(t).log(10)}function Sr(){return un(this,arguments,"lt")}function Br(){return un(this,arguments,"gt")}function Lr(t,e){return new this(t).mod(e)}function kr(t,e){return new this(t).mul(e)}function Cr(t,e){return new this(t).pow(e)}function Nr(t){var e,n,r,i,o=0,s=new this(1),a=[];if(t===void 0?t=this.precision:J(t,1,pe),r=Math.ceil(t/L),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(r));o<r;)i=e[o],i>=429e7?e[o]=crypto.getRandomValues(new Uint32Array(1))[0]:a[o++]=i%1e7;else if(crypto.randomBytes){for(e=crypto.randomBytes(r*=4);o<r;)i=e[o]+(e[o+1]<<8)+(e[o+2]<<16)+((e[o+3]&127)<<24),i>=214e7?crypto.randomBytes(4).copy(e,o):(a.push(i%1e7),o+=4);o=r/4}else throw Error(nn);else for(;o<r;)a[o++]=Math.random()*1e7|0;for(r=a[--o],t%=L,r&&t&&(i=H(10,L-t),a[o]=(r/i|0)*i);a[o]===0;o--)a.pop();if(o<0)n=0,a=[0];else{for(n=-1;a[0]===0;n-=L)a.shift();for(r=1,i=a[0];i>=10;i/=10)r++;r<L&&(n-=L-r)}return s.e=n,s.d=a,s}function Mr(t){return S(t=new this(t),t.e+1,this.rounding)}function Rr(t){return t=new this(t),t.d?t.d[0]?t.s:0*t.s:t.s||NaN}function Er(t){return new this(t).sin()}function Dr(t){return new this(t).sinh()}function vr(t){return new this(t).sqrt()}function Ir(t,e){return new this(t).sub(e)}function Kr(){var t=0,e=arguments,n=new this(e[t]);for(M=!1;n.s&&++t<e.length;)n=n.plus(e[t]);return M=!0,S(n,this.precision,this.rounding)}function _r(t){return new this(t).tan()}function Or(t){return new this(t).tanh()}function Fr(t){return S(t=new this(t),t.e+1,1)}m[Symbol.for("nodejs.util.inspect.custom")]=m.toString;m[Symbol.toStringTag]="Decimal";var et=m.constructor=fn(wt);Qe=new et(Qe);Ze=new et(Ze);import ci from"big.js";import cu from"bn.js";import{get as pn,set as Vr}from"lodash";var St=class{constructor(e){this.logLevel=e.logLevel!==void 0?e.logLevel:0,this.name=e.name}set level(e){this.logLevel=e}get time(){return Date.now().toString()}get moduleName(){return this.name}isLogLevel(e){return e<=this.logLevel}error(...e){return this.isLogLevel(0)?(console.error(this.time,this.name,"sdk logger error",...e),this):this}logWithError(...e){let n=e.map(r=>typeof r=="object"?JSON.stringify(r):r).join(", ");throw new Error(n)}warning(...e){return this.isLogLevel(1)?(console.warn(this.time,this.name,"sdk logger warning",...e),this):this}info(...e){return this.isLogLevel(2)?(console.info(this.time,this.name,"sdk logger info",...e),this):this}debug(...e){return this.isLogLevel(3)?(console.debug(this.time,this.name,"sdk logger debug",...e),this):this}},dn={},qr={};function Z(t){let e=pn(dn,t);if(!e){let n=pn(qr,t);e=new St({name:t,logLevel:n}),Vr(dn,t,e)}return e}import{PublicKey as Ur}from"@solana/web3.js";import{MINT_SIZE as Wi,TOKEN_PROGRAM_ID as Gi,getTransferFeeConfig as Hi,unpackMint as ji}from"@solana/spl-token";var Bt=Z("Raydium_accountInfo_util");async function mn(t,e,n){let{batchRequest:r,commitment:i="confirmed",chunkCount:o=100}=W({batchRequest:!1},n),s=Lt(e,o),a=new Array(s.length).fill([]);if(r){let c=s.map(f=>{let p=t._buildArgs([f.map(d=>d.toBase58())],i,"base64");return{methodName:"getMultipleAccounts",args:p}}),u=Lt(c,10);a=(await(await Promise.all(u.map(async f=>await t._rpcBatchRequest(f)))).flat()).map(f=>(f.error&&Bt.logWithError(`failed to get info for multiple accounts, RPC_ERROR, ${f.error.message}`),f.result.value.map(p=>{if(p){let{data:d,executable:b,lamports:g,owner:h,rentEpoch:T}=p;return d.length!==2&&d[1]!=="base64"&&Bt.logWithError("info must be base64 encoded, RPC_ERROR"),{data:Buffer.from(d[0],"base64"),executable:b,lamports:g,owner:new Ur(h),rentEpoch:T}}return null})))}else try{a=await Promise.all(s.map(c=>t.getMultipleAccountsInfo(c,i)))}catch(c){c instanceof Error&&Bt.logWithError(`failed to get info for multiple accounts, RPC_ERROR, ${c.message}`)}return a.flat()}import ve from"bn.js";var gn=9007199254740991;function oe(t){let e=Z("Raydium_parseBigNumberish");if(t instanceof ve)return t;if(typeof t=="string"){if(t.match(/^-?[0-9]+$/))return new ve(t);e.logWithError(`invalid BigNumberish string: ${t}`)}return typeof t=="number"?(t%1&&e.logWithError(`BigNumberish number underflow: ${t}`),(t>=gn||t<=-gn)&&e.logWithError(`BigNumberish number overflow: ${t}`),new ve(String(t))):typeof t=="bigint"?new ve(t.toString()):(e.error(`invalid BigNumberish value: ${t}`),new ve(0))}import{PublicKey as Wr}from"@solana/web3.js";import{TOKEN_PROGRAM_ID as hn}from"@solana/spl-token";var bn={chainId:101,address:Wr.default.toBase58(),programId:hn.toBase58(),decimals:9,symbol:"SOL",name:"solana",logoURI:"https://img-v1.raydium.io/icon/So11111111111111111111111111111111111111112.png",tags:[],priority:2,type:"raydium",extensions:{coingeckoId:"solana"}},ye={chainId:101,address:"So11111111111111111111111111111111111111112",programId:hn.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 Nt}from"@solana/web3.js";import{PublicKey as U,SystemProgram as yn,SYSVAR_RENT_PUBKEY as Gr}from"@solana/web3.js";import{TOKEN_PROGRAM_ID as Hr}from"@solana/spl-token";function Ct({pubkey:t,isSigner:e=!1,isWritable:n=!0}){return{pubkey:t,isWritable:n,isSigner:e}}var oo=[Ct({pubkey:Hr,isWritable:!1}),Ct({pubkey:yn.programId,isWritable:!1}),Ct({pubkey:Gr,isWritable:!1})];function wn({publicKey:t,transformSol:e}){let n=xn(t.toString());if(n instanceof U)return e&&n.equals(Ie)?kt:n;if(e&&n.toString()===Ie.toBase58())return kt;if(typeof n=="string"){if(n===U.default.toBase58())return U.default;try{return new U(n)}catch{throw new Error("invalid public key")}}throw new Error("invalid public key")}function xn(t){try{return new U(t)}catch{return t}}var so=new U("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),ao=new U("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),uo=new U("SysvarRent111111111111111111111111111111111"),co=new U("SysvarC1ock11111111111111111111111111111111"),lo=new U("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),fo=new U("Sysvar1nstructions1111111111111111111111111"),po=yn.programId,mo=new U("4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R"),go=new U("Ea5SjE2Y6yvCeW5dYTn7PYMuW5ikXkvbGdcmSnXeaLjS"),ho=new U("SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt"),bo=new U("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"),yo=new U("Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"),wo=new U("mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So"),xo=new U("7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj"),To=new U("USDH1SM1ojwWUga67PGrgFWUHibbjqMvuMaDkRJTgkX"),Po=new U("NRVwhjBQiUPYtfDT5zRBVJajzFQHaBUNtC7SNVvqRFa"),Ao=new U("ANAxByE6G2WjFp7A4NqtWYXb3mgruyzZYg3spfxe6Lbo"),So=new U("7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs"),kt=new U("So11111111111111111111111111111111111111112"),Ie=U.default;var Mt=class{constructor({mint:e,decimals:n,symbol:r,name:i,skipMint:o=!1,isToken2022:s=!1}){if(e===Ie.toBase58()||e instanceof Nt&&Ie.equals(e)){this.decimals=ye.decimals,this.symbol=ye.symbol,this.name=ye.name,this.mint=new Nt(ye.address),this.isToken2022=!1;return}this.decimals=n,this.symbol=r||e.toString().substring(0,6),this.name=i||e.toString().substring(0,6),this.mint=o?Nt.default:wn({publicKey:e}),this.isToken2022=s}equals(e){return this===e?!0:this.mint.equals(e.mint)}},Se=Mt;Se.WSOL=new Mt(ue(W({},ye),{mint:ye.address}));var Rt=class{constructor({decimals:e,symbol:n="UNKNOWN",name:r="UNKNOWN"}){this.decimals=e,this.symbol=n,this.name=r}equals(e){return this===e}},tt=Rt;tt.SOL=new Rt(bn);import jr from"toformat";var zr=jr,Ke=zr;import rt from"big.js";import Zr from"bn.js";import Xr from"decimal.js-light";var nt=Z("module/fraction"),Et=Ke(rt),_e=Ke(Xr),Yr={[0]:_e.ROUND_DOWN,[1]:_e.ROUND_HALF_UP,[2]:_e.ROUND_UP},Jr={[0]:rt.roundDown,[1]:rt.roundHalfUp,[2]:rt.roundUp},q=class{constructor(e,n=new Zr(1)){this.numerator=oe(e),this.denominator=oe(n)}get quotient(){return this.numerator.div(this.denominator)}invert(){return new q(this.denominator,this.numerator)}add(e){let n=e instanceof q?e:new q(oe(e));return this.denominator.eq(n.denominator)?new q(this.numerator.add(n.numerator),this.denominator):new q(this.numerator.mul(n.denominator).add(n.numerator.mul(this.denominator)),this.denominator.mul(n.denominator))}sub(e){let n=e instanceof q?e:new q(oe(e));return this.denominator.eq(n.denominator)?new q(this.numerator.sub(n.numerator),this.denominator):new q(this.numerator.mul(n.denominator).sub(n.numerator.mul(this.denominator)),this.denominator.mul(n.denominator))}mul(e){let n=e instanceof q?e:new q(oe(e));return new q(this.numerator.mul(n.numerator),this.denominator.mul(n.denominator))}div(e){let n=e instanceof q?e:new q(oe(e));return new q(this.numerator.mul(n.denominator),this.denominator.mul(n.numerator))}toSignificant(e,n={groupSeparator:""},r=1){Number.isInteger(e)||nt.logWithError(`${e} is not an integer.`),e<=0&&nt.logWithError(`${e} is not positive.`),_e.set({precision:e+1,rounding:Yr[r]});let i=new _e(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(e);return i.toFormat(i.decimalPlaces(),n)}toFixed(e,n={groupSeparator:""},r=1){return Number.isInteger(e)||nt.logWithError(`${e} is not an integer.`),e<0&&nt.logWithError(`${e} is negative.`),Et.DP=e,Et.RM=Jr[r]||1,new Et(this.numerator.toString()).div(this.denominator.toString()).toFormat(e,n)}isZero(){return this.numerator.isZero()}};import $r from"bn.js";var jo=new q(new $r(100));var Jo=Z("Raydium_price");function Lt(t,e=1,n=[]){let r=[...t];if(e<=0)return n;for(;r.length;)n.push(r.splice(0,e));return n}import{PublicKey as Ms}from"@solana/web3.js";import{TOKEN_PROGRAM_ID as Es}from"@solana/spl-token";import{ComputeBudgetProgram as Sn,Keypair as Ln,PublicKey as Ts,Transaction as kn,TransactionMessage as ei,VersionedTransaction as Cn}from"@solana/web3.js";var X={CreateAccount:"CreateAccount",InitAccount:"InitAccount",CreateATA:"CreateATA",CloseAccount:"CloseAccount",TransferAmount:"TransferAmount",InitMint:"InitMint",MintTo:"MintTo",InitMarket:"InitMarket",Util1216OwnerClaim:"Util1216OwnerClaim",SetComputeUnitPrice:"SetComputeUnitPrice",SetComputeUnitLimit:"SetComputeUnitLimit",ClmmCreatePool:"ClmmCreatePool",ClmmOpenPosition:"ClmmOpenPosition",ClmmIncreasePosition:"ClmmIncreasePosition",ClmmDecreasePosition:"ClmmDecreasePosition",ClmmClosePosition:"ClmmClosePosition",ClmmSwapBaseIn:"ClmmSwapBaseIn",ClmmSwapBaseOut:"ClmmSwapBaseOut",ClmmInitReward:"ClmmInitReward",ClmmSetReward:"ClmmSetReward",ClmmCollectReward:"ClmmCollectReward",ClmmLockPosition:"ClmmLockPosition",ClmmHarvestLockPosition:"ClmmHarvestLockPosition",AmmV4Swap:"AmmV4Swap",AmmV4AddLiquidity:"AmmV4AddLiquidity",AmmV4RemoveLiquidity:"AmmV4RemoveLiquidity",AmmV4SimulatePoolInfo:"AmmV4SimulatePoolInfo",AmmV4SwapBaseIn:"AmmV4SwapBaseIn",AmmV4SwapBaseOut:"AmmV4SwapBaseOut",AmmV4CreatePool:"AmmV4CreatePool",AmmV4InitPool:"AmmV4InitPool",AmmV5AddLiquidity:"AmmV5AddLiquidity",AmmV5RemoveLiquidity:"AmmV5RemoveLiquidity",AmmV5SimulatePoolInfo:"AmmV5SimulatePoolInfo",AmmV5SwapBaseIn:"AmmV5SwapBaseIn",AmmV5SwapBaseOut:"AmmV5SwapBaseOut",RouteSwap:"RouteSwap",RouteSwap1:"RouteSwap1",RouteSwap2:"RouteSwap2",FarmV3Deposit:"FarmV3Deposit",FarmV3Withdraw:"FarmV3Withdraw",FarmV3CreateLedger:"FarmV3CreateLedger",FarmV4Withdraw:"FarmV4Withdraw",FarmV5Deposit:"FarmV5Deposit",FarmV5Withdraw:"FarmV5Withdraw",FarmV5CreateLedger:"FarmV5CreateLedger",FarmV6Deposit:"FarmV6Deposit",FarmV6Withdraw:"FarmV6Withdraw",FarmV6Create:"FarmV6Create",FarmV6Restart:"FarmV6Restart",FarmV6CreatorAddReward:"FarmV6CreatorAddReward",FarmV6CreatorWithdraw:"FarmV6CreatorWithdraw",CpmmCreatePool:"CpmmCreatePool",CpmmAddLiquidity:"CpmmAddLiquidity",CpmmWithdrawLiquidity:"CpmmWithdrawLiquidity",CpmmSwapBaseIn:"CpmmSwapBaseIn",CpmmSwapBaseOut:"CpmmSwapBaseOut",CpmmLockLp:"CpmmLockLp",CpmmCollectLockFee:"CpmmCollectLockFee",TransferTip:"TransferTip"};import{TOKEN_PROGRAM_ID as ti}from"@solana/spl-token";var Bn=Z("Raydium_txUtil"),Nn=1644;function ot(t){let e=[],n=[];return t.microLamports&&(e.push(Sn.setComputeUnitPrice({microLamports:t.microLamports})),n.push(X.SetComputeUnitPrice)),t.units&&(e.push(Sn.setComputeUnitLimit({units:t.units})),n.push(X.SetComputeUnitLimit)),{instructions:e,instructionTypes:n}}async function we(t,e){var r,i;let n=e!=null?e:"confirmed";return(i=await((r=t.getLatestBlockhash)==null?void 0:r.call(t,{commitment:n})))==null?void 0:i.blockhash}async function st(t,e){return t.getSignatureStatuses([e]),new Promise((n,r)=>{let i=setTimeout(r,6e4);t.onSignature(e,o=>{if(clearTimeout(i),!o.err){n("");return}r(Object.assign(o.err,{txId:e}))},"confirmed")})}function ni(t,e){t.length<1&&Bn.logWithError(`no instructions provided: ${t.toString()}`),e.length<1&&Bn.logWithError(`no signers provided:, ${e.toString()}`);let n=new kn;n.recentBlockhash="11111111111111111111111111111111",n.feePayer=e[0],n.add(...t);try{return Buffer.from(n.serialize({verifySignatures:!1})).toString("base64").length<Nn}catch{return!1}}function Oe({instructions:t,payer:e,signers:n}){return ni(t,[e,...n])}function Fe({instructions:t,payer:e,lookupTableAddressAccount:n,recentBlockhash:r=Ln.generate().publicKey.toString()}){let o=new ei({payerKey:e,recentBlockhash:r,instructions:t}).compileToV0Message(Object.values(n!=null?n:{}));try{return Buffer.from(new Cn(o).serialize()).toString("base64").length<Nn}catch{return!1}}var ri=t=>Buffer.isBuffer(t)?t:t instanceof Uint8Array?Buffer.from(t.buffer,t.byteOffset,t.byteLength):Buffer.from(t),ii=t=>{let e=t.serialize({requireAllSignatures:!1,verifySignatures:!1});t instanceof Cn&&(e=ri(e));try{return e instanceof Buffer?e.toString("base64"):Buffer.from(e).toString("base64")}catch{return e.toString("base64")}};function xe(t){let e=[];return t.forEach(n=>{n instanceof kn&&(n.recentBlockhash||(n.recentBlockhash=ti.toBase58()),n.feePayer||(n.feePayer=Ln.generate().publicKey)),e.push(ii(n))}),console.log("simulate tx string:",e),e}import{PublicKey as B}from"@solana/web3.js";var Ks=new B("EhhTKczWMGQt46ynNeRX1WfeagwwJd7ufHvCDjRxjo5Q"),_s=new B("CBuCnLe26faBpcBP2fktp4rp8abpcAnTWft6ZrP5Q4T"),Os=new B("9KEPoZmtHUrBbhWN1v1KWLMkkvwY6WLtAVUCPRtRjP4z"),Fs=new B("FarmqiPv5eAj3j1GMdMCMUGXqPUvmquZtMy86QH6rzhG"),Vs=new B("CLaimxFqjHzgTJtAGHU47NPhg6qrc5sCnpC4tBLyABQS"),qs=new B("srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX"),Us=new B("9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin"),Ws=new B("675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8"),Gs=new B("5quBtoiQqxF9Jv6KYKctB59NT3gtJD2Y65kdnB1Uev3h"),Hs=new B("CDSr3ssLcRB6XYPJwAfFt18MZvEZp4LjHcvzBVZ45duo"),js=new B("CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK"),zs=new B("LockrWmn6K5twhz3y9w1dQERbmgSaRkfnTeTKbpofwE"),Qs=new B("kN1kEznaF5Xbd8LYuqtEFcxzWSBk5Fv6ygX6SqEGJVy"),Zs=new B("CDSr3ssLcRB6XYPJwAfFt18MZvEZp4LjHcvzBVZ45duo"),Xs=new B("routeUGWgWzqBWFcrCfv8tritsqukccJPu3q5GPP3xS"),Ys=new B("7YttLkHDoNj9wyDur5pM1ejNaAvT9X4eqaYcHQqtj2G5"),Js=new B("6FJon3QE27qgPVggARueB22hLvoh22VzJpXv4rBEoSLF"),$s=new B("CC12se5To1CdEuw7fDS27B7Geo5jJyL7t5UK2B44NgiH"),ea=new B("9HzJyW1qZsEiSfMUf6L2jo3CcTKAyBmSyKdwQeYisHrC"),ta=new B("DropEU8AvevN3UrXWXTMuz3rqnMczQVNjq3kcSdW2SQi"),na=new B("CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C"),ra=new B("GpMZbSM2GgvTKHJirzeGfMFoaZ8UR2X7F4v8vHTvxFbL"),ia=new B("DNXgeM9EiiaAbaWvwjHj9fQQLAX5ZsfHyvmYUNRAdNC8"),oa=new B("LockrWmn6K5twhz3y9w1dQERbmgSaRkfnTeTKbpofwE"),sa=new B("3f7GcQFG397GAaEnv51zR6tsTVihYRydnydDD1cXekxH"),aa=new B("LanMV9sAd7wArD4vJFi2qDdfnVhFxYSUg6eADduJ3uj"),ua=new B("WLHv2UAZm6z4KyaaELi5pjdbJh6RESMva1Rnn8pJVVh"),ca=new B("4Bu96XjU84XjPDSpveTVf6LYGCkfW5FK7SNkREWcEfV4"),la=new B("6s1xP3hpbAfFoNtUNF8mfHsjr2Bd97JxFJRWLbL6aHuX");var fa={OPEN_BOOK_PROGRAM:new B("EoTcMgcDRTJVZDMZWBoU6rhYHZfkNTVEAfz3uUJRcYGj"),SERUM_PROGRAM_ID_V3:new B("Ray1111111111111111111111111111111111111111"),AMM_V4:new B("DRaya7Kj3aMWQSy19kSjvmuwq9docCHofyP9kanQGaav"),AMM_STABLE:new B("DRayDdXc1NZQ9C3hRWmoSf8zK4iapgMnjdNZWrfwsP8m"),CLMM_PROGRAM_ID:new B("DRayAUgENGQBKVaX8owNhgzkEDyoHTGVEGHVJT1E9pfH"),CLMM_LOCK_PROGRAM_ID:new B("DRay25Usp3YJAi7beckgpGUC7mGJ2cR1AVPxhYfwVCUX"),CLMM_LOCK_AUTH_ID:new B("6Aoh8h2Lw2m5UGxYR8AdAL87jTWYeKoxM52mJRzfYwN"),CREATE_CPMM_POOL_PROGRAM:new B("DRaycpLY18LhpbydsBWbVJtxpNv9oXPgjRSfpF2bWpYb"),CREATE_CPMM_POOL_AUTH:new B("CXniRufdq5xL8t8jZAPxsPZDpuudwuJSPWnbcD5Y5Nxq"),CREATE_CPMM_POOL_FEE_ACC:new B("3oE58BKVt8KuYkGxx8zBojugnymWmBiyafWgMrnb6eYy"),LOCK_CPMM_PROGRAM:new B("DRay25Usp3YJAi7beckgpGUC7mGJ2cR1AVPxhYfwVCUX"),LOCK_CPMM_AUTH:new B("7qWVV8UY2bRJfDLP4s37YzBPKUkVB46DStYJBpYbQzu3"),UTIL1216:B.default,Router:new B("DRaybByLpbUL57LJARs3j8BitTxVfzBg351EaMr5UTCd"),FARM_PROGRAM_ID_V3:new B("DRayWyrLmEW5KEeqs8kdTMMaBabapqagaBC7KWpGtJeZ"),FARM_PROGRAM_ID_V4:new B("Ray1111111111111111111111111111111111111111"),FARM_PROGRAM_ID_V5:new B("DRayiCGSZgku1GTK6rXD6mVDdingXy6APAH1R6R5L2LC"),FARM_PROGRAM_ID_V6:new B("DRayzbYakXs45ELHkzH6vC3fuhQqTAnv5A68gdFuvZyZ"),LAUNCHPAD_PROGRAM:new B("DRay6fNdQ5J82H7xV6uq2aV3mNrUZ1J4PgSKsWgptcm6"),LAUNCHPAD_AUTH:new B("5xqNaZXX5eUi4p5HU4oz9i5QnwRNT2y6oN7yyn4qENeq"),LAUNCHPAD_PLATFORM:new B("2Jx4KTDrVSdWNazuGpcA8n3ZLTRGGBDxAWhuKe2Xcj2a"),LAUNCHPAD_CONFIG:new B("7ZR4zD7PYfY2XxoG1Gxcy2EgEeGYrpxrwzPuwdUBssEt"),FEE_DESTINATION_ID:new B("9y8ENuuZ3b19quffx9hQvRVygG5ky6snHfRvGpuSfeJy"),MODEL_DATA_PUBKEY:new B("Ray1111111111111111111111111111111111111111")};import ma from"bn.js";import{PublicKey as Dt,AddressLookupTableAccount as Le}from"@solana/web3.js";async function at({connection:t,address:e,cluster:n="mainnet"}){let r=await mn(t,[...new Set(e.map(o=>o.toString()))].map(o=>new Dt(o))),i={};for(let o=0;o<e.length;o++){let s=r[o],a=e[o];if(!s)continue;let c=new Le({key:a,state:Le.deserialize(s.data)});i[a.toString()]=c,n==="devnet"?Be[a.toString()]=c:Ve[a.toString()]=c}return i}var Ve={AcL1Vo8oy1ULiavEcjSUcwfBSForXMudcZvDZy5nzJkU:new Le({key:new Dt("AcL1Vo8oy1ULiavEcjSUcwfBSForXMudcZvDZy5nzJkU"),state:Le.deserialize(Buffer.from("AQAAAP//////////I1rcEwAAAAAvAQYwun9CU6c5Ikm2pAj+D9IEnCOR45nK+SFTGSdpd6J6AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAbd9uHXZaGT2cvhRs7reawctIXtX1s3kTqM9YV+/wCpBt324e51j94YQl285GzN2rYa/E2DuQ0n/r35KNihi/wFSlNQ+F3IgtYUpVZyeIopbd8eq6vQpgZ4iEky9O72oAVKU1qZKSEGTSTocWDaOHx8NbXdvJK7geQfqEBBBUSNBqfVFxksXFEhjMlMPUrxf1ja7gibof1E49vZigAAAAAGp9UXGMd0yShWY5hpHV62i164o5tLbVxzVVshAAAAAIyXJY9OJInxuz0QKRSODYMLWhOZ2v8QhASOe9jb6fhZC3BlsePRfEU4nVJ/awTDzVi4bHMaoP21SbbRvAP4KUbIScv+6Yw2LHF/6K0ZjUPibbSWXCirYPGuuVl7zT789IUPLW4CpHr4JNCatp3ELXDLKMv6JJ+37le50lbBJ2LvBkX2T9y7AHdNGviJAqQNtlDUDCnauQRWybsLji6nPM8Qkw5asQRvCdB3MbX6IEBwytOrpM32l4jQygKG9TKgR0vZScQ2AsM/IHeQ7RajUkyhuZdc8SGiqQz/7H34torNR/Wir3sl0ruUrVxJWEZfUg+QLNAxxODdBi53/OP7Ioil1cqeBM9dtZC3FLov4yyxWRM/wcGStyJX/QfTnLBAHqkqWotPKVlShCVQqpP9W5W1rOao65IMk5QuQ2kMIOxzDMKAy2vjGSxQODgBz0QwGA+eP4ZjIjrIAQaXENv31QfLlOdXSRCkaybRniDHF4C8YcwhcvsqrOVuTP4B2Na+9wLdtrB31uz2rtlFI5kahdsnp/d1SrASDInYCtTYtdoke4kX+hoKWcEWM4Tle8pTUkUVv4BxS6fje/EzKBE4Qu/YsA/yfEEFGcr8Z57VKDw8uQzpiru7g4lvjnfapW62W030syevD8k07SGoxUHiuT/ai7gAHWWhDsVmg/C63ajgpkH7Sn3GdutAr