@raydium-io/raydium-sdk-v2
Version:
An SDK for building applications on top of Raydium.
1 lines • 197 kB
JavaScript
var Fr=Object.create;var Wt=Object.defineProperty,_r=Object.defineProperties,vr=Object.getOwnPropertyDescriptor,Dr=Object.getOwnPropertyDescriptors,Wr=Object.getOwnPropertyNames,ln=Object.getOwnPropertySymbols,qr=Object.getPrototypeOf,Fn=Object.prototype.hasOwnProperty,xi=Object.prototype.propertyIsEnumerable;var Ai=(i,e,t)=>e in i?Wt(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,D=(i,e)=>{for(var t in e||(e={}))Fn.call(e,t)&&Ai(i,t,e[t]);if(ln)for(var t of ln(e))xi.call(e,t)&&Ai(i,t,e[t]);return i},Y=(i,e)=>_r(i,Dr(e));var Ct=(i,e)=>{var t={};for(var n in i)Fn.call(i,n)&&e.indexOf(n)<0&&(t[n]=i[n]);if(i!=null&&ln)for(var n of ln(i))e.indexOf(n)<0&&xi.call(i,n)&&(t[n]=i[n]);return t};var Vr=(i,e)=>{for(var t in e)Wt(i,t,{get:e[t],enumerable:!0})},Bi=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Wr(e))!Fn.call(i,r)&&r!==t&&Wt(i,r,{get:()=>e[r],enumerable:!(n=vr(e,r))||n.enumerable});return i};var we=(i,e,t)=>(t=i!=null?Fr(qr(i)):{},Bi(e||!i||!i.__esModule?Wt(t,"default",{value:i,enumerable:!0}):t,i)),Ur=i=>Bi(Wt({},"__esModule",{value:!0}),i);var bs={};Vr(bs,{Clmm:()=>ki});module.exports=Ur(bs);var L=require("@solana/web3.js"),Ee=we(require("bn.js"));var Kt=9e15,bt=1e9,_n="0123456789abcdef",fn="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",pn="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",vn={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Kt,maxE:Kt,crypto:!1},Ki,at,z=!0,bn="[DecimalError] ",gt=bn+"Invalid argument: ",Ni=bn+"Precision limit exceeded",Li=bn+"crypto unavailable",Ri="[object Decimal]",Le=Math.floor,Te=Math.pow,Gr=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Xr=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Hr=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,Mi=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,je=1e7,G=7,zr=9007199254740991,Zr=fn.length-1,Dn=pn.length-1,S={toStringTag:Ri};S.absoluteValue=S.abs=function(){var i=new this.constructor(this);return i.s<0&&(i.s=1),W(i)};S.ceil=function(){return W(new this.constructor(this),this.e+1,2)};S.clampedTo=S.clamp=function(i,e){var t,n=this,r=n.constructor;if(i=new r(i),e=new r(e),!i.s||!e.s)return new r(NaN);if(i.gt(e))throw Error(gt+e);return t=n.cmp(i),t<0?i:n.cmp(e)>0?e:new r(n)};S.comparedTo=S.cmp=function(i){var e,t,n,r,o=this,s=o.d,a=(i=new o.constructor(i)).d,c=o.s,u=i.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!==i.e)return o.e>i.e^c<0?1:-1;for(n=s.length,r=a.length,e=0,t=n<r?n:r;e<t;++e)if(s[e]!==a[e])return s[e]>a[e]^c<0?1:-1;return n===r?0:n>r^c<0?1:-1};S.cosine=S.cos=function(){var i,e,t=this,n=t.constructor;return t.d?t.d[0]?(i=n.precision,e=n.rounding,n.precision=i+Math.max(t.e,t.sd())+G,n.rounding=1,t=jr(n,vi(n,t)),n.precision=i,n.rounding=e,W(at==2||at==3?t.neg():t,i,e,!0)):new n(1):new n(NaN)};S.cubeRoot=S.cbrt=function(){var i,e,t,n,r,o,s,a,c,u,l=this,d=l.constructor;if(!l.isFinite()||l.isZero())return new d(l);for(z=!1,o=l.s*Te(l.s*l,1/3),!o||Math.abs(o)==1/0?(t=Ie(l.d),i=l.e,(o=(i-t.length+1)%3)&&(t+=o==1||o==-2?"0":"00"),o=Te(t,1/3),i=Le((i+1)/3)-(i%3==(i<0?-1:2)),o==1/0?t="5e"+i:(t=o.toExponential(),t=t.slice(0,t.indexOf("e")+1)+i),n=new d(t),n.s=l.s):n=new d(o.toString()),s=(i=d.precision)+3;;)if(a=n,c=a.times(a).times(a),u=c.plus(l),n=ae(u.plus(l).times(a),u.plus(c),s+2,1),Ie(a.d).slice(0,s)===(t=Ie(n.d)).slice(0,s))if(t=t.slice(s-3,s+1),t=="9999"||!r&&t=="4999"){if(!r&&(W(a,i+1,0),a.times(a).times(a).eq(l))){n=a;break}s+=4,r=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(W(n,i+1,1),e=!n.times(n).times(n).eq(l));break}return z=!0,W(n,i,d.rounding,e)};S.decimalPlaces=S.dp=function(){var i,e=this.d,t=NaN;if(e){if(i=e.length-1,t=(i-Le(this.e/G))*G,i=e[i],i)for(;i%10==0;i/=10)t--;t<0&&(t=0)}return t};S.dividedBy=S.div=function(i){return ae(this,new this.constructor(i))};S.dividedToIntegerBy=S.divToInt=function(i){var e=this,t=e.constructor;return W(ae(e,new t(i),0,1,1),t.precision,t.rounding)};S.equals=S.eq=function(i){return this.cmp(i)===0};S.floor=function(){return W(new this.constructor(this),this.e+1,3)};S.greaterThan=S.gt=function(i){return this.cmp(i)>0};S.greaterThanOrEqualTo=S.gte=function(i){var e=this.cmp(i);return e==1||e===0};S.hyperbolicCosine=S.cosh=function(){var i,e,t,n,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;t=s.precision,n=s.rounding,s.precision=t+Math.max(o.e,o.sd())+4,s.rounding=1,r=o.d.length,r<32?(i=Math.ceil(r/3),e=(1/wn(4,i)).toString()):(i=16,e="2.3283064365386962890625e-10"),o=Nt(s,1,o.times(e),new s(1),!0);for(var c,u=i,l=new s(8);u--;)c=o.times(o),o=a.minus(c.times(l.minus(c.times(l))));return W(o,s.precision=t,s.rounding=n,!0)};S.hyperbolicSine=S.sinh=function(){var i,e,t,n,r=this,o=r.constructor;if(!r.isFinite()||r.isZero())return new o(r);if(e=o.precision,t=o.rounding,o.precision=e+Math.max(r.e,r.sd())+4,o.rounding=1,n=r.d.length,n<3)r=Nt(o,2,r,r,!0);else{i=1.4*Math.sqrt(n),i=i>16?16:i|0,r=r.times(1/wn(5,i)),r=Nt(o,2,r,r,!0);for(var s,a=new o(5),c=new o(16),u=new o(20);i--;)s=r.times(r),r=r.times(a.plus(s.times(c.times(s).plus(u))))}return o.precision=e,o.rounding=t,W(r,e,t,!0)};S.hyperbolicTangent=S.tanh=function(){var i,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(i=n.precision,e=n.rounding,n.precision=i+7,n.rounding=1,ae(t.sinh(),t.cosh(),n.precision=i,n.rounding=e)):new n(t.s)};S.inverseCosine=S.acos=function(){var i=this,e=i.constructor,t=i.abs().cmp(1),n=e.precision,r=e.rounding;return t!==-1?t===0?i.isNeg()?et(e,n,r):new e(0):new e(NaN):i.isZero()?et(e,n+4,r).times(.5):(e.precision=n+6,e.rounding=1,i=new e(1).minus(i).div(i.plus(1)).sqrt().atan(),e.precision=n,e.rounding=r,i.times(2))};S.inverseHyperbolicCosine=S.acosh=function(){var i,e,t=this,n=t.constructor;return t.lte(1)?new n(t.eq(1)?0:NaN):t.isFinite()?(i=n.precision,e=n.rounding,n.precision=i+Math.max(Math.abs(t.e),t.sd())+4,n.rounding=1,z=!1,t=t.times(t).minus(1).sqrt().plus(t),z=!0,n.precision=i,n.rounding=e,t.ln()):new n(t)};S.inverseHyperbolicSine=S.asinh=function(){var i,e,t=this,n=t.constructor;return!t.isFinite()||t.isZero()?new n(t):(i=n.precision,e=n.rounding,n.precision=i+2*Math.max(Math.abs(t.e),t.sd())+6,n.rounding=1,z=!1,t=t.times(t).plus(1).sqrt().plus(t),z=!0,n.precision=i,n.rounding=e,t.ln())};S.inverseHyperbolicTangent=S.atanh=function(){var i,e,t,n,r=this,o=r.constructor;return r.isFinite()?r.e>=0?new o(r.abs().eq(1)?r.s/0:r.isZero()?r:NaN):(i=o.precision,e=o.rounding,n=r.sd(),Math.max(n,i)<2*-r.e-1?W(new o(r),i,e,!0):(o.precision=t=n-r.e,r=ae(r.plus(1),new o(1).minus(r),t+i,1),o.precision=i+4,o.rounding=1,r=r.ln(),o.precision=i,o.rounding=e,r.times(.5))):new o(NaN)};S.inverseSine=S.asin=function(){var i,e,t,n,r=this,o=r.constructor;return r.isZero()?new o(r):(e=r.abs().cmp(1),t=o.precision,n=o.rounding,e!==-1?e===0?(i=et(o,t+4,n).times(.5),i.s=r.s,i):new o(NaN):(o.precision=t+6,o.rounding=1,r=r.div(new o(1).minus(r.times(r)).sqrt().plus(1)).atan(),o.precision=t,o.rounding=n,r.times(2)))};S.inverseTangent=S.atan=function(){var i,e,t,n,r,o,s,a,c,u=this,l=u.constructor,d=l.precision,f=l.rounding;if(u.isFinite()){if(u.isZero())return new l(u);if(u.abs().eq(1)&&d+4<=Dn)return s=et(l,d+4,f).times(.25),s.s=u.s,s}else{if(!u.s)return new l(NaN);if(d+4<=Dn)return s=et(l,d+4,f).times(.5),s.s=u.s,s}for(l.precision=a=d+10,l.rounding=1,t=Math.min(28,a/G+2|0),i=t;i;--i)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(z=!1,e=Math.ceil(a/G),n=1,c=u.times(u),s=new l(u),r=u;i!==-1;)if(r=r.times(c),o=s.minus(r.div(n+=2)),r=r.times(c),s=o.plus(r.div(n+=2)),s.d[e]!==void 0)for(i=e;s.d[i]===o.d[i]&&i--;);return t&&(s=s.times(2<<t-1)),z=!0,W(s,l.precision=d,l.rounding=f,!0)};S.isFinite=function(){return!!this.d};S.isInteger=S.isInt=function(){return!!this.d&&Le(this.e/G)>this.d.length-2};S.isNaN=function(){return!this.s};S.isNegative=S.isNeg=function(){return this.s<0};S.isPositive=S.isPos=function(){return this.s>0};S.isZero=function(){return!!this.d&&this.d[0]===0};S.lessThan=S.lt=function(i){return this.cmp(i)<0};S.lessThanOrEqualTo=S.lte=function(i){return this.cmp(i)<1};S.logarithm=S.log=function(i){var e,t,n,r,o,s,a,c,u=this,l=u.constructor,d=l.precision,f=l.rounding,m=5;if(i==null)i=new l(10),e=!0;else{if(i=new l(i),t=i.d,i.s<0||!t||!t[0]||i.eq(1))return new l(NaN);e=i.eq(10)}if(t=u.d,u.s<0||!t||!t[0]||u.eq(1))return new l(t&&!t[0]?-1/0:u.s!=1?NaN:t?0:1/0);if(e)if(t.length>1)o=!0;else{for(r=t[0];r%10===0;)r/=10;o=r!==1}if(z=!1,a=d+m,s=pt(u,a),n=e?gn(l,a+10):pt(i,a),c=ae(s,n,a,1),qt(c.d,r=d,f))do if(a+=10,s=pt(u,a),n=e?gn(l,a+10):pt(i,a),c=ae(s,n,a,1),!o){+Ie(c.d).slice(r+1,r+15)+1==1e14&&(c=W(c,d+1,0));break}while(qt(c.d,r+=10,f));return z=!0,W(c,d,f)};S.minus=S.sub=function(i){var e,t,n,r,o,s,a,c,u,l,d,f,m=this,g=m.constructor;if(i=new g(i),!m.d||!i.d)return!m.s||!i.s?i=new g(NaN):m.d?i.s=-i.s:i=new g(i.d||m.s!==i.s?m:NaN),i;if(m.s!=i.s)return i.s=-i.s,m.plus(i);if(u=m.d,f=i.d,a=g.precision,c=g.rounding,!u[0]||!f[0]){if(f[0])i.s=-i.s;else if(u[0])i=new g(m);else return new g(c===3?-0:0);return z?W(i,a,c):i}if(t=Le(i.e/G),l=Le(m.e/G),u=u.slice(),o=l-t,o){for(d=o<0,d?(e=u,o=-o,s=f.length):(e=f,t=l,s=u.length),n=Math.max(Math.ceil(a/G),s)+2,o>n&&(o=n,e.length=1),e.reverse(),n=o;n--;)e.push(0);e.reverse()}else{for(n=u.length,s=f.length,d=n<s,d&&(s=n),n=0;n<s;n++)if(u[n]!=f[n]){d=u[n]<f[n];break}o=0}for(d&&(e=u,u=f,f=e,i.s=-i.s),s=u.length,n=f.length-s;n>0;--n)u[s++]=0;for(n=f.length;n>o;){if(u[--n]<f[n]){for(r=n;r&&u[--r]===0;)u[r]=je-1;--u[r],u[n]+=je}u[n]-=f[n]}for(;u[--s]===0;)u.pop();for(;u[0]===0;u.shift())--t;return u[0]?(i.d=u,i.e=yn(u,t),z?W(i,a,c):i):new g(c===3?-0:0)};S.modulo=S.mod=function(i){var e,t=this,n=t.constructor;return i=new n(i),!t.d||!i.s||i.d&&!i.d[0]?new n(NaN):!i.d||t.d&&!t.d[0]?W(new n(t),n.precision,n.rounding):(z=!1,n.modulo==9?(e=ae(t,i.abs(),0,3,1),e.s*=i.s):e=ae(t,i,0,n.modulo,1),e=e.times(i),z=!0,t.minus(e))};S.naturalExponential=S.exp=function(){return Wn(this)};S.naturalLogarithm=S.ln=function(){return pt(this)};S.negated=S.neg=function(){var i=new this.constructor(this);return i.s=-i.s,W(i)};S.plus=S.add=function(i){var e,t,n,r,o,s,a,c,u,l,d=this,f=d.constructor;if(i=new f(i),!d.d||!i.d)return!d.s||!i.s?i=new f(NaN):d.d||(i=new f(i.d||d.s===i.s?d:NaN)),i;if(d.s!=i.s)return i.s=-i.s,d.minus(i);if(u=d.d,l=i.d,a=f.precision,c=f.rounding,!u[0]||!l[0])return l[0]||(i=new f(d)),z?W(i,a,c):i;if(o=Le(d.e/G),n=Le(i.e/G),u=u.slice(),r=o-n,r){for(r<0?(t=u,r=-r,s=l.length):(t=l,n=o,s=u.length),o=Math.ceil(a/G),s=o>s?o+1:s+1,r>s&&(r=s,t.length=1),t.reverse();r--;)t.push(0);t.reverse()}for(s=u.length,r=l.length,s-r<0&&(r=s,t=l,l=u,u=t),e=0;r;)e=(u[--r]=u[r]+l[r]+e)/je|0,u[r]%=je;for(e&&(u.unshift(e),++n),s=u.length;u[--s]==0;)u.pop();return i.d=u,i.e=yn(u,n),z?W(i,a,c):i};S.precision=S.sd=function(i){var e,t=this;if(i!==void 0&&i!==!!i&&i!==1&&i!==0)throw Error(gt+i);return t.d?(e=Oi(t.d),i&&t.e+1>e&&(e=t.e+1)):e=NaN,e};S.round=function(){var i=this,e=i.constructor;return W(new e(i),i.e+1,e.rounding)};S.sine=S.sin=function(){var i,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(i=n.precision,e=n.rounding,n.precision=i+Math.max(t.e,t.sd())+G,n.rounding=1,t=Jr(n,vi(n,t)),n.precision=i,n.rounding=e,W(at>2?t.neg():t,i,e,!0)):new n(NaN)};S.squareRoot=S.sqrt=function(){var i,e,t,n,r,o,s=this,a=s.d,c=s.e,u=s.s,l=s.constructor;if(u!==1||!a||!a[0])return new l(!u||u<0&&(!a||a[0])?NaN:a?s:1/0);for(z=!1,u=Math.sqrt(+s),u==0||u==1/0?(e=Ie(a),(e.length+c)%2==0&&(e+="0"),u=Math.sqrt(e),c=Le((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),n=new l(e)):n=new l(u.toString()),t=(c=l.precision)+3;;)if(o=n,n=o.plus(ae(s,o,t+2,1)).times(.5),Ie(o.d).slice(0,t)===(e=Ie(n.d)).slice(0,t))if(e=e.slice(t-3,t+1),e=="9999"||!r&&e=="4999"){if(!r&&(W(o,c+1,0),o.times(o).eq(s))){n=o;break}t+=4,r=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(W(n,c+1,1),i=!n.times(n).eq(s));break}return z=!0,W(n,c,l.rounding,i)};S.tangent=S.tan=function(){var i,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(i=n.precision,e=n.rounding,n.precision=i+10,n.rounding=1,t=t.sin(),t.s=1,t=ae(t,new n(1).minus(t.times(t)).sqrt(),i+10,0),n.precision=i,n.rounding=e,W(at==2||at==4?t.neg():t,i,e,!0)):new n(NaN)};S.times=S.mul=function(i){var e,t,n,r,o,s,a,c,u,l=this,d=l.constructor,f=l.d,m=(i=new d(i)).d;if(i.s*=l.s,!f||!f[0]||!m||!m[0])return new d(!i.s||f&&!f[0]&&!m||m&&!m[0]&&!f?NaN:!f||!m?i.s/0:i.s*0);for(t=Le(l.e/G)+Le(i.e/G),c=f.length,u=m.length,c<u&&(o=f,f=m,m=o,s=c,c=u,u=s),o=[],s=c+u,n=s;n--;)o.push(0);for(n=u;--n>=0;){for(e=0,r=c+n;r>n;)a=o[r]+m[n]*f[r-n-1]+e,o[r--]=a%je|0,e=a/je|0;o[r]=(o[r]+e)%je|0}for(;!o[--s];)o.pop();return e?++t:o.shift(),i.d=o,i.e=yn(o,t),z?W(i,d.precision,d.rounding):i};S.toBinary=function(i,e){return qn(this,2,i,e)};S.toDecimalPlaces=S.toDP=function(i,e){var t=this,n=t.constructor;return t=new n(t),i===void 0?t:(We(i,0,bt),e===void 0?e=n.rounding:We(e,0,8),W(t,i+t.e+1,e))};S.toExponential=function(i,e){var t,n=this,r=n.constructor;return i===void 0?t=tt(n,!0):(We(i,0,bt),e===void 0?e=r.rounding:We(e,0,8),n=W(new r(n),i+1,e),t=tt(n,!0,i+1)),n.isNeg()&&!n.isZero()?"-"+t:t};S.toFixed=function(i,e){var t,n,r=this,o=r.constructor;return i===void 0?t=tt(r):(We(i,0,bt),e===void 0?e=o.rounding:We(e,0,8),n=W(new o(r),i+r.e+1,e),t=tt(n,!1,i+n.e+1)),r.isNeg()&&!r.isZero()?"-"+t:t};S.toFraction=function(i){var e,t,n,r,o,s,a,c,u,l,d,f,m=this,g=m.d,p=m.constructor;if(!g)return new p(m);if(u=t=new p(1),n=c=new p(0),e=new p(n),o=e.e=Oi(g)-m.e-1,s=o%G,e.d[0]=Te(10,s<0?G+s:s),i==null)i=o>0?e:u;else{if(a=new p(i),!a.isInt()||a.lt(u))throw Error(gt+a);i=a.gt(e)?o>0?e:u:a}for(z=!1,a=new p(Ie(g)),l=p.precision,p.precision=o=g.length*G*2;d=ae(a,e,0,1,1),r=t.plus(d.times(n)),r.cmp(i)!=1;)t=n,n=r,r=u,u=c.plus(d.times(r)),c=r,r=e,e=a.minus(d.times(r)),a=r;return r=ae(i.minus(t),n,0,1,1),c=c.plus(r.times(u)),t=t.plus(r.times(n)),c.s=u.s=m.s,f=ae(u,n,o,1).minus(m).abs().cmp(ae(c,t,o,1).minus(m).abs())<1?[u,n]:[c,t],p.precision=l,z=!0,f};S.toHexadecimal=S.toHex=function(i,e){return qn(this,16,i,e)};S.toNearest=function(i,e){var t=this,n=t.constructor;if(t=new n(t),i==null){if(!t.d)return t;i=new n(1),e=n.rounding}else{if(i=new n(i),e===void 0?e=n.rounding:We(e,0,8),!t.d)return i.s?t:i;if(!i.d)return i.s&&(i.s=t.s),i}return i.d[0]?(z=!1,t=ae(t,i,0,e,1).times(i),z=!0,W(t)):(i.s=t.s,t=i),t};S.toNumber=function(){return+this};S.toOctal=function(i,e){return qn(this,8,i,e)};S.toPower=S.pow=function(i){var e,t,n,r,o,s,a=this,c=a.constructor,u=+(i=new c(i));if(!a.d||!i.d||!a.d[0]||!i.d[0])return new c(Te(+a,u));if(a=new c(a),a.eq(1))return a;if(n=c.precision,o=c.rounding,i.eq(1))return W(a,n,o);if(e=Le(i.e/G),e>=i.d.length-1&&(t=u<0?-u:u)<=zr)return r=Ei(c,a,t,n),i.s<0?new c(1).div(r):W(r,n,o);if(s=a.s,s<0){if(e<i.d.length-1)return new c(NaN);if((i.d[e]&1)==0&&(s=1),a.e==0&&a.d[0]==1&&a.d.length==1)return a.s=s,a}return t=Te(+a,u),e=t==0||!isFinite(t)?Le(u*(Math.log("0."+Ie(a.d))/Math.LN10+a.e+1)):new c(t+"").e,e>c.maxE+1||e<c.minE-1?new c(e>0?s/0:0):(z=!1,c.rounding=a.s=1,t=Math.min(12,(e+"").length),r=Wn(i.times(pt(a,n+t)),n),r.d&&(r=W(r,n+5,1),qt(r.d,n,o)&&(e=n+10,r=W(Wn(i.times(pt(a,e+t)),e),e+5,1),+Ie(r.d).slice(n+1,n+15)+1==1e14&&(r=W(r,n+1,0)))),r.s=s,z=!0,c.rounding=o,W(r,n,o))};S.toPrecision=function(i,e){var t,n=this,r=n.constructor;return i===void 0?t=tt(n,n.e<=r.toExpNeg||n.e>=r.toExpPos):(We(i,1,bt),e===void 0?e=r.rounding:We(e,0,8),n=W(new r(n),i,e),t=tt(n,i<=n.e||n.e<=r.toExpNeg,i)),n.isNeg()&&!n.isZero()?"-"+t:t};S.toSignificantDigits=S.toSD=function(i,e){var t=this,n=t.constructor;return i===void 0?(i=n.precision,e=n.rounding):(We(i,1,bt),e===void 0?e=n.rounding:We(e,0,8)),W(new n(t),i,e)};S.toString=function(){var i=this,e=i.constructor,t=tt(i,i.e<=e.toExpNeg||i.e>=e.toExpPos);return i.isNeg()&&!i.isZero()?"-"+t:t};S.truncated=S.trunc=function(){return W(new this.constructor(this),this.e+1,1)};S.valueOf=S.toJSON=function(){var i=this,e=i.constructor,t=tt(i,i.e<=e.toExpNeg||i.e>=e.toExpPos);return i.isNeg()?"-"+t:t};function Ie(i){var e,t,n,r=i.length-1,o="",s=i[0];if(r>0){for(o+=s,e=1;e<r;e++)n=i[e]+"",t=G-n.length,t&&(o+=ft(t)),o+=n;s=i[e],n=s+"",t=G-n.length,t&&(o+=ft(t))}else if(s===0)return"0";for(;s%10===0;)s/=10;return o+s}function We(i,e,t){if(i!==~~i||i<e||i>t)throw Error(gt+i)}function qt(i,e,t,n){var r,o,s,a;for(o=i[0];o>=10;o/=10)--e;return--e<0?(e+=G,r=0):(r=Math.ceil((e+1)/G),e%=G),o=Te(10,G-e),a=i[r]%o|0,n==null?e<3?(e==0?a=a/100|0:e==1&&(a=a/10|0),s=t<4&&a==99999||t>3&&a==49999||a==5e4||a==0):s=(t<4&&a+1==o||t>3&&a+1==o/2)&&(i[r+1]/o/100|0)==Te(10,e-2)-1||(a==o/2||a==0)&&(i[r+1]/o/100|0)==0:e<4?(e==0?a=a/1e3|0:e==1?a=a/100|0:e==2&&(a=a/10|0),s=(n||t<4)&&a==9999||!n&&t>3&&a==4999):s=((n||t<4)&&a+1==o||!n&&t>3&&a+1==o/2)&&(i[r+1]/o/1e3|0)==Te(10,e-3)-1,s}function dn(i,e,t){for(var n,r=[0],o,s=0,a=i.length;s<a;){for(o=r.length;o--;)r[o]*=e;for(r[0]+=_n.indexOf(i.charAt(s++)),n=0;n<r.length;n++)r[n]>t-1&&(r[n+1]===void 0&&(r[n+1]=0),r[n+1]+=r[n]/t|0,r[n]%=t)}return r.reverse()}function jr(i,e){var t,n,r;if(e.isZero())return e;n=e.d.length,n<32?(t=Math.ceil(n/3),r=(1/wn(4,t)).toString()):(t=16,r="2.3283064365386962890625e-10"),i.precision+=t,e=Nt(i,1,e.times(r),new i(1));for(var o=t;o--;){var s=e.times(e);e=s.times(s).minus(s).times(8).plus(1)}return i.precision-=t,e}var ae=function(){function i(n,r,o){var s,a=0,c=n.length;for(n=n.slice();c--;)s=n[c]*r+a,n[c]=s%o|0,a=s/o|0;return a&&n.unshift(a),n}function e(n,r,o,s){var a,c;if(o!=s)c=o>s?1:-1;else for(a=c=0;a<o;a++)if(n[a]!=r[a]){c=n[a]>r[a]?1:-1;break}return c}function t(n,r,o,s){for(var a=0;o--;)n[o]-=a,a=n[o]<r[o]?1:0,n[o]=a*s+n[o]-r[o];for(;!n[0]&&n.length>1;)n.shift()}return function(n,r,o,s,a,c){var u,l,d,f,m,g,p,y,b,h,P,T,k,w,A,I,B,C,M,R,O=n.constructor,K=n.s==r.s?1:-1,N=n.d,_=r.d;if(!N||!N[0]||!_||!_[0])return new O(!n.s||!r.s||(N?_&&N[0]==_[0]:!_)?NaN:N&&N[0]==0||!_?K*0:K/0);for(c?(m=1,l=n.e-r.e):(c=je,m=G,l=Le(n.e/m)-Le(r.e/m)),M=_.length,B=N.length,b=new O(K),h=b.d=[],d=0;_[d]==(N[d]||0);d++);if(_[d]>(N[d]||0)&&l--,o==null?(w=o=O.precision,s=O.rounding):a?w=o+(n.e-r.e)+1:w=o,w<0)h.push(1),g=!0;else{if(w=w/m+2|0,d=0,M==1){for(f=0,_=_[0],w++;(d<B||f)&&w--;d++)A=f*c+(N[d]||0),h[d]=A/_|0,f=A%_|0;g=f||d<B}else{for(f=c/(_[0]+1)|0,f>1&&(_=i(_,f,c),N=i(N,f,c),M=_.length,B=N.length),I=M,P=N.slice(0,M),T=P.length;T<M;)P[T++]=0;R=_.slice(),R.unshift(0),C=_[0],_[1]>=c/2&&++C;do f=0,u=e(_,P,M,T),u<0?(k=P[0],M!=T&&(k=k*c+(P[1]||0)),f=k/C|0,f>1?(f>=c&&(f=c-1),p=i(_,f,c),y=p.length,T=P.length,u=e(p,P,y,T),u==1&&(f--,t(p,M<y?R:_,y,c))):(f==0&&(u=f=1),p=_.slice()),y=p.length,y<T&&p.unshift(0),t(P,p,T,c),u==-1&&(T=P.length,u=e(_,P,M,T),u<1&&(f++,t(P,M<T?R:_,T,c))),T=P.length):u===0&&(f++,P=[0]),h[d++]=f,u&&P[0]?P[T++]=N[I]||0:(P=[N[I]],T=1);while((I++<B||P[0]!==void 0)&&w--);g=P[0]!==void 0}h[0]||h.shift()}if(m==1)b.e=l,Ki=g;else{for(d=1,f=h[0];f>=10;f/=10)d++;b.e=d+l*m-1,W(b,a?o+b.e+1:o,s,g)}return b}}();function W(i,e,t,n){var r,o,s,a,c,u,l,d,f,m=i.constructor;e:if(e!=null){if(d=i.d,!d)return i;for(r=1,a=d[0];a>=10;a/=10)r++;if(o=e-r,o<0)o+=G,s=e,l=d[f=0],c=l/Te(10,r-s-1)%10|0;else if(f=Math.ceil((o+1)/G),a=d.length,f>=a)if(n){for(;a++<=f;)d.push(0);l=c=0,r=1,o%=G,s=o-G+1}else break e;else{for(l=a=d[f],r=1;a>=10;a/=10)r++;o%=G,s=o-G+r,c=s<0?0:l/Te(10,r-s-1)%10|0}if(n=n||e<0||d[f+1]!==void 0||(s<0?l:l%Te(10,r-s-1)),u=t<4?(c||n)&&(t==0||t==(i.s<0?3:2)):c>5||c==5&&(t==4||n||t==6&&(o>0?s>0?l/Te(10,r-s):0:d[f-1])%10&1||t==(i.s<0?8:7)),e<1||!d[0])return d.length=0,u?(e-=i.e+1,d[0]=Te(10,(G-e%G)%G),i.e=-e||0):d[0]=i.e=0,i;if(o==0?(d.length=f,a=1,f--):(d.length=f+1,a=Te(10,G-o),d[f]=s>0?(l/Te(10,r-s)%Te(10,s)|0)*a:0),u)for(;;)if(f==0){for(o=1,s=d[0];s>=10;s/=10)o++;for(s=d[0]+=a,a=1;s>=10;s/=10)a++;o!=a&&(i.e++,d[0]==je&&(d[0]=1));break}else{if(d[f]+=a,d[f]!=je)break;d[f--]=0,a=1}for(o=d.length;d[--o]===0;)d.pop()}return z&&(i.e>m.maxE?(i.d=null,i.e=NaN):i.e<m.minE&&(i.e=0,i.d=[0])),i}function tt(i,e,t){if(!i.isFinite())return _i(i);var n,r=i.e,o=Ie(i.d),s=o.length;return e?(t&&(n=t-s)>0?o=o.charAt(0)+"."+o.slice(1)+ft(n):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(i.e<0?"e":"e+")+i.e):r<0?(o="0."+ft(-r-1)+o,t&&(n=t-s)>0&&(o+=ft(n))):r>=s?(o+=ft(r+1-s),t&&(n=t-r-1)>0&&(o=o+"."+ft(n))):((n=r+1)<s&&(o=o.slice(0,n)+"."+o.slice(n)),t&&(n=t-s)>0&&(r+1===s&&(o+="."),o+=ft(n))),o}function yn(i,e){var t=i[0];for(e*=G;t>=10;t/=10)e++;return e}function gn(i,e,t){if(e>Zr)throw z=!0,t&&(i.precision=t),Error(Ni);return W(new i(fn),e,1,!0)}function et(i,e,t){if(e>Dn)throw Error(Ni);return W(new i(pn),e,t,!0)}function Oi(i){var e=i.length-1,t=e*G+1;if(e=i[e],e){for(;e%10==0;e/=10)t--;for(e=i[0];e>=10;e/=10)t++}return t}function ft(i){for(var e="";i--;)e+="0";return e}function Ei(i,e,t,n){var r,o=new i(1),s=Math.ceil(n/G+4);for(z=!1;;){if(t%2&&(o=o.times(e),Si(o.d,s)&&(r=!0)),t=Le(t/2),t===0){t=o.d.length-1,r&&o.d[t]===0&&++o.d[t];break}e=e.times(e),Si(e.d,s)}return z=!0,o}function Ii(i){return i.d[i.d.length-1]&1}function Fi(i,e,t){for(var n,r,o=new i(e[0]),s=0;++s<e.length;){if(r=new i(e[s]),!r.s){o=r;break}n=o.cmp(r),(n===t||n===0&&o.s===t)&&(o=r)}return o}function Wn(i,e){var t,n,r,o,s,a,c,u=0,l=0,d=0,f=i.constructor,m=f.rounding,g=f.precision;if(!i.d||!i.d[0]||i.e>17)return new f(i.d?i.d[0]?i.s<0?0:1/0:1:i.s?i.s<0?0:i:0/0);for(e==null?(z=!1,c=g):c=e,a=new f(.03125);i.e>-2;)i=i.times(a),d+=5;for(n=Math.log(Te(2,d))/Math.LN10*2+5|0,c+=n,t=o=s=new f(1),f.precision=c;;){if(o=W(o.times(i),c,1),t=t.times(++l),a=s.plus(ae(o,t,c,1)),Ie(a.d).slice(0,c)===Ie(s.d).slice(0,c)){for(r=d;r--;)s=W(s.times(s),c,1);if(e==null)if(u<3&&qt(s.d,c-n,m,u))f.precision=c+=10,t=o=a=new f(1),l=0,u++;else return W(s,f.precision=g,m,z=!0);else return f.precision=g,s}s=a}}function pt(i,e){var t,n,r,o,s,a,c,u,l,d,f,m=1,g=10,p=i,y=p.d,b=p.constructor,h=b.rounding,P=b.precision;if(p.s<0||!y||!y[0]||!p.e&&y[0]==1&&y.length==1)return new b(y&&!y[0]?-1/0:p.s!=1?NaN:y?0:p);if(e==null?(z=!1,l=P):l=e,b.precision=l+=g,t=Ie(y),n=t.charAt(0),Math.abs(o=p.e)<15e14){for(;n<7&&n!=1||n==1&&t.charAt(1)>3;)p=p.times(i),t=Ie(p.d),n=t.charAt(0),m++;o=p.e,n>1?(p=new b("0."+t),o++):p=new b(n+"."+t.slice(1))}else return u=gn(b,l+2,P).times(o+""),p=pt(new b(n+"."+t.slice(1)),l-g).plus(u),b.precision=P,e==null?W(p,P,h,z=!0):p;for(d=p,c=s=p=ae(p.minus(1),p.plus(1),l,1),f=W(p.times(p),l,1),r=3;;){if(s=W(s.times(f),l,1),u=c.plus(ae(s,new b(r),l,1)),Ie(u.d).slice(0,l)===Ie(c.d).slice(0,l))if(c=c.times(2),o!==0&&(c=c.plus(gn(b,l+2,P).times(o+""))),c=ae(c,new b(m),l,1),e==null)if(qt(c.d,l-g,h,a))b.precision=l+=g,u=s=p=ae(d.minus(1),d.plus(1),l,1),f=W(p.times(p),l,1),r=a=1;else return W(c,b.precision=P,h,z=!0);else return b.precision=P,c;c=u,r+=2}}function _i(i){return String(i.s*i.s/0)}function mn(i,e){var t,n,r;for((t=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(t<0&&(t=n),t+=+e.slice(n+1),e=e.substring(0,n)):t<0&&(t=e.length),n=0;e.charCodeAt(n)===48;n++);for(r=e.length;e.charCodeAt(r-1)===48;--r);if(e=e.slice(n,r),e){if(r-=n,i.e=t=t-n-1,i.d=[],n=(t+1)%G,t<0&&(n+=G),n<r){for(n&&i.d.push(+e.slice(0,n)),r-=G;n<r;)i.d.push(+e.slice(n,n+=G));e=e.slice(n),n=G-e.length}else n-=r;for(;n--;)e+="0";i.d.push(+e),z&&(i.e>i.constructor.maxE?(i.d=null,i.e=NaN):i.e<i.constructor.minE&&(i.e=0,i.d=[0]))}else i.e=0,i.d=[0];return i}function Yr(i,e){var t,n,r,o,s,a,c,u,l;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),Mi.test(e))return mn(i,e)}else if(e==="Infinity"||e==="NaN")return+e||(i.s=NaN),i.e=NaN,i.d=null,i;if(Xr.test(e))t=16,e=e.toLowerCase();else if(Gr.test(e))t=2;else if(Hr.test(e))t=8;else throw Error(gt+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,n=i.constructor,s&&(e=e.replace(".",""),a=e.length,o=a-o,r=Ei(n,new n(t),o,o*2)),u=dn(e,t,je),l=u.length-1,o=l;u[o]===0;--o)u.pop();return o<0?new n(i.s*0):(i.e=yn(u,l),i.d=u,z=!1,s&&(i=ae(i,r,a*4)),c&&(i=i.times(Math.abs(c)<54?Te(2,c):Vt.pow(2,c))),z=!0,i)}function Jr(i,e){var t,n=e.d.length;if(n<3)return e.isZero()?e:Nt(i,2,e,e);t=1.4*Math.sqrt(n),t=t>16?16:t|0,e=e.times(1/wn(5,t)),e=Nt(i,2,e,e);for(var r,o=new i(5),s=new i(16),a=new i(20);t--;)r=e.times(e),e=e.times(o.plus(r.times(s.times(r).minus(a))));return e}function Nt(i,e,t,n,r){var o,s,a,c,u=1,l=i.precision,d=Math.ceil(l/G);for(z=!1,c=t.times(t),a=new i(n);;){if(s=ae(a.times(c),new i(e++*e++),l,1),a=r?n.plus(s):n.minus(s),n=ae(s.times(c),new i(e++*e++),l,1),s=a.plus(n),s.d[d]!==void 0){for(o=d;s.d[o]===a.d[o]&&o--;);if(o==-1)break}o=a,a=n,n=s,s=o,u++}return z=!0,s.d.length=d+1,s}function wn(i,e){for(var t=i;--e;)t*=i;return t}function vi(i,e){var t,n=e.s<0,r=et(i,i.precision,1),o=r.times(.5);if(e=e.abs(),e.lte(o))return at=n?4:1,e;if(t=e.divToInt(r),t.isZero())at=n?3:2;else{if(e=e.minus(t.times(r)),e.lte(o))return at=Ii(t)?n?2:3:n?4:1,e;at=Ii(t)?n?1:4:n?3:2}return e.minus(r).abs()}function qn(i,e,t,n){var r,o,s,a,c,u,l,d,f,m=i.constructor,g=t!==void 0;if(g?(We(t,1,bt),n===void 0?n=m.rounding:We(n,0,8)):(t=m.precision,n=m.rounding),!i.isFinite())l=_i(i);else{for(l=tt(i),s=l.indexOf("."),g?(r=2,e==16?t=t*4-3:e==8&&(t=t*3-2)):r=e,s>=0&&(l=l.replace(".",""),f=new m(1),f.e=l.length-s,f.d=dn(tt(f),10,r),f.e=f.d.length),d=dn(l,10,r),o=c=d.length;d[--c]==0;)d.pop();if(!d[0])l=g?"0p+0":"0";else{if(s<0?o--:(i=new m(i),i.d=d,i.e=o,i=ae(i,f,t,n,0,r),d=i.d,o=i.e,u=Ki),s=d[t],a=r/2,u=u||d[t+1]!==void 0,u=n<4?(s!==void 0||u)&&(n===0||n===(i.s<0?3:2)):s>a||s===a&&(n===4||u||n===6&&d[t-1]&1||n===(i.s<0?8:7)),d.length=t,u)for(;++d[--t]>r-1;)d[t]=0,t||(++o,d.unshift(1));for(c=d.length;!d[c-1];--c);for(s=0,l="";s<c;s++)l+=_n.charAt(d[s]);if(g){if(c>1)if(e==16||e==8){for(s=e==16?4:3,--c;c%s;c++)l+="0";for(d=dn(l,r,e),c=d.length;!d[c-1];--c);for(s=1,l="1.";s<c;s++)l+=_n.charAt(d[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 i.s<0?"-"+l:l}function Si(i,e){if(i.length>e)return i.length=e,!0}function Qr(i){return new this(i).abs()}function $r(i){return new this(i).acos()}function eo(i){return new this(i).acosh()}function to(i,e){return new this(i).plus(e)}function no(i){return new this(i).asin()}function io(i){return new this(i).asinh()}function ro(i){return new this(i).atan()}function oo(i){return new this(i).atanh()}function so(i,e){i=new this(i),e=new this(e);var t,n=this.precision,r=this.rounding,o=n+4;return!i.s||!e.s?t=new this(NaN):!i.d&&!e.d?(t=et(this,o,1).times(e.s>0?.25:.75),t.s=i.s):!e.d||i.isZero()?(t=e.s<0?et(this,n,r):new this(0),t.s=i.s):!i.d||e.isZero()?(t=et(this,o,1).times(.5),t.s=i.s):e.s<0?(this.precision=o,this.rounding=1,t=this.atan(ae(i,e,o,1)),e=et(this,o,1),this.precision=n,this.rounding=r,t=i.s<0?t.minus(e):t.plus(e)):t=this.atan(ae(i,e,o,1)),t}function ao(i){return new this(i).cbrt()}function co(i){return W(i=new this(i),i.e+1,2)}function uo(i,e,t){return new this(i).clamp(e,t)}function lo(i){if(!i||typeof i!="object")throw Error(bn+"Object expected");var e,t,n,r=i.defaults===!0,o=["precision",1,bt,"rounding",0,8,"toExpNeg",-Kt,0,"toExpPos",0,Kt,"maxE",0,Kt,"minE",-Kt,0,"modulo",0,9];for(e=0;e<o.length;e+=3)if(t=o[e],r&&(this[t]=vn[t]),(n=i[t])!==void 0)if(Le(n)===n&&n>=o[e+1]&&n<=o[e+2])this[t]=n;else throw Error(gt+t+": "+n);if(t="crypto",r&&(this[t]=vn[t]),(n=i[t])!==void 0)if(n===!0||n===!1||n===0||n===1)if(n)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[t]=!0;else throw Error(Li);else this[t]=!1;else throw Error(gt+t+": "+n);return this}function mo(i){return new this(i).cos()}function fo(i){return new this(i).cosh()}function Di(i){var e,t,n;function r(o){var s,a,c,u=this;if(!(u instanceof r))return new r(o);if(u.constructor=r,Ci(o)){u.s=o.s,z?!o.d||o.e>r.maxE?(u.e=NaN,u.d=null):o.e<r.minE?(u.e=0,u.d=[0]):(u.e=o.e,u.d=o.d.slice()):(u.e=o.e,u.d=o.d?o.d.slice():o.d);return}if(c=typeof o,c==="number"){if(o===0){u.s=1/o<0?-1:1,u.e=0,u.d=[0];return}if(o<0?(o=-o,u.s=-1):u.s=1,o===~~o&&o<1e7){for(s=0,a=o;a>=10;a/=10)s++;z?s>r.maxE?(u.e=NaN,u.d=null):s<r.minE?(u.e=0,u.d=[0]):(u.e=s,u.d=[o]):(u.e=s,u.d=[o]);return}if(o*0!==0){o||(u.s=NaN),u.e=NaN,u.d=null;return}return mn(u,o.toString())}if(c==="string")return(a=o.charCodeAt(0))===45?(o=o.slice(1),u.s=-1):(a===43&&(o=o.slice(1)),u.s=1),Mi.test(o)?mn(u,o):Yr(u,o);if(c==="bigint")return o<0?(o=-o,u.s=-1):u.s=1,mn(u,o.toString());throw Error(gt+o)}if(r.prototype=S,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=lo,r.clone=Di,r.isDecimal=Ci,r.abs=Qr,r.acos=$r,r.acosh=eo,r.add=to,r.asin=no,r.asinh=io,r.atan=ro,r.atanh=oo,r.atan2=so,r.cbrt=ao,r.ceil=co,r.clamp=uo,r.cos=mo,r.cosh=fo,r.div=po,r.exp=go,r.floor=bo,r.hypot=yo,r.ln=wo,r.log=ho,r.log10=ko,r.log2=Po,r.max=To,r.min=Ao,r.mod=xo,r.mul=Bo,r.pow=Io,r.random=So,r.round=Co,r.sign=Ko,r.sin=No,r.sinh=Lo,r.sqrt=Ro,r.sub=Mo,r.sum=Oo,r.tan=Eo,r.tanh=Fo,r.trunc=_o,i===void 0&&(i={}),i&&i.defaults!==!0)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],e=0;e<n.length;)i.hasOwnProperty(t=n[e++])||(i[t]=this[t]);return r.config(i),r}function po(i,e){return new this(i).div(e)}function go(i){return new this(i).exp()}function bo(i){return W(i=new this(i),i.e+1,3)}function yo(){var i,e,t=new this(0);for(z=!1,i=0;i<arguments.length;)if(e=new this(arguments[i++]),e.d)t.d&&(t=t.plus(e.times(e)));else{if(e.s)return z=!0,new this(1/0);t=e}return z=!0,t.sqrt()}function Ci(i){return i instanceof Vt||i&&i.toStringTag===Ri||!1}function wo(i){return new this(i).ln()}function ho(i,e){return new this(i).log(e)}function Po(i){return new this(i).log(2)}function ko(i){return new this(i).log(10)}function To(){return Fi(this,arguments,-1)}function Ao(){return Fi(this,arguments,1)}function xo(i,e){return new this(i).mod(e)}function Bo(i,e){return new this(i).mul(e)}function Io(i,e){return new this(i).pow(e)}function So(i){var e,t,n,r,o=0,s=new this(1),a=[];if(i===void 0?i=this.precision:We(i,1,bt),n=Math.ceil(i/G),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(n));o<n;)r=e[o],r>=429e7?e[o]=crypto.getRandomValues(new Uint32Array(1))[0]:a[o++]=r%1e7;else if(crypto.randomBytes){for(e=crypto.randomBytes(n*=4);o<n;)r=e[o]+(e[o+1]<<8)+(e[o+2]<<16)+((e[o+3]&127)<<24),r>=214e7?crypto.randomBytes(4).copy(e,o):(a.push(r%1e7),o+=4);o=n/4}else throw Error(Li);else for(;o<n;)a[o++]=Math.random()*1e7|0;for(n=a[--o],i%=G,n&&i&&(r=Te(10,G-i),a[o]=(n/r|0)*r);a[o]===0;o--)a.pop();if(o<0)t=0,a=[0];else{for(t=-1;a[0]===0;t-=G)a.shift();for(n=1,r=a[0];r>=10;r/=10)n++;n<G&&(t-=G-n)}return s.e=t,s.d=a,s}function Co(i){return W(i=new this(i),i.e+1,this.rounding)}function Ko(i){return i=new this(i),i.d?i.d[0]?i.s:0*i.s:i.s||NaN}function No(i){return new this(i).sin()}function Lo(i){return new this(i).sinh()}function Ro(i){return new this(i).sqrt()}function Mo(i,e){return new this(i).sub(e)}function Oo(){var i=0,e=arguments,t=new this(e[i]);for(z=!1;t.s&&++i<e.length;)t=t.plus(e[i]);return z=!0,W(t,this.precision,this.rounding)}function Eo(i){return new this(i).tan()}function Fo(i){return new this(i).tanh()}function _o(i){return W(i=new this(i),i.e+1,1)}S[Symbol.for("nodejs.util.inspect.custom")]=S.toString;S[Symbol.toStringTag]="Decimal";var Vt=S.constructor=Di(vn);fn=new Vt(fn);pn=new Vt(pn);var E=Vt;var Xn=require("@solana/web3.js");var Ut=require("lodash");var Vn=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 t=e.map(n=>typeof n=="object"?JSON.stringify(n):n).join(", ");throw new Error(t)}warning(...e){return this.isLogLevel(1)?(console.warn(this.time,this.name,"sdk logger warning",...e),this):this}info(...e){return this.isLogLevel(2)?(console.info(this.time,this.name,"sdk logger info",...e),this):this}debug(...e){return this.isLogLevel(3)?(console.debug(this.time,this.name,"sdk logger debug",...e),this):this}},Wi={},vo={};function Se(i){let e=(0,Ut.get)(Wi,i);if(!e){let t=(0,Ut.get)(vo,i);e=new Vn({name:i,logLevel:t}),(0,Ut.set)(Wi,i,e)}return e}var yt=require("@solana/spl-token"),Un=Se("Raydium_accountInfo_util");async function ct(i,e,t){let{batchRequest:n,commitment:r="confirmed",chunkCount:o=100}=D({batchRequest:!1},t),s=Gn(e,o),a=new Array(s.length).fill([]);if(n){let c=s.map(d=>{let f=i._buildArgs([d.map(m=>m.toBase58())],r,"base64");return{methodName:"getMultipleAccounts",args:f}}),u=Gn(c,10);a=(await(await Promise.all(u.map(async d=>await i._rpcBatchRequest(d)))).flat()).map(d=>(d.error&&Un.logWithError(`failed to get info for multiple accounts, RPC_ERROR, ${d.error.message}`),d.result.value.map(f=>{if(f){let{data:m,executable:g,lamports:p,owner:y,rentEpoch:b}=f;return m.length!==2&&m[1]!=="base64"&&Un.logWithError("info must be base64 encoded, RPC_ERROR"),{data:Buffer.from(m[0],"base64"),executable:g,lamports:p,owner:new Xn.PublicKey(y),rentEpoch:b}}return null})))}else try{a=await Promise.all(s.map(c=>i.getMultipleAccountsInfo(c,r)))}catch(c){c instanceof Error&&Un.logWithError(`failed to get info for multiple accounts, RPC_ERROR, ${c.message}`)}return a.flat()}async function ut(i,e,t){let n=await ct(i,e.map(r=>r.pubkey),t);return e.map((r,o)=>Y(D({},r),{accountInfo:n[o]}))}async function qi({connection:i,mints:e,config:t}){var o,s,a;if(e.length===0)return{};let n=await ut(i,e.map(c=>({pubkey:Tt(c)})),t),r={};for(let c of n){if(!c.accountInfo||c.accountInfo.data.length<yt.MINT_SIZE){console.log("invalid mint account",c.pubkey.toBase58());continue}let u=(0,yt.unpackMint)(c.pubkey,c.accountInfo,(o=c.accountInfo)==null?void 0:o.owner);r[c.pubkey.toString()]=Y(D({},u),{programId:((s=c.accountInfo)==null?void 0:s.owner)||yt.TOKEN_PROGRAM_ID,feeConfig:(a=(0,yt.getTransferFeeConfig)(u))!=null?a:void 0})}return r[Xn.PublicKey.default.toBase58()]=r[te.toBase58()],r}var it=we(require("bn.js"));var zi=we(require("big.js")),zt=we(require("bn.js"));var Vi=we(require("toformat")),Do=Vi.default,Gt=Do;var Xt=we(require("big.js")),Gi=we(require("bn.js")),Xi=we(require("decimal.js-light"));var Lt=we(require("bn.js"));var Ui=9007199254740991;function xe(i){let e=Se("Raydium_parseBigNumberish");if(i instanceof Lt.default)return i;if(typeof i=="string"){if(i.match(/^-?[0-9]+$/))return new Lt.default(i);e.logWithError(`invalid BigNumberish string: ${i}`)}return typeof i=="number"?(i%1&&e.logWithError(`BigNumberish number underflow: ${i}`),(i>=Ui||i<=-Ui)&&e.logWithError(`BigNumberish number overflow: ${i}`),new Lt.default(String(i))):typeof i=="bigint"?new Lt.default(i.toString()):(e.error(`invalid BigNumberish value: ${i}`),new Lt.default(0))}var hn=Se("module/fraction"),Hn=Gt(Xt.default),Ht=Gt(Xi.default),qo={[0]:Ht.ROUND_DOWN,[1]:Ht.ROUND_HALF_UP,[2]:Ht.ROUND_UP},Vo={[0]:Xt.default.roundDown,[1]:Xt.default.roundHalfUp,[2]:Xt.default.roundUp},ie=class{constructor(e,t=new Gi.default(1)){this.numerator=xe(e),this.denominator=xe(t)}get quotient(){return this.numerator.div(this.denominator)}invert(){return new ie(this.denominator,this.numerator)}add(e){let t=e instanceof ie?e:new ie(xe(e));return this.denominator.eq(t.denominator)?new ie(this.numerator.add(t.numerator),this.denominator):new ie(this.numerator.mul(t.denominator).add(t.numerator.mul(this.denominator)),this.denominator.mul(t.denominator))}sub(e){let t=e instanceof ie?e:new ie(xe(e));return this.denominator.eq(t.denominator)?new ie(this.numerator.sub(t.numerator),this.denominator):new ie(this.numerator.mul(t.denominator).sub(t.numerator.mul(this.denominator)),this.denominator.mul(t.denominator))}mul(e){let t=e instanceof ie?e:new ie(xe(e));return new ie(this.numerator.mul(t.numerator),this.denominator.mul(t.denominator))}div(e){let t=e instanceof ie?e:new ie(xe(e));return new ie(this.numerator.mul(t.denominator),this.denominator.mul(t.numerator))}toSignificant(e,t={groupSeparator:""},n=1){Number.isInteger(e)||hn.logWithError(`${e} is not an integer.`),e<=0&&hn.logWithError(`${e} is not positive.`),Ht.set({precision:e+1,rounding:qo[n]});let r=new Ht(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(e);return r.toFormat(r.decimalPlaces(),t)}toFixed(e,t={groupSeparator:""},n=1){return Number.isInteger(e)||hn.logWithError(`${e} is not an integer.`),e<0&&hn.logWithError(`${e} is negative.`),Hn.DP=e,Hn.RM=Vo[n]||1,new Hn(this.numerator.toString()).div(this.denominator.toString()).toFormat(e,t)}isZero(){return this.numerator.isZero()}};var Uo=Se("Raydium_amount"),Hi=Gt(zi.default);function Go(i,e){let t="0",n="0";if(i.includes(".")){let r=i.split(".");r.length===2?([t,n]=r,n=n.padEnd(e,"0")):Uo.logWithError(`invalid number string, num: ${i}`)}else t=i;return[t,n.slice(0,e)||n]}var Ce=class extends ie{constructor(t,n,r=!0,o){let s=new zt.default(0),a=zn.pow(new zt.default(t.decimals));if(r)s=xe(n);else{let c=new zt.default(0),u=new zt.default(0);if(typeof n=="string"||typeof n=="number"||typeof n=="bigint"){let[l,d]=Go(n.toString(),t.decimals);c=xe(l),u=xe(d)}c=c.mul(a),s=c.add(u)}super(s,a);this.logger=Se(o||"TokenAmount"),this.token=t}get raw(){return this.numerator}isZero(){return this.raw.isZero()}gt(t){return this.token.equals(t.token)||this.logger.logWithError("gt token not equals"),this.raw.gt(t.raw)}lt(t){return this.token.equals(t.token)||this.logger.logWithError("lt token not equals"),this.raw.lt(t.raw)}add(t){return this.token.equals(t.token)||this.logger.logWithError("add token not equals"),new Ce(this.token,this.raw.add(t.raw))}subtract(t){return this.token.equals(t.token)||this.logger.logWithError("sub token not equals"),new Ce(this.token,this.raw.sub(t.raw))}toSignificant(t=this.token.decimals,n,r=0){return super.toSignificant(t,n,r)}toFixed(t=this.token.decimals,n,r=0){return t>this.token.decimals&&this.logger.logWithError("decimals overflow"),super.toFixed(t,n,r)}toExact(t={groupSeparator:""}){return Hi.DP=this.token.decimals,new Hi(this.numerator.toString()).div(this.denominator.toString()).toFormat(t)}};var Zi=require("@solana/web3.js"),Zn=require("@solana/spl-token"),jn={chainId:101,address:Zi.PublicKey.default.toBase58(),programId:Zn.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"}},wt={chainId:101,address:"So11111111111111111111111111111111111111112",programId:Zn.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 kn=require("@solana/web3.js");var re=require("@solana/web3.js"),ji=require("@solana/spl-token");function Yn({pubkey:i,isSigner:e=!1,isWritable:t=!0}){return{pubkey:i,isWritable:t,isSigner:e}}var Xs=[Yn({pubkey:ji.TOKEN_PROGRAM_ID,isWritable:!1}),Yn({pubkey:re.SystemProgram.programId,isWritable:!1}),Yn({pubkey:re.SYSVAR_RENT_PUBKEY,isWritable:!1})];function Jn({publicKey:i,transformSol:e}){let t=Yi(i.toString());if(t instanceof re.PublicKey)return e&&t.equals(Zt)?te:t;if(e&&t.toString()===Zt.toBase58())return te;if(typeof t=="string"){if(t===re.PublicKey.default.toBase58())return re.PublicKey.default;try{return new re.PublicKey(t)}catch{throw new Error("invalid public key")}}throw new Error("invalid public key")}function Yi(i){try{return new re.PublicKey(i)}catch{return i}}var Pn=new re.PublicKey("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),Qn=new re.PublicKey("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),ht=new re.PublicKey("SysvarRent111111111111111111111111111111111"),Hs=new re.PublicKey("SysvarC1ock11111111111111111111111111111111"),At=new re.PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),zs=new re.PublicKey("Sysvar1nstructions1111111111111111111111111"),Zs=re.SystemProgram.programId,js=new re.PublicKey("4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R"),Ys=new re.PublicKey("Ea5SjE2Y6yvCeW5dYTn7PYMuW5ikXkvbGdcmSnXeaLjS"),Js=new re.PublicKey("SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt"),Qs=new re.PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"),$s=new re.PublicKey("Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"),ea=new re.PublicKey("mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So"),ta=new re.PublicKey("7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj"),na=new re.PublicKey("USDH1SM1ojwWUga67PGrgFWUHibbjqMvuMaDkRJTgkX"),ia=new re.PublicKey("NRVwhjBQiUPYtfDT5zRBVJajzFQHaBUNtC7SNVvqRFa"),ra=new re.PublicKey("ANAxByE6G2WjFp7A4NqtWYXb3mgruyzZYg3spfxe6Lbo"),oa=new re.PublicKey("7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs"),te=new re.PublicKey("So11111111111111111111111111111111111111112"),Zt=re.PublicKey.default;function Tt(i){return Jn({publicKey:i,transformSol:!0})}var $n=class{constructor({mint:e,decimals:t,symbol:n,name:r,skipMint:o=!1,isToken2022:s=!1}){if(e===Zt.toBase58()||e instanceof kn.PublicKey&&Zt.equals(e)){this.decimals=wt.decimals,this.symbol=wt.symbol,this.name=wt.name,this.mint=new kn.PublicKey(wt.address),this.isToken2022=!1;return}this.decimals=t,this.symbol=n||e.toString().substring(0,6),this.name=r||e.toString().substring(0,6),this.mint=o?kn.PublicKey.default:Jn({publicKey:e}),this.isToken2022=s}equals(e){return this===e?!0:this.mint.equals(e.mint)}},nt=$n;nt.WSOL=new $n(Y(D({},wt),{mint:wt.address}));var ei=class{constructor({decimals:e,symbol:t="UNKNOWN",name:n="UNKNOWN"}){this.decimals=e,this.symbol=t,this.name=n}equals(e){return this===e}},Tn=ei;Tn.SOL=new ei(jn);var Qi=we(require("bn.js"));var Ji=new ie(new Qi.default(100)),Pt=class extends ie{toSignificant(e=5,t,n){return this.mul(Ji).toSignificant(e,t,n)}toFixed(e=2,t,n){return this.mul(Ji).toFixed(e,t,n)}};var Xo=Se("Raydium_price"),Ye=class extends ie{constructor(t){let{baseToken:n,quoteToken:r,numerator:o,denominator:s}=t;super(o,s);this.baseToken=n,this.quoteToken=r,this.scalar=new ie(ti(n.decimals),ti(r.decimals))}get raw(){return new ie(this.numerator,this.denominator)}get adjusted(){return super.mul(this.scalar)}invert(){return new Ye({baseToken:this.quoteToken,quoteToken:this.baseToken,denominator:this.numerator,numerator:this.denominator})}mul(t){this.quoteToken!==t.baseToken&&Xo.logWithError("mul token not equals");let n=super.mul(t);return new Ye({baseToken:this.baseToken,quoteToken:t.quoteToken,denominator:n.denominator,numerator:n.numerator})}toSignificant(t=this.quoteToken.decimals,n,r){return this.adjusted.toSignificant(t,n,r)}toFixed(t=this.quoteToken.decimals,n,r){return this.adjusted.toFixed(t,n,r)}};var Ho=new it.default(0),Xa=new it.default(1),Ha=new it.default(2),za=new it.default(3),Za=new it.default(5),zn=new it.default(10),ja=new it.default(100),Ya=new it.default(1e3),Ja=new it.default(1e4);function ti(i){return zn.pow(xe(i))}function Gn(i,e=1,t=[]){let n=[...i];if(e<=0)return t;for(;n.length;)t.push(n.splice(0,e));return t}var nr=require("@solana/web3.js"),ir=require("@solana/spl-token");var Re=require("@solana/web3.js");var ue={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"};var er=require("@solana/spl-token"),$i=Se("Raydium_txUtil"),tr=1644;function An(i){let e=[],t=[];return i.microLamports&&(e.push(Re.ComputeBudgetProgram.setComputeUnitPrice({microLamports:i.microLamports})),t.push(ue.SetComputeUnitPrice)),i.units&&(e.push(Re.ComputeBudgetProgram.setComputeUnitLimit({units:i.units})),t.push(ue.SetComputeUnitLimit)),{instructions:e,instructionTypes:t}}async function Rt(i,e){var n,r;let t=e!=null?e:"confirmed";return(r=await((n=i.getLatestBlockhash)==null?void 0:n.call(i,{commitment:t})))==null?void 0:r.blockhash}async function xn(i,e){return i.getSignatureStatuses([e]),new Promise((t,n)=>{let r=setTimeout(n,6e4);i.onSignature(e,o=>{if(clearTimeout(r),!o.err){t("");return}n(Object.assign(o.err,{txId:e}))},"confirmed")})}function zo(i,e){i.length<1&&$i.logWithError(`no instructions provided: ${i.toString()}`),e.length<1&&$i.logWithError(`no signers provided:, ${e.toString()}`);let t=new Re.Transaction;t.recentBlockhash="11111111111111111111111111111111",t.feePayer=e[0],t.add(...i);try{return Buffer.from(t.serialize({verifySignatures:!1})).toString("base64").length<tr}catch{return!1}}function Me(i,e){let[t,n]=Re.PublicKey.findProgramAddressSync(i,e);return{publicKey:t,nonce:n}}function jt({instructions:i,payer:e,signers:t}){return zo(i,[e,...t])}function Yt({instructions:i,payer:e,lookupTableAddressAccount:t,recentBlockhash:n=Re.Keypair.generate().publicKey.toString()}){let o=new Re.TransactionMessage({payerKey:e,recentBlockhash:n,instructions:i}).compileToV0Message(Object.values(t!=null?t:{}));try{return Buffer.from(new Re.VersionedTransaction(o).serialize()).toString("base64").length<tr}catch{return!1}}var Zo=i=>Buffer.isBuffer(i)?i:i instanceof Uint8Array?Buffer.from(i.buffer,i.byteOffset,i.byteLength):Buffer.from(i),jo=i=>{let e=i.serialize({requireAllSignatures:!1,verifySignatures:!1});i instanceof Re.VersionedTransaction&&(e=Zo(e));try{return e instanceof Buffer?e.toString("base64"):Buffer.from(e).toString("base64")}catch{return e.toString("base64")}};function xt(i){let e=[];return i.forEach(t=>{t instanceof Re.Transaction&&(t.recentBlockhash||(t.recentBlockhash=er.TOKEN_PROGRAM_ID.toBase58()),t.feePayer||(t.feePayer=Re.Keypair.generate().publicKey)),e.push(jo(t))}),console.log("simulate tx string:",e),e}function le(i,e,t){return Me([i.toBuffer(),(t!=null?t:ir.TOKEN_PROGRAM_ID).toBuffer(),e.toBuffer()],new nr.PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"))}var q=require("@solana/web3.js"),fc=new q.PublicKey("EhhTKczWMGQt46ynNeRX1WfeagwwJd7ufHvCDjRxjo5Q"),pc=new q.PublicKey("CBuCnLe26faBpcBP2fktp4rp8abpcAnTWft6ZrP5Q4T"),gc=new q.PublicKey("9KEPoZmtHUrBbhWN1v1KWLMkkvwY6WLtAVUCPRtRjP4z"),bc=new q.PublicKey("FarmqiPv5e