@dodoex/wallet-web3 0.0.43-beta.0 → 0.0.43-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{DefaultJsonRpcProvider-16b86457.js → DefaultJsonRpcProvider-48aec187.js} +1 -1
- package/dist/__node-resolve_empty-59fa3c56.js +1 -0
- package/dist/{blocto-e35c2bce.js → blocto-478b3978.js} +1 -1
- package/dist/{bn-bea96c1e.js → bn-efc414a2.js} +1 -1
- package/dist/{browser-ponyfill-f45b0187.js → browser-ponyfill-bc327969.js} +1 -1
- package/dist/cjs/{DefaultJsonRpcProvider-a4216c2c.cjs → DefaultJsonRpcProvider-55c338f0.cjs} +1 -1
- package/dist/cjs/{__node-resolve_empty-112a35f0.cjs → __node-resolve_empty-fd72eb2c.cjs} +1 -1
- package/dist/cjs/{blocto-6ce92a3c.cjs → blocto-965564db.cjs} +1 -1
- package/dist/cjs/{bn-4b6ace70.cjs → bn-d506e85d.cjs} +1 -1
- package/dist/cjs/{browser-ponyfill-3d00f58c.cjs → browser-ponyfill-323d988f.cjs} +1 -1
- package/dist/cjs/{draggabilly-a516601d.cjs → draggabilly-79573f3a.cjs} +1 -1
- package/dist/cjs/{ethers-79a8b64c.cjs → ethers-1ba31973.cjs} +1 -1
- package/dist/cjs/{id-aaf275ac.cjs → id-1118c8d9.cjs} +1 -1
- package/dist/cjs/{index-d132f04d.cjs → index-0122b1eb.cjs} +1 -1
- package/dist/cjs/{index-3a818183.cjs → index-0ce04635.cjs} +2 -2
- package/dist/cjs/{index-9e7c30e4.cjs → index-285c5389.cjs} +1 -1
- package/dist/cjs/{index-8908828b.cjs → index-3c74ed4c.cjs} +1 -1
- package/dist/cjs/{index-710e2e08.cjs → index-4d414966.cjs} +1 -1
- package/dist/cjs/{index-687606ef.cjs → index-58465208.cjs} +1 -1
- package/dist/cjs/{index-b508044f.cjs → index-685f72cf.cjs} +1 -1
- package/dist/cjs/{index-2b8f986d.cjs → index-99521957.cjs} +1 -1
- package/dist/cjs/{index-bb7b2a27.cjs → index-ac9f2e8f.cjs} +1 -1
- package/dist/cjs/{index-dfdc6c5b.cjs → index-ae56e5a3.cjs} +2 -2
- package/dist/cjs/{index-812ee091.cjs → index-dc6a6c03.cjs} +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/{index.es-a09533e6.cjs → index.es-6fd28bfe.cjs} +1 -1
- package/dist/cjs/{interface-401abdcd.cjs → interface-22e176bf.cjs} +1 -1
- package/dist/cjs/{lib-typedarrays-500eafc3.cjs → lib-typedarrays-4ea60734.cjs} +1 -1
- package/dist/cjs/{portis-4b600385.cjs → portis-5a7056fa.cjs} +1 -1
- package/dist/cjs/{provider-2af2c824.cjs → provider-d22e1228.cjs} +1 -1
- package/dist/cjs/{rainbow-56978b05.cjs → rainbow-54c01ab2.cjs} +1 -1
- package/dist/cjs/{sha224-d64bb467.cjs → sha224-75e384f0.cjs} +1 -1
- package/dist/cjs/{sha256-5e38dae7.cjs → sha256-ab07124e.cjs} +1 -1
- package/dist/cjs/{uAuth-7692d87b.cjs → uAuth-b9d43d2e.cjs} +1 -1
- package/dist/cjs/{walletConnect-9bf75169.cjs → walletConnect-398a4c97.cjs} +1 -1
- package/dist/cjs/{walletLink-2a1920a6.cjs → walletLink-6199ae38.cjs} +2 -2
- package/dist/{draggabilly-411a2bfc.js → draggabilly-830dc949.js} +1 -1
- package/dist/{ethers-cb195952.js → ethers-1d40d86b.js} +1 -1
- package/dist/{id-44a7ba96.js → id-62e12510.js} +1 -1
- package/dist/{index-272625f0.js → index-02350ba2.js} +1 -1
- package/dist/{index-d8a60005.js → index-115f7417.js} +1 -1
- package/dist/{index-764c794e.js → index-11a0760f.js} +1 -1
- package/dist/{index-df576275.js → index-37f47216.js} +1 -1
- package/dist/{index-32a0a636.js → index-3c4637f0.js} +1 -1
- package/dist/{index-849b2e9b.js → index-6e901e7d.js} +1 -1
- package/dist/{index-64864a90.js → index-a33c0bc7.js} +2 -2
- package/dist/{index-79d77b05.js → index-acc28a9b.js} +1 -1
- package/dist/index-b32df058.js +1 -0
- package/dist/{index-5bf4cdf3.js → index-b659401e.js} +1 -1
- package/dist/{index-c4b7e014.js → index-bcc0fefa.js} +1 -1
- package/dist/{index.es-1a5925ce.js → index.es-d4badfa1.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/{interface-c0409fdc.js → interface-c16329c9.js} +1 -1
- package/dist/{lib-typedarrays-89645c3c.js → lib-typedarrays-f90f59e3.js} +1 -1
- package/dist/{portis-e32a848b.js → portis-a86b0a05.js} +1 -1
- package/dist/{provider-84d6204f.js → provider-e4a0ed94.js} +1 -1
- package/dist/{rainbow-33e0f4ed.js → rainbow-3df70217.js} +1 -1
- package/dist/{sha224-87032d02.js → sha224-57921047.js} +1 -1
- package/dist/{sha256-e81cf2ba.js → sha256-5bd230f1.js} +1 -1
- package/dist/{uAuth-c2738d4a.js → uAuth-2e999ea5.js} +1 -1
- package/dist/walletConnect-565fd3db.js +1 -0
- package/dist/walletLink-df58109a.js +3 -0
- package/package.json +1 -1
- package/dist/__node-resolve_empty-69a251b7.js +0 -1
- package/dist/index-bacb8b7a.js +0 -1
- package/dist/walletConnect-8deba348.js +0 -1
- package/dist/walletLink-a7c249e1.js +0 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as t,k as i}from"./index-5bf4cdf3.js";import{r}from"./__node-resolve_empty-69a251b7.js";import{isBytes as e,hexlify as n,isHexString as h,arrayify as o}from"@ethersproject/bytes";let s=!1,u=!1;const a={debug:1,default:2,info:2,warning:3,error:4,off:5};let l=a.default,m=null;const f=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((i=>{try{if("test"!=="test".normalize(i))throw new Error("bad normalize")}catch(r){t.push(i)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var d,p;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(d||(d={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(p||(p={}));const g="0123456789abcdef";class c{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,i){const r=t.toLowerCase();null==a[r]&&this.throwArgumentError("invalid log level name","logLevel",t),l>a[r]||console.log.apply(console,i)}debug(...t){this._log(c.levels.DEBUG,t)}info(...t){this._log(c.levels.INFO,t)}warn(...t){this._log(c.levels.WARNING,t)}makeError(t,i,r){if(u)return this.makeError("censored error",i,{});i||(i=c.errors.UNKNOWN_ERROR),r||(r={});const e=[];Object.keys(r).forEach((t=>{const i=r[t];try{if(i instanceof Uint8Array){let r="";for(let t=0;t<i.length;t++)r+=g[i[t]>>4],r+=g[15&i[t]];e.push(t+"=Uint8Array(0x"+r+")")}else e.push(t+"="+JSON.stringify(i))}catch(i){e.push(t+"="+JSON.stringify(r[t].toString()))}})),e.push(`code=${i}`),e.push(`version=${this.version}`);const n=t;let h="";switch(i){case p.NUMERIC_FAULT:{h="NUMERIC_FAULT";const i=t;switch(i){case"overflow":case"underflow":case"division-by-zero":h+="-"+i;break;case"negative-power":case"negative-width":h+="-unsupported";break;case"unbound-bitwise-result":h+="-unbound-result"}break}case p.CALL_EXCEPTION:case p.INSUFFICIENT_FUNDS:case p.MISSING_NEW:case p.NONCE_EXPIRED:case p.REPLACEMENT_UNDERPRICED:case p.TRANSACTION_REPLACED:case p.UNPREDICTABLE_GAS_LIMIT:h=i}h&&(t+=" [ See: https://links.ethers.org/v5-errors-"+h+" ]"),e.length&&(t+=" ("+e.join(", ")+")");const o=new Error(t);return o.reason=n,o.code=i,Object.keys(r).forEach((function(t){o[t]=r[t]})),o}throwError(t,i,r){throw this.makeError(t,i,r)}throwArgumentError(t,i,r){return this.throwError(t,c.errors.INVALID_ARGUMENT,{argument:i,value:r})}assert(t,i,r,e){t||this.throwError(i,r,e)}assertArgument(t,i,r,e){t||this.throwArgumentError(i,r,e)}checkNormalize(t){f&&this.throwError("platform missing String.prototype.normalize",c.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:f})}checkSafeUint53(t,i){"number"==typeof t&&(null==i&&(i="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(i,c.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(i,c.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,i,r){r=r?": "+r:"",t<i&&this.throwError("missing argument"+r,c.errors.MISSING_ARGUMENT,{count:t,expectedCount:i}),t>i&&this.throwError("too many arguments"+r,c.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:i})}checkNew(t,i){t!==Object&&null!=t||this.throwError("missing new",c.errors.MISSING_NEW,{name:i.name})}checkAbstract(t,i){t===i?this.throwError("cannot instantiate abstract class "+JSON.stringify(i.name)+" directly; use a sub-class",c.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",c.errors.MISSING_NEW,{name:i.name})}static globalLogger(){return m||(m=new c("logger/5.7.0")),m}static setCensorship(t,i){if(!t&&i&&this.globalLogger().throwError("cannot permanently disable censorship",c.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),s){if(!t)return;this.globalLogger().throwError("error censorship permanent",c.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}u=!!t,s=!!i}static setLogLevel(t){const i=a[t.toLowerCase()];null!=i?l=i:c.globalLogger().warn("invalid log level - "+t)}static from(t){return new c(t)}}c.errors=p,c.levels=d;var M=Object.freeze({__proto__:null,get LogLevel(){return d},get ErrorCode(){return p},Logger:c}),v={exports:{}};!function(t,i){function e(t,i){if(!t)throw new Error(i||"Assertion failed")}function n(t,i){t.super_=i;var r=function(){};r.prototype=i.prototype,t.prototype=new r,t.prototype.constructor=t}function h(t,i,r){if(h.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==i&&"be"!==i||(r=i,i=10),this._init(t||0,i||10,r||"be"))}var o;"object"==typeof t?t.exports=h:i.BN=h,h.BN=h,h.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r.Buffer}catch(t){}function s(t,i){var r=t.charCodeAt(i);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void e(!1,"Invalid character in "+t)}function u(t,i,r){var e=s(t,r);return r-1>=i&&(e|=s(t,r-1)<<4),e}function a(t,i,r,n){for(var h=0,o=0,s=Math.min(t.length,r),u=i;u<s;u++){var a=t.charCodeAt(u)-48;h*=n,o=a>=49?a-49+10:a>=17?a-17+10:a,e(a>=0&&o<n,"Invalid character"),h+=o}return h}function l(t,i){t.words=i.words,t.length=i.length,t.negative=i.negative,t.red=i.red}if(h.isBN=function(t){return t instanceof h||null!==t&&"object"==typeof t&&t.constructor.wordSize===h.wordSize&&Array.isArray(t.words)},h.max=function(t,i){return t.cmp(i)>0?t:i},h.min=function(t,i){return t.cmp(i)<0?t:i},h.prototype._init=function(t,i,r){if("number"==typeof t)return this._initNumber(t,i,r);if("object"==typeof t)return this._initArray(t,i,r);"hex"===i&&(i=16),e(i===(0|i)&&i>=2&&i<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<t.length&&(16===i?this._parseHex(t,n,r):(this._parseBase(t,i,n),"le"===r&&this._initArray(this.toArray(),i,r)))},h.prototype._initNumber=function(t,i,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(e(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),i,r)},h.prototype._initArray=function(t,i,r){if(e("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var h,o,s=0;if("be"===r)for(n=t.length-1,h=0;n>=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[h]|=o<<s&67108863,this.words[h+1]=o>>>26-s&67108863,(s+=24)>=26&&(s-=26,h++);else if("le"===r)for(n=0,h=0;n<t.length;n+=3)o=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[h]|=o<<s&67108863,this.words[h+1]=o>>>26-s&67108863,(s+=24)>=26&&(s-=26,h++);return this._strip()},h.prototype._parseHex=function(t,i,r){this.length=Math.ceil((t.length-i)/6),this.words=new Array(this.length);for(var e=0;e<this.length;e++)this.words[e]=0;var n,h=0,o=0;if("be"===r)for(e=t.length-1;e>=i;e-=2)n=u(t,i,e)<<h,this.words[o]|=67108863&n,h>=18?(h-=18,o+=1,this.words[o]|=n>>>26):h+=8;else for(e=(t.length-i)%2==0?i+1:i;e<t.length;e+=2)n=u(t,i,e)<<h,this.words[o]|=67108863&n,h>=18?(h-=18,o+=1,this.words[o]|=n>>>26):h+=8;this._strip()},h.prototype._parseBase=function(t,i,r){this.words=[0],this.length=1;for(var e=0,n=1;n<=67108863;n*=i)e++;e--,n=n/i|0;for(var h=t.length-r,o=h%e,s=Math.min(h,h-o)+r,u=0,l=r;l<s;l+=e)u=a(t,l,l+e,i),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==o){var m=1;for(u=a(t,l,t.length,i),l=0;l<o;l++)m*=i;this.imuln(m),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},h.prototype.copy=function(t){t.words=new Array(this.length);for(var i=0;i<this.length;i++)t.words[i]=this.words[i];t.length=this.length,t.negative=this.negative,t.red=this.red},h.prototype._move=function(t){l(t,this)},h.prototype.clone=function(){var t=new h(null);return this.copy(t),t},h.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},h.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},h.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{h.prototype[Symbol.for("nodejs.util.inspect.custom")]=m}catch(t){h.prototype.inspect=m}else h.prototype.inspect=m;function m(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function g(t,i,r){r.negative=i.negative^t.negative;var e=t.length+i.length|0;r.length=e,e=e-1|0;var n=0|t.words[0],h=0|i.words[0],o=n*h,s=67108863&o,u=o/67108864|0;r.words[0]=s;for(var a=1;a<e;a++){for(var l=u>>>26,m=67108863&u,f=Math.min(a,i.length-1),d=Math.max(0,a-t.length+1);d<=f;d++){var p=a-d|0;l+=(o=(n=0|t.words[p])*(h=0|i.words[d])+m)/67108864|0,m=67108863&o}r.words[a]=0|m,u=0|l}return 0!==u?r.words[a]=0|u:r.length--,r._strip()}h.prototype.toString=function(t,i){var r;if(i=0|i||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,h=0,o=0;o<this.length;o++){var s=this.words[o],u=(16777215&(s<<n|h)).toString(16);h=s>>>24-n&16777215,(n+=2)>=26&&(n-=26,o--),r=0!==h||o!==this.length-1?f[6-u.length]+u+r:u+r}for(0!==h&&(r=h.toString(16)+r);r.length%i!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var a=d[t],l=p[t];r="";var m=this.clone();for(m.negative=0;!m.isZero();){var g=m.modrn(l).toString(t);r=(m=m.idivn(l)).isZero()?g+r:f[a-g.length]+g+r}for(this.isZero()&&(r="0"+r);r.length%i!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}e(!1,"Base should be between 2 and 36")},h.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&e(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},h.prototype.toJSON=function(){return this.toString(16,2)},o&&(h.prototype.toBuffer=function(t,i){return this.toArrayLike(o,t,i)}),h.prototype.toArray=function(t,i){return this.toArrayLike(Array,t,i)},h.prototype.toArrayLike=function(t,i,r){this._strip();var n=this.byteLength(),h=r||Math.max(1,n);e(n<=h,"byte array longer than desired length"),e(h>0,"Requested array length <= 0");var o=function(t,i){return t.allocUnsafe?t.allocUnsafe(i):new t(i)}(t,h);return this["_toArrayLike"+("le"===i?"LE":"BE")](o,n),o},h.prototype._toArrayLikeLE=function(t,i){for(var r=0,e=0,n=0,h=0;n<this.length;n++){var o=this.words[n]<<h|e;t[r++]=255&o,r<t.length&&(t[r++]=o>>8&255),r<t.length&&(t[r++]=o>>16&255),6===h?(r<t.length&&(t[r++]=o>>24&255),e=0,h=0):(e=o>>>24,h+=2)}if(r<t.length)for(t[r++]=e;r<t.length;)t[r++]=0},h.prototype._toArrayLikeBE=function(t,i){for(var r=t.length-1,e=0,n=0,h=0;n<this.length;n++){var o=this.words[n]<<h|e;t[r--]=255&o,r>=0&&(t[r--]=o>>8&255),r>=0&&(t[r--]=o>>16&255),6===h?(r>=0&&(t[r--]=o>>24&255),e=0,h=0):(e=o>>>24,h+=2)}if(r>=0)for(t[r--]=e;r>=0;)t[r--]=0},Math.clz32?h.prototype._countBits=function(t){return 32-Math.clz32(t)}:h.prototype._countBits=function(t){var i=t,r=0;return i>=4096&&(r+=13,i>>>=13),i>=64&&(r+=7,i>>>=7),i>=8&&(r+=4,i>>>=4),i>=2&&(r+=2,i>>>=2),r+i},h.prototype._zeroBits=function(t){if(0===t)return 26;var i=t,r=0;return 0==(8191&i)&&(r+=13,i>>>=13),0==(127&i)&&(r+=7,i>>>=7),0==(15&i)&&(r+=4,i>>>=4),0==(3&i)&&(r+=2,i>>>=2),0==(1&i)&&r++,r},h.prototype.bitLength=function(){var t=this.words[this.length-1],i=this._countBits(t);return 26*(this.length-1)+i},h.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,i=0;i<this.length;i++){var r=this._zeroBits(this.words[i]);if(t+=r,26!==r)break}return t},h.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},h.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},h.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},h.prototype.isNeg=function(){return 0!==this.negative},h.prototype.neg=function(){return this.clone().ineg()},h.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},h.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var i=0;i<t.length;i++)this.words[i]=this.words[i]|t.words[i];return this._strip()},h.prototype.ior=function(t){return e(0==(this.negative|t.negative)),this.iuor(t)},h.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},h.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},h.prototype.iuand=function(t){var i;i=this.length>t.length?t:this;for(var r=0;r<i.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=i.length,this._strip()},h.prototype.iand=function(t){return e(0==(this.negative|t.negative)),this.iuand(t)},h.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},h.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},h.prototype.iuxor=function(t){var i,r;this.length>t.length?(i=this,r=t):(i=t,r=this);for(var e=0;e<r.length;e++)this.words[e]=i.words[e]^r.words[e];if(this!==i)for(;e<i.length;e++)this.words[e]=i.words[e];return this.length=i.length,this._strip()},h.prototype.ixor=function(t){return e(0==(this.negative|t.negative)),this.iuxor(t)},h.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},h.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},h.prototype.inotn=function(t){e("number"==typeof t&&t>=0);var i=0|Math.ceil(t/26),r=t%26;this._expand(i),r>0&&i--;for(var n=0;n<i;n++)this.words[n]=67108863&~this.words[n];return r>0&&(this.words[n]=~this.words[n]&67108863>>26-r),this._strip()},h.prototype.notn=function(t){return this.clone().inotn(t)},h.prototype.setn=function(t,i){e("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=i?this.words[r]|1<<n:this.words[r]&~(1<<n),this._strip()},h.prototype.iadd=function(t){var i,r,e;if(0!==this.negative&&0===t.negative)return this.negative=0,i=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,i=this.isub(t),t.negative=1,i._normSign();this.length>t.length?(r=this,e=t):(r=t,e=this);for(var n=0,h=0;h<e.length;h++)i=(0|r.words[h])+(0|e.words[h])+n,this.words[h]=67108863&i,n=i>>>26;for(;0!==n&&h<r.length;h++)i=(0|r.words[h])+n,this.words[h]=67108863&i,n=i>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;h<r.length;h++)this.words[h]=r.words[h];return this},h.prototype.add=function(t){var i;return 0!==t.negative&&0===this.negative?(t.negative=0,i=this.sub(t),t.negative^=1,i):0===t.negative&&0!==this.negative?(this.negative=0,i=t.sub(this),this.negative=1,i):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},h.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var i=this.iadd(t);return t.negative=1,i._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,e,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,e=t):(r=t,e=this);for(var h=0,o=0;o<e.length;o++)h=(i=(0|r.words[o])-(0|e.words[o])+h)>>26,this.words[o]=67108863&i;for(;0!==h&&o<r.length;o++)h=(i=(0|r.words[o])+h)>>26,this.words[o]=67108863&i;if(0===h&&o<r.length&&r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this.length=Math.max(this.length,o),r!==this&&(this.negative=1),this._strip()},h.prototype.sub=function(t){return this.clone().isub(t)};var c=function(t,i,r){var e,n,h,o=t.words,s=i.words,u=r.words,a=0,l=0|o[0],m=8191&l,f=l>>>13,d=0|o[1],p=8191&d,g=d>>>13,c=0|o[2],M=8191&c,v=c>>>13,w=0|o[3],y=8191&w,b=w>>>13,E=0|o[4],N=8191&E,_=E>>>13,R=0|o[5],S=8191&R,A=R>>>13,I=0|o[6],T=8191&I,O=I>>>13,U=0|o[7],C=8191&U,k=U>>>13,x=0|o[8],L=8191&x,P=x>>>13,D=0|o[9],B=8191&D,F=D>>>13,G=0|s[0],Z=8191&G,q=G>>>13,z=0|s[1],j=8191&z,X=z>>>13,K=0|s[2],V=8191&K,W=K>>>13,H=0|s[3],J=8191&H,$=H>>>13,Q=0|s[4],Y=8191&Q,tt=Q>>>13,it=0|s[5],rt=8191&it,et=it>>>13,nt=0|s[6],ht=8191&nt,ot=nt>>>13,st=0|s[7],ut=8191&st,at=st>>>13,lt=0|s[8],mt=8191<,ft=lt>>>13,dt=0|s[9],pt=8191&dt,gt=dt>>>13;r.negative=t.negative^i.negative,r.length=19;var ct=(a+(e=Math.imul(m,Z))|0)+((8191&(n=(n=Math.imul(m,q))+Math.imul(f,Z)|0))<<13)|0;a=((h=Math.imul(f,q))+(n>>>13)|0)+(ct>>>26)|0,ct&=67108863,e=Math.imul(p,Z),n=(n=Math.imul(p,q))+Math.imul(g,Z)|0,h=Math.imul(g,q);var Mt=(a+(e=e+Math.imul(m,j)|0)|0)+((8191&(n=(n=n+Math.imul(m,X)|0)+Math.imul(f,j)|0))<<13)|0;a=((h=h+Math.imul(f,X)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,e=Math.imul(M,Z),n=(n=Math.imul(M,q))+Math.imul(v,Z)|0,h=Math.imul(v,q),e=e+Math.imul(p,j)|0,n=(n=n+Math.imul(p,X)|0)+Math.imul(g,j)|0,h=h+Math.imul(g,X)|0;var vt=(a+(e=e+Math.imul(m,V)|0)|0)+((8191&(n=(n=n+Math.imul(m,W)|0)+Math.imul(f,V)|0))<<13)|0;a=((h=h+Math.imul(f,W)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,e=Math.imul(y,Z),n=(n=Math.imul(y,q))+Math.imul(b,Z)|0,h=Math.imul(b,q),e=e+Math.imul(M,j)|0,n=(n=n+Math.imul(M,X)|0)+Math.imul(v,j)|0,h=h+Math.imul(v,X)|0,e=e+Math.imul(p,V)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(g,V)|0,h=h+Math.imul(g,W)|0;var wt=(a+(e=e+Math.imul(m,J)|0)|0)+((8191&(n=(n=n+Math.imul(m,$)|0)+Math.imul(f,J)|0))<<13)|0;a=((h=h+Math.imul(f,$)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,e=Math.imul(N,Z),n=(n=Math.imul(N,q))+Math.imul(_,Z)|0,h=Math.imul(_,q),e=e+Math.imul(y,j)|0,n=(n=n+Math.imul(y,X)|0)+Math.imul(b,j)|0,h=h+Math.imul(b,X)|0,e=e+Math.imul(M,V)|0,n=(n=n+Math.imul(M,W)|0)+Math.imul(v,V)|0,h=h+Math.imul(v,W)|0,e=e+Math.imul(p,J)|0,n=(n=n+Math.imul(p,$)|0)+Math.imul(g,J)|0,h=h+Math.imul(g,$)|0;var yt=(a+(e=e+Math.imul(m,Y)|0)|0)+((8191&(n=(n=n+Math.imul(m,tt)|0)+Math.imul(f,Y)|0))<<13)|0;a=((h=h+Math.imul(f,tt)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,e=Math.imul(S,Z),n=(n=Math.imul(S,q))+Math.imul(A,Z)|0,h=Math.imul(A,q),e=e+Math.imul(N,j)|0,n=(n=n+Math.imul(N,X)|0)+Math.imul(_,j)|0,h=h+Math.imul(_,X)|0,e=e+Math.imul(y,V)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(b,V)|0,h=h+Math.imul(b,W)|0,e=e+Math.imul(M,J)|0,n=(n=n+Math.imul(M,$)|0)+Math.imul(v,J)|0,h=h+Math.imul(v,$)|0,e=e+Math.imul(p,Y)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(g,Y)|0,h=h+Math.imul(g,tt)|0;var bt=(a+(e=e+Math.imul(m,rt)|0)|0)+((8191&(n=(n=n+Math.imul(m,et)|0)+Math.imul(f,rt)|0))<<13)|0;a=((h=h+Math.imul(f,et)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,e=Math.imul(T,Z),n=(n=Math.imul(T,q))+Math.imul(O,Z)|0,h=Math.imul(O,q),e=e+Math.imul(S,j)|0,n=(n=n+Math.imul(S,X)|0)+Math.imul(A,j)|0,h=h+Math.imul(A,X)|0,e=e+Math.imul(N,V)|0,n=(n=n+Math.imul(N,W)|0)+Math.imul(_,V)|0,h=h+Math.imul(_,W)|0,e=e+Math.imul(y,J)|0,n=(n=n+Math.imul(y,$)|0)+Math.imul(b,J)|0,h=h+Math.imul(b,$)|0,e=e+Math.imul(M,Y)|0,n=(n=n+Math.imul(M,tt)|0)+Math.imul(v,Y)|0,h=h+Math.imul(v,tt)|0,e=e+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,et)|0)+Math.imul(g,rt)|0,h=h+Math.imul(g,et)|0;var Et=(a+(e=e+Math.imul(m,ht)|0)|0)+((8191&(n=(n=n+Math.imul(m,ot)|0)+Math.imul(f,ht)|0))<<13)|0;a=((h=h+Math.imul(f,ot)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,e=Math.imul(C,Z),n=(n=Math.imul(C,q))+Math.imul(k,Z)|0,h=Math.imul(k,q),e=e+Math.imul(T,j)|0,n=(n=n+Math.imul(T,X)|0)+Math.imul(O,j)|0,h=h+Math.imul(O,X)|0,e=e+Math.imul(S,V)|0,n=(n=n+Math.imul(S,W)|0)+Math.imul(A,V)|0,h=h+Math.imul(A,W)|0,e=e+Math.imul(N,J)|0,n=(n=n+Math.imul(N,$)|0)+Math.imul(_,J)|0,h=h+Math.imul(_,$)|0,e=e+Math.imul(y,Y)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(b,Y)|0,h=h+Math.imul(b,tt)|0,e=e+Math.imul(M,rt)|0,n=(n=n+Math.imul(M,et)|0)+Math.imul(v,rt)|0,h=h+Math.imul(v,et)|0,e=e+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,ot)|0)+Math.imul(g,ht)|0,h=h+Math.imul(g,ot)|0;var Nt=(a+(e=e+Math.imul(m,ut)|0)|0)+((8191&(n=(n=n+Math.imul(m,at)|0)+Math.imul(f,ut)|0))<<13)|0;a=((h=h+Math.imul(f,at)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,e=Math.imul(L,Z),n=(n=Math.imul(L,q))+Math.imul(P,Z)|0,h=Math.imul(P,q),e=e+Math.imul(C,j)|0,n=(n=n+Math.imul(C,X)|0)+Math.imul(k,j)|0,h=h+Math.imul(k,X)|0,e=e+Math.imul(T,V)|0,n=(n=n+Math.imul(T,W)|0)+Math.imul(O,V)|0,h=h+Math.imul(O,W)|0,e=e+Math.imul(S,J)|0,n=(n=n+Math.imul(S,$)|0)+Math.imul(A,J)|0,h=h+Math.imul(A,$)|0,e=e+Math.imul(N,Y)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(_,Y)|0,h=h+Math.imul(_,tt)|0,e=e+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,et)|0)+Math.imul(b,rt)|0,h=h+Math.imul(b,et)|0,e=e+Math.imul(M,ht)|0,n=(n=n+Math.imul(M,ot)|0)+Math.imul(v,ht)|0,h=h+Math.imul(v,ot)|0,e=e+Math.imul(p,ut)|0,n=(n=n+Math.imul(p,at)|0)+Math.imul(g,ut)|0,h=h+Math.imul(g,at)|0;var _t=(a+(e=e+Math.imul(m,mt)|0)|0)+((8191&(n=(n=n+Math.imul(m,ft)|0)+Math.imul(f,mt)|0))<<13)|0;a=((h=h+Math.imul(f,ft)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,e=Math.imul(B,Z),n=(n=Math.imul(B,q))+Math.imul(F,Z)|0,h=Math.imul(F,q),e=e+Math.imul(L,j)|0,n=(n=n+Math.imul(L,X)|0)+Math.imul(P,j)|0,h=h+Math.imul(P,X)|0,e=e+Math.imul(C,V)|0,n=(n=n+Math.imul(C,W)|0)+Math.imul(k,V)|0,h=h+Math.imul(k,W)|0,e=e+Math.imul(T,J)|0,n=(n=n+Math.imul(T,$)|0)+Math.imul(O,J)|0,h=h+Math.imul(O,$)|0,e=e+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(A,Y)|0,h=h+Math.imul(A,tt)|0,e=e+Math.imul(N,rt)|0,n=(n=n+Math.imul(N,et)|0)+Math.imul(_,rt)|0,h=h+Math.imul(_,et)|0,e=e+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ot)|0)+Math.imul(b,ht)|0,h=h+Math.imul(b,ot)|0,e=e+Math.imul(M,ut)|0,n=(n=n+Math.imul(M,at)|0)+Math.imul(v,ut)|0,h=h+Math.imul(v,at)|0,e=e+Math.imul(p,mt)|0,n=(n=n+Math.imul(p,ft)|0)+Math.imul(g,mt)|0,h=h+Math.imul(g,ft)|0;var Rt=(a+(e=e+Math.imul(m,pt)|0)|0)+((8191&(n=(n=n+Math.imul(m,gt)|0)+Math.imul(f,pt)|0))<<13)|0;a=((h=h+Math.imul(f,gt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,e=Math.imul(B,j),n=(n=Math.imul(B,X))+Math.imul(F,j)|0,h=Math.imul(F,X),e=e+Math.imul(L,V)|0,n=(n=n+Math.imul(L,W)|0)+Math.imul(P,V)|0,h=h+Math.imul(P,W)|0,e=e+Math.imul(C,J)|0,n=(n=n+Math.imul(C,$)|0)+Math.imul(k,J)|0,h=h+Math.imul(k,$)|0,e=e+Math.imul(T,Y)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(O,Y)|0,h=h+Math.imul(O,tt)|0,e=e+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,et)|0)+Math.imul(A,rt)|0,h=h+Math.imul(A,et)|0,e=e+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,ot)|0)+Math.imul(_,ht)|0,h=h+Math.imul(_,ot)|0,e=e+Math.imul(y,ut)|0,n=(n=n+Math.imul(y,at)|0)+Math.imul(b,ut)|0,h=h+Math.imul(b,at)|0,e=e+Math.imul(M,mt)|0,n=(n=n+Math.imul(M,ft)|0)+Math.imul(v,mt)|0,h=h+Math.imul(v,ft)|0;var St=(a+(e=e+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,gt)|0)+Math.imul(g,pt)|0))<<13)|0;a=((h=h+Math.imul(g,gt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,e=Math.imul(B,V),n=(n=Math.imul(B,W))+Math.imul(F,V)|0,h=Math.imul(F,W),e=e+Math.imul(L,J)|0,n=(n=n+Math.imul(L,$)|0)+Math.imul(P,J)|0,h=h+Math.imul(P,$)|0,e=e+Math.imul(C,Y)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(k,Y)|0,h=h+Math.imul(k,tt)|0,e=e+Math.imul(T,rt)|0,n=(n=n+Math.imul(T,et)|0)+Math.imul(O,rt)|0,h=h+Math.imul(O,et)|0,e=e+Math.imul(S,ht)|0,n=(n=n+Math.imul(S,ot)|0)+Math.imul(A,ht)|0,h=h+Math.imul(A,ot)|0,e=e+Math.imul(N,ut)|0,n=(n=n+Math.imul(N,at)|0)+Math.imul(_,ut)|0,h=h+Math.imul(_,at)|0,e=e+Math.imul(y,mt)|0,n=(n=n+Math.imul(y,ft)|0)+Math.imul(b,mt)|0,h=h+Math.imul(b,ft)|0;var At=(a+(e=e+Math.imul(M,pt)|0)|0)+((8191&(n=(n=n+Math.imul(M,gt)|0)+Math.imul(v,pt)|0))<<13)|0;a=((h=h+Math.imul(v,gt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,e=Math.imul(B,J),n=(n=Math.imul(B,$))+Math.imul(F,J)|0,h=Math.imul(F,$),e=e+Math.imul(L,Y)|0,n=(n=n+Math.imul(L,tt)|0)+Math.imul(P,Y)|0,h=h+Math.imul(P,tt)|0,e=e+Math.imul(C,rt)|0,n=(n=n+Math.imul(C,et)|0)+Math.imul(k,rt)|0,h=h+Math.imul(k,et)|0,e=e+Math.imul(T,ht)|0,n=(n=n+Math.imul(T,ot)|0)+Math.imul(O,ht)|0,h=h+Math.imul(O,ot)|0,e=e+Math.imul(S,ut)|0,n=(n=n+Math.imul(S,at)|0)+Math.imul(A,ut)|0,h=h+Math.imul(A,at)|0,e=e+Math.imul(N,mt)|0,n=(n=n+Math.imul(N,ft)|0)+Math.imul(_,mt)|0,h=h+Math.imul(_,ft)|0;var It=(a+(e=e+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,gt)|0)+Math.imul(b,pt)|0))<<13)|0;a=((h=h+Math.imul(b,gt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,e=Math.imul(B,Y),n=(n=Math.imul(B,tt))+Math.imul(F,Y)|0,h=Math.imul(F,tt),e=e+Math.imul(L,rt)|0,n=(n=n+Math.imul(L,et)|0)+Math.imul(P,rt)|0,h=h+Math.imul(P,et)|0,e=e+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,ot)|0)+Math.imul(k,ht)|0,h=h+Math.imul(k,ot)|0,e=e+Math.imul(T,ut)|0,n=(n=n+Math.imul(T,at)|0)+Math.imul(O,ut)|0,h=h+Math.imul(O,at)|0,e=e+Math.imul(S,mt)|0,n=(n=n+Math.imul(S,ft)|0)+Math.imul(A,mt)|0,h=h+Math.imul(A,ft)|0;var Tt=(a+(e=e+Math.imul(N,pt)|0)|0)+((8191&(n=(n=n+Math.imul(N,gt)|0)+Math.imul(_,pt)|0))<<13)|0;a=((h=h+Math.imul(_,gt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,e=Math.imul(B,rt),n=(n=Math.imul(B,et))+Math.imul(F,rt)|0,h=Math.imul(F,et),e=e+Math.imul(L,ht)|0,n=(n=n+Math.imul(L,ot)|0)+Math.imul(P,ht)|0,h=h+Math.imul(P,ot)|0,e=e+Math.imul(C,ut)|0,n=(n=n+Math.imul(C,at)|0)+Math.imul(k,ut)|0,h=h+Math.imul(k,at)|0,e=e+Math.imul(T,mt)|0,n=(n=n+Math.imul(T,ft)|0)+Math.imul(O,mt)|0,h=h+Math.imul(O,ft)|0;var Ot=(a+(e=e+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,gt)|0)+Math.imul(A,pt)|0))<<13)|0;a=((h=h+Math.imul(A,gt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,e=Math.imul(B,ht),n=(n=Math.imul(B,ot))+Math.imul(F,ht)|0,h=Math.imul(F,ot),e=e+Math.imul(L,ut)|0,n=(n=n+Math.imul(L,at)|0)+Math.imul(P,ut)|0,h=h+Math.imul(P,at)|0,e=e+Math.imul(C,mt)|0,n=(n=n+Math.imul(C,ft)|0)+Math.imul(k,mt)|0,h=h+Math.imul(k,ft)|0;var Ut=(a+(e=e+Math.imul(T,pt)|0)|0)+((8191&(n=(n=n+Math.imul(T,gt)|0)+Math.imul(O,pt)|0))<<13)|0;a=((h=h+Math.imul(O,gt)|0)+(n>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,e=Math.imul(B,ut),n=(n=Math.imul(B,at))+Math.imul(F,ut)|0,h=Math.imul(F,at),e=e+Math.imul(L,mt)|0,n=(n=n+Math.imul(L,ft)|0)+Math.imul(P,mt)|0,h=h+Math.imul(P,ft)|0;var Ct=(a+(e=e+Math.imul(C,pt)|0)|0)+((8191&(n=(n=n+Math.imul(C,gt)|0)+Math.imul(k,pt)|0))<<13)|0;a=((h=h+Math.imul(k,gt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,e=Math.imul(B,mt),n=(n=Math.imul(B,ft))+Math.imul(F,mt)|0,h=Math.imul(F,ft);var kt=(a+(e=e+Math.imul(L,pt)|0)|0)+((8191&(n=(n=n+Math.imul(L,gt)|0)+Math.imul(P,pt)|0))<<13)|0;a=((h=h+Math.imul(P,gt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863;var xt=(a+(e=Math.imul(B,pt))|0)+((8191&(n=(n=Math.imul(B,gt))+Math.imul(F,pt)|0))<<13)|0;return a=((h=Math.imul(F,gt))+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,u[0]=ct,u[1]=Mt,u[2]=vt,u[3]=wt,u[4]=yt,u[5]=bt,u[6]=Et,u[7]=Nt,u[8]=_t,u[9]=Rt,u[10]=St,u[11]=At,u[12]=It,u[13]=Tt,u[14]=Ot,u[15]=Ut,u[16]=Ct,u[17]=kt,u[18]=xt,0!==a&&(u[19]=a,r.length++),r};function M(t,i,r){r.negative=i.negative^t.negative,r.length=t.length+i.length;for(var e=0,n=0,h=0;h<r.length-1;h++){var o=n;n=0;for(var s=67108863&e,u=Math.min(h,i.length-1),a=Math.max(0,h-t.length+1);a<=u;a++){var l=h-a,m=(0|t.words[l])*(0|i.words[a]),f=67108863&m;s=67108863&(f=f+s|0),n+=(o=(o=o+(m/67108864|0)|0)+(f>>>26)|0)>>>26,o&=67108863}r.words[h]=s,e=o,o=n}return 0!==e?r.words[h]=e:r.length--,r._strip()}function v(t,i,r){return M(t,i,r)}Math.imul||(c=g),h.prototype.mulTo=function(t,i){var r=this.length+t.length;return 10===this.length&&10===t.length?c(this,t,i):r<63?g(this,t,i):r<1024?M(this,t,i):v(this,t,i)},h.prototype.mul=function(t){var i=new h(null);return i.words=new Array(this.length+t.length),this.mulTo(t,i)},h.prototype.mulf=function(t){var i=new h(null);return i.words=new Array(this.length+t.length),v(this,t,i)},h.prototype.imul=function(t){return this.clone().mulTo(t,this)},h.prototype.imuln=function(t){var i=t<0;i&&(t=-t),e("number"==typeof t),e(t<67108864);for(var r=0,n=0;n<this.length;n++){var h=(0|this.words[n])*t,o=(67108863&h)+(67108863&r);r>>=26,r+=h/67108864|0,r+=o>>>26,this.words[n]=67108863&o}return 0!==r&&(this.words[n]=r,this.length++),i?this.ineg():this},h.prototype.muln=function(t){return this.clone().imuln(t)},h.prototype.sqr=function(){return this.mul(this)},h.prototype.isqr=function(){return this.imul(this.clone())},h.prototype.pow=function(t){var i=function(t){for(var i=new Array(t.bitLength()),r=0;r<i.length;r++){var e=r/26|0,n=r%26;i[r]=t.words[e]>>>n&1}return i}(t);if(0===i.length)return new h(1);for(var r=this,e=0;e<i.length&&0===i[e];e++,r=r.sqr());if(++e<i.length)for(var n=r.sqr();e<i.length;e++,n=n.sqr())0!==i[e]&&(r=r.mul(n));return r},h.prototype.iushln=function(t){e("number"==typeof t&&t>=0);var i,r=t%26,n=(t-r)/26,h=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(i=0;i<this.length;i++){var s=this.words[i]&h,u=(0|this.words[i])-s<<r;this.words[i]=u|o,o=s>>>26-r}o&&(this.words[i]=o,this.length++)}if(0!==n){for(i=this.length-1;i>=0;i--)this.words[i+n]=this.words[i];for(i=0;i<n;i++)this.words[i]=0;this.length+=n}return this._strip()},h.prototype.ishln=function(t){return e(0===this.negative),this.iushln(t)},h.prototype.iushrn=function(t,i,r){var n;e("number"==typeof t&&t>=0),n=i?(i-i%26)/26:0;var h=t%26,o=Math.min((t-h)/26,this.length),s=67108863^67108863>>>h<<h,u=r;if(n-=o,n=Math.max(0,n),u){for(var a=0;a<o;a++)u.words[a]=this.words[a];u.length=o}if(0===o);else if(this.length>o)for(this.length-=o,a=0;a<this.length;a++)this.words[a]=this.words[a+o];else this.words[0]=0,this.length=1;var l=0;for(a=this.length-1;a>=0&&(0!==l||a>=n);a--){var m=0|this.words[a];this.words[a]=l<<26-h|m>>>h,l=m&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},h.prototype.ishrn=function(t,i,r){return e(0===this.negative),this.iushrn(t,i,r)},h.prototype.shln=function(t){return this.clone().ishln(t)},h.prototype.ushln=function(t){return this.clone().iushln(t)},h.prototype.shrn=function(t){return this.clone().ishrn(t)},h.prototype.ushrn=function(t){return this.clone().iushrn(t)},h.prototype.testn=function(t){e("number"==typeof t&&t>=0);var i=t%26,r=(t-i)/26,n=1<<i;return!(this.length<=r||!(this.words[r]&n))},h.prototype.imaskn=function(t){e("number"==typeof t&&t>=0);var i=t%26,r=(t-i)/26;if(e(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==i&&r++,this.length=Math.min(r,this.length),0!==i){var n=67108863^67108863>>>i<<i;this.words[this.length-1]&=n}return this._strip()},h.prototype.maskn=function(t){return this.clone().imaskn(t)},h.prototype.iaddn=function(t){return e("number"==typeof t),e(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<=t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},h.prototype._iaddn=function(t){this.words[0]+=t;for(var i=0;i<this.length&&this.words[i]>=67108864;i++)this.words[i]-=67108864,i===this.length-1?this.words[i+1]=1:this.words[i+1]++;return this.length=Math.max(this.length,i+1),this},h.prototype.isubn=function(t){if(e("number"==typeof t),e(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var i=0;i<this.length&&this.words[i]<0;i++)this.words[i]+=67108864,this.words[i+1]-=1;return this._strip()},h.prototype.addn=function(t){return this.clone().iaddn(t)},h.prototype.subn=function(t){return this.clone().isubn(t)},h.prototype.iabs=function(){return this.negative=0,this},h.prototype.abs=function(){return this.clone().iabs()},h.prototype._ishlnsubmul=function(t,i,r){var n,h,o=t.length+r;this._expand(o);var s=0;for(n=0;n<t.length;n++){h=(0|this.words[n+r])+s;var u=(0|t.words[n])*i;s=((h-=67108863&u)>>26)-(u/67108864|0),this.words[n+r]=67108863&h}for(;n<this.length-r;n++)s=(h=(0|this.words[n+r])+s)>>26,this.words[n+r]=67108863&h;if(0===s)return this._strip();for(e(-1===s),s=0,n=0;n<this.length;n++)s=(h=-(0|this.words[n])+s)>>26,this.words[n]=67108863&h;return this.negative=1,this._strip()},h.prototype._wordDiv=function(t,i){var r=(this.length,t.length),e=this.clone(),n=t,o=0|n.words[n.length-1];0!=(r=26-this._countBits(o))&&(n=n.ushln(r),e.iushln(r),o=0|n.words[n.length-1]);var s,u=e.length-n.length;if("mod"!==i){(s=new h(null)).length=u+1,s.words=new Array(s.length);for(var a=0;a<s.length;a++)s.words[a]=0}var l=e.clone()._ishlnsubmul(n,1,u);0===l.negative&&(e=l,s&&(s.words[u]=1));for(var m=u-1;m>=0;m--){var f=67108864*(0|e.words[n.length+m])+(0|e.words[n.length+m-1]);for(f=Math.min(f/o|0,67108863),e._ishlnsubmul(n,f,m);0!==e.negative;)f--,e.negative=0,e._ishlnsubmul(n,1,m),e.isZero()||(e.negative^=1);s&&(s.words[m]=f)}return s&&s._strip(),e._strip(),"div"!==i&&0!==r&&e.iushrn(r),{div:s||null,mod:e}},h.prototype.divmod=function(t,i,r){return e(!t.isZero()),this.isZero()?{div:new h(0),mod:new h(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,i),"mod"!==i&&(n=s.div.neg()),"div"!==i&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),i),"mod"!==i&&(n=s.div.neg()),{div:n,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),i),"div"!==i&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new h(0),mod:this}:1===t.length?"div"===i?{div:this.divn(t.words[0]),mod:null}:"mod"===i?{div:null,mod:new h(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new h(this.modrn(t.words[0]))}:this._wordDiv(t,i);var n,o,s},h.prototype.div=function(t){return this.divmod(t,"div",!1).div},h.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},h.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},h.prototype.divRound=function(t){var i=this.divmod(t);if(i.mod.isZero())return i.div;var r=0!==i.div.negative?i.mod.isub(t):i.mod,e=t.ushrn(1),n=t.andln(1),h=r.cmp(e);return h<0||1===n&&0===h?i.div:0!==i.div.negative?i.div.isubn(1):i.div.iaddn(1)},h.prototype.modrn=function(t){var i=t<0;i&&(t=-t),e(t<=67108863);for(var r=(1<<26)%t,n=0,h=this.length-1;h>=0;h--)n=(r*n+(0|this.words[h]))%t;return i?-n:n},h.prototype.modn=function(t){return this.modrn(t)},h.prototype.idivn=function(t){var i=t<0;i&&(t=-t),e(t<=67108863);for(var r=0,n=this.length-1;n>=0;n--){var h=(0|this.words[n])+67108864*r;this.words[n]=h/t|0,r=h%t}return this._strip(),i?this.ineg():this},h.prototype.divn=function(t){return this.clone().idivn(t)},h.prototype.egcd=function(t){e(0===t.negative),e(!t.isZero());var i=this,r=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var n=new h(1),o=new h(0),s=new h(0),u=new h(1),a=0;i.isEven()&&r.isEven();)i.iushrn(1),r.iushrn(1),++a;for(var l=r.clone(),m=i.clone();!i.isZero();){for(var f=0,d=1;0==(i.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(i.iushrn(f);f-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(l),o.isub(m)),n.iushrn(1),o.iushrn(1);for(var p=0,g=1;0==(r.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(m)),s.iushrn(1),u.iushrn(1);i.cmp(r)>=0?(i.isub(r),n.isub(s),o.isub(u)):(r.isub(i),s.isub(n),u.isub(o))}return{a:s,b:u,gcd:r.iushln(a)}},h.prototype._invmp=function(t){e(0===t.negative),e(!t.isZero());var i=this,r=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var n,o=new h(1),s=new h(0),u=r.clone();i.cmpn(1)>0&&r.cmpn(1)>0;){for(var a=0,l=1;0==(i.words[0]&l)&&a<26;++a,l<<=1);if(a>0)for(i.iushrn(a);a-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var m=0,f=1;0==(r.words[0]&f)&&m<26;++m,f<<=1);if(m>0)for(r.iushrn(m);m-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);i.cmp(r)>=0?(i.isub(r),o.isub(s)):(r.isub(i),s.isub(o))}return(n=0===i.cmpn(1)?o:s).cmpn(0)<0&&n.iadd(t),n},h.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var i=this.clone(),r=t.clone();i.negative=0,r.negative=0;for(var e=0;i.isEven()&&r.isEven();e++)i.iushrn(1),r.iushrn(1);for(;;){for(;i.isEven();)i.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=i.cmp(r);if(n<0){var h=i;i=r,r=h}else if(0===n||0===r.cmpn(1))break;i.isub(r)}return r.iushln(e)},h.prototype.invm=function(t){return this.egcd(t).a.umod(t)},h.prototype.isEven=function(){return 0==(1&this.words[0])},h.prototype.isOdd=function(){return 1==(1&this.words[0])},h.prototype.andln=function(t){return this.words[0]&t},h.prototype.bincn=function(t){e("number"==typeof t);var i=t%26,r=(t-i)/26,n=1<<i;if(this.length<=r)return this._expand(r+1),this.words[r]|=n,this;for(var h=n,o=r;0!==h&&o<this.length;o++){var s=0|this.words[o];h=(s+=h)>>>26,s&=67108863,this.words[o]=s}return 0!==h&&(this.words[o]=h,this.length++),this},h.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},h.prototype.cmpn=function(t){var i,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)i=1;else{r&&(t=-t),e(t<=67108863,"Number is too big");var n=0|this.words[0];i=n===t?0:n<t?-1:1}return 0!==this.negative?0|-i:i},h.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var i=this.ucmp(t);return 0!==this.negative?0|-i:i},h.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var i=0,r=this.length-1;r>=0;r--){var e=0|this.words[r],n=0|t.words[r];if(e!==n){e<n?i=-1:e>n&&(i=1);break}}return i},h.prototype.gtn=function(t){return 1===this.cmpn(t)},h.prototype.gt=function(t){return 1===this.cmp(t)},h.prototype.gten=function(t){return this.cmpn(t)>=0},h.prototype.gte=function(t){return this.cmp(t)>=0},h.prototype.ltn=function(t){return-1===this.cmpn(t)},h.prototype.lt=function(t){return-1===this.cmp(t)},h.prototype.lten=function(t){return this.cmpn(t)<=0},h.prototype.lte=function(t){return this.cmp(t)<=0},h.prototype.eqn=function(t){return 0===this.cmpn(t)},h.prototype.eq=function(t){return 0===this.cmp(t)},h.red=function(t){return new R(t)},h.prototype.toRed=function(t){return e(!this.red,"Already a number in reduction context"),e(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},h.prototype.fromRed=function(){return e(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},h.prototype._forceRed=function(t){return this.red=t,this},h.prototype.forceRed=function(t){return e(!this.red,"Already a number in reduction context"),this._forceRed(t)},h.prototype.redAdd=function(t){return e(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},h.prototype.redIAdd=function(t){return e(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},h.prototype.redSub=function(t){return e(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},h.prototype.redISub=function(t){return e(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},h.prototype.redShl=function(t){return e(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},h.prototype.redMul=function(t){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},h.prototype.redIMul=function(t){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},h.prototype.redSqr=function(){return e(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},h.prototype.redISqr=function(){return e(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},h.prototype.redSqrt=function(){return e(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},h.prototype.redInvm=function(){return e(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},h.prototype.redNeg=function(){return e(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},h.prototype.redPow=function(t){return e(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function y(t,i){this.name=t,this.p=new h(i,16),this.n=this.p.bitLength(),this.k=new h(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function E(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function N(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function R(t){if("string"==typeof t){var i=h._prime(t);this.m=i.p,this.prime=i}else e(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function S(t){R.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new h(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}y.prototype._tmp=function(){var t=new h(null);return t.words=new Array(Math.ceil(this.n/13)),t},y.prototype.ireduce=function(t){var i,r=t;do{this.split(r,this.tmp),i=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(i>this.n);var e=i<this.n?-1:r.ucmp(this.p);return 0===e?(r.words[0]=0,r.length=1):e>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},y.prototype.split=function(t,i){t.iushrn(this.n,0,i)},y.prototype.imulK=function(t){return t.imul(this.k)},n(b,y),b.prototype.split=function(t,i){for(var r=4194303,e=Math.min(t.length,9),n=0;n<e;n++)i.words[n]=t.words[n];if(i.length=e,t.length<=9)return t.words[0]=0,void(t.length=1);var h=t.words[9];for(i.words[i.length++]=h&r,n=10;n<t.length;n++){var o=0|t.words[n];t.words[n-10]=(o&r)<<4|h>>>22,h=o}h>>>=22,t.words[n-10]=h,0===h&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var i=0,r=0;r<t.length;r++){var e=0|t.words[r];i+=977*e,t.words[r]=67108863&i,i=64*e+(i/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},n(E,y),n(N,y),n(_,y),_.prototype.imulK=function(t){for(var i=0,r=0;r<t.length;r++){var e=19*(0|t.words[r])+i,n=67108863&e;e>>>=26,t.words[r]=n,i=e}return 0!==i&&(t.words[t.length++]=i),t},h._prime=function(t){if(w[t])return w[t];var i;if("k256"===t)i=new b;else if("p224"===t)i=new E;else if("p192"===t)i=new N;else{if("p25519"!==t)throw new Error("Unknown prime "+t);i=new _}return w[t]=i,i},R.prototype._verify1=function(t){e(0===t.negative,"red works only with positives"),e(t.red,"red works only with red numbers")},R.prototype._verify2=function(t,i){e(0==(t.negative|i.negative),"red works only with positives"),e(t.red&&t.red===i.red,"red works only with red numbers")},R.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(l(t,t.umod(this.m)._forceRed(this)),t)},R.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},R.prototype.add=function(t,i){this._verify2(t,i);var r=t.add(i);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},R.prototype.iadd=function(t,i){this._verify2(t,i);var r=t.iadd(i);return r.cmp(this.m)>=0&&r.isub(this.m),r},R.prototype.sub=function(t,i){this._verify2(t,i);var r=t.sub(i);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},R.prototype.isub=function(t,i){this._verify2(t,i);var r=t.isub(i);return r.cmpn(0)<0&&r.iadd(this.m),r},R.prototype.shl=function(t,i){return this._verify1(t),this.imod(t.ushln(i))},R.prototype.imul=function(t,i){return this._verify2(t,i),this.imod(t.imul(i))},R.prototype.mul=function(t,i){return this._verify2(t,i),this.imod(t.mul(i))},R.prototype.isqr=function(t){return this.imul(t,t.clone())},R.prototype.sqr=function(t){return this.mul(t,t)},R.prototype.sqrt=function(t){if(t.isZero())return t.clone();var i=this.m.andln(3);if(e(i%2==1),3===i){var r=this.m.add(new h(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);e(!n.isZero());var s=new h(1).toRed(this),u=s.redNeg(),a=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new h(2*l*l).toRed(this);0!==this.pow(l,a).cmp(u);)l.redIAdd(u);for(var m=this.pow(l,n),f=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=o;0!==d.cmp(s);){for(var g=d,c=0;0!==g.cmp(s);c++)g=g.redSqr();e(c<p);var M=this.pow(m,new h(1).iushln(p-c-1));f=f.redMul(M),m=M.redSqr(),d=d.redMul(m),p=c}return f},R.prototype.invm=function(t){var i=t._invmp(this.m);return 0!==i.negative?(i.negative=0,this.imod(i).redNeg()):this.imod(i)},R.prototype.pow=function(t,i){if(i.isZero())return new h(1).toRed(this);if(0===i.cmpn(1))return t.clone();var r=new Array(16);r[0]=new h(1).toRed(this),r[1]=t;for(var e=2;e<r.length;e++)r[e]=this.mul(r[e-1],t);var n=r[0],o=0,s=0,u=i.bitLength()%26;for(0===u&&(u=26),e=i.length-1;e>=0;e--){for(var a=i.words[e],l=u-1;l>=0;l--){var m=a>>l&1;n!==r[0]&&(n=this.sqr(n)),0!==m||0!==o?(o<<=1,o|=m,(4==++s||0===e&&0===l)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}u=26}return n},R.prototype.convertTo=function(t){var i=t.umod(this.m);return i===t?i.clone():i},R.prototype.convertFrom=function(t){var i=t.clone();return i.red=null,i},h.mont=function(t){return new S(t)},n(S,R),S.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},S.prototype.convertFrom=function(t){var i=this.imod(t.mul(this.rinv));return i.red=null,i},S.prototype.imul=function(t,i){if(t.isZero()||i.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(i),e=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(e).iushrn(this.shift),h=n;return n.cmp(this.m)>=0?h=n.isub(this.m):n.cmpn(0)<0&&(h=n.iadd(this.m)),h._forceRed(this)},S.prototype.mul=function(t,i){if(t.isZero()||i.isZero())return new h(0)._forceRed(this);var r=t.mul(i),e=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(e).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},S.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(v,t);const w="bignumber/5.7.0";var y=v.exports.BN;const b=new c(w),E={},N=9007199254740991;function _(t){return null!=t&&(S.isBigNumber(t)||"number"==typeof t&&t%1==0||"string"==typeof t&&!!t.match(/^-?[0-9]+$/)||h(t)||"bigint"==typeof t||e(t))}let R=!1;class S{constructor(t,i){t!==E&&b.throwError("cannot call constructor directly; use BigNumber.from",c.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=i,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return I(T(this).fromTwos(t))}toTwos(t){return I(T(this).toTwos(t))}abs(){return"-"===this._hex[0]?S.from(this._hex.substring(1)):this}add(t){return I(T(this).add(T(t)))}sub(t){return I(T(this).sub(T(t)))}div(t){return S.from(t).isZero()&&O("division-by-zero","div"),I(T(this).div(T(t)))}mul(t){return I(T(this).mul(T(t)))}mod(t){const i=T(t);return i.isNeg()&&O("division-by-zero","mod"),I(T(this).umod(i))}pow(t){const i=T(t);return i.isNeg()&&O("negative-power","pow"),I(T(this).pow(i))}and(t){const i=T(t);return(this.isNegative()||i.isNeg())&&O("unbound-bitwise-result","and"),I(T(this).and(i))}or(t){const i=T(t);return(this.isNegative()||i.isNeg())&&O("unbound-bitwise-result","or"),I(T(this).or(i))}xor(t){const i=T(t);return(this.isNegative()||i.isNeg())&&O("unbound-bitwise-result","xor"),I(T(this).xor(i))}mask(t){return(this.isNegative()||t<0)&&O("negative-width","mask"),I(T(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&O("negative-width","shl"),I(T(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&O("negative-width","shr"),I(T(this).shrn(t))}eq(t){return T(this).eq(T(t))}lt(t){return T(this).lt(T(t))}lte(t){return T(this).lte(T(t))}gt(t){return T(this).gt(T(t))}gte(t){return T(this).gte(T(t))}isNegative(){return"-"===this._hex[0]}isZero(){return T(this).isZero()}toNumber(){try{return T(this).toNumber()}catch(t){O("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return b.throwError("this platform does not support BigInt",c.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?R||(R=!0,b.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?b.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",c.errors.UNEXPECTED_ARGUMENT,{}):b.throwError("BigNumber.toString does not accept parameters",c.errors.UNEXPECTED_ARGUMENT,{})),T(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof S)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new S(E,A(t)):t.match(/^-?[0-9]+$/)?new S(E,A(new y(t))):b.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&O("underflow","BigNumber.from",t),(t>=N||t<=-N)&&O("overflow","BigNumber.from",t),S.from(String(t));const i=t;if("bigint"==typeof i)return S.from(i.toString());if(e(i))return S.from(n(i));if(i)if(i.toHexString){const t=i.toHexString();if("string"==typeof t)return S.from(t)}else{let t=i._hex;if(null==t&&"BigNumber"===i.type&&(t=i.hex),"string"==typeof t&&(h(t)||"-"===t[0]&&h(t.substring(1))))return S.from(t)}return b.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function A(t){if("string"!=typeof t)return A(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&b.throwArgumentError("invalid hex","value",t),"0x00"===(t=A(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function I(t){return S.from(A(t))}function T(t){const i=S.from(t).toHexString();return"-"===i[0]?new y("-"+i.substring(3),16):new y(i.substring(2),16)}function O(t,i,r){const e={fault:t,operation:i};return null!=r&&(e.value=r),b.throwError(t,c.errors.NUMERIC_FAULT,e)}const U=new c("strings/5.7.0");var C,k;function x(t,i,r,e,n){if(t===k.BAD_PREFIX||t===k.UNEXPECTED_CONTINUE){let t=0;for(let e=i+1;e<r.length&&r[e]>>6==2;e++)t++;return t}return t===k.OVERRUN?r.length-i-1:0}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(C||(C={})),function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"}(k||(k={}));const L=Object.freeze({error:function(t,i,r,e,n){return U.throwArgumentError(`invalid codepoint at offset ${i}; ${t}`,"bytes",r)},ignore:x,replace:function(t,i,r,e,n){return t===k.OVERLONG?(e.push(n),0):(e.push(65533),x(t,i,r))}});function P(t,i){null==i&&(i=L.error),t=o(t);const r=[];let e=0;for(;e<t.length;){const n=t[e++];if(n>>7==0){r.push(n);continue}let h=null,o=null;if(192==(224&n))h=1,o=127;else if(224==(240&n))h=2,o=2047;else{if(240!=(248&n)){e+=i(128==(192&n)?k.UNEXPECTED_CONTINUE:k.BAD_PREFIX,e-1,t,r);continue}h=3,o=65535}if(e-1+h>=t.length){e+=i(k.OVERRUN,e-1,t,r);continue}let s=n&(1<<8-h-1)-1;for(let n=0;n<h;n++){let n=t[e];if(128!=(192&n)){e+=i(k.MISSING_CONTINUE,e,t,r),s=null;break}s=s<<6|63&n,e++}null!==s&&(s>1114111?e+=i(k.OUT_OF_RANGE,e-1-h,t,r,s):s>=55296&&s<=57343?e+=i(k.UTF16_SURROGATE,e-1-h,t,r,s):s<=o?e+=i(k.OVERLONG,e-1-h,t,r,s):r.push(s))}return r}function D(t,i=C.current){i!=C.current&&(U.checkNormalize(),t=t.normalize(i));let r=[];for(let i=0;i<t.length;i++){const e=t.charCodeAt(i);if(e<128)r.push(e);else if(e<2048)r.push(e>>6|192),r.push(63&e|128);else if(55296==(64512&e)){i++;const n=t.charCodeAt(i);if(i>=t.length||56320!=(64512&n))throw new Error("invalid utf-8 string");const h=65536+((1023&e)<<10)+(1023&n);r.push(h>>18|240),r.push(h>>12&63|128),r.push(h>>6&63|128),r.push(63&h|128)}else r.push(e>>12|224),r.push(e>>6&63|128),r.push(63&e|128)}return o(r)}function B(t){const i="0000"+t.toString(16);return"\\u"+i.substring(i.length-4)}function F(t,i){return'"'+P(t,i).map((t=>{if(t<256){switch(t){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 13:return"\\r";case 34:return'\\"';case 92:return"\\\\"}if(t>=32&&t<127)return String.fromCharCode(t)}return t<=65535?B(t):B(55296+((t-=65536)>>10&1023))+B(56320+(1023&t))})).join("")+'"'}function G(t){return t.map((t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10&1023),56320+(1023&t))))).join("")}function Z(t,i){return G(P(t,i))}function q(t,i=C.current){return P(D(t,i))}function z(t){return i(D(t))}export{S as B,p as E,c as L,C as U,G as _,Z as a,_ as b,q as c,F as d,L as e,k as f,z as i,M as l,D as t,w as v};
|
|
1
|
+
import{c as t,k as i}from"./index-b659401e.js";import{r}from"./__node-resolve_empty-59fa3c56.js";import{isBytes as e,hexlify as n,isHexString as h,arrayify as o}from"@ethersproject/bytes";let s=!1,u=!1;const a={debug:1,default:2,info:2,warning:3,error:4,off:5};let l=a.default,m=null;const f=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((i=>{try{if("test"!=="test".normalize(i))throw new Error("bad normalize")}catch(r){t.push(i)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var d,p;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(d||(d={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(p||(p={}));const g="0123456789abcdef";class c{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,i){const r=t.toLowerCase();null==a[r]&&this.throwArgumentError("invalid log level name","logLevel",t),l>a[r]||console.log.apply(console,i)}debug(...t){this._log(c.levels.DEBUG,t)}info(...t){this._log(c.levels.INFO,t)}warn(...t){this._log(c.levels.WARNING,t)}makeError(t,i,r){if(u)return this.makeError("censored error",i,{});i||(i=c.errors.UNKNOWN_ERROR),r||(r={});const e=[];Object.keys(r).forEach((t=>{const i=r[t];try{if(i instanceof Uint8Array){let r="";for(let t=0;t<i.length;t++)r+=g[i[t]>>4],r+=g[15&i[t]];e.push(t+"=Uint8Array(0x"+r+")")}else e.push(t+"="+JSON.stringify(i))}catch(i){e.push(t+"="+JSON.stringify(r[t].toString()))}})),e.push(`code=${i}`),e.push(`version=${this.version}`);const n=t;let h="";switch(i){case p.NUMERIC_FAULT:{h="NUMERIC_FAULT";const i=t;switch(i){case"overflow":case"underflow":case"division-by-zero":h+="-"+i;break;case"negative-power":case"negative-width":h+="-unsupported";break;case"unbound-bitwise-result":h+="-unbound-result"}break}case p.CALL_EXCEPTION:case p.INSUFFICIENT_FUNDS:case p.MISSING_NEW:case p.NONCE_EXPIRED:case p.REPLACEMENT_UNDERPRICED:case p.TRANSACTION_REPLACED:case p.UNPREDICTABLE_GAS_LIMIT:h=i}h&&(t+=" [ See: https://links.ethers.org/v5-errors-"+h+" ]"),e.length&&(t+=" ("+e.join(", ")+")");const o=new Error(t);return o.reason=n,o.code=i,Object.keys(r).forEach((function(t){o[t]=r[t]})),o}throwError(t,i,r){throw this.makeError(t,i,r)}throwArgumentError(t,i,r){return this.throwError(t,c.errors.INVALID_ARGUMENT,{argument:i,value:r})}assert(t,i,r,e){t||this.throwError(i,r,e)}assertArgument(t,i,r,e){t||this.throwArgumentError(i,r,e)}checkNormalize(t){f&&this.throwError("platform missing String.prototype.normalize",c.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:f})}checkSafeUint53(t,i){"number"==typeof t&&(null==i&&(i="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(i,c.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(i,c.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,i,r){r=r?": "+r:"",t<i&&this.throwError("missing argument"+r,c.errors.MISSING_ARGUMENT,{count:t,expectedCount:i}),t>i&&this.throwError("too many arguments"+r,c.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:i})}checkNew(t,i){t!==Object&&null!=t||this.throwError("missing new",c.errors.MISSING_NEW,{name:i.name})}checkAbstract(t,i){t===i?this.throwError("cannot instantiate abstract class "+JSON.stringify(i.name)+" directly; use a sub-class",c.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",c.errors.MISSING_NEW,{name:i.name})}static globalLogger(){return m||(m=new c("logger/5.7.0")),m}static setCensorship(t,i){if(!t&&i&&this.globalLogger().throwError("cannot permanently disable censorship",c.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),s){if(!t)return;this.globalLogger().throwError("error censorship permanent",c.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}u=!!t,s=!!i}static setLogLevel(t){const i=a[t.toLowerCase()];null!=i?l=i:c.globalLogger().warn("invalid log level - "+t)}static from(t){return new c(t)}}c.errors=p,c.levels=d;var M=Object.freeze({__proto__:null,get LogLevel(){return d},get ErrorCode(){return p},Logger:c}),v={exports:{}};!function(t,i){function e(t,i){if(!t)throw new Error(i||"Assertion failed")}function n(t,i){t.super_=i;var r=function(){};r.prototype=i.prototype,t.prototype=new r,t.prototype.constructor=t}function h(t,i,r){if(h.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==i&&"be"!==i||(r=i,i=10),this._init(t||0,i||10,r||"be"))}var o;"object"==typeof t?t.exports=h:i.BN=h,h.BN=h,h.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r.Buffer}catch(t){}function s(t,i){var r=t.charCodeAt(i);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void e(!1,"Invalid character in "+t)}function u(t,i,r){var e=s(t,r);return r-1>=i&&(e|=s(t,r-1)<<4),e}function a(t,i,r,n){for(var h=0,o=0,s=Math.min(t.length,r),u=i;u<s;u++){var a=t.charCodeAt(u)-48;h*=n,o=a>=49?a-49+10:a>=17?a-17+10:a,e(a>=0&&o<n,"Invalid character"),h+=o}return h}function l(t,i){t.words=i.words,t.length=i.length,t.negative=i.negative,t.red=i.red}if(h.isBN=function(t){return t instanceof h||null!==t&&"object"==typeof t&&t.constructor.wordSize===h.wordSize&&Array.isArray(t.words)},h.max=function(t,i){return t.cmp(i)>0?t:i},h.min=function(t,i){return t.cmp(i)<0?t:i},h.prototype._init=function(t,i,r){if("number"==typeof t)return this._initNumber(t,i,r);if("object"==typeof t)return this._initArray(t,i,r);"hex"===i&&(i=16),e(i===(0|i)&&i>=2&&i<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<t.length&&(16===i?this._parseHex(t,n,r):(this._parseBase(t,i,n),"le"===r&&this._initArray(this.toArray(),i,r)))},h.prototype._initNumber=function(t,i,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(e(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),i,r)},h.prototype._initArray=function(t,i,r){if(e("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var h,o,s=0;if("be"===r)for(n=t.length-1,h=0;n>=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[h]|=o<<s&67108863,this.words[h+1]=o>>>26-s&67108863,(s+=24)>=26&&(s-=26,h++);else if("le"===r)for(n=0,h=0;n<t.length;n+=3)o=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[h]|=o<<s&67108863,this.words[h+1]=o>>>26-s&67108863,(s+=24)>=26&&(s-=26,h++);return this._strip()},h.prototype._parseHex=function(t,i,r){this.length=Math.ceil((t.length-i)/6),this.words=new Array(this.length);for(var e=0;e<this.length;e++)this.words[e]=0;var n,h=0,o=0;if("be"===r)for(e=t.length-1;e>=i;e-=2)n=u(t,i,e)<<h,this.words[o]|=67108863&n,h>=18?(h-=18,o+=1,this.words[o]|=n>>>26):h+=8;else for(e=(t.length-i)%2==0?i+1:i;e<t.length;e+=2)n=u(t,i,e)<<h,this.words[o]|=67108863&n,h>=18?(h-=18,o+=1,this.words[o]|=n>>>26):h+=8;this._strip()},h.prototype._parseBase=function(t,i,r){this.words=[0],this.length=1;for(var e=0,n=1;n<=67108863;n*=i)e++;e--,n=n/i|0;for(var h=t.length-r,o=h%e,s=Math.min(h,h-o)+r,u=0,l=r;l<s;l+=e)u=a(t,l,l+e,i),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==o){var m=1;for(u=a(t,l,t.length,i),l=0;l<o;l++)m*=i;this.imuln(m),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},h.prototype.copy=function(t){t.words=new Array(this.length);for(var i=0;i<this.length;i++)t.words[i]=this.words[i];t.length=this.length,t.negative=this.negative,t.red=this.red},h.prototype._move=function(t){l(t,this)},h.prototype.clone=function(){var t=new h(null);return this.copy(t),t},h.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},h.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},h.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{h.prototype[Symbol.for("nodejs.util.inspect.custom")]=m}catch(t){h.prototype.inspect=m}else h.prototype.inspect=m;function m(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function g(t,i,r){r.negative=i.negative^t.negative;var e=t.length+i.length|0;r.length=e,e=e-1|0;var n=0|t.words[0],h=0|i.words[0],o=n*h,s=67108863&o,u=o/67108864|0;r.words[0]=s;for(var a=1;a<e;a++){for(var l=u>>>26,m=67108863&u,f=Math.min(a,i.length-1),d=Math.max(0,a-t.length+1);d<=f;d++){var p=a-d|0;l+=(o=(n=0|t.words[p])*(h=0|i.words[d])+m)/67108864|0,m=67108863&o}r.words[a]=0|m,u=0|l}return 0!==u?r.words[a]=0|u:r.length--,r._strip()}h.prototype.toString=function(t,i){var r;if(i=0|i||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,h=0,o=0;o<this.length;o++){var s=this.words[o],u=(16777215&(s<<n|h)).toString(16);h=s>>>24-n&16777215,(n+=2)>=26&&(n-=26,o--),r=0!==h||o!==this.length-1?f[6-u.length]+u+r:u+r}for(0!==h&&(r=h.toString(16)+r);r.length%i!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var a=d[t],l=p[t];r="";var m=this.clone();for(m.negative=0;!m.isZero();){var g=m.modrn(l).toString(t);r=(m=m.idivn(l)).isZero()?g+r:f[a-g.length]+g+r}for(this.isZero()&&(r="0"+r);r.length%i!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}e(!1,"Base should be between 2 and 36")},h.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&e(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},h.prototype.toJSON=function(){return this.toString(16,2)},o&&(h.prototype.toBuffer=function(t,i){return this.toArrayLike(o,t,i)}),h.prototype.toArray=function(t,i){return this.toArrayLike(Array,t,i)},h.prototype.toArrayLike=function(t,i,r){this._strip();var n=this.byteLength(),h=r||Math.max(1,n);e(n<=h,"byte array longer than desired length"),e(h>0,"Requested array length <= 0");var o=function(t,i){return t.allocUnsafe?t.allocUnsafe(i):new t(i)}(t,h);return this["_toArrayLike"+("le"===i?"LE":"BE")](o,n),o},h.prototype._toArrayLikeLE=function(t,i){for(var r=0,e=0,n=0,h=0;n<this.length;n++){var o=this.words[n]<<h|e;t[r++]=255&o,r<t.length&&(t[r++]=o>>8&255),r<t.length&&(t[r++]=o>>16&255),6===h?(r<t.length&&(t[r++]=o>>24&255),e=0,h=0):(e=o>>>24,h+=2)}if(r<t.length)for(t[r++]=e;r<t.length;)t[r++]=0},h.prototype._toArrayLikeBE=function(t,i){for(var r=t.length-1,e=0,n=0,h=0;n<this.length;n++){var o=this.words[n]<<h|e;t[r--]=255&o,r>=0&&(t[r--]=o>>8&255),r>=0&&(t[r--]=o>>16&255),6===h?(r>=0&&(t[r--]=o>>24&255),e=0,h=0):(e=o>>>24,h+=2)}if(r>=0)for(t[r--]=e;r>=0;)t[r--]=0},Math.clz32?h.prototype._countBits=function(t){return 32-Math.clz32(t)}:h.prototype._countBits=function(t){var i=t,r=0;return i>=4096&&(r+=13,i>>>=13),i>=64&&(r+=7,i>>>=7),i>=8&&(r+=4,i>>>=4),i>=2&&(r+=2,i>>>=2),r+i},h.prototype._zeroBits=function(t){if(0===t)return 26;var i=t,r=0;return 0==(8191&i)&&(r+=13,i>>>=13),0==(127&i)&&(r+=7,i>>>=7),0==(15&i)&&(r+=4,i>>>=4),0==(3&i)&&(r+=2,i>>>=2),0==(1&i)&&r++,r},h.prototype.bitLength=function(){var t=this.words[this.length-1],i=this._countBits(t);return 26*(this.length-1)+i},h.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,i=0;i<this.length;i++){var r=this._zeroBits(this.words[i]);if(t+=r,26!==r)break}return t},h.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},h.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},h.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},h.prototype.isNeg=function(){return 0!==this.negative},h.prototype.neg=function(){return this.clone().ineg()},h.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},h.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var i=0;i<t.length;i++)this.words[i]=this.words[i]|t.words[i];return this._strip()},h.prototype.ior=function(t){return e(0==(this.negative|t.negative)),this.iuor(t)},h.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},h.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},h.prototype.iuand=function(t){var i;i=this.length>t.length?t:this;for(var r=0;r<i.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=i.length,this._strip()},h.prototype.iand=function(t){return e(0==(this.negative|t.negative)),this.iuand(t)},h.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},h.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},h.prototype.iuxor=function(t){var i,r;this.length>t.length?(i=this,r=t):(i=t,r=this);for(var e=0;e<r.length;e++)this.words[e]=i.words[e]^r.words[e];if(this!==i)for(;e<i.length;e++)this.words[e]=i.words[e];return this.length=i.length,this._strip()},h.prototype.ixor=function(t){return e(0==(this.negative|t.negative)),this.iuxor(t)},h.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},h.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},h.prototype.inotn=function(t){e("number"==typeof t&&t>=0);var i=0|Math.ceil(t/26),r=t%26;this._expand(i),r>0&&i--;for(var n=0;n<i;n++)this.words[n]=67108863&~this.words[n];return r>0&&(this.words[n]=~this.words[n]&67108863>>26-r),this._strip()},h.prototype.notn=function(t){return this.clone().inotn(t)},h.prototype.setn=function(t,i){e("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=i?this.words[r]|1<<n:this.words[r]&~(1<<n),this._strip()},h.prototype.iadd=function(t){var i,r,e;if(0!==this.negative&&0===t.negative)return this.negative=0,i=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,i=this.isub(t),t.negative=1,i._normSign();this.length>t.length?(r=this,e=t):(r=t,e=this);for(var n=0,h=0;h<e.length;h++)i=(0|r.words[h])+(0|e.words[h])+n,this.words[h]=67108863&i,n=i>>>26;for(;0!==n&&h<r.length;h++)i=(0|r.words[h])+n,this.words[h]=67108863&i,n=i>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;h<r.length;h++)this.words[h]=r.words[h];return this},h.prototype.add=function(t){var i;return 0!==t.negative&&0===this.negative?(t.negative=0,i=this.sub(t),t.negative^=1,i):0===t.negative&&0!==this.negative?(this.negative=0,i=t.sub(this),this.negative=1,i):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},h.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var i=this.iadd(t);return t.negative=1,i._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,e,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,e=t):(r=t,e=this);for(var h=0,o=0;o<e.length;o++)h=(i=(0|r.words[o])-(0|e.words[o])+h)>>26,this.words[o]=67108863&i;for(;0!==h&&o<r.length;o++)h=(i=(0|r.words[o])+h)>>26,this.words[o]=67108863&i;if(0===h&&o<r.length&&r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this.length=Math.max(this.length,o),r!==this&&(this.negative=1),this._strip()},h.prototype.sub=function(t){return this.clone().isub(t)};var c=function(t,i,r){var e,n,h,o=t.words,s=i.words,u=r.words,a=0,l=0|o[0],m=8191&l,f=l>>>13,d=0|o[1],p=8191&d,g=d>>>13,c=0|o[2],M=8191&c,v=c>>>13,w=0|o[3],y=8191&w,b=w>>>13,E=0|o[4],N=8191&E,_=E>>>13,R=0|o[5],S=8191&R,A=R>>>13,I=0|o[6],T=8191&I,O=I>>>13,U=0|o[7],C=8191&U,k=U>>>13,x=0|o[8],L=8191&x,P=x>>>13,D=0|o[9],B=8191&D,F=D>>>13,G=0|s[0],Z=8191&G,q=G>>>13,z=0|s[1],j=8191&z,X=z>>>13,K=0|s[2],V=8191&K,W=K>>>13,H=0|s[3],J=8191&H,$=H>>>13,Q=0|s[4],Y=8191&Q,tt=Q>>>13,it=0|s[5],rt=8191&it,et=it>>>13,nt=0|s[6],ht=8191&nt,ot=nt>>>13,st=0|s[7],ut=8191&st,at=st>>>13,lt=0|s[8],mt=8191<,ft=lt>>>13,dt=0|s[9],pt=8191&dt,gt=dt>>>13;r.negative=t.negative^i.negative,r.length=19;var ct=(a+(e=Math.imul(m,Z))|0)+((8191&(n=(n=Math.imul(m,q))+Math.imul(f,Z)|0))<<13)|0;a=((h=Math.imul(f,q))+(n>>>13)|0)+(ct>>>26)|0,ct&=67108863,e=Math.imul(p,Z),n=(n=Math.imul(p,q))+Math.imul(g,Z)|0,h=Math.imul(g,q);var Mt=(a+(e=e+Math.imul(m,j)|0)|0)+((8191&(n=(n=n+Math.imul(m,X)|0)+Math.imul(f,j)|0))<<13)|0;a=((h=h+Math.imul(f,X)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,e=Math.imul(M,Z),n=(n=Math.imul(M,q))+Math.imul(v,Z)|0,h=Math.imul(v,q),e=e+Math.imul(p,j)|0,n=(n=n+Math.imul(p,X)|0)+Math.imul(g,j)|0,h=h+Math.imul(g,X)|0;var vt=(a+(e=e+Math.imul(m,V)|0)|0)+((8191&(n=(n=n+Math.imul(m,W)|0)+Math.imul(f,V)|0))<<13)|0;a=((h=h+Math.imul(f,W)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,e=Math.imul(y,Z),n=(n=Math.imul(y,q))+Math.imul(b,Z)|0,h=Math.imul(b,q),e=e+Math.imul(M,j)|0,n=(n=n+Math.imul(M,X)|0)+Math.imul(v,j)|0,h=h+Math.imul(v,X)|0,e=e+Math.imul(p,V)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(g,V)|0,h=h+Math.imul(g,W)|0;var wt=(a+(e=e+Math.imul(m,J)|0)|0)+((8191&(n=(n=n+Math.imul(m,$)|0)+Math.imul(f,J)|0))<<13)|0;a=((h=h+Math.imul(f,$)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,e=Math.imul(N,Z),n=(n=Math.imul(N,q))+Math.imul(_,Z)|0,h=Math.imul(_,q),e=e+Math.imul(y,j)|0,n=(n=n+Math.imul(y,X)|0)+Math.imul(b,j)|0,h=h+Math.imul(b,X)|0,e=e+Math.imul(M,V)|0,n=(n=n+Math.imul(M,W)|0)+Math.imul(v,V)|0,h=h+Math.imul(v,W)|0,e=e+Math.imul(p,J)|0,n=(n=n+Math.imul(p,$)|0)+Math.imul(g,J)|0,h=h+Math.imul(g,$)|0;var yt=(a+(e=e+Math.imul(m,Y)|0)|0)+((8191&(n=(n=n+Math.imul(m,tt)|0)+Math.imul(f,Y)|0))<<13)|0;a=((h=h+Math.imul(f,tt)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,e=Math.imul(S,Z),n=(n=Math.imul(S,q))+Math.imul(A,Z)|0,h=Math.imul(A,q),e=e+Math.imul(N,j)|0,n=(n=n+Math.imul(N,X)|0)+Math.imul(_,j)|0,h=h+Math.imul(_,X)|0,e=e+Math.imul(y,V)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(b,V)|0,h=h+Math.imul(b,W)|0,e=e+Math.imul(M,J)|0,n=(n=n+Math.imul(M,$)|0)+Math.imul(v,J)|0,h=h+Math.imul(v,$)|0,e=e+Math.imul(p,Y)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(g,Y)|0,h=h+Math.imul(g,tt)|0;var bt=(a+(e=e+Math.imul(m,rt)|0)|0)+((8191&(n=(n=n+Math.imul(m,et)|0)+Math.imul(f,rt)|0))<<13)|0;a=((h=h+Math.imul(f,et)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,e=Math.imul(T,Z),n=(n=Math.imul(T,q))+Math.imul(O,Z)|0,h=Math.imul(O,q),e=e+Math.imul(S,j)|0,n=(n=n+Math.imul(S,X)|0)+Math.imul(A,j)|0,h=h+Math.imul(A,X)|0,e=e+Math.imul(N,V)|0,n=(n=n+Math.imul(N,W)|0)+Math.imul(_,V)|0,h=h+Math.imul(_,W)|0,e=e+Math.imul(y,J)|0,n=(n=n+Math.imul(y,$)|0)+Math.imul(b,J)|0,h=h+Math.imul(b,$)|0,e=e+Math.imul(M,Y)|0,n=(n=n+Math.imul(M,tt)|0)+Math.imul(v,Y)|0,h=h+Math.imul(v,tt)|0,e=e+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,et)|0)+Math.imul(g,rt)|0,h=h+Math.imul(g,et)|0;var Et=(a+(e=e+Math.imul(m,ht)|0)|0)+((8191&(n=(n=n+Math.imul(m,ot)|0)+Math.imul(f,ht)|0))<<13)|0;a=((h=h+Math.imul(f,ot)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,e=Math.imul(C,Z),n=(n=Math.imul(C,q))+Math.imul(k,Z)|0,h=Math.imul(k,q),e=e+Math.imul(T,j)|0,n=(n=n+Math.imul(T,X)|0)+Math.imul(O,j)|0,h=h+Math.imul(O,X)|0,e=e+Math.imul(S,V)|0,n=(n=n+Math.imul(S,W)|0)+Math.imul(A,V)|0,h=h+Math.imul(A,W)|0,e=e+Math.imul(N,J)|0,n=(n=n+Math.imul(N,$)|0)+Math.imul(_,J)|0,h=h+Math.imul(_,$)|0,e=e+Math.imul(y,Y)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(b,Y)|0,h=h+Math.imul(b,tt)|0,e=e+Math.imul(M,rt)|0,n=(n=n+Math.imul(M,et)|0)+Math.imul(v,rt)|0,h=h+Math.imul(v,et)|0,e=e+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,ot)|0)+Math.imul(g,ht)|0,h=h+Math.imul(g,ot)|0;var Nt=(a+(e=e+Math.imul(m,ut)|0)|0)+((8191&(n=(n=n+Math.imul(m,at)|0)+Math.imul(f,ut)|0))<<13)|0;a=((h=h+Math.imul(f,at)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,e=Math.imul(L,Z),n=(n=Math.imul(L,q))+Math.imul(P,Z)|0,h=Math.imul(P,q),e=e+Math.imul(C,j)|0,n=(n=n+Math.imul(C,X)|0)+Math.imul(k,j)|0,h=h+Math.imul(k,X)|0,e=e+Math.imul(T,V)|0,n=(n=n+Math.imul(T,W)|0)+Math.imul(O,V)|0,h=h+Math.imul(O,W)|0,e=e+Math.imul(S,J)|0,n=(n=n+Math.imul(S,$)|0)+Math.imul(A,J)|0,h=h+Math.imul(A,$)|0,e=e+Math.imul(N,Y)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(_,Y)|0,h=h+Math.imul(_,tt)|0,e=e+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,et)|0)+Math.imul(b,rt)|0,h=h+Math.imul(b,et)|0,e=e+Math.imul(M,ht)|0,n=(n=n+Math.imul(M,ot)|0)+Math.imul(v,ht)|0,h=h+Math.imul(v,ot)|0,e=e+Math.imul(p,ut)|0,n=(n=n+Math.imul(p,at)|0)+Math.imul(g,ut)|0,h=h+Math.imul(g,at)|0;var _t=(a+(e=e+Math.imul(m,mt)|0)|0)+((8191&(n=(n=n+Math.imul(m,ft)|0)+Math.imul(f,mt)|0))<<13)|0;a=((h=h+Math.imul(f,ft)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,e=Math.imul(B,Z),n=(n=Math.imul(B,q))+Math.imul(F,Z)|0,h=Math.imul(F,q),e=e+Math.imul(L,j)|0,n=(n=n+Math.imul(L,X)|0)+Math.imul(P,j)|0,h=h+Math.imul(P,X)|0,e=e+Math.imul(C,V)|0,n=(n=n+Math.imul(C,W)|0)+Math.imul(k,V)|0,h=h+Math.imul(k,W)|0,e=e+Math.imul(T,J)|0,n=(n=n+Math.imul(T,$)|0)+Math.imul(O,J)|0,h=h+Math.imul(O,$)|0,e=e+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(A,Y)|0,h=h+Math.imul(A,tt)|0,e=e+Math.imul(N,rt)|0,n=(n=n+Math.imul(N,et)|0)+Math.imul(_,rt)|0,h=h+Math.imul(_,et)|0,e=e+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ot)|0)+Math.imul(b,ht)|0,h=h+Math.imul(b,ot)|0,e=e+Math.imul(M,ut)|0,n=(n=n+Math.imul(M,at)|0)+Math.imul(v,ut)|0,h=h+Math.imul(v,at)|0,e=e+Math.imul(p,mt)|0,n=(n=n+Math.imul(p,ft)|0)+Math.imul(g,mt)|0,h=h+Math.imul(g,ft)|0;var Rt=(a+(e=e+Math.imul(m,pt)|0)|0)+((8191&(n=(n=n+Math.imul(m,gt)|0)+Math.imul(f,pt)|0))<<13)|0;a=((h=h+Math.imul(f,gt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,e=Math.imul(B,j),n=(n=Math.imul(B,X))+Math.imul(F,j)|0,h=Math.imul(F,X),e=e+Math.imul(L,V)|0,n=(n=n+Math.imul(L,W)|0)+Math.imul(P,V)|0,h=h+Math.imul(P,W)|0,e=e+Math.imul(C,J)|0,n=(n=n+Math.imul(C,$)|0)+Math.imul(k,J)|0,h=h+Math.imul(k,$)|0,e=e+Math.imul(T,Y)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(O,Y)|0,h=h+Math.imul(O,tt)|0,e=e+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,et)|0)+Math.imul(A,rt)|0,h=h+Math.imul(A,et)|0,e=e+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,ot)|0)+Math.imul(_,ht)|0,h=h+Math.imul(_,ot)|0,e=e+Math.imul(y,ut)|0,n=(n=n+Math.imul(y,at)|0)+Math.imul(b,ut)|0,h=h+Math.imul(b,at)|0,e=e+Math.imul(M,mt)|0,n=(n=n+Math.imul(M,ft)|0)+Math.imul(v,mt)|0,h=h+Math.imul(v,ft)|0;var St=(a+(e=e+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,gt)|0)+Math.imul(g,pt)|0))<<13)|0;a=((h=h+Math.imul(g,gt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,e=Math.imul(B,V),n=(n=Math.imul(B,W))+Math.imul(F,V)|0,h=Math.imul(F,W),e=e+Math.imul(L,J)|0,n=(n=n+Math.imul(L,$)|0)+Math.imul(P,J)|0,h=h+Math.imul(P,$)|0,e=e+Math.imul(C,Y)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(k,Y)|0,h=h+Math.imul(k,tt)|0,e=e+Math.imul(T,rt)|0,n=(n=n+Math.imul(T,et)|0)+Math.imul(O,rt)|0,h=h+Math.imul(O,et)|0,e=e+Math.imul(S,ht)|0,n=(n=n+Math.imul(S,ot)|0)+Math.imul(A,ht)|0,h=h+Math.imul(A,ot)|0,e=e+Math.imul(N,ut)|0,n=(n=n+Math.imul(N,at)|0)+Math.imul(_,ut)|0,h=h+Math.imul(_,at)|0,e=e+Math.imul(y,mt)|0,n=(n=n+Math.imul(y,ft)|0)+Math.imul(b,mt)|0,h=h+Math.imul(b,ft)|0;var At=(a+(e=e+Math.imul(M,pt)|0)|0)+((8191&(n=(n=n+Math.imul(M,gt)|0)+Math.imul(v,pt)|0))<<13)|0;a=((h=h+Math.imul(v,gt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,e=Math.imul(B,J),n=(n=Math.imul(B,$))+Math.imul(F,J)|0,h=Math.imul(F,$),e=e+Math.imul(L,Y)|0,n=(n=n+Math.imul(L,tt)|0)+Math.imul(P,Y)|0,h=h+Math.imul(P,tt)|0,e=e+Math.imul(C,rt)|0,n=(n=n+Math.imul(C,et)|0)+Math.imul(k,rt)|0,h=h+Math.imul(k,et)|0,e=e+Math.imul(T,ht)|0,n=(n=n+Math.imul(T,ot)|0)+Math.imul(O,ht)|0,h=h+Math.imul(O,ot)|0,e=e+Math.imul(S,ut)|0,n=(n=n+Math.imul(S,at)|0)+Math.imul(A,ut)|0,h=h+Math.imul(A,at)|0,e=e+Math.imul(N,mt)|0,n=(n=n+Math.imul(N,ft)|0)+Math.imul(_,mt)|0,h=h+Math.imul(_,ft)|0;var It=(a+(e=e+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,gt)|0)+Math.imul(b,pt)|0))<<13)|0;a=((h=h+Math.imul(b,gt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,e=Math.imul(B,Y),n=(n=Math.imul(B,tt))+Math.imul(F,Y)|0,h=Math.imul(F,tt),e=e+Math.imul(L,rt)|0,n=(n=n+Math.imul(L,et)|0)+Math.imul(P,rt)|0,h=h+Math.imul(P,et)|0,e=e+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,ot)|0)+Math.imul(k,ht)|0,h=h+Math.imul(k,ot)|0,e=e+Math.imul(T,ut)|0,n=(n=n+Math.imul(T,at)|0)+Math.imul(O,ut)|0,h=h+Math.imul(O,at)|0,e=e+Math.imul(S,mt)|0,n=(n=n+Math.imul(S,ft)|0)+Math.imul(A,mt)|0,h=h+Math.imul(A,ft)|0;var Tt=(a+(e=e+Math.imul(N,pt)|0)|0)+((8191&(n=(n=n+Math.imul(N,gt)|0)+Math.imul(_,pt)|0))<<13)|0;a=((h=h+Math.imul(_,gt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,e=Math.imul(B,rt),n=(n=Math.imul(B,et))+Math.imul(F,rt)|0,h=Math.imul(F,et),e=e+Math.imul(L,ht)|0,n=(n=n+Math.imul(L,ot)|0)+Math.imul(P,ht)|0,h=h+Math.imul(P,ot)|0,e=e+Math.imul(C,ut)|0,n=(n=n+Math.imul(C,at)|0)+Math.imul(k,ut)|0,h=h+Math.imul(k,at)|0,e=e+Math.imul(T,mt)|0,n=(n=n+Math.imul(T,ft)|0)+Math.imul(O,mt)|0,h=h+Math.imul(O,ft)|0;var Ot=(a+(e=e+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,gt)|0)+Math.imul(A,pt)|0))<<13)|0;a=((h=h+Math.imul(A,gt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,e=Math.imul(B,ht),n=(n=Math.imul(B,ot))+Math.imul(F,ht)|0,h=Math.imul(F,ot),e=e+Math.imul(L,ut)|0,n=(n=n+Math.imul(L,at)|0)+Math.imul(P,ut)|0,h=h+Math.imul(P,at)|0,e=e+Math.imul(C,mt)|0,n=(n=n+Math.imul(C,ft)|0)+Math.imul(k,mt)|0,h=h+Math.imul(k,ft)|0;var Ut=(a+(e=e+Math.imul(T,pt)|0)|0)+((8191&(n=(n=n+Math.imul(T,gt)|0)+Math.imul(O,pt)|0))<<13)|0;a=((h=h+Math.imul(O,gt)|0)+(n>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,e=Math.imul(B,ut),n=(n=Math.imul(B,at))+Math.imul(F,ut)|0,h=Math.imul(F,at),e=e+Math.imul(L,mt)|0,n=(n=n+Math.imul(L,ft)|0)+Math.imul(P,mt)|0,h=h+Math.imul(P,ft)|0;var Ct=(a+(e=e+Math.imul(C,pt)|0)|0)+((8191&(n=(n=n+Math.imul(C,gt)|0)+Math.imul(k,pt)|0))<<13)|0;a=((h=h+Math.imul(k,gt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,e=Math.imul(B,mt),n=(n=Math.imul(B,ft))+Math.imul(F,mt)|0,h=Math.imul(F,ft);var kt=(a+(e=e+Math.imul(L,pt)|0)|0)+((8191&(n=(n=n+Math.imul(L,gt)|0)+Math.imul(P,pt)|0))<<13)|0;a=((h=h+Math.imul(P,gt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863;var xt=(a+(e=Math.imul(B,pt))|0)+((8191&(n=(n=Math.imul(B,gt))+Math.imul(F,pt)|0))<<13)|0;return a=((h=Math.imul(F,gt))+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,u[0]=ct,u[1]=Mt,u[2]=vt,u[3]=wt,u[4]=yt,u[5]=bt,u[6]=Et,u[7]=Nt,u[8]=_t,u[9]=Rt,u[10]=St,u[11]=At,u[12]=It,u[13]=Tt,u[14]=Ot,u[15]=Ut,u[16]=Ct,u[17]=kt,u[18]=xt,0!==a&&(u[19]=a,r.length++),r};function M(t,i,r){r.negative=i.negative^t.negative,r.length=t.length+i.length;for(var e=0,n=0,h=0;h<r.length-1;h++){var o=n;n=0;for(var s=67108863&e,u=Math.min(h,i.length-1),a=Math.max(0,h-t.length+1);a<=u;a++){var l=h-a,m=(0|t.words[l])*(0|i.words[a]),f=67108863&m;s=67108863&(f=f+s|0),n+=(o=(o=o+(m/67108864|0)|0)+(f>>>26)|0)>>>26,o&=67108863}r.words[h]=s,e=o,o=n}return 0!==e?r.words[h]=e:r.length--,r._strip()}function v(t,i,r){return M(t,i,r)}Math.imul||(c=g),h.prototype.mulTo=function(t,i){var r=this.length+t.length;return 10===this.length&&10===t.length?c(this,t,i):r<63?g(this,t,i):r<1024?M(this,t,i):v(this,t,i)},h.prototype.mul=function(t){var i=new h(null);return i.words=new Array(this.length+t.length),this.mulTo(t,i)},h.prototype.mulf=function(t){var i=new h(null);return i.words=new Array(this.length+t.length),v(this,t,i)},h.prototype.imul=function(t){return this.clone().mulTo(t,this)},h.prototype.imuln=function(t){var i=t<0;i&&(t=-t),e("number"==typeof t),e(t<67108864);for(var r=0,n=0;n<this.length;n++){var h=(0|this.words[n])*t,o=(67108863&h)+(67108863&r);r>>=26,r+=h/67108864|0,r+=o>>>26,this.words[n]=67108863&o}return 0!==r&&(this.words[n]=r,this.length++),i?this.ineg():this},h.prototype.muln=function(t){return this.clone().imuln(t)},h.prototype.sqr=function(){return this.mul(this)},h.prototype.isqr=function(){return this.imul(this.clone())},h.prototype.pow=function(t){var i=function(t){for(var i=new Array(t.bitLength()),r=0;r<i.length;r++){var e=r/26|0,n=r%26;i[r]=t.words[e]>>>n&1}return i}(t);if(0===i.length)return new h(1);for(var r=this,e=0;e<i.length&&0===i[e];e++,r=r.sqr());if(++e<i.length)for(var n=r.sqr();e<i.length;e++,n=n.sqr())0!==i[e]&&(r=r.mul(n));return r},h.prototype.iushln=function(t){e("number"==typeof t&&t>=0);var i,r=t%26,n=(t-r)/26,h=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(i=0;i<this.length;i++){var s=this.words[i]&h,u=(0|this.words[i])-s<<r;this.words[i]=u|o,o=s>>>26-r}o&&(this.words[i]=o,this.length++)}if(0!==n){for(i=this.length-1;i>=0;i--)this.words[i+n]=this.words[i];for(i=0;i<n;i++)this.words[i]=0;this.length+=n}return this._strip()},h.prototype.ishln=function(t){return e(0===this.negative),this.iushln(t)},h.prototype.iushrn=function(t,i,r){var n;e("number"==typeof t&&t>=0),n=i?(i-i%26)/26:0;var h=t%26,o=Math.min((t-h)/26,this.length),s=67108863^67108863>>>h<<h,u=r;if(n-=o,n=Math.max(0,n),u){for(var a=0;a<o;a++)u.words[a]=this.words[a];u.length=o}if(0===o);else if(this.length>o)for(this.length-=o,a=0;a<this.length;a++)this.words[a]=this.words[a+o];else this.words[0]=0,this.length=1;var l=0;for(a=this.length-1;a>=0&&(0!==l||a>=n);a--){var m=0|this.words[a];this.words[a]=l<<26-h|m>>>h,l=m&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},h.prototype.ishrn=function(t,i,r){return e(0===this.negative),this.iushrn(t,i,r)},h.prototype.shln=function(t){return this.clone().ishln(t)},h.prototype.ushln=function(t){return this.clone().iushln(t)},h.prototype.shrn=function(t){return this.clone().ishrn(t)},h.prototype.ushrn=function(t){return this.clone().iushrn(t)},h.prototype.testn=function(t){e("number"==typeof t&&t>=0);var i=t%26,r=(t-i)/26,n=1<<i;return!(this.length<=r||!(this.words[r]&n))},h.prototype.imaskn=function(t){e("number"==typeof t&&t>=0);var i=t%26,r=(t-i)/26;if(e(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==i&&r++,this.length=Math.min(r,this.length),0!==i){var n=67108863^67108863>>>i<<i;this.words[this.length-1]&=n}return this._strip()},h.prototype.maskn=function(t){return this.clone().imaskn(t)},h.prototype.iaddn=function(t){return e("number"==typeof t),e(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<=t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},h.prototype._iaddn=function(t){this.words[0]+=t;for(var i=0;i<this.length&&this.words[i]>=67108864;i++)this.words[i]-=67108864,i===this.length-1?this.words[i+1]=1:this.words[i+1]++;return this.length=Math.max(this.length,i+1),this},h.prototype.isubn=function(t){if(e("number"==typeof t),e(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var i=0;i<this.length&&this.words[i]<0;i++)this.words[i]+=67108864,this.words[i+1]-=1;return this._strip()},h.prototype.addn=function(t){return this.clone().iaddn(t)},h.prototype.subn=function(t){return this.clone().isubn(t)},h.prototype.iabs=function(){return this.negative=0,this},h.prototype.abs=function(){return this.clone().iabs()},h.prototype._ishlnsubmul=function(t,i,r){var n,h,o=t.length+r;this._expand(o);var s=0;for(n=0;n<t.length;n++){h=(0|this.words[n+r])+s;var u=(0|t.words[n])*i;s=((h-=67108863&u)>>26)-(u/67108864|0),this.words[n+r]=67108863&h}for(;n<this.length-r;n++)s=(h=(0|this.words[n+r])+s)>>26,this.words[n+r]=67108863&h;if(0===s)return this._strip();for(e(-1===s),s=0,n=0;n<this.length;n++)s=(h=-(0|this.words[n])+s)>>26,this.words[n]=67108863&h;return this.negative=1,this._strip()},h.prototype._wordDiv=function(t,i){var r=(this.length,t.length),e=this.clone(),n=t,o=0|n.words[n.length-1];0!=(r=26-this._countBits(o))&&(n=n.ushln(r),e.iushln(r),o=0|n.words[n.length-1]);var s,u=e.length-n.length;if("mod"!==i){(s=new h(null)).length=u+1,s.words=new Array(s.length);for(var a=0;a<s.length;a++)s.words[a]=0}var l=e.clone()._ishlnsubmul(n,1,u);0===l.negative&&(e=l,s&&(s.words[u]=1));for(var m=u-1;m>=0;m--){var f=67108864*(0|e.words[n.length+m])+(0|e.words[n.length+m-1]);for(f=Math.min(f/o|0,67108863),e._ishlnsubmul(n,f,m);0!==e.negative;)f--,e.negative=0,e._ishlnsubmul(n,1,m),e.isZero()||(e.negative^=1);s&&(s.words[m]=f)}return s&&s._strip(),e._strip(),"div"!==i&&0!==r&&e.iushrn(r),{div:s||null,mod:e}},h.prototype.divmod=function(t,i,r){return e(!t.isZero()),this.isZero()?{div:new h(0),mod:new h(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,i),"mod"!==i&&(n=s.div.neg()),"div"!==i&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),i),"mod"!==i&&(n=s.div.neg()),{div:n,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),i),"div"!==i&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new h(0),mod:this}:1===t.length?"div"===i?{div:this.divn(t.words[0]),mod:null}:"mod"===i?{div:null,mod:new h(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new h(this.modrn(t.words[0]))}:this._wordDiv(t,i);var n,o,s},h.prototype.div=function(t){return this.divmod(t,"div",!1).div},h.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},h.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},h.prototype.divRound=function(t){var i=this.divmod(t);if(i.mod.isZero())return i.div;var r=0!==i.div.negative?i.mod.isub(t):i.mod,e=t.ushrn(1),n=t.andln(1),h=r.cmp(e);return h<0||1===n&&0===h?i.div:0!==i.div.negative?i.div.isubn(1):i.div.iaddn(1)},h.prototype.modrn=function(t){var i=t<0;i&&(t=-t),e(t<=67108863);for(var r=(1<<26)%t,n=0,h=this.length-1;h>=0;h--)n=(r*n+(0|this.words[h]))%t;return i?-n:n},h.prototype.modn=function(t){return this.modrn(t)},h.prototype.idivn=function(t){var i=t<0;i&&(t=-t),e(t<=67108863);for(var r=0,n=this.length-1;n>=0;n--){var h=(0|this.words[n])+67108864*r;this.words[n]=h/t|0,r=h%t}return this._strip(),i?this.ineg():this},h.prototype.divn=function(t){return this.clone().idivn(t)},h.prototype.egcd=function(t){e(0===t.negative),e(!t.isZero());var i=this,r=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var n=new h(1),o=new h(0),s=new h(0),u=new h(1),a=0;i.isEven()&&r.isEven();)i.iushrn(1),r.iushrn(1),++a;for(var l=r.clone(),m=i.clone();!i.isZero();){for(var f=0,d=1;0==(i.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(i.iushrn(f);f-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(l),o.isub(m)),n.iushrn(1),o.iushrn(1);for(var p=0,g=1;0==(r.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(m)),s.iushrn(1),u.iushrn(1);i.cmp(r)>=0?(i.isub(r),n.isub(s),o.isub(u)):(r.isub(i),s.isub(n),u.isub(o))}return{a:s,b:u,gcd:r.iushln(a)}},h.prototype._invmp=function(t){e(0===t.negative),e(!t.isZero());var i=this,r=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var n,o=new h(1),s=new h(0),u=r.clone();i.cmpn(1)>0&&r.cmpn(1)>0;){for(var a=0,l=1;0==(i.words[0]&l)&&a<26;++a,l<<=1);if(a>0)for(i.iushrn(a);a-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var m=0,f=1;0==(r.words[0]&f)&&m<26;++m,f<<=1);if(m>0)for(r.iushrn(m);m-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);i.cmp(r)>=0?(i.isub(r),o.isub(s)):(r.isub(i),s.isub(o))}return(n=0===i.cmpn(1)?o:s).cmpn(0)<0&&n.iadd(t),n},h.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var i=this.clone(),r=t.clone();i.negative=0,r.negative=0;for(var e=0;i.isEven()&&r.isEven();e++)i.iushrn(1),r.iushrn(1);for(;;){for(;i.isEven();)i.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=i.cmp(r);if(n<0){var h=i;i=r,r=h}else if(0===n||0===r.cmpn(1))break;i.isub(r)}return r.iushln(e)},h.prototype.invm=function(t){return this.egcd(t).a.umod(t)},h.prototype.isEven=function(){return 0==(1&this.words[0])},h.prototype.isOdd=function(){return 1==(1&this.words[0])},h.prototype.andln=function(t){return this.words[0]&t},h.prototype.bincn=function(t){e("number"==typeof t);var i=t%26,r=(t-i)/26,n=1<<i;if(this.length<=r)return this._expand(r+1),this.words[r]|=n,this;for(var h=n,o=r;0!==h&&o<this.length;o++){var s=0|this.words[o];h=(s+=h)>>>26,s&=67108863,this.words[o]=s}return 0!==h&&(this.words[o]=h,this.length++),this},h.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},h.prototype.cmpn=function(t){var i,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)i=1;else{r&&(t=-t),e(t<=67108863,"Number is too big");var n=0|this.words[0];i=n===t?0:n<t?-1:1}return 0!==this.negative?0|-i:i},h.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var i=this.ucmp(t);return 0!==this.negative?0|-i:i},h.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var i=0,r=this.length-1;r>=0;r--){var e=0|this.words[r],n=0|t.words[r];if(e!==n){e<n?i=-1:e>n&&(i=1);break}}return i},h.prototype.gtn=function(t){return 1===this.cmpn(t)},h.prototype.gt=function(t){return 1===this.cmp(t)},h.prototype.gten=function(t){return this.cmpn(t)>=0},h.prototype.gte=function(t){return this.cmp(t)>=0},h.prototype.ltn=function(t){return-1===this.cmpn(t)},h.prototype.lt=function(t){return-1===this.cmp(t)},h.prototype.lten=function(t){return this.cmpn(t)<=0},h.prototype.lte=function(t){return this.cmp(t)<=0},h.prototype.eqn=function(t){return 0===this.cmpn(t)},h.prototype.eq=function(t){return 0===this.cmp(t)},h.red=function(t){return new R(t)},h.prototype.toRed=function(t){return e(!this.red,"Already a number in reduction context"),e(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},h.prototype.fromRed=function(){return e(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},h.prototype._forceRed=function(t){return this.red=t,this},h.prototype.forceRed=function(t){return e(!this.red,"Already a number in reduction context"),this._forceRed(t)},h.prototype.redAdd=function(t){return e(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},h.prototype.redIAdd=function(t){return e(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},h.prototype.redSub=function(t){return e(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},h.prototype.redISub=function(t){return e(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},h.prototype.redShl=function(t){return e(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},h.prototype.redMul=function(t){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},h.prototype.redIMul=function(t){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},h.prototype.redSqr=function(){return e(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},h.prototype.redISqr=function(){return e(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},h.prototype.redSqrt=function(){return e(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},h.prototype.redInvm=function(){return e(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},h.prototype.redNeg=function(){return e(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},h.prototype.redPow=function(t){return e(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function y(t,i){this.name=t,this.p=new h(i,16),this.n=this.p.bitLength(),this.k=new h(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function E(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function N(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function R(t){if("string"==typeof t){var i=h._prime(t);this.m=i.p,this.prime=i}else e(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function S(t){R.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new h(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}y.prototype._tmp=function(){var t=new h(null);return t.words=new Array(Math.ceil(this.n/13)),t},y.prototype.ireduce=function(t){var i,r=t;do{this.split(r,this.tmp),i=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(i>this.n);var e=i<this.n?-1:r.ucmp(this.p);return 0===e?(r.words[0]=0,r.length=1):e>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},y.prototype.split=function(t,i){t.iushrn(this.n,0,i)},y.prototype.imulK=function(t){return t.imul(this.k)},n(b,y),b.prototype.split=function(t,i){for(var r=4194303,e=Math.min(t.length,9),n=0;n<e;n++)i.words[n]=t.words[n];if(i.length=e,t.length<=9)return t.words[0]=0,void(t.length=1);var h=t.words[9];for(i.words[i.length++]=h&r,n=10;n<t.length;n++){var o=0|t.words[n];t.words[n-10]=(o&r)<<4|h>>>22,h=o}h>>>=22,t.words[n-10]=h,0===h&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var i=0,r=0;r<t.length;r++){var e=0|t.words[r];i+=977*e,t.words[r]=67108863&i,i=64*e+(i/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},n(E,y),n(N,y),n(_,y),_.prototype.imulK=function(t){for(var i=0,r=0;r<t.length;r++){var e=19*(0|t.words[r])+i,n=67108863&e;e>>>=26,t.words[r]=n,i=e}return 0!==i&&(t.words[t.length++]=i),t},h._prime=function(t){if(w[t])return w[t];var i;if("k256"===t)i=new b;else if("p224"===t)i=new E;else if("p192"===t)i=new N;else{if("p25519"!==t)throw new Error("Unknown prime "+t);i=new _}return w[t]=i,i},R.prototype._verify1=function(t){e(0===t.negative,"red works only with positives"),e(t.red,"red works only with red numbers")},R.prototype._verify2=function(t,i){e(0==(t.negative|i.negative),"red works only with positives"),e(t.red&&t.red===i.red,"red works only with red numbers")},R.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(l(t,t.umod(this.m)._forceRed(this)),t)},R.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},R.prototype.add=function(t,i){this._verify2(t,i);var r=t.add(i);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},R.prototype.iadd=function(t,i){this._verify2(t,i);var r=t.iadd(i);return r.cmp(this.m)>=0&&r.isub(this.m),r},R.prototype.sub=function(t,i){this._verify2(t,i);var r=t.sub(i);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},R.prototype.isub=function(t,i){this._verify2(t,i);var r=t.isub(i);return r.cmpn(0)<0&&r.iadd(this.m),r},R.prototype.shl=function(t,i){return this._verify1(t),this.imod(t.ushln(i))},R.prototype.imul=function(t,i){return this._verify2(t,i),this.imod(t.imul(i))},R.prototype.mul=function(t,i){return this._verify2(t,i),this.imod(t.mul(i))},R.prototype.isqr=function(t){return this.imul(t,t.clone())},R.prototype.sqr=function(t){return this.mul(t,t)},R.prototype.sqrt=function(t){if(t.isZero())return t.clone();var i=this.m.andln(3);if(e(i%2==1),3===i){var r=this.m.add(new h(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);e(!n.isZero());var s=new h(1).toRed(this),u=s.redNeg(),a=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new h(2*l*l).toRed(this);0!==this.pow(l,a).cmp(u);)l.redIAdd(u);for(var m=this.pow(l,n),f=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=o;0!==d.cmp(s);){for(var g=d,c=0;0!==g.cmp(s);c++)g=g.redSqr();e(c<p);var M=this.pow(m,new h(1).iushln(p-c-1));f=f.redMul(M),m=M.redSqr(),d=d.redMul(m),p=c}return f},R.prototype.invm=function(t){var i=t._invmp(this.m);return 0!==i.negative?(i.negative=0,this.imod(i).redNeg()):this.imod(i)},R.prototype.pow=function(t,i){if(i.isZero())return new h(1).toRed(this);if(0===i.cmpn(1))return t.clone();var r=new Array(16);r[0]=new h(1).toRed(this),r[1]=t;for(var e=2;e<r.length;e++)r[e]=this.mul(r[e-1],t);var n=r[0],o=0,s=0,u=i.bitLength()%26;for(0===u&&(u=26),e=i.length-1;e>=0;e--){for(var a=i.words[e],l=u-1;l>=0;l--){var m=a>>l&1;n!==r[0]&&(n=this.sqr(n)),0!==m||0!==o?(o<<=1,o|=m,(4==++s||0===e&&0===l)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}u=26}return n},R.prototype.convertTo=function(t){var i=t.umod(this.m);return i===t?i.clone():i},R.prototype.convertFrom=function(t){var i=t.clone();return i.red=null,i},h.mont=function(t){return new S(t)},n(S,R),S.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},S.prototype.convertFrom=function(t){var i=this.imod(t.mul(this.rinv));return i.red=null,i},S.prototype.imul=function(t,i){if(t.isZero()||i.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(i),e=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(e).iushrn(this.shift),h=n;return n.cmp(this.m)>=0?h=n.isub(this.m):n.cmpn(0)<0&&(h=n.iadd(this.m)),h._forceRed(this)},S.prototype.mul=function(t,i){if(t.isZero()||i.isZero())return new h(0)._forceRed(this);var r=t.mul(i),e=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(e).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},S.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(v,t);const w="bignumber/5.7.0";var y=v.exports.BN;const b=new c(w),E={},N=9007199254740991;function _(t){return null!=t&&(S.isBigNumber(t)||"number"==typeof t&&t%1==0||"string"==typeof t&&!!t.match(/^-?[0-9]+$/)||h(t)||"bigint"==typeof t||e(t))}let R=!1;class S{constructor(t,i){t!==E&&b.throwError("cannot call constructor directly; use BigNumber.from",c.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=i,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return I(T(this).fromTwos(t))}toTwos(t){return I(T(this).toTwos(t))}abs(){return"-"===this._hex[0]?S.from(this._hex.substring(1)):this}add(t){return I(T(this).add(T(t)))}sub(t){return I(T(this).sub(T(t)))}div(t){return S.from(t).isZero()&&O("division-by-zero","div"),I(T(this).div(T(t)))}mul(t){return I(T(this).mul(T(t)))}mod(t){const i=T(t);return i.isNeg()&&O("division-by-zero","mod"),I(T(this).umod(i))}pow(t){const i=T(t);return i.isNeg()&&O("negative-power","pow"),I(T(this).pow(i))}and(t){const i=T(t);return(this.isNegative()||i.isNeg())&&O("unbound-bitwise-result","and"),I(T(this).and(i))}or(t){const i=T(t);return(this.isNegative()||i.isNeg())&&O("unbound-bitwise-result","or"),I(T(this).or(i))}xor(t){const i=T(t);return(this.isNegative()||i.isNeg())&&O("unbound-bitwise-result","xor"),I(T(this).xor(i))}mask(t){return(this.isNegative()||t<0)&&O("negative-width","mask"),I(T(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&O("negative-width","shl"),I(T(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&O("negative-width","shr"),I(T(this).shrn(t))}eq(t){return T(this).eq(T(t))}lt(t){return T(this).lt(T(t))}lte(t){return T(this).lte(T(t))}gt(t){return T(this).gt(T(t))}gte(t){return T(this).gte(T(t))}isNegative(){return"-"===this._hex[0]}isZero(){return T(this).isZero()}toNumber(){try{return T(this).toNumber()}catch(t){O("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return b.throwError("this platform does not support BigInt",c.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?R||(R=!0,b.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?b.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",c.errors.UNEXPECTED_ARGUMENT,{}):b.throwError("BigNumber.toString does not accept parameters",c.errors.UNEXPECTED_ARGUMENT,{})),T(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof S)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new S(E,A(t)):t.match(/^-?[0-9]+$/)?new S(E,A(new y(t))):b.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&O("underflow","BigNumber.from",t),(t>=N||t<=-N)&&O("overflow","BigNumber.from",t),S.from(String(t));const i=t;if("bigint"==typeof i)return S.from(i.toString());if(e(i))return S.from(n(i));if(i)if(i.toHexString){const t=i.toHexString();if("string"==typeof t)return S.from(t)}else{let t=i._hex;if(null==t&&"BigNumber"===i.type&&(t=i.hex),"string"==typeof t&&(h(t)||"-"===t[0]&&h(t.substring(1))))return S.from(t)}return b.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function A(t){if("string"!=typeof t)return A(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&b.throwArgumentError("invalid hex","value",t),"0x00"===(t=A(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function I(t){return S.from(A(t))}function T(t){const i=S.from(t).toHexString();return"-"===i[0]?new y("-"+i.substring(3),16):new y(i.substring(2),16)}function O(t,i,r){const e={fault:t,operation:i};return null!=r&&(e.value=r),b.throwError(t,c.errors.NUMERIC_FAULT,e)}const U=new c("strings/5.7.0");var C,k;function x(t,i,r,e,n){if(t===k.BAD_PREFIX||t===k.UNEXPECTED_CONTINUE){let t=0;for(let e=i+1;e<r.length&&r[e]>>6==2;e++)t++;return t}return t===k.OVERRUN?r.length-i-1:0}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(C||(C={})),function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"}(k||(k={}));const L=Object.freeze({error:function(t,i,r,e,n){return U.throwArgumentError(`invalid codepoint at offset ${i}; ${t}`,"bytes",r)},ignore:x,replace:function(t,i,r,e,n){return t===k.OVERLONG?(e.push(n),0):(e.push(65533),x(t,i,r))}});function P(t,i){null==i&&(i=L.error),t=o(t);const r=[];let e=0;for(;e<t.length;){const n=t[e++];if(n>>7==0){r.push(n);continue}let h=null,o=null;if(192==(224&n))h=1,o=127;else if(224==(240&n))h=2,o=2047;else{if(240!=(248&n)){e+=i(128==(192&n)?k.UNEXPECTED_CONTINUE:k.BAD_PREFIX,e-1,t,r);continue}h=3,o=65535}if(e-1+h>=t.length){e+=i(k.OVERRUN,e-1,t,r);continue}let s=n&(1<<8-h-1)-1;for(let n=0;n<h;n++){let n=t[e];if(128!=(192&n)){e+=i(k.MISSING_CONTINUE,e,t,r),s=null;break}s=s<<6|63&n,e++}null!==s&&(s>1114111?e+=i(k.OUT_OF_RANGE,e-1-h,t,r,s):s>=55296&&s<=57343?e+=i(k.UTF16_SURROGATE,e-1-h,t,r,s):s<=o?e+=i(k.OVERLONG,e-1-h,t,r,s):r.push(s))}return r}function D(t,i=C.current){i!=C.current&&(U.checkNormalize(),t=t.normalize(i));let r=[];for(let i=0;i<t.length;i++){const e=t.charCodeAt(i);if(e<128)r.push(e);else if(e<2048)r.push(e>>6|192),r.push(63&e|128);else if(55296==(64512&e)){i++;const n=t.charCodeAt(i);if(i>=t.length||56320!=(64512&n))throw new Error("invalid utf-8 string");const h=65536+((1023&e)<<10)+(1023&n);r.push(h>>18|240),r.push(h>>12&63|128),r.push(h>>6&63|128),r.push(63&h|128)}else r.push(e>>12|224),r.push(e>>6&63|128),r.push(63&e|128)}return o(r)}function B(t){const i="0000"+t.toString(16);return"\\u"+i.substring(i.length-4)}function F(t,i){return'"'+P(t,i).map((t=>{if(t<256){switch(t){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 13:return"\\r";case 34:return'\\"';case 92:return"\\\\"}if(t>=32&&t<127)return String.fromCharCode(t)}return t<=65535?B(t):B(55296+((t-=65536)>>10&1023))+B(56320+(1023&t))})).join("")+'"'}function G(t){return t.map((t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10&1023),56320+(1023&t))))).join("")}function Z(t,i){return G(P(t,i))}function q(t,i=C.current){return P(D(t,i))}function z(t){return i(D(t))}export{S as B,p as E,c as L,C as U,G as _,Z as a,_ as b,q as c,F as d,L as e,k as f,z as i,M as l,D as t,w as v};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getAddress as t}from"@ethersproject/address";import{arrayify as e,hexZeroPad as r,hexConcat as n,isHexString as o,hexlify as i,isBytesLike as s}from"@ethersproject/bytes";import{k as a}from"./index-5bf4cdf3.js";import{defineReadOnly as c,deepCopy as u,shallowCopy as l}from"@ethersproject/properties";import{L as f,B as h,i as d,t as y,a as m}from"./id-44a7ba96.js";const p="hash/5.7.0";function g(t){t=atob(t);const r=[];for(let e=0;e<t.length;e++)r.push(t.charCodeAt(e));return e(r)}function v(t){t=e(t);let r="";for(let e=0;e<t.length;e++)r+=String.fromCharCode(t[e]);return btoa(r)}var E=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{c(n.next(t))}catch(t){i(t)}}function a(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};const w=new f(p),b=new Uint8Array(32);b.fill(0);const S=h.from(-1),C=h.from(0),O=h.from(1),R=h.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const A=r(O.toHexString(),32),x=r(C.toHexString(),32),T={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},k=["name","version","chainId","verifyingContract","salt"];function _(t){return function(e){return"string"!=typeof e&&w.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const I={name:_("name"),version:_("version"),chainId:function(t){try{return h.from(t).toString()}catch(t){}return w.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(e){try{return t(e).toLowerCase()}catch(t){}return w.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",e)},salt:function(t){try{const r=e(t);if(32!==r.length)throw new Error("bad length");return i(r)}catch(t){}return w.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function j(o){{const t=o.match(/^(u?)int(\d*)$/);if(t){const e=""===t[1],n=parseInt(t[2]||"256");(n%8!=0||n>256||t[2]&&t[2]!==String(n))&&w.throwArgumentError("invalid numeric width","type",o);const i=R.mask(e?n-1:n),s=e?i.add(O).mul(S):C;return function(t){const e=h.from(t);return(e.lt(s)||e.gt(i))&&w.throwArgumentError(`value out-of-bounds for ${o}`,"value",t),r(e.toTwos(256).toHexString(),32)}}}{const t=o.match(/^bytes(\d+)$/);if(t){const r=parseInt(t[1]);return(0===r||r>32||t[1]!==String(r))&&w.throwArgumentError("invalid bytes width","type",o),function(t){return e(t).length!==r&&w.throwArgumentError(`invalid length for ${o}`,"value",t),function(t){const r=e(t),o=r.length%32;return o?n([r,b.slice(o)]):i(r)}(t)}}}switch(o){case"address":return function(e){return r(t(e),32)};case"bool":return function(t){return t?A:x};case"bytes":return function(t){return a(t)};case"string":return function(t){return d(t)}}return null}function $(t,e){return`${t}(${e.map((({name:t,type:e})=>e+" "+t)).join(",")})`}class P{constructor(t){c(this,"types",Object.freeze(u(t))),c(this,"_encoderCache",{}),c(this,"_types",{});const e={},r={},n={};Object.keys(t).forEach((t=>{e[t]={},r[t]=[],n[t]={}}));for(const n in t){const o={};t[n].forEach((i=>{o[i.name]&&w.throwArgumentError(`duplicate variable name ${JSON.stringify(i.name)} in ${JSON.stringify(n)}`,"types",t),o[i.name]=!0;const s=i.type.match(/^([^\x5b]*)(\x5b|$)/)[1];s===n&&w.throwArgumentError(`circular type reference to ${JSON.stringify(s)}`,"types",t);j(s)||(r[s]||w.throwArgumentError(`unknown type ${JSON.stringify(s)}`,"types",t),r[s].push(n),e[n][s]=!0)}))}const o=Object.keys(r).filter((t=>0===r[t].length));0===o.length?w.throwArgumentError("missing primary type","types",t):o.length>1&&w.throwArgumentError(`ambiguous primary types or unused types: ${o.map((t=>JSON.stringify(t))).join(", ")}`,"types",t),c(this,"primaryType",o[0]),function o(i,s){s[i]&&w.throwArgumentError(`circular type reference to ${JSON.stringify(i)}`,"types",t),s[i]=!0,Object.keys(e[i]).forEach((t=>{r[t]&&(o(t,s),Object.keys(s).forEach((e=>{n[e][t]=!0})))})),delete s[i]}(this.primaryType,{});for(const e in n){const r=Object.keys(n[e]);r.sort(),this._types[e]=$(e,t[e])+r.map((e=>$(e,t[e]))).join("")}}getEncoder(t){let e=this._encoderCache[t];return e||(e=this._encoderCache[t]=this._getEncoder(t)),e}_getEncoder(t){{const e=j(t);if(e)return e}const e=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(e){const t=e[1],r=this.getEncoder(t),o=parseInt(e[3]);return e=>{o>=0&&e.length!==o&&w.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e);let i=e.map(r);return this._types[t]&&(i=i.map(a)),a(n(i))}}const r=this.types[t];if(r){const e=d(this._types[t]);return t=>{const o=r.map((({name:e,type:r})=>{const n=this.getEncoder(r)(t[e]);return this._types[r]?a(n):n}));return o.unshift(e),n(o)}}return w.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){const e=this._types[t];return e||w.throwArgumentError(`unknown type: ${JSON.stringify(t)}`,"name",t),e}encodeData(t,e){return this.getEncoder(t)(e)}hashStruct(t,e){return a(this.encodeData(t,e))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,e,r){if(j(t))return r(t,e);const n=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(n){const t=n[1],o=parseInt(n[3]);return o>=0&&e.length!==o&&w.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e),e.map((e=>this._visit(t,e,r)))}const o=this.types[t];return o?o.reduce(((t,{name:n,type:o})=>(t[n]=this._visit(o,e[n],r),t)),{}):w.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,e){return this._visit(this.primaryType,t,e)}static from(t){return new P(t)}static getPrimaryType(t){return P.from(t).primaryType}static hashStruct(t,e,r){return P.from(e).hashStruct(t,r)}static hashDomain(t){const e=[];for(const r in t){const n=T[r];n||w.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",t),e.push({name:r,type:n})}return e.sort(((t,e)=>k.indexOf(t.name)-k.indexOf(e.name))),P.hashStruct("EIP712Domain",{EIP712Domain:e},t)}static encode(t,e,r){return n(["0x1901",P.hashDomain(t),P.from(e).hash(r)])}static hash(t,e,r){return a(P.encode(t,e,r))}static resolveNames(t,e,r,n){return E(this,void 0,void 0,(function*(){t=l(t);const i={};t.verifyingContract&&!o(t.verifyingContract,20)&&(i[t.verifyingContract]="0x");const s=P.from(e);s.visit(r,((t,e)=>("address"!==t||o(e,20)||(i[e]="0x"),e)));for(const t in i)i[t]=yield n(t);return t.verifyingContract&&i[t.verifyingContract]&&(t.verifyingContract=i[t.verifyingContract]),r=s.visit(r,((t,e)=>"address"===t&&i[e]?i[e]:e)),{domain:t,value:r}}))}static getPayload(t,r,n){P.hashDomain(t);const o={},s=[];k.forEach((e=>{const r=t[e];null!=r&&(o[e]=I[e](r),s.push({name:e,type:T[e]}))}));const a=P.from(r),c=l(r);return c.EIP712Domain?w.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",r):c.EIP712Domain=s,a.encode(n),{types:c,domain:o,primaryType:a.primaryType,message:a.visit(n,((t,r)=>{if(t.match(/^bytes(\d*)/))return i(e(r));if(t.match(/^u?int/))return h.from(r).toString();switch(t){case"address":return r.toLowerCase();case"bool":return!!r;case"string":return"string"!=typeof r&&w.throwArgumentError("invalid string","value",r),r}return w.throwArgumentError("unsupported type","type",t)}))}}}var L=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{c(n.next(t))}catch(t){i(t)}}function a(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};function D(t,r){return L(this,void 0,void 0,(function*(){null==r&&(r={});const n={method:r.method||"GET",headers:r.headers||{},body:r.body||void 0};if(!0!==r.skipFetchSetup&&(n.mode="cors",n.cache="no-cache",n.credentials="same-origin",n.redirect="follow",n.referrer="client"),null!=r.fetchOptions){const t=r.fetchOptions;t.mode&&(n.mode=t.mode),t.cache&&(n.cache=t.cache),t.credentials&&(n.credentials=t.credentials),t.redirect&&(n.redirect=t.redirect),t.referrer&&(n.referrer=t.referrer)}const o=yield fetch(t,n),i=yield o.arrayBuffer(),s={};return o.headers.forEach?o.headers.forEach(((t,e)=>{s[e.toLowerCase()]=t})):o.headers.keys().forEach((t=>{s[t.toLowerCase()]=o.headers.get(t)})),{headers:s,statusCode:o.status,statusMessage:o.statusText,body:e(new Uint8Array(i))}}))}var M=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{c(n.next(t))}catch(t){i(t)}}function a(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};const N=new f("web/5.7.1");function q(t){return new Promise((e=>{setTimeout(e,t)}))}function J(t,e){if(null==t)return null;if("string"==typeof t)return t;if(s(t)){if(e&&("text"===e.split("/")[0]||"application/json"===e.split(";")[0].trim()))try{return m(t)}catch(t){}return i(t)}return t}function B(t,e,r){const n="object"==typeof t&&null!=t.throttleLimit?t.throttleLimit:12;N.assertArgument(n>0&&n%1==0,"invalid connection throttle limit","connection.throttleLimit",n);const o="object"==typeof t?t.throttleCallback:null,i="object"==typeof t&&"number"==typeof t.throttleSlotInterval?t.throttleSlotInterval:100;N.assertArgument(i>0&&i%1==0,"invalid connection throttle slot interval","connection.throttleSlotInterval",i);const s="object"==typeof t&&!!t.errorPassThrough,a={};let c=null;const u={method:"GET"};let h=!1,d=12e4;if("string"==typeof t)c=t;else if("object"==typeof t){if(null!=t&&null!=t.url||N.throwArgumentError("missing URL","connection.url",t),c=t.url,"number"==typeof t.timeout&&t.timeout>0&&(d=t.timeout),t.headers)for(const e in t.headers)a[e.toLowerCase()]={key:e,value:String(t.headers[e])},["if-none-match","if-modified-since"].indexOf(e.toLowerCase())>=0&&(h=!0);if(u.allowGzip=!!t.allowGzip,null!=t.user&&null!=t.password){"https:"!==c.substring(0,6)&&!0!==t.allowInsecureAuthentication&&N.throwError("basic authentication requires a secure https url",f.errors.INVALID_ARGUMENT,{argument:"url",url:c,user:t.user,password:"[REDACTED]"});const e=t.user+":"+t.password;a.authorization={key:"Authorization",value:"Basic "+v(y(e))}}null!=t.skipFetchSetup&&(u.skipFetchSetup=!!t.skipFetchSetup),null!=t.fetchOptions&&(u.fetchOptions=l(t.fetchOptions))}const m=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),p=c?c.match(m):null;if(p)try{const t={statusCode:200,statusMessage:"OK",headers:{"content-type":p[1]||"text/plain"},body:p[2]?g(p[3]):(E=p[3],y(E.replace(/%([0-9a-f][0-9a-f])/gi,((t,e)=>String.fromCharCode(parseInt(e,16))))))};let e=t.body;return r&&(e=r(t.body,t)),Promise.resolve(e)}catch(t){N.throwError("processing response error",f.errors.SERVER_ERROR,{body:J(p[1],p[2]),error:t,requestBody:null,requestMethod:"GET",url:c})}var E;e&&(u.method="POST",u.body=e,null==a["content-type"]&&(a["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==a["content-length"]&&(a["content-length"]={key:"Content-Length",value:String(e.length)}));const w={};Object.keys(a).forEach((t=>{const e=a[t];w[e.key]=e.value})),u.headers=w;const b=function(){let t=null;return{promise:new Promise((function(e,r){d&&(t=setTimeout((()=>{null!=t&&(t=null,r(N.makeError("timeout",f.errors.TIMEOUT,{requestBody:J(u.body,w["content-type"]),requestMethod:u.method,timeout:d,url:c})))}),d))})),cancel:function(){null!=t&&(clearTimeout(t),t=null)}}}(),S=function(){return M(this,void 0,void 0,(function*(){for(let t=0;t<n;t++){let e=null;try{if(e=yield D(c,u),t<n)if(301===e.statusCode||302===e.statusCode){const t=e.headers.location||"";if("GET"===u.method&&t.match(/^https:/)){c=e.headers.location;continue}}else if(429===e.statusCode){let r=!0;if(o&&(r=yield o(t,c)),r){let r=0;const n=e.headers["retry-after"];r="string"==typeof n&&n.match(/^[1-9][0-9]*$/)?1e3*parseInt(n):i*parseInt(String(Math.random()*Math.pow(2,t))),yield q(r);continue}}}catch(t){e=t.response,null==e&&(b.cancel(),N.throwError("missing response",f.errors.SERVER_ERROR,{requestBody:J(u.body,w["content-type"]),requestMethod:u.method,serverError:t,url:c}))}let a=e.body;if(h&&304===e.statusCode?a=null:!s&&(e.statusCode<200||e.statusCode>=300)&&(b.cancel(),N.throwError("bad response",f.errors.SERVER_ERROR,{status:e.statusCode,headers:e.headers,body:J(a,e.headers?e.headers["content-type"]:null),requestBody:J(u.body,w["content-type"]),requestMethod:u.method,url:c})),r)try{const t=yield r(a,e);return b.cancel(),t}catch(r){if(r.throttleRetry&&t<n){let e=!0;if(o&&(e=yield o(t,c)),e){const e=i*parseInt(String(Math.random()*Math.pow(2,t)));yield q(e);continue}}b.cancel(),N.throwError("processing response error",f.errors.SERVER_ERROR,{body:J(a,e.headers?e.headers["content-type"]:null),error:r,requestBody:J(u.body,w["content-type"]),requestMethod:u.method,url:c})}return b.cancel(),a}return N.throwError("failed response",f.errors.SERVER_ERROR,{requestBody:J(u.body,w["content-type"]),requestMethod:u.method,url:c})}))}();return Promise.race([b.promise,S])}function G(t,e,r){let n=null;if(null!=e){n=y(e);const r="string"==typeof t?{url:t}:l(t);if(r.headers){0!==Object.keys(r.headers).filter((t=>"content-type"===t.toLowerCase())).length||(r.headers=l(r.headers),r.headers["content-type"]="application/json")}else r.headers={"content-type":"application/json"};t=r}return B(t,n,((t,e)=>{let n=null;if(null!=t)try{n=JSON.parse(m(t))}catch(e){N.throwError("invalid JSON",f.errors.SERVER_ERROR,{body:t,error:e})}return r&&(n=r(n,e)),n}))}function V(t,e){return e||(e={}),null==(e=l(e)).floor&&(e.floor=0),null==e.ceiling&&(e.ceiling=1e4),null==e.interval&&(e.interval=250),new Promise((function(r,n){let o=null,i=!1;const s=()=>!i&&(i=!0,o&&clearTimeout(o),!0);e.timeout&&(o=setTimeout((()=>{s()&&n(new Error("timeout"))}),e.timeout));const a=e.retryLimit;let c=0;!function o(){return t().then((function(t){if(void 0!==t)s()&&r(t);else if(e.oncePoll)e.oncePoll.once("poll",o);else if(e.onceBlock)e.onceBlock.once("block",o);else if(!i){if(c++,c>a)return void(s()&&n(new Error("retry limit reached")));let t=e.interval*parseInt(String(Math.random()*Math.pow(2,c)));t<e.floor&&(t=e.floor),t>e.ceiling&&(t=e.ceiling),setTimeout(o,t)}return null}),(function(t){s()&&n(t)}))}()}))}var z=Object.freeze({__proto__:null,_fetchData:B,fetchJson:G,poll:V});export{P as T,B as _,g as d,v as e,G as f,z as l,V as p,p as v};
|
|
1
|
+
import{getAddress as t}from"@ethersproject/address";import{arrayify as e,hexZeroPad as r,hexConcat as n,isHexString as o,hexlify as i,isBytesLike as s}from"@ethersproject/bytes";import{k as a}from"./index-b659401e.js";import{defineReadOnly as c,deepCopy as u,shallowCopy as l}from"@ethersproject/properties";import{L as f,B as h,i as d,t as y,a as m}from"./id-62e12510.js";const p="hash/5.7.0";function g(t){t=atob(t);const r=[];for(let e=0;e<t.length;e++)r.push(t.charCodeAt(e));return e(r)}function v(t){t=e(t);let r="";for(let e=0;e<t.length;e++)r+=String.fromCharCode(t[e]);return btoa(r)}var E=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{c(n.next(t))}catch(t){i(t)}}function a(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};const w=new f(p),b=new Uint8Array(32);b.fill(0);const S=h.from(-1),C=h.from(0),O=h.from(1),R=h.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const A=r(O.toHexString(),32),x=r(C.toHexString(),32),T={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},k=["name","version","chainId","verifyingContract","salt"];function _(t){return function(e){return"string"!=typeof e&&w.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const I={name:_("name"),version:_("version"),chainId:function(t){try{return h.from(t).toString()}catch(t){}return w.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(e){try{return t(e).toLowerCase()}catch(t){}return w.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",e)},salt:function(t){try{const r=e(t);if(32!==r.length)throw new Error("bad length");return i(r)}catch(t){}return w.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function j(o){{const t=o.match(/^(u?)int(\d*)$/);if(t){const e=""===t[1],n=parseInt(t[2]||"256");(n%8!=0||n>256||t[2]&&t[2]!==String(n))&&w.throwArgumentError("invalid numeric width","type",o);const i=R.mask(e?n-1:n),s=e?i.add(O).mul(S):C;return function(t){const e=h.from(t);return(e.lt(s)||e.gt(i))&&w.throwArgumentError(`value out-of-bounds for ${o}`,"value",t),r(e.toTwos(256).toHexString(),32)}}}{const t=o.match(/^bytes(\d+)$/);if(t){const r=parseInt(t[1]);return(0===r||r>32||t[1]!==String(r))&&w.throwArgumentError("invalid bytes width","type",o),function(t){return e(t).length!==r&&w.throwArgumentError(`invalid length for ${o}`,"value",t),function(t){const r=e(t),o=r.length%32;return o?n([r,b.slice(o)]):i(r)}(t)}}}switch(o){case"address":return function(e){return r(t(e),32)};case"bool":return function(t){return t?A:x};case"bytes":return function(t){return a(t)};case"string":return function(t){return d(t)}}return null}function $(t,e){return`${t}(${e.map((({name:t,type:e})=>e+" "+t)).join(",")})`}class P{constructor(t){c(this,"types",Object.freeze(u(t))),c(this,"_encoderCache",{}),c(this,"_types",{});const e={},r={},n={};Object.keys(t).forEach((t=>{e[t]={},r[t]=[],n[t]={}}));for(const n in t){const o={};t[n].forEach((i=>{o[i.name]&&w.throwArgumentError(`duplicate variable name ${JSON.stringify(i.name)} in ${JSON.stringify(n)}`,"types",t),o[i.name]=!0;const s=i.type.match(/^([^\x5b]*)(\x5b|$)/)[1];s===n&&w.throwArgumentError(`circular type reference to ${JSON.stringify(s)}`,"types",t);j(s)||(r[s]||w.throwArgumentError(`unknown type ${JSON.stringify(s)}`,"types",t),r[s].push(n),e[n][s]=!0)}))}const o=Object.keys(r).filter((t=>0===r[t].length));0===o.length?w.throwArgumentError("missing primary type","types",t):o.length>1&&w.throwArgumentError(`ambiguous primary types or unused types: ${o.map((t=>JSON.stringify(t))).join(", ")}`,"types",t),c(this,"primaryType",o[0]),function o(i,s){s[i]&&w.throwArgumentError(`circular type reference to ${JSON.stringify(i)}`,"types",t),s[i]=!0,Object.keys(e[i]).forEach((t=>{r[t]&&(o(t,s),Object.keys(s).forEach((e=>{n[e][t]=!0})))})),delete s[i]}(this.primaryType,{});for(const e in n){const r=Object.keys(n[e]);r.sort(),this._types[e]=$(e,t[e])+r.map((e=>$(e,t[e]))).join("")}}getEncoder(t){let e=this._encoderCache[t];return e||(e=this._encoderCache[t]=this._getEncoder(t)),e}_getEncoder(t){{const e=j(t);if(e)return e}const e=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(e){const t=e[1],r=this.getEncoder(t),o=parseInt(e[3]);return e=>{o>=0&&e.length!==o&&w.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e);let i=e.map(r);return this._types[t]&&(i=i.map(a)),a(n(i))}}const r=this.types[t];if(r){const e=d(this._types[t]);return t=>{const o=r.map((({name:e,type:r})=>{const n=this.getEncoder(r)(t[e]);return this._types[r]?a(n):n}));return o.unshift(e),n(o)}}return w.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){const e=this._types[t];return e||w.throwArgumentError(`unknown type: ${JSON.stringify(t)}`,"name",t),e}encodeData(t,e){return this.getEncoder(t)(e)}hashStruct(t,e){return a(this.encodeData(t,e))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,e,r){if(j(t))return r(t,e);const n=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(n){const t=n[1],o=parseInt(n[3]);return o>=0&&e.length!==o&&w.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e),e.map((e=>this._visit(t,e,r)))}const o=this.types[t];return o?o.reduce(((t,{name:n,type:o})=>(t[n]=this._visit(o,e[n],r),t)),{}):w.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,e){return this._visit(this.primaryType,t,e)}static from(t){return new P(t)}static getPrimaryType(t){return P.from(t).primaryType}static hashStruct(t,e,r){return P.from(e).hashStruct(t,r)}static hashDomain(t){const e=[];for(const r in t){const n=T[r];n||w.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",t),e.push({name:r,type:n})}return e.sort(((t,e)=>k.indexOf(t.name)-k.indexOf(e.name))),P.hashStruct("EIP712Domain",{EIP712Domain:e},t)}static encode(t,e,r){return n(["0x1901",P.hashDomain(t),P.from(e).hash(r)])}static hash(t,e,r){return a(P.encode(t,e,r))}static resolveNames(t,e,r,n){return E(this,void 0,void 0,(function*(){t=l(t);const i={};t.verifyingContract&&!o(t.verifyingContract,20)&&(i[t.verifyingContract]="0x");const s=P.from(e);s.visit(r,((t,e)=>("address"!==t||o(e,20)||(i[e]="0x"),e)));for(const t in i)i[t]=yield n(t);return t.verifyingContract&&i[t.verifyingContract]&&(t.verifyingContract=i[t.verifyingContract]),r=s.visit(r,((t,e)=>"address"===t&&i[e]?i[e]:e)),{domain:t,value:r}}))}static getPayload(t,r,n){P.hashDomain(t);const o={},s=[];k.forEach((e=>{const r=t[e];null!=r&&(o[e]=I[e](r),s.push({name:e,type:T[e]}))}));const a=P.from(r),c=l(r);return c.EIP712Domain?w.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",r):c.EIP712Domain=s,a.encode(n),{types:c,domain:o,primaryType:a.primaryType,message:a.visit(n,((t,r)=>{if(t.match(/^bytes(\d*)/))return i(e(r));if(t.match(/^u?int/))return h.from(r).toString();switch(t){case"address":return r.toLowerCase();case"bool":return!!r;case"string":return"string"!=typeof r&&w.throwArgumentError("invalid string","value",r),r}return w.throwArgumentError("unsupported type","type",t)}))}}}var L=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{c(n.next(t))}catch(t){i(t)}}function a(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};function D(t,r){return L(this,void 0,void 0,(function*(){null==r&&(r={});const n={method:r.method||"GET",headers:r.headers||{},body:r.body||void 0};if(!0!==r.skipFetchSetup&&(n.mode="cors",n.cache="no-cache",n.credentials="same-origin",n.redirect="follow",n.referrer="client"),null!=r.fetchOptions){const t=r.fetchOptions;t.mode&&(n.mode=t.mode),t.cache&&(n.cache=t.cache),t.credentials&&(n.credentials=t.credentials),t.redirect&&(n.redirect=t.redirect),t.referrer&&(n.referrer=t.referrer)}const o=yield fetch(t,n),i=yield o.arrayBuffer(),s={};return o.headers.forEach?o.headers.forEach(((t,e)=>{s[e.toLowerCase()]=t})):o.headers.keys().forEach((t=>{s[t.toLowerCase()]=o.headers.get(t)})),{headers:s,statusCode:o.status,statusMessage:o.statusText,body:e(new Uint8Array(i))}}))}var M=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{c(n.next(t))}catch(t){i(t)}}function a(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};const N=new f("web/5.7.1");function q(t){return new Promise((e=>{setTimeout(e,t)}))}function J(t,e){if(null==t)return null;if("string"==typeof t)return t;if(s(t)){if(e&&("text"===e.split("/")[0]||"application/json"===e.split(";")[0].trim()))try{return m(t)}catch(t){}return i(t)}return t}function B(t,e,r){const n="object"==typeof t&&null!=t.throttleLimit?t.throttleLimit:12;N.assertArgument(n>0&&n%1==0,"invalid connection throttle limit","connection.throttleLimit",n);const o="object"==typeof t?t.throttleCallback:null,i="object"==typeof t&&"number"==typeof t.throttleSlotInterval?t.throttleSlotInterval:100;N.assertArgument(i>0&&i%1==0,"invalid connection throttle slot interval","connection.throttleSlotInterval",i);const s="object"==typeof t&&!!t.errorPassThrough,a={};let c=null;const u={method:"GET"};let h=!1,d=12e4;if("string"==typeof t)c=t;else if("object"==typeof t){if(null!=t&&null!=t.url||N.throwArgumentError("missing URL","connection.url",t),c=t.url,"number"==typeof t.timeout&&t.timeout>0&&(d=t.timeout),t.headers)for(const e in t.headers)a[e.toLowerCase()]={key:e,value:String(t.headers[e])},["if-none-match","if-modified-since"].indexOf(e.toLowerCase())>=0&&(h=!0);if(u.allowGzip=!!t.allowGzip,null!=t.user&&null!=t.password){"https:"!==c.substring(0,6)&&!0!==t.allowInsecureAuthentication&&N.throwError("basic authentication requires a secure https url",f.errors.INVALID_ARGUMENT,{argument:"url",url:c,user:t.user,password:"[REDACTED]"});const e=t.user+":"+t.password;a.authorization={key:"Authorization",value:"Basic "+v(y(e))}}null!=t.skipFetchSetup&&(u.skipFetchSetup=!!t.skipFetchSetup),null!=t.fetchOptions&&(u.fetchOptions=l(t.fetchOptions))}const m=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),p=c?c.match(m):null;if(p)try{const t={statusCode:200,statusMessage:"OK",headers:{"content-type":p[1]||"text/plain"},body:p[2]?g(p[3]):(E=p[3],y(E.replace(/%([0-9a-f][0-9a-f])/gi,((t,e)=>String.fromCharCode(parseInt(e,16))))))};let e=t.body;return r&&(e=r(t.body,t)),Promise.resolve(e)}catch(t){N.throwError("processing response error",f.errors.SERVER_ERROR,{body:J(p[1],p[2]),error:t,requestBody:null,requestMethod:"GET",url:c})}var E;e&&(u.method="POST",u.body=e,null==a["content-type"]&&(a["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==a["content-length"]&&(a["content-length"]={key:"Content-Length",value:String(e.length)}));const w={};Object.keys(a).forEach((t=>{const e=a[t];w[e.key]=e.value})),u.headers=w;const b=function(){let t=null;return{promise:new Promise((function(e,r){d&&(t=setTimeout((()=>{null!=t&&(t=null,r(N.makeError("timeout",f.errors.TIMEOUT,{requestBody:J(u.body,w["content-type"]),requestMethod:u.method,timeout:d,url:c})))}),d))})),cancel:function(){null!=t&&(clearTimeout(t),t=null)}}}(),S=function(){return M(this,void 0,void 0,(function*(){for(let t=0;t<n;t++){let e=null;try{if(e=yield D(c,u),t<n)if(301===e.statusCode||302===e.statusCode){const t=e.headers.location||"";if("GET"===u.method&&t.match(/^https:/)){c=e.headers.location;continue}}else if(429===e.statusCode){let r=!0;if(o&&(r=yield o(t,c)),r){let r=0;const n=e.headers["retry-after"];r="string"==typeof n&&n.match(/^[1-9][0-9]*$/)?1e3*parseInt(n):i*parseInt(String(Math.random()*Math.pow(2,t))),yield q(r);continue}}}catch(t){e=t.response,null==e&&(b.cancel(),N.throwError("missing response",f.errors.SERVER_ERROR,{requestBody:J(u.body,w["content-type"]),requestMethod:u.method,serverError:t,url:c}))}let a=e.body;if(h&&304===e.statusCode?a=null:!s&&(e.statusCode<200||e.statusCode>=300)&&(b.cancel(),N.throwError("bad response",f.errors.SERVER_ERROR,{status:e.statusCode,headers:e.headers,body:J(a,e.headers?e.headers["content-type"]:null),requestBody:J(u.body,w["content-type"]),requestMethod:u.method,url:c})),r)try{const t=yield r(a,e);return b.cancel(),t}catch(r){if(r.throttleRetry&&t<n){let e=!0;if(o&&(e=yield o(t,c)),e){const e=i*parseInt(String(Math.random()*Math.pow(2,t)));yield q(e);continue}}b.cancel(),N.throwError("processing response error",f.errors.SERVER_ERROR,{body:J(a,e.headers?e.headers["content-type"]:null),error:r,requestBody:J(u.body,w["content-type"]),requestMethod:u.method,url:c})}return b.cancel(),a}return N.throwError("failed response",f.errors.SERVER_ERROR,{requestBody:J(u.body,w["content-type"]),requestMethod:u.method,url:c})}))}();return Promise.race([b.promise,S])}function G(t,e,r){let n=null;if(null!=e){n=y(e);const r="string"==typeof t?{url:t}:l(t);if(r.headers){0!==Object.keys(r.headers).filter((t=>"content-type"===t.toLowerCase())).length||(r.headers=l(r.headers),r.headers["content-type"]="application/json")}else r.headers={"content-type":"application/json"};t=r}return B(t,n,((t,e)=>{let n=null;if(null!=t)try{n=JSON.parse(m(t))}catch(e){N.throwError("invalid JSON",f.errors.SERVER_ERROR,{body:t,error:e})}return r&&(n=r(n,e)),n}))}function V(t,e){return e||(e={}),null==(e=l(e)).floor&&(e.floor=0),null==e.ceiling&&(e.ceiling=1e4),null==e.interval&&(e.interval=250),new Promise((function(r,n){let o=null,i=!1;const s=()=>!i&&(i=!0,o&&clearTimeout(o),!0);e.timeout&&(o=setTimeout((()=>{s()&&n(new Error("timeout"))}),e.timeout));const a=e.retryLimit;let c=0;!function o(){return t().then((function(t){if(void 0!==t)s()&&r(t);else if(e.oncePoll)e.oncePoll.once("poll",o);else if(e.onceBlock)e.onceBlock.once("block",o);else if(!i){if(c++,c>a)return void(s()&&n(new Error("retry limit reached")));let t=e.interval*parseInt(String(Math.random()*Math.pow(2,c)));t<e.floor&&(t=e.floor),t>e.ceiling&&(t=e.ceiling),setTimeout(o,t)}return null}),(function(t){s()&&n(t)}))}()}))}var z=Object.freeze({__proto__:null,_fetchData:B,fetchJson:G,poll:V});export{P as T,B as _,g as d,v as e,G as f,z as l,V as p,p as v};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,j as r,l as t,m as o,E as n,n as s,o as i,u as a}from"./index-
|
|
1
|
+
import{_ as e,j as r,l as t,m as o,E as n,n as s,o as i,u as a}from"./index-b659401e.js";export{p as getIsCyber}from"./index-b659401e.js";import{getAddress as d}from"@ethersproject/address";import"events";import{hexlify as c}from"@ethersproject/bytes";import{t as h}from"./id-62e12510.js";import{T as u}from"./index-02350ba2.js";import{Signer as l}from"@ethersproject/abstract-signer";import{D as m}from"./DefaultJsonRpcProvider-48aec187.js";import{defineReadOnly as v}from"@ethersproject/properties";import"@ethersproject/providers";import"zustand";import"@ethersproject/constants";import"@ethersproject/contracts";import"@ethersproject/transactions";import"./__node-resolve_empty-59fa3c56.js";class g extends l{constructor(e,r,t,o){super(),this._address=r,this._index=null!=t?t:0,this.provider=e,this.app=o}_legacySignMessage(e){throw new Error("Method not implemented.")}sendUncheckedTransaction(e){throw new Error("Method not implemented.")}unlock(e){throw new Error("Method not implemented.")}getAddress(){return e(this,void 0,void 0,(function*(){return Promise.resolve(d(this._address))}))}signMessage(t){return e(this,void 0,void 0,(function*(){const e=r(),o="string"==typeof t?h(t):t,n=yield this.getAddress();return yield e.send("personal_sign",[c(o),n.toLowerCase()])}))}_signTypedData(o,n,s){var i,a;return e(this,void 0,void 0,(function*(){const d=r(),c=yield u.resolveNames(o,n,s,(r=>e(this,void 0,void 0,(function*(){return yield d.resolveName(r)})))),p=null!==(a=null===(i=t())||void 0===i?void 0:i.ownerAddress)&&void 0!==a?a:"";return yield d.send("eth_signTypedData_v4",[p.toLowerCase(),JSON.stringify(u.getPayload(c.domain,n,c.value))])}))}signTransaction(r){return e(this,void 0,void 0,(function*(){throw new Error("Method not implemented.")}))}sendTransaction(r){return e(this,void 0,void 0,(function*(){const e=yield this.getChainId(),t=o(this.app,e);return{hash:yield t.sendTransaction({to:r.to,value:r.value,data:r.data}).catch((e=>{if(e.name===n.SendTransactionError&&(console.error(e.shortMessage),e.shortMessage))throw new Error(e.shortMessage);throw e}))}}))}connect(e){return new g(null!=e?e:this.provider,this._address,this._index,this.app)}connectUnchecked(){return new g(this.provider,this._address,this._index,this.app)}}function f(r,t){return e(this,void 0,void 0,(function*(){const o=yield function({appName:r,appLogoUrl:t,rpcUrl:o,rpc:n,chainId:a,cyberParams:c,JsonRpcProvider:p=m}){return e(this,void 0,void 0,(function*(){if(!r||!t)throw new Error("appName and appLogoUrl is required.");if(!(null==c?void 0:c.appId))throw new Error("cyberParams.appId and appLogoUrl is required.");const{app:h,cyberAccount:u}=yield s({appName:r,appLogoUrl:t,appId:null==c?void 0:c.appId});if(!u)throw new Error("cyberAccount is not valid.");const l=u.address,m=new class extends p{constructor(e,r){super(e,r),this.updateUpWalletConfig=e=>{const r=null==n?void 0:n[e];if(!i.includes(e))throw new Error(`chainId ${e} not supported`);if("object"==typeof this.network)this.network.chainId=e;else{const r={chainId:e,name:"unknown"};v(this,"_network",r),this.emit("network",r,null)}return this.rpcUrl=r,this.emit("chainChanged",`0x${e.toString(16)}`),{result:!0}}}getSigner(){return new g(m,l,0,h)}listAccounts(){return e(this,void 0,void 0,(function*(){return[l]}))}getAddress(){return Promise.resolve(d(l))}}(o,a);return m}))}(r);return o.on("connect",t.connect),o.on("disconnect",t.disconnect),o.on("accountsChanged",t.accountsChanged),o.on("chainChanged",t.chainChanged),o.on("message",t.message),o}))}function w(e){var r;const t=e.addChainParameters.chainId,o="string"==typeof t&&(null==t?void 0:t.startsWith("0x"))?parseInt(t,16):Number(t);if(!i.includes(o))throw new Error(`chainId ${o} not supported`);return null===(r=a.getState().provider)||void 0===r?void 0:r.updateUpWalletConfig(o)}export{f as default,w as switchChain};
|