@nextrope/xrpl
Version:
A TypeScript/JavaScript API for interacting with the XRP Ledger in Node.js and the browser
2 lines • 453 kB
JavaScript
/*! For license information please see xrpl-latest-min.js.LICENSE.txt */
var xrpl;(()=>{var e={5:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validatePaymentChannelFund=void 0;const r=n(255),i=n(2794);t.validatePaymentChannelFund=function(e){if((0,i.validateBaseTransaction)(e),void 0===e.Channel)throw new r.ValidationError("PaymentChannelFund: missing Channel");if("string"!=typeof e.Channel)throw new r.ValidationError("PaymentChannelFund: Channel must be a string");if(void 0===e.Amount)throw new r.ValidationError("PaymentChannelFund: missing Amount");if("string"!=typeof e.Amount)throw new r.ValidationError("PaymentChannelFund: Amount must be a string");if(void 0!==e.Expiration&&"number"!=typeof e.Expiration)throw new r.ValidationError("PaymentChannelFund: Expiration must be a number")}},99:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isHex=t.hasFlag=t.isFlagEnabled=t.onlyHasFields=t.INTEGER_SANITY_CHECK=void 0;const n=/^[0-9A-Fa-f]+$/u;function r(e,t){return(BigInt(t)&BigInt(e))===BigInt(t)}t.INTEGER_SANITY_CHECK=/^[0-9]+$/u,t.onlyHasFields=function(e,t){return Object.keys(e).every((e=>t.includes(e)))},t.isFlagEnabled=r,t.hasFlag=function(e,t,n){return null!=e.Flags&&("number"==typeof e.Flags?r(e.Flags,t):!0===e.Flags[n])},t.isHex=function(e){return n.test(e)}},168:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.Node=t.NodeType=void 0,function(e){e[e.INNER=1]="INNER",e[e.TRANSACTION_NO_METADATA=2]="TRANSACTION_NO_METADATA",e[e.TRANSACTION_METADATA=3]="TRANSACTION_METADATA",e[e.ACCOUNT_STATE=4]="ACCOUNT_STATE"}(n||(t.NodeType=n={})),t.Node=class{}},248:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateCheckCash=void 0;const r=n(255),i=n(2794);t.validateCheckCash=function(e){if((0,i.validateBaseTransaction)(e),null==e.Amount&&null==e.DeliverMin)throw new r.ValidationError("CheckCash: must have either Amount or DeliverMin");if(null!=e.Amount&&null!=e.DeliverMin)throw new r.ValidationError("CheckCash: cannot have both Amount and DeliverMin");if(null!=e.Amount&&void 0!==e.Amount&&!(0,i.isAmount)(e.Amount))throw new r.ValidationError("CheckCash: invalid Amount");if(null!=e.DeliverMin&&void 0!==e.DeliverMin&&!(0,i.isAmount)(e.DeliverMin))throw new r.ValidationError("CheckCash: invalid DeliverMin");if(void 0!==e.CheckID&&"string"!=typeof e.CheckID)throw new r.ValidationError("CheckCash: invalid CheckID")}},255:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XRPLFaucetError=t.NotFoundError=t.ValidationError=t.ResponseFormatError=t.TimeoutError=t.RippledNotInitializedError=t.DisconnectedError=t.NotConnectedError=t.RippledError=t.ConnectionError=t.UnexpectedError=t.XrplError=void 0;class n extends Error{constructor(e="",t){super(e),this.name=this.constructor.name,this.message=e,this.data=t,null!=Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}toString(){let e=`[${this.name}(${this.message}`;return this.data&&(e+=`, ${JSON.stringify(this.data)}`),e+=")]",e}inspect(){return this.toString()}}t.XrplError=n,t.RippledError=class extends n{},t.UnexpectedError=class extends n{};class r extends n{}t.ConnectionError=r,t.NotConnectedError=class extends r{},t.DisconnectedError=class extends r{},t.RippledNotInitializedError=class extends r{},t.TimeoutError=class extends r{},t.ResponseFormatError=class extends r{},t.ValidationError=class extends n{},t.XRPLFaucetError=class extends n{},t.NotFoundError=class extends n{constructor(e="Not found"){super(e)}}},376:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(1363),i=n(5442),o=n(2722);t.default=function(e,t,n){const s=(0,r.encodeForSigningClaim)({channel:e,amount:(0,o.xrpToDrops)(t)});return(0,i.sign)(s,n)}},390:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateCredentialAccept=void 0;const r=n(2794);t.validateCredentialAccept=function(e){(0,r.validateBaseTransaction)(e),(0,r.validateRequiredField)(e,"Account",r.isString),(0,r.validateRequiredField)(e,"Issuer",r.isString),(0,r.validateCredentialType)(e)}},392:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(1363),i=n(5442),o=n(2722);t.default=function(e,t,n,s){const a=(0,r.encodeForSigningClaim)({channel:e,amount:(0,o.xrpToDrops)(t)});return(0,i.verify)(a,n,s)}},425:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateXChainCreateClaimID=void 0;const r=n(2794);t.validateXChainCreateClaimID=function(e){(0,r.validateBaseTransaction)(e),(0,r.validateRequiredField)(e,"XChainBridge",r.isXChainBridge),(0,r.validateRequiredField)(e,"SignatureReward",r.isAmount),(0,r.validateRequiredField)(e,"OtherChainSource",r.isAccount)}},534:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=n(255),o=r(n(9373)),s=r(n(2530)),a=r(n(5644)),c=n(168),l="0000000000000000000000000000000000000000000000000000000000000000";class u extends c.Node{constructor(e=0){super(),this.leaves={},this.type=c.NodeType.INNER,this.depth=e,this.empty=!0}get hash(){if(this.empty)return l;let e="";for(let t=0;t<=15;t++){const n=this.leaves[t];e+=null==n?l:n.hash}const t=o.default.INNER_NODE.toString(16);return(0,s.default)(t+e)}addItem(e,t){const n=this.getNode(parseInt(e[this.depth],16));if(void 0!==n){if(n instanceof u)n.addItem(e,t);else if(n instanceof a.default){if(n.tag===e)throw new i.XrplError("Tried to add a node to a SHAMap that was already in there.");{const r=new u(this.depth+1);r.addItem(n.tag,n),r.addItem(e,t),this.setNode(parseInt(e[this.depth],16),r)}}}else this.setNode(parseInt(e[this.depth],16),t)}setNode(e,t){if(e<0||e>15)throw new i.XrplError("Invalid slot: slot must be between 0-15.");this.leaves[e]=t,this.empty=!1}getNode(e){if(e<0||e>15)throw new i.XrplError("Invalid slot: slot must be between 0-15.");return this.leaves[e]}}t.default=u},548:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateMPTokenIssuanceSet=t.MPTokenIssuanceSetFlags=void 0;const r=n(255),i=n(99),o=n(2794);var s;!function(e){e[e.tfMPTLock=1]="tfMPTLock",e[e.tfMPTUnlock=2]="tfMPTUnlock"}(s||(t.MPTokenIssuanceSetFlags=s={})),t.validateMPTokenIssuanceSet=function(e){var t,n,a;(0,o.validateBaseTransaction)(e),(0,o.validateRequiredField)(e,"MPTokenIssuanceID",o.isString),(0,o.validateOptionalField)(e,"Holder",o.isAccount);const c=null!==(t=e.Flags)&&void 0!==t?t:0,l="number"==typeof c?(0,i.isFlagEnabled)(c,s.tfMPTLock):null!==(n=c.tfMPTLock)&&void 0!==n&&n,u="number"==typeof c?(0,i.isFlagEnabled)(c,s.tfMPTUnlock):null!==(a=c.tfMPTUnlock)&&void 0!==a&&a;if(l&&u)throw new r.ValidationError("MPTokenIssuanceSet: flag conflict")}},602:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateDepositPreauth=void 0;const r=n(255),i=n(2794);t.validateDepositPreauth=function(e){if((0,i.validateBaseTransaction)(e),function(e){if(1!==["Authorize","Unauthorize","AuthorizeCredentials","UnauthorizeCredentials"].filter((t=>void 0!==e[t])).length)throw new r.ValidationError("DepositPreauth: Requires exactly one field of the following: Authorize, Unauthorize, AuthorizeCredentials, UnauthorizeCredentials.")}(e),void 0!==e.Authorize){if("string"!=typeof e.Authorize)throw new r.ValidationError("DepositPreauth: Authorize must be a string");if(e.Account===e.Authorize)throw new r.ValidationError("DepositPreauth: Account can't preauthorize its own address")}else if(void 0!==e.Unauthorize){if("string"!=typeof e.Unauthorize)throw new r.ValidationError("DepositPreauth: Unauthorize must be a string");if(e.Account===e.Unauthorize)throw new r.ValidationError("DepositPreauth: Account can't unauthorize its own address")}else void 0!==e.AuthorizeCredentials?(0,i.validateCredentialsList)(e.AuthorizeCredentials,e.TransactionType,!1,i.MAX_AUTHORIZED_CREDENTIALS):void 0!==e.UnauthorizeCredentials&&(0,i.validateCredentialsList)(e.UnauthorizeCredentials,e.TransactionType,!1,i.MAX_AUTHORIZED_CREDENTIALS)}},619:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.randomBytes=t.stringToHex=t.hexToString=t.hexToBytes=t.bytesToHex=void 0;const o=n(5492),s=n(1602);t.bytesToHex=e=>(0,o.bytesToHex)(e instanceof Uint8Array?e:Uint8Array.from(e)).toUpperCase(),t.hexToBytes=e=>{const t=e.length,n=new Uint8Array(t/2);if(!s.HEX_REGEX.test(e))throw new Error("Invalid hex string");for(let t=0;t<n.length;t++){const r=2*t,i=e.slice(r,r+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");n[t]=o}return n},t.hexToString=(e,n="utf8")=>new TextDecoder(n).decode((0,t.hexToBytes)(e)),t.stringToHex=e=>(0,t.bytesToHex)((new TextEncoder).encode(e)),t.randomBytes=o.randomBytes,i(n(1602),t)},667:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getDecodedTransaction=t.addressToBigNumber=t.NUM_BITS_IN_HEX=t.compareSigners=void 0;const i=n(619),o=r(n(735)),s=n(6333),a=n(1363);function c(e){const n=(0,i.bytesToHex)((0,s.decodeAccountID)(e));return new o.default(n,t.NUM_BITS_IN_HEX)}t.compareSigners=function(e,t){return c(e.Account).comparedTo(c(t.Account))},t.NUM_BITS_IN_HEX=16,t.addressToBigNumber=c,t.getDecodedTransaction=function(e){return"object"==typeof e?(0,a.decode)((0,a.encode)(e)):(0,a.decode)(e)}},707:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateXChainCreateBridge=void 0;const r=n(2794);t.validateXChainCreateBridge=function(e){(0,r.validateBaseTransaction)(e),(0,r.validateRequiredField)(e,"XChainBridge",r.isXChainBridge),(0,r.validateRequiredField)(e,"SignatureReward",r.isAmount),(0,r.validateOptionalField)(e,"MinAccountCreateAmount",r.isAmount)}},714:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sha384=t.sha512_256=t.sha512_224=t.sha512=t.SHA384=t.SHA512_256=t.SHA512_224=t.SHA512=void 0;const r=n(1998),i=n(3914),o=n(9987),[s,a]=(()=>i.default.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((e=>BigInt(e)))))(),c=new Uint32Array(80),l=new Uint32Array(80);class u extends r.HashMD{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:t,Bh:n,Bl:r,Ch:i,Cl:o,Dh:s,Dl:a,Eh:c,El:l,Fh:u,Fl:d,Gh:f,Gl:h,Hh:g,Hl:p}=this;return[e,t,n,r,i,o,s,a,c,l,u,d,f,h,g,p]}set(e,t,n,r,i,o,s,a,c,l,u,d,f,h,g,p){this.Ah=0|e,this.Al=0|t,this.Bh=0|n,this.Bl=0|r,this.Ch=0|i,this.Cl=0|o,this.Dh=0|s,this.Dl=0|a,this.Eh=0|c,this.El=0|l,this.Fh=0|u,this.Fl=0|d,this.Gh=0|f,this.Gl=0|h,this.Hh=0|g,this.Hl=0|p}process(e,t){for(let n=0;n<16;n++,t+=4)c[n]=e.getUint32(t),l[n]=e.getUint32(t+=4);for(let e=16;e<80;e++){const t=0|c[e-15],n=0|l[e-15],r=i.default.rotrSH(t,n,1)^i.default.rotrSH(t,n,8)^i.default.shrSH(t,n,7),o=i.default.rotrSL(t,n,1)^i.default.rotrSL(t,n,8)^i.default.shrSL(t,n,7),s=0|c[e-2],a=0|l[e-2],u=i.default.rotrSH(s,a,19)^i.default.rotrBH(s,a,61)^i.default.shrSH(s,a,6),d=i.default.rotrSL(s,a,19)^i.default.rotrBL(s,a,61)^i.default.shrSL(s,a,6),f=i.default.add4L(o,d,l[e-7],l[e-16]),h=i.default.add4H(f,r,u,c[e-7],c[e-16]);c[e]=0|h,l[e]=0|f}let{Ah:n,Al:r,Bh:o,Bl:u,Ch:d,Cl:f,Dh:h,Dl:g,Eh:p,El:y,Fh:m,Fl:A,Gh:E,Gl:b,Hh:w,Hl:S}=this;for(let e=0;e<80;e++){const t=i.default.rotrSH(p,y,14)^i.default.rotrSH(p,y,18)^i.default.rotrBH(p,y,41),v=i.default.rotrSL(p,y,14)^i.default.rotrSL(p,y,18)^i.default.rotrBL(p,y,41),T=p&m^~p&E,O=y&A^~y&b,I=i.default.add5L(S,v,O,a[e],l[e]),L=i.default.add5H(I,w,t,T,s[e],c[e]),_=0|I,B=i.default.rotrSH(n,r,28)^i.default.rotrBH(n,r,34)^i.default.rotrBH(n,r,39),N=i.default.rotrSL(n,r,28)^i.default.rotrBL(n,r,34)^i.default.rotrBL(n,r,39),C=n&o^n&d^o&d,F=r&u^r&f^u&f;w=0|E,S=0|b,E=0|m,b=0|A,m=0|p,A=0|y,({h:p,l:y}=i.default.add(0|h,0|g,0|L,0|_)),h=0|d,g=0|f,d=0|o,f=0|u,o=0|n,u=0|r;const D=i.default.add3L(_,N,F);n=i.default.add3H(D,L,B,C),r=0|D}({h:n,l:r}=i.default.add(0|this.Ah,0|this.Al,0|n,0|r)),({h:o,l:u}=i.default.add(0|this.Bh,0|this.Bl,0|o,0|u)),({h:d,l:f}=i.default.add(0|this.Ch,0|this.Cl,0|d,0|f)),({h,l:g}=i.default.add(0|this.Dh,0|this.Dl,0|h,0|g)),({h:p,l:y}=i.default.add(0|this.Eh,0|this.El,0|p,0|y)),({h:m,l:A}=i.default.add(0|this.Fh,0|this.Fl,0|m,0|A)),({h:E,l:b}=i.default.add(0|this.Gh,0|this.Gl,0|E,0|b)),({h:w,l:S}=i.default.add(0|this.Hh,0|this.Hl,0|w,0|S)),this.set(n,r,o,u,d,f,h,g,p,y,m,A,E,b,w,S)}roundClean(){c.fill(0),l.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}t.SHA512=u;class d extends u{constructor(){super(),this.Ah=-1942145080,this.Al=424955298,this.Bh=1944164710,this.Bl=-1982016298,this.Ch=502970286,this.Cl=855612546,this.Dh=1738396948,this.Dl=1479516111,this.Eh=258812777,this.El=2077511080,this.Fh=2011393907,this.Fl=79989058,this.Gh=1067287976,this.Gl=1780299464,this.Hh=286451373,this.Hl=-1848208735,this.outputLen=28}}t.SHA512_224=d;class f extends u{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}}t.SHA512_256=f;class h extends u{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}}t.SHA384=h,t.sha512=(0,o.wrapConstructor)((()=>new u)),t.sha512_224=(0,o.wrapConstructor)((()=>new d)),t.sha512_256=(0,o.wrapConstructor)((()=>new f)),t.sha384=(0,o.wrapConstructor)((()=>new h))},735:function(e,t,n){var r;!function(){"use strict";var i,o=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,s=Math.ceil,a=Math.floor,c="[BigNumber Error] ",l=c+"Number primitive has more than 15 significant digits: ",u=1e14,d=14,f=9007199254740991,h=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],g=1e7,p=1e9;function y(e){var t=0|e;return e>0||e===t?t:t-1}function m(e){for(var t,n,r=1,i=e.length,o=e[0]+"";r<i;){for(t=e[r++]+"",n=d-t.length;n--;t="0"+t);o+=t}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function A(e,t){var n,r,i=e.c,o=t.c,s=e.s,a=t.s,c=e.e,l=t.e;if(!s||!a)return null;if(n=i&&!i[0],r=o&&!o[0],n||r)return n?r?0:-a:s;if(s!=a)return s;if(n=s<0,r=c==l,!i||!o)return r?0:!i^n?1:-1;if(!r)return c>l^n?1:-1;for(a=(c=i.length)<(l=o.length)?c:l,s=0;s<a;s++)if(i[s]!=o[s])return i[s]>o[s]^n?1:-1;return c==l?0:c>l^n?1:-1}function E(e,t,n,r){if(e<t||e>n||e!==a(e))throw Error(c+(r||"Argument")+("number"==typeof e?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function b(e){var t=e.c.length-1;return y(e.e/d)==t&&e.c[t]%2!=0}function w(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function S(e,t,n){var r,i;if(t<0){for(i=n+".";++t;i+=n);e=i+e}else if(++t>(r=e.length)){for(i=n,t-=r;--t;i+=n);e+=i}else t<r&&(e=e.slice(0,t)+"."+e.slice(t));return e}i=function e(t){var n,r,i,v,T,O,I,L,_,B,N=G.prototype={constructor:G,toString:null,valueOf:null},C=new G(1),F=20,D=4,M=-7,P=21,R=-1e7,x=1e7,H=!1,U=1,k=0,V={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},j="0123456789abcdefghijklmnopqrstuvwxyz",z=!0;function G(e,t){var n,s,c,u,h,g,p,y,m=this;if(!(m instanceof G))return new G(e,t);if(null==t){if(e&&!0===e._isBigNumber)return m.s=e.s,void(!e.c||e.e>x?m.c=m.e=null:e.e<R?m.c=[m.e=0]:(m.e=e.e,m.c=e.c.slice()));if((g="number"==typeof e)&&0*e==0){if(m.s=1/e<0?(e=-e,-1):1,e===~~e){for(u=0,h=e;h>=10;h/=10,u++);return void(u>x?m.c=m.e=null:(m.e=u,m.c=[e]))}y=String(e)}else{if(!o.test(y=String(e)))return i(m,y,g);m.s=45==y.charCodeAt(0)?(y=y.slice(1),-1):1}(u=y.indexOf("."))>-1&&(y=y.replace(".","")),(h=y.search(/e/i))>0?(u<0&&(u=h),u+=+y.slice(h+1),y=y.substring(0,h)):u<0&&(u=y.length)}else{if(E(t,2,j.length,"Base"),10==t&&z)return X(m=new G(e),F+m.e+1,D);if(y=String(e),g="number"==typeof e){if(0*e!=0)return i(m,y,g,t);if(m.s=1/e<0?(y=y.slice(1),-1):1,G.DEBUG&&y.replace(/^0\.0*|\./,"").length>15)throw Error(l+e)}else m.s=45===y.charCodeAt(0)?(y=y.slice(1),-1):1;for(n=j.slice(0,t),u=h=0,p=y.length;h<p;h++)if(n.indexOf(s=y.charAt(h))<0){if("."==s){if(h>u){u=p;continue}}else if(!c&&(y==y.toUpperCase()&&(y=y.toLowerCase())||y==y.toLowerCase()&&(y=y.toUpperCase()))){c=!0,h=-1,u=0;continue}return i(m,String(e),g,t)}g=!1,(u=(y=r(y,t,10,m.s)).indexOf("."))>-1?y=y.replace(".",""):u=y.length}for(h=0;48===y.charCodeAt(h);h++);for(p=y.length;48===y.charCodeAt(--p););if(y=y.slice(h,++p)){if(p-=h,g&&G.DEBUG&&p>15&&(e>f||e!==a(e)))throw Error(l+m.s*e);if((u=u-h-1)>x)m.c=m.e=null;else if(u<R)m.c=[m.e=0];else{if(m.e=u,m.c=[],h=(u+1)%d,u<0&&(h+=d),h<p){for(h&&m.c.push(+y.slice(0,h)),p-=d;h<p;)m.c.push(+y.slice(h,h+=d));h=d-(y=y.slice(h)).length}else h-=p;for(;h--;y+="0");m.c.push(+y)}}else m.c=[m.e=0]}function K(e,t,n,r){var i,o,s,a,c;if(null==n?n=D:E(n,0,8),!e.c)return e.toString();if(i=e.c[0],s=e.e,null==t)c=m(e.c),c=1==r||2==r&&(s<=M||s>=P)?w(c,s):S(c,s,"0");else if(o=(e=X(new G(e),t,n)).e,a=(c=m(e.c)).length,1==r||2==r&&(t<=o||o<=M)){for(;a<t;c+="0",a++);c=w(c,o)}else if(t-=s,c=S(c,o,"0"),o+1>a){if(--t>0)for(c+=".";t--;c+="0");}else if((t+=o-a)>0)for(o+1==a&&(c+=".");t--;c+="0");return e.s<0&&i?"-"+c:c}function q(e,t){for(var n,r,i=1,o=new G(e[0]);i<e.length;i++)(!(r=new G(e[i])).s||(n=A(o,r))===t||0===n&&o.s===t)&&(o=r);return o}function W(e,t,n){for(var r=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,r++);return(n=r+n*d-1)>x?e.c=e.e=null:n<R?e.c=[e.e=0]:(e.e=n,e.c=t),e}function X(e,t,n,r){var i,o,c,l,f,g,p,y=e.c,m=h;if(y){e:{for(i=1,l=y[0];l>=10;l/=10,i++);if((o=t-i)<0)o+=d,c=t,f=y[g=0],p=a(f/m[i-c-1]%10);else if((g=s((o+1)/d))>=y.length){if(!r)break e;for(;y.length<=g;y.push(0));f=p=0,i=1,c=(o%=d)-d+1}else{for(f=l=y[g],i=1;l>=10;l/=10,i++);p=(c=(o%=d)-d+i)<0?0:a(f/m[i-c-1]%10)}if(r=r||t<0||null!=y[g+1]||(c<0?f:f%m[i-c-1]),r=n<4?(p||r)&&(0==n||n==(e.s<0?3:2)):p>5||5==p&&(4==n||r||6==n&&(o>0?c>0?f/m[i-c]:0:y[g-1])%10&1||n==(e.s<0?8:7)),t<1||!y[0])return y.length=0,r?(t-=e.e+1,y[0]=m[(d-t%d)%d],e.e=-t||0):y[0]=e.e=0,e;if(0==o?(y.length=g,l=1,g--):(y.length=g+1,l=m[d-o],y[g]=c>0?a(f/m[i-c]%m[c])*l:0),r)for(;;){if(0==g){for(o=1,c=y[0];c>=10;c/=10,o++);for(c=y[0]+=l,l=1;c>=10;c/=10,l++);o!=l&&(e.e++,y[0]==u&&(y[0]=1));break}if(y[g]+=l,y[g]!=u)break;y[g--]=0,l=1}for(o=y.length;0===y[--o];y.pop());}e.e>x?e.c=e.e=null:e.e<R&&(e.c=[e.e=0])}return e}function Y(e){var t,n=e.e;return null===n?e.toString():(t=m(e.c),t=n<=M||n>=P?w(t,n):S(t,n,"0"),e.s<0?"-"+t:t)}return G.clone=e,G.ROUND_UP=0,G.ROUND_DOWN=1,G.ROUND_CEIL=2,G.ROUND_FLOOR=3,G.ROUND_HALF_UP=4,G.ROUND_HALF_DOWN=5,G.ROUND_HALF_EVEN=6,G.ROUND_HALF_CEIL=7,G.ROUND_HALF_FLOOR=8,G.EUCLID=9,G.config=G.set=function(e){var t,n;if(null!=e){if("object"!=typeof e)throw Error(c+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(E(n=e[t],0,p,t),F=n),e.hasOwnProperty(t="ROUNDING_MODE")&&(E(n=e[t],0,8,t),D=n),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((n=e[t])&&n.pop?(E(n[0],-p,0,t),E(n[1],0,p,t),M=n[0],P=n[1]):(E(n,-p,p,t),M=-(P=n<0?-n:n))),e.hasOwnProperty(t="RANGE"))if((n=e[t])&&n.pop)E(n[0],-p,-1,t),E(n[1],1,p,t),R=n[0],x=n[1];else{if(E(n,-p,p,t),!n)throw Error(c+t+" cannot be zero: "+n);R=-(x=n<0?-n:n)}if(e.hasOwnProperty(t="CRYPTO")){if((n=e[t])!==!!n)throw Error(c+t+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw H=!n,Error(c+"crypto unavailable");H=n}else H=n}if(e.hasOwnProperty(t="MODULO_MODE")&&(E(n=e[t],0,9,t),U=n),e.hasOwnProperty(t="POW_PRECISION")&&(E(n=e[t],0,p,t),k=n),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(n=e[t]))throw Error(c+t+" not an object: "+n);V=n}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(n=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(n))throw Error(c+t+" invalid: "+n);z="0123456789"==n.slice(0,10),j=n}}return{DECIMAL_PLACES:F,ROUNDING_MODE:D,EXPONENTIAL_AT:[M,P],RANGE:[R,x],CRYPTO:H,MODULO_MODE:U,POW_PRECISION:k,FORMAT:V,ALPHABET:j}},G.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!G.DEBUG)return!0;var t,n,r=e.c,i=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(r)){if((1===o||-1===o)&&i>=-p&&i<=p&&i===a(i)){if(0===r[0]){if(0===i&&1===r.length)return!0;break e}if((t=(i+1)%d)<1&&(t+=d),String(r[0]).length==t){for(t=0;t<r.length;t++)if((n=r[t])<0||n>=u||n!==a(n))break e;if(0!==n)return!0}}}else if(null===r&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(c+"Invalid BigNumber: "+e)},G.maximum=G.max=function(){return q(arguments,-1)},G.minimum=G.min=function(){return q(arguments,1)},G.random=(v=9007199254740992,T=Math.random()*v&2097151?function(){return a(Math.random()*v)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,n,r,i,o,l=0,u=[],f=new G(C);if(null==e?e=F:E(e,0,p),i=s(e/d),H)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));l<i;)(o=131072*t[l]+(t[l+1]>>>11))>=9e15?(n=crypto.getRandomValues(new Uint32Array(2)),t[l]=n[0],t[l+1]=n[1]):(u.push(o%1e14),l+=2);l=i/2}else{if(!crypto.randomBytes)throw H=!1,Error(c+"crypto unavailable");for(t=crypto.randomBytes(i*=7);l<i;)(o=281474976710656*(31&t[l])+1099511627776*t[l+1]+4294967296*t[l+2]+16777216*t[l+3]+(t[l+4]<<16)+(t[l+5]<<8)+t[l+6])>=9e15?crypto.randomBytes(7).copy(t,l):(u.push(o%1e14),l+=7);l=i/7}if(!H)for(;l<i;)(o=T())<9e15&&(u[l++]=o%1e14);for(i=u[--l],e%=d,i&&e&&(o=h[d-e],u[l]=a(i/o)*o);0===u[l];u.pop(),l--);if(l<0)u=[r=0];else{for(r=-1;0===u[0];u.splice(0,1),r-=d);for(l=1,o=u[0];o>=10;o/=10,l++);l<d&&(r-=d-l)}return f.e=r,f.c=u,f}),G.sum=function(){for(var e=1,t=arguments,n=new G(t[0]);e<t.length;)n=n.plus(t[e++]);return n},r=function(){var e="0123456789";function t(e,t,n,r){for(var i,o,s=[0],a=0,c=e.length;a<c;){for(o=s.length;o--;s[o]*=t);for(s[0]+=r.indexOf(e.charAt(a++)),i=0;i<s.length;i++)s[i]>n-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/n|0,s[i]%=n)}return s.reverse()}return function(r,i,o,s,a){var c,l,u,d,f,h,g,p,y=r.indexOf("."),A=F,E=D;for(y>=0&&(d=k,k=0,r=r.replace(".",""),h=(p=new G(i)).pow(r.length-y),k=d,p.c=t(S(m(h.c),h.e,"0"),10,o,e),p.e=p.c.length),u=d=(g=t(r,i,o,a?(c=j,e):(c=e,j))).length;0==g[--d];g.pop());if(!g[0])return c.charAt(0);if(y<0?--u:(h.c=g,h.e=u,h.s=s,g=(h=n(h,p,A,E,o)).c,f=h.r,u=h.e),y=g[l=u+A+1],d=o/2,f=f||l<0||null!=g[l+1],f=E<4?(null!=y||f)&&(0==E||E==(h.s<0?3:2)):y>d||y==d&&(4==E||f||6==E&&1&g[l-1]||E==(h.s<0?8:7)),l<1||!g[0])r=f?S(c.charAt(1),-A,c.charAt(0)):c.charAt(0);else{if(g.length=l,f)for(--o;++g[--l]>o;)g[l]=0,l||(++u,g=[1].concat(g));for(d=g.length;!g[--d];);for(y=0,r="";y<=d;r+=c.charAt(g[y++]));r=S(r,u,c.charAt(0))}return r}}(),n=function(){function e(e,t,n){var r,i,o,s,a=0,c=e.length,l=t%g,u=t/g|0;for(e=e.slice();c--;)a=((i=l*(o=e[c]%g)+(r=u*o+(s=e[c]/g|0)*l)%g*g+a)/n|0)+(r/g|0)+u*s,e[c]=i%n;return a&&(e=[a].concat(e)),e}function t(e,t,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;i<n;i++)if(e[i]!=t[i]){o=e[i]>t[i]?1:-1;break}return o}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=e[n]<t[n]?1:0,e[n]=i*r+e[n]-t[n];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(r,i,o,s,c){var l,f,h,g,p,m,A,E,b,w,S,v,T,O,I,L,_,B=r.s==i.s?1:-1,N=r.c,C=i.c;if(!(N&&N[0]&&C&&C[0]))return new G(r.s&&i.s&&(N?!C||N[0]!=C[0]:C)?N&&0==N[0]||!C?0*B:B/0:NaN);for(b=(E=new G(B)).c=[],B=o+(f=r.e-i.e)+1,c||(c=u,f=y(r.e/d)-y(i.e/d),B=B/d|0),h=0;C[h]==(N[h]||0);h++);if(C[h]>(N[h]||0)&&f--,B<0)b.push(1),g=!0;else{for(O=N.length,L=C.length,h=0,B+=2,(p=a(c/(C[0]+1)))>1&&(C=e(C,p,c),N=e(N,p,c),L=C.length,O=N.length),T=L,S=(w=N.slice(0,L)).length;S<L;w[S++]=0);_=C.slice(),_=[0].concat(_),I=C[0],C[1]>=c/2&&I++;do{if(p=0,(l=t(C,w,L,S))<0){if(v=w[0],L!=S&&(v=v*c+(w[1]||0)),(p=a(v/I))>1)for(p>=c&&(p=c-1),A=(m=e(C,p,c)).length,S=w.length;1==t(m,w,A,S);)p--,n(m,L<A?_:C,A,c),A=m.length,l=1;else 0==p&&(l=p=1),A=(m=C.slice()).length;if(A<S&&(m=[0].concat(m)),n(w,m,S,c),S=w.length,-1==l)for(;t(C,w,L,S)<1;)p++,n(w,L<S?_:C,S,c),S=w.length}else 0===l&&(p++,w=[0]);b[h++]=p,w[0]?w[S++]=N[T]||0:(w=[N[T]],S=1)}while((T++<O||null!=w[0])&&B--);g=null!=w[0],b[0]||b.splice(0,1)}if(c==u){for(h=1,B=b[0];B>=10;B/=10,h++);X(E,o+(E.e=h+f*d-1)+1,s,g)}else E.e=f,E.r=+g;return E}}(),O=/^(-?)0([xbo])(?=\w[\w.]*$)/i,I=/^([^.]+)\.$/,L=/^\.([^.]+)$/,_=/^-?(Infinity|NaN)$/,B=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(e,t,n,r){var i,o=n?t:t.replace(B,"");if(_.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!n&&(o=o.replace(O,(function(e,t,n){return i="x"==(n=n.toLowerCase())?16:"b"==n?2:8,r&&r!=i?e:t})),r&&(i=r,o=o.replace(I,"$1").replace(L,"0.$1")),t!=o))return new G(o,i);if(G.DEBUG)throw Error(c+"Not a"+(r?" base "+r:"")+" number: "+t);e.s=null}e.c=e.e=null},N.absoluteValue=N.abs=function(){var e=new G(this);return e.s<0&&(e.s=1),e},N.comparedTo=function(e,t){return A(this,new G(e,t))},N.decimalPlaces=N.dp=function(e,t){var n,r,i,o=this;if(null!=e)return E(e,0,p),null==t?t=D:E(t,0,8),X(new G(o),e+o.e+1,t);if(!(n=o.c))return null;if(r=((i=n.length-1)-y(this.e/d))*d,i=n[i])for(;i%10==0;i/=10,r--);return r<0&&(r=0),r},N.dividedBy=N.div=function(e,t){return n(this,new G(e,t),F,D)},N.dividedToIntegerBy=N.idiv=function(e,t){return n(this,new G(e,t),0,1)},N.exponentiatedBy=N.pow=function(e,t){var n,r,i,o,l,u,f,h,g=this;if((e=new G(e)).c&&!e.isInteger())throw Error(c+"Exponent not an integer: "+Y(e));if(null!=t&&(t=new G(t)),l=e.e>14,!g.c||!g.c[0]||1==g.c[0]&&!g.e&&1==g.c.length||!e.c||!e.c[0])return h=new G(Math.pow(+Y(g),l?e.s*(2-b(e)):+Y(e))),t?h.mod(t):h;if(u=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new G(NaN);(r=!u&&g.isInteger()&&t.isInteger())&&(g=g.mod(t))}else{if(e.e>9&&(g.e>0||g.e<-1||(0==g.e?g.c[0]>1||l&&g.c[1]>=24e7:g.c[0]<8e13||l&&g.c[0]<=9999975e7)))return o=g.s<0&&b(e)?-0:0,g.e>-1&&(o=1/o),new G(u?1/o:o);k&&(o=s(k/d+2))}for(l?(n=new G(.5),u&&(e.s=1),f=b(e)):f=(i=Math.abs(+Y(e)))%2,h=new G(C);;){if(f){if(!(h=h.times(g)).c)break;o?h.c.length>o&&(h.c.length=o):r&&(h=h.mod(t))}if(i){if(0===(i=a(i/2)))break;f=i%2}else if(X(e=e.times(n),e.e+1,1),e.e>14)f=b(e);else{if(0==(i=+Y(e)))break;f=i%2}g=g.times(g),o?g.c&&g.c.length>o&&(g.c.length=o):r&&(g=g.mod(t))}return r?h:(u&&(h=C.div(h)),t?h.mod(t):o?X(h,k,D,void 0):h)},N.integerValue=function(e){var t=new G(this);return null==e?e=D:E(e,0,8),X(t,t.e+1,e)},N.isEqualTo=N.eq=function(e,t){return 0===A(this,new G(e,t))},N.isFinite=function(){return!!this.c},N.isGreaterThan=N.gt=function(e,t){return A(this,new G(e,t))>0},N.isGreaterThanOrEqualTo=N.gte=function(e,t){return 1===(t=A(this,new G(e,t)))||0===t},N.isInteger=function(){return!!this.c&&y(this.e/d)>this.c.length-2},N.isLessThan=N.lt=function(e,t){return A(this,new G(e,t))<0},N.isLessThanOrEqualTo=N.lte=function(e,t){return-1===(t=A(this,new G(e,t)))||0===t},N.isNaN=function(){return!this.s},N.isNegative=function(){return this.s<0},N.isPositive=function(){return this.s>0},N.isZero=function(){return!!this.c&&0==this.c[0]},N.minus=function(e,t){var n,r,i,o,s=this,a=s.s;if(t=(e=new G(e,t)).s,!a||!t)return new G(NaN);if(a!=t)return e.s=-t,s.plus(e);var c=s.e/d,l=e.e/d,f=s.c,h=e.c;if(!c||!l){if(!f||!h)return f?(e.s=-t,e):new G(h?s:NaN);if(!f[0]||!h[0])return h[0]?(e.s=-t,e):new G(f[0]?s:3==D?-0:0)}if(c=y(c),l=y(l),f=f.slice(),a=c-l){for((o=a<0)?(a=-a,i=f):(l=c,i=h),i.reverse(),t=a;t--;i.push(0));i.reverse()}else for(r=(o=(a=f.length)<(t=h.length))?a:t,a=t=0;t<r;t++)if(f[t]!=h[t]){o=f[t]<h[t];break}if(o&&(i=f,f=h,h=i,e.s=-e.s),(t=(r=h.length)-(n=f.length))>0)for(;t--;f[n++]=0);for(t=u-1;r>a;){if(f[--r]<h[r]){for(n=r;n&&!f[--n];f[n]=t);--f[n],f[r]+=u}f[r]-=h[r]}for(;0==f[0];f.splice(0,1),--l);return f[0]?W(e,f,l):(e.s=3==D?-1:1,e.c=[e.e=0],e)},N.modulo=N.mod=function(e,t){var r,i,o=this;return e=new G(e,t),!o.c||!e.s||e.c&&!e.c[0]?new G(NaN):!e.c||o.c&&!o.c[0]?new G(o):(9==U?(i=e.s,e.s=1,r=n(o,e,0,3),e.s=i,r.s*=i):r=n(o,e,0,U),(e=o.minus(r.times(e))).c[0]||1!=U||(e.s=o.s),e)},N.multipliedBy=N.times=function(e,t){var n,r,i,o,s,a,c,l,f,h,p,m,A,E,b,w=this,S=w.c,v=(e=new G(e,t)).c;if(!(S&&v&&S[0]&&v[0]))return!w.s||!e.s||S&&!S[0]&&!v||v&&!v[0]&&!S?e.c=e.e=e.s=null:(e.s*=w.s,S&&v?(e.c=[0],e.e=0):e.c=e.e=null),e;for(r=y(w.e/d)+y(e.e/d),e.s*=w.s,(c=S.length)<(h=v.length)&&(A=S,S=v,v=A,i=c,c=h,h=i),i=c+h,A=[];i--;A.push(0));for(E=u,b=g,i=h;--i>=0;){for(n=0,p=v[i]%b,m=v[i]/b|0,o=i+(s=c);o>i;)n=((l=p*(l=S[--s]%b)+(a=m*l+(f=S[s]/b|0)*p)%b*b+A[o]+n)/E|0)+(a/b|0)+m*f,A[o--]=l%E;A[o]=n}return n?++r:A.splice(0,1),W(e,A,r)},N.negated=function(){var e=new G(this);return e.s=-e.s||null,e},N.plus=function(e,t){var n,r=this,i=r.s;if(t=(e=new G(e,t)).s,!i||!t)return new G(NaN);if(i!=t)return e.s=-t,r.minus(e);var o=r.e/d,s=e.e/d,a=r.c,c=e.c;if(!o||!s){if(!a||!c)return new G(i/0);if(!a[0]||!c[0])return c[0]?e:new G(a[0]?r:0*i)}if(o=y(o),s=y(s),a=a.slice(),i=o-s){for(i>0?(s=o,n=c):(i=-i,n=a),n.reverse();i--;n.push(0));n.reverse()}for((i=a.length)-(t=c.length)<0&&(n=c,c=a,a=n,t=i),i=0;t;)i=(a[--t]=a[t]+c[t]+i)/u|0,a[t]=u===a[t]?0:a[t]%u;return i&&(a=[i].concat(a),++s),W(e,a,s)},N.precision=N.sd=function(e,t){var n,r,i,o=this;if(null!=e&&e!==!!e)return E(e,1,p),null==t?t=D:E(t,0,8),X(new G(o),e,t);if(!(n=o.c))return null;if(r=(i=n.length-1)*d+1,i=n[i]){for(;i%10==0;i/=10,r--);for(i=n[0];i>=10;i/=10,r++);}return e&&o.e+1>r&&(r=o.e+1),r},N.shiftedBy=function(e){return E(e,-9007199254740991,f),this.times("1e"+e)},N.squareRoot=N.sqrt=function(){var e,t,r,i,o,s=this,a=s.c,c=s.s,l=s.e,u=F+4,d=new G("0.5");if(1!==c||!a||!a[0])return new G(!c||c<0&&(!a||a[0])?NaN:a?s:1/0);if(0==(c=Math.sqrt(+Y(s)))||c==1/0?(((t=m(a)).length+l)%2==0&&(t+="0"),c=Math.sqrt(+t),l=y((l+1)/2)-(l<0||l%2),r=new G(t=c==1/0?"5e"+l:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+l)):r=new G(c+""),r.c[0])for((c=(l=r.e)+u)<3&&(c=0);;)if(o=r,r=d.times(o.plus(n(s,o,u,1))),m(o.c).slice(0,c)===(t=m(r.c)).slice(0,c)){if(r.e<l&&--c,"9999"!=(t=t.slice(c-3,c+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(X(r,r.e+F+2,1),e=!r.times(r).eq(s));break}if(!i&&(X(o,o.e+F+2,0),o.times(o).eq(s))){r=o;break}u+=4,c+=4,i=1}return X(r,r.e+F+1,D,e)},N.toExponential=function(e,t){return null!=e&&(E(e,0,p),e++),K(this,e,t,1)},N.toFixed=function(e,t){return null!=e&&(E(e,0,p),e=e+this.e+1),K(this,e,t)},N.toFormat=function(e,t,n){var r,i=this;if(null==n)null!=e&&t&&"object"==typeof t?(n=t,t=null):e&&"object"==typeof e?(n=e,e=t=null):n=V;else if("object"!=typeof n)throw Error(c+"Argument not an object: "+n);if(r=i.toFixed(e,t),i.c){var o,s=r.split("."),a=+n.groupSize,l=+n.secondaryGroupSize,u=n.groupSeparator||"",d=s[0],f=s[1],h=i.s<0,g=h?d.slice(1):d,p=g.length;if(l&&(o=a,a=l,l=o,p-=o),a>0&&p>0){for(o=p%a||a,d=g.substr(0,o);o<p;o+=a)d+=u+g.substr(o,a);l>0&&(d+=u+g.slice(o)),h&&(d="-"+d)}r=f?d+(n.decimalSeparator||"")+((l=+n.fractionGroupSize)?f.replace(new RegExp("\\d{"+l+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):f):d}return(n.prefix||"")+r+(n.suffix||"")},N.toFraction=function(e){var t,r,i,o,s,a,l,u,f,g,p,y,A=this,E=A.c;if(null!=e&&(!(l=new G(e)).isInteger()&&(l.c||1!==l.s)||l.lt(C)))throw Error(c+"Argument "+(l.isInteger()?"out of range: ":"not an integer: ")+Y(l));if(!E)return new G(A);for(t=new G(C),f=r=new G(C),i=u=new G(C),y=m(E),s=t.e=y.length-A.e-1,t.c[0]=h[(a=s%d)<0?d+a:a],e=!e||l.comparedTo(t)>0?s>0?t:f:l,a=x,x=1/0,l=new G(y),u.c[0]=0;g=n(l,t,0,1),1!=(o=r.plus(g.times(i))).comparedTo(e);)r=i,i=o,f=u.plus(g.times(o=f)),u=o,t=l.minus(g.times(o=t)),l=o;return o=n(e.minus(r),i,0,1),u=u.plus(o.times(f)),r=r.plus(o.times(i)),u.s=f.s=A.s,p=n(f,i,s*=2,D).minus(A).abs().comparedTo(n(u,r,s,D).minus(A).abs())<1?[f,i]:[u,r],x=a,p},N.toNumber=function(){return+Y(this)},N.toPrecision=function(e,t){return null!=e&&E(e,1,p),K(this,e,t,2)},N.toString=function(e){var t,n=this,i=n.s,o=n.e;return null===o?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(null==e?t=o<=M||o>=P?w(m(n.c),o):S(m(n.c),o,"0"):10===e&&z?t=S(m((n=X(new G(n),F+o+1,D)).c),n.e,"0"):(E(e,2,j.length,"Base"),t=r(S(m(n.c),o,"0"),10,e,i,!0)),i<0&&n.c[0]&&(t="-"+t)),t},N.valueOf=N.toJSON=function(){return Y(this)},N._isBigNumber=!0,null!=t&&G.set(t),G}(),i.default=i.BigNumber=i,void 0===(r=function(){return i}.call(t,n,t,e))||(e.exports=r)}()},802:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isNegativeLE=void 0,t.mod=d,t.pow=f,t.pow2=function(e,t,n){let r=e;for(;t-- >i;)r*=r,r%=n;return r},t.invert=h,t.tonelliShanks=g,t.FpSqrt=p,t.validateField=function(e){const t=y.reduce(((e,t)=>(e[t]="function",e)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"});return(0,r.validateObject)(e,t)},t.FpPow=m,t.FpInvertBatch=A,t.FpDiv=function(e,t,n){return e.mul(t,"bigint"==typeof n?h(n,e.ORDER):e.inv(n))},t.FpLegendre=E,t.FpIsSquare=function(e){const t=E(e.ORDER);return n=>{const r=t(e,n);return e.eql(r,e.ZERO)||e.eql(r,e.ONE)}},t.nLength=b,t.Field=function(e,t,n=!1,s={}){if(e<=i)throw new Error("invalid field: expected ORDER > 0, got "+e);const{nBitLength:a,nByteLength:c}=b(e,t);if(c>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let l;const u=Object.freeze({ORDER:e,isLE:n,BITS:a,BYTES:c,MASK:(0,r.bitMask)(a),ZERO:i,ONE:o,create:t=>d(t,e),isValid:t=>{if("bigint"!=typeof t)throw new Error("invalid field element: expected bigint, got "+typeof t);return i<=t&&t<e},is0:e=>e===i,isOdd:e=>(e&o)===o,neg:t=>d(-t,e),eql:(e,t)=>e===t,sqr:t=>d(t*t,e),add:(t,n)=>d(t+n,e),sub:(t,n)=>d(t-n,e),mul:(t,n)=>d(t*n,e),pow:(e,t)=>m(u,e,t),div:(t,n)=>d(t*h(n,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>h(t,e),sqrt:s.sqrt||(t=>(l||(l=p(e)),l(u,t))),invertBatch:e=>A(u,e),cmov:(e,t,n)=>n?t:e,toBytes:e=>n?(0,r.numberToBytesLE)(e,c):(0,r.numberToBytesBE)(e,c),fromBytes:e=>{if(e.length!==c)throw new Error("Field.fromBytes: expected "+c+" bytes, got "+e.length);return n?(0,r.bytesToNumberLE)(e):(0,r.bytesToNumberBE)(e)}});return Object.freeze(u)},t.FpSqrtOdd=function(e,t){if(!e.isOdd)throw new Error("Field doesn't have isOdd");const n=e.sqrt(t);return e.isOdd(n)?n:e.neg(n)},t.FpSqrtEven=function(e,t){if(!e.isOdd)throw new Error("Field doesn't have isOdd");const n=e.sqrt(t);return e.isOdd(n)?e.neg(n):n},t.hashToPrivateScalar=function(e,t,n=!1){const i=(e=(0,r.ensureBytes)("privateHash",e)).length,s=b(t).nByteLength+8;if(s<24||i<s||i>1024)throw new Error("hashToPrivateScalar: expected "+s+"-1024 bytes of input, got "+i);return d(n?(0,r.bytesToNumberLE)(e):(0,r.bytesToNumberBE)(e),t-o)+o},t.getFieldBytesLength=w,t.getMinHashLength=S,t.mapHashToField=function(e,t,n=!1){const i=e.length,s=w(t),a=S(t);if(i<16||i<a||i>1024)throw new Error("expected "+a+"-1024 bytes of input, got "+i);const c=d(n?(0,r.bytesToNumberLE)(e):(0,r.bytesToNumberBE)(e),t-o)+o;return n?(0,r.numberToBytesLE)(c,s):(0,r.numberToBytesBE)(c,s)};const r=n(3449),i=BigInt(0),o=BigInt(1),s=BigInt(2),a=BigInt(3),c=BigInt(4),l=BigInt(5),u=BigInt(8);function d(e,t){const n=e%t;return n>=i?n:t+n}function f(e,t,n){if(t<i)throw new Error("invalid exponent, negatives unsupported");if(n<=i)throw new Error("invalid modulus");if(n===o)return i;let r=o;for(;t>i;)t&o&&(r=r*e%n),e=e*e%n,t>>=o;return r}function h(e,t){if(e===i)throw new Error("invert: expected non-zero number");if(t<=i)throw new Error("invert: expected positive modulus, got "+t);let n=d(e,t),r=t,s=i,a=o,c=o,l=i;for(;n!==i;){const e=r/n,t=r%n,i=s-c*e,o=a-l*e;r=n,n=t,s=c,a=l,c=i,l=o}if(r!==o)throw new Error("invert: does not exist");return d(s,t)}function g(e){const t=(e-o)/s;let n,r,a;for(n=e-o,r=0;n%s===i;n/=s,r++);for(a=s;a<e&&f(a,t,e)!==e-o;a++)if(a>1e3)throw new Error("Cannot find square root: likely non-prime P");if(1===r){const t=(e+o)/c;return function(e,n){const r=e.pow(n,t);if(!e.eql(e.sqr(r),n))throw new Error("Cannot find square root");return r}}const l=(n+o)/s;return function(e,i){if(e.pow(i,t)===e.neg(e.ONE))throw new Error("Cannot find square root");let s=r,c=e.pow(e.mul(e.ONE,a),n),u=e.pow(i,l),d=e.pow(i,n);for(;!e.eql(d,e.ONE);){if(e.eql(d,e.ZERO))return e.ZERO;let t=1;for(let n=e.sqr(d);t<s&&!e.eql(n,e.ONE);t++)n=e.sqr(n);const n=e.pow(c,o<<BigInt(s-t-1));c=e.sqr(n),u=e.mul(u,n),d=e.mul(d,c),s=t}return u}}function p(e){if(e%c===a){const t=(e+o)/c;return function(e,n){const r=e.pow(n,t);if(!e.eql(e.sqr(r),n))throw new Error("Cannot find square root");return r}}if(e%u===l){const t=(e-l)/u;return function(e,n){const r=e.mul(n,s),i=e.pow(r,t),o=e.mul(n,i),a=e.mul(e.mul(o,s),i),c=e.mul(o,e.sub(a,e.ONE));if(!e.eql(e.sqr(c),n))throw new Error("Cannot find square root");return c}}return g(e)}t.isNegativeLE=(e,t)=>(d(e,t)&o)===o;const y=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function m(e,t,n){if(n<i)throw new Error("invalid exponent, negatives unsupported");if(n===i)return e.ONE;if(n===o)return t;let r=e.ONE,s=t;for(;n>i;)n&o&&(r=e.mul(r,s)),s=e.sqr(s),n>>=o;return r}function A(e,t){const n=new Array(t.length),r=t.reduce(((t,r,i)=>e.is0(r)?t:(n[i]=t,e.mul(t,r))),e.ONE),i=e.inv(r);return t.reduceRight(((t,r,i)=>e.is0(r)?t:(n[i]=e.mul(t,n[i]),e.mul(t,r))),i),n}function E(e){const t=(e-o)/s;return(e,n)=>e.pow(n,t)}function b(e,t){const n=void 0!==t?t:e.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function w(e){if("bigint"!=typeof e)throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function S(e){const t=w(e);return t+Math.ceil(t/2)}},811:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.handleStreamPartialPayment=t.handlePartialPayment=void 0;const i=r(n(735)),o=n(1363),s=n(9843),a=n(99);function c(e,t){var n,r;if(null==e||null==t||"Payment"!==e.TransactionType)return!1;let c=t;if("string"==typeof c){if("unavailable"===c)return!1;c=(0,o.decode)(c)}if(!("number"==typeof e.Flags?(0,a.isFlagEnabled)(e.Flags,s.PaymentFlags.tfPartialPayment):null===(n=e.Flags)||void 0===n?void 0:n.tfPartialPayment))return!1;const l=c.delivered_amount,u=null!==(r=e.DeliverMax)&&void 0!==r?r:e.Amount;return void 0!==l&&!function(e,t){if("string"==typeof e&&"string"==typeof t)return e===t;if("string"==typeof e||"string"==typeof t)return!1;if((0,s.isMPTAmount)(e)&&(0,s.isMPTAmount)(t)){const n=new i.default(e.value),r=new i.default(t.value);return e.mpt_issuance_id===t.mpt_issuance_id&&n.isEqualTo(r)}if((0,s.isMPTAmount)(e)||(0,s.isMPTAmount)(t))return!1;const n=new i.default(e.value),r=new i.default(t.value);return e.currency===t.currency&&e.issuer===t.issuer&&n.isEqualTo(r)}(l,u)}t.handlePartialPayment=function(e,t){var n;if(function(e,t){switch(e){case"tx":return function(e){return c(e.result.tx_json,e.result.meta)}(t);case"transaction_entry":return function(e){return c(e.result.tx_json,e.result.metadata)}(t);case"account_tx":return function(e){const{transactions:t}=e.result;return t.some((e=>{if(null!=e.tx_json){const t=e;return c(t.tx_json,t.meta)}const t=e;return c(t.tx,t.meta)}))}(t);default:return!1}}(e,t)){const e=null!==(n=t.warnings)&&void 0!==n?n:[],r={id:2001,message:"This response contains a Partial Payment"};e.push(r),t.warnings=e}},t.handleStreamPartialPayment=function(e,t){var n,r;if(c(null!==(n=e.tx_json)&&void 0!==n?n:e.transaction,e.meta)){const n=null!==(r=e.warnings)&&void 0!==r?r:[],i={id:2001,message:"This response contains a Partial Payment"};n.push(i),e.warnings=n,t("Partial payment received",JSON.stringify(e))}}},821:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validatePermissionedDomainSet=void 0;const r=n(2794);t.validatePermissionedDomainSet=function(e){(0,r.validateBaseTransaction)(e),(0,r.validateOptionalField)(e,"DomainID",r.isString),(0,r.validateRequiredField)(e,"AcceptedCredentials",r.isArray),(0,r.validateCredentialsList)(e.AcceptedCredentials,e.TransactionType,!1,10)}},857:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HDKey=t.HARDENED_OFFSET=void 0;const r=n(7203),i=n(8538),o=n(2283),s=n(6522),a=n(5697),c=n(4211),l=n(9005),u=n(802),d=n(1616),f=l.secp256k1.ProjectivePoint,h=(0,d.createBase58check)(o.sha256);function g(e){(0,a.abytes)(e);const t=0===e.length?"0":(0,c.bytesToHex)(e);return BigInt("0x"+t)}const p=(0,c.utf8ToBytes)("Bitcoin seed"),y={private:76066276,public:76067358};t.HARDENED_OFFSET=2147483648;const m=e=>{if(!Number.isSafeInteger(e)||e<0||e>2**32-1)throw new Error("invalid number, should be from 0 to 2**32-1, got "+e);const t=new Uint8Array(4);return(0,c.createView)(t).setUint32(0,e,!1),t};class A{get fingerprint(){if(!this.pubHash)throw new Error("No publicKey set!");return e=this.pubHash,(0,c.createView)(e).getUint32(0,!1);var e}get identifier(){return this.pubHash}get pubKeyHash(){return this.pubHash}get privateKey(){return this.privKeyBytes||null}get publicKey(){return this.pubKey||null}get privateExtendedKey(){const e=this.privateKey;if(!e)throw new Error("No private key");return h.encode(this.serialize(this.versions.private,(0,c.concatBytes)(new Uint8Array([0]),e)))}get publicExtendedKey(){if(!this.pubKey)throw new Error("No public key");return h.encode(this.serialize(this.versions.public,this.pubKey))}static fromMasterSeed(e,t=y){if((0,a.abytes)(e),8*e.length<128||8*e.length>512)throw new Error("HDKey: seed length must be between 128 and 512 bits; 256 bits is advised, got "+e.length);const n=(0,r.hmac)(s.sha512,p,e);return new A({versions:t,chainCode:n.slice(32),privateKey:n.slice(0,32)})}static fromExtendedKey(e,t=y){const n=h.decode(e),r=(0,c.createView)(n),i=r.getUint32(0,!1),o={versions:t,depth:n[4],parentFingerprint:r.getUint32(5,!1),index:r.getUint32(9,!1),chainCode:n.slice(13,45)},s=n.slice(45),a=0===s[0];if(i!==t[a?"private":"public"])throw new Error("Version mismatch");return new A(a?{...o,privateKey:s.slice(1)}:{...o,publicKey:s})}static fromJSON(e){return A.fromExtendedKey(e.xpriv)}constructor(e){if(this.depth=0,this.index=0,this.chainCode=null,this.parentFingerprint=0,!e||"object"!=typeof e)throw new Error("HDKey.constructor must not be called directly");if(this.versions=e.versions||y,this.depth=e.depth||0,this.chainCode=e.chainCode||null,this.index=e.index||0,this.parentFingerprint=e.parentFingerprint||0,!this.depth&&(this.parentFingerprint||this.index))throw new Error("HDKey: zero depth with non-zero index/parent fingerprint");if(e.publicKey&&e.privateKey)throw new Error("HDKey: publicKey and privateKey at same time.");if(e.privateKey){if(!l.secp256k1.utils.isValidPrivateKey(e.privateKey))throw new Error("Invalid private key");this.privKey="bigint"==typeof e.privateKey?e.privateKey:g(e.privateKey),this.privKeyBytes=function(e){if("bigint"!=typeof e)throw new Error("bigint expected");return(0,c.hexToBytes)(e.toString(16).padStart(64,"0"))}(this.privKey),this.pubKey=l.secp256k1.getPublicKey(e.privateKey,!0)}else{if(!e.publicKey)throw new Error("HDKey: no public or private key provided");this.pubKey=f.fromHex(e.publicKey).toRawBytes(!0)}var t;this.pubHash=(t=this.pubKey,(0,i.ripemd160)((0,o.sha256)(t)))}derive(e){if(!/^[mM]'?/.test(e))throw new Error('Path must start with "m" or "M"');if(/^[mM]'?$/.test(e))return this;const n=e.replace(/^[mM]'?\//,"").split("/");let r=this;for(const e of n){const n=/^(\d+)('?)$/.exec(e),i=n&&n[1];if(!n||3!==n.length||"string"!=typeof i)throw new Error("invalid child index: "+e);let o=+i;if(!Number.isSafeInteger(o)||o>=t.HARDENED_OFFSET)throw new Error("Invalid index");"'"===n[2]&&(o+=t.HARDENED_OFFSET),r=r.deriveChild(o)}return r}deriveChild(e){if(!this.pubKey||!this.chainCode)throw new Error("No publicKey or chainCode set");let n=m(e);if(e>=t.HARDENED_OFFSET){const e=this.privateKey;if(!e)throw new Error("Could not derive hardened child key");n=(0,c.concatBytes)(new Uint8Array([0]),e,n)}else n=(0,c.concatBytes)(this.pubKey,n);const i=(0,r.hmac)(s.sha512,this.chainCode,n),o=g(i.slice(0,32)),a=i.slice(32);if(!l.secp256k1.utils.isValidPrivateKey(o))throw new Error("Tweak bigger than curve order");const d={versions:this.versions,chainCode:a,depth:this.depth+1,parentFingerprint:this.fingerprint,index:e};try{if(this.privateKey){const e=(0,u.mod)(this.privKey+o,l.secp256k1.CURVE.n);if(!l.secp256k1.utils.isValidPrivateKey(e))throw new Error("The tweak was out of range or the resulted private key is invalid");d.privateKey=e}else{const e=f.fromHex(this.pubKey).add(f.fromPrivateKey(o));if(e.equals(f.ZERO))throw new Error("The tweak was equal to negative P, which made the result key invalid");d.publicKey=e.toRawBytes(!0)}return new A(d)}catch(t){return this.deriveChild(e+1)}}sign(e){if(!this.privateKey)throw new Error("No privateKey set!");return(0,a.abytes)(e,32),l.secp256k1.sign(e,this.privKey).toCompactRawBytes()}verify(e,t){if((0,a.abytes)(e,32),(0,a.abytes)(t,64),!this.publicKey)throw new Error("No publicKey set!");let n;try{n=l.secp256k1.Signature.fromCompact(t)}catch(e){return!1}return l.secp256k1.verify(n,e,this.publicKey)}wipePrivateData(){return this.privKey=void 0,this.privKeyBytes&&(this.privKeyBytes.fill(0),this.privKeyBytes=void 0),this}toJSON(){return{xpriv:this.privateExtendedKey,xpub:this.publicExtendedKey}}serialize(e,t){if(!this.chainCode)throw new Error("No chainCode set");return(0,a.abytes)(t,33),(0,c.concatBytes)(m(e),new Uint8Array([this.depth]),m(this.parentFingerprint),m(this.index),this.chainCode,t)}}t.HDKey=A},964:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9819);class i extends r.EventEmitter{constructor(e,t,n){super(),this.ws=new WebSocket(e),this.ws.onclose=e=>{let t;e.reason&&(t=(new TextEncoder).encode(e.reason)),this.emit("close",e.code,t)},this.ws.onopen=()=>{this.emit("open")},this.ws.onerror=e=>{this.emit("error",e)},this.ws.onmessage=e=>{this.emit("message",e.data)}}get readyState(){return this.ws.readyState}close(e,t){1===this.readyState&&this.ws.close(e,t)}send(e){this.ws.send(e)}}i.CONNECTING=0,i.OPEN=1,i.CLOSING=2,i.CLOSED=3,t.default=i},988:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateAMMWithdraw=t.AMMWithdrawFlags=void 0;const r=n(255),i=n(2794);var o;!function(e){e[e.tfLPToken=65536]="tfLPToken",e[e.tfWithdrawAll=131072]="tfWithdrawAll",e[e.tfOneAssetWithdrawAll=262144]="tfOneAssetWithdrawAll",e[e.tfSingleAsset=524288]="tfSingleAsset",e[e.tfTwoAsset=1048576]="tfTwoAsset",e[e.tfOneAssetLPToken=2097152]="tfOneAssetLPToken",e[e.tfLimitLPToken=4194304]="tfLimitLPToken"}(o||(t.AMMWithdrawFlags=o={})),t.validateAMMWithdraw=function(e){if((0,i.validateBaseTransaction)(e),null==e.Asset)throw new r.ValidationError("AMMWithdraw: missing field Asset");if(!(0,i.isIssuedCurrency)(e.Asset))throw new r.ValidationError("AMMWithdraw: Asset must be a Currency");if(null==e.Asset2)throw new r.ValidationError("AMMWithdraw: missing field Asset2");if(!(0,i.isIssuedCurrency)(e.Asset2))throw new r.ValidationError("AMMWithdraw: Asset2 must be a Currency");if(null!=e.Amount2&&null==e.Amount)throw new r.ValidationError("AMMWithdraw: must set Amount with Amount2");if(null!=e.EPrice&&null==e.Amount)throw new r.ValidationError("AMMWithdraw: must set Amount with EPrice");if(null!=e.LPTokenIn&&!(0,i.isIssuedCurrencyAmount)(e.LPTokenIn))throw new r.ValidationError("AMMWithdraw: LPTokenIn must be an IssuedCurrencyAmount");if(null!=e.Amount&&!(0,i.isAmount)(e.Amount))throw new r.ValidationError("AMMWithdraw: Amount must be an Amount");if(null!=e.Amount2&&!(0,i.isAmount)(e.Amount2))throw new r.ValidationError("AMMWithdraw: Amount2 must be an Amount");if(null!=e.EPrice&&!(0,i.isAmount)(e.EPrice))throw new r.Valid