UNPKG

@raydium-io/raydium-sdk-v2

Version:

An SDK for building applications on top of Raydium.

1 lines 134 kB
var Gi=Object.create;var yt=Object.defineProperty,Ui=Object.defineProperties,Xi=Object.getOwnPropertyDescriptor,Hi=Object.getOwnPropertyDescriptors,zi=Object.getOwnPropertyNames,En=Object.getOwnPropertySymbols,Zi=Object.getPrototypeOf,_n=Object.prototype.hasOwnProperty,Yi=Object.prototype.propertyIsEnumerable;var Fn=(i,e,t)=>e in i?yt(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,te=(i,e)=>{for(var t in e||(e={}))_n.call(e,t)&&Fn(i,t,e[t]);if(En)for(var t of En(e))Yi.call(e,t)&&Fn(i,t,e[t]);return i},se=(i,e)=>Ui(i,Hi(e));var ji=(i,e)=>{for(var t in e)yt(i,t,{get:e[t],enumerable:!0})},vn=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of zi(e))!_n.call(i,r)&&r!==t&&yt(i,r,{get:()=>e[r],enumerable:!(n=Xi(e,r))||n.enumerable});return i};var de=(i,e,t)=>(t=i!=null?Gi(Zi(i)):{},vn(e||!i||!i.__esModule?yt(t,"default",{value:i,enumerable:!0}):t,i)),Ji=i=>vn(yt({},"__esModule",{value:!0}),i);var ko={};ji(ko,{ClmmInstrument:()=>Et});module.exports=Ji(ko);var w=require("@solana/web3.js"),$t=de(require("bn.js"));var Dn=require("@solana/web3.js");var wt=require("lodash");var en=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}},Wn={},Qi={};function xe(i){let e=(0,wt.get)(Wn,i);if(!e){let t=(0,wt.get)(Qi,i);e=new en({name:i,logLevel:t}),(0,wt.set)(Wn,i,e)}return e}var Ft=require("@solana/spl-token"),tn=xe("Raydium_accountInfo_util");async function ze(i,e,t){let{batchRequest:n,commitment:r="confirmed",chunkCount:o=100}=te({batchRequest:!1},t),s=nn(e,o),a=new Array(s.length).fill([]);if(n){let u=s.map(m=>{let d=i._buildArgs([m.map(f=>f.toBase58())],r,"base64");return{methodName:"getMultipleAccounts",args:d}}),c=nn(u,10);a=(await(await Promise.all(c.map(async m=>await i._rpcBatchRequest(m)))).flat()).map(m=>(m.error&&tn.logWithError(`failed to get info for multiple accounts, RPC_ERROR, ${m.error.message}`),m.result.value.map(d=>{if(d){let{data:f,executable:b,lamports:p,owner:y,rentEpoch:g}=d;return f.length!==2&&f[1]!=="base64"&&tn.logWithError("info must be base64 encoded, RPC_ERROR"),{data:Buffer.from(f[0],"base64"),executable:b,lamports:p,owner:new Dn.PublicKey(y),rentEpoch:g}}return null})))}else try{a=await Promise.all(s.map(u=>i.getMultipleAccountsInfo(u,r)))}catch(u){u instanceof Error&&tn.logWithError(`failed to get info for multiple accounts, RPC_ERROR, ${u.message}`)}return a.flat()}async function rn(i,e,t){let n=await ze(i,e.map(r=>r.pubkey),t);return e.map((r,o)=>se(te({},r),{accountInfo:n[o]}))}var qe=de(require("bn.js"));var lt=9e15,Je=1e9,sn="0123456789abcdef",Dt="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Ot="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",an={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-lt,maxE:lt,crypto:!1},Gn,Ge,F=!0,Vt="[DecimalError] ",je=Vt+"Invalid argument: ",Un=Vt+"Precision limit exceeded",Xn=Vt+"crypto unavailable",Hn="[object Decimal]",Pe=Math.floor,fe=Math.pow,$i=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,er=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,tr=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,zn=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,_e=1e7,E=7,nr=9007199254740991,ir=Dt.length-1,un=Ot.length-1,h={toStringTag:Hn};h.absoluteValue=h.abs=function(){var i=new this.constructor(this);return i.s<0&&(i.s=1),I(i)};h.ceil=function(){return I(new this.constructor(this),this.e+1,2)};h.clampedTo=h.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(je+e);return t=n.cmp(i),t<0?i:n.cmp(e)>0?e:new r(n)};h.comparedTo=h.cmp=function(i){var e,t,n,r,o=this,s=o.d,a=(i=new o.constructor(i)).d,u=o.s,c=i.s;if(!s||!a)return!u||!c?NaN:u!==c?u:s===a?0:!s^u<0?1:-1;if(!s[0]||!a[0])return s[0]?u:a[0]?-c:0;if(u!==c)return u;if(o.e!==i.e)return o.e>i.e^u<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]^u<0?1:-1;return n===r?0:n>r^u<0?1:-1};h.cosine=h.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())+E,n.rounding=1,t=rr(n,Qn(n,t)),n.precision=i,n.rounding=e,I(Ge==2||Ge==3?t.neg():t,i,e,!0)):new n(1):new n(NaN)};h.cubeRoot=h.cbrt=function(){var i,e,t,n,r,o,s,a,u,c,l=this,m=l.constructor;if(!l.isFinite()||l.isZero())return new m(l);for(F=!1,o=l.s*fe(l.s*l,1/3),!o||Math.abs(o)==1/0?(t=he(l.d),i=l.e,(o=(i-t.length+1)%3)&&(t+=o==1||o==-2?"0":"00"),o=fe(t,1/3),i=Pe((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 m(t),n.s=l.s):n=new m(o.toString()),s=(i=m.precision)+3;;)if(a=n,u=a.times(a).times(a),c=u.plus(l),n=Q(c.plus(l).times(a),c.plus(u),s+2,1),he(a.d).slice(0,s)===(t=he(n.d)).slice(0,s))if(t=t.slice(s-3,s+1),t=="9999"||!r&&t=="4999"){if(!r&&(I(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")&&(I(n,i+1,1),e=!n.times(n).times(n).eq(l));break}return F=!0,I(n,i,m.rounding,e)};h.decimalPlaces=h.dp=function(){var i,e=this.d,t=NaN;if(e){if(i=e.length-1,t=(i-Pe(this.e/E))*E,i=e[i],i)for(;i%10==0;i/=10)t--;t<0&&(t=0)}return t};h.dividedBy=h.div=function(i){return Q(this,new this.constructor(i))};h.dividedToIntegerBy=h.divToInt=function(i){var e=this,t=e.constructor;return I(Q(e,new t(i),0,1,1),t.precision,t.rounding)};h.equals=h.eq=function(i){return this.cmp(i)===0};h.floor=function(){return I(new this.constructor(this),this.e+1,3)};h.greaterThan=h.gt=function(i){return this.cmp(i)>0};h.greaterThanOrEqualTo=h.gte=function(i){var e=this.cmp(i);return e==1||e===0};h.hyperbolicCosine=h.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/Ut(4,i)).toString()):(i=16,e="2.3283064365386962890625e-10"),o=mt(s,1,o.times(e),new s(1),!0);for(var u,c=i,l=new s(8);c--;)u=o.times(o),o=a.minus(u.times(l.minus(u.times(l))));return I(o,s.precision=t,s.rounding=n,!0)};h.hyperbolicSine=h.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=mt(o,2,r,r,!0);else{i=1.4*Math.sqrt(n),i=i>16?16:i|0,r=r.times(1/Ut(5,i)),r=mt(o,2,r,r,!0);for(var s,a=new o(5),u=new o(16),c=new o(20);i--;)s=r.times(r),r=r.times(a.plus(s.times(u.times(s).plus(c))))}return o.precision=e,o.rounding=t,I(r,e,t,!0)};h.hyperbolicTangent=h.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,Q(t.sinh(),t.cosh(),n.precision=i,n.rounding=e)):new n(t.s)};h.inverseCosine=h.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()?De(e,n,r):new e(0):new e(NaN):i.isZero()?De(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))};h.inverseHyperbolicCosine=h.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,F=!1,t=t.times(t).minus(1).sqrt().plus(t),F=!0,n.precision=i,n.rounding=e,t.ln()):new n(t)};h.inverseHyperbolicSine=h.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,F=!1,t=t.times(t).plus(1).sqrt().plus(t),F=!0,n.precision=i,n.rounding=e,t.ln())};h.inverseHyperbolicTangent=h.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?I(new o(r),i,e,!0):(o.precision=t=n-r.e,r=Q(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)};h.inverseSine=h.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=De(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)))};h.inverseTangent=h.atan=function(){var i,e,t,n,r,o,s,a,u,c=this,l=c.constructor,m=l.precision,d=l.rounding;if(c.isFinite()){if(c.isZero())return new l(c);if(c.abs().eq(1)&&m+4<=un)return s=De(l,m+4,d).times(.25),s.s=c.s,s}else{if(!c.s)return new l(NaN);if(m+4<=un)return s=De(l,m+4,d).times(.5),s.s=c.s,s}for(l.precision=a=m+10,l.rounding=1,t=Math.min(28,a/E+2|0),i=t;i;--i)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(F=!1,e=Math.ceil(a/E),n=1,u=c.times(c),s=new l(c),r=c;i!==-1;)if(r=r.times(u),o=s.minus(r.div(n+=2)),r=r.times(u),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)),F=!0,I(s,l.precision=m,l.rounding=d,!0)};h.isFinite=function(){return!!this.d};h.isInteger=h.isInt=function(){return!!this.d&&Pe(this.e/E)>this.d.length-2};h.isNaN=function(){return!this.s};h.isNegative=h.isNeg=function(){return this.s<0};h.isPositive=h.isPos=function(){return this.s>0};h.isZero=function(){return!!this.d&&this.d[0]===0};h.lessThan=h.lt=function(i){return this.cmp(i)<0};h.lessThanOrEqualTo=h.lte=function(i){return this.cmp(i)<1};h.logarithm=h.log=function(i){var e,t,n,r,o,s,a,u,c=this,l=c.constructor,m=l.precision,d=l.rounding,f=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=c.d,c.s<0||!t||!t[0]||c.eq(1))return new l(t&&!t[0]?-1/0:c.s!=1?NaN:t?0:1/0);if(e)if(t.length>1)o=!0;else{for(r=t[0];r%10===0;)r/=10;o=r!==1}if(F=!1,a=m+f,s=Ye(c,a),n=e?qt(l,a+10):Ye(i,a),u=Q(s,n,a,1),ht(u.d,r=m,d))do if(a+=10,s=Ye(c,a),n=e?qt(l,a+10):Ye(i,a),u=Q(s,n,a,1),!o){+he(u.d).slice(r+1,r+15)+1==1e14&&(u=I(u,m+1,0));break}while(ht(u.d,r+=10,d));return F=!0,I(u,m,d)};h.minus=h.sub=function(i){var e,t,n,r,o,s,a,u,c,l,m,d,f=this,b=f.constructor;if(i=new b(i),!f.d||!i.d)return!f.s||!i.s?i=new b(NaN):f.d?i.s=-i.s:i=new b(i.d||f.s!==i.s?f:NaN),i;if(f.s!=i.s)return i.s=-i.s,f.plus(i);if(c=f.d,d=i.d,a=b.precision,u=b.rounding,!c[0]||!d[0]){if(d[0])i.s=-i.s;else if(c[0])i=new b(f);else return new b(u===3?-0:0);return F?I(i,a,u):i}if(t=Pe(i.e/E),l=Pe(f.e/E),c=c.slice(),o=l-t,o){for(m=o<0,m?(e=c,o=-o,s=d.length):(e=d,t=l,s=c.length),n=Math.max(Math.ceil(a/E),s)+2,o>n&&(o=n,e.length=1),e.reverse(),n=o;n--;)e.push(0);e.reverse()}else{for(n=c.length,s=d.length,m=n<s,m&&(s=n),n=0;n<s;n++)if(c[n]!=d[n]){m=c[n]<d[n];break}o=0}for(m&&(e=c,c=d,d=e,i.s=-i.s),s=c.length,n=d.length-s;n>0;--n)c[s++]=0;for(n=d.length;n>o;){if(c[--n]<d[n]){for(r=n;r&&c[--r]===0;)c[r]=_e-1;--c[r],c[n]+=_e}c[n]-=d[n]}for(;c[--s]===0;)c.pop();for(;c[0]===0;c.shift())--t;return c[0]?(i.d=c,i.e=Gt(c,t),F?I(i,a,u):i):new b(u===3?-0:0)};h.modulo=h.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]?I(new n(t),n.precision,n.rounding):(F=!1,n.modulo==9?(e=Q(t,i.abs(),0,3,1),e.s*=i.s):e=Q(t,i,0,n.modulo,1),e=e.times(i),F=!0,t.minus(e))};h.naturalExponential=h.exp=function(){return cn(this)};h.naturalLogarithm=h.ln=function(){return Ye(this)};h.negated=h.neg=function(){var i=new this.constructor(this);return i.s=-i.s,I(i)};h.plus=h.add=function(i){var e,t,n,r,o,s,a,u,c,l,m=this,d=m.constructor;if(i=new d(i),!m.d||!i.d)return!m.s||!i.s?i=new d(NaN):m.d||(i=new d(i.d||m.s===i.s?m:NaN)),i;if(m.s!=i.s)return i.s=-i.s,m.minus(i);if(c=m.d,l=i.d,a=d.precision,u=d.rounding,!c[0]||!l[0])return l[0]||(i=new d(m)),F?I(i,a,u):i;if(o=Pe(m.e/E),n=Pe(i.e/E),c=c.slice(),r=o-n,r){for(r<0?(t=c,r=-r,s=l.length):(t=l,n=o,s=c.length),o=Math.ceil(a/E),s=o>s?o+1:s+1,r>s&&(r=s,t.length=1),t.reverse();r--;)t.push(0);t.reverse()}for(s=c.length,r=l.length,s-r<0&&(r=s,t=l,l=c,c=t),e=0;r;)e=(c[--r]=c[r]+l[r]+e)/_e|0,c[r]%=_e;for(e&&(c.unshift(e),++n),s=c.length;c[--s]==0;)c.pop();return i.d=c,i.e=Gt(c,n),F?I(i,a,u):i};h.precision=h.sd=function(i){var e,t=this;if(i!==void 0&&i!==!!i&&i!==1&&i!==0)throw Error(je+i);return t.d?(e=Zn(t.d),i&&t.e+1>e&&(e=t.e+1)):e=NaN,e};h.round=function(){var i=this,e=i.constructor;return I(new e(i),i.e+1,e.rounding)};h.sine=h.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())+E,n.rounding=1,t=sr(n,Qn(n,t)),n.precision=i,n.rounding=e,I(Ge>2?t.neg():t,i,e,!0)):new n(NaN)};h.squareRoot=h.sqrt=function(){var i,e,t,n,r,o,s=this,a=s.d,u=s.e,c=s.s,l=s.constructor;if(c!==1||!a||!a[0])return new l(!c||c<0&&(!a||a[0])?NaN:a?s:1/0);for(F=!1,c=Math.sqrt(+s),c==0||c==1/0?(e=he(a),(e.length+u)%2==0&&(e+="0"),c=Math.sqrt(e),u=Pe((u+1)/2)-(u<0||u%2),c==1/0?e="5e"+u:(e=c.toExponential(),e=e.slice(0,e.indexOf("e")+1)+u),n=new l(e)):n=new l(c.toString()),t=(u=l.precision)+3;;)if(o=n,n=o.plus(Q(s,o,t+2,1)).times(.5),he(o.d).slice(0,t)===(e=he(n.d)).slice(0,t))if(e=e.slice(t-3,t+1),e=="9999"||!r&&e=="4999"){if(!r&&(I(o,u+1,0),o.times(o).eq(s))){n=o;break}t+=4,r=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(I(n,u+1,1),i=!n.times(n).eq(s));break}return F=!0,I(n,u,l.rounding,i)};h.tangent=h.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=Q(t,new n(1).minus(t.times(t)).sqrt(),i+10,0),n.precision=i,n.rounding=e,I(Ge==2||Ge==4?t.neg():t,i,e,!0)):new n(NaN)};h.times=h.mul=function(i){var e,t,n,r,o,s,a,u,c,l=this,m=l.constructor,d=l.d,f=(i=new m(i)).d;if(i.s*=l.s,!d||!d[0]||!f||!f[0])return new m(!i.s||d&&!d[0]&&!f||f&&!f[0]&&!d?NaN:!d||!f?i.s/0:i.s*0);for(t=Pe(l.e/E)+Pe(i.e/E),u=d.length,c=f.length,u<c&&(o=d,d=f,f=o,s=u,u=c,c=s),o=[],s=u+c,n=s;n--;)o.push(0);for(n=c;--n>=0;){for(e=0,r=u+n;r>n;)a=o[r]+f[n]*d[r-n-1]+e,o[r--]=a%_e|0,e=a/_e|0;o[r]=(o[r]+e)%_e|0}for(;!o[--s];)o.pop();return e?++t:o.shift(),i.d=o,i.e=Gt(o,t),F?I(i,m.precision,m.rounding):i};h.toBinary=function(i,e){return ln(this,2,i,e)};h.toDecimalPlaces=h.toDP=function(i,e){var t=this,n=t.constructor;return t=new n(t),i===void 0?t:(Ne(i,0,Je),e===void 0?e=n.rounding:Ne(e,0,8),I(t,i+t.e+1,e))};h.toExponential=function(i,e){var t,n=this,r=n.constructor;return i===void 0?t=Oe(n,!0):(Ne(i,0,Je),e===void 0?e=r.rounding:Ne(e,0,8),n=I(new r(n),i+1,e),t=Oe(n,!0,i+1)),n.isNeg()&&!n.isZero()?"-"+t:t};h.toFixed=function(i,e){var t,n,r=this,o=r.constructor;return i===void 0?t=Oe(r):(Ne(i,0,Je),e===void 0?e=o.rounding:Ne(e,0,8),n=I(new o(r),i+r.e+1,e),t=Oe(n,!1,i+n.e+1)),r.isNeg()&&!r.isZero()?"-"+t:t};h.toFraction=function(i){var e,t,n,r,o,s,a,u,c,l,m,d,f=this,b=f.d,p=f.constructor;if(!b)return new p(f);if(c=t=new p(1),n=u=new p(0),e=new p(n),o=e.e=Zn(b)-f.e-1,s=o%E,e.d[0]=fe(10,s<0?E+s:s),i==null)i=o>0?e:c;else{if(a=new p(i),!a.isInt()||a.lt(c))throw Error(je+a);i=a.gt(e)?o>0?e:c:a}for(F=!1,a=new p(he(b)),l=p.precision,p.precision=o=b.length*E*2;m=Q(a,e,0,1,1),r=t.plus(m.times(n)),r.cmp(i)!=1;)t=n,n=r,r=c,c=u.plus(m.times(r)),u=r,r=e,e=a.minus(m.times(r)),a=r;return r=Q(i.minus(t),n,0,1,1),u=u.plus(r.times(c)),t=t.plus(r.times(n)),u.s=c.s=f.s,d=Q(c,n,o,1).minus(f).abs().cmp(Q(u,t,o,1).minus(f).abs())<1?[c,n]:[u,t],p.precision=l,F=!0,d};h.toHexadecimal=h.toHex=function(i,e){return ln(this,16,i,e)};h.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:Ne(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]?(F=!1,t=Q(t,i,0,e,1).times(i),F=!0,I(t)):(i.s=t.s,t=i),t};h.toNumber=function(){return+this};h.toOctal=function(i,e){return ln(this,8,i,e)};h.toPower=h.pow=function(i){var e,t,n,r,o,s,a=this,u=a.constructor,c=+(i=new u(i));if(!a.d||!i.d||!a.d[0]||!i.d[0])return new u(fe(+a,c));if(a=new u(a),a.eq(1))return a;if(n=u.precision,o=u.rounding,i.eq(1))return I(a,n,o);if(e=Pe(i.e/E),e>=i.d.length-1&&(t=c<0?-c:c)<=nr)return r=Yn(u,a,t,n),i.s<0?new u(1).div(r):I(r,n,o);if(s=a.s,s<0){if(e<i.d.length-1)return new u(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=fe(+a,c),e=t==0||!isFinite(t)?Pe(c*(Math.log("0."+he(a.d))/Math.LN10+a.e+1)):new u(t+"").e,e>u.maxE+1||e<u.minE-1?new u(e>0?s/0:0):(F=!1,u.rounding=a.s=1,t=Math.min(12,(e+"").length),r=cn(i.times(Ye(a,n+t)),n),r.d&&(r=I(r,n+5,1),ht(r.d,n,o)&&(e=n+10,r=I(cn(i.times(Ye(a,e+t)),e),e+5,1),+he(r.d).slice(n+1,n+15)+1==1e14&&(r=I(r,n+1,0)))),r.s=s,F=!0,u.rounding=o,I(r,n,o))};h.toPrecision=function(i,e){var t,n=this,r=n.constructor;return i===void 0?t=Oe(n,n.e<=r.toExpNeg||n.e>=r.toExpPos):(Ne(i,1,Je),e===void 0?e=r.rounding:Ne(e,0,8),n=I(new r(n),i,e),t=Oe(n,i<=n.e||n.e<=r.toExpNeg,i)),n.isNeg()&&!n.isZero()?"-"+t:t};h.toSignificantDigits=h.toSD=function(i,e){var t=this,n=t.constructor;return i===void 0?(i=n.precision,e=n.rounding):(Ne(i,1,Je),e===void 0?e=n.rounding:Ne(e,0,8)),I(new n(t),i,e)};h.toString=function(){var i=this,e=i.constructor,t=Oe(i,i.e<=e.toExpNeg||i.e>=e.toExpPos);return i.isNeg()&&!i.isZero()?"-"+t:t};h.truncated=h.trunc=function(){return I(new this.constructor(this),this.e+1,1)};h.valueOf=h.toJSON=function(){var i=this,e=i.constructor,t=Oe(i,i.e<=e.toExpNeg||i.e>=e.toExpPos);return i.isNeg()?"-"+t:t};function he(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=E-n.length,t&&(o+=Ze(t)),o+=n;s=i[e],n=s+"",t=E-n.length,t&&(o+=Ze(t))}else if(s===0)return"0";for(;s%10===0;)s/=10;return o+s}function Ne(i,e,t){if(i!==~~i||i<e||i>t)throw Error(je+i)}function ht(i,e,t,n){var r,o,s,a;for(o=i[0];o>=10;o/=10)--e;return--e<0?(e+=E,r=0):(r=Math.ceil((e+1)/E),e%=E),o=fe(10,E-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)==fe(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)==fe(10,e-3)-1,s}function vt(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]+=sn.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 rr(i,e){var t,n,r;if(e.isZero())return e;n=e.d.length,n<32?(t=Math.ceil(n/3),r=(1/Ut(4,t)).toString()):(t=16,r="2.3283064365386962890625e-10"),i.precision+=t,e=mt(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 Q=function(){function i(n,r,o){var s,a=0,u=n.length;for(n=n.slice();u--;)s=n[u]*r+a,n[u]=s%o|0,a=s/o|0;return a&&n.unshift(a),n}function e(n,r,o,s){var a,u;if(o!=s)u=o>s?1:-1;else for(a=u=0;a<o;a++)if(n[a]!=r[a]){u=n[a]>r[a]?1:-1;break}return u}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,u){var c,l,m,d,f,b,p,y,g,T,k,A,C,P,L,M,W,U,_,ue,$=n.constructor,be=n.s==r.s?1:-1,oe=n.d,j=r.d;if(!oe||!oe[0]||!j||!j[0])return new $(!n.s||!r.s||(oe?j&&oe[0]==j[0]:!j)?NaN:oe&&oe[0]==0||!j?be*0:be/0);for(u?(f=1,l=n.e-r.e):(u=_e,f=E,l=Pe(n.e/f)-Pe(r.e/f)),_=j.length,W=oe.length,g=new $(be),T=g.d=[],m=0;j[m]==(oe[m]||0);m++);if(j[m]>(oe[m]||0)&&l--,o==null?(P=o=$.precision,s=$.rounding):a?P=o+(n.e-r.e)+1:P=o,P<0)T.push(1),b=!0;else{if(P=P/f+2|0,m=0,_==1){for(d=0,j=j[0],P++;(m<W||d)&&P--;m++)L=d*u+(oe[m]||0),T[m]=L/j|0,d=L%j|0;b=d||m<W}else{for(d=u/(j[0]+1)|0,d>1&&(j=i(j,d,u),oe=i(oe,d,u),_=j.length,W=oe.length),M=_,k=oe.slice(0,_),A=k.length;A<_;)k[A++]=0;ue=j.slice(),ue.unshift(0),U=j[0],j[1]>=u/2&&++U;do d=0,c=e(j,k,_,A),c<0?(C=k[0],_!=A&&(C=C*u+(k[1]||0)),d=C/U|0,d>1?(d>=u&&(d=u-1),p=i(j,d,u),y=p.length,A=k.length,c=e(p,k,y,A),c==1&&(d--,t(p,_<y?ue:j,y,u))):(d==0&&(c=d=1),p=j.slice()),y=p.length,y<A&&p.unshift(0),t(k,p,A,u),c==-1&&(A=k.length,c=e(j,k,_,A),c<1&&(d++,t(k,_<A?ue:j,A,u))),A=k.length):c===0&&(d++,k=[0]),T[m++]=d,c&&k[0]?k[A++]=oe[M]||0:(k=[oe[M]],A=1);while((M++<W||k[0]!==void 0)&&P--);b=k[0]!==void 0}T[0]||T.shift()}if(f==1)g.e=l,Gn=b;else{for(m=1,d=T[0];d>=10;d/=10)m++;g.e=m+l*f-1,I(g,a?o+g.e+1:o,s,b)}return g}}();function I(i,e,t,n){var r,o,s,a,u,c,l,m,d,f=i.constructor;e:if(e!=null){if(m=i.d,!m)return i;for(r=1,a=m[0];a>=10;a/=10)r++;if(o=e-r,o<0)o+=E,s=e,l=m[d=0],u=l/fe(10,r-s-1)%10|0;else if(d=Math.ceil((o+1)/E),a=m.length,d>=a)if(n){for(;a++<=d;)m.push(0);l=u=0,r=1,o%=E,s=o-E+1}else break e;else{for(l=a=m[d],r=1;a>=10;a/=10)r++;o%=E,s=o-E+r,u=s<0?0:l/fe(10,r-s-1)%10|0}if(n=n||e<0||m[d+1]!==void 0||(s<0?l:l%fe(10,r-s-1)),c=t<4?(u||n)&&(t==0||t==(i.s<0?3:2)):u>5||u==5&&(t==4||n||t==6&&(o>0?s>0?l/fe(10,r-s):0:m[d-1])%10&1||t==(i.s<0?8:7)),e<1||!m[0])return m.length=0,c?(e-=i.e+1,m[0]=fe(10,(E-e%E)%E),i.e=-e||0):m[0]=i.e=0,i;if(o==0?(m.length=d,a=1,d--):(m.length=d+1,a=fe(10,E-o),m[d]=s>0?(l/fe(10,r-s)%fe(10,s)|0)*a:0),c)for(;;)if(d==0){for(o=1,s=m[0];s>=10;s/=10)o++;for(s=m[0]+=a,a=1;s>=10;s/=10)a++;o!=a&&(i.e++,m[0]==_e&&(m[0]=1));break}else{if(m[d]+=a,m[d]!=_e)break;m[d--]=0,a=1}for(o=m.length;m[--o]===0;)m.pop()}return F&&(i.e>f.maxE?(i.d=null,i.e=NaN):i.e<f.minE&&(i.e=0,i.d=[0])),i}function Oe(i,e,t){if(!i.isFinite())return Jn(i);var n,r=i.e,o=he(i.d),s=o.length;return e?(t&&(n=t-s)>0?o=o.charAt(0)+"."+o.slice(1)+Ze(n):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(i.e<0?"e":"e+")+i.e):r<0?(o="0."+Ze(-r-1)+o,t&&(n=t-s)>0&&(o+=Ze(n))):r>=s?(o+=Ze(r+1-s),t&&(n=t-r-1)>0&&(o=o+"."+Ze(n))):((n=r+1)<s&&(o=o.slice(0,n)+"."+o.slice(n)),t&&(n=t-s)>0&&(r+1===s&&(o+="."),o+=Ze(n))),o}function Gt(i,e){var t=i[0];for(e*=E;t>=10;t/=10)e++;return e}function qt(i,e,t){if(e>ir)throw F=!0,t&&(i.precision=t),Error(Un);return I(new i(Dt),e,1,!0)}function De(i,e,t){if(e>un)throw Error(Un);return I(new i(Ot),e,t,!0)}function Zn(i){var e=i.length-1,t=e*E+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 Ze(i){for(var e="";i--;)e+="0";return e}function Yn(i,e,t,n){var r,o=new i(1),s=Math.ceil(n/E+4);for(F=!1;;){if(t%2&&(o=o.times(e),qn(o.d,s)&&(r=!0)),t=Pe(t/2),t===0){t=o.d.length-1,r&&o.d[t]===0&&++o.d[t];break}e=e.times(e),qn(e.d,s)}return F=!0,o}function On(i){return i.d[i.d.length-1]&1}function jn(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 cn(i,e){var t,n,r,o,s,a,u,c=0,l=0,m=0,d=i.constructor,f=d.rounding,b=d.precision;if(!i.d||!i.d[0]||i.e>17)return new d(i.d?i.d[0]?i.s<0?0:1/0:1:i.s?i.s<0?0:i:0/0);for(e==null?(F=!1,u=b):u=e,a=new d(.03125);i.e>-2;)i=i.times(a),m+=5;for(n=Math.log(fe(2,m))/Math.LN10*2+5|0,u+=n,t=o=s=new d(1),d.precision=u;;){if(o=I(o.times(i),u,1),t=t.times(++l),a=s.plus(Q(o,t,u,1)),he(a.d).slice(0,u)===he(s.d).slice(0,u)){for(r=m;r--;)s=I(s.times(s),u,1);if(e==null)if(c<3&&ht(s.d,u-n,f,c))d.precision=u+=10,t=o=a=new d(1),l=0,c++;else return I(s,d.precision=b,f,F=!0);else return d.precision=b,s}s=a}}function Ye(i,e){var t,n,r,o,s,a,u,c,l,m,d,f=1,b=10,p=i,y=p.d,g=p.constructor,T=g.rounding,k=g.precision;if(p.s<0||!y||!y[0]||!p.e&&y[0]==1&&y.length==1)return new g(y&&!y[0]?-1/0:p.s!=1?NaN:y?0:p);if(e==null?(F=!1,l=k):l=e,g.precision=l+=b,t=he(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=he(p.d),n=t.charAt(0),f++;o=p.e,n>1?(p=new g("0."+t),o++):p=new g(n+"."+t.slice(1))}else return c=qt(g,l+2,k).times(o+""),p=Ye(new g(n+"."+t.slice(1)),l-b).plus(c),g.precision=k,e==null?I(p,k,T,F=!0):p;for(m=p,u=s=p=Q(p.minus(1),p.plus(1),l,1),d=I(p.times(p),l,1),r=3;;){if(s=I(s.times(d),l,1),c=u.plus(Q(s,new g(r),l,1)),he(c.d).slice(0,l)===he(u.d).slice(0,l))if(u=u.times(2),o!==0&&(u=u.plus(qt(g,l+2,k).times(o+""))),u=Q(u,new g(f),l,1),e==null)if(ht(u.d,l-b,T,a))g.precision=l+=b,c=s=p=Q(m.minus(1),m.plus(1),l,1),d=I(p.times(p),l,1),r=a=1;else return I(u,g.precision=k,T,F=!0);else return g.precision=k,u;u=c,r+=2}}function Jn(i){return String(i.s*i.s/0)}function Wt(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)%E,t<0&&(n+=E),n<r){for(n&&i.d.push(+e.slice(0,n)),r-=E;n<r;)i.d.push(+e.slice(n,n+=E));e=e.slice(n),n=E-e.length}else n-=r;for(;n--;)e+="0";i.d.push(+e),F&&(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 or(i,e){var t,n,r,o,s,a,u,c,l;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),zn.test(e))return Wt(i,e)}else if(e==="Infinity"||e==="NaN")return+e||(i.s=NaN),i.e=NaN,i.d=null,i;if(er.test(e))t=16,e=e.toLowerCase();else if($i.test(e))t=2;else if(tr.test(e))t=8;else throw Error(je+e);for(o=e.search(/p/i),o>0?(u=+e.slice(o+1),e=e.substring(2,o)):e=e.slice(2),o=e.indexOf("."),s=o>=0,n=i.constructor,s&&(e=e.replace(".",""),a=e.length,o=a-o,r=Yn(n,new n(t),o,o*2)),c=vt(e,t,_e),l=c.length-1,o=l;c[o]===0;--o)c.pop();return o<0?new n(i.s*0):(i.e=Gt(c,l),i.d=c,F=!1,s&&(i=Q(i,r,a*4)),u&&(i=i.times(Math.abs(u)<54?fe(2,u):kt.pow(2,u))),F=!0,i)}function sr(i,e){var t,n=e.d.length;if(n<3)return e.isZero()?e:mt(i,2,e,e);t=1.4*Math.sqrt(n),t=t>16?16:t|0,e=e.times(1/Ut(5,t)),e=mt(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 mt(i,e,t,n,r){var o,s,a,u,c=1,l=i.precision,m=Math.ceil(l/E);for(F=!1,u=t.times(t),a=new i(n);;){if(s=Q(a.times(u),new i(e++*e++),l,1),a=r?n.plus(s):n.minus(s),n=Q(s.times(u),new i(e++*e++),l,1),s=a.plus(n),s.d[m]!==void 0){for(o=m;s.d[o]===a.d[o]&&o--;);if(o==-1)break}o=a,a=n,n=s,s=o,c++}return F=!0,s.d.length=m+1,s}function Ut(i,e){for(var t=i;--e;)t*=i;return t}function Qn(i,e){var t,n=e.s<0,r=De(i,i.precision,1),o=r.times(.5);if(e=e.abs(),e.lte(o))return Ge=n?4:1,e;if(t=e.divToInt(r),t.isZero())Ge=n?3:2;else{if(e=e.minus(t.times(r)),e.lte(o))return Ge=On(t)?n?2:3:n?4:1,e;Ge=On(t)?n?1:4:n?3:2}return e.minus(r).abs()}function ln(i,e,t,n){var r,o,s,a,u,c,l,m,d,f=i.constructor,b=t!==void 0;if(b?(Ne(t,1,Je),n===void 0?n=f.rounding:Ne(n,0,8)):(t=f.precision,n=f.rounding),!i.isFinite())l=Jn(i);else{for(l=Oe(i),s=l.indexOf("."),b?(r=2,e==16?t=t*4-3:e==8&&(t=t*3-2)):r=e,s>=0&&(l=l.replace(".",""),d=new f(1),d.e=l.length-s,d.d=vt(Oe(d),10,r),d.e=d.d.length),m=vt(l,10,r),o=u=m.length;m[--u]==0;)m.pop();if(!m[0])l=b?"0p+0":"0";else{if(s<0?o--:(i=new f(i),i.d=m,i.e=o,i=Q(i,d,t,n,0,r),m=i.d,o=i.e,c=Gn),s=m[t],a=r/2,c=c||m[t+1]!==void 0,c=n<4?(s!==void 0||c)&&(n===0||n===(i.s<0?3:2)):s>a||s===a&&(n===4||c||n===6&&m[t-1]&1||n===(i.s<0?8:7)),m.length=t,c)for(;++m[--t]>r-1;)m[t]=0,t||(++o,m.unshift(1));for(u=m.length;!m[u-1];--u);for(s=0,l="";s<u;s++)l+=sn.charAt(m[s]);if(b){if(u>1)if(e==16||e==8){for(s=e==16?4:3,--u;u%s;u++)l+="0";for(m=vt(l,r,e),u=m.length;!m[u-1];--u);for(s=1,l="1.";s<u;s++)l+=sn.charAt(m[s])}else l=l.charAt(0)+"."+l.slice(1);l=l+(o<0?"p":"p+")+o}else if(o<0){for(;++o;)l="0"+l;l="0."+l}else if(++o>u)for(o-=u;o--;)l+="0";else o<u&&(l=l.slice(0,o)+"."+l.slice(o))}l=(e==16?"0x":e==2?"0b":e==8?"0o":"")+l}return i.s<0?"-"+l:l}function qn(i,e){if(i.length>e)return i.length=e,!0}function ar(i){return new this(i).abs()}function ur(i){return new this(i).acos()}function cr(i){return new this(i).acosh()}function lr(i,e){return new this(i).plus(e)}function mr(i){return new this(i).asin()}function dr(i){return new this(i).asinh()}function fr(i){return new this(i).atan()}function pr(i){return new this(i).atanh()}function br(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=De(this,o,1).times(e.s>0?.25:.75),t.s=i.s):!e.d||i.isZero()?(t=e.s<0?De(this,n,r):new this(0),t.s=i.s):!i.d||e.isZero()?(t=De(this,o,1).times(.5),t.s=i.s):e.s<0?(this.precision=o,this.rounding=1,t=this.atan(Q(i,e,o,1)),e=De(this,o,1),this.precision=n,this.rounding=r,t=i.s<0?t.minus(e):t.plus(e)):t=this.atan(Q(i,e,o,1)),t}function gr(i){return new this(i).cbrt()}function yr(i){return I(i=new this(i),i.e+1,2)}function wr(i,e,t){return new this(i).clamp(e,t)}function hr(i){if(!i||typeof i!="object")throw Error(Vt+"Object expected");var e,t,n,r=i.defaults===!0,o=["precision",1,Je,"rounding",0,8,"toExpNeg",-lt,0,"toExpPos",0,lt,"maxE",0,lt,"minE",-lt,0,"modulo",0,9];for(e=0;e<o.length;e+=3)if(t=o[e],r&&(this[t]=an[t]),(n=i[t])!==void 0)if(Pe(n)===n&&n>=o[e+1]&&n<=o[e+2])this[t]=n;else throw Error(je+t+": "+n);if(t="crypto",r&&(this[t]=an[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(Xn);else this[t]=!1;else throw Error(je+t+": "+n);return this}function kr(i){return new this(i).cos()}function Pr(i){return new this(i).cosh()}function $n(i){var e,t,n;function r(o){var s,a,u,c=this;if(!(c instanceof r))return new r(o);if(c.constructor=r,Vn(o)){c.s=o.s,F?!o.d||o.e>r.maxE?(c.e=NaN,c.d=null):o.e<r.minE?(c.e=0,c.d=[0]):(c.e=o.e,c.d=o.d.slice()):(c.e=o.e,c.d=o.d?o.d.slice():o.d);return}if(u=typeof o,u==="number"){if(o===0){c.s=1/o<0?-1:1,c.e=0,c.d=[0];return}if(o<0?(o=-o,c.s=-1):c.s=1,o===~~o&&o<1e7){for(s=0,a=o;a>=10;a/=10)s++;F?s>r.maxE?(c.e=NaN,c.d=null):s<r.minE?(c.e=0,c.d=[0]):(c.e=s,c.d=[o]):(c.e=s,c.d=[o]);return}if(o*0!==0){o||(c.s=NaN),c.e=NaN,c.d=null;return}return Wt(c,o.toString())}if(u==="string")return(a=o.charCodeAt(0))===45?(o=o.slice(1),c.s=-1):(a===43&&(o=o.slice(1)),c.s=1),zn.test(o)?Wt(c,o):or(c,o);if(u==="bigint")return o<0?(o=-o,c.s=-1):c.s=1,Wt(c,o.toString());throw Error(je+o)}if(r.prototype=h,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=hr,r.clone=$n,r.isDecimal=Vn,r.abs=ar,r.acos=ur,r.acosh=cr,r.add=lr,r.asin=mr,r.asinh=dr,r.atan=fr,r.atanh=pr,r.atan2=br,r.cbrt=gr,r.ceil=yr,r.clamp=wr,r.cos=kr,r.cosh=Pr,r.div=Tr,r.exp=Ar,r.floor=xr,r.hypot=Br,r.ln=Sr,r.log=Ir,r.log10=Kr,r.log2=Nr,r.max=Cr,r.min=Lr,r.mod=Rr,r.mul=Mr,r.pow=Er,r.random=Fr,r.round=_r,r.sign=vr,r.sin=Wr,r.sinh=Dr,r.sqrt=Or,r.sub=qr,r.sum=Vr,r.tan=Gr,r.tanh=Ur,r.trunc=Xr,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 Tr(i,e){return new this(i).div(e)}function Ar(i){return new this(i).exp()}function xr(i){return I(i=new this(i),i.e+1,3)}function Br(){var i,e,t=new this(0);for(F=!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 F=!0,new this(1/0);t=e}return F=!0,t.sqrt()}function Vn(i){return i instanceof kt||i&&i.toStringTag===Hn||!1}function Sr(i){return new this(i).ln()}function Ir(i,e){return new this(i).log(e)}function Nr(i){return new this(i).log(2)}function Kr(i){return new this(i).log(10)}function Cr(){return jn(this,arguments,-1)}function Lr(){return jn(this,arguments,1)}function Rr(i,e){return new this(i).mod(e)}function Mr(i,e){return new this(i).mul(e)}function Er(i,e){return new this(i).pow(e)}function Fr(i){var e,t,n,r,o=0,s=new this(1),a=[];if(i===void 0?i=this.precision:Ne(i,1,Je),n=Math.ceil(i/E),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(Xn);else for(;o<n;)a[o++]=Math.random()*1e7|0;for(n=a[--o],i%=E,n&&i&&(r=fe(10,E-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-=E)a.shift();for(n=1,r=a[0];r>=10;r/=10)n++;n<E&&(t-=E-n)}return s.e=t,s.d=a,s}function _r(i){return I(i=new this(i),i.e+1,this.rounding)}function vr(i){return i=new this(i),i.d?i.d[0]?i.s:0*i.s:i.s||NaN}function Wr(i){return new this(i).sin()}function Dr(i){return new this(i).sinh()}function Or(i){return new this(i).sqrt()}function qr(i,e){return new this(i).sub(e)}function Vr(){var i=0,e=arguments,t=new this(e[i]);for(F=!1;t.s&&++i<e.length;)t=t.plus(e[i]);return F=!0,I(t,this.precision,this.rounding)}function Gr(i){return new this(i).tan()}function Ur(i){return new this(i).tanh()}function Xr(i){return I(i=new this(i),i.e+1,1)}h[Symbol.for("nodejs.util.inspect.custom")]=h.toString;h[Symbol.toStringTag]="Decimal";var kt=h.constructor=$n(an);Dt=new kt(Dt);Ot=new kt(Ot);var S=kt;var oi=de(require("big.js")),xt=de(require("bn.js"));var ei=de(require("toformat")),Hr=ei.default,Pt=Hr;var Tt=de(require("big.js")),ni=de(require("bn.js")),ii=de(require("decimal.js-light"));var dt=de(require("bn.js"));var ti=9007199254740991;function ge(i){let e=xe("Raydium_parseBigNumberish");if(i instanceof dt.default)return i;if(typeof i=="string"){if(i.match(/^-?[0-9]+$/))return new dt.default(i);e.logWithError(`invalid BigNumberish string: ${i}`)}return typeof i=="number"?(i%1&&e.logWithError(`BigNumberish number underflow: ${i}`),(i>=ti||i<=-ti)&&e.logWithError(`BigNumberish number overflow: ${i}`),new dt.default(String(i))):typeof i=="bigint"?new dt.default(i.toString()):(e.error(`invalid BigNumberish value: ${i}`),new dt.default(0))}var Xt=xe("module/fraction"),mn=Pt(Tt.default),At=Pt(ii.default),Zr={[0]:At.ROUND_DOWN,[1]:At.ROUND_HALF_UP,[2]:At.ROUND_UP},Yr={[0]:Tt.default.roundDown,[1]:Tt.default.roundHalfUp,[2]:Tt.default.roundUp},H=class{constructor(e,t=new ni.default(1)){this.numerator=ge(e),this.denominator=ge(t)}get quotient(){return this.numerator.div(this.denominator)}invert(){return new H(this.denominator,this.numerator)}add(e){let t=e instanceof H?e:new H(ge(e));return this.denominator.eq(t.denominator)?new H(this.numerator.add(t.numerator),this.denominator):new H(this.numerator.mul(t.denominator).add(t.numerator.mul(this.denominator)),this.denominator.mul(t.denominator))}sub(e){let t=e instanceof H?e:new H(ge(e));return this.denominator.eq(t.denominator)?new H(this.numerator.sub(t.numerator),this.denominator):new H(this.numerator.mul(t.denominator).sub(t.numerator.mul(this.denominator)),this.denominator.mul(t.denominator))}mul(e){let t=e instanceof H?e:new H(ge(e));return new H(this.numerator.mul(t.numerator),this.denominator.mul(t.denominator))}div(e){let t=e instanceof H?e:new H(ge(e));return new H(this.numerator.mul(t.denominator),this.denominator.mul(t.numerator))}toSignificant(e,t={groupSeparator:""},n=1){Number.isInteger(e)||Xt.logWithError(`${e} is not an integer.`),e<=0&&Xt.logWithError(`${e} is not positive.`),At.set({precision:e+1,rounding:Zr[n]});let r=new At(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)||Xt.logWithError(`${e} is not an integer.`),e<0&&Xt.logWithError(`${e} is negative.`),mn.DP=e,mn.RM=Yr[n]||1,new mn(this.numerator.toString()).div(this.denominator.toString()).toFormat(e,t)}isZero(){return this.numerator.isZero()}};var jr=xe("Raydium_amount"),ri=Pt(oi.default);function Jr(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")):jr.logWithError(`invalid number string, num: ${i}`)}else t=i;return[t,n.slice(0,e)||n]}var Te=class extends H{constructor(t,n,r=!0,o){let s=new xt.default(0),a=dn.pow(new xt.default(t.decimals));if(r)s=ge(n);else{let u=new xt.default(0),c=new xt.default(0);if(typeof n=="string"||typeof n=="number"||typeof n=="bigint"){let[l,m]=Jr(n.toString(),t.decimals);u=ge(l),c=ge(m)}u=u.mul(a),s=u.add(c)}super(s,a);this.logger=xe(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 Te(this.token,this.raw.add(t.raw))}subtract(t){return this.token.equals(t.token)||this.logger.logWithError("sub token not equals"),new Te(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 ri.DP=this.token.decimals,new ri(this.numerator.toString()).div(this.denominator.toString()).toFormat(t)}};var si=require("@solana/web3.js"),fn=require("@solana/spl-token"),ai={chainId:101,address:si.PublicKey.default.toBase58(),programId:fn.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"}},nt={chainId:101,address:"So11111111111111111111111111111111111111112",programId:fn.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 zt=require("@solana/web3.js");var z=require("@solana/web3.js"),ui=require("@solana/spl-token");function pn({pubkey:i,isSigner:e=!1,isWritable:t=!0}){return{pubkey:i,isWritable:t,isSigner:e}}var Yo=[pn({pubkey:ui.TOKEN_PROGRAM_ID,isWritable:!1}),pn({pubkey:z.SystemProgram.programId,isWritable:!1}),pn({pubkey:z.SYSVAR_RENT_PUBKEY,isWritable:!1})];function bn({publicKey:i,transformSol:e}){let t=ci(i.toString());if(t instanceof z.PublicKey)return e&&t.equals(Bt)?on:t;if(e&&t.toString()===Bt.toBase58())return on;if(typeof t=="string"){if(t===z.PublicKey.default.toBase58())return z.PublicKey.default;try{return new z.PublicKey(t)}catch{throw new Error("invalid public key")}}throw new Error("invalid public key")}function ci(i){try{return new z.PublicKey(i)}catch{return i}}var Ht=new z.PublicKey("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),gn=new z.PublicKey("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),Qe=new z.PublicKey("SysvarRent111111111111111111111111111111111"),jo=new z.PublicKey("SysvarC1ock11111111111111111111111111111111"),it=new z.PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),Jo=new z.PublicKey("Sysvar1nstructions1111111111111111111111111"),Qo=z.SystemProgram.programId,$o=new z.PublicKey("4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R"),es=new z.PublicKey("Ea5SjE2Y6yvCeW5dYTn7PYMuW5ikXkvbGdcmSnXeaLjS"),ts=new z.PublicKey("SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt"),ns=new z.PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"),is=new z.PublicKey("Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"),rs=new z.PublicKey("mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So"),os=new z.PublicKey("7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj"),ss=new z.PublicKey("USDH1SM1ojwWUga67PGrgFWUHibbjqMvuMaDkRJTgkX"),as=new z.PublicKey("NRVwhjBQiUPYtfDT5zRBVJajzFQHaBUNtC7SNVvqRFa"),us=new z.PublicKey("ANAxByE6G2WjFp7A4NqtWYXb3mgruyzZYg3spfxe6Lbo"),cs=new z.PublicKey("7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs"),on=new z.PublicKey("So11111111111111111111111111111111111111112"),Bt=z.PublicKey.default;function _t(i){return bn({publicKey:i,transformSol:!0})}var yn=class{constructor({mint:e,decimals:t,symbol:n,name:r,skipMint:o=!1,isToken2022:s=!1}){if(e===Bt.toBase58()||e instanceof zt.PublicKey&&Bt.equals(e)){this.decimals=nt.decimals,this.symbol=nt.symbol,this.name=nt.name,this.mint=new zt.PublicKey(nt.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?zt.PublicKey.default:bn({publicKey:e}),this.isToken2022=s}equals(e){return this===e?!0:this.mint.equals(e.mint)}},Ue=yn;Ue.WSOL=new yn(se(te({},nt),{mint:nt.address}));var wn=class{constructor({decimals:e,symbol:t="UNKNOWN",name:n="UNKNOWN"}){this.decimals=e,this.symbol=t,this.name=n}equals(e){return this===e}},Zt=wn;Zt.SOL=new wn(ai);var mi=de(require("bn.js"));var li=new H(new mi.default(100)),$e=class extends H{toSignificant(e=5,t,n){return this.mul(li).toSignificant(e,t,n)}toFixed(e=2,t,n){return this.mul(li).toFixed(e,t,n)}};var Qr=xe("Raydium_price"),ve=class extends H{constructor(t){let{baseToken:n,quoteToken:r,numerator:o,denominator:s}=t;super(o,s);this.baseToken=n,this.quoteToken=r,this.scalar=new H(hn(n.decimals),hn(r.decimals))}get raw(){return new H(this.numerator,this.denominator)}get adjusted(){return super.mul(this.scalar)}invert(){return new ve({baseToken:this.quoteToken,quoteToken:this.baseToken,denominator:this.numerator,numerator:this.denominator})}mul(t){this.quoteToken!==t.baseToken&&Qr.logWithError("mul token not equals");let n=super.mul(t);return new ve({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 $r=new qe.default(0),Ys=new qe.default(1),js=new qe.default(2),Js=new qe.default(3),Qs=new qe.default(5),dn=new qe.default(10),$s=new qe.default(100),ea=new qe.default(1e3),ta=new qe.default(1e4);function hn(i){return dn.pow(ge(i))}function nn(i,e=1,t=[]){let n=[...i];if(e<=0)return t;for(;n.length;)t.push(n.splice(0,e));return t}var di=require("@solana/web3.js"),fi=require("@solana/spl-token");var rt=require("@solana/web3.js");var ye={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 eo=require("@solana/spl-token"),pa=xe("Raydium_txUtil");function Be(i,e){let[t,n]=rt.PublicKey.findProgramAddressSync(i,e);return{publicKey:t,nonce:n}}function le(i,e,t){return Be([i.toBuffer(),(t!=null?t:fi.TOKEN_PROGRAM_ID).toBuffer(),e.toBuffer()],new di.PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"))}var N=require("@solana/web3.js"),wa=new N.PublicKey("EhhTKczWMGQt46ynNeRX1WfeagwwJd7ufHvCDjRxjo5Q"),ha=new N.PublicKey("CBuCnLe26faBpcBP2fktp4rp8abpcAnTWft6ZrP5Q4T"),ka=new N.PublicKey("9KEPoZmtHUrBbhWN1v1KWLMkkvwY6WLtAVUCPRtRjP4z"),Pa=new N.PublicKey("FarmqiPv5eAj3j1GMdMCMUGXqPUvmquZtMy86QH6rzhG"),Ta=new N.PublicKey("CLaimxFqjHzgTJtAGHU47NPhg6qrc5sCnpC4tBLyABQS"),Aa=new N.PublicKey("srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX"),xa=new N.PublicKey("9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin"),Ba=new N.PublicKey("675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8"),Sa=new N.PublicKey("5quBtoiQqxF9Jv6KYKctB59NT3gtJD2Y65kdnB1Uev3h"),Ia=new N.PublicKey("CDSr3ssLcRB6XYPJwAfFt18MZvEZp4LjHcvzBVZ45duo"),Na=new N.PublicKey("CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK"),Ka=new N.PublicKey("LockrWmn6K5twhz3y9w1dQERbmgSaRkfnTeTKbpofwE"),Ca=new N.PublicKey("kN1kEznaF5Xbd8LYuqtEFcxzWSBk5Fv6ygX6SqEGJVy"),La=new N.PublicKey("CDSr3ssLcRB6XYPJwAfFt18MZvEZp4LjHcvzBVZ45duo"),Ra=new N.PublicKey("routeUGWgWzqBWFcrCfv8tritsqukccJPu3q5GPP3xS"),Ma=new N.PublicKey("7YttLkHDoNj9wyDur5pM1ejNaAvT9X4eqaYcHQqtj2G5"),Ea=new N.PublicKey("6FJon3QE27qgPVggARueB22hLvoh22VzJpXv4rBEoSLF"),Fa=new N.PublicKey("CC12se5To1CdEuw7fDS27B7Geo5jJyL7t5UK2B44NgiH"),_a=new N.PublicKey("9HzJyW1qZsEiSfMUf6L2jo3CcTKAyBmSyKdwQeYisHrC"),va=new N.PublicKey("DropEU8AvevN3UrXWXTMuz3rqnMczQVNjq3kcSdW2SQi"),Wa=new N.PublicKey("CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C"),Da=new N.PublicKey("GpMZbSM2GgvTKHJirzeGfMFoaZ8UR2X7F4v8vHTvxFbL"),Oa=new N.PublicKey("DNXgeM9EiiaAbaWvwjHj9fQQLAX5ZsfHyvmYUNRAdNC8"),qa=new N.PublicKey("LockrWmn6K5twhz3y9w1dQERbmgSaRkfnTeTKbpofwE"),Va=new N.PublicKey("3f7GcQFG397GAaEnv51zR6tsTVihYRydnydDD1cXekxH"),Ga=new N.PublicKey("LanMV9sAd7wArD4vJFi2qDdfnVhFxYSUg6eADduJ3uj"),Ua=new N.PublicKey("WLHv2UAZm6z4KyaaELi5pjdbJh6RESMva1Rnn8pJVVh"),Xa=new N.PublicKey("DRay6fNdQ5J82H7xV6uq2aV3mNrUZ1J4PgSKsWgptcm6"),Ha=new N.PublicKey("5xqNaZXX5eUi4p5HU4oz9i5QnwRNT2y6oN7yyn4qENeq"),za=new N.PublicKey("4Bu96XjU84XjPDSpveTVf6LYGCkfW5FK7SNkREWcEfV4"),Za=new N.PublicKey("6s1xP3hpbAfFoNtUNF8mfHsjr2Bd97JxFJRWLbL6aHuX");var Ya={OPEN_BOOK_PROGRAM:new N.PublicKey("EoTcMgcDRTJVZDMZWBoU6rhYHZfkNTVEAfz3uUJRcYGj"),SERUM_PROGRAM_ID_V3:new N.PublicKey("Ray1111111111111111111111111111111111111111"),AMM_V4:new N.PublicKey("DRaya7Kj3aMWQSy19kSjvmuwq9docCHofyP9kanQGaav"),AMM_STABLE:new N.PublicKey("DRayDdXc1NZQ9C3hRWmoSf8zK4iapgMnjdNZWrfwsP8m"),CLMM_PROGRAM_ID:new N.PublicKey("DRayAUgENGQBKVaX8owNhgzkEDyoHTGVEGHVJT1E9pfH"),CLMM_LOCK_PROGRAM_ID:new N.PublicKey("DRay25Usp3YJAi7beckgpGUC7mGJ2cR1AVPxhYfwVCUX"),CLMM_LOCK_AUTH_ID:new N.PublicKey("6Aoh8h2Lw2m5UGxYR8AdAL87jTWYeKoxM52mJRzfYwN"),CREATE_CPMM_POOL_PROGRAM:new N.PublicKey("DRaycpLY18LhpbydsBWbVJtxpNv9oXPgjRSfpF2bWpYb"),CREATE_CPMM_POOL_AUTH:new N.PublicKey("CXniRufdq5xL8t8jZAPxsPZDpuudwuJSPWnbcD5Y5Nxq"),CREATE_CPMM_POOL_FEE_ACC:new N.PublicKey("3oE58BKVt8KuYkGxx8zBojugnymWmBiyafWgMrnb6eYy"),LOCK_CPMM_PROGRAM:new N.PublicKey("DRay25Usp3YJAi7beckgpGUC7mGJ2cR1AVPxhYfwVCUX"),LOCK_CPMM_AUTH:new N.PublicKey("7qWVV8UY2bRJfDLP4s37YzBPKUkVB46DStYJBpYbQzu3"),UTIL1216:N.PublicKey.default,Router:new N.PublicKey("DRaybByLpbUL57LJARs3j8BitTxVfzBg351EaM