diff --git a/app/assets/v2/css/grants/cart.css b/app/assets/v2/css/grants/cart.css
index 0c5c9d947f9..03a59ba261a 100644
--- a/app/assets/v2/css/grants/cart.css
+++ b/app/assets/v2/css/grants/cart.css
@@ -68,6 +68,11 @@
padding: 0.5rem 1rem;
}
+.disabled-btn-address {
+ opacity: 0.8;
+ border-color: #eee;
+}
+
.black {
color: black;
}
diff --git a/app/assets/v2/images/chains/kusama.svg b/app/assets/v2/images/chains/kusama.svg
new file mode 100644
index 00000000000..89e1c399d96
--- /dev/null
+++ b/app/assets/v2/images/chains/kusama.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/app/assets/v2/js/cart-data.js b/app/assets/v2/js/cart-data.js
index 65a2a81703e..c7a3ef352e6 100644
--- a/app/assets/v2/js/cart-data.js
+++ b/app/assets/v2/js/cart-data.js
@@ -113,6 +113,22 @@ class CartData {
if (!grantData.grant_donation_currency) {
grantData.grant_donation_currency = 'ONE';
}
+ } else if (grantData.tenants.includes('POLKADOT')) {
+
+ if (!grantData.grant_donation_amount) {
+ grantData.grant_donation_amount = 1;
+ }
+ if (!grantData.grant_donation_currency) {
+ grantData.grant_donation_currency = 'DOT';
+ }
+ } else if (grantData.tenants.includes('KUSAMA')) {
+
+ if (!grantData.grant_donation_amount) {
+ grantData.grant_donation_amount = 1;
+ }
+ if (!grantData.grant_donation_currency) {
+ grantData.grant_donation_currency = 'KSM';
+ }
} else if (acceptsAllTokens || 'DAI' == accptedTokenName) {
if (!grantData.grant_donation_amount) {
grantData.grant_donation_amount = 5;
diff --git a/app/assets/v2/js/cart.js b/app/assets/v2/js/cart.js
index d816cddc63d..f41ed9d8aba 100644
--- a/app/assets/v2/js/cart.js
+++ b/app/assets/v2/js/cart.js
@@ -333,6 +333,10 @@ Vue.component('grants-cart', {
isHarmonyExtInstalled() {
return window.onewallet && window.onewallet.isOneWallet;
+ },
+
+ isPolkadotExtInstalled() {
+ return polkadot_extension_dapp.isWeb3Injected;
}
},
@@ -376,6 +380,12 @@ Vue.component('grants-cart', {
case 'HARMONY':
vm.chainId = '1000';
break;
+ case 'KUSAMA':
+ vm.chainId = '59';
+ break;
+ case 'POLKADOT':
+ vm.chainId = '58';
+ break;
}
},
confirmQRPayment: function(e, grant) {
@@ -435,13 +445,21 @@ Vue.component('grants-cart', {
vm.$set(grant, 'loading', false);
});
},
- contributeWithExtension: function(grant, tenant) {
+ contributeWithExtension: function(grant, tenant, data) {
let vm = this;
switch (tenant) {
case 'HARMONY':
contributeWithHarmonyExtension(grant, vm);
break;
+ case 'POLKADOT':
+ case 'KUSAMA':
+ if (data) {
+ contributeWithPolkadotExtension(grant, vm, data);
+ } else {
+ initPolkadotConnection(grant, vm);
+ }
+ break;
}
},
loginWithGitHub() {
@@ -479,7 +497,7 @@ Vue.component('grants-cart', {
// $('input[type=textarea]').focus();
},
- updatePaymentStatus(grant_id, step = 'waiting', txnid) {
+ updatePaymentStatus(grant_id, step = 'waiting', txnid, additionalAttributes) {
let vm = this;
let grantData = vm.grantData;
@@ -489,6 +507,9 @@ Vue.component('grants-cart', {
if (txnid) {
vm.grantData[index].txnid = txnid;
}
+ if (additionalAttributes) {
+ vm.grantData[index].additionalAttributes = additionalAttributes;
+ }
}
});
},
diff --git a/app/assets/v2/js/grants/_new.js b/app/assets/v2/js/grants/_new.js
index 714a446641c..3ab773b2630 100644
--- a/app/assets/v2/js/grants/_new.js
+++ b/app/assets/v2/js/grants/_new.js
@@ -119,6 +119,10 @@ Vue.mixin({
vm.$set(vm.errors, 'zil_payout_address', 'Please enter Zilliqa address');
} else if (vm.chainId == 'harmony' && !vm.form.harmony_payout_address) {
vm.$set(vm.errors, 'harmony_payout_address', 'Please enter Harmony address');
+ } else if (vm.chainId == 'polkadot' && !vm.form.polkadot_payout_address) {
+ vm.$set(vm.errors, 'polkadot_payout_address', 'Please enter Polkadot address');
+ } else if (vm.chainId == 'kusama' && !vm.form.kusama_payout_address) {
+ vm.$set(vm.errors, 'kusama_payout_address', 'Please enter Kusama address');
}
if (!vm.form.grant_type) {
@@ -165,6 +169,8 @@ Vue.mixin({
'celo_payout_address': form.celo_payout_address,
'zil_payout_address': form.zil_payout_address,
'harmony_payout_address': form.harmony_payout_address,
+ 'polkadot_payout_address': form.polkadot_payout_address,
+ 'kusama_payout_address': form.kusama_payout_address,
'grant_type': form.grant_type,
'categories[]': form.grant_categories,
'network': form.network,
@@ -324,6 +330,8 @@ if (document.getElementById('gc-new-grant')) {
celo_payout_address: '',
zil_payout_address: '',
harmony_payout_address: '',
+ polkadot_payout_address: '',
+ kusama_payout_address: '',
grant_type: '',
grant_categories: [],
network: 'mainnet'
diff --git a/app/assets/v2/js/grants/cart/polkadot_extension.js b/app/assets/v2/js/grants/cart/polkadot_extension.js
new file mode 100644
index 00000000000..8480eb0cfcd
--- /dev/null
+++ b/app/assets/v2/js/grants/cart/polkadot_extension.js
@@ -0,0 +1,147 @@
+const initPolkadotConnection = async(grant, vm) => {
+
+ // step 1: check if web3 is injected
+ if (!polkadot_utils.isWeb3Injected) {
+ vm.updatePaymentStatus(grant.grant_id, 'failed');
+ _alert({ message: `Please ensure your Polkadot One wallet is installed and unlocked`}, 'error');
+ return;
+ }
+
+ // step 2: init connection based on token
+ let polkadot_endpoint;
+ let decimals;
+ let format;
+ if (grant.grant_donation_currency == 'KSM') {
+ polkadot_endpoint = KUSAMA_ENDPOINT;
+ decimals = 12;
+ format = 0;
+ } else if (grant.grant_donation_currency == 'DOT') {
+ polkadot_endpoint = POLKADOT_ENDPOINT;
+ decimals = 10;
+ format = 2;
+ }
+
+ polkadot_utils.connect(polkadot_endpoint).then(() =>{
+ polkadot_extension_dapp.web3Enable('gitcoin').then(() => {
+ initComplete(null, grant, vm);
+ }).catch(err => {
+ initComplete(err);
+ });
+ }).catch(err => {
+ console.log(err);
+ _alert('Error connecting to polkadot network', 'error');
+ });
+
+ // step 3: allow user to select address on successful connection
+ async function initComplete(error, grant, vm) {
+
+ if (error) {
+ vm.updatePaymentStatus(grant.grant_id, 'failed');
+ _alert('Please ensure you\'ve connected your polkadot extension to Gitcoin', 'error');
+ console.log(error);
+ return;
+ }
+
+ const addresses = await polkadot_utils.getExtensionConnectedAccounts();
+ for (let i = 0; i < addresses.length; i++) {
+ const balance = (await polkadot_utils.getAddressBalance(addresses[i].address)) / 10 ** decimals;
+ addresses[i].balance = balance;
+ addresses[i].token_symbol = grant.grant_donation_currency;
+ addresses[i].chain_address = polkadot_keyring.encodeAddress(addresses[i].address, format);
+ addresses[i].sufficent_balance = balance >= grant.grant_donation_amount;
+ }
+
+ vm.updatePaymentStatus(grant.grant_id, 'waiting-on-user-input', null, {addresses: addresses});
+ }
+}
+
+
+const contributeWithPolkadotExtension = async(grant, vm, from_address) => {
+
+ let decimals;
+
+ if (grant.grant_donation_currency == 'KSM') {
+ decimals = 12;
+ } else if (grant.grant_donation_currency == 'DOT') {
+ decimals = 10;
+ }
+
+ // step 1. set modal to waiting state
+ vm.updatePaymentStatus(grant.grant_id, 'waiting');
+
+ const amount = grant.grant_donation_amount;
+
+ let to_address;
+ if (grant.grant_donation_currency == 'DOT') {
+ to_address = grant.polkadot_payout_address;
+ } else if (grant.grant_donation_currency == 'KSM') {
+ to_address = grant.kusama_payout_address;
+ }
+
+ // step 2. balance check
+ const account_balance = await polkadot_utils.getAddressBalance(from_address);
+ if (account_balance < amount * 10 ** decimals) {
+ _alert({ message: `Account needs to have more than ${amount} ${grant.grant_donation_currency}`}, 'error');
+ return;
+ }
+
+ // step 3: payout
+ polkadot_utils.transferViaExtension(
+ amount * 10 ** decimals,
+ to_address,
+ from_address
+ ).then(txn => {
+ callback(null, from_address, txn.hash.toString());
+ }).catch(err => {
+ callback(err);
+ });
+
+
+ function callback(error, from_address, txn) {
+ if (error) {
+ vm.updatePaymentStatus(grant.grant_id, 'failed');
+ _alert({ message: gettext('Unable to contribute to grant due to ' + error) }, 'error');
+ console.log(error);
+ } else {
+
+ let tenant;
+ if (grant.grant_donation_currency == 'DOT') {
+ tenant = 'POLKADOT';
+ } else if (grant.grant_donation_currency == 'KSM') {
+ tenant = 'KUSAMA';
+ }
+
+ const payload = {
+ 'contributions': [{
+ 'grant_id': grant.grant_id,
+ 'contributor_address': from_address,
+ 'tx_id': txn,
+ 'token_symbol': grant.grant_donation_currency,
+ 'tenant': tenant,
+ 'comment': grant.grant_comments,
+ 'amount_per_period': grant.grant_donation_amount
+ }]
+ };
+
+ const apiUrlBounty = `v1/api/contribute`;
+
+ fetchData(apiUrlBounty, 'POST', JSON.stringify(payload)).then(response => {
+
+ if (200 <= response.status && response.status <= 204) {
+ console.log('success', response);
+
+ vm.updatePaymentStatus(grant.grant_id, 'done', txn);
+
+ } else {
+ vm.updatePaymentStatus(grant.grant_id, 'failed');
+ _alert('Unable to make contribute to grant. Please try again later', 'error');
+ console.error(`error: grant contribution failed with status: ${response.status} and message: ${response.message}`);
+ }
+ }).catch(function(error) {
+ vm.updatePaymentStatus(grant.grant_id, 'failed');
+ _alert('Unable to make contribute to grant. Please try again later', 'error');
+ console.log(error);
+ });
+ }
+ }
+};
\ No newline at end of file
diff --git a/app/assets/v2/js/grants/funding.js b/app/assets/v2/js/grants/funding.js
index 58e44502c70..08bbb84b4d1 100644
--- a/app/assets/v2/js/grants/funding.js
+++ b/app/assets/v2/js/grants/funding.js
@@ -174,6 +174,12 @@ function tokenOptionsForGrant(grant) {
} else if (grant.tenants && grant.tenants.includes('HARMONY')) {
tokenDataList = tokenDataList.filter(token => token.chainId === 1000);
tokenDefault = 'ONE';
+ } else if (grant.tenants && grant.tenants.includes('POLKADOT')) {
+ tokenDataList = tokenDataList.filter(token => token.chainId === 58);
+ tokenDefault = 'DOT';
+ } else if (grant.tenants && grant.tenants.includes('KUSAMA')) {
+ tokenDataList = tokenDataList.filter(token => token.chainId === 59);
+ tokenDefault = 'KSM';
} else {
tokenDataList = tokenDataList.filter(token => token.chainId === 1);
}
diff --git a/app/assets/v2/js/lib/polkadot/core.min.js b/app/assets/v2/js/lib/polkadot/core.min.js
index 3a48ebc1c8b..b9e90a71f00 100644
--- a/app/assets/v2/js/lib/polkadot/core.min.js
+++ b/app/assets/v2/js/lib/polkadot/core.min.js
@@ -1,20 +1,22 @@
-!function(A){var e={};function t(r){if(e[r])return e[r].exports;var c=e[r]={i:r,l:!1,exports:{}};return A[r].call(c.exports,c,c.exports,t),c.l=!0,c.exports}t.m=A,t.c=e,t.d=function(A,e,r){t.o(A,e)||Object.defineProperty(A,e,{enumerable:!0,get:r})},t.r=function(A){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(A,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(A,"__esModule",{value:!0})},t.t=function(A,e){if(1&e&&(A=t(A)),8&e)return A;if(4&e&&"object"==typeof A&&A&&A.__esModule)return A;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:A}),2&e&&"string"!=typeof A)for(var c in A)t.d(r,c,function(e){return A[e]}.bind(null,c));return r},t.n=function(A){var e=A&&A.__esModule?function(){return A.default}:function(){return A};return t.d(e,"a",e),e},t.o=function(A,e){return Object.prototype.hasOwnProperty.call(A,e)},t.p="",t(t.s=4)}([function(A,e){var t;t=function(){return this}();try{t=t||new Function("return this")()}catch(A){"object"==typeof window&&(t=window)}A.exports=t},function(A,e){(function(e){A.exports=e}).call(this,{})},,,function(A,e,t){(function(A){var e;!function A(e,t,r){function c(f,n){if(!t[f]){if(!e[f]){if(i)return i(f,!0);var a=new Error("Cannot find module '"+f+"'");throw a.code="MODULE_NOT_FOUND",a}var o=t[f]={exports:{}};e[f][0].call(o.exports,(function(A){return c(e[f][1][A]||A)}),o,o.exports,A,e,t,r)}return t[f].exports}for(var i=!1,f=0;f>6],c=0==(32&t);if(31==(31&t)){let r=t;for(t=0;128==(128&r);){if(r=A.readUInt8(e),A.isError(r))return r;t<<=7,t|=127&r}}else t&=31;return{cls:r,primitive:c,tag:t,tagStr:n.tag[t]}}function d(A,e,t){let r=A.readUInt8(t);if(A.isError(r))return r;if(!e&&128===r)return null;if(0==(128&r))return r;const c=127&r;if(c>4)return A.error("length octect is too long");r=0;for(let e=0;e=31)return r.error("Multi-octet tag encoding unsupported");e||(c|=32);return c|=f.tagClassByName[t||"universal"]<<6,c}(A,e,t,this.reporter);if(r.length<128){const A=c.alloc(2);return A[0]=i,A[1]=r.length,this._createEncoderBuffer([A,r])}let n=1;for(let A=r.length;A>=256;A>>=8)n++;const a=c.alloc(2+n);a[0]=i,a[1]=128|n;for(let A=1+n,e=r.length;e>0;A--,e>>=8)a[A]=255&e;return this._createEncoderBuffer([a,r])},a.prototype._encodeStr=function(A,e){if("bitstr"===e)return this._createEncoderBuffer([0|A.unused,A.data]);if("bmpstr"===e){const e=c.alloc(2*A.length);for(let t=0;t=40)return this.reporter.error("Second objid identifier OOB");A.splice(0,2,40*A[0]+A[1])}let r=0;for(let e=0;e=128;t>>=7)r++}const i=c.alloc(r);let f=i.length-1;for(let e=A.length-1;e>=0;e--){let t=A[e];for(i[f--]=127&t;(t>>=7)>0;)i[f--]=128|127&t}return this._createEncoderBuffer(i)},a.prototype._encodeTime=function(A,e){let t;const r=new Date(A);return"gentime"===e?t=[o(r.getUTCFullYear()),o(r.getUTCMonth()+1),o(r.getUTCDate()),o(r.getUTCHours()),o(r.getUTCMinutes()),o(r.getUTCSeconds()),"Z"].join(""):"utctime"===e?t=[o(r.getUTCFullYear()%100),o(r.getUTCMonth()+1),o(r.getUTCDate()),o(r.getUTCHours()),o(r.getUTCMinutes()),o(r.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+e+" time is not supported yet"),this._encodeStr(t,"octstr")},a.prototype._encodeNull=function(){return this._createEncoderBuffer("")},a.prototype._encodeInt=function(A,e){if("string"==typeof A){if(!e)return this.reporter.error("String int or enum given, but no values map");if(!e.hasOwnProperty(A))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(A));A=e[A]}if("number"!=typeof A&&!c.isBuffer(A)){const e=A.toArray();!A.sign&&128&e[0]&&e.unshift(0),A=c.from(e)}if(c.isBuffer(A)){let e=A.length;0===A.length&&e++;const t=c.alloc(e);return A.copy(t),0===A.length&&(t[0]=0),this._createEncoderBuffer(t)}if(A<128)return this._createEncoderBuffer(A);if(A<256)return this._createEncoderBuffer([0,A]);let t=1;for(let e=A;e>=256;e>>=8)t++;const r=new Array(t);for(let e=r.length-1;e>=0;e--)r[e]=255&A,A>>=8;return 128&r[0]&&r.unshift(0),this._createEncoderBuffer(c.from(r))},a.prototype._encodeBool=function(A){return this._createEncoderBuffer(A?255:0)},a.prototype._use=function(A,e){return"function"==typeof A&&(A=A(e)),A._getEncoder("der").tree},a.prototype._skipDefault=function(A,e,t){const r=this._baseState;let c;if(null===r.default)return!1;const i=A.join();if(void 0===r.defaultBuffer&&(r.defaultBuffer=this._encodeValue(r.default,e,t).join()),i.length!==r.defaultBuffer.length)return!1;for(c=0;c=49&&f<=54?f-49+10:f>=17&&f<=22?f-17+10:15&f}return r}function a(A,e,t,r){for(var c=0,i=Math.min(A.length,t),f=e;f=49?n-49+10:n>=17?n-17+10:n}return c}i.isBN=function(A){return A instanceof i||null!==A&&"object"==typeof A&&A.constructor.wordSize===i.wordSize&&Array.isArray(A.words)},i.max=function(A,e){return A.cmp(e)>0?A:e},i.min=function(A,e){return A.cmp(e)<0?A:e},i.prototype._init=function(A,e,t){if("number"==typeof A)return this._initNumber(A,e,t);if("object"==typeof A)return this._initArray(A,e,t);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var c=0;"-"===(A=A.toString().replace(/\s+/g,""))[0]&&c++,16===e?this._parseHex(A,c):this._parseBase(A,e,c),"-"===A[0]&&(this.negative=1),this.strip(),"le"===t&&this._initArray(this.toArray(),e,t)},i.prototype._initNumber=function(A,e,t){A<0&&(this.negative=1,A=-A),A<67108864?(this.words=[67108863&A],this.length=1):A<4503599627370496?(this.words=[67108863&A,A/67108864&67108863],this.length=2):(r(A<9007199254740992),this.words=[67108863&A,A/67108864&67108863,1],this.length=3),"le"===t&&this._initArray(this.toArray(),e,t)},i.prototype._initArray=function(A,e,t){if(r("number"==typeof A.length),A.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(A.length/3),this.words=new Array(this.length);for(var c=0;c=0;c-=3)f=A[c]|A[c-1]<<8|A[c-2]<<16,this.words[i]|=f<>>26-n&67108863,(n+=24)>=26&&(n-=26,i++);else if("le"===t)for(c=0,i=0;c>>26-n&67108863,(n+=24)>=26&&(n-=26,i++);return this.strip()},i.prototype._parseHex=function(A,e){this.length=Math.ceil((A.length-e)/6),this.words=new Array(this.length);for(var t=0;t=e;t-=6)c=n(A,t,t+6),this.words[r]|=c<>>26-i&4194303,(i+=24)>=26&&(i-=26,r++);t+6!==e&&(c=n(A,e,t+6),this.words[r]|=c<>>26-i&4194303),this.strip()},i.prototype._parseBase=function(A,e,t){this.words=[0],this.length=1;for(var r=0,c=1;c<=67108863;c*=e)r++;r--,c=c/e|0;for(var i=A.length-t,f=i%r,n=Math.min(i,i-f)+t,o=0,s=t;s1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var o=["","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"],s=[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],d=[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 u(A,e,t){t.negative=e.negative^A.negative;var r=A.length+e.length|0;t.length=r,r=r-1|0;var c=0|A.words[0],i=0|e.words[0],f=c*i,n=67108863&f,a=f/67108864|0;t.words[0]=n;for(var o=1;o>>26,d=67108863&a,u=Math.min(o,e.length-1),l=Math.max(0,o-A.length+1);l<=u;l++){var g=o-l|0;s+=(f=(c=0|A.words[g])*(i=0|e.words[l])+d)/67108864|0,d=67108863&f}t.words[o]=0|d,a=0|s}return 0!==a?t.words[o]=0|a:t.length--,t.strip()}i.prototype.toString=function(A,e){var t;if(e=0|e||1,16===(A=A||10)||"hex"===A){t="";for(var c=0,i=0,f=0;f>>24-c&16777215)||f!==this.length-1?o[6-a.length]+a+t:a+t,(c+=2)>=26&&(c-=26,f--)}for(0!==i&&(t=i.toString(16)+t);t.length%e!=0;)t="0"+t;return 0!==this.negative&&(t="-"+t),t}if(A===(0|A)&&A>=2&&A<=36){var u=s[A],l=d[A];t="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modn(l).toString(A);t=(g=g.idivn(l)).isZero()?p+t:o[u-p.length]+p+t}for(this.isZero()&&(t="0"+t);t.length%e!=0;)t="0"+t;return 0!==this.negative&&(t="-"+t),t}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var A=this.words[0];return 2===this.length?A+=67108864*this.words[1]:3===this.length&&1===this.words[2]?A+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-A:A},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(A,e){return r(void 0!==f),this.toArrayLike(f,A,e)},i.prototype.toArray=function(A,e){return this.toArrayLike(Array,A,e)},i.prototype.toArrayLike=function(A,e,t){var c=this.byteLength(),i=t||Math.max(1,c);r(c<=i,"byte array longer than desired length"),r(i>0,"Requested array length <= 0"),this.strip();var f,n,a="le"===e,o=new A(i),s=this.clone();if(a){for(n=0;!s.isZero();n++)f=s.andln(255),s.iushrn(8),o[n]=f;for(;n=4096&&(t+=13,e>>>=13),e>=64&&(t+=7,e>>>=7),e>=8&&(t+=4,e>>>=4),e>=2&&(t+=2,e>>>=2),t+e},i.prototype._zeroBits=function(A){if(0===A)return 26;var e=A,t=0;return 0==(8191&e)&&(t+=13,e>>>=13),0==(127&e)&&(t+=7,e>>>=7),0==(15&e)&&(t+=4,e>>>=4),0==(3&e)&&(t+=2,e>>>=2),0==(1&e)&&t++,t},i.prototype.bitLength=function(){var A=this.words[this.length-1],e=this._countBits(A);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var A=0,e=0;eA.length?this.clone().ior(A):A.clone().ior(this)},i.prototype.uor=function(A){return this.length>A.length?this.clone().iuor(A):A.clone().iuor(this)},i.prototype.iuand=function(A){var e;e=this.length>A.length?A:this;for(var t=0;tA.length?this.clone().iand(A):A.clone().iand(this)},i.prototype.uand=function(A){return this.length>A.length?this.clone().iuand(A):A.clone().iuand(this)},i.prototype.iuxor=function(A){var e,t;this.length>A.length?(e=this,t=A):(e=A,t=this);for(var r=0;rA.length?this.clone().ixor(A):A.clone().ixor(this)},i.prototype.uxor=function(A){return this.length>A.length?this.clone().iuxor(A):A.clone().iuxor(this)},i.prototype.inotn=function(A){r("number"==typeof A&&A>=0);var e=0|Math.ceil(A/26),t=A%26;this._expand(e),t>0&&e--;for(var c=0;c0&&(this.words[c]=~this.words[c]&67108863>>26-t),this.strip()},i.prototype.notn=function(A){return this.clone().inotn(A)},i.prototype.setn=function(A,e){r("number"==typeof A&&A>=0);var t=A/26|0,c=A%26;return this._expand(t+1),this.words[t]=e?this.words[t]|1<A.length?(t=this,r=A):(t=A,r=this);for(var c=0,i=0;i>>26;for(;0!==c&&i>>26;if(this.length=t.length,0!==c)this.words[this.length]=c,this.length++;else if(t!==this)for(;iA.length?this.clone().iadd(A):A.clone().iadd(this)},i.prototype.isub=function(A){if(0!==A.negative){A.negative=0;var e=this.iadd(A);return A.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(A),this.negative=1,this._normSign();var t,r,c=this.cmp(A);if(0===c)return this.negative=0,this.length=1,this.words[0]=0,this;c>0?(t=this,r=A):(t=A,r=this);for(var i=0,f=0;f>26,this.words[f]=67108863&e;for(;0!==i&&f>26,this.words[f]=67108863&e;if(0===i&&f>>13,l=0|f[1],g=8191&l,p=l>>>13,B=0|f[2],h=8191&B,I=B>>>13,b=0|f[3],E=8191&b,C=b>>>13,Q=0|f[4],y=8191&Q,w=Q>>>13,m=0|f[5],S=8191&m,D=m>>>13,M=0|f[6],v=8191&M,k=M>>>13,O=0|f[7],N=8191&O,G=O>>>13,F=0|f[8],U=8191&F,x=F>>>13,j=0|f[9],Y=8191&j,_=j>>>13,L=0|n[0],R=8191&L,H=L>>>13,P=0|n[1],J=8191&P,K=P>>>13,q=0|n[2],T=8191&q,V=q>>>13,Z=0|n[3],z=8191&Z,W=Z>>>13,X=0|n[4],$=8191&X,AA=X>>>13,eA=0|n[5],tA=8191&eA,rA=eA>>>13,cA=0|n[6],iA=8191&cA,fA=cA>>>13,nA=0|n[7],aA=8191&nA,oA=nA>>>13,sA=0|n[8],dA=8191&sA,uA=sA>>>13,lA=0|n[9],gA=8191&lA,pA=lA>>>13;t.negative=A.negative^e.negative,t.length=19;var BA=(o+(r=Math.imul(d,R))|0)+((8191&(c=(c=Math.imul(d,H))+Math.imul(u,R)|0))<<13)|0;o=((i=Math.imul(u,H))+(c>>>13)|0)+(BA>>>26)|0,BA&=67108863,r=Math.imul(g,R),c=(c=Math.imul(g,H))+Math.imul(p,R)|0,i=Math.imul(p,H);var hA=(o+(r=r+Math.imul(d,J)|0)|0)+((8191&(c=(c=c+Math.imul(d,K)|0)+Math.imul(u,J)|0))<<13)|0;o=((i=i+Math.imul(u,K)|0)+(c>>>13)|0)+(hA>>>26)|0,hA&=67108863,r=Math.imul(h,R),c=(c=Math.imul(h,H))+Math.imul(I,R)|0,i=Math.imul(I,H),r=r+Math.imul(g,J)|0,c=(c=c+Math.imul(g,K)|0)+Math.imul(p,J)|0,i=i+Math.imul(p,K)|0;var IA=(o+(r=r+Math.imul(d,T)|0)|0)+((8191&(c=(c=c+Math.imul(d,V)|0)+Math.imul(u,T)|0))<<13)|0;o=((i=i+Math.imul(u,V)|0)+(c>>>13)|0)+(IA>>>26)|0,IA&=67108863,r=Math.imul(E,R),c=(c=Math.imul(E,H))+Math.imul(C,R)|0,i=Math.imul(C,H),r=r+Math.imul(h,J)|0,c=(c=c+Math.imul(h,K)|0)+Math.imul(I,J)|0,i=i+Math.imul(I,K)|0,r=r+Math.imul(g,T)|0,c=(c=c+Math.imul(g,V)|0)+Math.imul(p,T)|0,i=i+Math.imul(p,V)|0;var bA=(o+(r=r+Math.imul(d,z)|0)|0)+((8191&(c=(c=c+Math.imul(d,W)|0)+Math.imul(u,z)|0))<<13)|0;o=((i=i+Math.imul(u,W)|0)+(c>>>13)|0)+(bA>>>26)|0,bA&=67108863,r=Math.imul(y,R),c=(c=Math.imul(y,H))+Math.imul(w,R)|0,i=Math.imul(w,H),r=r+Math.imul(E,J)|0,c=(c=c+Math.imul(E,K)|0)+Math.imul(C,J)|0,i=i+Math.imul(C,K)|0,r=r+Math.imul(h,T)|0,c=(c=c+Math.imul(h,V)|0)+Math.imul(I,T)|0,i=i+Math.imul(I,V)|0,r=r+Math.imul(g,z)|0,c=(c=c+Math.imul(g,W)|0)+Math.imul(p,z)|0,i=i+Math.imul(p,W)|0;var EA=(o+(r=r+Math.imul(d,$)|0)|0)+((8191&(c=(c=c+Math.imul(d,AA)|0)+Math.imul(u,$)|0))<<13)|0;o=((i=i+Math.imul(u,AA)|0)+(c>>>13)|0)+(EA>>>26)|0,EA&=67108863,r=Math.imul(S,R),c=(c=Math.imul(S,H))+Math.imul(D,R)|0,i=Math.imul(D,H),r=r+Math.imul(y,J)|0,c=(c=c+Math.imul(y,K)|0)+Math.imul(w,J)|0,i=i+Math.imul(w,K)|0,r=r+Math.imul(E,T)|0,c=(c=c+Math.imul(E,V)|0)+Math.imul(C,T)|0,i=i+Math.imul(C,V)|0,r=r+Math.imul(h,z)|0,c=(c=c+Math.imul(h,W)|0)+Math.imul(I,z)|0,i=i+Math.imul(I,W)|0,r=r+Math.imul(g,$)|0,c=(c=c+Math.imul(g,AA)|0)+Math.imul(p,$)|0,i=i+Math.imul(p,AA)|0;var CA=(o+(r=r+Math.imul(d,tA)|0)|0)+((8191&(c=(c=c+Math.imul(d,rA)|0)+Math.imul(u,tA)|0))<<13)|0;o=((i=i+Math.imul(u,rA)|0)+(c>>>13)|0)+(CA>>>26)|0,CA&=67108863,r=Math.imul(v,R),c=(c=Math.imul(v,H))+Math.imul(k,R)|0,i=Math.imul(k,H),r=r+Math.imul(S,J)|0,c=(c=c+Math.imul(S,K)|0)+Math.imul(D,J)|0,i=i+Math.imul(D,K)|0,r=r+Math.imul(y,T)|0,c=(c=c+Math.imul(y,V)|0)+Math.imul(w,T)|0,i=i+Math.imul(w,V)|0,r=r+Math.imul(E,z)|0,c=(c=c+Math.imul(E,W)|0)+Math.imul(C,z)|0,i=i+Math.imul(C,W)|0,r=r+Math.imul(h,$)|0,c=(c=c+Math.imul(h,AA)|0)+Math.imul(I,$)|0,i=i+Math.imul(I,AA)|0,r=r+Math.imul(g,tA)|0,c=(c=c+Math.imul(g,rA)|0)+Math.imul(p,tA)|0,i=i+Math.imul(p,rA)|0;var QA=(o+(r=r+Math.imul(d,iA)|0)|0)+((8191&(c=(c=c+Math.imul(d,fA)|0)+Math.imul(u,iA)|0))<<13)|0;o=((i=i+Math.imul(u,fA)|0)+(c>>>13)|0)+(QA>>>26)|0,QA&=67108863,r=Math.imul(N,R),c=(c=Math.imul(N,H))+Math.imul(G,R)|0,i=Math.imul(G,H),r=r+Math.imul(v,J)|0,c=(c=c+Math.imul(v,K)|0)+Math.imul(k,J)|0,i=i+Math.imul(k,K)|0,r=r+Math.imul(S,T)|0,c=(c=c+Math.imul(S,V)|0)+Math.imul(D,T)|0,i=i+Math.imul(D,V)|0,r=r+Math.imul(y,z)|0,c=(c=c+Math.imul(y,W)|0)+Math.imul(w,z)|0,i=i+Math.imul(w,W)|0,r=r+Math.imul(E,$)|0,c=(c=c+Math.imul(E,AA)|0)+Math.imul(C,$)|0,i=i+Math.imul(C,AA)|0,r=r+Math.imul(h,tA)|0,c=(c=c+Math.imul(h,rA)|0)+Math.imul(I,tA)|0,i=i+Math.imul(I,rA)|0,r=r+Math.imul(g,iA)|0,c=(c=c+Math.imul(g,fA)|0)+Math.imul(p,iA)|0,i=i+Math.imul(p,fA)|0;var yA=(o+(r=r+Math.imul(d,aA)|0)|0)+((8191&(c=(c=c+Math.imul(d,oA)|0)+Math.imul(u,aA)|0))<<13)|0;o=((i=i+Math.imul(u,oA)|0)+(c>>>13)|0)+(yA>>>26)|0,yA&=67108863,r=Math.imul(U,R),c=(c=Math.imul(U,H))+Math.imul(x,R)|0,i=Math.imul(x,H),r=r+Math.imul(N,J)|0,c=(c=c+Math.imul(N,K)|0)+Math.imul(G,J)|0,i=i+Math.imul(G,K)|0,r=r+Math.imul(v,T)|0,c=(c=c+Math.imul(v,V)|0)+Math.imul(k,T)|0,i=i+Math.imul(k,V)|0,r=r+Math.imul(S,z)|0,c=(c=c+Math.imul(S,W)|0)+Math.imul(D,z)|0,i=i+Math.imul(D,W)|0,r=r+Math.imul(y,$)|0,c=(c=c+Math.imul(y,AA)|0)+Math.imul(w,$)|0,i=i+Math.imul(w,AA)|0,r=r+Math.imul(E,tA)|0,c=(c=c+Math.imul(E,rA)|0)+Math.imul(C,tA)|0,i=i+Math.imul(C,rA)|0,r=r+Math.imul(h,iA)|0,c=(c=c+Math.imul(h,fA)|0)+Math.imul(I,iA)|0,i=i+Math.imul(I,fA)|0,r=r+Math.imul(g,aA)|0,c=(c=c+Math.imul(g,oA)|0)+Math.imul(p,aA)|0,i=i+Math.imul(p,oA)|0;var wA=(o+(r=r+Math.imul(d,dA)|0)|0)+((8191&(c=(c=c+Math.imul(d,uA)|0)+Math.imul(u,dA)|0))<<13)|0;o=((i=i+Math.imul(u,uA)|0)+(c>>>13)|0)+(wA>>>26)|0,wA&=67108863,r=Math.imul(Y,R),c=(c=Math.imul(Y,H))+Math.imul(_,R)|0,i=Math.imul(_,H),r=r+Math.imul(U,J)|0,c=(c=c+Math.imul(U,K)|0)+Math.imul(x,J)|0,i=i+Math.imul(x,K)|0,r=r+Math.imul(N,T)|0,c=(c=c+Math.imul(N,V)|0)+Math.imul(G,T)|0,i=i+Math.imul(G,V)|0,r=r+Math.imul(v,z)|0,c=(c=c+Math.imul(v,W)|0)+Math.imul(k,z)|0,i=i+Math.imul(k,W)|0,r=r+Math.imul(S,$)|0,c=(c=c+Math.imul(S,AA)|0)+Math.imul(D,$)|0,i=i+Math.imul(D,AA)|0,r=r+Math.imul(y,tA)|0,c=(c=c+Math.imul(y,rA)|0)+Math.imul(w,tA)|0,i=i+Math.imul(w,rA)|0,r=r+Math.imul(E,iA)|0,c=(c=c+Math.imul(E,fA)|0)+Math.imul(C,iA)|0,i=i+Math.imul(C,fA)|0,r=r+Math.imul(h,aA)|0,c=(c=c+Math.imul(h,oA)|0)+Math.imul(I,aA)|0,i=i+Math.imul(I,oA)|0,r=r+Math.imul(g,dA)|0,c=(c=c+Math.imul(g,uA)|0)+Math.imul(p,dA)|0,i=i+Math.imul(p,uA)|0;var mA=(o+(r=r+Math.imul(d,gA)|0)|0)+((8191&(c=(c=c+Math.imul(d,pA)|0)+Math.imul(u,gA)|0))<<13)|0;o=((i=i+Math.imul(u,pA)|0)+(c>>>13)|0)+(mA>>>26)|0,mA&=67108863,r=Math.imul(Y,J),c=(c=Math.imul(Y,K))+Math.imul(_,J)|0,i=Math.imul(_,K),r=r+Math.imul(U,T)|0,c=(c=c+Math.imul(U,V)|0)+Math.imul(x,T)|0,i=i+Math.imul(x,V)|0,r=r+Math.imul(N,z)|0,c=(c=c+Math.imul(N,W)|0)+Math.imul(G,z)|0,i=i+Math.imul(G,W)|0,r=r+Math.imul(v,$)|0,c=(c=c+Math.imul(v,AA)|0)+Math.imul(k,$)|0,i=i+Math.imul(k,AA)|0,r=r+Math.imul(S,tA)|0,c=(c=c+Math.imul(S,rA)|0)+Math.imul(D,tA)|0,i=i+Math.imul(D,rA)|0,r=r+Math.imul(y,iA)|0,c=(c=c+Math.imul(y,fA)|0)+Math.imul(w,iA)|0,i=i+Math.imul(w,fA)|0,r=r+Math.imul(E,aA)|0,c=(c=c+Math.imul(E,oA)|0)+Math.imul(C,aA)|0,i=i+Math.imul(C,oA)|0,r=r+Math.imul(h,dA)|0,c=(c=c+Math.imul(h,uA)|0)+Math.imul(I,dA)|0,i=i+Math.imul(I,uA)|0;var SA=(o+(r=r+Math.imul(g,gA)|0)|0)+((8191&(c=(c=c+Math.imul(g,pA)|0)+Math.imul(p,gA)|0))<<13)|0;o=((i=i+Math.imul(p,pA)|0)+(c>>>13)|0)+(SA>>>26)|0,SA&=67108863,r=Math.imul(Y,T),c=(c=Math.imul(Y,V))+Math.imul(_,T)|0,i=Math.imul(_,V),r=r+Math.imul(U,z)|0,c=(c=c+Math.imul(U,W)|0)+Math.imul(x,z)|0,i=i+Math.imul(x,W)|0,r=r+Math.imul(N,$)|0,c=(c=c+Math.imul(N,AA)|0)+Math.imul(G,$)|0,i=i+Math.imul(G,AA)|0,r=r+Math.imul(v,tA)|0,c=(c=c+Math.imul(v,rA)|0)+Math.imul(k,tA)|0,i=i+Math.imul(k,rA)|0,r=r+Math.imul(S,iA)|0,c=(c=c+Math.imul(S,fA)|0)+Math.imul(D,iA)|0,i=i+Math.imul(D,fA)|0,r=r+Math.imul(y,aA)|0,c=(c=c+Math.imul(y,oA)|0)+Math.imul(w,aA)|0,i=i+Math.imul(w,oA)|0,r=r+Math.imul(E,dA)|0,c=(c=c+Math.imul(E,uA)|0)+Math.imul(C,dA)|0,i=i+Math.imul(C,uA)|0;var DA=(o+(r=r+Math.imul(h,gA)|0)|0)+((8191&(c=(c=c+Math.imul(h,pA)|0)+Math.imul(I,gA)|0))<<13)|0;o=((i=i+Math.imul(I,pA)|0)+(c>>>13)|0)+(DA>>>26)|0,DA&=67108863,r=Math.imul(Y,z),c=(c=Math.imul(Y,W))+Math.imul(_,z)|0,i=Math.imul(_,W),r=r+Math.imul(U,$)|0,c=(c=c+Math.imul(U,AA)|0)+Math.imul(x,$)|0,i=i+Math.imul(x,AA)|0,r=r+Math.imul(N,tA)|0,c=(c=c+Math.imul(N,rA)|0)+Math.imul(G,tA)|0,i=i+Math.imul(G,rA)|0,r=r+Math.imul(v,iA)|0,c=(c=c+Math.imul(v,fA)|0)+Math.imul(k,iA)|0,i=i+Math.imul(k,fA)|0,r=r+Math.imul(S,aA)|0,c=(c=c+Math.imul(S,oA)|0)+Math.imul(D,aA)|0,i=i+Math.imul(D,oA)|0,r=r+Math.imul(y,dA)|0,c=(c=c+Math.imul(y,uA)|0)+Math.imul(w,dA)|0,i=i+Math.imul(w,uA)|0;var MA=(o+(r=r+Math.imul(E,gA)|0)|0)+((8191&(c=(c=c+Math.imul(E,pA)|0)+Math.imul(C,gA)|0))<<13)|0;o=((i=i+Math.imul(C,pA)|0)+(c>>>13)|0)+(MA>>>26)|0,MA&=67108863,r=Math.imul(Y,$),c=(c=Math.imul(Y,AA))+Math.imul(_,$)|0,i=Math.imul(_,AA),r=r+Math.imul(U,tA)|0,c=(c=c+Math.imul(U,rA)|0)+Math.imul(x,tA)|0,i=i+Math.imul(x,rA)|0,r=r+Math.imul(N,iA)|0,c=(c=c+Math.imul(N,fA)|0)+Math.imul(G,iA)|0,i=i+Math.imul(G,fA)|0,r=r+Math.imul(v,aA)|0,c=(c=c+Math.imul(v,oA)|0)+Math.imul(k,aA)|0,i=i+Math.imul(k,oA)|0,r=r+Math.imul(S,dA)|0,c=(c=c+Math.imul(S,uA)|0)+Math.imul(D,dA)|0,i=i+Math.imul(D,uA)|0;var vA=(o+(r=r+Math.imul(y,gA)|0)|0)+((8191&(c=(c=c+Math.imul(y,pA)|0)+Math.imul(w,gA)|0))<<13)|0;o=((i=i+Math.imul(w,pA)|0)+(c>>>13)|0)+(vA>>>26)|0,vA&=67108863,r=Math.imul(Y,tA),c=(c=Math.imul(Y,rA))+Math.imul(_,tA)|0,i=Math.imul(_,rA),r=r+Math.imul(U,iA)|0,c=(c=c+Math.imul(U,fA)|0)+Math.imul(x,iA)|0,i=i+Math.imul(x,fA)|0,r=r+Math.imul(N,aA)|0,c=(c=c+Math.imul(N,oA)|0)+Math.imul(G,aA)|0,i=i+Math.imul(G,oA)|0,r=r+Math.imul(v,dA)|0,c=(c=c+Math.imul(v,uA)|0)+Math.imul(k,dA)|0,i=i+Math.imul(k,uA)|0;var kA=(o+(r=r+Math.imul(S,gA)|0)|0)+((8191&(c=(c=c+Math.imul(S,pA)|0)+Math.imul(D,gA)|0))<<13)|0;o=((i=i+Math.imul(D,pA)|0)+(c>>>13)|0)+(kA>>>26)|0,kA&=67108863,r=Math.imul(Y,iA),c=(c=Math.imul(Y,fA))+Math.imul(_,iA)|0,i=Math.imul(_,fA),r=r+Math.imul(U,aA)|0,c=(c=c+Math.imul(U,oA)|0)+Math.imul(x,aA)|0,i=i+Math.imul(x,oA)|0,r=r+Math.imul(N,dA)|0,c=(c=c+Math.imul(N,uA)|0)+Math.imul(G,dA)|0,i=i+Math.imul(G,uA)|0;var OA=(o+(r=r+Math.imul(v,gA)|0)|0)+((8191&(c=(c=c+Math.imul(v,pA)|0)+Math.imul(k,gA)|0))<<13)|0;o=((i=i+Math.imul(k,pA)|0)+(c>>>13)|0)+(OA>>>26)|0,OA&=67108863,r=Math.imul(Y,aA),c=(c=Math.imul(Y,oA))+Math.imul(_,aA)|0,i=Math.imul(_,oA),r=r+Math.imul(U,dA)|0,c=(c=c+Math.imul(U,uA)|0)+Math.imul(x,dA)|0,i=i+Math.imul(x,uA)|0;var NA=(o+(r=r+Math.imul(N,gA)|0)|0)+((8191&(c=(c=c+Math.imul(N,pA)|0)+Math.imul(G,gA)|0))<<13)|0;o=((i=i+Math.imul(G,pA)|0)+(c>>>13)|0)+(NA>>>26)|0,NA&=67108863,r=Math.imul(Y,dA),c=(c=Math.imul(Y,uA))+Math.imul(_,dA)|0,i=Math.imul(_,uA);var GA=(o+(r=r+Math.imul(U,gA)|0)|0)+((8191&(c=(c=c+Math.imul(U,pA)|0)+Math.imul(x,gA)|0))<<13)|0;o=((i=i+Math.imul(x,pA)|0)+(c>>>13)|0)+(GA>>>26)|0,GA&=67108863;var FA=(o+(r=Math.imul(Y,gA))|0)+((8191&(c=(c=Math.imul(Y,pA))+Math.imul(_,gA)|0))<<13)|0;return o=((i=Math.imul(_,pA))+(c>>>13)|0)+(FA>>>26)|0,FA&=67108863,a[0]=BA,a[1]=hA,a[2]=IA,a[3]=bA,a[4]=EA,a[5]=CA,a[6]=QA,a[7]=yA,a[8]=wA,a[9]=mA,a[10]=SA,a[11]=DA,a[12]=MA,a[13]=vA,a[14]=kA,a[15]=OA,a[16]=NA,a[17]=GA,a[18]=FA,0!==o&&(a[19]=o,t.length++),t};function g(A,e,t){return(new p).mulp(A,e,t)}function p(A,e){this.x=A,this.y=e}Math.imul||(l=u),i.prototype.mulTo=function(A,e){var t=this.length+A.length;return 10===this.length&&10===A.length?l(this,A,e):t<63?u(this,A,e):t<1024?function(A,e,t){t.negative=e.negative^A.negative,t.length=A.length+e.length;for(var r=0,c=0,i=0;i>>26)|0)>>>26,f&=67108863}t.words[i]=n,r=f,f=c}return 0!==r?t.words[i]=r:t.length--,t.strip()}(this,A,e):g(this,A,e)},p.prototype.makeRBT=function(A){for(var e=new Array(A),t=i.prototype._countBits(A)-1,r=0;r>=1;return r},p.prototype.permute=function(A,e,t,r,c,i){for(var f=0;f>>=1)c++;return 1<>>=13,t[2*f+1]=8191&i,i>>>=13;for(f=2*e;f>=26,e+=c/67108864|0,e+=i>>>26,this.words[t]=67108863&i}return 0!==e&&(this.words[t]=e,this.length++),this},i.prototype.muln=function(A){return this.clone().imuln(A)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(A){var e=function(A){for(var e=new Array(A.bitLength()),t=0;t>>c}return e}(A);if(0===e.length)return new i(1);for(var t=this,r=0;r=0);var e,t=A%26,c=(A-t)/26,i=67108863>>>26-t<<26-t;if(0!==t){var f=0;for(e=0;e>>26-t}f&&(this.words[e]=f,this.length++)}if(0!==c){for(e=this.length-1;e>=0;e--)this.words[e+c]=this.words[e];for(e=0;e=0),c=e?(e-e%26)/26:0;var i=A%26,f=Math.min((A-i)/26,this.length),n=67108863^67108863>>>i<f)for(this.length-=f,o=0;o=0&&(0!==s||o>=c);o--){var d=0|this.words[o];this.words[o]=s<<26-i|d>>>i,s=d&n}return a&&0!==s&&(a.words[a.length++]=s),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(A,e,t){return r(0===this.negative),this.iushrn(A,e,t)},i.prototype.shln=function(A){return this.clone().ishln(A)},i.prototype.ushln=function(A){return this.clone().iushln(A)},i.prototype.shrn=function(A){return this.clone().ishrn(A)},i.prototype.ushrn=function(A){return this.clone().iushrn(A)},i.prototype.testn=function(A){r("number"==typeof A&&A>=0);var e=A%26,t=(A-e)/26,c=1<=0);var e=A%26,t=(A-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=t)return this;if(0!==e&&t++,this.length=Math.min(t,this.length),0!==e){var c=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},i.prototype.isubn=function(A){if(r("number"==typeof A),r(A<67108864),A<0)return this.iaddn(-A);if(0!==this.negative)return this.negative=0,this.iaddn(A),this.negative=1,this;if(this.words[0]-=A,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(a/67108864|0),this.words[c+t]=67108863&i}for(;c>26,this.words[c+t]=67108863&i;if(0===n)return this.strip();for(r(-1===n),n=0,c=0;c>26,this.words[c]=67108863&i;return this.negative=1,this.strip()},i.prototype._wordDiv=function(A,e){var t=(this.length,A.length),r=this.clone(),c=A,f=0|c.words[c.length-1];0!==(t=26-this._countBits(f))&&(c=c.ushln(t),r.iushln(t),f=0|c.words[c.length-1]);var n,a=r.length-c.length;if("mod"!==e){(n=new i(null)).length=a+1,n.words=new Array(n.length);for(var o=0;o=0;d--){var u=67108864*(0|r.words[c.length+d])+(0|r.words[c.length+d-1]);for(u=Math.min(u/f|0,67108863),r._ishlnsubmul(c,u,d);0!==r.negative;)u--,r.negative=0,r._ishlnsubmul(c,1,d),r.isZero()||(r.negative^=1);n&&(n.words[d]=u)}return n&&n.strip(),r.strip(),"div"!==e&&0!==t&&r.iushrn(t),{div:n||null,mod:r}},i.prototype.divmod=function(A,e,t){return r(!A.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===A.negative?(n=this.neg().divmod(A,e),"mod"!==e&&(c=n.div.neg()),"div"!==e&&(f=n.mod.neg(),t&&0!==f.negative&&f.iadd(A)),{div:c,mod:f}):0===this.negative&&0!==A.negative?(n=this.divmod(A.neg(),e),"mod"!==e&&(c=n.div.neg()),{div:c,mod:n.mod}):0!=(this.negative&A.negative)?(n=this.neg().divmod(A.neg(),e),"div"!==e&&(f=n.mod.neg(),t&&0!==f.negative&&f.isub(A)),{div:n.div,mod:f}):A.length>this.length||this.cmp(A)<0?{div:new i(0),mod:this}:1===A.length?"div"===e?{div:this.divn(A.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modn(A.words[0]))}:{div:this.divn(A.words[0]),mod:new i(this.modn(A.words[0]))}:this._wordDiv(A,e);var c,f,n},i.prototype.div=function(A){return this.divmod(A,"div",!1).div},i.prototype.mod=function(A){return this.divmod(A,"mod",!1).mod},i.prototype.umod=function(A){return this.divmod(A,"mod",!0).mod},i.prototype.divRound=function(A){var e=this.divmod(A);if(e.mod.isZero())return e.div;var t=0!==e.div.negative?e.mod.isub(A):e.mod,r=A.ushrn(1),c=A.andln(1),i=t.cmp(r);return i<0||1===c&&0===i?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modn=function(A){r(A<=67108863);for(var e=(1<<26)%A,t=0,c=this.length-1;c>=0;c--)t=(e*t+(0|this.words[c]))%A;return t},i.prototype.idivn=function(A){r(A<=67108863);for(var e=0,t=this.length-1;t>=0;t--){var c=(0|this.words[t])+67108864*e;this.words[t]=c/A|0,e=c%A}return this.strip()},i.prototype.divn=function(A){return this.clone().idivn(A)},i.prototype.egcd=function(A){r(0===A.negative),r(!A.isZero());var e=this,t=A.clone();e=0!==e.negative?e.umod(A):e.clone();for(var c=new i(1),f=new i(0),n=new i(0),a=new i(1),o=0;e.isEven()&&t.isEven();)e.iushrn(1),t.iushrn(1),++o;for(var s=t.clone(),d=e.clone();!e.isZero();){for(var u=0,l=1;0==(e.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(e.iushrn(u);u-- >0;)(c.isOdd()||f.isOdd())&&(c.iadd(s),f.isub(d)),c.iushrn(1),f.iushrn(1);for(var g=0,p=1;0==(t.words[0]&p)&&g<26;++g,p<<=1);if(g>0)for(t.iushrn(g);g-- >0;)(n.isOdd()||a.isOdd())&&(n.iadd(s),a.isub(d)),n.iushrn(1),a.iushrn(1);e.cmp(t)>=0?(e.isub(t),c.isub(n),f.isub(a)):(t.isub(e),n.isub(c),a.isub(f))}return{a:n,b:a,gcd:t.iushln(o)}},i.prototype._invmp=function(A){r(0===A.negative),r(!A.isZero());var e=this,t=A.clone();e=0!==e.negative?e.umod(A):e.clone();for(var c,f=new i(1),n=new i(0),a=t.clone();e.cmpn(1)>0&&t.cmpn(1)>0;){for(var o=0,s=1;0==(e.words[0]&s)&&o<26;++o,s<<=1);if(o>0)for(e.iushrn(o);o-- >0;)f.isOdd()&&f.iadd(a),f.iushrn(1);for(var d=0,u=1;0==(t.words[0]&u)&&d<26;++d,u<<=1);if(d>0)for(t.iushrn(d);d-- >0;)n.isOdd()&&n.iadd(a),n.iushrn(1);e.cmp(t)>=0?(e.isub(t),f.isub(n)):(t.isub(e),n.isub(f))}return(c=0===e.cmpn(1)?f:n).cmpn(0)<0&&c.iadd(A),c},i.prototype.gcd=function(A){if(this.isZero())return A.abs();if(A.isZero())return this.abs();var e=this.clone(),t=A.clone();e.negative=0,t.negative=0;for(var r=0;e.isEven()&&t.isEven();r++)e.iushrn(1),t.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;t.isEven();)t.iushrn(1);var c=e.cmp(t);if(c<0){var i=e;e=t,t=i}else if(0===c||0===t.cmpn(1))break;e.isub(t)}return t.iushln(r)},i.prototype.invm=function(A){return this.egcd(A).a.umod(A)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(A){return this.words[0]&A},i.prototype.bincn=function(A){r("number"==typeof A);var e=A%26,t=(A-e)/26,c=1<>>26,n&=67108863,this.words[f]=n}return 0!==i&&(this.words[f]=i,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(A){var e,t=A<0;if(0!==this.negative&&!t)return-1;if(0===this.negative&&t)return 1;if(this.strip(),this.length>1)e=1;else{t&&(A=-A),r(A<=67108863,"Number is too big");var c=0|this.words[0];e=c===A?0:cA.length)return 1;if(this.length=0;t--){var r=0|this.words[t],c=0|A.words[t];if(r!==c){rc&&(e=1);break}}return e},i.prototype.gtn=function(A){return 1===this.cmpn(A)},i.prototype.gt=function(A){return 1===this.cmp(A)},i.prototype.gten=function(A){return this.cmpn(A)>=0},i.prototype.gte=function(A){return this.cmp(A)>=0},i.prototype.ltn=function(A){return-1===this.cmpn(A)},i.prototype.lt=function(A){return-1===this.cmp(A)},i.prototype.lten=function(A){return this.cmpn(A)<=0},i.prototype.lte=function(A){return this.cmp(A)<=0},i.prototype.eqn=function(A){return 0===this.cmpn(A)},i.prototype.eq=function(A){return 0===this.cmp(A)},i.red=function(A){return new Q(A)},i.prototype.toRed=function(A){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),A.convertTo(this)._forceRed(A)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(A){return this.red=A,this},i.prototype.forceRed=function(A){return r(!this.red,"Already a number in reduction context"),this._forceRed(A)},i.prototype.redAdd=function(A){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,A)},i.prototype.redIAdd=function(A){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,A)},i.prototype.redSub=function(A){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,A)},i.prototype.redISub=function(A){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,A)},i.prototype.redShl=function(A){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,A)},i.prototype.redMul=function(A){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,A),this.red.mul(this,A)},i.prototype.redIMul=function(A){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,A),this.red.imul(this,A)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(A){return r(this.red&&!A.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,A)};var B={k256:null,p224:null,p192:null,p25519:null};function h(A,e){this.name=A,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function I(){h.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){h.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){h.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function C(){h.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Q(A){if("string"==typeof A){var e=i._prime(A);this.m=e.p,this.prime=e}else r(A.gtn(1),"modulus must be greater than 1"),this.m=A,this.prime=null}function y(A){Q.call(this,A),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(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)}h.prototype._tmp=function(){var A=new i(null);return A.words=new Array(Math.ceil(this.n/13)),A},h.prototype.ireduce=function(A){var e,t=A;do{this.split(t,this.tmp),e=(t=(t=this.imulK(t)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e0?t.isub(this.p):void 0!==t.strip?t.strip():t._strip(),t},h.prototype.split=function(A,e){A.iushrn(this.n,0,e)},h.prototype.imulK=function(A){return A.imul(this.k)},c(I,h),I.prototype.split=function(A,e){for(var t=Math.min(A.length,9),r=0;r>>22,c=i}c>>>=22,A.words[r-10]=c,0===c&&A.length>10?A.length-=10:A.length-=9},I.prototype.imulK=function(A){A.words[A.length]=0,A.words[A.length+1]=0,A.length+=2;for(var e=0,t=0;t>>=26,A.words[t]=c,e=r}return 0!==e&&(A.words[A.length++]=e),A},i._prime=function(A){if(B[A])return B[A];var e;if("k256"===A)e=new I;else if("p224"===A)e=new b;else if("p192"===A)e=new E;else{if("p25519"!==A)throw new Error("Unknown prime "+A);e=new C}return B[A]=e,e},Q.prototype._verify1=function(A){r(0===A.negative,"red works only with positives"),r(A.red,"red works only with red numbers")},Q.prototype._verify2=function(A,e){r(0==(A.negative|e.negative),"red works only with positives"),r(A.red&&A.red===e.red,"red works only with red numbers")},Q.prototype.imod=function(A){return this.prime?this.prime.ireduce(A)._forceRed(this):A.umod(this.m)._forceRed(this)},Q.prototype.neg=function(A){return A.isZero()?A.clone():this.m.sub(A)._forceRed(this)},Q.prototype.add=function(A,e){this._verify2(A,e);var t=A.add(e);return t.cmp(this.m)>=0&&t.isub(this.m),t._forceRed(this)},Q.prototype.iadd=function(A,e){this._verify2(A,e);var t=A.iadd(e);return t.cmp(this.m)>=0&&t.isub(this.m),t},Q.prototype.sub=function(A,e){this._verify2(A,e);var t=A.sub(e);return t.cmpn(0)<0&&t.iadd(this.m),t._forceRed(this)},Q.prototype.isub=function(A,e){this._verify2(A,e);var t=A.isub(e);return t.cmpn(0)<0&&t.iadd(this.m),t},Q.prototype.shl=function(A,e){return this._verify1(A),this.imod(A.ushln(e))},Q.prototype.imul=function(A,e){return this._verify2(A,e),this.imod(A.imul(e))},Q.prototype.mul=function(A,e){return this._verify2(A,e),this.imod(A.mul(e))},Q.prototype.isqr=function(A){return this.imul(A,A.clone())},Q.prototype.sqr=function(A){return this.mul(A,A)},Q.prototype.sqrt=function(A){if(A.isZero())return A.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var t=this.m.add(new i(1)).iushrn(2);return this.pow(A,t)}for(var c=this.m.subn(1),f=0;!c.isZero()&&0===c.andln(1);)f++,c.iushrn(1);r(!c.isZero());var n=new i(1).toRed(this),a=n.redNeg(),o=this.m.subn(1).iushrn(1),s=this.m.bitLength();for(s=new i(2*s*s).toRed(this);0!==this.pow(s,o).cmp(a);)s.redIAdd(a);for(var d=this.pow(s,c),u=this.pow(A,c.addn(1).iushrn(1)),l=this.pow(A,c),g=f;0!==l.cmp(n);){for(var p=l,B=0;0!==p.cmp(n);B++)p=p.redSqr();r(B=0;r--){for(var o=e.words[r],s=a-1;s>=0;s--){var d=o>>s&1;c!==t[0]&&(c=this.sqr(c)),0!==d||0!==f?(f<<=1,f|=d,(4===++n||0===r&&0===s)&&(c=this.mul(c,t[f]),n=0,f=0)):n=0}a=26}return c},Q.prototype.convertTo=function(A){var e=A.umod(this.m);return e===A?e.clone():e},Q.prototype.convertFrom=function(A){var e=A.clone();return e.red=null,e},i.mont=function(A){return new y(A)},c(y,Q),y.prototype.convertTo=function(A){return this.imod(A.ushln(this.shift))},y.prototype.convertFrom=function(A){var e=this.imod(A.mul(this.rinv));return e.red=null,e},y.prototype.imul=function(A,e){if(A.isZero()||e.isZero())return A.words[0]=0,A.length=1,A;var t=A.imul(e),r=t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),c=t.isub(r).iushrn(this.shift),i=c;return c.cmp(this.m)>=0?i=c.isub(this.m):c.cmpn(0)<0&&(i=c.iadd(this.m)),i._forceRed(this)},y.prototype.mul=function(A,e){if(A.isZero()||e.isZero())return new i(0)._forceRed(this);var t=A.mul(e),r=t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),c=t.isub(r).iushrn(this.shift),f=c;return c.cmp(this.m)>=0?f=c.isub(this.m):c.cmpn(0)<0&&(f=c.iadd(this.m)),f._forceRed(this)},y.prototype.invm=function(A){return this.imod(A._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)},{buffer:19}],16:[function(A,e,t){"use strict";t.byteLength=function(A){var e=o(A),t=e[0],r=e[1];return 3*(t+r)/4-r},t.toByteArray=function(A){var e,t,r=o(A),f=r[0],n=r[1],a=new i(function(A,e,t){return 3*(e+t)/4-t}(0,f,n)),s=0,d=n>0?f-4:f;for(t=0;t>16&255,a[s++]=e>>8&255,a[s++]=255&e;2===n&&(e=c[A.charCodeAt(t)]<<2|c[A.charCodeAt(t+1)]>>4,a[s++]=255&e);1===n&&(e=c[A.charCodeAt(t)]<<10|c[A.charCodeAt(t+1)]<<4|c[A.charCodeAt(t+2)]>>2,a[s++]=e>>8&255,a[s++]=255&e);return a},t.fromByteArray=function(A){for(var e,t=A.length,c=t%3,i=[],f=0,n=t-c;fn?n:f+16383));1===c?(e=A[t-1],i.push(r[e>>2]+r[e<<4&63]+"==")):2===c&&(e=(A[t-2]<<8)+A[t-1],i.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"="));return i.join("")};for(var r=[],c=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=0,a=f.length;n0)throw new Error("Invalid string. Length must be a multiple of 4");var t=A.indexOf("=");return-1===t&&(t=e),[t,t===e?0:4-t%4]}function s(A,e,t){for(var c,i,f=[],n=e;n>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return f.join("")}c["-".charCodeAt(0)]=62,c["_".charCodeAt(0)]=63},{}],17:[function(A,e,t){!function(e,t){"use strict";function r(A,e){if(!A)throw new Error(e||"Assertion failed")}function c(A,e){A.super_=e;var t=function(){};t.prototype=e.prototype,A.prototype=new t,A.prototype.constructor=A}function i(A,e,t){if(i.isBN(A))return A;this.negative=0,this.words=null,this.length=0,this.red=null,null!==A&&("le"!==e&&"be"!==e||(t=e,e=10),this._init(A||0,e||10,t||"be"))}var f;"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;try{f=A("buffer").Buffer}catch(A){}function n(A,e,t){for(var c=0,i=Math.min(A.length,t),f=0,n=e;n=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:o,f|=a}return r(!(240&f),"Invalid character in "+A),c}function a(A,e,t,c){for(var i=0,f=0,n=Math.min(A.length,t),a=e;a=49?o-49+10:o>=17?o-17+10:o,r(o>=0&&f0?A:e},i.min=function(A,e){return A.cmp(e)<0?A:e},i.prototype._init=function(A,e,t){if("number"==typeof A)return this._initNumber(A,e,t);if("object"==typeof A)return this._initArray(A,e,t);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var c=0;"-"===(A=A.toString().replace(/\s+/g,""))[0]&&c++,16===e?this._parseHex(A,c):this._parseBase(A,e,c),"-"===A[0]&&(this.negative=1),this._strip(),"le"===t&&this._initArray(this.toArray(),e,t)},i.prototype._initNumber=function(A,e,t){A<0&&(this.negative=1,A=-A),A<67108864?(this.words=[67108863&A],this.length=1):A<4503599627370496?(this.words=[67108863&A,A/67108864&67108863],this.length=2):(r(A<9007199254740992),this.words=[67108863&A,A/67108864&67108863,1],this.length=3),"le"===t&&this._initArray(this.toArray(),e,t)},i.prototype._initArray=function(A,e,t){if(r("number"==typeof A.length),A.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(A.length/3),this.words=new Array(this.length);for(var c=0;c=0;c-=3)f=A[c]|A[c-1]<<8|A[c-2]<<16,this.words[i]|=f<>>26-n&67108863,(n+=24)>=26&&(n-=26,i++);else if("le"===t)for(c=0,i=0;c>>26-n&67108863,(n+=24)>=26&&(n-=26,i++);return this._strip()},i.prototype._parseHex=function(A,e){this.length=Math.ceil((A.length-e)/6),this.words=new Array(this.length);for(var t=0;t=e;t-=6)c=n(A,t,t+6),this.words[r]|=c<>>26-i&4194303,(i+=24)>=26&&(i-=26,r++);t+6!==e&&(c=n(A,e,t+6),this.words[r]|=c<>>26-i&4194303),this._strip()},i.prototype._parseBase=function(A,e,t){this.words=[0],this.length=1;for(var r=0,c=1;c<=67108863;c*=e)r++;r--,c=c/e|0;for(var i=A.length-t,f=i%r,n=Math.min(i,i-f)+t,o=0,s=t;s1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=s}catch(A){i.prototype.inspect=s}else i.prototype.inspect=s;function s(){return(this.red?""}var d=["","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"],u=[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],l=[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];i.prototype.toString=function(A,e){var t;if(e=0|e||1,16===(A=A||10)||"hex"===A){t="";for(var c=0,i=0,f=0;f>>24-c&16777215)||f!==this.length-1?d[6-a.length]+a+t:a+t,(c+=2)>=26&&(c-=26,f--)}for(0!==i&&(t=i.toString(16)+t);t.length%e!=0;)t="0"+t;return 0!==this.negative&&(t="-"+t),t}if(A===(0|A)&&A>=2&&A<=36){var o=u[A],s=l[A];t="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modrn(s).toString(A);t=(g=g.idivn(s)).isZero()?p+t:d[o-p.length]+p+t}for(this.isZero()&&(t="0"+t);t.length%e!=0;)t="0"+t;return 0!==this.negative&&(t="-"+t),t}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var A=this.words[0];return 2===this.length?A+=67108864*this.words[1]:3===this.length&&1===this.words[2]?A+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-A:A},i.prototype.toJSON=function(){return this.toString(16,2)},f&&(i.prototype.toBuffer=function(A,e){return this.toArrayLike(f,A,e)}),i.prototype.toArray=function(A,e){return this.toArrayLike(Array,A,e)};function g(A,e,t){t.negative=e.negative^A.negative;var r=A.length+e.length|0;t.length=r,r=r-1|0;var c=0|A.words[0],i=0|e.words[0],f=c*i,n=67108863&f,a=f/67108864|0;t.words[0]=n;for(var o=1;o>>26,d=67108863&a,u=Math.min(o,e.length-1),l=Math.max(0,o-A.length+1);l<=u;l++){var g=o-l|0;s+=(f=(c=0|A.words[g])*(i=0|e.words[l])+d)/67108864|0,d=67108863&f}t.words[o]=0|d,a=0|s}return 0!==a?t.words[o]=0|a:t.length--,t._strip()}i.prototype.toArrayLike=function(A,e,t){this._strip();var c=this.byteLength(),i=t||Math.max(1,c);r(c<=i,"byte array longer than desired length"),r(i>0,"Requested array length <= 0");var f=function(A,e){return A.allocUnsafe?A.allocUnsafe(e):new A(e)}(A,i);return this["_toArrayLike"+("le"===e?"LE":"BE")](f,c),f},i.prototype._toArrayLikeLE=function(A,e){for(var t=0,r=0,c=0,i=0;c>8&255),t>16&255),6===i?(t>24&255),r=0,i=0):(r=f>>>24,i+=2)}if(t=0&&(A[t--]=f>>8&255),t>=0&&(A[t--]=f>>16&255),6===i?(t>=0&&(A[t--]=f>>24&255),r=0,i=0):(r=f>>>24,i+=2)}if(t>=0)for(A[t--]=r;t>=0;)A[t--]=0},Math.clz32?i.prototype._countBits=function(A){return 32-Math.clz32(A)}:i.prototype._countBits=function(A){var e=A,t=0;return e>=4096&&(t+=13,e>>>=13),e>=64&&(t+=7,e>>>=7),e>=8&&(t+=4,e>>>=4),e>=2&&(t+=2,e>>>=2),t+e},i.prototype._zeroBits=function(A){if(0===A)return 26;var e=A,t=0;return 0==(8191&e)&&(t+=13,e>>>=13),0==(127&e)&&(t+=7,e>>>=7),0==(15&e)&&(t+=4,e>>>=4),0==(3&e)&&(t+=2,e>>>=2),0==(1&e)&&t++,t},i.prototype.bitLength=function(){var A=this.words[this.length-1],e=this._countBits(A);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var A=0,e=0;eA.length?this.clone().ior(A):A.clone().ior(this)},i.prototype.uor=function(A){return this.length>A.length?this.clone().iuor(A):A.clone().iuor(this)},i.prototype.iuand=function(A){var e;e=this.length>A.length?A:this;for(var t=0;tA.length?this.clone().iand(A):A.clone().iand(this)},i.prototype.uand=function(A){return this.length>A.length?this.clone().iuand(A):A.clone().iuand(this)},i.prototype.iuxor=function(A){var e,t;this.length>A.length?(e=this,t=A):(e=A,t=this);for(var r=0;rA.length?this.clone().ixor(A):A.clone().ixor(this)},i.prototype.uxor=function(A){return this.length>A.length?this.clone().iuxor(A):A.clone().iuxor(this)},i.prototype.inotn=function(A){r("number"==typeof A&&A>=0);var e=0|Math.ceil(A/26),t=A%26;this._expand(e),t>0&&e--;for(var c=0;c0&&(this.words[c]=~this.words[c]&67108863>>26-t),this._strip()},i.prototype.notn=function(A){return this.clone().inotn(A)},i.prototype.setn=function(A,e){r("number"==typeof A&&A>=0);var t=A/26|0,c=A%26;return this._expand(t+1),this.words[t]=e?this.words[t]|1<A.length?(t=this,r=A):(t=A,r=this);for(var c=0,i=0;i>>26;for(;0!==c&&i>>26;if(this.length=t.length,0!==c)this.words[this.length]=c,this.length++;else if(t!==this)for(;iA.length?this.clone().iadd(A):A.clone().iadd(this)},i.prototype.isub=function(A){if(0!==A.negative){A.negative=0;var e=this.iadd(A);return A.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(A),this.negative=1,this._normSign();var t,r,c=this.cmp(A);if(0===c)return this.negative=0,this.length=1,this.words[0]=0,this;c>0?(t=this,r=A):(t=A,r=this);for(var i=0,f=0;f>26,this.words[f]=67108863&e;for(;0!==i&&f>26,this.words[f]=67108863&e;if(0===i&&f>>13,l=0|f[1],g=8191&l,p=l>>>13,B=0|f[2],h=8191&B,I=B>>>13,b=0|f[3],E=8191&b,C=b>>>13,Q=0|f[4],y=8191&Q,w=Q>>>13,m=0|f[5],S=8191&m,D=m>>>13,M=0|f[6],v=8191&M,k=M>>>13,O=0|f[7],N=8191&O,G=O>>>13,F=0|f[8],U=8191&F,x=F>>>13,j=0|f[9],Y=8191&j,_=j>>>13,L=0|n[0],R=8191&L,H=L>>>13,P=0|n[1],J=8191&P,K=P>>>13,q=0|n[2],T=8191&q,V=q>>>13,Z=0|n[3],z=8191&Z,W=Z>>>13,X=0|n[4],$=8191&X,AA=X>>>13,eA=0|n[5],tA=8191&eA,rA=eA>>>13,cA=0|n[6],iA=8191&cA,fA=cA>>>13,nA=0|n[7],aA=8191&nA,oA=nA>>>13,sA=0|n[8],dA=8191&sA,uA=sA>>>13,lA=0|n[9],gA=8191&lA,pA=lA>>>13;t.negative=A.negative^e.negative,t.length=19;var BA=(o+(r=Math.imul(d,R))|0)+((8191&(c=(c=Math.imul(d,H))+Math.imul(u,R)|0))<<13)|0;o=((i=Math.imul(u,H))+(c>>>13)|0)+(BA>>>26)|0,BA&=67108863,r=Math.imul(g,R),c=(c=Math.imul(g,H))+Math.imul(p,R)|0,i=Math.imul(p,H);var hA=(o+(r=r+Math.imul(d,J)|0)|0)+((8191&(c=(c=c+Math.imul(d,K)|0)+Math.imul(u,J)|0))<<13)|0;o=((i=i+Math.imul(u,K)|0)+(c>>>13)|0)+(hA>>>26)|0,hA&=67108863,r=Math.imul(h,R),c=(c=Math.imul(h,H))+Math.imul(I,R)|0,i=Math.imul(I,H),r=r+Math.imul(g,J)|0,c=(c=c+Math.imul(g,K)|0)+Math.imul(p,J)|0,i=i+Math.imul(p,K)|0;var IA=(o+(r=r+Math.imul(d,T)|0)|0)+((8191&(c=(c=c+Math.imul(d,V)|0)+Math.imul(u,T)|0))<<13)|0;o=((i=i+Math.imul(u,V)|0)+(c>>>13)|0)+(IA>>>26)|0,IA&=67108863,r=Math.imul(E,R),c=(c=Math.imul(E,H))+Math.imul(C,R)|0,i=Math.imul(C,H),r=r+Math.imul(h,J)|0,c=(c=c+Math.imul(h,K)|0)+Math.imul(I,J)|0,i=i+Math.imul(I,K)|0,r=r+Math.imul(g,T)|0,c=(c=c+Math.imul(g,V)|0)+Math.imul(p,T)|0,i=i+Math.imul(p,V)|0;var bA=(o+(r=r+Math.imul(d,z)|0)|0)+((8191&(c=(c=c+Math.imul(d,W)|0)+Math.imul(u,z)|0))<<13)|0;o=((i=i+Math.imul(u,W)|0)+(c>>>13)|0)+(bA>>>26)|0,bA&=67108863,r=Math.imul(y,R),c=(c=Math.imul(y,H))+Math.imul(w,R)|0,i=Math.imul(w,H),r=r+Math.imul(E,J)|0,c=(c=c+Math.imul(E,K)|0)+Math.imul(C,J)|0,i=i+Math.imul(C,K)|0,r=r+Math.imul(h,T)|0,c=(c=c+Math.imul(h,V)|0)+Math.imul(I,T)|0,i=i+Math.imul(I,V)|0,r=r+Math.imul(g,z)|0,c=(c=c+Math.imul(g,W)|0)+Math.imul(p,z)|0,i=i+Math.imul(p,W)|0;var EA=(o+(r=r+Math.imul(d,$)|0)|0)+((8191&(c=(c=c+Math.imul(d,AA)|0)+Math.imul(u,$)|0))<<13)|0;o=((i=i+Math.imul(u,AA)|0)+(c>>>13)|0)+(EA>>>26)|0,EA&=67108863,r=Math.imul(S,R),c=(c=Math.imul(S,H))+Math.imul(D,R)|0,i=Math.imul(D,H),r=r+Math.imul(y,J)|0,c=(c=c+Math.imul(y,K)|0)+Math.imul(w,J)|0,i=i+Math.imul(w,K)|0,r=r+Math.imul(E,T)|0,c=(c=c+Math.imul(E,V)|0)+Math.imul(C,T)|0,i=i+Math.imul(C,V)|0,r=r+Math.imul(h,z)|0,c=(c=c+Math.imul(h,W)|0)+Math.imul(I,z)|0,i=i+Math.imul(I,W)|0,r=r+Math.imul(g,$)|0,c=(c=c+Math.imul(g,AA)|0)+Math.imul(p,$)|0,i=i+Math.imul(p,AA)|0;var CA=(o+(r=r+Math.imul(d,tA)|0)|0)+((8191&(c=(c=c+Math.imul(d,rA)|0)+Math.imul(u,tA)|0))<<13)|0;o=((i=i+Math.imul(u,rA)|0)+(c>>>13)|0)+(CA>>>26)|0,CA&=67108863,r=Math.imul(v,R),c=(c=Math.imul(v,H))+Math.imul(k,R)|0,i=Math.imul(k,H),r=r+Math.imul(S,J)|0,c=(c=c+Math.imul(S,K)|0)+Math.imul(D,J)|0,i=i+Math.imul(D,K)|0,r=r+Math.imul(y,T)|0,c=(c=c+Math.imul(y,V)|0)+Math.imul(w,T)|0,i=i+Math.imul(w,V)|0,r=r+Math.imul(E,z)|0,c=(c=c+Math.imul(E,W)|0)+Math.imul(C,z)|0,i=i+Math.imul(C,W)|0,r=r+Math.imul(h,$)|0,c=(c=c+Math.imul(h,AA)|0)+Math.imul(I,$)|0,i=i+Math.imul(I,AA)|0,r=r+Math.imul(g,tA)|0,c=(c=c+Math.imul(g,rA)|0)+Math.imul(p,tA)|0,i=i+Math.imul(p,rA)|0;var QA=(o+(r=r+Math.imul(d,iA)|0)|0)+((8191&(c=(c=c+Math.imul(d,fA)|0)+Math.imul(u,iA)|0))<<13)|0;o=((i=i+Math.imul(u,fA)|0)+(c>>>13)|0)+(QA>>>26)|0,QA&=67108863,r=Math.imul(N,R),c=(c=Math.imul(N,H))+Math.imul(G,R)|0,i=Math.imul(G,H),r=r+Math.imul(v,J)|0,c=(c=c+Math.imul(v,K)|0)+Math.imul(k,J)|0,i=i+Math.imul(k,K)|0,r=r+Math.imul(S,T)|0,c=(c=c+Math.imul(S,V)|0)+Math.imul(D,T)|0,i=i+Math.imul(D,V)|0,r=r+Math.imul(y,z)|0,c=(c=c+Math.imul(y,W)|0)+Math.imul(w,z)|0,i=i+Math.imul(w,W)|0,r=r+Math.imul(E,$)|0,c=(c=c+Math.imul(E,AA)|0)+Math.imul(C,$)|0,i=i+Math.imul(C,AA)|0,r=r+Math.imul(h,tA)|0,c=(c=c+Math.imul(h,rA)|0)+Math.imul(I,tA)|0,i=i+Math.imul(I,rA)|0,r=r+Math.imul(g,iA)|0,c=(c=c+Math.imul(g,fA)|0)+Math.imul(p,iA)|0,i=i+Math.imul(p,fA)|0;var yA=(o+(r=r+Math.imul(d,aA)|0)|0)+((8191&(c=(c=c+Math.imul(d,oA)|0)+Math.imul(u,aA)|0))<<13)|0;o=((i=i+Math.imul(u,oA)|0)+(c>>>13)|0)+(yA>>>26)|0,yA&=67108863,r=Math.imul(U,R),c=(c=Math.imul(U,H))+Math.imul(x,R)|0,i=Math.imul(x,H),r=r+Math.imul(N,J)|0,c=(c=c+Math.imul(N,K)|0)+Math.imul(G,J)|0,i=i+Math.imul(G,K)|0,r=r+Math.imul(v,T)|0,c=(c=c+Math.imul(v,V)|0)+Math.imul(k,T)|0,i=i+Math.imul(k,V)|0,r=r+Math.imul(S,z)|0,c=(c=c+Math.imul(S,W)|0)+Math.imul(D,z)|0,i=i+Math.imul(D,W)|0,r=r+Math.imul(y,$)|0,c=(c=c+Math.imul(y,AA)|0)+Math.imul(w,$)|0,i=i+Math.imul(w,AA)|0,r=r+Math.imul(E,tA)|0,c=(c=c+Math.imul(E,rA)|0)+Math.imul(C,tA)|0,i=i+Math.imul(C,rA)|0,r=r+Math.imul(h,iA)|0,c=(c=c+Math.imul(h,fA)|0)+Math.imul(I,iA)|0,i=i+Math.imul(I,fA)|0,r=r+Math.imul(g,aA)|0,c=(c=c+Math.imul(g,oA)|0)+Math.imul(p,aA)|0,i=i+Math.imul(p,oA)|0;var wA=(o+(r=r+Math.imul(d,dA)|0)|0)+((8191&(c=(c=c+Math.imul(d,uA)|0)+Math.imul(u,dA)|0))<<13)|0;o=((i=i+Math.imul(u,uA)|0)+(c>>>13)|0)+(wA>>>26)|0,wA&=67108863,r=Math.imul(Y,R),c=(c=Math.imul(Y,H))+Math.imul(_,R)|0,i=Math.imul(_,H),r=r+Math.imul(U,J)|0,c=(c=c+Math.imul(U,K)|0)+Math.imul(x,J)|0,i=i+Math.imul(x,K)|0,r=r+Math.imul(N,T)|0,c=(c=c+Math.imul(N,V)|0)+Math.imul(G,T)|0,i=i+Math.imul(G,V)|0,r=r+Math.imul(v,z)|0,c=(c=c+Math.imul(v,W)|0)+Math.imul(k,z)|0,i=i+Math.imul(k,W)|0,r=r+Math.imul(S,$)|0,c=(c=c+Math.imul(S,AA)|0)+Math.imul(D,$)|0,i=i+Math.imul(D,AA)|0,r=r+Math.imul(y,tA)|0,c=(c=c+Math.imul(y,rA)|0)+Math.imul(w,tA)|0,i=i+Math.imul(w,rA)|0,r=r+Math.imul(E,iA)|0,c=(c=c+Math.imul(E,fA)|0)+Math.imul(C,iA)|0,i=i+Math.imul(C,fA)|0,r=r+Math.imul(h,aA)|0,c=(c=c+Math.imul(h,oA)|0)+Math.imul(I,aA)|0,i=i+Math.imul(I,oA)|0,r=r+Math.imul(g,dA)|0,c=(c=c+Math.imul(g,uA)|0)+Math.imul(p,dA)|0,i=i+Math.imul(p,uA)|0;var mA=(o+(r=r+Math.imul(d,gA)|0)|0)+((8191&(c=(c=c+Math.imul(d,pA)|0)+Math.imul(u,gA)|0))<<13)|0;o=((i=i+Math.imul(u,pA)|0)+(c>>>13)|0)+(mA>>>26)|0,mA&=67108863,r=Math.imul(Y,J),c=(c=Math.imul(Y,K))+Math.imul(_,J)|0,i=Math.imul(_,K),r=r+Math.imul(U,T)|0,c=(c=c+Math.imul(U,V)|0)+Math.imul(x,T)|0,i=i+Math.imul(x,V)|0,r=r+Math.imul(N,z)|0,c=(c=c+Math.imul(N,W)|0)+Math.imul(G,z)|0,i=i+Math.imul(G,W)|0,r=r+Math.imul(v,$)|0,c=(c=c+Math.imul(v,AA)|0)+Math.imul(k,$)|0,i=i+Math.imul(k,AA)|0,r=r+Math.imul(S,tA)|0,c=(c=c+Math.imul(S,rA)|0)+Math.imul(D,tA)|0,i=i+Math.imul(D,rA)|0,r=r+Math.imul(y,iA)|0,c=(c=c+Math.imul(y,fA)|0)+Math.imul(w,iA)|0,i=i+Math.imul(w,fA)|0,r=r+Math.imul(E,aA)|0,c=(c=c+Math.imul(E,oA)|0)+Math.imul(C,aA)|0,i=i+Math.imul(C,oA)|0,r=r+Math.imul(h,dA)|0,c=(c=c+Math.imul(h,uA)|0)+Math.imul(I,dA)|0,i=i+Math.imul(I,uA)|0;var SA=(o+(r=r+Math.imul(g,gA)|0)|0)+((8191&(c=(c=c+Math.imul(g,pA)|0)+Math.imul(p,gA)|0))<<13)|0;o=((i=i+Math.imul(p,pA)|0)+(c>>>13)|0)+(SA>>>26)|0,SA&=67108863,r=Math.imul(Y,T),c=(c=Math.imul(Y,V))+Math.imul(_,T)|0,i=Math.imul(_,V),r=r+Math.imul(U,z)|0,c=(c=c+Math.imul(U,W)|0)+Math.imul(x,z)|0,i=i+Math.imul(x,W)|0,r=r+Math.imul(N,$)|0,c=(c=c+Math.imul(N,AA)|0)+Math.imul(G,$)|0,i=i+Math.imul(G,AA)|0,r=r+Math.imul(v,tA)|0,c=(c=c+Math.imul(v,rA)|0)+Math.imul(k,tA)|0,i=i+Math.imul(k,rA)|0,r=r+Math.imul(S,iA)|0,c=(c=c+Math.imul(S,fA)|0)+Math.imul(D,iA)|0,i=i+Math.imul(D,fA)|0,r=r+Math.imul(y,aA)|0,c=(c=c+Math.imul(y,oA)|0)+Math.imul(w,aA)|0,i=i+Math.imul(w,oA)|0,r=r+Math.imul(E,dA)|0,c=(c=c+Math.imul(E,uA)|0)+Math.imul(C,dA)|0,i=i+Math.imul(C,uA)|0;var DA=(o+(r=r+Math.imul(h,gA)|0)|0)+((8191&(c=(c=c+Math.imul(h,pA)|0)+Math.imul(I,gA)|0))<<13)|0;o=((i=i+Math.imul(I,pA)|0)+(c>>>13)|0)+(DA>>>26)|0,DA&=67108863,r=Math.imul(Y,z),c=(c=Math.imul(Y,W))+Math.imul(_,z)|0,i=Math.imul(_,W),r=r+Math.imul(U,$)|0,c=(c=c+Math.imul(U,AA)|0)+Math.imul(x,$)|0,i=i+Math.imul(x,AA)|0,r=r+Math.imul(N,tA)|0,c=(c=c+Math.imul(N,rA)|0)+Math.imul(G,tA)|0,i=i+Math.imul(G,rA)|0,r=r+Math.imul(v,iA)|0,c=(c=c+Math.imul(v,fA)|0)+Math.imul(k,iA)|0,i=i+Math.imul(k,fA)|0,r=r+Math.imul(S,aA)|0,c=(c=c+Math.imul(S,oA)|0)+Math.imul(D,aA)|0,i=i+Math.imul(D,oA)|0,r=r+Math.imul(y,dA)|0,c=(c=c+Math.imul(y,uA)|0)+Math.imul(w,dA)|0,i=i+Math.imul(w,uA)|0;var MA=(o+(r=r+Math.imul(E,gA)|0)|0)+((8191&(c=(c=c+Math.imul(E,pA)|0)+Math.imul(C,gA)|0))<<13)|0;o=((i=i+Math.imul(C,pA)|0)+(c>>>13)|0)+(MA>>>26)|0,MA&=67108863,r=Math.imul(Y,$),c=(c=Math.imul(Y,AA))+Math.imul(_,$)|0,i=Math.imul(_,AA),r=r+Math.imul(U,tA)|0,c=(c=c+Math.imul(U,rA)|0)+Math.imul(x,tA)|0,i=i+Math.imul(x,rA)|0,r=r+Math.imul(N,iA)|0,c=(c=c+Math.imul(N,fA)|0)+Math.imul(G,iA)|0,i=i+Math.imul(G,fA)|0,r=r+Math.imul(v,aA)|0,c=(c=c+Math.imul(v,oA)|0)+Math.imul(k,aA)|0,i=i+Math.imul(k,oA)|0,r=r+Math.imul(S,dA)|0,c=(c=c+Math.imul(S,uA)|0)+Math.imul(D,dA)|0,i=i+Math.imul(D,uA)|0;var vA=(o+(r=r+Math.imul(y,gA)|0)|0)+((8191&(c=(c=c+Math.imul(y,pA)|0)+Math.imul(w,gA)|0))<<13)|0;o=((i=i+Math.imul(w,pA)|0)+(c>>>13)|0)+(vA>>>26)|0,vA&=67108863,r=Math.imul(Y,tA),c=(c=Math.imul(Y,rA))+Math.imul(_,tA)|0,i=Math.imul(_,rA),r=r+Math.imul(U,iA)|0,c=(c=c+Math.imul(U,fA)|0)+Math.imul(x,iA)|0,i=i+Math.imul(x,fA)|0,r=r+Math.imul(N,aA)|0,c=(c=c+Math.imul(N,oA)|0)+Math.imul(G,aA)|0,i=i+Math.imul(G,oA)|0,r=r+Math.imul(v,dA)|0,c=(c=c+Math.imul(v,uA)|0)+Math.imul(k,dA)|0,i=i+Math.imul(k,uA)|0;var kA=(o+(r=r+Math.imul(S,gA)|0)|0)+((8191&(c=(c=c+Math.imul(S,pA)|0)+Math.imul(D,gA)|0))<<13)|0;o=((i=i+Math.imul(D,pA)|0)+(c>>>13)|0)+(kA>>>26)|0,kA&=67108863,r=Math.imul(Y,iA),c=(c=Math.imul(Y,fA))+Math.imul(_,iA)|0,i=Math.imul(_,fA),r=r+Math.imul(U,aA)|0,c=(c=c+Math.imul(U,oA)|0)+Math.imul(x,aA)|0,i=i+Math.imul(x,oA)|0,r=r+Math.imul(N,dA)|0,c=(c=c+Math.imul(N,uA)|0)+Math.imul(G,dA)|0,i=i+Math.imul(G,uA)|0;var OA=(o+(r=r+Math.imul(v,gA)|0)|0)+((8191&(c=(c=c+Math.imul(v,pA)|0)+Math.imul(k,gA)|0))<<13)|0;o=((i=i+Math.imul(k,pA)|0)+(c>>>13)|0)+(OA>>>26)|0,OA&=67108863,r=Math.imul(Y,aA),c=(c=Math.imul(Y,oA))+Math.imul(_,aA)|0,i=Math.imul(_,oA),r=r+Math.imul(U,dA)|0,c=(c=c+Math.imul(U,uA)|0)+Math.imul(x,dA)|0,i=i+Math.imul(x,uA)|0;var NA=(o+(r=r+Math.imul(N,gA)|0)|0)+((8191&(c=(c=c+Math.imul(N,pA)|0)+Math.imul(G,gA)|0))<<13)|0;o=((i=i+Math.imul(G,pA)|0)+(c>>>13)|0)+(NA>>>26)|0,NA&=67108863,r=Math.imul(Y,dA),c=(c=Math.imul(Y,uA))+Math.imul(_,dA)|0,i=Math.imul(_,uA);var GA=(o+(r=r+Math.imul(U,gA)|0)|0)+((8191&(c=(c=c+Math.imul(U,pA)|0)+Math.imul(x,gA)|0))<<13)|0;o=((i=i+Math.imul(x,pA)|0)+(c>>>13)|0)+(GA>>>26)|0,GA&=67108863;var FA=(o+(r=Math.imul(Y,gA))|0)+((8191&(c=(c=Math.imul(Y,pA))+Math.imul(_,gA)|0))<<13)|0;return o=((i=Math.imul(_,pA))+(c>>>13)|0)+(FA>>>26)|0,FA&=67108863,a[0]=BA,a[1]=hA,a[2]=IA,a[3]=bA,a[4]=EA,a[5]=CA,a[6]=QA,a[7]=yA,a[8]=wA,a[9]=mA,a[10]=SA,a[11]=DA,a[12]=MA,a[13]=vA,a[14]=kA,a[15]=OA,a[16]=NA,a[17]=GA,a[18]=FA,0!==o&&(a[19]=o,t.length++),t};function B(A,e,t){t.negative=e.negative^A.negative,t.length=A.length+e.length;for(var r=0,c=0,i=0;i>>26)|0)>>>26,f&=67108863}t.words[i]=n,r=f,f=c}return 0!==r?t.words[i]=r:t.length--,t._strip()}function h(A,e,t){return B(A,e,t)}function I(A,e){this.x=A,this.y=e}Math.imul||(p=g),i.prototype.mulTo=function(A,e){var t=this.length+A.length;return 10===this.length&&10===A.length?p(this,A,e):t<63?g(this,A,e):t<1024?B(this,A,e):h(this,A,e)},I.prototype.makeRBT=function(A){for(var e=new Array(A),t=i.prototype._countBits(A)-1,r=0;r>=1;return r},I.prototype.permute=function(A,e,t,r,c,i){for(var f=0;f>>=1)c++;return 1<>>=13,t[2*f+1]=8191&i,i>>>=13;for(f=2*e;f>=26,t+=i/67108864|0,t+=f>>>26,this.words[c]=67108863&f}return 0!==t&&(this.words[c]=t,this.length++),e?this.ineg():this},i.prototype.muln=function(A){return this.clone().imuln(A)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(A){var e=function(A){for(var e=new Array(A.bitLength()),t=0;t>>c&1}return e}(A);if(0===e.length)return new i(1);for(var t=this,r=0;r=0);var e,t=A%26,c=(A-t)/26,i=67108863>>>26-t<<26-t;if(0!==t){var f=0;for(e=0;e>>26-t}f&&(this.words[e]=f,this.length++)}if(0!==c){for(e=this.length-1;e>=0;e--)this.words[e+c]=this.words[e];for(e=0;e=0),c=e?(e-e%26)/26:0;var i=A%26,f=Math.min((A-i)/26,this.length),n=67108863^67108863>>>i<f)for(this.length-=f,o=0;o=0&&(0!==s||o>=c);o--){var d=0|this.words[o];this.words[o]=s<<26-i|d>>>i,s=d&n}return a&&0!==s&&(a.words[a.length++]=s),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(A,e,t){return r(0===this.negative),this.iushrn(A,e,t)},i.prototype.shln=function(A){return this.clone().ishln(A)},i.prototype.ushln=function(A){return this.clone().iushln(A)},i.prototype.shrn=function(A){return this.clone().ishrn(A)},i.prototype.ushrn=function(A){return this.clone().iushrn(A)},i.prototype.testn=function(A){r("number"==typeof A&&A>=0);var e=A%26,t=(A-e)/26,c=1<=0);var e=A%26,t=(A-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=t)return this;if(0!==e&&t++,this.length=Math.min(t,this.length),0!==e){var c=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},i.prototype.isubn=function(A){if(r("number"==typeof A),r(A<67108864),A<0)return this.iaddn(-A);if(0!==this.negative)return this.negative=0,this.iaddn(A),this.negative=1,this;if(this.words[0]-=A,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(a/67108864|0),this.words[c+t]=67108863&i}for(;c>26,this.words[c+t]=67108863&i;if(0===n)return this._strip();for(r(-1===n),n=0,c=0;c>26,this.words[c]=67108863&i;return this.negative=1,this._strip()},i.prototype._wordDiv=function(A,e){var t=(this.length,A.length),r=this.clone(),c=A,f=0|c.words[c.length-1];0!==(t=26-this._countBits(f))&&(c=c.ushln(t),r.iushln(t),f=0|c.words[c.length-1]);var n,a=r.length-c.length;if("mod"!==e){(n=new i(null)).length=a+1,n.words=new Array(n.length);for(var o=0;o=0;d--){var u=67108864*(0|r.words[c.length+d])+(0|r.words[c.length+d-1]);for(u=Math.min(u/f|0,67108863),r._ishlnsubmul(c,u,d);0!==r.negative;)u--,r.negative=0,r._ishlnsubmul(c,1,d),r.isZero()||(r.negative^=1);n&&(n.words[d]=u)}return n&&n._strip(),r._strip(),"div"!==e&&0!==t&&r.iushrn(t),{div:n||null,mod:r}},i.prototype.divmod=function(A,e,t){return r(!A.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===A.negative?(n=this.neg().divmod(A,e),"mod"!==e&&(c=n.div.neg()),"div"!==e&&(f=n.mod.neg(),t&&0!==f.negative&&f.iadd(A)),{div:c,mod:f}):0===this.negative&&0!==A.negative?(n=this.divmod(A.neg(),e),"mod"!==e&&(c=n.div.neg()),{div:c,mod:n.mod}):0!=(this.negative&A.negative)?(n=this.neg().divmod(A.neg(),e),"div"!==e&&(f=n.mod.neg(),t&&0!==f.negative&&f.isub(A)),{div:n.div,mod:f}):A.length>this.length||this.cmp(A)<0?{div:new i(0),mod:this}:1===A.length?"div"===e?{div:this.divn(A.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modrn(A.words[0]))}:{div:this.divn(A.words[0]),mod:new i(this.modrn(A.words[0]))}:this._wordDiv(A,e);var c,f,n},i.prototype.div=function(A){return this.divmod(A,"div",!1).div},i.prototype.mod=function(A){return this.divmod(A,"mod",!1).mod},i.prototype.umod=function(A){return this.divmod(A,"mod",!0).mod},i.prototype.divRound=function(A){var e=this.divmod(A);if(e.mod.isZero())return e.div;var t=0!==e.div.negative?e.mod.isub(A):e.mod,r=A.ushrn(1),c=A.andln(1),i=t.cmp(r);return i<0||1===c&&0===i?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modrn=function(A){var e=A<0;e&&(A=-A),r(A<=67108863);for(var t=(1<<26)%A,c=0,i=this.length-1;i>=0;i--)c=(t*c+(0|this.words[i]))%A;return e?-c:c},i.prototype.modn=function(A){return this.modrn(A)},i.prototype.idivn=function(A){var e=A<0;e&&(A=-A),r(A<=67108863);for(var t=0,c=this.length-1;c>=0;c--){var i=(0|this.words[c])+67108864*t;this.words[c]=i/A|0,t=i%A}return this._strip(),e?this.ineg():this},i.prototype.divn=function(A){return this.clone().idivn(A)},i.prototype.egcd=function(A){r(0===A.negative),r(!A.isZero());var e=this,t=A.clone();e=0!==e.negative?e.umod(A):e.clone();for(var c=new i(1),f=new i(0),n=new i(0),a=new i(1),o=0;e.isEven()&&t.isEven();)e.iushrn(1),t.iushrn(1),++o;for(var s=t.clone(),d=e.clone();!e.isZero();){for(var u=0,l=1;0==(e.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(e.iushrn(u);u-- >0;)(c.isOdd()||f.isOdd())&&(c.iadd(s),f.isub(d)),c.iushrn(1),f.iushrn(1);for(var g=0,p=1;0==(t.words[0]&p)&&g<26;++g,p<<=1);if(g>0)for(t.iushrn(g);g-- >0;)(n.isOdd()||a.isOdd())&&(n.iadd(s),a.isub(d)),n.iushrn(1),a.iushrn(1);e.cmp(t)>=0?(e.isub(t),c.isub(n),f.isub(a)):(t.isub(e),n.isub(c),a.isub(f))}return{a:n,b:a,gcd:t.iushln(o)}},i.prototype._invmp=function(A){r(0===A.negative),r(!A.isZero());var e=this,t=A.clone();e=0!==e.negative?e.umod(A):e.clone();for(var c,f=new i(1),n=new i(0),a=t.clone();e.cmpn(1)>0&&t.cmpn(1)>0;){for(var o=0,s=1;0==(e.words[0]&s)&&o<26;++o,s<<=1);if(o>0)for(e.iushrn(o);o-- >0;)f.isOdd()&&f.iadd(a),f.iushrn(1);for(var d=0,u=1;0==(t.words[0]&u)&&d<26;++d,u<<=1);if(d>0)for(t.iushrn(d);d-- >0;)n.isOdd()&&n.iadd(a),n.iushrn(1);e.cmp(t)>=0?(e.isub(t),f.isub(n)):(t.isub(e),n.isub(f))}return(c=0===e.cmpn(1)?f:n).cmpn(0)<0&&c.iadd(A),c},i.prototype.gcd=function(A){if(this.isZero())return A.abs();if(A.isZero())return this.abs();var e=this.clone(),t=A.clone();e.negative=0,t.negative=0;for(var r=0;e.isEven()&&t.isEven();r++)e.iushrn(1),t.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;t.isEven();)t.iushrn(1);var c=e.cmp(t);if(c<0){var i=e;e=t,t=i}else if(0===c||0===t.cmpn(1))break;e.isub(t)}return t.iushln(r)},i.prototype.invm=function(A){return this.egcd(A).a.umod(A)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(A){return this.words[0]&A},i.prototype.bincn=function(A){r("number"==typeof A);var e=A%26,t=(A-e)/26,c=1<>>26,n&=67108863,this.words[f]=n}return 0!==i&&(this.words[f]=i,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(A){var e,t=A<0;if(0!==this.negative&&!t)return-1;if(0===this.negative&&t)return 1;if(this._strip(),this.length>1)e=1;else{t&&(A=-A),r(A<=67108863,"Number is too big");var c=0|this.words[0];e=c===A?0:cA.length)return 1;if(this.length=0;t--){var r=0|this.words[t],c=0|A.words[t];if(r!==c){rc&&(e=1);break}}return e},i.prototype.gtn=function(A){return 1===this.cmpn(A)},i.prototype.gt=function(A){return 1===this.cmp(A)},i.prototype.gten=function(A){return this.cmpn(A)>=0},i.prototype.gte=function(A){return this.cmp(A)>=0},i.prototype.ltn=function(A){return-1===this.cmpn(A)},i.prototype.lt=function(A){return-1===this.cmp(A)},i.prototype.lten=function(A){return this.cmpn(A)<=0},i.prototype.lte=function(A){return this.cmp(A)<=0},i.prototype.eqn=function(A){return 0===this.cmpn(A)},i.prototype.eq=function(A){return 0===this.cmp(A)},i.red=function(A){return new m(A)},i.prototype.toRed=function(A){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),A.convertTo(this)._forceRed(A)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(A){return this.red=A,this},i.prototype.forceRed=function(A){return r(!this.red,"Already a number in reduction context"),this._forceRed(A)},i.prototype.redAdd=function(A){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,A)},i.prototype.redIAdd=function(A){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,A)},i.prototype.redSub=function(A){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,A)},i.prototype.redISub=function(A){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,A)},i.prototype.redShl=function(A){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,A)},i.prototype.redMul=function(A){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,A),this.red.mul(this,A)},i.prototype.redIMul=function(A){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,A),this.red.imul(this,A)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(A){return r(this.red&&!A.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,A)};var b={k256:null,p224:null,p192:null,p25519:null};function E(A,e){this.name=A,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function C(){E.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function Q(){E.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function y(){E.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function w(){E.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function m(A){if("string"==typeof A){var e=i._prime(A);this.m=e.p,this.prime=e}else r(A.gtn(1),"modulus must be greater than 1"),this.m=A,this.prime=null}function S(A){m.call(this,A),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(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)}E.prototype._tmp=function(){var A=new i(null);return A.words=new Array(Math.ceil(this.n/13)),A},E.prototype.ireduce=function(A){var e,t=A;do{this.split(t,this.tmp),e=(t=(t=this.imulK(t)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e0?t.isub(this.p):void 0!==t.strip?t.strip():t._strip(),t},E.prototype.split=function(A,e){A.iushrn(this.n,0,e)},E.prototype.imulK=function(A){return A.imul(this.k)},c(C,E),C.prototype.split=function(A,e){for(var t=Math.min(A.length,9),r=0;r>>22,c=i}c>>>=22,A.words[r-10]=c,0===c&&A.length>10?A.length-=10:A.length-=9},C.prototype.imulK=function(A){A.words[A.length]=0,A.words[A.length+1]=0,A.length+=2;for(var e=0,t=0;t>>=26,A.words[t]=c,e=r}return 0!==e&&(A.words[A.length++]=e),A},i._prime=function(A){if(b[A])return b[A];var e;if("k256"===A)e=new C;else if("p224"===A)e=new Q;else if("p192"===A)e=new y;else{if("p25519"!==A)throw new Error("Unknown prime "+A);e=new w}return b[A]=e,e},m.prototype._verify1=function(A){r(0===A.negative,"red works only with positives"),r(A.red,"red works only with red numbers")},m.prototype._verify2=function(A,e){r(0==(A.negative|e.negative),"red works only with positives"),r(A.red&&A.red===e.red,"red works only with red numbers")},m.prototype.imod=function(A){return this.prime?this.prime.ireduce(A)._forceRed(this):(o(A,A.umod(this.m)._forceRed(this)),A)},m.prototype.neg=function(A){return A.isZero()?A.clone():this.m.sub(A)._forceRed(this)},m.prototype.add=function(A,e){this._verify2(A,e);var t=A.add(e);return t.cmp(this.m)>=0&&t.isub(this.m),t._forceRed(this)},m.prototype.iadd=function(A,e){this._verify2(A,e);var t=A.iadd(e);return t.cmp(this.m)>=0&&t.isub(this.m),t},m.prototype.sub=function(A,e){this._verify2(A,e);var t=A.sub(e);return t.cmpn(0)<0&&t.iadd(this.m),t._forceRed(this)},m.prototype.isub=function(A,e){this._verify2(A,e);var t=A.isub(e);return t.cmpn(0)<0&&t.iadd(this.m),t},m.prototype.shl=function(A,e){return this._verify1(A),this.imod(A.ushln(e))},m.prototype.imul=function(A,e){return this._verify2(A,e),this.imod(A.imul(e))},m.prototype.mul=function(A,e){return this._verify2(A,e),this.imod(A.mul(e))},m.prototype.isqr=function(A){return this.imul(A,A.clone())},m.prototype.sqr=function(A){return this.mul(A,A)},m.prototype.sqrt=function(A){if(A.isZero())return A.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var t=this.m.add(new i(1)).iushrn(2);return this.pow(A,t)}for(var c=this.m.subn(1),f=0;!c.isZero()&&0===c.andln(1);)f++,c.iushrn(1);r(!c.isZero());var n=new i(1).toRed(this),a=n.redNeg(),o=this.m.subn(1).iushrn(1),s=this.m.bitLength();for(s=new i(2*s*s).toRed(this);0!==this.pow(s,o).cmp(a);)s.redIAdd(a);for(var d=this.pow(s,c),u=this.pow(A,c.addn(1).iushrn(1)),l=this.pow(A,c),g=f;0!==l.cmp(n);){for(var p=l,B=0;0!==p.cmp(n);B++)p=p.redSqr();r(B=0;r--){for(var o=e.words[r],s=a-1;s>=0;s--){var d=o>>s&1;c!==t[0]&&(c=this.sqr(c)),0!==d||0!==f?(f<<=1,f|=d,(4===++n||0===r&&0===s)&&(c=this.mul(c,t[f]),n=0,f=0)):n=0}a=26}return c},m.prototype.convertTo=function(A){var e=A.umod(this.m);return e===A?e.clone():e},m.prototype.convertFrom=function(A){var e=A.clone();return e.red=null,e},i.mont=function(A){return new S(A)},c(S,m),S.prototype.convertTo=function(A){return this.imod(A.ushln(this.shift))},S.prototype.convertFrom=function(A){var e=this.imod(A.mul(this.rinv));return e.red=null,e},S.prototype.imul=function(A,e){if(A.isZero()||e.isZero())return A.words[0]=0,A.length=1,A;var t=A.imul(e),r=t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),c=t.isub(r).iushrn(this.shift),i=c;return c.cmp(this.m)>=0?i=c.isub(this.m):c.cmpn(0)<0&&(i=c.iadd(this.m)),i._forceRed(this)},S.prototype.mul=function(A,e){if(A.isZero()||e.isZero())return new i(0)._forceRed(this);var t=A.mul(e),r=t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),c=t.isub(r).iushrn(this.shift),f=c;return c.cmp(this.m)>=0?f=c.isub(this.m):c.cmpn(0)<0&&(f=c.iadd(this.m)),f._forceRed(this)},S.prototype.invm=function(A){return this.imod(A._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)},{buffer:19}],18:[function(A,e,t){var r;function c(A){this.rand=A}if(e.exports=function(A){return r||(r=new c(null)),r.generate(A)},e.exports.Rand=c,c.prototype.generate=function(A){return this._rand(A)},c.prototype._rand=function(A){if(this.rand.getBytes)return this.rand.getBytes(A);for(var e=new Uint8Array(A),t=0;t>>24]^s[g>>>16&255]^d[p>>>8&255]^u[255&B]^e[h++],f=o[g>>>24]^s[p>>>16&255]^d[B>>>8&255]^u[255&l]^e[h++],n=o[p>>>24]^s[B>>>16&255]^d[l>>>8&255]^u[255&g]^e[h++],a=o[B>>>24]^s[l>>>16&255]^d[g>>>8&255]^u[255&p]^e[h++],l=i,g=f,p=n,B=a;return i=(r[l>>>24]<<24|r[g>>>16&255]<<16|r[p>>>8&255]<<8|r[255&B])^e[h++],f=(r[g>>>24]<<24|r[p>>>16&255]<<16|r[B>>>8&255]<<8|r[255&l])^e[h++],n=(r[p>>>24]<<24|r[B>>>16&255]<<16|r[l>>>8&255]<<8|r[255&g])^e[h++],a=(r[B>>>24]<<24|r[l>>>16&255]<<16|r[g>>>8&255]<<8|r[255&p])^e[h++],[i>>>=0,f>>>=0,n>>>=0,a>>>=0]}var n=[0,1,2,4,8,16,32,64,128,27,54],a=function(){for(var A=new Array(256),e=0;e<256;e++)A[e]=e<128?e<<1:e<<1^283;for(var t=[],r=[],c=[[],[],[],[]],i=[[],[],[],[]],f=0,n=0,a=0;a<256;++a){var o=n^n<<1^n<<2^n<<3^n<<4;o=o>>>8^255&o^99,t[f]=o,r[o]=f;var s=A[f],d=A[s],u=A[d],l=257*A[o]^16843008*o;c[0][f]=l<<24|l>>>8,c[1][f]=l<<16|l>>>16,c[2][f]=l<<8|l>>>24,c[3][f]=l,l=16843009*u^65537*d^257*s^16843008*f,i[0][o]=l<<24|l>>>8,i[1][o]=l<<16|l>>>16,i[2][o]=l<<8|l>>>24,i[3][o]=l,0===f?f=n=1:(f=s^A[A[A[u^s]]],n^=A[A[n]])}return{SBOX:t,INV_SBOX:r,SUB_MIX:c,INV_SUB_MIX:i}}();function o(A){this._key=c(A),this._reset()}o.blockSize=16,o.keySize=32,o.prototype.blockSize=o.blockSize,o.prototype.keySize=o.keySize,o.prototype._reset=function(){for(var A=this._key,e=A.length,t=e+6,r=4*(t+1),c=[],i=0;i>>24,f=a.SBOX[f>>>24]<<24|a.SBOX[f>>>16&255]<<16|a.SBOX[f>>>8&255]<<8|a.SBOX[255&f],f^=n[i/e|0]<<24):e>6&&i%e==4&&(f=a.SBOX[f>>>24]<<24|a.SBOX[f>>>16&255]<<16|a.SBOX[f>>>8&255]<<8|a.SBOX[255&f]),c[i]=c[i-e]^f}for(var o=[],s=0;s>>24]]^a.INV_SUB_MIX[1][a.SBOX[u>>>16&255]]^a.INV_SUB_MIX[2][a.SBOX[u>>>8&255]]^a.INV_SUB_MIX[3][a.SBOX[255&u]]}this._nRounds=t,this._keySchedule=c,this._invKeySchedule=o},o.prototype.encryptBlockRaw=function(A){return f(A=c(A),this._keySchedule,a.SUB_MIX,a.SBOX,this._nRounds)},o.prototype.encryptBlock=function(A){var e=this.encryptBlockRaw(A),t=r.allocUnsafe(16);return t.writeUInt32BE(e[0],0),t.writeUInt32BE(e[1],4),t.writeUInt32BE(e[2],8),t.writeUInt32BE(e[3],12),t},o.prototype.decryptBlock=function(A){var e=(A=c(A))[1];A[1]=A[3],A[3]=e;var t=f(A,this._invKeySchedule,a.INV_SUB_MIX,a.INV_SBOX,this._nRounds),i=r.allocUnsafe(16);return i.writeUInt32BE(t[0],0),i.writeUInt32BE(t[3],4),i.writeUInt32BE(t[2],8),i.writeUInt32BE(t[1],12),i},o.prototype.scrub=function(){i(this._keySchedule),i(this._invKeySchedule),i(this._key)},e.exports.AES=o},{"safe-buffer":180}],21:[function(A,e,t){var r=A("./aes"),c=A("safe-buffer").Buffer,i=A("cipher-base"),f=A("inherits"),n=A("./ghash"),a=A("buffer-xor"),o=A("./incr32");function s(A,e,t,f){i.call(this);var a=c.alloc(4,0);this._cipher=new r.AES(e);var s=this._cipher.encryptBlock(a);this._ghash=new n(s),t=function(A,e,t){if(12===e.length)return A._finID=c.concat([e,c.from([0,0,0,1])]),c.concat([e,c.from([0,0,0,2])]);var r=new n(t),i=e.length,f=i%16;r.update(e),f&&(f=16-f,r.update(c.alloc(f,0))),r.update(c.alloc(8,0));var a=8*i,s=c.alloc(8);s.writeUIntBE(a,0,8),r.update(s),A._finID=r.state;var d=c.from(A._finID);return o(d),d}(this,t,s),this._prev=c.from(t),this._cache=c.allocUnsafe(0),this._secCache=c.allocUnsafe(0),this._decrypt=f,this._alen=0,this._len=0,this._mode=A,this._authTag=null,this._called=!1}f(s,i),s.prototype._update=function(A){if(!this._called&&this._alen){var e=16-this._alen%16;e<16&&(e=c.alloc(e,0),this._ghash.update(e))}this._called=!0;var t=this._mode.encrypt(this,A);return this._decrypt?this._ghash.update(A):this._ghash.update(t),this._len+=A.length,t},s.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var A=a(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(A,e){var t=0;A.length!==e.length&&t++;for(var r=Math.min(A.length,e.length),c=0;c16)throw new Error("unable to decrypt data");var t=-1;for(;++t16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e}else if(this.cache.length>=16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e;return null},d.prototype.flush=function(){if(this.cache.length)return this.cache},t.createDecipher=function(A,e){var t=i[A.toLowerCase()];if(!t)throw new TypeError("invalid suite type");var r=o(e,!1,t.key,t.iv);return u(A,r.key,r.iv)},t.createDecipheriv=u},{"./aes":20,"./authCipher":21,"./modes":33,"./streamCipher":36,"cipher-base":65,evp_bytestokey:103,inherits:134,"safe-buffer":180}],24:[function(A,e,t){var r=A("./modes"),c=A("./authCipher"),i=A("safe-buffer").Buffer,f=A("./streamCipher"),n=A("cipher-base"),a=A("./aes"),o=A("evp_bytestokey");function s(A,e,t){n.call(this),this._cache=new u,this._cipher=new a.AES(e),this._prev=i.from(t),this._mode=A,this._autopadding=!0}A("inherits")(s,n),s.prototype._update=function(A){var e,t;this._cache.add(A);for(var r=[];e=this._cache.get();)t=this._mode.encrypt(this,e),r.push(t);return i.concat(r)};var d=i.alloc(16,16);function u(){this.cache=i.allocUnsafe(0)}function l(A,e,t){var n=r[A.toLowerCase()];if(!n)throw new TypeError("invalid suite type");if("string"==typeof e&&(e=i.from(e)),e.length!==n.key/8)throw new TypeError("invalid key length "+e.length);if("string"==typeof t&&(t=i.from(t)),"GCM"!==n.mode&&t.length!==n.iv)throw new TypeError("invalid iv length "+t.length);return"stream"===n.type?new f(n.module,e,t):"auth"===n.type?new c(n.module,e,t):new s(n.module,e,t)}s.prototype._final=function(){var A=this._cache.flush();if(this._autopadding)return A=this._mode.encrypt(this,A),this._cipher.scrub(),A;if(!A.equals(d))throw this._cipher.scrub(),new Error("data not multiple of block length")},s.prototype.setAutoPadding=function(A){return this._autopadding=!!A,this},u.prototype.add=function(A){this.cache=i.concat([this.cache,A])},u.prototype.get=function(){if(this.cache.length>15){var A=this.cache.slice(0,16);return this.cache=this.cache.slice(16),A}return null},u.prototype.flush=function(){for(var A=16-this.cache.length,e=i.allocUnsafe(A),t=-1;++t>>0,0),e.writeUInt32BE(A[1]>>>0,4),e.writeUInt32BE(A[2]>>>0,8),e.writeUInt32BE(A[3]>>>0,12),e}function f(A){this.h=A,this.state=r.alloc(16,0),this.cache=r.allocUnsafe(0)}f.prototype.ghash=function(A){for(var e=-1;++e0;e--)r[e]=r[e]>>>1|(1&r[e-1])<<31;r[0]=r[0]>>>1,t&&(r[0]=r[0]^225<<24)}this.state=i(c)},f.prototype.update=function(A){var e;for(this.cache=r.concat([this.cache,A]);this.cache.length>=16;)e=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(e)},f.prototype.final=function(A,e){return this.cache.length&&this.ghash(r.concat([this.cache,c],16)),this.ghash(i([0,A,0,e])),this.state},e.exports=f},{"safe-buffer":180}],26:[function(A,e,t){e.exports=function(A){for(var e,t=A.length;t--;){if(255!==(e=A.readUInt8(t))){e++,A.writeUInt8(e,t);break}A.writeUInt8(0,t)}}},{}],27:[function(A,e,t){var r=A("buffer-xor");t.encrypt=function(A,e){var t=r(e,A._prev);return A._prev=A._cipher.encryptBlock(t),A._prev},t.decrypt=function(A,e){var t=A._prev;A._prev=e;var c=A._cipher.decryptBlock(e);return r(c,t)}},{"buffer-xor":63}],28:[function(A,e,t){var r=A("safe-buffer").Buffer,c=A("buffer-xor");function i(A,e,t){var i=e.length,f=c(e,A._cache);return A._cache=A._cache.slice(i),A._prev=r.concat([A._prev,t?e:f]),f}t.encrypt=function(A,e,t){for(var c,f=r.allocUnsafe(0);e.length;){if(0===A._cache.length&&(A._cache=A._cipher.encryptBlock(A._prev),A._prev=r.allocUnsafe(0)),!(A._cache.length<=e.length)){f=r.concat([f,i(A,e,t)]);break}c=A._cache.length,f=r.concat([f,i(A,e.slice(0,c),t)]),e=e.slice(c)}return f}},{"buffer-xor":63,"safe-buffer":180}],29:[function(A,e,t){var r=A("safe-buffer").Buffer;function c(A,e,t){for(var r,c,f=-1,n=0;++f<8;)r=e&1<<7-f?128:0,n+=(128&(c=A._cipher.encryptBlock(A._prev)[0]^r))>>f%8,A._prev=i(A._prev,t?r:c);return n}function i(A,e){var t=A.length,c=-1,i=r.allocUnsafe(A.length);for(A=r.concat([A,r.from([e])]);++c>7;return i}t.encrypt=function(A,e,t){for(var i=e.length,f=r.allocUnsafe(i),n=-1;++n=0||!t.umod(A.prime1)||!t.umod(A.prime2);)t=new r(c(e));return t}e.exports=i,i.getr=f}).call(this,A("buffer").Buffer)},{"bn.js":41,buffer:64,randombytes:162}],41:[function(A,e,t){arguments[4][15][0].apply(t,arguments)},{buffer:19,dup:15}],42:[function(A,e,t){e.exports=A("./browser/algorithms.json")},{"./browser/algorithms.json":43}],43:[function(A,e,t){e.exports={sha224WithRSAEncryption:{sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:{sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:{sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:{sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:{sign:"ecdsa",hash:"sha256",id:""},sha224:{sign:"ecdsa",hash:"sha224",id:""},sha384:{sign:"ecdsa",hash:"sha384",id:""},sha512:{sign:"ecdsa",hash:"sha512",id:""},"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:{sign:"dsa",hash:"sha1",id:""},"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}}},{}],44:[function(A,e,t){e.exports={"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}},{}],45:[function(A,e,t){var r=A("safe-buffer").Buffer,c=A("create-hash"),i=A("readable-stream"),f=A("inherits"),n=A("./sign"),a=A("./verify"),o=A("./algorithms.json");function s(A){i.Writable.call(this);var e=o[A];if(!e)throw new Error("Unknown message digest");this._hashType=e.hash,this._hash=c(e.hash),this._tag=e.id,this._signType=e.sign}function d(A){i.Writable.call(this);var e=o[A];if(!e)throw new Error("Unknown message digest");this._hash=c(e.hash),this._tag=e.id,this._signType=e.sign}function u(A){return new s(A)}function l(A){return new d(A)}Object.keys(o).forEach((function(A){o[A].id=r.from(o[A].id,"hex"),o[A.toLowerCase()]=o[A]})),f(s,i.Writable),s.prototype._write=function(A,e,t){this._hash.update(A),t()},s.prototype.update=function(A,e){return"string"==typeof A&&(A=r.from(A,e)),this._hash.update(A),this},s.prototype.sign=function(A,e){this.end();var t=this._hash.digest(),r=n(t,A,this._hashType,this._signType,this._tag);return e?r.toString(e):r},f(d,i.Writable),d.prototype._write=function(A,e,t){this._hash.update(A),t()},d.prototype.update=function(A,e){return"string"==typeof A&&(A=r.from(A,e)),this._hash.update(A),this},d.prototype.verify=function(A,e,t){"string"==typeof e&&(e=r.from(e,t)),this.end();var c=this._hash.digest();return a(e,c,A,this._signType,this._tag)},e.exports={Sign:u,Verify:l,createSign:u,createVerify:l}},{"./algorithms.json":43,"./sign":46,"./verify":47,"create-hash":69,inherits:134,"readable-stream":62,"safe-buffer":180}],46:[function(A,e,t){var r=A("safe-buffer").Buffer,c=A("create-hmac"),i=A("browserify-rsa"),f=A("elliptic").ec,n=A("bn.js"),a=A("parse-asn1"),o=A("./curves.json");function s(A,e,t,i){if((A=r.from(A.toArray())).length0&&t.ishrn(r),t}function u(A,e,t){var i,f;do{for(i=r.alloc(0);8*i.length=e)throw new Error("invalid sig")}e.exports=function(A,e,t,o,s){var d=f(t);if("ec"===d.type){if("ecdsa"!==o&&"ecdsa/rsa"!==o)throw new Error("wrong public key type");return function(A,e,t){var r=n[t.data.algorithm.curve.join(".")];if(!r)throw new Error("unknown curve "+t.data.algorithm.curve.join("."));var c=new i(r),f=t.data.subjectPrivateKey.data;return c.verify(e,A,f)}(A,e,d)}if("dsa"===d.type){if("dsa"!==o)throw new Error("wrong public key type");return function(A,e,t){var r=t.data.p,i=t.data.q,n=t.data.g,o=t.data.pub_key,s=f.signature.decode(A,"der"),d=s.s,u=s.r;a(d,i),a(u,i);var l=c.mont(r),g=d.invm(i);return 0===n.toRed(l).redPow(new c(e).mul(g).mod(i)).fromRed().mul(o.toRed(l).redPow(u.mul(g).mod(i)).fromRed()).mod(r).mod(i).cmp(u)}(A,e,d)}if("rsa"!==o&&"ecdsa/rsa"!==o)throw new Error("wrong public key type");e=r.concat([s,e]);for(var u=d.modulus.byteLength(),l=[1],g=0;e.length+l.length+22?"one of ".concat(e," ").concat(A.slice(0,t-1).join(", "),", or ")+A[t-1]:2===t?"one of ".concat(e," ").concat(A[0]," or ").concat(A[1]):"of ".concat(e," ").concat(A[0])}return"of ".concat(e," ").concat(String(A))}c("ERR_INVALID_OPT_VALUE",(function(A,e){return'The value "'+e+'" is invalid for option "'+A+'"'}),TypeError),c("ERR_INVALID_ARG_TYPE",(function(A,e,t){var r,c,f,n;if("string"==typeof e&&(c="not ",e.substr(!f||f<0?0:+f,c.length)===c)?(r="must not be",e=e.replace(/^not /,"")):r="must be",function(A,e,t){return(void 0===t||t>A.length)&&(t=A.length),A.substring(t-e.length,t)===e}(A," argument"))n="The ".concat(A," ").concat(r," ").concat(i(e,"type"));else{var a=function(A,e,t){return"number"!=typeof t&&(t=0),!(t+e.length>A.length)&&-1!==A.indexOf(e,t)}(A,".")?"property":"argument";n='The "'.concat(A,'" ').concat(a," ").concat(r," ").concat(i(e,"type"))}return n+=". Received type ".concat(typeof t)}),TypeError),c("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),c("ERR_METHOD_NOT_IMPLEMENTED",(function(A){return"The "+A+" method is not implemented"})),c("ERR_STREAM_PREMATURE_CLOSE","Premature close"),c("ERR_STREAM_DESTROYED",(function(A){return"Cannot call "+A+" after a stream was destroyed"})),c("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),c("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),c("ERR_STREAM_WRITE_AFTER_END","write after end"),c("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),c("ERR_UNKNOWN_ENCODING",(function(A){return"Unknown encoding: "+A}),TypeError),c("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.codes=r},{}],49:[function(A,e,t){(function(t){"use strict";var r=Object.keys||function(A){var e=[];for(var t in A)e.push(t);return e};e.exports=o;var c=A("./_stream_readable"),i=A("./_stream_writable");A("inherits")(o,c);for(var f=r(i.prototype),n=0;n0)if("string"==typeof e||f.objectMode||Object.getPrototypeOf(e)===n.prototype||(e=function(A){return n.from(A)}(e)),r)f.endEmitted?Q(A,new C):D(A,f,e,!0);else if(f.ended)Q(A,new b);else{if(f.destroyed)return!1;f.reading=!1,f.decoder&&!t?(e=f.decoder.write(e),f.objectMode||0!==e.length?D(A,f,e,!1):O(A,f)):D(A,f,e,!1)}else r||(f.reading=!1,O(A,f));return!f.ended&&(f.lengthe.highWaterMark&&(e.highWaterMark=function(A){return A>=1073741824?A=1073741824:(A--,A|=A>>>1,A|=A>>>2,A|=A>>>4,A|=A>>>8,A|=A>>>16,A++),A}(A)),A<=e.length?A:e.ended?e.length:(e.needReadable=!0,0))}function v(e){var t=e._readableState;o("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(o("emitReadable",t.flowing),t.emittedReadable=!0,A.nextTick(k,e))}function k(A){var e=A._readableState;o("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(A.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,x(A)}function O(e,t){t.readingMore||(t.readingMore=!0,A.nextTick(N,e,t))}function N(A,e){for(;!e.reading&&!e.ended&&(e.length0,e.resumeScheduled&&!e.paused?e.flowing=!0:A.listenerCount("data")>0&&A.resume()}function F(A){o("readable nexttick read 0"),A.read(0)}function U(A,e){o("resume",e.reading),e.reading||A.read(0),e.resumeScheduled=!1,A.emit("resume"),x(A),e.flowing&&!e.reading&&A.read(0)}function x(A){var e=A._readableState;for(o("flow",e.flowing);e.flowing&&null!==A.read(););}function j(A,e){return 0===e.length?null:(e.objectMode?t=e.buffer.shift():!A||A>=e.length?(t=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):t=e.buffer.consume(A,e.decoder),t);var t}function Y(e){var t=e._readableState;o("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,A.nextTick(_,t,e))}function _(A,e){if(o("endReadableNT",A.endEmitted,A.length),!A.endEmitted&&0===A.length&&(A.endEmitted=!0,e.readable=!1,e.emit("end"),A.autoDestroy)){var t=e._writableState;(!t||t.autoDestroy&&t.finished)&&e.destroy()}}function L(A,e){for(var t=0,r=A.length;t=e.highWaterMark:e.length>0)||e.ended))return o("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?Y(this):v(this),null;if(0===(A=M(A,e))&&e.ended)return 0===e.length&&Y(this),null;var r,c=e.needReadable;return o("need readable",c),(0===e.length||e.length-A0?j(A,e):null)?(e.needReadable=e.length<=e.highWaterMark,A=0):(e.length-=A,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),t!==A&&e.ended&&Y(this)),null!==r&&this.emit("data",r),r},m.prototype._read=function(A){Q(this,new E("_read()"))},m.prototype.pipe=function(e,t){var r=this,c=this._readableState;switch(c.pipesCount){case 0:c.pipes=e;break;case 1:c.pipes=[c.pipes,e];break;default:c.pipes.push(e)}c.pipesCount+=1,o("pipe count=%d opts=%j",c.pipesCount,t);var f=(!t||!1!==t.end)&&e!==A.stdout&&e!==A.stderr?a:B;function n(A,t){o("onunpipe"),A===r&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,o("cleanup"),e.removeListener("close",g),e.removeListener("finish",p),e.removeListener("drain",s),e.removeListener("error",l),e.removeListener("unpipe",n),r.removeListener("end",a),r.removeListener("end",B),r.removeListener("data",u),d=!0,!c.awaitDrain||e._writableState&&!e._writableState.needDrain||s())}function a(){o("onend"),e.end()}c.endEmitted?A.nextTick(f):r.once("end",f),e.on("unpipe",n);var s=function(A){return function(){var e=A._readableState;o("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&i(A,"data")&&(e.flowing=!0,x(A))}}(r);e.on("drain",s);var d=!1;function u(A){o("ondata");var t=e.write(A);o("dest.write",t),!1===t&&((1===c.pipesCount&&c.pipes===e||c.pipesCount>1&&-1!==L(c.pipes,e))&&!d&&(o("false write response, pause",c.awaitDrain),c.awaitDrain++),r.pause())}function l(A){o("onerror",A),B(),e.removeListener("error",l),0===i(e,"error")&&Q(e,A)}function g(){e.removeListener("finish",p),B()}function p(){o("onfinish"),e.removeListener("close",g),B()}function B(){o("unpipe"),r.unpipe(e)}return r.on("data",u),function(A,e,t){if("function"==typeof A.prependListener)return A.prependListener(e,t);A._events&&A._events[e]?Array.isArray(A._events[e])?A._events[e].unshift(t):A._events[e]=[t,A._events[e]]:A.on(e,t)}(e,"error",l),e.once("close",g),e.once("finish",p),e.emit("pipe",r),c.flowing||(o("pipe resume"),r.resume()),e},m.prototype.unpipe=function(A){var e=this._readableState,t={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return A&&A!==e.pipes||(A||(A=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,A&&A.emit("unpipe",this,t)),this;if(!A){var r=e.pipes,c=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var i=0;i0,!1!==c.flowing&&this.resume()):"readable"===e&&(c.endEmitted||c.readableListening||(c.readableListening=c.needReadable=!0,c.flowing=!1,c.emittedReadable=!1,o("on readable",c.length,c.reading),c.length?v(this):c.reading||A.nextTick(F,this))),r},m.prototype.addListener=m.prototype.on,m.prototype.removeListener=function(e,t){var r=f.prototype.removeListener.call(this,e,t);return"readable"===e&&A.nextTick(G,this),r},m.prototype.removeAllListeners=function(e){var t=f.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||A.nextTick(G,this),t},m.prototype.resume=function(){var e=this._readableState;return e.flowing||(o("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,A.nextTick(U,e,t))}(this,e)),e.paused=!1,this},m.prototype.pause=function(){return o("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(o("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},m.prototype.wrap=function(A){var e=this,t=this._readableState,r=!1;for(var c in A.on("end",(function(){if(o("wrapped end"),t.decoder&&!t.ended){var A=t.decoder.end();A&&A.length&&e.push(A)}e.push(null)})),A.on("data",(function(c){(o("wrapped data"),t.decoder&&(c=t.decoder.write(c)),t.objectMode&&null==c)||(t.objectMode||c&&c.length)&&(e.push(c)||(r=!0,A.pause()))})),A)void 0===this[c]&&"function"==typeof A[c]&&(this[c]=function(e){return function(){return A[e].apply(A,arguments)}}(c));for(var i=0;i-1))throw new C(A);return this._writableState.defaultEncoding=A,this},Object.defineProperty(m.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(m.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),m.prototype._write=function(A,e,t){t(new p("_write()"))},m.prototype._writev=null,m.prototype.end=function(e,t,r){var c=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),c.corked&&(c.corked=1,this.uncork()),c.ending||function(e,t,r){t.ending=!0,O(e,t),r&&(t.finished?A.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,c,r),this},Object.defineProperty(m.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(m.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(A){this._writableState&&(this._writableState.destroyed=A)}}),m.prototype.destroy=d.destroy,m.prototype._undestroy=d.undestroy,m.prototype._destroy=function(A,e){e(A)}}).call(this,e("_process"),void 0!==A?A:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../errors":48,"./_stream_duplex":49,"./internal/streams/destroy":56,"./internal/streams/state":60,"./internal/streams/stream":61,_process:154,buffer:64,inherits:134,"util-deprecate":193}],54:[function(A,e,t){(function(t){"use strict";var r;function c(A,e,t){return e in A?Object.defineProperty(A,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):A[e]=t,A}var i=A("./end-of-stream"),f=Symbol("lastResolve"),n=Symbol("lastReject"),a=Symbol("error"),o=Symbol("ended"),s=Symbol("lastPromise"),d=Symbol("handlePromise"),u=Symbol("stream");function l(A,e){return{value:A,done:e}}function g(A){var e=A[f];if(null!==e){var t=A[u].read();null!==t&&(A[s]=null,A[f]=null,A[n]=null,e(l(t,!1)))}}function p(A){t.nextTick(g,A)}var B=Object.getPrototypeOf((function(){})),h=Object.setPrototypeOf((c(r={get stream(){return this[u]},next:function(){var A=this,e=this[a];if(null!==e)return Promise.reject(e);if(this[o])return Promise.resolve(l(void 0,!0));if(this[u].destroyed)return new Promise((function(e,r){t.nextTick((function(){A[a]?r(A[a]):e(l(void 0,!0))}))}));var r,c=this[s];if(c)r=new Promise(function(A,e){return function(t,r){A.then((function(){e[o]?t(l(void 0,!0)):e[d](t,r)}),r)}}(c,this));else{var i=this[u].read();if(null!==i)return Promise.resolve(l(i,!1));r=new Promise(this[d])}return this[s]=r,r}},Symbol.asyncIterator,(function(){return this})),c(r,"return",(function(){var A=this;return new Promise((function(e,t){A[u].destroy(null,(function(A){A?t(A):e(l(void 0,!0))}))}))})),r),B);e.exports=function(A){var e,t=Object.create(h,(c(e={},u,{value:A,writable:!0}),c(e,f,{value:null,writable:!0}),c(e,n,{value:null,writable:!0}),c(e,a,{value:null,writable:!0}),c(e,o,{value:A._readableState.endEmitted,writable:!0}),c(e,d,{value:function(A,e){var r=t[u].read();r?(t[s]=null,t[f]=null,t[n]=null,A(l(r,!1))):(t[f]=A,t[n]=e)},writable:!0}),e));return t[s]=null,i(A,(function(A){if(A&&"ERR_STREAM_PREMATURE_CLOSE"!==A.code){var e=t[n];return null!==e&&(t[s]=null,t[f]=null,t[n]=null,e(A)),void(t[a]=A)}var r=t[f];null!==r&&(t[s]=null,t[f]=null,t[n]=null,r(l(void 0,!0))),t[o]=!0})),A.on("readable",p.bind(null,t)),t}}).call(this,A("_process"))},{"./end-of-stream":57,_process:154}],55:[function(A,e,t){"use strict";function r(A,e){var t=Object.keys(A);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(A);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(A,e).enumerable}))),t.push.apply(t,r)}return t}function c(A,e,t){return e in A?Object.defineProperty(A,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):A[e]=t,A}function i(A,e){for(var t=0;t0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(A){var e={data:A,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var A=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,A}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(A){if(0===this.length)return"";for(var e=this.head,t=""+e.data;e=e.next;)t+=A+e.data;return t}},{key:"concat",value:function(A){if(0===this.length)return f.alloc(0);for(var e,t,r,c=f.allocUnsafe(A>>>0),i=this.head,n=0;i;)e=i.data,t=c,r=n,f.prototype.copy.call(e,t,r),n+=i.data.length,i=i.next;return c}},{key:"consume",value:function(A,e){var t;return Ac.length?c.length:A;if(i===c.length?r+=c:r+=c.slice(0,A),0==(A-=i)){i===c.length?(++t,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=c.slice(i));break}++t}return this.length-=t,r}},{key:"_getBuffer",value:function(A){var e=f.allocUnsafe(A),t=this.head,r=1;for(t.data.copy(e),A-=t.data.length;t=t.next;){var c=t.data,i=A>c.length?c.length:A;if(c.copy(e,e.length-A,0,i),0==(A-=i)){i===c.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=c.slice(i));break}++r}return this.length-=r,e}},{key:a,value:function(A,e){return n(this,function(A){for(var e=1;e0,(function(A){r||(r=A),A&&f.forEach(o),i||(f.forEach(o),c(r))}))}));return e.reduce(s)}},{"../../../errors":48,"./end-of-stream":57}],60:[function(A,e,t){"use strict";var r=A("../../../errors").codes.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function(A,e,t,c){var i=function(A,e,t){return null!=A.highWaterMark?A.highWaterMark:e?A[t]:null}(e,c,t);if(null!=i){if(!isFinite(i)||Math.floor(i)!==i||i<0)throw new r(c?t:"highWaterMark",i);return Math.floor(i)}return A.objectMode?16:16384}}},{"../../../errors":48}],61:[function(A,e,t){e.exports=A("events").EventEmitter},{events:102}],62:[function(A,e,t){(t=e.exports=A("./lib/_stream_readable.js")).Stream=t,t.Readable=t,t.Writable=A("./lib/_stream_writable.js"),t.Duplex=A("./lib/_stream_duplex.js"),t.Transform=A("./lib/_stream_transform.js"),t.PassThrough=A("./lib/_stream_passthrough.js"),t.finished=A("./lib/internal/streams/end-of-stream.js"),t.pipeline=A("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":49,"./lib/_stream_passthrough.js":50,"./lib/_stream_readable.js":51,"./lib/_stream_transform.js":52,"./lib/_stream_writable.js":53,"./lib/internal/streams/end-of-stream.js":57,"./lib/internal/streams/pipeline.js":59}],63:[function(A,e,t){(function(A){e.exports=function(e,t){for(var r=Math.min(e.length,t.length),c=new A(r),i=0;i>6],i=0==(32&r);if(31==(31&r)){let n=r;for(r=0;128==(128&n);){if(n=e.readUInt8(t),e.isError(n))return n;r<<=7,r|=127&n}}else r&=31;return{cls:n,primitive:i,tag:r,tagStr:f.tag[r]}}function u(e,t,r){let n=e.readUInt8(r);if(e.isError(n))return n;if(!t&&128===n)return null;if(0==(128&n))return n;const i=127&n;if(i>4)return e.error("length octect is too long");n=0;for(let t=0;t=31)return n.error("Multi-octet tag encoding unsupported");t||(i|=32);return i|=a.tagClassByName[r||"universal"]<<6,i}(e,t,r,this.reporter);if(n.length<128){const e=i.alloc(2);return e[0]=c,e[1]=n.length,this._createEncoderBuffer([e,n])}let f=1;for(let e=n.length;e>=256;e>>=8)f++;const o=i.alloc(2+f);o[0]=c,o[1]=128|f;for(let e=1+f,t=n.length;t>0;e--,t>>=8)o[e]=255&t;return this._createEncoderBuffer([o,n])},o.prototype._encodeStr=function(e,t){if("bitstr"===t)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===t){const t=i.alloc(2*e.length);for(let r=0;r=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,40*e[0]+e[1])}let n=0;for(let t=0;t=128;r>>=7)n++}const c=i.alloc(n);let a=c.length-1;for(let t=e.length-1;t>=0;t--){let r=e[t];for(c[a--]=127&r;(r>>=7)>0;)c[a--]=128|127&r}return this._createEncoderBuffer(c)},o.prototype._encodeTime=function(e,t){let r;const n=new Date(e);return"gentime"===t?r=[s(n.getUTCFullYear()),s(n.getUTCMonth()+1),s(n.getUTCDate()),s(n.getUTCHours()),s(n.getUTCMinutes()),s(n.getUTCSeconds()),"Z"].join(""):"utctime"===t?r=[s(n.getUTCFullYear()%100),s(n.getUTCMonth()+1),s(n.getUTCDate()),s(n.getUTCHours()),s(n.getUTCMinutes()),s(n.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(r,"octstr")},o.prototype._encodeNull=function(){return this._createEncoderBuffer("")},o.prototype._encodeInt=function(e,t){if("string"==typeof e){if(!t)return this.reporter.error("String int or enum given, but no values map");if(!t.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=t[e]}if("number"!=typeof e&&!i.isBuffer(e)){const t=e.toArray();!e.sign&&128&t[0]&&t.unshift(0),e=i.from(t)}if(i.isBuffer(e)){let t=e.length;0===e.length&&t++;const r=i.alloc(t);return e.copy(r),0===e.length&&(r[0]=0),this._createEncoderBuffer(r)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);let r=1;for(let t=e;t>=256;t>>=8)r++;const n=new Array(r);for(let t=n.length-1;t>=0;t--)n[t]=255&e,e>>=8;return 128&n[0]&&n.unshift(0),this._createEncoderBuffer(i.from(n))},o.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},o.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getEncoder("der").tree},o.prototype._skipDefault=function(e,t,r){const n=this._baseState;let i;if(null===n.default)return!1;const c=e.join();if(void 0===n.defaultBuffer&&(n.defaultBuffer=this._encodeValue(n.default,t,r).join()),c.length!==n.defaultBuffer.length)return!1;for(i=0;i=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:15&a}return n}function o(e,t,r,n){for(var i=0,c=Math.min(e.length,r),a=t;a=49?f-49+10:f>=17?f-17+10:f}return i}c.isBN=function(e){return e instanceof c||null!==e&&"object"==typeof e&&e.constructor.wordSize===c.wordSize&&Array.isArray(e.words)},c.max=function(e,t){return e.cmp(t)>0?e:t},c.min=function(e,t){return e.cmp(t)<0?e:t},c.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&i++,16===t?this._parseHex(e,i):this._parseBase(e,t,i),"-"===e[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),t,r)},c.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},c.prototype._initArray=function(e,t,r){if(n("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[c]|=a<>>26-f&67108863,(f+=24)>=26&&(f-=26,c++);else if("le"===r)for(i=0,c=0;i>>26-f&67108863,(f+=24)>=26&&(f-=26,c++);return this.strip()},c.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r=t;r-=6)i=f(e,r,r+6),this.words[n]|=i<>>26-c&4194303,(c+=24)>=26&&(c-=26,n++);r+6!==t&&(i=f(e,t,r+6),this.words[n]|=i<>>26-c&4194303),this.strip()},c.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var c=e.length-r,a=c%n,f=Math.min(c,c-a)+r,s=0,d=r;d1&&0===this.words[this.length-1];)this.length--;return this._normSign()},c.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},c.prototype.inspect=function(){return(this.red?""};var s=["","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],u=[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 l(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],c=0|t.words[0],a=i*c,f=67108863&a,o=a/67108864|0;r.words[0]=f;for(var s=1;s>>26,u=67108863&o,l=Math.min(s,t.length-1),p=Math.max(0,s-e.length+1);p<=l;p++){var h=s-p|0;d+=(a=(i=0|e.words[h])*(c=0|t.words[p])+u)/67108864|0,u=67108863&a}r.words[s]=0|u,o=0|d}return 0!==o?r.words[s]=0|o:r.length--,r.strip()}c.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,c=0,a=0;a>>24-i&16777215)||a!==this.length-1?s[6-o.length]+o+r:o+r,(i+=2)>=26&&(i-=26,a--)}for(0!==c&&(r=c.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=d[e],p=u[e];r="";var h=this.clone();for(h.negative=0;!h.isZero();){var b=h.modn(p).toString(e);r=(h=h.idivn(p)).isZero()?b+r:s[l-b.length]+b+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},c.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},c.prototype.toJSON=function(){return this.toString(16)},c.prototype.toBuffer=function(e,t){return n(void 0!==a),this.toArrayLike(a,e,t)},c.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},c.prototype.toArrayLike=function(e,t,r){var i=this.byteLength(),c=r||Math.max(1,i);n(i<=c,"byte array longer than desired length"),n(c>0,"Requested array length <= 0"),this.strip();var a,f,o="le"===t,s=new e(c),d=this.clone();if(o){for(f=0;!d.isZero();f++)a=d.andln(255),d.iushrn(8),s[f]=a;for(;f=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},c.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},c.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},c.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},c.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},c.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},c.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},c.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},c.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},c.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},c.prototype.notn=function(e){return this.clone().inotn(e)},c.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,n=e):(r=e,n=this);for(var i=0,c=0;c>>26;for(;0!==i&&c>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ce.length?this.clone().iadd(e):e.clone().iadd(this)},c.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=e):(r=e,n=this);for(var c=0,a=0;a>26,this.words[a]=67108863&t;for(;0!==c&&a>26,this.words[a]=67108863&t;if(0===c&&a>>13,p=0|a[1],h=8191&p,b=p>>>13,y=0|a[2],m=8191&y,v=y>>>13,g=0|a[3],x=8191&g,w=g>>>13,O=0|a[4],k=8191&O,j=O>>>13,P=0|a[5],S=8191&P,_=P>>>13,M=0|a[6],T=8191&M,E=M>>>13,A=0|a[7],I=8191&A,R=A>>>13,C=0|a[8],D=8191&C,B=C>>>13,N=0|a[9],U=8191&N,H=N>>>13,L=0|f[0],V=8191&L,q=L>>>13,F=0|f[1],z=8191&F,K=F>>>13,W=0|f[2],G=8191&W,X=W>>>13,Y=0|f[3],J=8191&Y,Z=Y>>>13,Q=0|f[4],$=8191&Q,ee=Q>>>13,te=0|f[5],re=8191&te,ne=te>>>13,ie=0|f[6],ce=8191&ie,ae=ie>>>13,fe=0|f[7],oe=8191&fe,se=fe>>>13,de=0|f[8],ue=8191&de,le=de>>>13,pe=0|f[9],he=8191&pe,be=pe>>>13;r.negative=e.negative^t.negative,r.length=19;var ye=(s+(n=Math.imul(u,V))|0)+((8191&(i=(i=Math.imul(u,q))+Math.imul(l,V)|0))<<13)|0;s=((c=Math.imul(l,q))+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(h,V),i=(i=Math.imul(h,q))+Math.imul(b,V)|0,c=Math.imul(b,q);var me=(s+(n=n+Math.imul(u,z)|0)|0)+((8191&(i=(i=i+Math.imul(u,K)|0)+Math.imul(l,z)|0))<<13)|0;s=((c=c+Math.imul(l,K)|0)+(i>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(m,V),i=(i=Math.imul(m,q))+Math.imul(v,V)|0,c=Math.imul(v,q),n=n+Math.imul(h,z)|0,i=(i=i+Math.imul(h,K)|0)+Math.imul(b,z)|0,c=c+Math.imul(b,K)|0;var ve=(s+(n=n+Math.imul(u,G)|0)|0)+((8191&(i=(i=i+Math.imul(u,X)|0)+Math.imul(l,G)|0))<<13)|0;s=((c=c+Math.imul(l,X)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(x,V),i=(i=Math.imul(x,q))+Math.imul(w,V)|0,c=Math.imul(w,q),n=n+Math.imul(m,z)|0,i=(i=i+Math.imul(m,K)|0)+Math.imul(v,z)|0,c=c+Math.imul(v,K)|0,n=n+Math.imul(h,G)|0,i=(i=i+Math.imul(h,X)|0)+Math.imul(b,G)|0,c=c+Math.imul(b,X)|0;var ge=(s+(n=n+Math.imul(u,J)|0)|0)+((8191&(i=(i=i+Math.imul(u,Z)|0)+Math.imul(l,J)|0))<<13)|0;s=((c=c+Math.imul(l,Z)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(k,V),i=(i=Math.imul(k,q))+Math.imul(j,V)|0,c=Math.imul(j,q),n=n+Math.imul(x,z)|0,i=(i=i+Math.imul(x,K)|0)+Math.imul(w,z)|0,c=c+Math.imul(w,K)|0,n=n+Math.imul(m,G)|0,i=(i=i+Math.imul(m,X)|0)+Math.imul(v,G)|0,c=c+Math.imul(v,X)|0,n=n+Math.imul(h,J)|0,i=(i=i+Math.imul(h,Z)|0)+Math.imul(b,J)|0,c=c+Math.imul(b,Z)|0;var xe=(s+(n=n+Math.imul(u,$)|0)|0)+((8191&(i=(i=i+Math.imul(u,ee)|0)+Math.imul(l,$)|0))<<13)|0;s=((c=c+Math.imul(l,ee)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(S,V),i=(i=Math.imul(S,q))+Math.imul(_,V)|0,c=Math.imul(_,q),n=n+Math.imul(k,z)|0,i=(i=i+Math.imul(k,K)|0)+Math.imul(j,z)|0,c=c+Math.imul(j,K)|0,n=n+Math.imul(x,G)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(w,G)|0,c=c+Math.imul(w,X)|0,n=n+Math.imul(m,J)|0,i=(i=i+Math.imul(m,Z)|0)+Math.imul(v,J)|0,c=c+Math.imul(v,Z)|0,n=n+Math.imul(h,$)|0,i=(i=i+Math.imul(h,ee)|0)+Math.imul(b,$)|0,c=c+Math.imul(b,ee)|0;var we=(s+(n=n+Math.imul(u,re)|0)|0)+((8191&(i=(i=i+Math.imul(u,ne)|0)+Math.imul(l,re)|0))<<13)|0;s=((c=c+Math.imul(l,ne)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(T,V),i=(i=Math.imul(T,q))+Math.imul(E,V)|0,c=Math.imul(E,q),n=n+Math.imul(S,z)|0,i=(i=i+Math.imul(S,K)|0)+Math.imul(_,z)|0,c=c+Math.imul(_,K)|0,n=n+Math.imul(k,G)|0,i=(i=i+Math.imul(k,X)|0)+Math.imul(j,G)|0,c=c+Math.imul(j,X)|0,n=n+Math.imul(x,J)|0,i=(i=i+Math.imul(x,Z)|0)+Math.imul(w,J)|0,c=c+Math.imul(w,Z)|0,n=n+Math.imul(m,$)|0,i=(i=i+Math.imul(m,ee)|0)+Math.imul(v,$)|0,c=c+Math.imul(v,ee)|0,n=n+Math.imul(h,re)|0,i=(i=i+Math.imul(h,ne)|0)+Math.imul(b,re)|0,c=c+Math.imul(b,ne)|0;var Oe=(s+(n=n+Math.imul(u,ce)|0)|0)+((8191&(i=(i=i+Math.imul(u,ae)|0)+Math.imul(l,ce)|0))<<13)|0;s=((c=c+Math.imul(l,ae)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(I,V),i=(i=Math.imul(I,q))+Math.imul(R,V)|0,c=Math.imul(R,q),n=n+Math.imul(T,z)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(E,z)|0,c=c+Math.imul(E,K)|0,n=n+Math.imul(S,G)|0,i=(i=i+Math.imul(S,X)|0)+Math.imul(_,G)|0,c=c+Math.imul(_,X)|0,n=n+Math.imul(k,J)|0,i=(i=i+Math.imul(k,Z)|0)+Math.imul(j,J)|0,c=c+Math.imul(j,Z)|0,n=n+Math.imul(x,$)|0,i=(i=i+Math.imul(x,ee)|0)+Math.imul(w,$)|0,c=c+Math.imul(w,ee)|0,n=n+Math.imul(m,re)|0,i=(i=i+Math.imul(m,ne)|0)+Math.imul(v,re)|0,c=c+Math.imul(v,ne)|0,n=n+Math.imul(h,ce)|0,i=(i=i+Math.imul(h,ae)|0)+Math.imul(b,ce)|0,c=c+Math.imul(b,ae)|0;var ke=(s+(n=n+Math.imul(u,oe)|0)|0)+((8191&(i=(i=i+Math.imul(u,se)|0)+Math.imul(l,oe)|0))<<13)|0;s=((c=c+Math.imul(l,se)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(D,V),i=(i=Math.imul(D,q))+Math.imul(B,V)|0,c=Math.imul(B,q),n=n+Math.imul(I,z)|0,i=(i=i+Math.imul(I,K)|0)+Math.imul(R,z)|0,c=c+Math.imul(R,K)|0,n=n+Math.imul(T,G)|0,i=(i=i+Math.imul(T,X)|0)+Math.imul(E,G)|0,c=c+Math.imul(E,X)|0,n=n+Math.imul(S,J)|0,i=(i=i+Math.imul(S,Z)|0)+Math.imul(_,J)|0,c=c+Math.imul(_,Z)|0,n=n+Math.imul(k,$)|0,i=(i=i+Math.imul(k,ee)|0)+Math.imul(j,$)|0,c=c+Math.imul(j,ee)|0,n=n+Math.imul(x,re)|0,i=(i=i+Math.imul(x,ne)|0)+Math.imul(w,re)|0,c=c+Math.imul(w,ne)|0,n=n+Math.imul(m,ce)|0,i=(i=i+Math.imul(m,ae)|0)+Math.imul(v,ce)|0,c=c+Math.imul(v,ae)|0,n=n+Math.imul(h,oe)|0,i=(i=i+Math.imul(h,se)|0)+Math.imul(b,oe)|0,c=c+Math.imul(b,se)|0;var je=(s+(n=n+Math.imul(u,ue)|0)|0)+((8191&(i=(i=i+Math.imul(u,le)|0)+Math.imul(l,ue)|0))<<13)|0;s=((c=c+Math.imul(l,le)|0)+(i>>>13)|0)+(je>>>26)|0,je&=67108863,n=Math.imul(U,V),i=(i=Math.imul(U,q))+Math.imul(H,V)|0,c=Math.imul(H,q),n=n+Math.imul(D,z)|0,i=(i=i+Math.imul(D,K)|0)+Math.imul(B,z)|0,c=c+Math.imul(B,K)|0,n=n+Math.imul(I,G)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(R,G)|0,c=c+Math.imul(R,X)|0,n=n+Math.imul(T,J)|0,i=(i=i+Math.imul(T,Z)|0)+Math.imul(E,J)|0,c=c+Math.imul(E,Z)|0,n=n+Math.imul(S,$)|0,i=(i=i+Math.imul(S,ee)|0)+Math.imul(_,$)|0,c=c+Math.imul(_,ee)|0,n=n+Math.imul(k,re)|0,i=(i=i+Math.imul(k,ne)|0)+Math.imul(j,re)|0,c=c+Math.imul(j,ne)|0,n=n+Math.imul(x,ce)|0,i=(i=i+Math.imul(x,ae)|0)+Math.imul(w,ce)|0,c=c+Math.imul(w,ae)|0,n=n+Math.imul(m,oe)|0,i=(i=i+Math.imul(m,se)|0)+Math.imul(v,oe)|0,c=c+Math.imul(v,se)|0,n=n+Math.imul(h,ue)|0,i=(i=i+Math.imul(h,le)|0)+Math.imul(b,ue)|0,c=c+Math.imul(b,le)|0;var Pe=(s+(n=n+Math.imul(u,he)|0)|0)+((8191&(i=(i=i+Math.imul(u,be)|0)+Math.imul(l,he)|0))<<13)|0;s=((c=c+Math.imul(l,be)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(U,z),i=(i=Math.imul(U,K))+Math.imul(H,z)|0,c=Math.imul(H,K),n=n+Math.imul(D,G)|0,i=(i=i+Math.imul(D,X)|0)+Math.imul(B,G)|0,c=c+Math.imul(B,X)|0,n=n+Math.imul(I,J)|0,i=(i=i+Math.imul(I,Z)|0)+Math.imul(R,J)|0,c=c+Math.imul(R,Z)|0,n=n+Math.imul(T,$)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(E,$)|0,c=c+Math.imul(E,ee)|0,n=n+Math.imul(S,re)|0,i=(i=i+Math.imul(S,ne)|0)+Math.imul(_,re)|0,c=c+Math.imul(_,ne)|0,n=n+Math.imul(k,ce)|0,i=(i=i+Math.imul(k,ae)|0)+Math.imul(j,ce)|0,c=c+Math.imul(j,ae)|0,n=n+Math.imul(x,oe)|0,i=(i=i+Math.imul(x,se)|0)+Math.imul(w,oe)|0,c=c+Math.imul(w,se)|0,n=n+Math.imul(m,ue)|0,i=(i=i+Math.imul(m,le)|0)+Math.imul(v,ue)|0,c=c+Math.imul(v,le)|0;var Se=(s+(n=n+Math.imul(h,he)|0)|0)+((8191&(i=(i=i+Math.imul(h,be)|0)+Math.imul(b,he)|0))<<13)|0;s=((c=c+Math.imul(b,be)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(U,G),i=(i=Math.imul(U,X))+Math.imul(H,G)|0,c=Math.imul(H,X),n=n+Math.imul(D,J)|0,i=(i=i+Math.imul(D,Z)|0)+Math.imul(B,J)|0,c=c+Math.imul(B,Z)|0,n=n+Math.imul(I,$)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(R,$)|0,c=c+Math.imul(R,ee)|0,n=n+Math.imul(T,re)|0,i=(i=i+Math.imul(T,ne)|0)+Math.imul(E,re)|0,c=c+Math.imul(E,ne)|0,n=n+Math.imul(S,ce)|0,i=(i=i+Math.imul(S,ae)|0)+Math.imul(_,ce)|0,c=c+Math.imul(_,ae)|0,n=n+Math.imul(k,oe)|0,i=(i=i+Math.imul(k,se)|0)+Math.imul(j,oe)|0,c=c+Math.imul(j,se)|0,n=n+Math.imul(x,ue)|0,i=(i=i+Math.imul(x,le)|0)+Math.imul(w,ue)|0,c=c+Math.imul(w,le)|0;var _e=(s+(n=n+Math.imul(m,he)|0)|0)+((8191&(i=(i=i+Math.imul(m,be)|0)+Math.imul(v,he)|0))<<13)|0;s=((c=c+Math.imul(v,be)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(U,J),i=(i=Math.imul(U,Z))+Math.imul(H,J)|0,c=Math.imul(H,Z),n=n+Math.imul(D,$)|0,i=(i=i+Math.imul(D,ee)|0)+Math.imul(B,$)|0,c=c+Math.imul(B,ee)|0,n=n+Math.imul(I,re)|0,i=(i=i+Math.imul(I,ne)|0)+Math.imul(R,re)|0,c=c+Math.imul(R,ne)|0,n=n+Math.imul(T,ce)|0,i=(i=i+Math.imul(T,ae)|0)+Math.imul(E,ce)|0,c=c+Math.imul(E,ae)|0,n=n+Math.imul(S,oe)|0,i=(i=i+Math.imul(S,se)|0)+Math.imul(_,oe)|0,c=c+Math.imul(_,se)|0,n=n+Math.imul(k,ue)|0,i=(i=i+Math.imul(k,le)|0)+Math.imul(j,ue)|0,c=c+Math.imul(j,le)|0;var Me=(s+(n=n+Math.imul(x,he)|0)|0)+((8191&(i=(i=i+Math.imul(x,be)|0)+Math.imul(w,he)|0))<<13)|0;s=((c=c+Math.imul(w,be)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(U,$),i=(i=Math.imul(U,ee))+Math.imul(H,$)|0,c=Math.imul(H,ee),n=n+Math.imul(D,re)|0,i=(i=i+Math.imul(D,ne)|0)+Math.imul(B,re)|0,c=c+Math.imul(B,ne)|0,n=n+Math.imul(I,ce)|0,i=(i=i+Math.imul(I,ae)|0)+Math.imul(R,ce)|0,c=c+Math.imul(R,ae)|0,n=n+Math.imul(T,oe)|0,i=(i=i+Math.imul(T,se)|0)+Math.imul(E,oe)|0,c=c+Math.imul(E,se)|0,n=n+Math.imul(S,ue)|0,i=(i=i+Math.imul(S,le)|0)+Math.imul(_,ue)|0,c=c+Math.imul(_,le)|0;var Te=(s+(n=n+Math.imul(k,he)|0)|0)+((8191&(i=(i=i+Math.imul(k,be)|0)+Math.imul(j,he)|0))<<13)|0;s=((c=c+Math.imul(j,be)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(U,re),i=(i=Math.imul(U,ne))+Math.imul(H,re)|0,c=Math.imul(H,ne),n=n+Math.imul(D,ce)|0,i=(i=i+Math.imul(D,ae)|0)+Math.imul(B,ce)|0,c=c+Math.imul(B,ae)|0,n=n+Math.imul(I,oe)|0,i=(i=i+Math.imul(I,se)|0)+Math.imul(R,oe)|0,c=c+Math.imul(R,se)|0,n=n+Math.imul(T,ue)|0,i=(i=i+Math.imul(T,le)|0)+Math.imul(E,ue)|0,c=c+Math.imul(E,le)|0;var Ee=(s+(n=n+Math.imul(S,he)|0)|0)+((8191&(i=(i=i+Math.imul(S,be)|0)+Math.imul(_,he)|0))<<13)|0;s=((c=c+Math.imul(_,be)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(U,ce),i=(i=Math.imul(U,ae))+Math.imul(H,ce)|0,c=Math.imul(H,ae),n=n+Math.imul(D,oe)|0,i=(i=i+Math.imul(D,se)|0)+Math.imul(B,oe)|0,c=c+Math.imul(B,se)|0,n=n+Math.imul(I,ue)|0,i=(i=i+Math.imul(I,le)|0)+Math.imul(R,ue)|0,c=c+Math.imul(R,le)|0;var Ae=(s+(n=n+Math.imul(T,he)|0)|0)+((8191&(i=(i=i+Math.imul(T,be)|0)+Math.imul(E,he)|0))<<13)|0;s=((c=c+Math.imul(E,be)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(U,oe),i=(i=Math.imul(U,se))+Math.imul(H,oe)|0,c=Math.imul(H,se),n=n+Math.imul(D,ue)|0,i=(i=i+Math.imul(D,le)|0)+Math.imul(B,ue)|0,c=c+Math.imul(B,le)|0;var Ie=(s+(n=n+Math.imul(I,he)|0)|0)+((8191&(i=(i=i+Math.imul(I,be)|0)+Math.imul(R,he)|0))<<13)|0;s=((c=c+Math.imul(R,be)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(U,ue),i=(i=Math.imul(U,le))+Math.imul(H,ue)|0,c=Math.imul(H,le);var Re=(s+(n=n+Math.imul(D,he)|0)|0)+((8191&(i=(i=i+Math.imul(D,be)|0)+Math.imul(B,he)|0))<<13)|0;s=((c=c+Math.imul(B,be)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863;var Ce=(s+(n=Math.imul(U,he))|0)+((8191&(i=(i=Math.imul(U,be))+Math.imul(H,he)|0))<<13)|0;return s=((c=Math.imul(H,be))+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,o[0]=ye,o[1]=me,o[2]=ve,o[3]=ge,o[4]=xe,o[5]=we,o[6]=Oe,o[7]=ke,o[8]=je,o[9]=Pe,o[10]=Se,o[11]=_e,o[12]=Me,o[13]=Te,o[14]=Ee,o[15]=Ae,o[16]=Ie,o[17]=Re,o[18]=Ce,0!==s&&(o[19]=s,r.length++),r};function h(e,t,r){return(new b).mulp(e,t,r)}function b(e,t){this.x=e,this.y=t}Math.imul||(p=l),c.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?p(this,e,t):r<63?l(this,e,t):r<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,c=0;c>>26)|0)>>>26,a&=67108863}r.words[c]=f,n=a,a=i}return 0!==n?r.words[c]=n:r.length--,r.strip()}(this,e,t):h(this,e,t)},b.prototype.makeRBT=function(e){for(var t=new Array(e),r=c.prototype._countBits(e)-1,n=0;n>=1;return n},b.prototype.permute=function(e,t,r,n,i,c){for(var a=0;a>>=1)i++;return 1<>>=13,r[2*a+1]=8191&c,c>>>=13;for(a=2*t;a>=26,t+=i/67108864|0,t+=c>>>26,this.words[r]=67108863&c}return 0!==t&&(this.words[r]=t,this.length++),this},c.prototype.muln=function(e){return this.clone().imuln(e)},c.prototype.sqr=function(){return this.mul(this)},c.prototype.isqr=function(){return this.imul(this.clone())},c.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r>>i}return t}(e);if(0===t.length)return new c(1);for(var r=this,n=0;n=0);var t,r=e%26,i=(e-r)/26,c=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(t=0;t>>26-r}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var c=e%26,a=Math.min((e-c)/26,this.length),f=67108863^67108863>>>c<a)for(this.length-=a,s=0;s=0&&(0!==d||s>=i);s--){var u=0|this.words[s];this.words[s]=d<<26-c|u>>>c,d=u&f}return o&&0!==d&&(o.words[o.length++]=d),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},c.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},c.prototype.shln=function(e){return this.clone().ishln(e)},c.prototype.ushln=function(e){return this.clone().iushln(e)},c.prototype.shrn=function(e){return this.clone().ishrn(e)},c.prototype.ushrn=function(e){return this.clone().iushrn(e)},c.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},c.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(o/67108864|0),this.words[i+r]=67108863&c}for(;i>26,this.words[i+r]=67108863&c;if(0===f)return this.strip();for(n(-1===f),f=0,i=0;i>26,this.words[i]=67108863&c;return this.negative=1,this.strip()},c.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),i=e,a=0|i.words[i.length-1];0!==(r=26-this._countBits(a))&&(i=i.ushln(r),n.iushln(r),a=0|i.words[i.length-1]);var f,o=n.length-i.length;if("mod"!==t){(f=new c(null)).length=o+1,f.words=new Array(f.length);for(var s=0;s=0;u--){var l=67108864*(0|n.words[i.length+u])+(0|n.words[i.length+u-1]);for(l=Math.min(l/a|0,67108863),n._ishlnsubmul(i,l,u);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(i,1,u),n.isZero()||(n.negative^=1);f&&(f.words[u]=l)}return f&&f.strip(),n.strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:f||null,mod:n}},c.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new c(0),mod:new c(0)}:0!==this.negative&&0===e.negative?(f=this.neg().divmod(e,t),"mod"!==t&&(i=f.div.neg()),"div"!==t&&(a=f.mod.neg(),r&&0!==a.negative&&a.iadd(e)),{div:i,mod:a}):0===this.negative&&0!==e.negative?(f=this.divmod(e.neg(),t),"mod"!==t&&(i=f.div.neg()),{div:i,mod:f.mod}):0!=(this.negative&e.negative)?(f=this.neg().divmod(e.neg(),t),"div"!==t&&(a=f.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:f.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new c(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new c(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new c(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,a,f},c.prototype.div=function(e){return this.divmod(e,"div",!1).div},c.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},c.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},c.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),c=r.cmp(n);return c<0||1===i&&0===c?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},c.prototype.modn=function(e){n(e<=67108863);for(var t=(1<<26)%e,r=0,i=this.length-1;i>=0;i--)r=(t*r+(0|this.words[i]))%e;return r},c.prototype.idivn=function(e){n(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*t;this.words[r]=i/e|0,t=i%e}return this.strip()},c.prototype.divn=function(e){return this.clone().idivn(e)},c.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new c(1),a=new c(0),f=new c(0),o=new c(1),s=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++s;for(var d=r.clone(),u=t.clone();!t.isZero();){for(var l=0,p=1;0==(t.words[0]&p)&&l<26;++l,p<<=1);if(l>0)for(t.iushrn(l);l-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(d),a.isub(u)),i.iushrn(1),a.iushrn(1);for(var h=0,b=1;0==(r.words[0]&b)&&h<26;++h,b<<=1);if(h>0)for(r.iushrn(h);h-- >0;)(f.isOdd()||o.isOdd())&&(f.iadd(d),o.isub(u)),f.iushrn(1),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),i.isub(f),a.isub(o)):(r.isub(t),f.isub(i),o.isub(a))}return{a:f,b:o,gcd:r.iushln(s)}},c.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,a=new c(1),f=new c(0),o=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var s=0,d=1;0==(t.words[0]&d)&&s<26;++s,d<<=1);if(s>0)for(t.iushrn(s);s-- >0;)a.isOdd()&&a.iadd(o),a.iushrn(1);for(var u=0,l=1;0==(r.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(r.iushrn(u);u-- >0;)f.isOdd()&&f.iadd(o),f.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(f)):(r.isub(t),f.isub(a))}return(i=0===t.cmpn(1)?a:f).cmpn(0)<0&&i.iadd(e),i},c.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var c=t;t=r,r=c}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},c.prototype.invm=function(e){return this.egcd(e).a.umod(e)},c.prototype.isEven=function(){return 0==(1&this.words[0])},c.prototype.isOdd=function(){return 1==(1&this.words[0])},c.prototype.andln=function(e){return this.words[0]&e},c.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<>>26,f&=67108863,this.words[a]=f}return 0!==c&&(this.words[a]=c,this.length++),this},c.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},c.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){ni&&(t=1);break}}return t},c.prototype.gtn=function(e){return 1===this.cmpn(e)},c.prototype.gt=function(e){return 1===this.cmp(e)},c.prototype.gten=function(e){return this.cmpn(e)>=0},c.prototype.gte=function(e){return this.cmp(e)>=0},c.prototype.ltn=function(e){return-1===this.cmpn(e)},c.prototype.lt=function(e){return-1===this.cmp(e)},c.prototype.lten=function(e){return this.cmpn(e)<=0},c.prototype.lte=function(e){return this.cmp(e)<=0},c.prototype.eqn=function(e){return 0===this.cmpn(e)},c.prototype.eq=function(e){return 0===this.cmp(e)},c.red=function(e){return new O(e)},c.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},c.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},c.prototype._forceRed=function(e){return this.red=e,this},c.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},c.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},c.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},c.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},c.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},c.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},c.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},c.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},c.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},c.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},c.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},c.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},c.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},c.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var y={k256:null,p224:null,p192:null,p25519:null};function m(e,t){this.name=e,this.p=new c(t,16),this.n=this.p.bitLength(),this.k=new c(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){m.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function g(){m.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function x(){m.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function w(){m.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function O(e){if("string"==typeof e){var t=c._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function k(e){O.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new c(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)}m.prototype._tmp=function(){var e=new c(null);return e.words=new Array(Math.ceil(this.n/13)),e},m.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},m.prototype.split=function(e,t){e.iushrn(this.n,0,t)},m.prototype.imulK=function(e){return e.imul(this.k)},i(v,m),v.prototype.split=function(e,t){for(var r=Math.min(e.length,9),n=0;n>>22,i=c}i>>>=22,e.words[n-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},v.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},c._prime=function(e){if(y[e])return y[e];var t;if("k256"===e)t=new v;else if("p224"===e)t=new g;else if("p192"===e)t=new x;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new w}return y[e]=t,t},O.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},O.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},O.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},O.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},O.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},O.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},O.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},O.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},O.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},O.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},O.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},O.prototype.isqr=function(e){return this.imul(e,e.clone())},O.prototype.sqr=function(e){return this.mul(e,e)},O.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new c(1)).iushrn(2);return this.pow(e,r)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);n(!i.isZero());var f=new c(1).toRed(this),o=f.redNeg(),s=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new c(2*d*d).toRed(this);0!==this.pow(d,s).cmp(o);)d.redIAdd(o);for(var u=this.pow(d,i),l=this.pow(e,i.addn(1).iushrn(1)),p=this.pow(e,i),h=a;0!==p.cmp(f);){for(var b=p,y=0;0!==b.cmp(f);y++)b=b.redSqr();n(y=0;n--){for(var s=t.words[n],d=o-1;d>=0;d--){var u=s>>d&1;i!==r[0]&&(i=this.sqr(i)),0!==u||0!==a?(a<<=1,a|=u,(4===++f||0===n&&0===d)&&(i=this.mul(i,r[a]),f=0,a=0)):f=0}o=26}return i},O.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},O.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},c.mont=function(e){return new k(e)},i(k,O),k.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},k.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},k.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),c=i;return i.cmp(this.m)>=0?c=i.isub(this.m):i.cmpn(0)<0&&(c=i.iadd(this.m)),c._forceRed(this)},k.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new c(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},k.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===t||t,this)},{buffer:19}],16:[function(e,t,r){"use strict";r.byteLength=function(e){var t=s(e),r=t[0],n=t[1];return 3*(r+n)/4-n},r.toByteArray=function(e){var t,r,n=s(e),a=n[0],f=n[1],o=new c(function(e,t,r){return 3*(t+r)/4-r}(0,a,f)),d=0,u=f>0?a-4:a;for(r=0;r>16&255,o[d++]=t>>8&255,o[d++]=255&t;2===f&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,o[d++]=255&t);1===f&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,o[d++]=t>>8&255,o[d++]=255&t);return o},r.fromByteArray=function(e){for(var t,r=e.length,i=r%3,c=[],a=0,f=r-i;af?f:a+16383));1===i?(t=e[r-1],c.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],c.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return c.join("")};for(var n=[],i=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",f=0,o=a.length;f0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function d(e,t,r){for(var i,c,a=[],f=t;f>18&63]+n[c>>12&63]+n[c>>6&63]+n[63&c]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],17:[function(e,t,r){!function(t,r){"use strict";function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function c(e,t,r){if(c.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof t?t.exports=c:r.BN=c,c.BN=c,c.wordSize=26;try{a=e("buffer").Buffer}catch(e){}function f(e,t,r){for(var i=0,c=Math.min(e.length,r),a=0,f=t;f=49&&s<=54?s-49+10:s>=17&&s<=22?s-17+10:s,a|=o}return n(!(240&a),"Invalid character in "+e),i}function o(e,t,r,i){for(var c=0,a=0,f=Math.min(e.length,r),o=t;o=49?s-49+10:s>=17?s-17+10:s,n(s>=0&&a0?e:t},c.min=function(e,t){return e.cmp(t)<0?e:t},c.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&i++,16===t?this._parseHex(e,i):this._parseBase(e,t,i),"-"===e[0]&&(this.negative=1),this._strip(),"le"===r&&this._initArray(this.toArray(),t,r)},c.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},c.prototype._initArray=function(e,t,r){if(n("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[c]|=a<>>26-f&67108863,(f+=24)>=26&&(f-=26,c++);else if("le"===r)for(i=0,c=0;i>>26-f&67108863,(f+=24)>=26&&(f-=26,c++);return this._strip()},c.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r=t;r-=6)i=f(e,r,r+6),this.words[n]|=i<>>26-c&4194303,(c+=24)>=26&&(c-=26,n++);r+6!==t&&(i=f(e,t,r+6),this.words[n]|=i<>>26-c&4194303),this._strip()},c.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var c=e.length-r,a=c%n,f=Math.min(c,c-a)+r,s=0,d=r;d1&&0===this.words[this.length-1];)this.length--;return this._normSign()},c.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{c.prototype[Symbol.for("nodejs.util.inspect.custom")]=d}catch(e){c.prototype.inspect=d}else c.prototype.inspect=d;function d(){return(this.red?""}var u=["","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"],l=[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];c.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,c=0,a=0;a>>24-i&16777215)||a!==this.length-1?u[6-o.length]+o+r:o+r,(i+=2)>=26&&(i-=26,a--)}for(0!==c&&(r=c.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var s=l[e],d=p[e];r="";var h=this.clone();for(h.negative=0;!h.isZero();){var b=h.modrn(d).toString(e);r=(h=h.idivn(d)).isZero()?b+r:u[s-b.length]+b+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},c.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},c.prototype.toJSON=function(){return this.toString(16,2)},a&&(c.prototype.toBuffer=function(e,t){return this.toArrayLike(a,e,t)}),c.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function h(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],c=0|t.words[0],a=i*c,f=67108863&a,o=a/67108864|0;r.words[0]=f;for(var s=1;s>>26,u=67108863&o,l=Math.min(s,t.length-1),p=Math.max(0,s-e.length+1);p<=l;p++){var h=s-p|0;d+=(a=(i=0|e.words[h])*(c=0|t.words[p])+u)/67108864|0,u=67108863&a}r.words[s]=0|u,o=0|d}return 0!==o?r.words[s]=0|o:r.length--,r._strip()}c.prototype.toArrayLike=function(e,t,r){this._strip();var i=this.byteLength(),c=r||Math.max(1,i);n(i<=c,"byte array longer than desired length"),n(c>0,"Requested array length <= 0");var a=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,c);return this["_toArrayLike"+("le"===t?"LE":"BE")](a,i),a},c.prototype._toArrayLikeLE=function(e,t){for(var r=0,n=0,i=0,c=0;i>8&255),r>16&255),6===c?(r>24&255),n=0,c=0):(n=a>>>24,c+=2)}if(r=0&&(e[r--]=a>>8&255),r>=0&&(e[r--]=a>>16&255),6===c?(r>=0&&(e[r--]=a>>24&255),n=0,c=0):(n=a>>>24,c+=2)}if(r>=0)for(e[r--]=n;r>=0;)e[r--]=0},Math.clz32?c.prototype._countBits=function(e){return 32-Math.clz32(e)}:c.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},c.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},c.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},c.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},c.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},c.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},c.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},c.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},c.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},c.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},c.prototype.notn=function(e){return this.clone().inotn(e)},c.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,n=e):(r=e,n=this);for(var i=0,c=0;c>>26;for(;0!==i&&c>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ce.length?this.clone().iadd(e):e.clone().iadd(this)},c.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=e):(r=e,n=this);for(var c=0,a=0;a>26,this.words[a]=67108863&t;for(;0!==c&&a>26,this.words[a]=67108863&t;if(0===c&&a>>13,p=0|a[1],h=8191&p,b=p>>>13,y=0|a[2],m=8191&y,v=y>>>13,g=0|a[3],x=8191&g,w=g>>>13,O=0|a[4],k=8191&O,j=O>>>13,P=0|a[5],S=8191&P,_=P>>>13,M=0|a[6],T=8191&M,E=M>>>13,A=0|a[7],I=8191&A,R=A>>>13,C=0|a[8],D=8191&C,B=C>>>13,N=0|a[9],U=8191&N,H=N>>>13,L=0|f[0],V=8191&L,q=L>>>13,F=0|f[1],z=8191&F,K=F>>>13,W=0|f[2],G=8191&W,X=W>>>13,Y=0|f[3],J=8191&Y,Z=Y>>>13,Q=0|f[4],$=8191&Q,ee=Q>>>13,te=0|f[5],re=8191&te,ne=te>>>13,ie=0|f[6],ce=8191&ie,ae=ie>>>13,fe=0|f[7],oe=8191&fe,se=fe>>>13,de=0|f[8],ue=8191&de,le=de>>>13,pe=0|f[9],he=8191&pe,be=pe>>>13;r.negative=e.negative^t.negative,r.length=19;var ye=(s+(n=Math.imul(u,V))|0)+((8191&(i=(i=Math.imul(u,q))+Math.imul(l,V)|0))<<13)|0;s=((c=Math.imul(l,q))+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(h,V),i=(i=Math.imul(h,q))+Math.imul(b,V)|0,c=Math.imul(b,q);var me=(s+(n=n+Math.imul(u,z)|0)|0)+((8191&(i=(i=i+Math.imul(u,K)|0)+Math.imul(l,z)|0))<<13)|0;s=((c=c+Math.imul(l,K)|0)+(i>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(m,V),i=(i=Math.imul(m,q))+Math.imul(v,V)|0,c=Math.imul(v,q),n=n+Math.imul(h,z)|0,i=(i=i+Math.imul(h,K)|0)+Math.imul(b,z)|0,c=c+Math.imul(b,K)|0;var ve=(s+(n=n+Math.imul(u,G)|0)|0)+((8191&(i=(i=i+Math.imul(u,X)|0)+Math.imul(l,G)|0))<<13)|0;s=((c=c+Math.imul(l,X)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(x,V),i=(i=Math.imul(x,q))+Math.imul(w,V)|0,c=Math.imul(w,q),n=n+Math.imul(m,z)|0,i=(i=i+Math.imul(m,K)|0)+Math.imul(v,z)|0,c=c+Math.imul(v,K)|0,n=n+Math.imul(h,G)|0,i=(i=i+Math.imul(h,X)|0)+Math.imul(b,G)|0,c=c+Math.imul(b,X)|0;var ge=(s+(n=n+Math.imul(u,J)|0)|0)+((8191&(i=(i=i+Math.imul(u,Z)|0)+Math.imul(l,J)|0))<<13)|0;s=((c=c+Math.imul(l,Z)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(k,V),i=(i=Math.imul(k,q))+Math.imul(j,V)|0,c=Math.imul(j,q),n=n+Math.imul(x,z)|0,i=(i=i+Math.imul(x,K)|0)+Math.imul(w,z)|0,c=c+Math.imul(w,K)|0,n=n+Math.imul(m,G)|0,i=(i=i+Math.imul(m,X)|0)+Math.imul(v,G)|0,c=c+Math.imul(v,X)|0,n=n+Math.imul(h,J)|0,i=(i=i+Math.imul(h,Z)|0)+Math.imul(b,J)|0,c=c+Math.imul(b,Z)|0;var xe=(s+(n=n+Math.imul(u,$)|0)|0)+((8191&(i=(i=i+Math.imul(u,ee)|0)+Math.imul(l,$)|0))<<13)|0;s=((c=c+Math.imul(l,ee)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(S,V),i=(i=Math.imul(S,q))+Math.imul(_,V)|0,c=Math.imul(_,q),n=n+Math.imul(k,z)|0,i=(i=i+Math.imul(k,K)|0)+Math.imul(j,z)|0,c=c+Math.imul(j,K)|0,n=n+Math.imul(x,G)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(w,G)|0,c=c+Math.imul(w,X)|0,n=n+Math.imul(m,J)|0,i=(i=i+Math.imul(m,Z)|0)+Math.imul(v,J)|0,c=c+Math.imul(v,Z)|0,n=n+Math.imul(h,$)|0,i=(i=i+Math.imul(h,ee)|0)+Math.imul(b,$)|0,c=c+Math.imul(b,ee)|0;var we=(s+(n=n+Math.imul(u,re)|0)|0)+((8191&(i=(i=i+Math.imul(u,ne)|0)+Math.imul(l,re)|0))<<13)|0;s=((c=c+Math.imul(l,ne)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(T,V),i=(i=Math.imul(T,q))+Math.imul(E,V)|0,c=Math.imul(E,q),n=n+Math.imul(S,z)|0,i=(i=i+Math.imul(S,K)|0)+Math.imul(_,z)|0,c=c+Math.imul(_,K)|0,n=n+Math.imul(k,G)|0,i=(i=i+Math.imul(k,X)|0)+Math.imul(j,G)|0,c=c+Math.imul(j,X)|0,n=n+Math.imul(x,J)|0,i=(i=i+Math.imul(x,Z)|0)+Math.imul(w,J)|0,c=c+Math.imul(w,Z)|0,n=n+Math.imul(m,$)|0,i=(i=i+Math.imul(m,ee)|0)+Math.imul(v,$)|0,c=c+Math.imul(v,ee)|0,n=n+Math.imul(h,re)|0,i=(i=i+Math.imul(h,ne)|0)+Math.imul(b,re)|0,c=c+Math.imul(b,ne)|0;var Oe=(s+(n=n+Math.imul(u,ce)|0)|0)+((8191&(i=(i=i+Math.imul(u,ae)|0)+Math.imul(l,ce)|0))<<13)|0;s=((c=c+Math.imul(l,ae)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(I,V),i=(i=Math.imul(I,q))+Math.imul(R,V)|0,c=Math.imul(R,q),n=n+Math.imul(T,z)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(E,z)|0,c=c+Math.imul(E,K)|0,n=n+Math.imul(S,G)|0,i=(i=i+Math.imul(S,X)|0)+Math.imul(_,G)|0,c=c+Math.imul(_,X)|0,n=n+Math.imul(k,J)|0,i=(i=i+Math.imul(k,Z)|0)+Math.imul(j,J)|0,c=c+Math.imul(j,Z)|0,n=n+Math.imul(x,$)|0,i=(i=i+Math.imul(x,ee)|0)+Math.imul(w,$)|0,c=c+Math.imul(w,ee)|0,n=n+Math.imul(m,re)|0,i=(i=i+Math.imul(m,ne)|0)+Math.imul(v,re)|0,c=c+Math.imul(v,ne)|0,n=n+Math.imul(h,ce)|0,i=(i=i+Math.imul(h,ae)|0)+Math.imul(b,ce)|0,c=c+Math.imul(b,ae)|0;var ke=(s+(n=n+Math.imul(u,oe)|0)|0)+((8191&(i=(i=i+Math.imul(u,se)|0)+Math.imul(l,oe)|0))<<13)|0;s=((c=c+Math.imul(l,se)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(D,V),i=(i=Math.imul(D,q))+Math.imul(B,V)|0,c=Math.imul(B,q),n=n+Math.imul(I,z)|0,i=(i=i+Math.imul(I,K)|0)+Math.imul(R,z)|0,c=c+Math.imul(R,K)|0,n=n+Math.imul(T,G)|0,i=(i=i+Math.imul(T,X)|0)+Math.imul(E,G)|0,c=c+Math.imul(E,X)|0,n=n+Math.imul(S,J)|0,i=(i=i+Math.imul(S,Z)|0)+Math.imul(_,J)|0,c=c+Math.imul(_,Z)|0,n=n+Math.imul(k,$)|0,i=(i=i+Math.imul(k,ee)|0)+Math.imul(j,$)|0,c=c+Math.imul(j,ee)|0,n=n+Math.imul(x,re)|0,i=(i=i+Math.imul(x,ne)|0)+Math.imul(w,re)|0,c=c+Math.imul(w,ne)|0,n=n+Math.imul(m,ce)|0,i=(i=i+Math.imul(m,ae)|0)+Math.imul(v,ce)|0,c=c+Math.imul(v,ae)|0,n=n+Math.imul(h,oe)|0,i=(i=i+Math.imul(h,se)|0)+Math.imul(b,oe)|0,c=c+Math.imul(b,se)|0;var je=(s+(n=n+Math.imul(u,ue)|0)|0)+((8191&(i=(i=i+Math.imul(u,le)|0)+Math.imul(l,ue)|0))<<13)|0;s=((c=c+Math.imul(l,le)|0)+(i>>>13)|0)+(je>>>26)|0,je&=67108863,n=Math.imul(U,V),i=(i=Math.imul(U,q))+Math.imul(H,V)|0,c=Math.imul(H,q),n=n+Math.imul(D,z)|0,i=(i=i+Math.imul(D,K)|0)+Math.imul(B,z)|0,c=c+Math.imul(B,K)|0,n=n+Math.imul(I,G)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(R,G)|0,c=c+Math.imul(R,X)|0,n=n+Math.imul(T,J)|0,i=(i=i+Math.imul(T,Z)|0)+Math.imul(E,J)|0,c=c+Math.imul(E,Z)|0,n=n+Math.imul(S,$)|0,i=(i=i+Math.imul(S,ee)|0)+Math.imul(_,$)|0,c=c+Math.imul(_,ee)|0,n=n+Math.imul(k,re)|0,i=(i=i+Math.imul(k,ne)|0)+Math.imul(j,re)|0,c=c+Math.imul(j,ne)|0,n=n+Math.imul(x,ce)|0,i=(i=i+Math.imul(x,ae)|0)+Math.imul(w,ce)|0,c=c+Math.imul(w,ae)|0,n=n+Math.imul(m,oe)|0,i=(i=i+Math.imul(m,se)|0)+Math.imul(v,oe)|0,c=c+Math.imul(v,se)|0,n=n+Math.imul(h,ue)|0,i=(i=i+Math.imul(h,le)|0)+Math.imul(b,ue)|0,c=c+Math.imul(b,le)|0;var Pe=(s+(n=n+Math.imul(u,he)|0)|0)+((8191&(i=(i=i+Math.imul(u,be)|0)+Math.imul(l,he)|0))<<13)|0;s=((c=c+Math.imul(l,be)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(U,z),i=(i=Math.imul(U,K))+Math.imul(H,z)|0,c=Math.imul(H,K),n=n+Math.imul(D,G)|0,i=(i=i+Math.imul(D,X)|0)+Math.imul(B,G)|0,c=c+Math.imul(B,X)|0,n=n+Math.imul(I,J)|0,i=(i=i+Math.imul(I,Z)|0)+Math.imul(R,J)|0,c=c+Math.imul(R,Z)|0,n=n+Math.imul(T,$)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(E,$)|0,c=c+Math.imul(E,ee)|0,n=n+Math.imul(S,re)|0,i=(i=i+Math.imul(S,ne)|0)+Math.imul(_,re)|0,c=c+Math.imul(_,ne)|0,n=n+Math.imul(k,ce)|0,i=(i=i+Math.imul(k,ae)|0)+Math.imul(j,ce)|0,c=c+Math.imul(j,ae)|0,n=n+Math.imul(x,oe)|0,i=(i=i+Math.imul(x,se)|0)+Math.imul(w,oe)|0,c=c+Math.imul(w,se)|0,n=n+Math.imul(m,ue)|0,i=(i=i+Math.imul(m,le)|0)+Math.imul(v,ue)|0,c=c+Math.imul(v,le)|0;var Se=(s+(n=n+Math.imul(h,he)|0)|0)+((8191&(i=(i=i+Math.imul(h,be)|0)+Math.imul(b,he)|0))<<13)|0;s=((c=c+Math.imul(b,be)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(U,G),i=(i=Math.imul(U,X))+Math.imul(H,G)|0,c=Math.imul(H,X),n=n+Math.imul(D,J)|0,i=(i=i+Math.imul(D,Z)|0)+Math.imul(B,J)|0,c=c+Math.imul(B,Z)|0,n=n+Math.imul(I,$)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(R,$)|0,c=c+Math.imul(R,ee)|0,n=n+Math.imul(T,re)|0,i=(i=i+Math.imul(T,ne)|0)+Math.imul(E,re)|0,c=c+Math.imul(E,ne)|0,n=n+Math.imul(S,ce)|0,i=(i=i+Math.imul(S,ae)|0)+Math.imul(_,ce)|0,c=c+Math.imul(_,ae)|0,n=n+Math.imul(k,oe)|0,i=(i=i+Math.imul(k,se)|0)+Math.imul(j,oe)|0,c=c+Math.imul(j,se)|0,n=n+Math.imul(x,ue)|0,i=(i=i+Math.imul(x,le)|0)+Math.imul(w,ue)|0,c=c+Math.imul(w,le)|0;var _e=(s+(n=n+Math.imul(m,he)|0)|0)+((8191&(i=(i=i+Math.imul(m,be)|0)+Math.imul(v,he)|0))<<13)|0;s=((c=c+Math.imul(v,be)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(U,J),i=(i=Math.imul(U,Z))+Math.imul(H,J)|0,c=Math.imul(H,Z),n=n+Math.imul(D,$)|0,i=(i=i+Math.imul(D,ee)|0)+Math.imul(B,$)|0,c=c+Math.imul(B,ee)|0,n=n+Math.imul(I,re)|0,i=(i=i+Math.imul(I,ne)|0)+Math.imul(R,re)|0,c=c+Math.imul(R,ne)|0,n=n+Math.imul(T,ce)|0,i=(i=i+Math.imul(T,ae)|0)+Math.imul(E,ce)|0,c=c+Math.imul(E,ae)|0,n=n+Math.imul(S,oe)|0,i=(i=i+Math.imul(S,se)|0)+Math.imul(_,oe)|0,c=c+Math.imul(_,se)|0,n=n+Math.imul(k,ue)|0,i=(i=i+Math.imul(k,le)|0)+Math.imul(j,ue)|0,c=c+Math.imul(j,le)|0;var Me=(s+(n=n+Math.imul(x,he)|0)|0)+((8191&(i=(i=i+Math.imul(x,be)|0)+Math.imul(w,he)|0))<<13)|0;s=((c=c+Math.imul(w,be)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(U,$),i=(i=Math.imul(U,ee))+Math.imul(H,$)|0,c=Math.imul(H,ee),n=n+Math.imul(D,re)|0,i=(i=i+Math.imul(D,ne)|0)+Math.imul(B,re)|0,c=c+Math.imul(B,ne)|0,n=n+Math.imul(I,ce)|0,i=(i=i+Math.imul(I,ae)|0)+Math.imul(R,ce)|0,c=c+Math.imul(R,ae)|0,n=n+Math.imul(T,oe)|0,i=(i=i+Math.imul(T,se)|0)+Math.imul(E,oe)|0,c=c+Math.imul(E,se)|0,n=n+Math.imul(S,ue)|0,i=(i=i+Math.imul(S,le)|0)+Math.imul(_,ue)|0,c=c+Math.imul(_,le)|0;var Te=(s+(n=n+Math.imul(k,he)|0)|0)+((8191&(i=(i=i+Math.imul(k,be)|0)+Math.imul(j,he)|0))<<13)|0;s=((c=c+Math.imul(j,be)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(U,re),i=(i=Math.imul(U,ne))+Math.imul(H,re)|0,c=Math.imul(H,ne),n=n+Math.imul(D,ce)|0,i=(i=i+Math.imul(D,ae)|0)+Math.imul(B,ce)|0,c=c+Math.imul(B,ae)|0,n=n+Math.imul(I,oe)|0,i=(i=i+Math.imul(I,se)|0)+Math.imul(R,oe)|0,c=c+Math.imul(R,se)|0,n=n+Math.imul(T,ue)|0,i=(i=i+Math.imul(T,le)|0)+Math.imul(E,ue)|0,c=c+Math.imul(E,le)|0;var Ee=(s+(n=n+Math.imul(S,he)|0)|0)+((8191&(i=(i=i+Math.imul(S,be)|0)+Math.imul(_,he)|0))<<13)|0;s=((c=c+Math.imul(_,be)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(U,ce),i=(i=Math.imul(U,ae))+Math.imul(H,ce)|0,c=Math.imul(H,ae),n=n+Math.imul(D,oe)|0,i=(i=i+Math.imul(D,se)|0)+Math.imul(B,oe)|0,c=c+Math.imul(B,se)|0,n=n+Math.imul(I,ue)|0,i=(i=i+Math.imul(I,le)|0)+Math.imul(R,ue)|0,c=c+Math.imul(R,le)|0;var Ae=(s+(n=n+Math.imul(T,he)|0)|0)+((8191&(i=(i=i+Math.imul(T,be)|0)+Math.imul(E,he)|0))<<13)|0;s=((c=c+Math.imul(E,be)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(U,oe),i=(i=Math.imul(U,se))+Math.imul(H,oe)|0,c=Math.imul(H,se),n=n+Math.imul(D,ue)|0,i=(i=i+Math.imul(D,le)|0)+Math.imul(B,ue)|0,c=c+Math.imul(B,le)|0;var Ie=(s+(n=n+Math.imul(I,he)|0)|0)+((8191&(i=(i=i+Math.imul(I,be)|0)+Math.imul(R,he)|0))<<13)|0;s=((c=c+Math.imul(R,be)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(U,ue),i=(i=Math.imul(U,le))+Math.imul(H,ue)|0,c=Math.imul(H,le);var Re=(s+(n=n+Math.imul(D,he)|0)|0)+((8191&(i=(i=i+Math.imul(D,be)|0)+Math.imul(B,he)|0))<<13)|0;s=((c=c+Math.imul(B,be)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863;var Ce=(s+(n=Math.imul(U,he))|0)+((8191&(i=(i=Math.imul(U,be))+Math.imul(H,he)|0))<<13)|0;return s=((c=Math.imul(H,be))+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,o[0]=ye,o[1]=me,o[2]=ve,o[3]=ge,o[4]=xe,o[5]=we,o[6]=Oe,o[7]=ke,o[8]=je,o[9]=Pe,o[10]=Se,o[11]=_e,o[12]=Me,o[13]=Te,o[14]=Ee,o[15]=Ae,o[16]=Ie,o[17]=Re,o[18]=Ce,0!==s&&(o[19]=s,r.length++),r};function y(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,c=0;c>>26)|0)>>>26,a&=67108863}r.words[c]=f,n=a,a=i}return 0!==n?r.words[c]=n:r.length--,r._strip()}function m(e,t,r){return y(e,t,r)}function v(e,t){this.x=e,this.y=t}Math.imul||(b=h),c.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?b(this,e,t):r<63?h(this,e,t):r<1024?y(this,e,t):m(this,e,t)},v.prototype.makeRBT=function(e){for(var t=new Array(e),r=c.prototype._countBits(e)-1,n=0;n>=1;return n},v.prototype.permute=function(e,t,r,n,i,c){for(var a=0;a>>=1)i++;return 1<>>=13,r[2*a+1]=8191&c,c>>>=13;for(a=2*t;a>=26,r+=c/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),t?this.ineg():this},c.prototype.muln=function(e){return this.clone().imuln(e)},c.prototype.sqr=function(){return this.mul(this)},c.prototype.isqr=function(){return this.imul(this.clone())},c.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r>>i&1}return t}(e);if(0===t.length)return new c(1);for(var r=this,n=0;n=0);var t,r=e%26,i=(e-r)/26,c=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(t=0;t>>26-r}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var c=e%26,a=Math.min((e-c)/26,this.length),f=67108863^67108863>>>c<a)for(this.length-=a,s=0;s=0&&(0!==d||s>=i);s--){var u=0|this.words[s];this.words[s]=d<<26-c|u>>>c,d=u&f}return o&&0!==d&&(o.words[o.length++]=d),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},c.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},c.prototype.shln=function(e){return this.clone().ishln(e)},c.prototype.ushln=function(e){return this.clone().iushln(e)},c.prototype.shrn=function(e){return this.clone().ishrn(e)},c.prototype.ushrn=function(e){return this.clone().iushrn(e)},c.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},c.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(o/67108864|0),this.words[i+r]=67108863&c}for(;i>26,this.words[i+r]=67108863&c;if(0===f)return this._strip();for(n(-1===f),f=0,i=0;i>26,this.words[i]=67108863&c;return this.negative=1,this._strip()},c.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),i=e,a=0|i.words[i.length-1];0!==(r=26-this._countBits(a))&&(i=i.ushln(r),n.iushln(r),a=0|i.words[i.length-1]);var f,o=n.length-i.length;if("mod"!==t){(f=new c(null)).length=o+1,f.words=new Array(f.length);for(var s=0;s=0;u--){var l=67108864*(0|n.words[i.length+u])+(0|n.words[i.length+u-1]);for(l=Math.min(l/a|0,67108863),n._ishlnsubmul(i,l,u);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(i,1,u),n.isZero()||(n.negative^=1);f&&(f.words[u]=l)}return f&&f._strip(),n._strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:f||null,mod:n}},c.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new c(0),mod:new c(0)}:0!==this.negative&&0===e.negative?(f=this.neg().divmod(e,t),"mod"!==t&&(i=f.div.neg()),"div"!==t&&(a=f.mod.neg(),r&&0!==a.negative&&a.iadd(e)),{div:i,mod:a}):0===this.negative&&0!==e.negative?(f=this.divmod(e.neg(),t),"mod"!==t&&(i=f.div.neg()),{div:i,mod:f.mod}):0!=(this.negative&e.negative)?(f=this.neg().divmod(e.neg(),t),"div"!==t&&(a=f.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:f.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new c(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new c(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new c(this.modrn(e.words[0]))}:this._wordDiv(e,t);var i,a,f},c.prototype.div=function(e){return this.divmod(e,"div",!1).div},c.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},c.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},c.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),c=r.cmp(n);return c<0||1===i&&0===c?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},c.prototype.modrn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=(1<<26)%e,i=0,c=this.length-1;c>=0;c--)i=(r*i+(0|this.words[c]))%e;return t?-i:i},c.prototype.modn=function(e){return this.modrn(e)},c.prototype.idivn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var c=(0|this.words[i])+67108864*r;this.words[i]=c/e|0,r=c%e}return this._strip(),t?this.ineg():this},c.prototype.divn=function(e){return this.clone().idivn(e)},c.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new c(1),a=new c(0),f=new c(0),o=new c(1),s=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++s;for(var d=r.clone(),u=t.clone();!t.isZero();){for(var l=0,p=1;0==(t.words[0]&p)&&l<26;++l,p<<=1);if(l>0)for(t.iushrn(l);l-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(d),a.isub(u)),i.iushrn(1),a.iushrn(1);for(var h=0,b=1;0==(r.words[0]&b)&&h<26;++h,b<<=1);if(h>0)for(r.iushrn(h);h-- >0;)(f.isOdd()||o.isOdd())&&(f.iadd(d),o.isub(u)),f.iushrn(1),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),i.isub(f),a.isub(o)):(r.isub(t),f.isub(i),o.isub(a))}return{a:f,b:o,gcd:r.iushln(s)}},c.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,a=new c(1),f=new c(0),o=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var s=0,d=1;0==(t.words[0]&d)&&s<26;++s,d<<=1);if(s>0)for(t.iushrn(s);s-- >0;)a.isOdd()&&a.iadd(o),a.iushrn(1);for(var u=0,l=1;0==(r.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(r.iushrn(u);u-- >0;)f.isOdd()&&f.iadd(o),f.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(f)):(r.isub(t),f.isub(a))}return(i=0===t.cmpn(1)?a:f).cmpn(0)<0&&i.iadd(e),i},c.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var c=t;t=r,r=c}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},c.prototype.invm=function(e){return this.egcd(e).a.umod(e)},c.prototype.isEven=function(){return 0==(1&this.words[0])},c.prototype.isOdd=function(){return 1==(1&this.words[0])},c.prototype.andln=function(e){return this.words[0]&e},c.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<>>26,f&=67108863,this.words[a]=f}return 0!==c&&(this.words[a]=c,this.length++),this},c.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},c.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){ni&&(t=1);break}}return t},c.prototype.gtn=function(e){return 1===this.cmpn(e)},c.prototype.gt=function(e){return 1===this.cmp(e)},c.prototype.gten=function(e){return this.cmpn(e)>=0},c.prototype.gte=function(e){return this.cmp(e)>=0},c.prototype.ltn=function(e){return-1===this.cmpn(e)},c.prototype.lt=function(e){return-1===this.cmp(e)},c.prototype.lten=function(e){return this.cmpn(e)<=0},c.prototype.lte=function(e){return this.cmp(e)<=0},c.prototype.eqn=function(e){return 0===this.cmpn(e)},c.prototype.eq=function(e){return 0===this.cmp(e)},c.red=function(e){return new P(e)},c.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},c.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},c.prototype._forceRed=function(e){return this.red=e,this},c.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},c.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},c.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},c.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},c.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},c.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},c.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},c.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},c.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},c.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},c.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},c.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},c.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},c.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var g={k256:null,p224:null,p192:null,p25519:null};function x(e,t){this.name=e,this.p=new c(t,16),this.n=this.p.bitLength(),this.k=new c(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){x.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function O(){x.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function k(){x.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function j(){x.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function P(e){if("string"==typeof e){var t=c._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function S(e){P.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new c(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)}x.prototype._tmp=function(){var e=new c(null);return e.words=new Array(Math.ceil(this.n/13)),e},x.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},x.prototype.split=function(e,t){e.iushrn(this.n,0,t)},x.prototype.imulK=function(e){return e.imul(this.k)},i(w,x),w.prototype.split=function(e,t){for(var r=Math.min(e.length,9),n=0;n>>22,i=c}i>>>=22,e.words[n-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},w.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},c._prime=function(e){if(g[e])return g[e];var t;if("k256"===e)t=new w;else if("p224"===e)t=new O;else if("p192"===e)t=new k;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new j}return g[e]=t,t},P.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},P.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},P.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(s(e,e.umod(this.m)._forceRed(this)),e)},P.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},P.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},P.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},P.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},P.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},P.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},P.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},P.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},P.prototype.isqr=function(e){return this.imul(e,e.clone())},P.prototype.sqr=function(e){return this.mul(e,e)},P.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new c(1)).iushrn(2);return this.pow(e,r)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);n(!i.isZero());var f=new c(1).toRed(this),o=f.redNeg(),s=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new c(2*d*d).toRed(this);0!==this.pow(d,s).cmp(o);)d.redIAdd(o);for(var u=this.pow(d,i),l=this.pow(e,i.addn(1).iushrn(1)),p=this.pow(e,i),h=a;0!==p.cmp(f);){for(var b=p,y=0;0!==b.cmp(f);y++)b=b.redSqr();n(y=0;n--){for(var s=t.words[n],d=o-1;d>=0;d--){var u=s>>d&1;i!==r[0]&&(i=this.sqr(i)),0!==u||0!==a?(a<<=1,a|=u,(4===++f||0===n&&0===d)&&(i=this.mul(i,r[a]),f=0,a=0)):f=0}o=26}return i},P.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},P.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},c.mont=function(e){return new S(e)},i(S,P),S.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},S.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},S.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),c=i;return i.cmp(this.m)>=0?c=i.isub(this.m):i.cmpn(0)<0&&(c=i.iadd(this.m)),c._forceRed(this)},S.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new c(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},S.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===t||t,this)},{buffer:19}],18:[function(e,t,r){var n;function i(e){this.rand=e}if(t.exports=function(e){return n||(n=new i(null)),n.generate(e)},t.exports.Rand=i,i.prototype.generate=function(e){return this._rand(e)},i.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r>>24]^d[h>>>16&255]^u[b>>>8&255]^l[255&y]^t[m++],a=s[h>>>24]^d[b>>>16&255]^u[y>>>8&255]^l[255&p]^t[m++],f=s[b>>>24]^d[y>>>16&255]^u[p>>>8&255]^l[255&h]^t[m++],o=s[y>>>24]^d[p>>>16&255]^u[h>>>8&255]^l[255&b]^t[m++],p=c,h=a,b=f,y=o;return c=(n[p>>>24]<<24|n[h>>>16&255]<<16|n[b>>>8&255]<<8|n[255&y])^t[m++],a=(n[h>>>24]<<24|n[b>>>16&255]<<16|n[y>>>8&255]<<8|n[255&p])^t[m++],f=(n[b>>>24]<<24|n[y>>>16&255]<<16|n[p>>>8&255]<<8|n[255&h])^t[m++],o=(n[y>>>24]<<24|n[p>>>16&255]<<16|n[h>>>8&255]<<8|n[255&b])^t[m++],[c>>>=0,a>>>=0,f>>>=0,o>>>=0]}var f=[0,1,2,4,8,16,32,64,128,27,54],o=function(){for(var e=new Array(256),t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;for(var r=[],n=[],i=[[],[],[],[]],c=[[],[],[],[]],a=0,f=0,o=0;o<256;++o){var s=f^f<<1^f<<2^f<<3^f<<4;s=s>>>8^255&s^99,r[a]=s,n[s]=a;var d=e[a],u=e[d],l=e[u],p=257*e[s]^16843008*s;i[0][a]=p<<24|p>>>8,i[1][a]=p<<16|p>>>16,i[2][a]=p<<8|p>>>24,i[3][a]=p,p=16843009*l^65537*u^257*d^16843008*a,c[0][s]=p<<24|p>>>8,c[1][s]=p<<16|p>>>16,c[2][s]=p<<8|p>>>24,c[3][s]=p,0===a?a=f=1:(a=d^e[e[e[l^d]]],f^=e[e[f]])}return{SBOX:r,INV_SBOX:n,SUB_MIX:i,INV_SUB_MIX:c}}();function s(e){this._key=i(e),this._reset()}s.blockSize=16,s.keySize=32,s.prototype.blockSize=s.blockSize,s.prototype.keySize=s.keySize,s.prototype._reset=function(){for(var e=this._key,t=e.length,r=t+6,n=4*(r+1),i=[],c=0;c>>24,a=o.SBOX[a>>>24]<<24|o.SBOX[a>>>16&255]<<16|o.SBOX[a>>>8&255]<<8|o.SBOX[255&a],a^=f[c/t|0]<<24):t>6&&c%t==4&&(a=o.SBOX[a>>>24]<<24|o.SBOX[a>>>16&255]<<16|o.SBOX[a>>>8&255]<<8|o.SBOX[255&a]),i[c]=i[c-t]^a}for(var s=[],d=0;d>>24]]^o.INV_SUB_MIX[1][o.SBOX[l>>>16&255]]^o.INV_SUB_MIX[2][o.SBOX[l>>>8&255]]^o.INV_SUB_MIX[3][o.SBOX[255&l]]}this._nRounds=r,this._keySchedule=i,this._invKeySchedule=s},s.prototype.encryptBlockRaw=function(e){return a(e=i(e),this._keySchedule,o.SUB_MIX,o.SBOX,this._nRounds)},s.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),r=n.allocUnsafe(16);return r.writeUInt32BE(t[0],0),r.writeUInt32BE(t[1],4),r.writeUInt32BE(t[2],8),r.writeUInt32BE(t[3],12),r},s.prototype.decryptBlock=function(e){var t=(e=i(e))[1];e[1]=e[3],e[3]=t;var r=a(e,this._invKeySchedule,o.INV_SUB_MIX,o.INV_SBOX,this._nRounds),c=n.allocUnsafe(16);return c.writeUInt32BE(r[0],0),c.writeUInt32BE(r[3],4),c.writeUInt32BE(r[2],8),c.writeUInt32BE(r[1],12),c},s.prototype.scrub=function(){c(this._keySchedule),c(this._invKeySchedule),c(this._key)},t.exports.AES=s},{"safe-buffer":161}],21:[function(e,t,r){var n=e("./aes"),i=e("safe-buffer").Buffer,c=e("cipher-base"),a=e("inherits"),f=e("./ghash"),o=e("buffer-xor"),s=e("./incr32");function d(e,t,r,a){c.call(this);var o=i.alloc(4,0);this._cipher=new n.AES(t);var d=this._cipher.encryptBlock(o);this._ghash=new f(d),r=function(e,t,r){if(12===t.length)return e._finID=i.concat([t,i.from([0,0,0,1])]),i.concat([t,i.from([0,0,0,2])]);var n=new f(r),c=t.length,a=c%16;n.update(t),a&&(a=16-a,n.update(i.alloc(a,0))),n.update(i.alloc(8,0));var o=8*c,d=i.alloc(8);d.writeUIntBE(o,0,8),n.update(d),e._finID=n.state;var u=i.from(e._finID);return s(u),u}(this,r,d),this._prev=i.from(r),this._cache=i.allocUnsafe(0),this._secCache=i.allocUnsafe(0),this._decrypt=a,this._alen=0,this._len=0,this._mode=e,this._authTag=null,this._called=!1}a(d,c),d.prototype._update=function(e){if(!this._called&&this._alen){var t=16-this._alen%16;t<16&&(t=i.alloc(t,0),this._ghash.update(t))}this._called=!0;var r=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(r),this._len+=e.length,r},d.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var e=o(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(e,t){var r=0;e.length!==t.length&&r++;for(var n=Math.min(e.length,t.length),i=0;i16)throw new Error("unable to decrypt data");var r=-1;for(;++r16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t}else if(this.cache.length>=16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t;return null},u.prototype.flush=function(){if(this.cache.length)return this.cache},r.createDecipher=function(e,t){var r=c[e.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var n=s(t,!1,r.key,r.iv);return l(e,n.key,n.iv)},r.createDecipheriv=l},{"./aes":20,"./authCipher":21,"./modes":33,"./streamCipher":36,"cipher-base":64,evp_bytestokey:101,inherits:132,"safe-buffer":161}],24:[function(e,t,r){var n=e("./modes"),i=e("./authCipher"),c=e("safe-buffer").Buffer,a=e("./streamCipher"),f=e("cipher-base"),o=e("./aes"),s=e("evp_bytestokey");function d(e,t,r){f.call(this),this._cache=new l,this._cipher=new o.AES(t),this._prev=c.from(r),this._mode=e,this._autopadding=!0}e("inherits")(d,f),d.prototype._update=function(e){var t,r;this._cache.add(e);for(var n=[];t=this._cache.get();)r=this._mode.encrypt(this,t),n.push(r);return c.concat(n)};var u=c.alloc(16,16);function l(){this.cache=c.allocUnsafe(0)}function p(e,t,r){var f=n[e.toLowerCase()];if(!f)throw new TypeError("invalid suite type");if("string"==typeof t&&(t=c.from(t)),t.length!==f.key/8)throw new TypeError("invalid key length "+t.length);if("string"==typeof r&&(r=c.from(r)),"GCM"!==f.mode&&r.length!==f.iv)throw new TypeError("invalid iv length "+r.length);return"stream"===f.type?new a(f.module,t,r):"auth"===f.type?new i(f.module,t,r):new d(f.module,t,r)}d.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return e=this._mode.encrypt(this,e),this._cipher.scrub(),e;if(!e.equals(u))throw this._cipher.scrub(),new Error("data not multiple of block length")},d.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},l.prototype.add=function(e){this.cache=c.concat([this.cache,e])},l.prototype.get=function(){if(this.cache.length>15){var e=this.cache.slice(0,16);return this.cache=this.cache.slice(16),e}return null},l.prototype.flush=function(){for(var e=16-this.cache.length,t=c.allocUnsafe(e),r=-1;++r>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function a(e){this.h=e,this.state=n.alloc(16,0),this.cache=n.allocUnsafe(0)}a.prototype.ghash=function(e){for(var t=-1;++t0;t--)n[t]=n[t]>>>1|(1&n[t-1])<<31;n[0]=n[0]>>>1,r&&(n[0]=n[0]^225<<24)}this.state=c(i)},a.prototype.update=function(e){var t;for(this.cache=n.concat([this.cache,e]);this.cache.length>=16;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)},a.prototype.final=function(e,t){return this.cache.length&&this.ghash(n.concat([this.cache,i],16)),this.ghash(c([0,e,0,t])),this.state},t.exports=a},{"safe-buffer":161}],26:[function(e,t,r){t.exports=function(e){for(var t,r=e.length;r--;){if(255!==(t=e.readUInt8(r))){t++,e.writeUInt8(t,r);break}e.writeUInt8(0,r)}}},{}],27:[function(e,t,r){var n=e("buffer-xor");r.encrypt=function(e,t){var r=n(t,e._prev);return e._prev=e._cipher.encryptBlock(r),e._prev},r.decrypt=function(e,t){var r=e._prev;e._prev=t;var i=e._cipher.decryptBlock(t);return n(i,r)}},{"buffer-xor":62}],28:[function(e,t,r){var n=e("safe-buffer").Buffer,i=e("buffer-xor");function c(e,t,r){var c=t.length,a=i(t,e._cache);return e._cache=e._cache.slice(c),e._prev=n.concat([e._prev,r?t:a]),a}r.encrypt=function(e,t,r){for(var i,a=n.allocUnsafe(0);t.length;){if(0===e._cache.length&&(e._cache=e._cipher.encryptBlock(e._prev),e._prev=n.allocUnsafe(0)),!(e._cache.length<=t.length)){a=n.concat([a,c(e,t,r)]);break}i=e._cache.length,a=n.concat([a,c(e,t.slice(0,i),r)]),t=t.slice(i)}return a}},{"buffer-xor":62,"safe-buffer":161}],29:[function(e,t,r){var n=e("safe-buffer").Buffer;function i(e,t,r){for(var n,i,a=-1,f=0;++a<8;)n=t&1<<7-a?128:0,f+=(128&(i=e._cipher.encryptBlock(e._prev)[0]^n))>>a%8,e._prev=c(e._prev,r?n:i);return f}function c(e,t){var r=e.length,i=-1,c=n.allocUnsafe(e.length);for(e=n.concat([e,n.from([t])]);++i>7;return c}r.encrypt=function(e,t,r){for(var c=t.length,a=n.allocUnsafe(c),f=-1;++f=0||!t.umod(e.prime1)||!t.umod(e.prime2));return t}function a(e,t){var i=function(e){var t=c(e);return{blinder:t.toRed(n.mont(e.modulus)).redPow(new n(e.publicExponent)).fromRed(),unblinder:t.invm(e.modulus)}}(t),a=t.modulus.byteLength(),f=new n(e).mul(i.blinder).umod(t.modulus),o=f.toRed(n.mont(t.prime1)),s=f.toRed(n.mont(t.prime2)),d=t.coefficient,u=t.prime1,l=t.prime2,p=o.redPow(t.exponent1).fromRed(),h=s.redPow(t.exponent2).fromRed(),b=p.isub(h).imul(d).umod(u).imul(l);return h.iadd(b).imul(i.unblinder).umod(t.modulus).toArrayLike(r,"be",a)}a.getr=c,t.exports=a}).call(this)}).call(this,e("buffer").Buffer)},{"bn.js":17,buffer:63,randombytes:158}],41:[function(e,t,r){t.exports=e("./browser/algorithms.json")},{"./browser/algorithms.json":42}],42:[function(e,t,r){t.exports={sha224WithRSAEncryption:{sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:{sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:{sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:{sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:{sign:"ecdsa",hash:"sha256",id:""},sha224:{sign:"ecdsa",hash:"sha224",id:""},sha384:{sign:"ecdsa",hash:"sha384",id:""},sha512:{sign:"ecdsa",hash:"sha512",id:""},"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:{sign:"dsa",hash:"sha1",id:""},"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}}},{}],43:[function(e,t,r){t.exports={"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}},{}],44:[function(e,t,r){var n=e("safe-buffer").Buffer,i=e("create-hash"),c=e("readable-stream"),a=e("inherits"),f=e("./sign"),o=e("./verify"),s=e("./algorithms.json");function d(e){c.Writable.call(this);var t=s[e];if(!t)throw new Error("Unknown message digest");this._hashType=t.hash,this._hash=i(t.hash),this._tag=t.id,this._signType=t.sign}function u(e){c.Writable.call(this);var t=s[e];if(!t)throw new Error("Unknown message digest");this._hash=i(t.hash),this._tag=t.id,this._signType=t.sign}function l(e){return new d(e)}function p(e){return new u(e)}Object.keys(s).forEach((function(e){s[e].id=n.from(s[e].id,"hex"),s[e.toLowerCase()]=s[e]})),a(d,c.Writable),d.prototype._write=function(e,t,r){this._hash.update(e),r()},d.prototype.update=function(e,t){return"string"==typeof e&&(e=n.from(e,t)),this._hash.update(e),this},d.prototype.sign=function(e,t){this.end();var r=this._hash.digest(),n=f(r,e,this._hashType,this._signType,this._tag);return t?n.toString(t):n},a(u,c.Writable),u.prototype._write=function(e,t,r){this._hash.update(e),r()},u.prototype.update=function(e,t){return"string"==typeof e&&(e=n.from(e,t)),this._hash.update(e),this},u.prototype.verify=function(e,t,r){"string"==typeof t&&(t=n.from(t,r)),this.end();var i=this._hash.digest();return o(t,i,e,this._signType,this._tag)},t.exports={Sign:l,Verify:p,createSign:l,createVerify:p}},{"./algorithms.json":42,"./sign":45,"./verify":46,"create-hash":67,inherits:132,"readable-stream":61,"safe-buffer":161}],45:[function(e,t,r){var n=e("safe-buffer").Buffer,i=e("create-hmac"),c=e("browserify-rsa"),a=e("elliptic").ec,f=e("bn.js"),o=e("parse-asn1"),s=e("./curves.json");function d(e,t,r,c){if((e=n.from(e.toArray())).length0&&r.ishrn(n),r}function l(e,t,r){var c,a;do{for(c=n.alloc(0);8*c.length=t)throw new Error("invalid sig")}t.exports=function(e,t,r,s,d){var u=a(r);if("ec"===u.type){if("ecdsa"!==s&&"ecdsa/rsa"!==s)throw new Error("wrong public key type");return function(e,t,r){var n=f[r.data.algorithm.curve.join(".")];if(!n)throw new Error("unknown curve "+r.data.algorithm.curve.join("."));var i=new c(n),a=r.data.subjectPrivateKey.data;return i.verify(t,e,a)}(e,t,u)}if("dsa"===u.type){if("dsa"!==s)throw new Error("wrong public key type");return function(e,t,r){var n=r.data.p,c=r.data.q,f=r.data.g,s=r.data.pub_key,d=a.signature.decode(e,"der"),u=d.s,l=d.r;o(u,c),o(l,c);var p=i.mont(n),h=u.invm(c);return 0===f.toRed(p).redPow(new i(t).mul(h).mod(c)).fromRed().mul(s.toRed(p).redPow(l.mul(h).mod(c)).fromRed()).mod(n).mod(c).cmp(l)}(e,t,u)}if("rsa"!==s&&"ecdsa/rsa"!==s)throw new Error("wrong public key type");t=n.concat([d,t]);for(var l=u.modulus.byteLength(),p=[1],h=0;t.length+p.length+22?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}i("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),i("ERR_INVALID_ARG_TYPE",(function(e,t,r){var n,i,a,f;if("string"==typeof t&&(i="not ",t.substr(!a||a<0?0:+a,i.length)===i)?(n="must not be",t=t.replace(/^not /,"")):n="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))f="The ".concat(e," ").concat(n," ").concat(c(t,"type"));else{var o=function(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}(e,".")?"property":"argument";f='The "'.concat(e,'" ').concat(o," ").concat(n," ").concat(c(t,"type"))}return f+=". Received type ".concat(typeof r)}),TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},{}],48:[function(e,t,r){(function(r){(function(){"use strict";var n=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};t.exports=s;var i=e("./_stream_readable"),c=e("./_stream_writable");e("inherits")(s,i);for(var a=n(c.prototype),f=0;f0)if("string"==typeof t||a.objectMode||Object.getPrototypeOf(t)===f.prototype||(t=function(e){return f.from(e)}(t)),n)a.endEmitted?O(e,new w):_(e,a,t,!0);else if(a.ended)O(e,new g);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!r?(t=a.decoder.write(t),a.objectMode||0!==t.length?_(e,a,t,!1):A(e,a)):_(e,a,t,!1)}else n||(a.reading=!1,A(e,a));return!a.ended&&(a.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=1073741824?e=1073741824:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function T(t){var r=t._readableState;s("emitReadable",r.needReadable,r.emittedReadable),r.needReadable=!1,r.emittedReadable||(s("emitReadable",r.flowing),r.emittedReadable=!0,e.nextTick(E,t))}function E(e){var t=e._readableState;s("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,B(e)}function A(t,r){r.readingMore||(r.readingMore=!0,e.nextTick(I,t,r))}function I(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function C(e){s("readable nexttick read 0"),e.read(0)}function D(e,t){s("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),B(e),t.flowing&&!t.reading&&e.read(0)}function B(e){var t=e._readableState;for(s("flow",t.flowing);t.flowing&&null!==e.read(););}function N(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function U(t){var r=t._readableState;s("endReadable",r.endEmitted),r.endEmitted||(r.ended=!0,e.nextTick(H,r,t))}function H(e,t){if(s("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function L(e,t){for(var r=0,n=e.length;r