!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("crypto")):"function"==typeof define&&define.amd?define(["crypto"],t):"object"==typeof exports?exports.jscec=t(require("crypto")):e.jscec=t(e.crypto)}(this,function(e){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/home/circleci/repo/packages/js-crypto-ec/dist",r(r.s=47)}([function(e,t,r){e.exports=r(48)},function(e,t){function r(e,t,r,n,i,a,o){try{var f=e[a](o),s=f.value}catch(e){return void r(e)}f.done?t(s):Promise.resolve(s).then(n,i)}e.exports=function(e){return function(){var t=this,n=arguments;return new Promise(function(i,a){var o=e.apply(t,n);function f(e){r(o,i,a,f,s,"next",e)}function s(e){r(o,i,a,f,s,"throw",e)}f(void 0)})}}},function(e,t){e.exports=function(e){return e&&e.__esModule?e:{default:e}}},function(e,t,r){"use strict";var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var i=n(r(31));t.encoder=i;var a=n(r(53));t.formatter=a,t.default={encoder:i,formatter:a}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},function(e,t,r){"use strict";(function(e){ /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ var n=r(50),i=r(51),a=r(52);function o(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function f(e,t){if(o()=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|e}function l(e,t){if(s.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return D(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return q(e).length;default:if(n)return D(e).length;t=(""+t).toLowerCase(),n=!0}}function b(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return j(this,t,r);case"utf8":case"utf-8":return k(this,t,r);case"ascii":return P(this,t,r);case"latin1":case"binary":return B(this,t,r);case"base64":return M(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function y(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function m(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=s.from(t,n)),s.isBuffer(t))return 0===t.length?-1:v(e,t,r,n,i);if("number"==typeof t)return t&=255,s.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):v(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,r,n,i){var a,o=1,f=e.length,s=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,f/=2,s/=2,r/=2}function c(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var u=-1;for(a=r;af&&(r=f-s),a=r;a>=0;a--){for(var d=!0,h=0;hi&&(n=i):n=i;var a=t.length;if(a%2!=0)throw new TypeError("Invalid hex string");n>a/2&&(n=a/2);for(var o=0;o>8,i=r%256,a.push(i),a.push(n);return a}(t,e.length-r),e,r,n)}function M(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function k(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i239?4:c>223?3:c>191?2:1;if(i+d<=r)switch(d){case 1:c<128&&(u=c);break;case 2:128==(192&(a=e[i+1]))&&(s=(31&c)<<6|63&a)>127&&(u=s);break;case 3:a=e[i+1],o=e[i+2],128==(192&a)&&128==(192&o)&&(s=(15&c)<<12|(63&a)<<6|63&o)>2047&&(s<55296||s>57343)&&(u=s);break;case 4:a=e[i+1],o=e[i+2],f=e[i+3],128==(192&a)&&128==(192&o)&&128==(192&f)&&(s=(15&c)<<18|(63&a)<<12|(63&o)<<6|63&f)>65535&&s<1114112&&(u=s)}null===u?(u=65533,d=1):u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|1023&u),n.push(u),i+=d}return function(e){var t=e.length;if(t<=E)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},s.prototype.compare=function(e,t,r,n,i){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var a=(i>>>=0)-(n>>>=0),o=(r>>>=0)-(t>>>=0),f=Math.min(a,o),c=this.slice(n,i),u=e.slice(t,r),d=0;di)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return g(this,e,t,r);case"utf8":case"utf-8":return w(this,e,t,r);case"ascii":return _(this,e,t,r);case"latin1":case"binary":return S(this,e,t,r);case"base64":return A(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,e,t,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var E=4096;function P(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;in)&&(r=n);for(var i="",a=t;ar)throw new RangeError("Trying to access beyond buffer length")}function U(e,t,r,n,i,a){if(!s.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function O(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,a=Math.min(e.length-r,2);i>>8*(n?i:1-i)}function R(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,a=Math.min(e.length-r,4);i>>8*(n?i:3-i)&255}function K(e,t,r,n,i,a){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function z(e,t,r,n,a){return a||K(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function T(e,t,r,n,a){return a||K(e,0,r,8),i.write(e,t,r,n,52,8),r+8}s.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t0&&(i*=256);)n+=this[e+--t]*i;return n},s.prototype.readUInt8=function(e,t){return t||C(e,1,this.length),this[e]},s.prototype.readUInt16LE=function(e,t){return t||C(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUInt16BE=function(e,t){return t||C(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUInt32LE=function(e,t){return t||C(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},s.prototype.readUInt32BE=function(e,t){return t||C(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||C(e,t,this.length);for(var n=this[e],i=1,a=0;++a=(i*=128)&&(n-=Math.pow(2,8*t)),n},s.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||C(e,t,this.length);for(var n=t,i=1,a=this[e+--n];n>0&&(i*=256);)a+=this[e+--n]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},s.prototype.readInt8=function(e,t){return t||C(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},s.prototype.readInt16LE=function(e,t){t||C(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(e,t){t||C(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(e,t){return t||C(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return t||C(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readFloatLE=function(e,t){return t||C(e,4,this.length),i.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return t||C(e,4,this.length),i.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return t||C(e,8,this.length),i.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return t||C(e,8,this.length),i.read(this,e,!1,52,8)},s.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||U(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,a=0;for(this[t]=255&e;++a=0&&(a*=256);)this[t+i]=e/a&255;return t+r},s.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,1,255,0),s.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},s.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):O(this,e,t,!0),t+2},s.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):O(this,e,t,!1),t+2},s.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):R(this,e,t,!0),t+4},s.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):R(this,e,t,!1),t+4},s.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);U(this,e,t,r,i-1,-i)}var a=0,o=1,f=0;for(this[t]=255&e;++a>0)-f&255;return t+r},s.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);U(this,e,t,r,i-1,-i)}var a=r-1,o=1,f=0;for(this[t+a]=255&e;--a>=0&&(o*=256);)e<0&&0===f&&0!==this[t+a+1]&&(f=1),this[t+a]=(e/o>>0)-f&255;return t+r},s.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,1,127,-128),s.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):O(this,e,t,!0),t+2},s.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):O(this,e,t,!1),t+2},s.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,4,2147483647,-2147483648),s.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):R(this,e,t,!0),t+4},s.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):R(this,e,t,!1),t+4},s.prototype.writeFloatLE=function(e,t,r){return z(this,e,t,!0,r)},s.prototype.writeFloatBE=function(e,t,r){return z(this,e,t,!1,r)},s.prototype.writeDoubleLE=function(e,t,r){return T(this,e,t,!0,r)},s.prototype.writeDoubleBE=function(e,t,r){return T(this,e,t,!1,r)},s.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--i)e[i+t]=this[i+r];else if(a<1e3||!s.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(a=t;a55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function q(e){return n.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(N,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function F(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}}).call(this,r(32))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getRootWebCryptoAll=t.getWebCryptoAll=t.getMsCrypto=t.getWebCrypto=t.getNodeCrypto=t.default=void 0;var n=function(){return"undefined"!=typeof window?void 0:r(30)};t.getNodeCrypto=n;var i=function(){if("undefined"!=typeof window)return window.crypto?window.crypto.subtle:void 0};t.getWebCrypto=i;var a=function(){if("undefined"!=typeof window)return window.msCrypto?window.msCrypto.subtle:window.crypto?window.crypto.subtle:void 0};t.getWebCryptoAll=a;var o=function(){if("undefined"!=typeof window)return window.msCrypto?window.msCrypto:window.crypto?window.crypto:void 0};t.getRootWebCryptoAll=o;var f=function(){if("undefined"!=typeof window&&!window.crypto)return window.msCrypto?window.msCrypto.subtle:void 0};t.getMsCrypto=f;var s={getNodeCrypto:n,getWebCrypto:i,getMsCrypto:f,getWebCryptoAll:a,getRootWebCryptoAll:o};t.default=s},function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=r,r.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)}},function(e,t,r){"use strict";var n=t,i=r(10),a=r(7),o=r(39);n.assert=a,n.toArray=o.toArray,n.zero2=o.zero2,n.toHex=o.toHex,n.encode=o.encode,n.getNAF=function(e,t){for(var r=[],n=1<=0;){var a;if(i.isOdd()){var o=i.andln(n-1);a=o>(n>>1)-1?(n>>1)-o:o,i.isubn(a)}else a=0;r.push(a);for(var f=0!==i.cmpn(0)&&0===i.andln(n-1)?t+1:1,s=1;s0||t.cmpn(-i)>0;){var a,o,f,s=e.andln(3)+n&3,c=t.andln(3)+i&3;3===s&&(s=-1),3===c&&(c=-1),a=0==(1&s)?0:3!=(f=e.andln(7)+n&7)&&5!==f||2!==c?s:-s,r[0].push(a),o=0==(1&c)?0:3!=(f=t.andln(7)+i&7)&&5!==f||2!==s?c:-c,r[1].push(o),2*n===a+1&&(n=1-n),2*i===o+1&&(i=1-i),e.iushrn(1),t.iushrn(1)}return r},n.cachedProperty=function(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},n.parseBytes=function(e){return"string"==typeof e?n.toArray(e,"hex"):e},n.intFromLE=function(e){return new i(e,"hex","le")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"Key",{enumerable:!0,get:function(){return n.Key}}),t.default=void 0;var n=r(60),i={Key:n.Key};t.default=i},function(e,t,r){(function(e){!function(e,t){"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 a(e,t,r){if(a.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 o;"object"==typeof e?e.exports=a:t.BN=a,a.BN=a,a.wordSize=26;try{o=r(54).Buffer}catch(e){}function f(e,t,r){for(var n=0,i=Math.min(e.length,r),a=t;a=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return n}function s(e,t,r,n){for(var i=0,a=Math.min(e.length,r),o=t;o=49?f-49+10:f>=17?f-17+10:f}return i}a.isBN=function(e){return e instanceof a||null!==e&&"object"==typeof e&&e.constructor.wordSize===a.wordSize&&Array.isArray(e.words)},a.max=function(e,t){return e.cmp(t)>0?e:t},a.min=function(e,t){return e.cmp(t)<0?e:t},a.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)},a.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)},a.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)o=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[a]|=o<>>26-f&67108863,(f+=24)>=26&&(f-=26,a++);else if("le"===r)for(i=0,a=0;i>>26-f&67108863,(f+=24)>=26&&(f-=26,a++);return this.strip()},a.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-a&4194303,(a+=24)>=26&&(a-=26,n++);r+6!==t&&(i=f(e,t,r+6),this.words[n]|=i<>>26-a&4194303),this.strip()},a.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 a=e.length-r,o=a%n,f=Math.min(a,a-o)+r,c=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?""};var c=["","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],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 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],a=0|t.words[0],o=i*a,f=67108863&o,s=o/67108864|0;r.words[0]=f;for(var c=1;c>>26,d=67108863&s,h=Math.min(c,t.length-1),p=Math.max(0,c-e.length+1);p<=h;p++){var l=c-p|0;u+=(o=(i=0|e.words[l])*(a=0|t.words[p])+d)/67108864|0,d=67108863&o}r.words[c]=0|d,s=0|u}return 0!==s?r.words[c]=0|s:r.length--,r.strip()}a.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,a=0,o=0;o>>24-i&16777215)||o!==this.length-1?c[6-s.length]+s+r:s+r,(i+=2)>=26&&(i-=26,o--)}for(0!==a&&(r=a.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 h=u[e],p=d[e];r="";var l=this.clone();for(l.negative=0;!l.isZero();){var b=l.modn(p).toString(e);r=(l=l.idivn(p)).isZero()?b+r:c[h-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")},a.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},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(e,t){return n(void 0!==o),this.toArrayLike(o,e,t)},a.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},a.prototype.toArrayLike=function(e,t,r){var i=this.byteLength(),a=r||Math.max(1,i);n(i<=a,"byte array longer than desired length"),n(a>0,"Requested array length <= 0"),this.strip();var o,f,s="le"===t,c=new e(a),u=this.clone();if(s){for(f=0;!u.isZero();f++)o=u.andln(255),u.iushrn(8),c[f]=o;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},a.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},a.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},a.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},a.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)},a.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},a.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)},a.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},a.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()},a.prototype.notn=function(e){return this.clone().inotn(e)},a.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,a=0;a>>26;for(;0!==i&&a>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ae.length?this.clone().iadd(e):e.clone().iadd(this)},a.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 a=0,o=0;o>26,this.words[o]=67108863&t;for(;0!==a&&o>26,this.words[o]=67108863&t;if(0===a&&o>>13,p=0|o[1],l=8191&p,b=p>>>13,y=0|o[2],m=8191&y,v=y>>>13,g=0|o[3],w=8191&g,_=g>>>13,S=0|o[4],A=8191&S,x=S>>>13,M=0|o[5],k=8191&M,E=M>>>13,P=0|o[6],B=8191&P,j=P>>>13,I=0|o[7],C=8191&I,U=I>>>13,O=0|o[8],R=8191&O,K=O>>>13,z=0|o[9],T=8191&z,N=z>>>13,L=0|f[0],D=8191&L,q=L>>>13,F=0|f[1],H=8191&F,J=F>>>13,W=0|f[2],Y=8191&W,Z=W>>>13,V=0|f[3],G=8191&V,X=V>>>13,$=0|f[4],Q=8191&$,ee=$>>>13,te=0|f[5],re=8191&te,ne=te>>>13,ie=0|f[6],ae=8191&ie,oe=ie>>>13,fe=0|f[7],se=8191&fe,ce=fe>>>13,ue=0|f[8],de=8191&ue,he=ue>>>13,pe=0|f[9],le=8191&pe,be=pe>>>13;r.negative=e.negative^t.negative,r.length=19;var ye=(c+(n=Math.imul(d,D))|0)+((8191&(i=(i=Math.imul(d,q))+Math.imul(h,D)|0))<<13)|0;c=((a=Math.imul(h,q))+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(l,D),i=(i=Math.imul(l,q))+Math.imul(b,D)|0,a=Math.imul(b,q);var me=(c+(n=n+Math.imul(d,H)|0)|0)+((8191&(i=(i=i+Math.imul(d,J)|0)+Math.imul(h,H)|0))<<13)|0;c=((a=a+Math.imul(h,J)|0)+(i>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(m,D),i=(i=Math.imul(m,q))+Math.imul(v,D)|0,a=Math.imul(v,q),n=n+Math.imul(l,H)|0,i=(i=i+Math.imul(l,J)|0)+Math.imul(b,H)|0,a=a+Math.imul(b,J)|0;var ve=(c+(n=n+Math.imul(d,Y)|0)|0)+((8191&(i=(i=i+Math.imul(d,Z)|0)+Math.imul(h,Y)|0))<<13)|0;c=((a=a+Math.imul(h,Z)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(w,D),i=(i=Math.imul(w,q))+Math.imul(_,D)|0,a=Math.imul(_,q),n=n+Math.imul(m,H)|0,i=(i=i+Math.imul(m,J)|0)+Math.imul(v,H)|0,a=a+Math.imul(v,J)|0,n=n+Math.imul(l,Y)|0,i=(i=i+Math.imul(l,Z)|0)+Math.imul(b,Y)|0,a=a+Math.imul(b,Z)|0;var ge=(c+(n=n+Math.imul(d,G)|0)|0)+((8191&(i=(i=i+Math.imul(d,X)|0)+Math.imul(h,G)|0))<<13)|0;c=((a=a+Math.imul(h,X)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(A,D),i=(i=Math.imul(A,q))+Math.imul(x,D)|0,a=Math.imul(x,q),n=n+Math.imul(w,H)|0,i=(i=i+Math.imul(w,J)|0)+Math.imul(_,H)|0,a=a+Math.imul(_,J)|0,n=n+Math.imul(m,Y)|0,i=(i=i+Math.imul(m,Z)|0)+Math.imul(v,Y)|0,a=a+Math.imul(v,Z)|0,n=n+Math.imul(l,G)|0,i=(i=i+Math.imul(l,X)|0)+Math.imul(b,G)|0,a=a+Math.imul(b,X)|0;var we=(c+(n=n+Math.imul(d,Q)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(h,Q)|0))<<13)|0;c=((a=a+Math.imul(h,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(k,D),i=(i=Math.imul(k,q))+Math.imul(E,D)|0,a=Math.imul(E,q),n=n+Math.imul(A,H)|0,i=(i=i+Math.imul(A,J)|0)+Math.imul(x,H)|0,a=a+Math.imul(x,J)|0,n=n+Math.imul(w,Y)|0,i=(i=i+Math.imul(w,Z)|0)+Math.imul(_,Y)|0,a=a+Math.imul(_,Z)|0,n=n+Math.imul(m,G)|0,i=(i=i+Math.imul(m,X)|0)+Math.imul(v,G)|0,a=a+Math.imul(v,X)|0,n=n+Math.imul(l,Q)|0,i=(i=i+Math.imul(l,ee)|0)+Math.imul(b,Q)|0,a=a+Math.imul(b,ee)|0;var _e=(c+(n=n+Math.imul(d,re)|0)|0)+((8191&(i=(i=i+Math.imul(d,ne)|0)+Math.imul(h,re)|0))<<13)|0;c=((a=a+Math.imul(h,ne)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(B,D),i=(i=Math.imul(B,q))+Math.imul(j,D)|0,a=Math.imul(j,q),n=n+Math.imul(k,H)|0,i=(i=i+Math.imul(k,J)|0)+Math.imul(E,H)|0,a=a+Math.imul(E,J)|0,n=n+Math.imul(A,Y)|0,i=(i=i+Math.imul(A,Z)|0)+Math.imul(x,Y)|0,a=a+Math.imul(x,Z)|0,n=n+Math.imul(w,G)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(_,G)|0,a=a+Math.imul(_,X)|0,n=n+Math.imul(m,Q)|0,i=(i=i+Math.imul(m,ee)|0)+Math.imul(v,Q)|0,a=a+Math.imul(v,ee)|0,n=n+Math.imul(l,re)|0,i=(i=i+Math.imul(l,ne)|0)+Math.imul(b,re)|0,a=a+Math.imul(b,ne)|0;var Se=(c+(n=n+Math.imul(d,ae)|0)|0)+((8191&(i=(i=i+Math.imul(d,oe)|0)+Math.imul(h,ae)|0))<<13)|0;c=((a=a+Math.imul(h,oe)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(C,D),i=(i=Math.imul(C,q))+Math.imul(U,D)|0,a=Math.imul(U,q),n=n+Math.imul(B,H)|0,i=(i=i+Math.imul(B,J)|0)+Math.imul(j,H)|0,a=a+Math.imul(j,J)|0,n=n+Math.imul(k,Y)|0,i=(i=i+Math.imul(k,Z)|0)+Math.imul(E,Y)|0,a=a+Math.imul(E,Z)|0,n=n+Math.imul(A,G)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(x,G)|0,a=a+Math.imul(x,X)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(_,Q)|0,a=a+Math.imul(_,ee)|0,n=n+Math.imul(m,re)|0,i=(i=i+Math.imul(m,ne)|0)+Math.imul(v,re)|0,a=a+Math.imul(v,ne)|0,n=n+Math.imul(l,ae)|0,i=(i=i+Math.imul(l,oe)|0)+Math.imul(b,ae)|0,a=a+Math.imul(b,oe)|0;var Ae=(c+(n=n+Math.imul(d,se)|0)|0)+((8191&(i=(i=i+Math.imul(d,ce)|0)+Math.imul(h,se)|0))<<13)|0;c=((a=a+Math.imul(h,ce)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(R,D),i=(i=Math.imul(R,q))+Math.imul(K,D)|0,a=Math.imul(K,q),n=n+Math.imul(C,H)|0,i=(i=i+Math.imul(C,J)|0)+Math.imul(U,H)|0,a=a+Math.imul(U,J)|0,n=n+Math.imul(B,Y)|0,i=(i=i+Math.imul(B,Z)|0)+Math.imul(j,Y)|0,a=a+Math.imul(j,Z)|0,n=n+Math.imul(k,G)|0,i=(i=i+Math.imul(k,X)|0)+Math.imul(E,G)|0,a=a+Math.imul(E,X)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,ee)|0)+Math.imul(x,Q)|0,a=a+Math.imul(x,ee)|0,n=n+Math.imul(w,re)|0,i=(i=i+Math.imul(w,ne)|0)+Math.imul(_,re)|0,a=a+Math.imul(_,ne)|0,n=n+Math.imul(m,ae)|0,i=(i=i+Math.imul(m,oe)|0)+Math.imul(v,ae)|0,a=a+Math.imul(v,oe)|0,n=n+Math.imul(l,se)|0,i=(i=i+Math.imul(l,ce)|0)+Math.imul(b,se)|0,a=a+Math.imul(b,ce)|0;var xe=(c+(n=n+Math.imul(d,de)|0)|0)+((8191&(i=(i=i+Math.imul(d,he)|0)+Math.imul(h,de)|0))<<13)|0;c=((a=a+Math.imul(h,he)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(T,D),i=(i=Math.imul(T,q))+Math.imul(N,D)|0,a=Math.imul(N,q),n=n+Math.imul(R,H)|0,i=(i=i+Math.imul(R,J)|0)+Math.imul(K,H)|0,a=a+Math.imul(K,J)|0,n=n+Math.imul(C,Y)|0,i=(i=i+Math.imul(C,Z)|0)+Math.imul(U,Y)|0,a=a+Math.imul(U,Z)|0,n=n+Math.imul(B,G)|0,i=(i=i+Math.imul(B,X)|0)+Math.imul(j,G)|0,a=a+Math.imul(j,X)|0,n=n+Math.imul(k,Q)|0,i=(i=i+Math.imul(k,ee)|0)+Math.imul(E,Q)|0,a=a+Math.imul(E,ee)|0,n=n+Math.imul(A,re)|0,i=(i=i+Math.imul(A,ne)|0)+Math.imul(x,re)|0,a=a+Math.imul(x,ne)|0,n=n+Math.imul(w,ae)|0,i=(i=i+Math.imul(w,oe)|0)+Math.imul(_,ae)|0,a=a+Math.imul(_,oe)|0,n=n+Math.imul(m,se)|0,i=(i=i+Math.imul(m,ce)|0)+Math.imul(v,se)|0,a=a+Math.imul(v,ce)|0,n=n+Math.imul(l,de)|0,i=(i=i+Math.imul(l,he)|0)+Math.imul(b,de)|0,a=a+Math.imul(b,he)|0;var Me=(c+(n=n+Math.imul(d,le)|0)|0)+((8191&(i=(i=i+Math.imul(d,be)|0)+Math.imul(h,le)|0))<<13)|0;c=((a=a+Math.imul(h,be)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(T,H),i=(i=Math.imul(T,J))+Math.imul(N,H)|0,a=Math.imul(N,J),n=n+Math.imul(R,Y)|0,i=(i=i+Math.imul(R,Z)|0)+Math.imul(K,Y)|0,a=a+Math.imul(K,Z)|0,n=n+Math.imul(C,G)|0,i=(i=i+Math.imul(C,X)|0)+Math.imul(U,G)|0,a=a+Math.imul(U,X)|0,n=n+Math.imul(B,Q)|0,i=(i=i+Math.imul(B,ee)|0)+Math.imul(j,Q)|0,a=a+Math.imul(j,ee)|0,n=n+Math.imul(k,re)|0,i=(i=i+Math.imul(k,ne)|0)+Math.imul(E,re)|0,a=a+Math.imul(E,ne)|0,n=n+Math.imul(A,ae)|0,i=(i=i+Math.imul(A,oe)|0)+Math.imul(x,ae)|0,a=a+Math.imul(x,oe)|0,n=n+Math.imul(w,se)|0,i=(i=i+Math.imul(w,ce)|0)+Math.imul(_,se)|0,a=a+Math.imul(_,ce)|0,n=n+Math.imul(m,de)|0,i=(i=i+Math.imul(m,he)|0)+Math.imul(v,de)|0,a=a+Math.imul(v,he)|0;var ke=(c+(n=n+Math.imul(l,le)|0)|0)+((8191&(i=(i=i+Math.imul(l,be)|0)+Math.imul(b,le)|0))<<13)|0;c=((a=a+Math.imul(b,be)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(T,Y),i=(i=Math.imul(T,Z))+Math.imul(N,Y)|0,a=Math.imul(N,Z),n=n+Math.imul(R,G)|0,i=(i=i+Math.imul(R,X)|0)+Math.imul(K,G)|0,a=a+Math.imul(K,X)|0,n=n+Math.imul(C,Q)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(U,Q)|0,a=a+Math.imul(U,ee)|0,n=n+Math.imul(B,re)|0,i=(i=i+Math.imul(B,ne)|0)+Math.imul(j,re)|0,a=a+Math.imul(j,ne)|0,n=n+Math.imul(k,ae)|0,i=(i=i+Math.imul(k,oe)|0)+Math.imul(E,ae)|0,a=a+Math.imul(E,oe)|0,n=n+Math.imul(A,se)|0,i=(i=i+Math.imul(A,ce)|0)+Math.imul(x,se)|0,a=a+Math.imul(x,ce)|0,n=n+Math.imul(w,de)|0,i=(i=i+Math.imul(w,he)|0)+Math.imul(_,de)|0,a=a+Math.imul(_,he)|0;var Ee=(c+(n=n+Math.imul(m,le)|0)|0)+((8191&(i=(i=i+Math.imul(m,be)|0)+Math.imul(v,le)|0))<<13)|0;c=((a=a+Math.imul(v,be)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(T,G),i=(i=Math.imul(T,X))+Math.imul(N,G)|0,a=Math.imul(N,X),n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,ee)|0)+Math.imul(K,Q)|0,a=a+Math.imul(K,ee)|0,n=n+Math.imul(C,re)|0,i=(i=i+Math.imul(C,ne)|0)+Math.imul(U,re)|0,a=a+Math.imul(U,ne)|0,n=n+Math.imul(B,ae)|0,i=(i=i+Math.imul(B,oe)|0)+Math.imul(j,ae)|0,a=a+Math.imul(j,oe)|0,n=n+Math.imul(k,se)|0,i=(i=i+Math.imul(k,ce)|0)+Math.imul(E,se)|0,a=a+Math.imul(E,ce)|0,n=n+Math.imul(A,de)|0,i=(i=i+Math.imul(A,he)|0)+Math.imul(x,de)|0,a=a+Math.imul(x,he)|0;var Pe=(c+(n=n+Math.imul(w,le)|0)|0)+((8191&(i=(i=i+Math.imul(w,be)|0)+Math.imul(_,le)|0))<<13)|0;c=((a=a+Math.imul(_,be)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(T,Q),i=(i=Math.imul(T,ee))+Math.imul(N,Q)|0,a=Math.imul(N,ee),n=n+Math.imul(R,re)|0,i=(i=i+Math.imul(R,ne)|0)+Math.imul(K,re)|0,a=a+Math.imul(K,ne)|0,n=n+Math.imul(C,ae)|0,i=(i=i+Math.imul(C,oe)|0)+Math.imul(U,ae)|0,a=a+Math.imul(U,oe)|0,n=n+Math.imul(B,se)|0,i=(i=i+Math.imul(B,ce)|0)+Math.imul(j,se)|0,a=a+Math.imul(j,ce)|0,n=n+Math.imul(k,de)|0,i=(i=i+Math.imul(k,he)|0)+Math.imul(E,de)|0,a=a+Math.imul(E,he)|0;var Be=(c+(n=n+Math.imul(A,le)|0)|0)+((8191&(i=(i=i+Math.imul(A,be)|0)+Math.imul(x,le)|0))<<13)|0;c=((a=a+Math.imul(x,be)|0)+(i>>>13)|0)+(Be>>>26)|0,Be&=67108863,n=Math.imul(T,re),i=(i=Math.imul(T,ne))+Math.imul(N,re)|0,a=Math.imul(N,ne),n=n+Math.imul(R,ae)|0,i=(i=i+Math.imul(R,oe)|0)+Math.imul(K,ae)|0,a=a+Math.imul(K,oe)|0,n=n+Math.imul(C,se)|0,i=(i=i+Math.imul(C,ce)|0)+Math.imul(U,se)|0,a=a+Math.imul(U,ce)|0,n=n+Math.imul(B,de)|0,i=(i=i+Math.imul(B,he)|0)+Math.imul(j,de)|0,a=a+Math.imul(j,he)|0;var je=(c+(n=n+Math.imul(k,le)|0)|0)+((8191&(i=(i=i+Math.imul(k,be)|0)+Math.imul(E,le)|0))<<13)|0;c=((a=a+Math.imul(E,be)|0)+(i>>>13)|0)+(je>>>26)|0,je&=67108863,n=Math.imul(T,ae),i=(i=Math.imul(T,oe))+Math.imul(N,ae)|0,a=Math.imul(N,oe),n=n+Math.imul(R,se)|0,i=(i=i+Math.imul(R,ce)|0)+Math.imul(K,se)|0,a=a+Math.imul(K,ce)|0,n=n+Math.imul(C,de)|0,i=(i=i+Math.imul(C,he)|0)+Math.imul(U,de)|0,a=a+Math.imul(U,he)|0;var Ie=(c+(n=n+Math.imul(B,le)|0)|0)+((8191&(i=(i=i+Math.imul(B,be)|0)+Math.imul(j,le)|0))<<13)|0;c=((a=a+Math.imul(j,be)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(T,se),i=(i=Math.imul(T,ce))+Math.imul(N,se)|0,a=Math.imul(N,ce),n=n+Math.imul(R,de)|0,i=(i=i+Math.imul(R,he)|0)+Math.imul(K,de)|0,a=a+Math.imul(K,he)|0;var Ce=(c+(n=n+Math.imul(C,le)|0)|0)+((8191&(i=(i=i+Math.imul(C,be)|0)+Math.imul(U,le)|0))<<13)|0;c=((a=a+Math.imul(U,be)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(T,de),i=(i=Math.imul(T,he))+Math.imul(N,de)|0,a=Math.imul(N,he);var Ue=(c+(n=n+Math.imul(R,le)|0)|0)+((8191&(i=(i=i+Math.imul(R,be)|0)+Math.imul(K,le)|0))<<13)|0;c=((a=a+Math.imul(K,be)|0)+(i>>>13)|0)+(Ue>>>26)|0,Ue&=67108863;var Oe=(c+(n=Math.imul(T,le))|0)+((8191&(i=(i=Math.imul(T,be))+Math.imul(N,le)|0))<<13)|0;return c=((a=Math.imul(N,be))+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,s[0]=ye,s[1]=me,s[2]=ve,s[3]=ge,s[4]=we,s[5]=_e,s[6]=Se,s[7]=Ae,s[8]=xe,s[9]=Me,s[10]=ke,s[11]=Ee,s[12]=Pe,s[13]=Be,s[14]=je,s[15]=Ie,s[16]=Ce,s[17]=Ue,s[18]=Oe,0!==c&&(s[19]=c,r.length++),r};function l(e,t,r){return(new b).mulp(e,t,r)}function b(e,t){this.x=e,this.y=t}Math.imul||(p=h),a.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?p(this,e,t):r<63?h(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,a=0;a>>26)|0)>>>26,o&=67108863}r.words[a]=f,n=o,o=i}return 0!==n?r.words[a]=n:r.length--,r.strip()}(this,e,t):l(this,e,t)},b.prototype.makeRBT=function(e){for(var t=new Array(e),r=a.prototype._countBits(e)-1,n=0;n>=1;return n},b.prototype.permute=function(e,t,r,n,i,a){for(var o=0;o>>=1)i++;return 1<>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*t;o>=26,t+=i/67108864|0,t+=a>>>26,this.words[r]=67108863&a}return 0!==t&&(this.words[r]=t,this.length++),this},a.prototype.muln=function(e){return this.clone().imuln(e)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.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 a(1);for(var r=this,n=0;n=0);var t,r=e%26,i=(e-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,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 a=e%26,o=Math.min((e-a)/26,this.length),f=67108863^67108863>>>a<o)for(this.length-=o,c=0;c=0&&(0!==u||c>=i);c--){var d=0|this.words[c];this.words[c]=u<<26-a|d>>>a,u=d&f}return s&&0!==u&&(s.words[s.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},a.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},a.prototype.shln=function(e){return this.clone().ishln(e)},a.prototype.ushln=function(e){return this.clone().iushln(e)},a.prototype.shrn=function(e){return this.clone().ishrn(e)},a.prototype.ushrn=function(e){return this.clone().iushrn(e)},a.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},a.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)-(s/67108864|0),this.words[i+r]=67108863&a}for(;i>26,this.words[i+r]=67108863&a;if(0===f)return this.strip();for(n(-1===f),f=0,i=0;i>26,this.words[i]=67108863&a;return this.negative=1,this.strip()},a.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),i=e,o=0|i.words[i.length-1];0!==(r=26-this._countBits(o))&&(i=i.ushln(r),n.iushln(r),o=0|i.words[i.length-1]);var f,s=n.length-i.length;if("mod"!==t){(f=new a(null)).length=s+1,f.words=new Array(f.length);for(var c=0;c=0;d--){var h=67108864*(0|n.words[i.length+d])+(0|n.words[i.length+d-1]);for(h=Math.min(h/o|0,67108863),n._ishlnsubmul(i,h,d);0!==n.negative;)h--,n.negative=0,n._ishlnsubmul(i,1,d),n.isZero()||(n.negative^=1);f&&(f.words[d]=h)}return f&&f.strip(),n.strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:f||null,mod:n}},a.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===e.negative?(f=this.neg().divmod(e,t),"mod"!==t&&(i=f.div.neg()),"div"!==t&&(o=f.mod.neg(),r&&0!==o.negative&&o.iadd(e)),{div:i,mod:o}):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&&(o=f.mod.neg(),r&&0!==o.negative&&o.isub(e)),{div:f.div,mod:o}):e.length>this.length||this.cmp(e)<0?{div:new a(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new a(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new a(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,o,f},a.prototype.div=function(e){return this.divmod(e,"div",!1).div},a.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},a.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},a.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),a=r.cmp(n);return a<0||1===i&&0===a?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},a.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},a.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()},a.prototype.divn=function(e){return this.clone().idivn(e)},a.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 a(1),o=new a(0),f=new a(0),s=new a(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var u=r.clone(),d=t.clone();!t.isZero();){for(var h=0,p=1;0==(t.words[0]&p)&&h<26;++h,p<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(u),o.isub(d)),i.iushrn(1),o.iushrn(1);for(var l=0,b=1;0==(r.words[0]&b)&&l<26;++l,b<<=1);if(l>0)for(r.iushrn(l);l-- >0;)(f.isOdd()||s.isOdd())&&(f.iadd(u),s.isub(d)),f.iushrn(1),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),i.isub(f),o.isub(s)):(r.isub(t),f.isub(i),s.isub(o))}return{a:f,b:s,gcd:r.iushln(c)}},a.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,o=new a(1),f=new a(0),s=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,u=1;0==(t.words[0]&u)&&c<26;++c,u<<=1);if(c>0)for(t.iushrn(c);c-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);for(var d=0,h=1;0==(r.words[0]&h)&&d<26;++d,h<<=1);if(d>0)for(r.iushrn(d);d-- >0;)f.isOdd()&&f.iadd(s),f.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(f)):(r.isub(t),f.isub(o))}return(i=0===t.cmpn(1)?o:f).cmpn(0)<0&&i.iadd(e),i},a.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 a=t;t=r,r=a}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},a.prototype.invm=function(e){return this.egcd(e).a.umod(e)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(e){return this.words[0]&e},a.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<>>26,f&=67108863,this.words[o]=f}return 0!==a&&(this.words[o]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.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},a.prototype.gtn=function(e){return 1===this.cmpn(e)},a.prototype.gt=function(e){return 1===this.cmp(e)},a.prototype.gten=function(e){return this.cmpn(e)>=0},a.prototype.gte=function(e){return this.cmp(e)>=0},a.prototype.ltn=function(e){return-1===this.cmpn(e)},a.prototype.lt=function(e){return-1===this.cmp(e)},a.prototype.lten=function(e){return this.cmpn(e)<=0},a.prototype.lte=function(e){return this.cmp(e)<=0},a.prototype.eqn=function(e){return 0===this.cmpn(e)},a.prototype.eq=function(e){return 0===this.cmp(e)},a.red=function(e){return new S(e)},a.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)},a.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(e){return this.red=e,this},a.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},a.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},a.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},a.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},a.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},a.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},a.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},a.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},a.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.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 a(t,16),this.n=this.p.bitLength(),this.k=new a(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 w(){m.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){m.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(e){if("string"==typeof e){var t=a._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 A(e){S.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new a(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 a(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):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=a}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},a._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 w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new _}return y[e]=t,t},S.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},S.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")},S.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},S.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},S.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)},S.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},S.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)},S.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},S.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},S.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},S.prototype.isqr=function(e){return this.imul(e,e.clone())},S.prototype.sqr=function(e){return this.mul(e,e)},S.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 a(1)).iushrn(2);return this.pow(e,r)}for(var i=this.m.subn(1),o=0;!i.isZero()&&0===i.andln(1);)o++,i.iushrn(1);n(!i.isZero());var f=new a(1).toRed(this),s=f.redNeg(),c=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new a(2*u*u).toRed(this);0!==this.pow(u,c).cmp(s);)u.redIAdd(s);for(var d=this.pow(u,i),h=this.pow(e,i.addn(1).iushrn(1)),p=this.pow(e,i),l=o;0!==p.cmp(f);){for(var b=p,y=0;0!==b.cmp(f);y++)b=b.redSqr();n(y=0;n--){for(var c=t.words[n],u=s-1;u>=0;u--){var d=c>>u&1;i!==r[0]&&(i=this.sqr(i)),0!==d||0!==o?(o<<=1,o|=d,(4===++f||0===n&&0===u)&&(i=this.mul(i,r[o]),f=0,o=0)):f=0}s=26}return i},S.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},S.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},a.mont=function(e){return new A(e)},i(A,S),A.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},A.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},A.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),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)},A.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new a(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),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},A.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,this)}).call(this,r(33)(e))},function(e,t,r){"use strict";var n=r(7),i=r(4);function a(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function o(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function f(e){return 1===e.length?"0"+e:e}function s(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=i,t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),i=0;i>6|192,r[n++]=63&o|128):a(e,i)?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++i)),r[n++]=o>>18|240,r[n++]=o>>12&63|128,r[n++]=o>>6&63|128,r[n++]=63&o|128):(r[n++]=o>>12|224,r[n++]=o>>6&63|128,r[n++]=63&o|128)}else for(i=0;i>>0}return o},t.split32=function(e,t){for(var r=new Array(4*e.length),n=0,i=0;n>>24,r[i+1]=a>>>16&255,r[i+2]=a>>>8&255,r[i+3]=255&a):(r[i+3]=a>>>24,r[i+2]=a>>>16&255,r[i+1]=a>>>8&255,r[i]=255&a)}return r},t.rotr32=function(e,t){return e>>>t|e<<32-t},t.rotl32=function(e,t){return e<>>32-t},t.sum32=function(e,t){return e+t>>>0},t.sum32_3=function(e,t,r){return e+t+r>>>0},t.sum32_4=function(e,t,r,n){return e+t+r+n>>>0},t.sum32_5=function(e,t,r,n,i){return e+t+r+n+i>>>0},t.sum64=function(e,t,r,n){var i=e[t],a=n+e[t+1]>>>0,o=(a>>0,e[t+1]=a},t.sum64_hi=function(e,t,r,n){return(t+n>>>0>>0},t.sum64_lo=function(e,t,r,n){return t+n>>>0},t.sum64_4_hi=function(e,t,r,n,i,a,o,f){var s=0,c=t;return s+=(c=c+n>>>0)>>0)>>0)>>0},t.sum64_4_lo=function(e,t,r,n,i,a,o,f){return t+n+a+f>>>0},t.sum64_5_hi=function(e,t,r,n,i,a,o,f,s,c){var u=0,d=t;return u+=(d=d+n>>>0)>>0)>>0)>>0)>>0},t.sum64_5_lo=function(e,t,r,n,i,a,o,f,s,c){return t+n+a+f+c>>>0},t.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},t.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},t.shr64_hi=function(e,t,r){return e>>>r},t.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0}},function(e,t){e.exports=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var n=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,r):{};n.get||n.set?Object.defineProperty(t,r,n):t[r]=e[r]}return t.default=e,t}},function(e,t,r){"use strict";const n=t;n.bignum=r(10),n.define=r(55).define,n.base=r(58),n.constants=r(59),n.decoders=r(36),n.encoders=r(34)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getAlgorithmFromOid=n,t.getAlgorithmFromOidStrict=t.default=void 0;function n(e,t){return Object.keys(t).filter(function(r){return t[r].oid.toString()===e.toString()})}t.default={namedCurves:{"P-256":{indutnyName:"p256",payloadSize:32,oid:[1,2,840,10045,3,1,7]},"P-384":{indutnyName:"p384",payloadSize:48,oid:[1,3,132,0,34]},"P-521":{indutnyName:"p521",payloadSize:66,oid:[1,3,132,0,35]},"P-256K":{indutnyName:"secp256k1",payloadSize:32,oid:[1,3,132,0,10]}},publicKeyAlgorithms:{EC:{oid:[1,2,840,10045,2,1]},RSA:{oid:[1,2,840,113549,1,1,1]}},passwordBasedEncryptionSchemes:{"pbeWithMD5AndDES-CBC":{oid:[1,2,840,113549,1,5,3],hash:"MD5",encrypt:"DES-CBC"},"pbeWithSHA1AndDES-CBC":{oid:[1,2,840,113549,1,5,10],hash:"SHA-1",encrypt:"DES-CBC"},pbes2:{oid:[1,2,840,113549,1,5,13]}},keyDerivationFunctions:{pbkdf2:{oid:[1,2,840,113549,1,5,12],defaultSaltLen:8}},pbkdf2Prfs:{hmacWithSHA1:{oid:[1,2,840,113549,2,7],hash:"SHA-1"},hmacWithSHA256:{oid:[1,2,840,113549,2,9],hash:"SHA-256"},hmacWithSHA384:{oid:[1,2,840,113549,2,10],hash:"SHA-384"},hmacWithSHA512:{oid:[1,2,840,113549,2,11],hash:"SHA-512"}},encryptionSchemes:{"des-ede3-cbc":{oid:[1,2,840,113549,3,7],keyLength:24,ivLength:8},"aes128-cbc":{oid:[2,16,840,1,101,3,4,1,2],keyLength:16,ivLength:16},"aes192-cbc":{oid:[2,16,840,1,101,3,4,1,22],keyLength:24,ivLength:16},"aes256-cbc":{oid:[2,16,840,1,101,3,4,1,42],keyLength:32,ivLength:16}},hashes:{"SHA-256":{hashSize:32},"SHA-384":{hashSize:48},"SHA-512":{hashSize:64},"SHA-1":{hashSize:20},MD5:{hashSize:16}}};t.getAlgorithmFromOidStrict=function(e,t){var r=n(e,t);if(0===r.length)throw new Error("UnsupportedAlgorithm");return r[0]}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"compute",{enumerable:!0,get:function(){return n.compute}}),t.default=void 0;var n=r(94),i={compute:n.compute};t.default=i},function(e,t,r){"use strict";const n=r(4),i=r(22).Reporter,a=r(5).Buffer;function o(e,t){i.call(this,t),a.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function f(e,t){if(Array.isArray(e))this.length=0,this.value=e.map(function(e){return f.isEncoderBuffer(e)||(e=new f(e,t)),this.length+=e.length,e},this);else if("number"==typeof e){if(!(0<=e&&e<=255))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=a.byteLength(e);else{if(!a.isBuffer(e))return t.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}n(o,i),t.DecoderBuffer=o,o.isDecoderBuffer=function(e){if(e instanceof o)return!0;return"object"==typeof e&&a.isBuffer(e.base)&&"DecoderBuffer"===e.constructor.name&&"number"==typeof e.offset&&"number"==typeof e.length&&"function"==typeof e.save&&"function"==typeof e.restore&&"function"==typeof e.isEmpty&&"function"==typeof e.readUInt8&&"function"==typeof e.skip&&"function"==typeof e.raw},o.prototype.save=function(){return{offset:this.offset,reporter:i.prototype.save.call(this)}},o.prototype.restore=function(e){const t=new o(this.base);return t.offset=e.offset,t.length=this.offset,this.offset=e.offset,i.prototype.restore.call(this,e.reporter),t},o.prototype.isEmpty=function(){return this.offset===this.length},o.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")},o.prototype.skip=function(e,t){if(!(this.offset+e<=this.length))return this.error(t||"DecoderBuffer overrun");const r=new o(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+e,this.offset+=e,r},o.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)},t.EncoderBuffer=f,f.isEncoderBuffer=function(e){if(e instanceof f)return!0;return"object"==typeof e&&"EncoderBuffer"===e.constructor.name&&"number"==typeof e.length&&"function"==typeof e.join},f.prototype.join=function(e,t){return e||(e=new a(this.length)),t||(t=0),0===this.length?e:(Array.isArray(this.value)?this.value.forEach(function(r){r.join(e,t),t+=r.length}):("number"==typeof this.value?e[t]=this.value:"string"==typeof this.value?e.write(this.value,t):a.isBuffer(this.value)&&this.value.copy(e,t),t+=this.length),e)}},function(e,t,r){"use strict";var n=r(11),i=r(7);function a(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}t.BlockHash=a,a.prototype.update=function(e,t){if(e=n.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=n.join32(e,0,e.length-r,this.endian);for(var i=0;i>>24&255,n[i++]=e>>>16&255,n[i++]=e>>>8&255,n[i++]=255&e}else for(n[i++]=255&e,n[i++]=e>>>8&255,n[i++]=e>>>16&255,n[i++]=e>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,a=8;a0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function c(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=s,s.prototype.point=function(){throw new Error("Not implemented")},s.prototype.validate=function(){throw new Error("Not implemented")},s.prototype._fixedNafMul=function(e,t){f(e.precomputed);var r=e._getDoubles(),n=a(t,1),i=(1<=s;t--)c=(c<<1)+n[t];o.push(c)}for(var u=this.jpoint(null,null,null),d=this.jpoint(null,null,null),h=i;h>0;h--){for(s=0;s=0;c--){for(t=0;c>=0&&0===o[c];c--)t++;if(c>=0&&t++,s=s.dblp(t),c<0)break;var u=o[c];f(0!==u),s="affine"===e.type?u>0?s.mixedAdd(i[u-1>>1]):s.mixedAdd(i[-u-1>>1].neg()):u>0?s.add(i[u-1>>1]):s.add(i[-u-1>>1].neg())}return"affine"===e.type?s.toP():s},s.prototype._wnafMulAdd=function(e,t,r,n,i){for(var f=this._wnafT1,s=this._wnafT2,c=this._wnafT3,u=0,d=0;d=1;d-=2){var p=d-1,l=d;if(1===f[p]&&1===f[l]){var b=[t[p],null,null,t[l]];0===t[p].y.cmp(t[l].y)?(b[1]=t[p].add(t[l]),b[2]=t[p].toJ().mixedAdd(t[l].neg())):0===t[p].y.cmp(t[l].y.redNeg())?(b[1]=t[p].toJ().mixedAdd(t[l]),b[2]=t[p].add(t[l].neg())):(b[1]=t[p].toJ().mixedAdd(t[l]),b[2]=t[p].toJ().mixedAdd(t[l].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],m=o(r[p],r[l]);u=Math.max(m[0].length,u),c[p]=new Array(u),c[l]=new Array(u);for(var v=0;v=0;d--){for(var A=0;d>=0;){var x=!0;for(v=0;v=0&&A++,_=_.dblp(A),d<0)break;for(v=0;v0?M=s[v][k-1>>1]:k<0&&(M=s[v][-k-1>>1].neg()),_="affine"===M.type?_.mixedAdd(M):_.add(M))}}for(d=0;d=Math.ceil((e.bitLength()+1)/t.step)},c.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i1&&void 0!==arguments[1]?arguments[1]:"pem";try{t=f(e,r)}catch(e){return!1}return"encryptedPrivate"===t};t.isAsn1Public=function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"pem";try{t=f(e,r)}catch(e){return!1}return"public"===t};var f=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"pem",n="pem"===r?i.default.formatter.pemToBin(t,"private"):t,a=o.KeyStructure.decode(e.from(n),"der");if("encryptedPrivateKeyInfo"===a.type)return"encryptedPrivate";if("oneAsymmetricKey"===a.type)return"private";if("subjectPublicKeyInfo"===a.type)return"public";throw new Error("NotSpkiNorPkcs8Key")};t.getSec1KeyType=function(e,t){var r;if(e instanceof Uint8Array)r="binary";else{if("string"!=typeof e)throw new Error("InvalidObjectType");r="string"}var n="string"===r?i.default.encoder.hexStringToArrayBuffer(e):e,o=a.default.namedCurves[t].payloadSize;if(n.length<=o)return"private";if(n.length===2*o+1&&4===n[0]||n.length===o+1&&(2===n[0]||3===n[0]))return"public";throw new Error("UnsupportedKeyStructure")};t.getJwkType=function(e){if("EC"===e.kty){if(e.x&&e.y&&e.d)return"private";if(e.x&&e.y)return"public";throw new Error("InvalidECKey")}if("RSA"===e.kty){if(e.n&&e.e&&e.d&&e.p&&e.q&&e.dp&&e.dq&&e.qi)return"private";if(e.n&&e.e)return"public";throw new Error("InvalidRSAKey")}throw new Error("UnsupportedJWKType")};t.pruneLeadingZeros=function(e){if(!(e instanceof Uint8Array))throw new Error("NonUint8Array");for(var t=0,r=0;rt)throw new Error("InvalidLength");var r=new Uint8Array(t);return r.set(e,t-e.length),r}}).call(this,r(5).Buffer)},function(e,t,r){"use strict";const n=r(22).Reporter,i=r(16).EncoderBuffer,a=r(16).DecoderBuffer,o=r(7),f=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],s=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(f);function c(e,t,r){const n={};this._baseState=n,n.name=r,n.enc=e,n.parent=t||null,n.children=null,n.tag=null,n.args=null,n.reverseArgs=null,n.choice=null,n.optional=!1,n.any=!1,n.obj=!1,n.use=null,n.useDecoder=null,n.key=null,n.default=null,n.explicit=null,n.implicit=null,n.contains=null,n.parent||(n.children=[],this._wrap())}e.exports=c;const u=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];c.prototype.clone=function(){const e=this._baseState,t={};u.forEach(function(r){t[r]=e[r]});const r=new this.constructor(t.parent);return r._baseState=t,r},c.prototype._wrap=function(){const e=this._baseState;s.forEach(function(t){this[t]=function(){const r=new this.constructor(this);return e.children.push(r),r[t].apply(r,arguments)}},this)},c.prototype._init=function(e){const t=this._baseState;o(null===t.parent),e.call(this),t.children=t.children.filter(function(e){return e._baseState.parent===this},this),o.equal(t.children.length,1,"Root node can have only one child")},c.prototype._useArgs=function(e){const t=this._baseState,r=e.filter(function(e){return e instanceof this.constructor},this);e=e.filter(function(e){return!(e instanceof this.constructor)},this),0!==r.length&&(o(null===t.children),t.children=r,r.forEach(function(e){e._baseState.parent=this},this)),0!==e.length&&(o(null===t.args),t.args=e,t.reverseArgs=e.map(function(e){if("object"!=typeof e||e.constructor!==Object)return e;const t={};return Object.keys(e).forEach(function(r){r==(0|r)&&(r|=0);const n=e[r];t[n]=r}),t}))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach(function(e){c.prototype[e]=function(){const t=this._baseState;throw new Error(e+" not implemented for encoding: "+t.enc)}}),f.forEach(function(e){c.prototype[e]=function(){const t=this._baseState,r=Array.prototype.slice.call(arguments);return o(null===t.tag),t.tag=e,this._useArgs(r),this}}),c.prototype.use=function(e){o(e);const t=this._baseState;return o(null===t.use),t.use=e,this},c.prototype.optional=function(){return this._baseState.optional=!0,this},c.prototype.def=function(e){const t=this._baseState;return o(null===t.default),t.default=e,t.optional=!0,this},c.prototype.explicit=function(e){const t=this._baseState;return o(null===t.explicit&&null===t.implicit),t.explicit=e,this},c.prototype.implicit=function(e){const t=this._baseState;return o(null===t.explicit&&null===t.implicit),t.implicit=e,this},c.prototype.obj=function(){const e=this._baseState,t=Array.prototype.slice.call(arguments);return e.obj=!0,0!==t.length&&this._useArgs(t),this},c.prototype.key=function(e){const t=this._baseState;return o(null===t.key),t.key=e,this},c.prototype.any=function(){return this._baseState.any=!0,this},c.prototype.choice=function(e){const t=this._baseState;return o(null===t.choice),t.choice=e,this._useArgs(Object.keys(e).map(function(t){return e[t]})),this},c.prototype.contains=function(e){const t=this._baseState;return o(null===t.use),t.contains=e,this},c.prototype._decode=function(e,t){const r=this._baseState;if(null===r.parent)return e.wrapResult(r.children[0]._decode(e,t));let n,i=r.default,o=!0,f=null;if(null!==r.key&&(f=e.enterKey(r.key)),r.optional){let n=null;if(null!==r.explicit?n=r.explicit:null!==r.implicit?n=r.implicit:null!==r.tag&&(n=r.tag),null!==n||r.any){if(o=this._peekTag(e,n,r.any),e.isError(o))return o}else{const n=e.save();try{null===r.choice?this._decodeGeneric(r.tag,e,t):this._decodeChoice(e,t),o=!0}catch(e){o=!1}e.restore(n)}}if(r.obj&&o&&(n=e.enterObject()),o){if(null!==r.explicit){const t=this._decodeTag(e,r.explicit);if(e.isError(t))return t;e=t}const n=e.offset;if(null===r.use&&null===r.choice){let t;r.any&&(t=e.save());const n=this._decodeTag(e,null!==r.implicit?r.implicit:r.tag,r.any);if(e.isError(n))return n;r.any?i=e.raw(t):e=n}if(t&&t.track&&null!==r.tag&&t.track(e.path(),n,e.length,"tagged"),t&&t.track&&null!==r.tag&&t.track(e.path(),e.offset,e.length,"content"),r.any||(i=null===r.choice?this._decodeGeneric(r.tag,e,t):this._decodeChoice(e,t)),e.isError(i))return i;if(r.any||null!==r.choice||null===r.children||r.children.forEach(function(r){r._decode(e,t)}),r.contains&&("octstr"===r.tag||"bitstr"===r.tag)){const n=new a(i);i=this._getUse(r.contains,e._reporterState.obj)._decode(n,t)}}return r.obj&&o&&(i=e.leaveObject(n)),null===r.key||null===i&&!0!==o?null!==f&&e.exitKey(f):e.leaveKey(f,r.key,i),i},c.prototype._decodeGeneric=function(e,t,r){const n=this._baseState;return"seq"===e||"set"===e?null:"seqof"===e||"setof"===e?this._decodeList(t,e,n.args[0],r):/str$/.test(e)?this._decodeStr(t,e,r):"objid"===e&&n.args?this._decodeObjid(t,n.args[0],n.args[1],r):"objid"===e?this._decodeObjid(t,null,null,r):"gentime"===e||"utctime"===e?this._decodeTime(t,e,r):"null_"===e?this._decodeNull(t,r):"bool"===e?this._decodeBool(t,r):"objDesc"===e?this._decodeStr(t,e,r):"int"===e||"enum"===e?this._decodeInt(t,n.args&&n.args[0],r):null!==n.use?this._getUse(n.use,t._reporterState.obj)._decode(t,r):t.error("unknown tag: "+e)},c.prototype._getUse=function(e,t){const r=this._baseState;return r.useDecoder=this._use(e,t),o(null===r.useDecoder._baseState.parent),r.useDecoder=r.useDecoder._baseState.children[0],r.implicit!==r.useDecoder._baseState.implicit&&(r.useDecoder=r.useDecoder.clone(),r.useDecoder._baseState.implicit=r.implicit),r.useDecoder},c.prototype._decodeChoice=function(e,t){const r=this._baseState;let n=null,i=!1;return Object.keys(r.choice).some(function(a){const o=e.save(),f=r.choice[a];try{const r=f._decode(e,t);if(e.isError(r))return!1;n={type:a,value:r},i=!0}catch(t){return e.restore(o),!1}return!0},this),i?n:e.error("Choice not matched")},c.prototype._createEncoderBuffer=function(e){return new i(e,this.reporter)},c.prototype._encode=function(e,t,r){const n=this._baseState;if(null!==n.default&&n.default===e)return;const i=this._encodeValue(e,t,r);return void 0===i||this._skipDefault(i,t,r)?void 0:i},c.prototype._encodeValue=function(e,t,r){const i=this._baseState;if(null===i.parent)return i.children[0]._encode(e,t||new n);let a=null;if(this.reporter=t,i.optional&&void 0===e){if(null===i.default)return;e=i.default}let o=null,f=!1;if(i.any)a=this._createEncoderBuffer(e);else if(i.choice)a=this._encodeChoice(e,t);else if(i.contains)o=this._getUse(i.contains,r)._encode(e,t),f=!0;else if(i.children)o=i.children.map(function(r){if("null_"===r._baseState.tag)return r._encode(null,t,e);if(null===r._baseState.key)return t.error("Child should have a key");const n=t.enterKey(r._baseState.key);if("object"!=typeof e)return t.error("Child expected, but input is not object");const i=r._encode(e[r._baseState.key],t,e);return t.leaveKey(n),i},this).filter(function(e){return e}),o=this._createEncoderBuffer(o);else if("seqof"===i.tag||"setof"===i.tag){if(!i.args||1!==i.args.length)return t.error("Too many args for : "+i.tag);if(!Array.isArray(e))return t.error("seqof/setof, but data is not Array");const r=this.clone();r._baseState.implicit=null,o=this._createEncoderBuffer(e.map(function(r){const n=this._baseState;return this._getUse(n.args[0],e)._encode(r,t)},r))}else null!==i.use?a=this._getUse(i.use,r)._encode(e,t):(o=this._encodePrimitive(i.tag,e),f=!0);if(!i.any&&null===i.choice){const e=null!==i.implicit?i.implicit:i.tag,r=null===i.implicit?"universal":"context";null===e?null===i.use&&t.error("Tag could be omitted only for .use()"):null===i.use&&(a=this._encodeComposite(e,f,r,o))}return null!==i.explicit&&(a=this._encodeComposite(i.explicit,!1,"context",a)),a},c.prototype._encodeChoice=function(e,t){const r=this._baseState,n=r.choice[e.type];return n||o(!1,e.type+" not found in "+JSON.stringify(Object.keys(r.choice))),n._encode(e.value,t)},c.prototype._encodePrimitive=function(e,t){const r=this._baseState;if(/str$/.test(e))return this._encodeStr(t,e);if("objid"===e&&r.args)return this._encodeObjid(t,r.reverseArgs[0],r.args[1]);if("objid"===e)return this._encodeObjid(t,null,null);if("gentime"===e||"utctime"===e)return this._encodeTime(t,e);if("null_"===e)return this._encodeNull();if("int"===e||"enum"===e)return this._encodeInt(t,r.args&&r.reverseArgs[0]);if("bool"===e)return this._encodeBool(t);if("objDesc"===e)return this._encodeStr(t,e);throw new Error("Unsupported tag: "+e)},c.prototype._isNumstr=function(e){return/^[0-9 ]*$/.test(e)},c.prototype._isPrintstr=function(e){return/^[A-Za-z0-9 '()+,-.\/:=?]*$/.test(e)}},function(e,t,r){"use strict";const n=r(4);function i(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function a(e,t){this.path=e,this.rethrow(t)}t.Reporter=i,i.prototype.isError=function(e){return e instanceof a},i.prototype.save=function(){const e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}},i.prototype.restore=function(e){const t=this._reporterState;t.obj=e.obj,t.path=t.path.slice(0,e.pathLen)},i.prototype.enterKey=function(e){return this._reporterState.path.push(e)},i.prototype.exitKey=function(e){const t=this._reporterState;t.path=t.path.slice(0,e-1)},i.prototype.leaveKey=function(e,t,r){const n=this._reporterState;this.exitKey(e),null!==n.obj&&(n.obj[t]=r)},i.prototype.path=function(){return this._reporterState.path.join("/")},i.prototype.enterObject=function(){const e=this._reporterState,t=e.obj;return e.obj={},t},i.prototype.leaveObject=function(e){const t=this._reporterState,r=t.obj;return t.obj=e,r},i.prototype.error=function(e){let t;const r=this._reporterState,n=e instanceof a;if(t=n?e:new a(r.path.map(function(e){return"["+JSON.stringify(e)+"]"}).join(""),e.message||e,e.stack),!r.options.partial)throw t;return n||r.errors.push(t),t},i.prototype.wrapResult=function(e){const t=this._reporterState;return t.options.partial?{result:this.isError(e)?null:e,errors:t.errors}:e},n(a,Error),a.prototype.rethrow=function(e){if(this.message=e+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,a),!this.stack)try{throw new Error(this.message)}catch(e){this.stack=e.stack}return this}},function(e,t,r){"use strict";function n(e){const t={};return Object.keys(e).forEach(function(r){(0|r)==r&&(r|=0);const n=e[r];t[n]=r}),t}t.tagClass={0:"universal",1:"application",2:"context",3:"private"},t.tagClassByName=n(t.tagClass),t.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},t.tagByName=n(t.tag)},function(e,t,r){"use strict";var n,i=t,a=r(19),o=r(41),f=r(8).assert;function s(e){"short"===e.type?this.curve=new o.short(e):"edwards"===e.type?this.curve=new o.edwards(e):this.curve=new o.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,f(this.g.validate(),"Invalid curve"),f(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function c(e,t){Object.defineProperty(i,e,{configurable:!0,enumerable:!0,get:function(){var r=new s(t);return Object.defineProperty(i,e,{configurable:!0,enumerable:!0,value:r}),r}})}i.PresetCurve=s,c("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:a.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),c("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:a.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),c("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:a.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),c("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:a.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),c("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:a.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),c("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:a.sha256,gRed:!1,g:["9"]}),c("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:a.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=r(77)}catch(e){n=void 0}c("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:a.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})},function(e,t,r){"use strict";(function(e){var n=r(2);Object.defineProperty(t,"__esModule",{value:!0}),t.PBES2ESParams=t.PBKDF2Params=t.PBES2Params=t.PBEParameter=t.EncryptedPrivateKeyInfo=t.OneAsymmetricKey=t.SubjectPublicKeyInfo=t.KeyStructure=void 0;var i=n(r(13)),a=i.default.define("KeyStructure",function(){this.choice({subjectPublicKeyInfo:this.use(o),oneAsymmetricKey:this.use(f),encryptedPrivateKeyInfo:this.use(s)})});t.KeyStructure=a;var o=i.default.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(p),this.key("subjectPublicKey").bitstr())});t.SubjectPublicKeyInfo=o;var f=i.default.define("OneAsymmetricKey",function(){this.seq().obj(this.key("version").use(l),this.key("privateKeyAlgorithm").use(p),this.key("privateKey").octstr(),this.key("attributes").implicit(0).optional().any(),this.key("publicKey").implicit(1).optional().bitstr())});t.OneAsymmetricKey=f;var s=i.default.define("EncryptedPrivateKeyInfo",function(){this.seq().obj(this.key("encryptionAlgorithm").use(p),this.key("encryptedData").octstr())});t.EncryptedPrivateKeyInfo=s;var c=i.default.define("PBEParameter",function(){this.seq().obj(this.key("salt").octstr(8),this.key("iterationCount").int())});t.PBEParameter=c;var u=i.default.define("PBES2Params",function(){this.seq().obj(this.key("keyDerivationFunc").use(p),this.key("encryptionScheme").use(p))});t.PBES2Params=u;var d=i.default.define("PBKDF2Params",function(){this.seq().obj(this.key("salt").choice({specified:this.octstr(),otherSource:this.use(p)}),this.key("iterationCount").int(),this.key("keyLength").int().optional(),this.key("prf").use(p).def({algorithm:[1,2,840,113549,2,7],parameters:e.from([5,0])}))});t.PBKDF2Params=d;var h={"des-ede3-cbc":i.default.define("DesEde3CbcParams",function(){this.octstr()}),"aes128-cbc":i.default.define("Aes128CbcParams",function(){this.octstr()}),"aes192-cbc":i.default.define("Aes192CbcParams",function(){this.octstr()}),"aes256-cbc":i.default.define("Aes256CbcParams",function(){this.octstr()})};t.PBES2ESParams=h;var p=i.default.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional().any())}),l=i.default.define("Version",function(){this.int()})}).call(this,r(5).Buffer)},function(e,t,r){"use strict";t.utils=r(87),t.Cipher=r(88),t.DES=r(89),t.CBC=r(90),t.EDE=r(91)},function(e,t,r){"use strict";e.exports=function(e,t){return function(r,n){var i=2*n,a=2*t;r[i]=e[a],r[i+1]=e[a+1]}}},function(e,t,r){"use strict";var n=t;n.version=r(67).version,n.utils=r(8),n.rand=r(40),n.curve=r(41),n.curves=r(24),n.ec=r(78),n.eddsa=r(82)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getRandomBytes",{enumerable:!0,get:function(){return n.getRandomBytes}}),Object.defineProperty(t,"getRandomAsciiString",{enumerable:!0,get:function(){return n.getRandomAsciiString}}),Object.defineProperty(t,"getRandomString",{enumerable:!0,get:function(){return n.getRandomString}}),Object.defineProperty(t,"getRandomSampledString",{enumerable:!0,get:function(){return n.getRandomSampledString}}),t.default=void 0;var n=r(117),i={getRandomBytes:n.getRandomBytes,getRandomAsciiString:n.getRandomAsciiString,getRandomString:n.getRandomString,getRandomSampledString:n.getRandomSampledString};t.default=i},function(t,r){t.exports=e},function(e,t,r){"use strict";var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var i=n(r(49));t.encodeBase64=function(e){var r="";return r="string"==typeof e?e:t.arrayBufferToString(e),i.getEnvBtoa()(r)},t.decodeBase64=function(e){var r=i.getEnvAtob()(e),n=t.stringToArrayBuffer(r);return o(n)};var a=function(e){if(e instanceof Uint8Array)return e;if(ArrayBuffer.isView(e)&&void 0!==e.buffer)return new Uint8Array(e.buffer);if(e instanceof ArrayBuffer)return new Uint8Array(e);throw new Error("Input must be an ArrayBuffer or a TypedArray")},o=function(e){for(var t=!0,r=0;r126||e[r]<32&&13!==e[r]&&10!==e[r]){t=!1;break}var n=null;if(t){n="";for(r=0;r=31)return n.error("Multi-octet tag encoding unsupported");t||(i|=32);return i|=o.tagClassByName[r||"universal"]<<6}(e,t,r,this.reporter);if(n.length<128){const e=new i(2);return e[0]=a,e[1]=n.length,this._createEncoderBuffer([e,n])}let f=1;for(let e=n.length;e>=256;e>>=8)f++;const s=new i(2+f);s[0]=a,s[1]=128|f;for(let e=1+f,t=n.length;t>0;e--,t>>=8)s[e]=255&t;return this._createEncoderBuffer([s,n])},s.prototype._encodeStr=function(e,t){if("bitstr"===t)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===t){const t=new i(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 a=new i(n);let o=a.length-1;for(let t=e.length-1;t>=0;t--){let r=e[t];for(a[o--]=127&r;(r>>=7)>0;)a[o--]=128|127&r}return this._createEncoderBuffer(a)},s.prototype._encodeTime=function(e,t){let r;const n=new Date(e);return"gentime"===t?r=[c(n.getUTCFullYear()),c(n.getUTCMonth()+1),c(n.getUTCDate()),c(n.getUTCHours()),c(n.getUTCMinutes()),c(n.getUTCSeconds()),"Z"].join(""):"utctime"===t?r=[c(n.getUTCFullYear()%100),c(n.getUTCMonth()+1),c(n.getUTCDate()),c(n.getUTCHours()),c(n.getUTCMinutes()),c(n.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(r,"octstr")},s.prototype._encodeNull=function(){return this._createEncoderBuffer("")},s.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=new i(t)}if(i.isBuffer(e)){let t=e.length;0===e.length&&t++;const r=new i(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(new i(n))},s.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},s.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getEncoder("der").tree},s.prototype._skipDefault=function(e,t,r){const n=this._baseState;let i;if(null===n.default)return!1;const a=e.join();if(void 0===n.defaultBuffer&&(n.defaultBuffer=this._encodeValue(n.default,t,r).join()),a.length!==n.defaultBuffer.length)return!1;for(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 d(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>8,o=255&i;a?r.push(a,o):r.push(o)}return r},n.zero2=i,n.toHex=a,n.encode=function(e,t){return"hex"===t?a(e):e}},function(e,t,r){var n;function i(e){this.rand=e}if(e.exports=function(e){return n||(n=new i(null)),n.generate(e)},e.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>>3},t.g1_256=function(e){return n(e,17)^n(e,19)^e>>>10}},function(e,t,r){"use strict";var n=r(11),i=r(17),a=r(42),o=r(7),f=n.sum32,s=n.sum32_4,c=n.sum32_5,u=a.ch32,d=a.maj32,h=a.s0_256,p=a.s1_256,l=a.g0_256,b=a.g1_256,y=i.BlockHash,m=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function v(){if(!(this instanceof v))return new v;y.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=m,this.W=new Array(64)}n.inherits(v,y),e.exports=v,v.blockSize=512,v.outSize=256,v.hmacStrength=192,v.padLength=64,v.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n=0;--a){var o=this.tryEntries[a],f=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var s=n.call(o,"catchLoc"),c=n.call(o,"finallyLoc");if(s&&c){if(this.prev=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),k(r),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;k(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:P(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),l}},e}(e.exports);try{regeneratorRuntime=n}catch(e){Function("r","regeneratorRuntime = r")(n)}},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.getEnvBtoa=function(){return"undefined"!=typeof window?window.btoa:r},t.getEnvAtob=function(){return"undefined"!=typeof window?window.atob:n};var r=function(t){if(void 0===e)throw new Error("UnsupportedEnvironment");var r=Object.prototype.toString.call(t).slice(8,-1);return(e.isBuffer(t)?t:["ArrayBuffer","TypedArray","Uint8Array","Int8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array"].indexOf(r)>=0?e.from(t):e.from(t.toString(),"binary")).toString("base64")},n=function(t){if(void 0===e)throw new Error("UnsupportedEnvironment");return e.from(t,"base64").toString("binary")}}).call(this,r(5).Buffer)},function(e,t,r){"use strict";t.toByteArray=function(e){for(var t,r=c(e),n=r[0],o=r[1],f=new a(function(e,t,r){return 3*(t+r)/4-r}(0,n,o)),s=0,u=o>0?n-4:n,d=0;d>16&255,f[s++]=t>>8&255,f[s++]=255&t;2===o&&(t=i[e.charCodeAt(d)]<<2|i[e.charCodeAt(d+1)]>>4,f[s++]=255&t);1===o&&(t=i[e.charCodeAt(d)]<<10|i[e.charCodeAt(d+1)]<<4|i[e.charCodeAt(d+2)]>>2,f[s++]=t>>8&255,f[s++]=255&t);return f},t.fromByteArray=function(e){for(var t,r=e.length,i=r%3,a=[],o=0,f=r-i;of?f:o+16383));1===i?(t=e[r-1],a.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],a.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return a.join("")};for(var n=[],i=[],a="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",f=0,s=o.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 u(e,t,r){for(var i,a,o=[],f=t;f>18&63]+n[a>>12&63]+n[a>>6&63]+n[63&a]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,r,n,i){var a,o,f=8*i-n-1,s=(1<>1,u=-7,d=r?i-1:0,h=r?-1:1,p=e[t+d];for(d+=h,a=p&(1<<-u)-1,p>>=-u,u+=f;u>0;a=256*a+e[t+d],d+=h,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=n;u>0;o=256*o+e[t+d],d+=h,u-=8);if(0===a)a=1-c;else{if(a===s)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,n),a-=c}return(p?-1:1)*o*Math.pow(2,a-n)},t.write=function(e,t,r,n,i,a){var o,f,s,c=8*a-i-1,u=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:a-1,l=n?1:-1,b=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(f=isNaN(t)?1:0,o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-o))<1&&(o--,s*=2),(t+=o+d>=1?h/s:h*Math.pow(2,1-d))*s>=2&&(o++,s/=2),o+d>=u?(f=0,o=u):o+d>=1?(f=(t*s-1)*Math.pow(2,i),o+=d):(f=t*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;e[r+p]=255&f,p+=l,f/=256,i-=8);for(o=o<0;e[r+p]=255&o,p+=l,o/=256,c-=8);e[r+p-l]|=128*b}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){"use strict";var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var i=n(r(31)),a={public:"PUBLIC KEY",private:"PRIVATE KEY",encryptedPrivate:"ENCRYPTED PRIVATE KEY",certificate:"CERTIFICATE",certRequest:"CERTIFICATE REQUEST"};t.pemToBin=function(e){var t=f(e);return i.decodeBase64(t)},t.binToPem=function(e,t){var r=i.encodeBase64(e);return o(r,t)};var o=function(e,t){if(Object.keys(a).indexOf(t)<0)throw new Error("Unsupported type");for(var r=a[t],n="-----BEGIN "+r+"-----\n";e.length>0;)n+=e.substring(0,64)+"\n",e=e.substring(64);return n=n+"-----END "+r+"-----"},f=function(e){var t=RegExp("^-----[s]*BEGIN[^-]*-----$","gm"),r=RegExp("^-----[s]*END[^-]*-----$","gm");try{var n=e.split(t)[1].split(r)[0];return n=n.replace(/\r?\n/g,"")}catch(e){throw new Error("Invalid format as PEM")}}},function(e,t){},function(e,t,r){"use strict";const n=r(34),i=r(36),a=r(4);function o(e,t){this.name=e,this.body=t,this.decoders={},this.encoders={}}t.define=function(e,t){return new o(e,t)},o.prototype._createNamed=function(e){const t=this.name;function r(e){this._initNamed(e,t)}return a(r,e),r.prototype._initNamed=function(t,r){e.call(this,t,r)},new r(this)},o.prototype._getDecoder=function(e){return e=e||"der",this.decoders.hasOwnProperty(e)||(this.decoders[e]=this._createNamed(i[e])),this.decoders[e]},o.prototype.decode=function(e,t,r){return this._getDecoder(t).decode(e,r)},o.prototype._getEncoder=function(e){return e=e||"der",this.encoders.hasOwnProperty(e)||(this.encoders[e]=this._createNamed(n[e])),this.encoders[e]},o.prototype.encode=function(e,t,r){return this._getEncoder(t).encode(e,r)}},function(e,t,r){"use strict";const n=r(4),i=r(35);function a(e){i.call(this,e),this.enc="pem"}n(a,i),e.exports=a,a.prototype.encode=function(e,t){const r=i.prototype.encode.call(this,e).toString("base64"),n=["-----BEGIN "+t.label+"-----"];for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};(0,o.default)(this,e);var i=(0,u.default)(r),a=(0,u.default)(n);if(this._jwk={},this._der=null,this._oct={},this._current={jwk:!1,der:!1,oct:!1},"jwk"===t)this._setJwk(i);else if("der"===t||"pem"===t){if("der"===t&&!(i instanceof Uint8Array))throw new Error("DerKeyMustBeUint8Array");if("pem"===t&&"string"!=typeof i)throw new Error("PemKeyMustBeString");this._setAsn1(i,t)}else{if("oct"!==t)throw new Error("UnsupportedType");if("string"!=typeof a.namedCurve)throw new Error("namedCurveMustBeSpecified");if(!(i instanceof Uint8Array))throw new Error("OctetKeyMustBeUint8Array");this._setSec1(i,a.namedCurve)}}var t,r,n,p;return(0,f.default)(e,[{key:"_setJwk",value:function(e){this._type=(0,h.getJwkType)(e),this._jwk=e,this._isEncrypted&&(this._der=null),this._isEncrypted=!1,this._setCurrentStatus()}},{key:"_setAsn1",value:function(e,t){this._type=(0,h.isAsn1Public)(e,t)?"public":"private",this._isEncrypted=(0,h.isAsn1Encrypted)(e,t),this._der="pem"===t?d.default.formatter.pemToBin(e):e,this._isEncrypted&&(this._jwk={},this._oct={}),this._setCurrentStatus()}},{key:"_setSec1",value:function(e,t){this._type=(0,h.getSec1KeyType)(e,t),this._oct={namedCurve:t,key:e},this._isEncrypted&&(this._der=null),this._isEncrypted=!1,this._setCurrentStatus()}},{key:"_setCurrentStatus",value:function(){this._current.jwk="string"==typeof this._jwk.kty&&("RSA"===this._jwk.kty||"EC"===this._jwk.kty),this._current.der=void 0!==this._der&&this._der instanceof Uint8Array&&this._der.length>0,this._current.oct=void 0!==this._oct.key&&this._oct.key instanceof Uint8Array&&this._oct.key.length>0&&"string"==typeof this._oct.namedCurve}},{key:"export",value:(p=(0,a.default)(i.default.mark(function e(){var t,r,n,a=arguments;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=a.length>0&&void 0!==a[0]?a[0]:"jwk",r=a.length>1&&void 0!==a[1]?a[1]:{},!(["pem","der","jwk","oct"].indexOf(t)<0)){e.next=4;break}throw new Error("UnsupportedFormat");case 4:if(!this._isEncrypted||"private"!==this._type){e.next=10;break}if("der"!==t&&"pem"!==t||0!==Object.keys(r).length||!this._current.der){e.next=9;break}return e.abrupt("return","pem"===t?d.default.formatter.binToPem(this._der,"encryptedPrivate"):this._der);case 9:throw new Error("DecryptionRequired");case 10:if(!this._current.jwk){e.next=14;break}n=this._jwk,e.next=27;break;case 14:if(!this._current.oct){e.next=20;break}return e.next=17,(0,s.toJwkFrom)("oct",this._oct.key,{namedCurve:this._oct.namedCurve});case 17:n=e.sent,e.next=27;break;case 20:if(!this._current.der){e.next=26;break}return e.next=23,(0,s.toJwkFrom)("der",this._der);case 23:n=e.sent,e.next=27;break;case 26:throw new Error("InvalidStatus");case 27:if(this._setJwk(n),"der"!==t&&"pem"!==t){e.next=35;break}return void 0===r.encryptParams&&(r.encryptParams={}),e.next=32,(0,s.fromJwkTo)(t,n,{outputPublic:r.outputPublic,compact:r.compact,encryptParams:r.encryptParams});case 32:return e.abrupt("return",e.sent);case 35:if("oct"!==t){e.next=41;break}return e.next=38,(0,s.fromJwkTo)(t,n,{outputPublic:r.outputPublic,output:r.output,compact:r.compact});case 38:return e.abrupt("return",e.sent);case 41:return e.abrupt("return",n);case 42:case"end":return e.stop()}},e,this)})),function(){return p.apply(this,arguments)})},{key:"encrypt",value:(n=(0,a.default)(i.default.mark(function e(t){var r;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isEncrypted){e.next=2;break}throw new Error("AlreadyEncrypted");case 2:return r={encryptParams:{passphrase:t}},e.t0=this,e.next=6,this.export("der",r);case 6:return e.t1=e.sent,e.t0._setAsn1.call(e.t0,e.t1,"der"),e.abrupt("return",!0);case 9:case"end":return e.stop()}},e,this)})),function(e){return n.apply(this,arguments)})},{key:"decrypt",value:(r=(0,a.default)(i.default.mark(function e(t){var r;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this._isEncrypted){e.next=2;break}throw new Error("NotEncrypted");case 2:if(!this._current.der||"string"!=typeof t){e.next=8;break}return e.next=5,(0,s.toJwkFrom)("der",this._der,{passphrase:t});case 5:r=e.sent,e.next=9;break;case 8:throw new Error("FailedToDecrypt");case 9:return this._setJwk(r),e.abrupt("return",!0);case 11:case"end":return e.stop()}},e,this)})),function(e){return r.apply(this,arguments)})},{key:"getJwkThumbprint",value:(t=(0,a.default)(i.default.mark(function e(){var t,r,n=arguments;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=n.length>0&&void 0!==n[0]?n[0]:"SHA-256",r=n.length>1&&void 0!==n[1]?n[1]:"binary",!this._isEncrypted){e.next=4;break}throw new Error("DecryptionRequired");case 4:return e.t0=c.getJwkThumbprint,e.next=7,this.export("jwk");case 7:return e.t1=e.sent,e.t2=t,e.t3=r,e.next=12,(0,e.t0)(e.t1,e.t2,e.t3);case 12:return e.abrupt("return",e.sent);case 13:case"end":return e.stop()}},e,this)})),function(){return t.apply(this,arguments)})},{key:"keyType",get:function(){var e=this;if(this._isEncrypted)throw new Error("DecryptionRequired");return new Promise(function(){var t=(0,a.default)(i.default.mark(function t(r,n){var a;return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.export("jwk").catch(function(e){n(e)});case 2:a=t.sent,r(a.kty);case 4:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}())}},{key:"jwkThumbprint",get:function(){return this.getJwkThumbprint()}},{key:"isEncrypted",get:function(){return this._isEncrypted}},{key:"isPrivate",get:function(){return"private"===this._type}},{key:"der",get:function(){return this.export("der")}},{key:"pem",get:function(){return this.export("pem")}},{key:"jwk",get:function(){return this.export("jwk")}},{key:"oct",get:function(){return this.export("oct",{output:"string"})}}]),e}();t.Key=p},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function r(e,t){for(var r=0;r0&&void 0!==i[0]?i[0]:"pem",r=i.length>1?i[1]:void 0,n=i.length>2&&void 0!==i[2]?i[2]:{},!(["pem","der","oct"].indexOf(t)<0)){e.next=5;break}throw new Error("InvalidOutputForm");case 5:if("object"===(0,o.default)(r)){e.next=7;break}throw new Error("InvalidJWKAsObject");case 7:if("EC"===r.kty||"RSA"===r.kty){e.next=9;break}throw new Error("UnsupportedKeyType");case 9:if(void 0===n.outputPublic||"boolean"==typeof n.outputPublic){e.next=11;break}throw new Error("outputPublicMustBeBoolean");case 11:if("EC"===r.key&&"boolean"!=typeof n.compact&&(n.compact=!1),"oct"===t&&"string"!==n.output&&(n.output="binary"),void 0===n.encryptParams&&(n.encryptParams={}),"der"!==t&&"pem"!==t||void 0!==n.encryptParams.passphrase||(n.encryptParams.passphrase=""),"der"!==t&&"pem"!==t){e.next=21;break}return e.next=18,s.fromJwk(r,t,{outputPublic:n.outputPublic,compact:n.compact,encOptions:n.encryptParams});case 18:return e.abrupt("return",e.sent);case 21:if("oct"!==t||"EC"!==r.kty){e.next=25;break}return e.abrupt("return",c.fromJwk(r,{outputPublic:n.outputPublic,outputFormat:n.output,compact:n.compact}));case 25:throw new Error("UnsupportedConversion");case 26:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}();t.fromJwkTo=u;var d=function(){var e=(0,f.default)(a.default.mark(function e(t,r){var n,i=arguments;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=i.length>2&&void 0!==i[2]?i[2]:{},!(["pem","der","oct"].indexOf(t)<0)){e.next=3;break}throw new Error("InvalidInputForm");case 3:if("oct"!==t||n.namedCurve){e.next=5;break}throw new Error("InappropriateOptions");case 5:if(void 0===n.outputPublic||"boolean"==typeof n.outputPublic){e.next=7;break}throw new Error("outputPublicMustBeBoolean");case 7:if("der"!==t&&"pem"!==t||void 0!==n.passphrase||(n.passphrase=""),"der"!==t&&"pem"!==t){e.next=14;break}return e.next=11,s.toJwk(r,t,{outputPublic:n.outputPublic,passphrase:n.passphrase});case 11:return e.abrupt("return",e.sent);case 14:if("oct"!==t){e.next=18;break}return e.abrupt("return",c.toJwk(r,n.namedCurve,{outputPublic:n.outputPublic}));case 18:throw new Error("UnsupportedConversion");case 19:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}();t.toJwkFrom=d},function(e,t){function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(t){return"function"==typeof Symbol&&"symbol"===r(Symbol.iterator)?e.exports=n=function(e){return r(e)}:e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":r(e)},n(t)}e.exports=n},function(e,t,r){"use strict";var n=r(12),i=r(2);Object.defineProperty(t,"__esModule",{value:!0}),t.toJwk=t.fromJwk=void 0;var a=i(r(0)),o=i(r(1)),f=n(r(66)),s=n(r(85)),c=n(r(14)),u=i(r(3)),d=i(r(5)),h=r(25),p=r(86),l=r(20),b=d.default.Buffer,y=function(){var e=(0,o.default)(a.default.mark(function e(t,r,n){var i,o,c,d,b,y,m,v;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i=n.outputPublic,o=n.compact,c=void 0!==o&&o,d=n.encOptions,b=(0,l.getJwkType)(t),y="boolean"==typeof i&&i?"public":b,"EC"===t.kty?m=f.fromJWK(t,y,c):"RSA"===t.kty&&(m=s.fromJwk(t,y)),"public"!==y){e.next=8;break}v=h.SubjectPublicKeyInfo.encode(m,"der"),e.next=14;break;case 8:if(v=h.OneAsymmetricKey.encode(m,"der"),!(void 0!==d.passphrase&&d.passphrase.length>0)){e.next=14;break}return e.next=12,(0,p.encryptEncryptedPrivateKeyInfo)(v,d);case 12:v=e.sent,y="encryptedPrivate";case 14:return v=new Uint8Array(v),e.abrupt("return","pem"===r?u.default.formatter.binToPem(v,y):v);case 16:case"end":return e.stop()}},e)}));return function(t,r,n){return e.apply(this,arguments)}}();t.fromJwk=y;var m=function(){var e=(0,o.default)(a.default.mark(function e(t,r,n){var i,o,d,l,y,m;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:i=n.outputPublic,o=n.passphrase,d="pem"===r?u.default.formatter.pemToBin(t):t,e.prev=2,l=h.KeyStructure.decode(b.from(d),"der"),e.next=9;break;case 6:throw e.prev=6,e.t0=e.catch(2),new Error("FailedToDecodeKey");case 9:if("subjectPublicKeyInfo"!==l.type){e.next=14;break}y="public",l=l.value,e.next=26;break;case 14:if(y="boolean"==typeof i&&i?"public":"private","encryptedPrivateKeyInfo"!==l.type){e.next=21;break}return e.next=18,(0,p.decryptEncryptedPrivateKeyInfo)(l.value,o);case 18:l=e.sent,e.next=26;break;case 21:if("oneAsymmetricKey"!==l.type){e.next=25;break}l=l.value,e.next=26;break;case 25:throw new Error("UnsupportedKeyStructure");case 26:if(!((m=(0,c.getAlgorithmFromOid)("public"===y?l.algorithm.algorithm:l.privateKeyAlgorithm.algorithm,c.default.publicKeyAlgorithms)).length<1)){e.next=29;break}throw new Error("UnsupportedKey");case 29:if("EC"!==m[0]){e.next=33;break}return e.abrupt("return",f.toJWK(l,y));case 33:if("RSA"!==m[0]){e.next=37;break}return e.abrupt("return",s.toJwk(l,y));case 37:throw new Error("InvalidKeyType");case 38:case"end":return e.stop()}},e,null,[[2,6]])}));return function(t,r,n){return e.apply(this,arguments)}}();t.toJwk=m},function(e,t,r){"use strict";var n=r(12),i=r(2);Object.defineProperty(t,"__esModule",{value:!0}),t.toJWK=t.fromJWK=void 0;var a=i(r(13)),o=n(r(14)),f=r(38);t.fromJWK=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(Object.keys(o.default.namedCurves).indexOf(e.crv)<0)throw new Error("UnsupportedCurve");var n=(0,f.fromJwk)(e,{outputFormat:"binary",outputPublic:!0,compact:r}),i=o.default.publicKeyAlgorithms.EC.oid,a={unused:0,data:Array.from(n)},u=s.encode({type:"namedCurve",value:o.default.namedCurves[e.crv].oid},"der"),d={algorithm:i,parameters:u},h={};if("public"===t)h.subjectPublicKey=a,h.algorithm=d;else if("private"===t){var p=(0,f.fromJwk)(e,{outputFormat:"binary",outputPublic:!1,compact:r});h.version=0,h.privateKeyAlgorithm=d,h.privateKey=c.encode({version:1,privateKey:Array.from(p),parameters:u,publicKey:a},"der")}return h};t.toJWK=function(e,t){if("public"===t){e.algorithm.parameters=s.decode(e.algorithm.parameters,"der");var r=new Uint8Array(e.subjectPublicKey.data),n=(0,o.getAlgorithmFromOid)(e.algorithm.parameters.value,o.default.namedCurves);if(n.length<1)throw new Error("UnsupportedCurve");return(0,f.toJwk)(r,n[0],{outputPublic:!0})}if("private"===t){e.privateKeyAlgorithm.parameters=s.decode(e.privateKeyAlgorithm.parameters,"der");try{e.privateKey=c.decode(e.privateKey,"der")}catch(t){e.privateKey=u.decode(e.privateKey,"der")}var i=new Uint8Array(e.privateKey.privateKey),a=(0,o.getAlgorithmFromOid)(e.privateKeyAlgorithm.parameters.value,o.default.namedCurves);if(a.length<1)throw new Error("UnsupportedCurve");return(0,f.toJwk)(i,a[0],{outputPublic:!1})}};var s=a.default.define("ECParameters",function(){this.choice({namedCurve:this.objid()})}),c=a.default.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").explicit(0).optional().any(),this.key("publicKey").explicit(1).optional().bitstr())}),u=a.default.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("publicKey").explicit(1).optional().bitstr())})},function(e){e.exports=JSON.parse('{"name":"elliptic","version":"6.5.0","description":"EC cryptography","main":"lib/elliptic.js","files":["lib"],"scripts":{"jscs":"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js","jshint":"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js","lint":"npm run jscs && npm run jshint","unit":"istanbul test _mocha --reporter=spec test/index.js","test":"npm run lint && npm run unit","version":"grunt dist && git add dist/"},"repository":{"type":"git","url":"git@github.com:indutny/elliptic"},"keywords":["EC","Elliptic","curve","Cryptography"],"author":"Fedor Indutny ","license":"MIT","bugs":{"url":"https://github.com/indutny/elliptic/issues"},"homepage":"https://github.com/indutny/elliptic","devDependencies":{"brfs":"^1.4.3","coveralls":"^2.11.3","grunt":"^0.4.5","grunt-browserify":"^5.0.0","grunt-cli":"^1.2.0","grunt-contrib-connect":"^1.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^1.0.1","grunt-mocha-istanbul":"^3.0.1","grunt-saucelabs":"^8.6.2","istanbul":"^0.4.2","jscs":"^2.9.0","jshint":"^2.6.0","mocha":"^2.1.0"},"dependencies":{"bn.js":"^4.4.0","brorand":"^1.0.1","hash.js":"^1.0.0","hmac-drbg":"^1.0.0","inherits":"^2.0.1","minimalistic-assert":"^1.0.0","minimalistic-crypto-utils":"^1.0.0"}}')},function(e,t,r){"use strict";var n=r(8),i=r(10),a=r(4),o=r(18),f=n.assert;function s(e){o.call(this,"short",e),this.a=new i(e.a,16).toRed(this.red),this.b=new i(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function c(e,t,r,n){o.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(t,16),this.y=new i(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function u(e,t,r,n){o.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new i(0)):(this.x=new i(t,16),this.y=new i(r,16),this.z=new i(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}a(s,o),e.exports=s,s.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new i(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=(t=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(e.lambda)r=new i(e.lambda,16);else{var a=this._getEndoRoots(this.n);0===this.g.mul(a[0]).x.cmp(this.g.x.redMul(t))?r=a[0]:(r=a[1],f(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map(function(e){return{a:new i(e.a,16),b:new i(e.b,16)}}):this._getEndoBasis(r)}}},s.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:i.mont(e),r=new i(2).toRed(t).redInvm(),n=r.redNeg(),a=new i(3).toRed(t).redNeg().redSqrt().redMul(r);return[n.redAdd(a).fromRed(),n.redSub(a).fromRed()]},s.prototype._getEndoBasis=function(e){for(var t,r,n,a,o,f,s,c,u,d=this.n.ushrn(Math.floor(this.n.bitLength()/2)),h=e,p=this.n.clone(),l=new i(1),b=new i(0),y=new i(0),m=new i(1),v=0;0!==h.cmpn(0);){var g=p.div(h);c=p.sub(g.mul(h)),u=y.sub(g.mul(l));var w=m.sub(g.mul(b));if(!n&&c.cmp(d)<0)t=s.neg(),r=l,n=c.neg(),a=u;else if(n&&2==++v)break;s=c,p=h,h=c,y=l,l=u,m=b,b=w}o=c.neg(),f=u;var _=n.sqr().add(a.sqr());return o.sqr().add(f.sqr()).cmp(_)>=0&&(o=t,f=r),n.negative&&(n=n.neg(),a=a.neg()),o.negative&&(o=o.neg(),f=f.neg()),[{a:n,b:a},{a:o,b:f}]},s.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],i=n.b.mul(e).divRound(this.n),a=r.b.neg().mul(e).divRound(this.n),o=i.mul(r.a),f=a.mul(n.a),s=i.mul(r.b),c=a.mul(n.b);return{k1:e.sub(o).sub(f),k2:s.add(c).neg()}},s.prototype.pointFromX=function(e,t){(e=new i(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var a=n.fromRed().isOdd();return(t&&!a||!t&&a)&&(n=n.redNeg()),this.point(e,n)},s.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},s.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,a=0;a":""},c.prototype.isInfinity=function(){return this.inf},c.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},c.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),a=i.redSqr().redISub(this.x.redAdd(this.x)),o=i.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,o)},c.prototype.getX=function(){return this.x.fromRed()},c.prototype.getY=function(){return this.y.fromRed()},c.prototype.mul=function(e){return e=new i(e,16),this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},c.prototype.mulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},c.prototype.jmulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},c.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},c.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},c.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},a(u,o.BasePoint),s.prototype.jpoint=function(e,t,r){return new u(this,e,t,r)},u.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},u.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},u.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),i=e.x.redMul(r),a=this.y.redMul(t.redMul(e.z)),o=e.y.redMul(r.redMul(this.z)),f=n.redSub(i),s=a.redSub(o);if(0===f.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=f.redSqr(),u=c.redMul(f),d=n.redMul(c),h=s.redSqr().redIAdd(u).redISub(d).redISub(d),p=s.redMul(d.redISub(h)).redISub(a.redMul(u)),l=this.z.redMul(e.z).redMul(f);return this.curve.jpoint(h,p,l)},u.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),i=this.y,a=e.y.redMul(t).redMul(this.z),o=r.redSub(n),f=i.redSub(a);if(0===o.cmpn(0))return 0!==f.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var s=o.redSqr(),c=s.redMul(o),u=r.redMul(s),d=f.redSqr().redIAdd(c).redISub(u).redISub(u),h=f.redMul(u.redISub(d)).redISub(i.redMul(c)),p=this.z.redMul(o);return this.curve.jpoint(d,h,p)},u.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var t=this,r=0;r=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},u.prototype.inspect=function(){return this.isInfinity()?"":""},u.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},function(e,t,r){"use strict";var n=r(10),i=r(4),a=r(18),o=r(8);function f(e){a.call(this,"mont",e),this.a=new n(e.a,16).toRed(this.red),this.b=new n(e.b,16).toRed(this.red),this.i4=new n(4).toRed(this.red).redInvm(),this.two=new n(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function s(e,t,r){a.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new n(t,16),this.z=new n(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}i(f,a),e.exports=f,f.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),n=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===n.redSqrt().redSqr().cmp(n)},i(s,a.BasePoint),f.prototype.decodePoint=function(e,t){return this.point(o.toArray(e,t),1)},f.prototype.point=function(e,t){return new s(this,e,t)},f.prototype.pointFromJSON=function(e){return s.fromJSON(this,e)},s.prototype.precompute=function(){},s.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},s.fromJSON=function(e,t){return new s(e,t[0],t[1]||e.one)},s.prototype.inspect=function(){return this.isInfinity()?"":""},s.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},s.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),n=e.redMul(t),i=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,i)},s.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},s.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=e.x.redAdd(e.z),a=e.x.redSub(e.z).redMul(r),o=i.redMul(n),f=t.z.redMul(a.redAdd(o).redSqr()),s=t.x.redMul(a.redISub(o).redSqr());return this.curve.point(f,s)},s.prototype.mul=function(e){for(var t=e.clone(),r=this,n=this.curve.point(null,null),i=[];0!==t.cmpn(0);t.iushrn(1))i.push(t.andln(1));for(var a=i.length-1;a>=0;a--)0===i[a]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},s.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},s.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},s.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},s.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},s.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},function(e,t,r){"use strict";var n=r(8),i=r(10),a=r(4),o=r(18),f=n.assert;function s(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,o.call(this,"edwards",e),this.a=new i(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new i(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new i(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),f(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}function c(e,t,r,n,a){o.BasePoint.call(this,e,"projective"),null===t&&null===r&&null===n?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new i(t,16),this.y=new i(r,16),this.z=n?new i(n,16):this.curve.one,this.t=a&&new i(a,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}a(s,o),e.exports=s,s.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},s.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},s.prototype.jpoint=function(e,t,r,n){return this.point(e,t,r,n)},s.prototype.pointFromX=function(e,t){(e=new i(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=this.c2.redSub(this.a.redMul(r)),a=this.one.redSub(this.c2.redMul(this.d).redMul(r)),o=n.redMul(a.redInvm()),f=o.redSqrt();if(0!==f.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");var s=f.fromRed().isOdd();return(t&&!s||!t&&s)&&(f=f.redNeg()),this.point(e,f)},s.prototype.pointFromY=function(e,t){(e=new i(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=r.redSub(this.c2),a=r.redMul(this.d).redMul(this.c2).redSub(this.a),o=n.redMul(a.redInvm());if(0===o.cmp(this.zero)){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var f=o.redSqrt();if(0!==f.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");return f.fromRed().isOdd()!==t&&(f=f.redNeg()),this.point(f,e)},s.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),r=e.y.redSqr(),n=t.redMul(this.a).redAdd(r),i=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(r)));return 0===n.cmp(i)},a(c,o.BasePoint),s.prototype.pointFromJSON=function(e){return c.fromJSON(this,e)},s.prototype.point=function(e,t,r,n){return new c(this,e,t,r,n)},c.fromJSON=function(e,t){return new c(e,t[0],t[1],t[2])},c.prototype.inspect=function(){return this.isInfinity()?"":""},c.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},c.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),a=n.redAdd(t),o=a.redSub(r),f=n.redSub(t),s=i.redMul(o),c=a.redMul(f),u=i.redMul(f),d=o.redMul(a);return this.curve.point(s,c,d,u)},c.prototype._projDbl=function(){var e,t,r,n=this.x.redAdd(this.y).redSqr(),i=this.x.redSqr(),a=this.y.redSqr();if(this.curve.twisted){var o=(c=this.curve._mulA(i)).redAdd(a);if(this.zOne)e=n.redSub(i).redSub(a).redMul(o.redSub(this.curve.two)),t=o.redMul(c.redSub(a)),r=o.redSqr().redSub(o).redSub(o);else{var f=this.z.redSqr(),s=o.redSub(f).redISub(f);e=n.redSub(i).redISub(a).redMul(s),t=o.redMul(c.redSub(a)),r=o.redMul(s)}}else{var c=i.redAdd(a);f=this.curve._mulC(this.z).redSqr(),s=c.redSub(f).redSub(f);e=this.curve._mulC(n.redISub(c)).redMul(s),t=this.curve._mulC(c).redMul(i.redISub(a)),r=c.redMul(s)}return this.curve.point(e,t,r)},c.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},c.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),a=r.redSub(t),o=i.redSub(n),f=i.redAdd(n),s=r.redAdd(t),c=a.redMul(o),u=f.redMul(s),d=a.redMul(s),h=o.redMul(f);return this.curve.point(c,u,h,d)},c.prototype._projAdd=function(e){var t,r,n=this.z.redMul(e.z),i=n.redSqr(),a=this.x.redMul(e.x),o=this.y.redMul(e.y),f=this.curve.d.redMul(a).redMul(o),s=i.redSub(f),c=i.redAdd(f),u=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(a).redISub(o),d=n.redMul(s).redMul(u);return this.curve.twisted?(t=n.redMul(c).redMul(o.redSub(this.curve._mulA(a))),r=s.redMul(c)):(t=n.redMul(c).redMul(o.redSub(a)),r=this.curve._mulC(s).redMul(c)),this.curve.point(d,t,r)},c.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},c.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},c.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},c.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},c.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},c.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()},c.prototype.getY=function(){return this.normalize(),this.y.fromRed()},c.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},c.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var r=e.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(n),0===this.x.cmp(t))return!0}},c.prototype.toP=c.prototype.normalize,c.prototype.mixedAdd=c.prototype.add},function(e,t,r){"use strict";t.sha1=r(72),t.sha224=r(73),t.sha256=r(43),t.sha384=r(74),t.sha512=r(44)},function(e,t,r){"use strict";var n=r(11),i=r(17),a=r(42),o=n.rotl32,f=n.sum32,s=n.sum32_5,c=a.ft_1,u=i.BlockHash,d=[1518500249,1859775393,2400959708,3395469782];function h(){if(!(this instanceof h))return new h;u.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}n.inherits(h,u),e.exports=h,h.blockSize=512,h.outSize=160,h.hmacStrength=80,h.padLength=64,h.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;nthis.blockSize&&(e=(new this.Hash).update(e).digest()),i(e.length<=this.blockSize);for(var t=e.length;t0))return o.iaddn(1),this.keyFromPrivate(o)}},d.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},d.prototype.sign=function(e,t,r,a){"object"==typeof r&&(a=r,r=null),a||(a={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new n(e,16));for(var o=this.n.byteLength(),f=t.getPrivate().toArray("be",o),s=e.toArray("be",o),c=new i({hash:this.hash,entropy:f,nonce:s,pers:a.pers,persEnc:a.persEnc||"utf8"}),d=this.n.sub(new n(1)),h=0;;h++){var p=a.k?a.k(h):new n(c.generate(this.n.byteLength()));if(!((p=this._truncateToN(p,!0)).cmpn(1)<=0||p.cmp(d)>=0)){var l=this.g.mul(p);if(!l.isInfinity()){var b=l.getX(),y=b.umod(this.n);if(0!==y.cmpn(0)){var m=p.invm(this.n).mul(y.mul(t.getPrivate()).iadd(e));if(0!==(m=m.umod(this.n)).cmpn(0)){var v=(l.getY().isOdd()?1:0)|(0!==b.cmp(y)?2:0);return a.canonical&&m.cmp(this.nh)>0&&(m=this.n.sub(m),v^=1),new u({r:y,s:m,recoveryParam:v})}}}}}},d.prototype.verify=function(e,t,r,i){e=this._truncateToN(new n(e,16)),r=this.keyFromPublic(r,i);var a=(t=new u(t,"hex")).r,o=t.s;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var f,s=o.invm(this.n),c=s.mul(e).umod(this.n),d=s.mul(a).umod(this.n);return this.curve._maxwellTrick?!(f=this.g.jmulAdd(c,r.getPublic(),d)).isInfinity()&&f.eqXToP(a):!(f=this.g.mulAdd(c,r.getPublic(),d)).isInfinity()&&0===f.getX().umod(this.n).cmp(a)},d.prototype.recoverPubKey=function(e,t,r,i){s((3&r)===r,"The recovery param is more than two bits"),t=new u(t,i);var a=this.n,o=new n(e),f=t.r,c=t.s,d=1&r,h=r>>1;if(f.cmp(this.curve.p.umod(this.curve.n))>=0&&h)throw new Error("Unable to find sencond key candinate");f=h?this.curve.pointFromX(f.add(this.curve.n),d):this.curve.pointFromX(f,d);var p=t.r.invm(a),l=a.sub(o).mul(p).umod(a),b=c.mul(p).umod(a);return this.g.mulAdd(l,f,b)},d.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new u(t,n)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var a;try{a=this.recoverPubKey(e,t,i)}catch(e){continue}if(a.eq(r))return i}throw new Error("Unable to find valid recovery factor")}},function(e,t,r){"use strict";var n=r(19),i=r(39),a=r(7);function o(e){if(!(this instanceof o))return new o(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=i.toArray(e.entropy,e.entropyEnc||"hex"),r=i.toArray(e.nonce,e.nonceEnc||"hex"),n=i.toArray(e.pers,e.persEnc||"hex");a(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}e.exports=o,o.prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},o.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(n=r,r=t,t=null),r&&(r=i.toArray(r,n||"hex"),this._update(r));for(var a=[];a.length"}},function(e,t,r){"use strict";var n=r(10),i=r(8),a=i.assert;function o(e,t){if(e instanceof o)return e;this._importDER(e,t)||(a(e.r&&e.s,"Signature without r or s"),this.r=new n(e.r,16),this.s=new n(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function f(){this.place=0}function s(e,t){var r=e[t.place++];if(!(128&r))return r;for(var n=15&r,i=0,a=0,o=t.place;a>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}e.exports=o,o.prototype._importDER=function(e,t){e=i.toArray(e,t);var r=new f;if(48!==e[r.place++])return!1;if(s(e,r)+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var a=s(e,r),o=e.slice(r.place,a+r.place);if(r.place+=a,2!==e[r.place++])return!1;var c=s(e,r);if(e.length!==c+r.place)return!1;var u=e.slice(r.place,c+r.place);return 0===o[0]&&128&o[1]&&(o=o.slice(1)),0===u[0]&&128&u[1]&&(u=u.slice(1)),this.r=new n(o),this.s=new n(u),this.recoveryParam=null,!0},o.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=c(t),r=c(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];u(n,t.length),(n=n.concat(t)).push(2),u(n,r.length);var a=n.concat(r),o=[48];return u(o,a.length),o=o.concat(a),i.encode(o,e)}},function(e,t,r){"use strict";var n=r(19),i=r(24),a=r(8),o=a.assert,f=a.parseBytes,s=r(83),c=r(84);function u(e){if(o("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof u))return new u(e);e=i[e].curve;this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=n.sha512}e.exports=u,u.prototype.sign=function(e,t){e=f(e);var r=this.keyFromSecret(t),n=this.hashInt(r.messagePrefix(),e),i=this.g.mul(n),a=this.encodePoint(i),o=this.hashInt(a,r.pubBytes(),e).mul(r.priv()),s=n.add(o).umod(this.curve.n);return this.makeSignature({R:i,S:s,Rencoded:a})},u.prototype.verify=function(e,t,r){e=f(e),t=this.makeSignature(t);var n=this.keyFromPublic(r),i=this.hashInt(t.Rencoded(),n.pubBytes(),e),a=this.g.mul(t.S());return t.R().add(n.pub().mul(i)).eq(a)},u.prototype.hashInt=function(){for(var e=this.hash(),t=0;t>1))}),{kty:"RSA",n:a.default.encoder.encodeBase64Url((0,s.pruneLeadingZeros)(f.modulus)),e:a.default.encoder.encodeBase64Url((0,s.pruneLeadingZeros)(f.publicExponent)),d:a.default.encoder.encodeBase64Url((0,s.pruneLeadingZeros)(f.privateExponent)),p:a.default.encoder.encodeBase64Url((0,s.pruneLeadingZeros)(f.prime1)),q:a.default.encoder.encodeBase64Url((0,s.pruneLeadingZeros)(f.prime2)),dp:a.default.encoder.encodeBase64Url((0,s.pruneLeadingZeros)(f.exponent1)),dq:a.default.encoder.encodeBase64Url((0,s.pruneLeadingZeros)(f.exponent2)),qi:a.default.encoder.encodeBase64Url((0,s.pruneLeadingZeros)(f.coefficient))}}};var u=i.default.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())}),d=i.default.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int(),this.key("otherPrimeInfos").optional().use(h))}),h=i.default.define("OtherPrimeInfos",function(){this.seqof(p)}),p=i.default.define("OtherPrimeInfo",function(){this.seq().obj(this.key("prime").int(),this.key("exponent").int(),this.key("coefficient").int())})},function(e,t,r){"use strict";var n=r(12),i=r(2);Object.defineProperty(t,"__esModule",{value:!0}),t.decryptEncryptedPrivateKeyInfo=t.encryptEncryptedPrivateKeyInfo=void 0;var a=i(r(0)),o=i(r(1)),f=n(r(14)),s=r(25),c=i(r(26)),u=i(r(5)),d=i(r(13)),h=i(r(3)),p=i(r(92)),l=i(r(113)),b=i(r(29)),y=u.default.Buffer,m=d.default.bignum,v=function(){var e=(0,o.default)(a.default.mark(function e(t){var r,n,i,o,c=arguments;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0===(r=c.length>1&&void 0!==c[1]?c[1]:{passphrase:""}).algorithm&&(r.algorithm="pbes2"),void 0===r.iterationCount&&(r.iterationCount=2048),"pbes2"!==r.algorithm){e.next=15;break}return void 0===r.cipher&&(r.cipher="aes256-cbc"),void 0===r.prf&&(r.prf="hmacWithSHA256"),n="pbkdf2",e.next=9,S(t,r.passphrase,n,r.prf,r.iterationCount,r.cipher);case 9:return i=e.sent,e.next=12,w(i);case 12:return e.abrupt("return",e.sent);case 15:return e.next=17,x(t,r.passphrase,r.algorithm,r.iterationCount);case 17:return(o=e.sent).encryptionAlgorithm.algorithm=f.default.passwordBasedEncryptionSchemes[o.encryptionAlgorithm.algorithm].oid,o.encryptionAlgorithm.parameters=s.PBEParameter.encode(o.encryptionAlgorithm.parameters,"der"),e.abrupt("return",s.EncryptedPrivateKeyInfo.encode(o,"der"));case 21:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}();t.encryptEncryptedPrivateKeyInfo=v;var g=function(){var e=(0,o.default)(a.default.mark(function e(t,r){var n;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if((n={}).encryptionAlgorithm={algorithm:(0,f.getAlgorithmFromOidStrict)(t.encryptionAlgorithm.algorithm,f.default.passwordBasedEncryptionSchemes)},"pbes2"===n.encryptionAlgorithm.algorithm?n.encryptionAlgorithm.parameters=_(t.encryptionAlgorithm.parameters):n.encryptionAlgorithm.parameters=s.PBEParameter.decode(t.encryptionAlgorithm.parameters,"der"),n.encryptedData=t.encryptedData,"pbes2"!==n.encryptionAlgorithm.algorithm){e.next=10;break}return e.next=7,A(n,r);case 7:return e.abrupt("return",e.sent);case 10:return e.next=12,M(n,r);case 12:return e.abrupt("return",e.sent);case 13:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}();t.decryptEncryptedPrivateKeyInfo=g;var w=function(e){var t={encryptionAlgorithm:{}};t.encryptionAlgorithm.algorithm=f.default.passwordBasedEncryptionSchemes[e.encryptionAlgorithm.algorithm].oid;var r=e.encryptionAlgorithm.parameters.keyDerivationFunc;if("pbkdf2"!==r.algorithm)throw new Error("UnsupportedKDF");r.parameters.prf.algorithm=f.default.pbkdf2Prfs[r.parameters.prf.algorithm].oid,r.parameters=s.PBKDF2Params.encode(r.parameters,"der"),r.algorithm=f.default.keyDerivationFunctions[r.algorithm].oid;var n=e.encryptionAlgorithm.parameters.encryptionScheme;if(!(Object.keys(s.PBES2ESParams).indexOf(n.algorithm)>=0))throw new Error("UnsupportedCipher");return n.parameters=s.PBES2ESParams[n.algorithm].encode(n.parameters,"der"),n.algorithm=f.default.encryptionSchemes[n.algorithm].oid,t.encryptionAlgorithm.parameters=s.PBES2Params.encode({keyDerivationFunc:r,encryptionScheme:n},"der"),t.encryptedData=e.encryptedData,s.EncryptedPrivateKeyInfo.encode(t,"der")},_=function(e){var t,r,n,i=s.PBES2Params.decode(e,"der"),a=(0,f.getAlgorithmFromOidStrict)(i.keyDerivationFunc.algorithm,f.default.keyDerivationFunctions);if("pbkdf2"!==a)throw new Error("UnsupportedKDF");var o=s.PBKDF2Params.decode(i.keyDerivationFunc.parameters,"der");n={algorithm:(0,f.getAlgorithmFromOidStrict)(o.prf.algorithm,f.default.pbkdf2Prfs),parameters:o.prf.parameters},t=o.iterationCount,r={type:o.salt.type,value:o.salt.value};var c=(0,f.getAlgorithmFromOidStrict)(i.encryptionScheme.algorithm,f.default.encryptionSchemes);if(!(Object.keys(s.PBES2ESParams).indexOf(c)>=0))throw new Error("UnsupportedCipher");return{keyDerivationFunc:{algorithm:a,parameters:{salt:r,iterationCount:t,prf:n}},encryptionScheme:{algorithm:c,parameters:s.PBES2ESParams[c].decode(i.encryptionScheme.parameters,"der")}}},S=function(){var e=(0,o.default)(a.default.mark(function e(t,r,n,i,o,s){var u,d,v,g,w,_,S,A;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return u=h.default.encoder.stringToArrayBuffer(r),e.next=3,b.default.getRandomBytes(f.default.keyDerivationFunctions[n].defaultSaltLen);case 3:if(d=e.sent,v=f.default.encryptionSchemes[s].keyLength,"pbkdf2"!==n){e.next=11;break}return e.next=8,p.default.pbkdf2(u,d,o,v,f.default.pbkdf2Prfs[i].hash);case 8:g=e.sent,e.next=12;break;case 11:throw new Error("UnsupportedKDF");case 12:if("des-ede3-cbc"!==s){e.next=23;break}return e.t0=y,e.next=16,b.default.getRandomBytes(f.default.encryptionSchemes[s].ivLength);case 16:e.t1=e.sent,w=e.t0.from.call(e.t0,e.t1),S=c.default.CBC.instantiate(c.default.EDE),A=S.create({type:"encrypt",key:y.from(g),iv:w}),_=y.from(A.update(t).concat(A.final())),e.next=36;break;case 23:if("aes128-cbc"!==s&&"aes192-cbc"!==s&&"aes256-cbc"!==s){e.next=35;break}return e.next=26,b.default.getRandomBytes(f.default.encryptionSchemes[s].ivLength);case 26:return w=e.sent,e.t2=y,e.next=30,l.default.encrypt(new Uint8Array(t),g,{name:"AES-CBC",iv:w});case 30:e.t3=e.sent,_=e.t2.from.call(e.t2,e.t3),w=y.from(w),e.next=36;break;case 35:throw new Error("UnsupportedCipher");case 36:return e.abrupt("return",{encryptedData:_,encryptionAlgorithm:{algorithm:"pbes2",parameters:{keyDerivationFunc:{algorithm:n,parameters:{salt:{type:"specified",value:y.from(d)},iterationCount:new m(o),prf:{algorithm:i,parameters:y.from([5,0])}}},encryptionScheme:{algorithm:s,parameters:w}}}});case 37:case"end":return e.stop()}},e)}));return function(t,r,n,i,a,o){return e.apply(this,arguments)}}(),A=function(){var e=(0,o.default)(a.default.mark(function e(t,r){var n,i,o,u,d,b,m,v,g,w,_,S,A;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.encryptionAlgorithm.parameters.keyDerivationFunc,i=t.encryptionAlgorithm.parameters.encryptionScheme,o=f.default.encryptionSchemes[i.algorithm].keyLength,"pbkdf2"!==n.algorithm){e.next=15;break}if(d=h.default.encoder.stringToArrayBuffer(r),"specified"===n.parameters.salt.type){e.next=7;break}throw new Error("UnsupportedSaltSource");case 7:return b=new Uint8Array(n.parameters.salt.value),m=n.parameters.iterationCount.toNumber(),v=n.parameters.prf.algorithm,e.next=12,p.default.pbkdf2(d,b,m,o,f.default.pbkdf2Prfs[v].hash);case 12:u=e.sent,e.next=16;break;case 15:throw new Error("UnsupportedKDF");case 16:if("des-ede3-cbc"!==i.algorithm){e.next=23;break}w=i.parameters,_=c.default.CBC.instantiate(c.default.EDE),S=_.create({type:"decrypt",key:u,iv:w}),g=y.from(S.update(t.encryptedData).concat(S.final())),e.next=33;break;case 23:if("aes128-cbc"!==i.algorithm&&"aes192-cbc"!==i.algorithm&&"aes256-cbc"!==i.algorithm){e.next=32;break}return A=new Uint8Array(i.parameters),e.t0=y,e.next=28,l.default.decrypt(new Uint8Array(t.encryptedData),u,{name:"AES-CBC",iv:A});case 28:e.t1=e.sent,g=e.t0.from.call(e.t0,e.t1),e.next=33;break;case 32:throw new Error("UnsupportedEncryptionAlgorithm");case 33:return e.abrupt("return",s.OneAsymmetricKey.decode(g,"der"));case 34:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}(),x=function(){var e=(0,o.default)(a.default.mark(function e(t,r,n,i){var o,s,u,d,l,v,g,w,_;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return o=h.default.encoder.stringToArrayBuffer(r),e.next=3,b.default.getRandomBytes(8);case 3:return s=e.sent,u=f.default.passwordBasedEncryptionSchemes[n].hash,e.next=7,p.default.pbkdf1(o,s,i,16,u);case 7:if(d=e.sent,l=d.slice(0,8),v=d.slice(8,16),"DES-CBC"!==f.default.passwordBasedEncryptionSchemes[n].encrypt){e.next=17;break}w=c.default.CBC.instantiate(c.default.DES),_=w.create({type:"encrypt",key:l,iv:v}),g=y.from(_.update(t).concat(_.final())),e.next=18;break;case 17:throw new Error("UnsupportedEncryptionAlgorithm");case 18:return e.abrupt("return",{encryptionAlgorithm:{algorithm:n,parameters:{salt:y.from(s),iterationCount:new m(i)}},encryptedData:g});case 19:case"end":return e.stop()}},e)}));return function(t,r,n,i){return e.apply(this,arguments)}}(),M=function(){var e=(0,o.default)(a.default.mark(function e(t,r){var n,i,o,u,d,l,b,m,v,g;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=h.default.encoder.stringToArrayBuffer(r),i=new Uint8Array(t.encryptionAlgorithm.parameters.salt),o=f.default.passwordBasedEncryptionSchemes[t.encryptionAlgorithm.algorithm].hash,u=t.encryptionAlgorithm.parameters.iterationCount.toNumber(),e.next=6,p.default.pbkdf1(n,i,u,16,o);case 6:if(d=e.sent,l=d.slice(0,8),b=d.slice(8,16),"DES-CBC"!==f.default.passwordBasedEncryptionSchemes[t.encryptionAlgorithm.algorithm].encrypt){e.next=16;break}v=c.default.CBC.instantiate(c.default.DES),g=v.create({type:"decrypt",key:l,iv:b}),m=y.from(g.update(t.encryptedData).concat(g.final())),e.next=17;break;case 16:throw new Error("UnsupportedEncryptionAlgorithm");case 17:return e.abrupt("return",s.OneAsymmetricKey.decode(m,"der"));case 18:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}()},function(e,t,r){"use strict";t.readUInt32BE=function(e,t){return(e[0+t]<<24|e[1+t]<<16|e[2+t]<<8|e[3+t])>>>0},t.writeUInt32BE=function(e,t,r){e[0+r]=t>>>24,e[1+r]=t>>>16&255,e[2+r]=t>>>8&255,e[3+r]=255&t},t.ip=function(e,t,r,n){for(var i=0,a=0,o=6;o>=0;o-=2){for(var f=0;f<=24;f+=8)i<<=1,i|=t>>>f+o&1;for(f=0;f<=24;f+=8)i<<=1,i|=e>>>f+o&1}for(o=6;o>=0;o-=2){for(f=1;f<=25;f+=8)a<<=1,a|=t>>>f+o&1;for(f=1;f<=25;f+=8)a<<=1,a|=e>>>f+o&1}r[n+0]=i>>>0,r[n+1]=a>>>0},t.rip=function(e,t,r,n){for(var i=0,a=0,o=0;o<4;o++)for(var f=24;f>=0;f-=8)i<<=1,i|=t>>>f+o&1,i<<=1,i|=e>>>f+o&1;for(o=4;o<8;o++)for(f=24;f>=0;f-=8)a<<=1,a|=t>>>f+o&1,a<<=1,a|=e>>>f+o&1;r[n+0]=i>>>0,r[n+1]=a>>>0},t.pc1=function(e,t,r,n){for(var i=0,a=0,o=7;o>=5;o--){for(var f=0;f<=24;f+=8)i<<=1,i|=t>>f+o&1;for(f=0;f<=24;f+=8)i<<=1,i|=e>>f+o&1}for(f=0;f<=24;f+=8)i<<=1,i|=t>>f+o&1;for(o=1;o<=3;o++){for(f=0;f<=24;f+=8)a<<=1,a|=t>>f+o&1;for(f=0;f<=24;f+=8)a<<=1,a|=e>>f+o&1}for(f=0;f<=24;f+=8)a<<=1,a|=e>>f+o&1;r[n+0]=i>>>0,r[n+1]=a>>>0},t.r28shl=function(e,t){return e<>>28-t};var n=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];t.pc2=function(e,t,r,i){for(var a=0,o=0,f=n.length>>>1,s=0;s>>n[s]&1;for(s=f;s>>n[s]&1;r[i+0]=a>>>0,r[i+1]=o>>>0},t.expand=function(e,t,r){var n=0,i=0;n=(1&e)<<5|e>>>27;for(var a=23;a>=15;a-=4)n<<=6,n|=e>>>a&63;for(a=11;a>=3;a-=4)i|=e>>>a&63,i<<=6;i|=(31&e)<<1|e>>>31,t[r+0]=n>>>0,t[r+1]=i>>>0};var i=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];t.substitute=function(e,t){for(var r=0,n=0;n<4;n++){r<<=4,r|=i[64*n+(e>>>18-6*n&63)]}for(n=0;n<4;n++){r<<=4,r|=i[256+64*n+(t>>>18-6*n&63)]}return r>>>0};var a=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];t.permute=function(e){for(var t=0,r=0;r>>a[r]&1;return t>>>0},t.padSplit=function(e,t,r){for(var n=e.toString(2);n.length0;n--)t+=this._buffer(e,t),r+=this._flushBuffer(i,r);return t+=this._buffer(e,t),i},i.prototype.final=function(e){var t,r;return e&&(t=this.update(e)),r="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),t?t.concat(r):r},i.prototype._pad=function(e,t){if(0===t)return!1;for(;t>>1];r=o.r28shl(r,f),i=o.r28shl(i,f),o.pc2(r,i,e.keys,a)}},c.prototype._update=function(e,t,r,n){var i=this._desState,a=o.readUInt32BE(e,t),f=o.readUInt32BE(e,t+4);o.ip(a,f,i.tmp,0),a=i.tmp[0],f=i.tmp[1],"encrypt"===this.type?this._encrypt(i,a,f,i.tmp,0):this._decrypt(i,a,f,i.tmp,0),a=i.tmp[0],f=i.tmp[1],o.writeUInt32BE(r,a,n),o.writeUInt32BE(r,f,n+4)},c.prototype._pad=function(e,t){for(var r=e.length-t,n=t;n>>0,a=h}o.rip(f,a,n,i)},c.prototype._decrypt=function(e,t,r,n,i){for(var a=r,f=t,s=e.keys.length-2;s>=0;s-=2){var c=e.keys[s],u=e.keys[s+1];o.expand(a,e.tmp,0),c^=e.tmp[0],u^=e.tmp[1];var d=o.substitute(c,u),h=a;a=(f^o.permute(d))>>>0,f=h}o.rip(a,f,n,i)}},function(e,t,r){"use strict";var n=r(7),i=r(4),a={};function o(e){n.equal(e.length,8,"Invalid IV length"),this.iv=new Array(8);for(var t=0;t(Math.pow(2,32)-1)*h)){e.next=5;break}throw new Error("DerivedKeyTooLong");case 5:for(l=Math.ceil(f/h),b=f-(l-1)*h,y=function(){var e=(0,a.default)(i.default.mark(function e(a){var o,f,c,h;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return(o=new Uint8Array(r.length+4)).set(r),o.set(d(a+1,4),r.length),e.next=5,s.default.compute(t,o,u);case 5:f=e.sent,c=new Uint8Array(f),h=1;case 8:if(!(h>8*(t-n-1);return r},h=function(){var e=(0,a.default)(i.default.mark(function e(t,r,n,a,s){var u,d;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(p(t,r,n,a,s),"string"==typeof t&&(t=o.default.encoder.stringToArrayBuffer(t)),!(a>c.default.hashes[s].hashSize)){e.next=4;break}throw new Error("DerivedKeyTooLong");case 4:(u=new Uint8Array(t.length+r.length)).set(t),u.set(r,t.length),d=0;case 8:if(!(d1&&void 0!==h[1]?h[1]:"SHA-256",!(Object.keys(s.default.hashes).indexOf(r)<0)){e.next=3;break}throw new Error("UnsupportedHashAlgorithm");case 3:if(t instanceof Uint8Array){e.next=5;break}throw new Error("UnsupportedMessageType");case 5:if(n=f.getWebCrypto(),i=f.getNodeCrypto(),o=f.getMsCrypto(),d=!0,void 0===n||"function"!=typeof n.digest||void 0!==o){e.next=15;break}return e.next=12,n.digest(r,t).catch(function(e){u=e.message,d=!1});case 12:c=e.sent,e.next=26;break;case 15:if(void 0===i){e.next=19;break}try{c=l(r,t,i)}catch(e){u=e.message,d=!1}e.next=26;break;case 19:if(void 0===o||"function"!=typeof o.digest){e.next=25;break}return e.next=22,p(r,t,o).catch(function(e){u=e.message,d=!1});case 22:c=e.sent,e.next=26;break;case 25:d=!1;case 26:if(d){e.next=35;break}e.prev=27,c=b(r,t),e.next=35;break;case 31:throw e.prev=31,e.t0=e.catch(27),u="".concat(u," => ").concat(e.t0.message),new Error("UnsupportedEnvironment: ".concat(u));case 35:return e.abrupt("return",new Uint8Array(c));case 36:case"end":return e.stop()}},e,null,[[27,31]])}));return function(t){return e.apply(this,arguments)}}();t.compute=h;var p=function(e,t,r){return new Promise(function(n,i){var a=r.digest(e,t);a.oncomplete=function(e){n(e.target.result)},a.onerror=function(e){i(e)}})},l=function(e,t,r){var n=s.default.hashes[e].nodeName,i=r.createHash(n);return i.update(t),i.digest()},b=function(e,t){var n;if("MD5"===e)n=(0,c.default)(Array.from(t),{asBytes:!0});else if(["SHA3-512","SHA3-384","SHA3-256","SHA3-224"].indexOf(e)>=0){var i=new u.SHA3(8*s.default.hashes[e].hashSize),a=r(5).Buffer;i.update(a.from(t)),n=i.digest("binary")}else n=d.default[s.default.hashes[e].nodeName]().update(t).digest();return new Uint8Array(n)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={hashes:{"SHA3-512":{nodeName:"sha3-512",hashSize:64},"SHA3-384":{nodeName:"sha3-384",hashSize:48},"SHA3-256":{nodeName:"sha3-256",hashSize:32},"SHA3-224":{nodeName:"sha3-224",hashSize:28},"SHA-256":{nodeName:"sha256",hashSize:32},"SHA-384":{nodeName:"sha384",hashSize:48},"SHA-512":{nodeName:"sha512",hashSize:64},"SHA-1":{nodeName:"sha1",hashSize:20},MD5:{nodeName:"md5",hashSize:16}}}},function(e,t,r){var n,i,a,o,f;n=r(97),i=r(45).utf8,a=r(98),o=r(45).bin,(f=function(e,t){e.constructor==String?e=t&&"binary"===t.encoding?o.stringToBytes(e):i.stringToBytes(e):a(e)?e=Array.prototype.slice.call(e,0):Array.isArray(e)||(e=e.toString());for(var r=n.bytesToWords(e),s=8*e.length,c=1732584193,u=-271733879,d=-1732584194,h=271733878,p=0;p>>24)|4278255360&(r[p]<<24|r[p]>>>8);r[s>>>5]|=128<>>9<<4)]=s;var l=f._ff,b=f._gg,y=f._hh,m=f._ii;for(p=0;p>>0,u=u+g>>>0,d=d+w>>>0,h=h+_>>>0}return n.endian([c,u,d,h])})._ff=function(e,t,r,n,i,a,o){var f=e+(t&r|~t&n)+(i>>>0)+o;return(f<>>32-a)+t},f._gg=function(e,t,r,n,i,a,o){var f=e+(t&n|r&~n)+(i>>>0)+o;return(f<>>32-a)+t},f._hh=function(e,t,r,n,i,a,o){var f=e+(t^r^n)+(i>>>0)+o;return(f<>>32-a)+t},f._ii=function(e,t,r,n,i,a,o){var f=e+(r^(t|~n))+(i>>>0)+o;return(f<>>32-a)+t},f._blocksize=16,f._digestsize=16,e.exports=function(e,t){if(null==e)throw new Error("Illegal argument "+e);var r=n.wordsToBytes(f(e,t));return t&&t.asBytes?r:t&&t.asString?o.bytesToString(r):n.bytesToHex(r)}},function(e,t){var r,n;r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n={rotl:function(e,t){return e<>>32-t},rotr:function(e,t){return e<<32-t|e>>>t},endian:function(e){if(e.constructor==Number)return 16711935&n.rotl(e,8)|4278255360&n.rotl(e,24);for(var t=0;t0;e--)t.push(Math.floor(256*Math.random()));return t},bytesToWords:function(e){for(var t=[],r=0,n=0;r>>5]|=e[r]<<24-n%32;return t},wordsToBytes:function(e){for(var t=[],r=0;r<32*e.length;r+=8)t.push(e[r>>>5]>>>24-r%32&255);return t},bytesToHex:function(e){for(var t=[],r=0;r>>4).toString(16)),t.push((15&e[r]).toString(16));return t.join("")},hexToBytes:function(e){for(var t=[],r=0;r>>6*(3-a)&63)):t.push("=");return t.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/gi,"");for(var t=[],n=0,i=0;n>>6-2*i);return t}},e.exports=n},function(e,t){function r(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)} /*! * Determine if an object is a Buffer * * @author Feross Aboukhadijeh * @license MIT */ e.exports=function(e){return null!=e&&(r(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&r(e.slice(0,0))}(e)||!!e._isBuffer)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SHA3=void 0;var n,i=r(5),a=(n=r(100))&&n.__esModule?n:{default:n};var o=function(e){var t=e.padding;return function e(){var r=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:512;if(!this||this.constructor!==e)return new e(n);var o=new a.default({capacity:n,padding:t});return this.update=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf8";if(i.Buffer.isBuffer(e))return o.absorb(e),r;if("string"==typeof e)return r.update(i.Buffer.from(e,t));throw new TypeError("Not a string or buffer")},this.digest=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"binary",t=o.squeeze();return e&&"binary"!==e?t.toString(e):t},this.reset=function(){return o.reset(),r},this}},f=o({padding:1}),s=o({padding:6});t.SHA3=s;var c=f;s.SHA3Hash=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,i=r(5),a=(n=r(101))&&n.__esModule?n:{default:n};var o=[224,256,384,512],f=function(e,t){for(var r=0;r=u&&(f(p,h),s(h),d=0);return t},this.squeeze=function(){var e={queue:i.Buffer.allocUnsafe(u),state:new Uint32Array(50)};p.copy(e.queue);for(var t=0;t>>8,r[n+2]=e[a+1]>>>16,r[n+3]=e[a+1]>>>24,r[n+4]=e[a],r[n+5]=e[a]>>>8,r[n+6]=e[a]>>>16,r[n+7]=e[a]>>>24}return r}(e.state,c)},this.reset=function(){return p.fill(0),h.fill(0),d=0,t},this};t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=f(r(102)),i=f(r(103)),a=f(r(105)),o=f(r(108));function f(e){return e&&e.__esModule?e:{default:e}}var s=function(){var e=new Uint32Array(10),t=new Uint32Array(10),r=new Uint32Array(2);return function(f){for(var s=0;s<24;s++)(0,o.default)({A:f,C:e,D:t,W:r}),(0,a.default)({A:f,C:e,W:r}),(0,n.default)({A:f,C:e}),(0,i.default)({A:f,roundIndex:s});e.fill(0),t.fill(0),r.fill(0)}};t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,i=(n=r(27))&&n.__esModule?n:{default:n};var a=function(e){for(var t=e.A,r=e.C,n=0;n<25;n+=5){for(var a=0;a<5;a++)(0,i.default)(t,n+a)(r,a);for(var o=0;o<5;o++){var f=2*(n+o),s=(o+1)%5*2,c=(o+2)%5*2;t[f]^=~r[s]&r[c],t[f+1]^=~r[s+1]&r[c+1]}}};t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,i=(n=r(104))&&n.__esModule?n:{default:n};var a=function(e){var t=e.A,r=2*e.roundIndex;t[0]^=i.default[r],t[1]^=i.default[r+1]};t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=new Uint32Array([0,1,0,32898,2147483648,32906,2147483648,2147516416,0,32907,0,2147483649,2147483648,2147516545,2147483648,32777,0,138,0,136,0,2147516425,0,2147483658,0,2147516555,2147483648,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,0,32778,2147483648,2147483658,2147483648,2147516545,2147483648,32896,0,2147483649,2147483648,2147516424]);t.default=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=o(r(106)),i=o(r(107)),a=o(r(27));function o(e){return e&&e.__esModule?e:{default:e}}var f=function(e){var t=e.A,r=e.C,o=e.W;(0,a.default)(t,1)(o,0);for(var f=0,s=0,c=0,u=32,d=0;d<24;d++){var h=n.default[d],p=i.default[d];(0,a.default)(t,h)(r,0),f=o[0],s=o[1],u=32-p,o[c=p<32?0:1]=f<>>u,o[(c+1)%2]=s<>>u,(0,a.default)(o,0)(t,h),(0,a.default)(r,0)(o,0)}};t.default=f},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=[10,7,11,17,18,3,5,16,8,21,24,4,15,23,19,13,12,2,20,14,22,9,6,1];t.default=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=[1,3,6,10,15,21,28,36,45,55,2,14,27,41,56,8,25,43,62,18,39,61,20,44];t.default=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,i=(n=r(27))&&n.__esModule?n:{default:n};var a=function(e){for(var t=e.A,r=e.C,n=e.D,a=e.W,o=0,f=0,s=0;s<5;s++){var c=2*s,u=2*(s+5),d=2*(s+10),h=2*(s+15),p=2*(s+20);r[c]=t[c]^t[u]^t[d]^t[h]^t[p],r[c+1]=t[c+1]^t[u+1]^t[d+1]^t[h+1]^t[p+1]}for(var l=0;l<5;l++){(0,i.default)(r,(l+1)%5)(a,0),o=a[0],f=a[1],a[0]=o<<1|f>>>31,a[1]=f<<1|o>>>31,n[2*l]=r[(l+4)%5*2]^a[0],n[2*l+1]=r[(l+4)%5*2+1]^a[1];for(var b=0;b<25;b+=5)t[2*(b+l)]^=n[2*l],t[2*(b+l)+1]^=n[2*l+1]}};t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"compute",{enumerable:!0,get:function(){return n.compute}}),Object.defineProperty(t,"verify",{enumerable:!0,get:function(){return n.verify}}),t.default=void 0;var n=r(110),i={compute:n.compute,verify:n.verify};t.default=i},function(e,t,r){"use strict";var n=r(12),i=r(2);Object.defineProperty(t,"__esModule",{value:!0}),t.verify=t.compute=void 0;var a=i(r(0)),o=i(r(1)),f=i(r(111)),s=n(r(6)),c=i(r(15)),u=function(){var e=(0,o.default)(a.default.mark(function e(t,r){var n,i,o,c,u,h,p,l,b,y,m,v=arguments;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=v.length>2&&void 0!==v[2]?v[2]:"SHA-256",i=s.getWebCryptoAll(),o=s.getNodeCrypto(),c=!0,void 0===i||"function"!=typeof i.importKey||"function"!=typeof i.sign){e.next=38;break}if(void 0!==window.msCrypto){e.next=21;break}return e.prev=6,e.next=9,i.importKey("raw",t,{name:"HMAC",hash:{name:n}},!1,["sign","verify"]);case 9:return u=e.sent,e.next=12,i.sign({name:"HMAC",hash:{name:n}},u,r);case 12:return h=e.sent,e.abrupt("return",new Uint8Array(h));case 16:e.prev=16,e.t0=e.catch(6),c=!1;case 19:e.next=36;break;case 21:return e.prev=21,p=function(e,t,r,n,a){return new Promise(function(o,f){var s=i.importKey(e,t,r,n,a);s.oncomplete=function(e){o(e.target.result)},s.onerror=function(){f("KeyImportingFailed")}})},l=function(e,t,r){return new Promise(function(n,a){var o=i.sign({name:"HMAC",hash:{name:e}},t,r);o.oncomplete=function(e){n(new Uint8Array(e.target.result))},o.onerror=function(){a("ComputingHMACFailed")}})},e.next=26,p("raw",t,{name:"HMAC",hash:{name:n}},!1,["sign","verify"]);case 26:return b=e.sent,e.next=29,l(n,b,r);case 29:return y=e.sent,e.abrupt("return",new Uint8Array(y));case 33:e.prev=33,e.t1=e.catch(21),c=!1;case 36:e.next=50;break;case 38:if(void 0===o){e.next=49;break}return e.prev=39,m=o.createHmac(f.default.hashes[n].nodeName,t),e.abrupt("return",new Uint8Array(m.update(r).digest()));case 44:e.prev=44,e.t2=e.catch(39),c=!1;case 47:e.next=50;break;case 49:c=!1;case 50:if(c){e.next=60;break}return e.prev=51,e.next=54,d(t,r,n);case 54:return e.abrupt("return",e.sent);case 57:throw e.prev=57,e.t3=e.catch(51),new Error("UnsupportedEnvironments");case 60:case"end":return e.stop()}},e,null,[[6,16],[21,33],[39,44],[51,57]])}));return function(t,r){return e.apply(this,arguments)}}();t.compute=u;var d=function(){var e=(0,o.default)(a.default.mark(function e(t,r,n){var i,o,s,u,d,h,p,l;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i=f.default.hashes[n].blockSize,o=f.default.hashes[n].hashSize,!(t.length>i)){e.next=6;break}return e.next=5,c.default.compute(t,n);case 5:t=e.sent;case 6:return(s=new Uint8Array(i)).set(t),u=s.map(function(e){return 255&(54^e)}),d=s.map(function(e){return 255&(92^e)}),(h=new Uint8Array(i+r.length)).set(u),h.set(r,i),e.next=15,c.default.compute(h,n);case 15:return p=e.sent,(l=new Uint8Array(i+o)).set(d),l.set(p,i),e.abrupt("return",c.default.compute(l,n));case 20:case"end":return e.stop()}},e)}));return function(t,r,n){return e.apply(this,arguments)}}(),h=function(){var e=(0,o.default)(a.default.mark(function e(t,r,n){var i,o,f=arguments;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i=f.length>3&&void 0!==f[3]?f[3]:"SHA-256",n instanceof Uint8Array){e.next=3;break}throw new Error("InvalidInputMac");case 3:return e.next=5,u(t,r,i);case 5:return o=e.sent,e.abrupt("return",n.toString()===o.toString());case 7:case"end":return e.stop()}},e)}));return function(t,r,n){return e.apply(this,arguments)}}();t.verify=h},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={hashes:{"SHA3-512":{nodeName:"sha3-512",hashSize:64,blockSize:72},"SHA3-384":{nodeName:"sha3-384",hashSize:48,blockSize:104},"SHA3-256":{nodeName:"sha3-256",hashSize:32,blockSize:136},"SHA3-224":{nodeName:"sha3-224",hashSize:28,blockSize:144},"SHA-256":{nodeName:"sha256",hashSize:32,blockSize:64},"SHA-384":{nodeName:"sha384",hashSize:48,blockSize:128},"SHA-512":{nodeName:"sha512",hashSize:64,blockSize:128},"SHA-1":{nodeName:"sha1",hashSize:20,blockSize:64},MD5:{nodeName:"md5",hashSize:16,blockSize:64}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={hashes:{"SHA3-512":{hashSize:64},"SHA3-384":{hashSize:48},"SHA3-256":{hashSize:32},"SHA3-224":{hashSize:28},"SHA-256":{hashSize:32},"SHA-384":{hashSize:48},"SHA-512":{hashSize:64},"SHA-1":{hashSize:20},MD5:{hashSize:16}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"encrypt",{enumerable:!0,get:function(){return n.encrypt}}),Object.defineProperty(t,"decrypt",{enumerable:!0,get:function(){return n.decrypt}}),Object.defineProperty(t,"wrapKey",{enumerable:!0,get:function(){return n.wrapKey}}),Object.defineProperty(t,"unwrapKey",{enumerable:!0,get:function(){return n.unwrapKey}}),t.default=void 0;var n=r(114),i={encrypt:n.encrypt,decrypt:n.decrypt,wrapKey:n.wrapKey,unwrapKey:n.unwrapKey};t.default=i},function(e,t,r){"use strict";var n=r(12),i=r(2);Object.defineProperty(t,"__esModule",{value:!0}),t.unwrapKey=t.wrapKey=t.decrypt=t.encrypt=void 0;var a=i(r(0)),o=i(r(1)),f=n(r(6)),s=n(r(115)),c=n(r(116)),u=i(r(46)),d=function(e){var t=e.name,r=e.iv,n=e.tagLength;if(Object.keys(u.default.ciphers).indexOf(t)<0)throw new Error("UnsupportedAlgorithm");if(u.default.ciphers[t].ivLength){if(!(r instanceof Uint8Array))throw new Error("InvalidArguments");if(r.byteLength<2||r.byteLength>16)throw new Error("InvalidIVLength");if(u.default.ciphers[t].staticIvLength&&u.default.ciphers[t].ivLength!==r.byteLength)throw new Error("InvalidIVLength")}if(u.default.ciphers[t].tagLength&&n){if(!Number.isInteger(n))throw new Error("InvalidArguments");if(n<4||n>16)throw new Error("InvalidTagLength")}},h=function(){var e=(0,o.default)(a.default.mark(function e(t,r,n){var i,o,h,p,l,b,y,m;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i=n.name,o=void 0===i?"AES-GCM":i,h=n.iv,p=n.additionalData,l=void 0===p?new Uint8Array([]):p,b=n.tagLength,t instanceof Uint8Array&&r instanceof Uint8Array){e.next=3;break}throw new Error("InvalidArguments");case 3:return d({name:o,iv:h,tagLength:b}),u.default.ciphers[o].tagLength&&!b&&(b=u.default.ciphers[o].tagLength),e.next=7,f.getWebCryptoAll();case 7:return y=e.sent,e.next=10,f.getNodeCrypto();case 10:if(m=e.sent,void 0===y||"function"!=typeof y.importKey||"function"!=typeof y.encrypt){e.next=15;break}return e.abrupt("return",c.encrypt(t,r,{name:o,iv:h,additionalData:l,tagLength:b},y));case 15:if(void 0===m){e.next=19;break}return e.abrupt("return",s.encrypt(t,r,{name:o,iv:h,additionalData:l,tagLength:b},m));case 19:throw new Error("UnsupportedEnvironment");case 20:case"end":return e.stop()}},e)}));return function(t,r,n){return e.apply(this,arguments)}}();t.encrypt=h;var p=function(){var e=(0,o.default)(a.default.mark(function e(t,r,n){var i,o,h,p,l,b,y,m;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i=n.name,o=void 0===i?"AES-GCM":i,h=n.iv,p=n.additionalData,l=void 0===p?new Uint8Array([]):p,b=n.tagLength,t instanceof Uint8Array&&r instanceof Uint8Array){e.next=3;break}throw new Error("InvalidArguments");case 3:return d({name:o,iv:h,tagLength:b}),u.default.ciphers[o].tagLength&&!b&&(b=u.default.ciphers[o].tagLength),e.next=7,f.getWebCryptoAll();case 7:return y=e.sent,e.next=10,f.getNodeCrypto();case 10:if(m=e.sent,void 0===y||"function"!=typeof y.importKey||"function"!=typeof y.encrypt){e.next=15;break}return e.abrupt("return",c.decrypt(t,r,{name:o,iv:h,additionalData:l,tagLength:b},y));case 15:if(void 0===m){e.next=19;break}return e.abrupt("return",s.decrypt(t,r,{name:o,iv:h,additionalData:l,tagLength:b},m));case 19:throw new Error("UnsupportedEnvironment");case 20:case"end":return e.stop()}},e)}));return function(t,r,n){return e.apply(this,arguments)}}();t.decrypt=p;var l=function(){var e=(0,o.default)(a.default.mark(function e(t,r,n){var i,o,d,h,p;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i=n.name,o=void 0===i?"AES-KW":i,t instanceof Uint8Array){e.next=3;break}throw new Error("NonUint8ArrayData");case 3:if(r instanceof Uint8Array){e.next=5;break}throw new Error("NonUint8ArrayKey");case 5:if(!(t.length%8>0)){e.next=7;break}throw new Error("WrappedKeyMustBeMultipleOf8");case 7:return e.next=9,f.getWebCryptoAll();case 9:return d=e.sent,e.next=12,f.getNodeCrypto();case 12:if(h=e.sent,p=u.default.wrapKeys["AES-KW"].defaultIV,void 0===d||"function"!=typeof d.importKey||"function"!=typeof d.wrapKey){e.next=18;break}return e.abrupt("return",c.wrapKey(t,r,{name:o,iv:p},d));case 18:if(void 0===h){e.next=22;break}return e.abrupt("return",s.wrapKey(t,r,{name:o,iv:p},h));case 22:throw new Error("UnsupportedEnvironment");case 23:case"end":return e.stop()}},e)}));return function(t,r,n){return e.apply(this,arguments)}}();t.wrapKey=l;var b=function(){var e=(0,o.default)(a.default.mark(function e(t,r,n){var i,o,d,h,p;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i=n.name,o=void 0===i?"AES-KW":i,t instanceof Uint8Array){e.next=3;break}throw new Error("NonUint8ArrayData");case 3:if(r instanceof Uint8Array){e.next=5;break}throw new Error("NonUint8ArrayKey");case 5:return e.next=7,f.getWebCryptoAll();case 7:return d=e.sent,e.next=10,f.getNodeCrypto();case 10:if(h=e.sent,p=u.default.wrapKeys["AES-KW"].defaultIV,void 0===d||"function"!=typeof d.importKey||"function"!=typeof d.wrapKey){e.next=16;break}return e.abrupt("return",c.unwrapKey(t,r,{name:o,iv:p},d));case 16:if(void 0===h){e.next=20;break}return e.abrupt("return",s.unwrapKey(t,r,{name:o,iv:p},h));case 20:throw new Error("UnsupportedEnvironment");case 21:case"end":return e.stop()}},e)}));return function(t,r,n){return e.apply(this,arguments)}}();t.unwrapKey=b},function(e,t,r){"use strict";var n=r(2);Object.defineProperty(t,"__esModule",{value:!0}),t.decrypt=t.encrypt=t.unwrapKey=t.wrapKey=void 0;var i=n(r(46));t.wrapKey=function(e,t,r,n){var i=r.name,o=void 0===i?"AES-KW":i,f=r.iv;return a(e,t,{name:o,iv:f},n,!0)};t.unwrapKey=function(e,t,r,n){var i=r.name,a=void 0===i?"AES-KW":i,f=r.iv;return o(e,t,{name:a,iv:f},n,!0)};var a=function(e,t,r,n){var a,o,s,c,u=r.name,d=r.iv,h=r.additionalData,p=r.tagLength,l=arguments.length>4&&void 0!==arguments[4]&&arguments[4],b=f(u,t.byteLength,l?i.default.wrapKeys:i.default.ciphers);switch(u){case"AES-GCM":(a=n.createCipheriv(b,t,d,{authTagLength:p})).setAAD(h);break;case"AES-CTR":if(0===d.length||d.length>16)throw new Error("InvalidIVLength");var y=new Uint8Array(16);y.set(d),y[15]+=1,a=n.createCipheriv(b,t,y);break;default:a=n.createCipheriv(b,t,d)}try{o=new Uint8Array(a.update(e)),s=new Uint8Array(a.final()),c=new Uint8Array([]),"AES-GCM"===u&&(c=new Uint8Array(a.getAuthTag()))}catch(e){throw new Error("NodeCrypto_EncryptionFailure")}var m=new Uint8Array(o.length+s.length+c.length);return m.set(o),m.set(s,o.length),m.set(c,o.length+s.length),m};t.encrypt=a;var o=function(e,t,r,n){var a,o,s,c,u=r.name,d=r.iv,h=r.additionalData,p=r.tagLength,l=arguments.length>4&&void 0!==arguments[4]&&arguments[4],b=f(u,t.byteLength,l?i.default.wrapKeys:i.default.ciphers);switch(u){case"AES-GCM":(a=n.createDecipheriv(b,t,d,{authTagLength:p})).setAAD(h),o=e.slice(0,e.length-p);var y=e.slice(e.length-p);a.setAuthTag(y);break;case"AES-CTR":if(0===d.length||d.length>16)throw new Error("InvalidIVLength");var m=new Uint8Array(16);m.set(d),m[15]+=1,a=n.createDecipheriv(b,t,m),o=e;break;default:a=n.createDecipheriv(b,t,d),o=e}try{s=a.update(o),c=a.final()}catch(e){throw new Error("NodeCrypto_DecryptionFailure")}var v=new Uint8Array(c.length+s.length);return v.set(s),v.set(c,s.length),v};t.decrypt=o;var f=function(e,t,r){var n=r[e].nodePrefix;return(n="".concat(n).concat((8*t).toString()))+r[e].nodeSuffix}},function(e,t,r){"use strict";var n=r(2);Object.defineProperty(t,"__esModule",{value:!0}),t.decrypt=t.encrypt=t.unwrapKey=t.wrapKey=void 0;var i=n(r(0)),a=n(r(1)),o=function(){var e=(0,a.default)(i.default.mark(function e(t,r,n,a){var o,f,s,c,u,d;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(o=n.name,f=void 0===o?"AES-KW":o,s=n.iv,void 0!==window.msCrypto){e.next=20;break}return e.prev=2,e.next=5,a.importKey("raw",r,{name:f},!1,["wrapKey","unwrapKey"]);case 5:return c=e.sent,e.next=8,a.importKey("raw",t,{name:f},!0,["wrapKey","unwrapKey"]);case 8:return u=e.sent,e.next=11,a.wrapKey("raw",u,c,{name:f,iv:s});case 11:return d=e.sent,e.abrupt("return",new Uint8Array(d));case 15:throw e.prev=15,e.t0=e.catch(2),new Error("WebCrypto_FailedToWrapKey - ".concat(e.t0.message));case 18:e.next=21;break;case 20:throw new Error("ThrowAwayIeAsap");case 21:case"end":return e.stop()}},e,null,[[2,15]])}));return function(t,r,n,i){return e.apply(this,arguments)}}();t.wrapKey=o;var f=function(){var e=(0,a.default)(i.default.mark(function e(t,r,n,a){var o,f,s,c,u;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(o=n.name,f=void 0===o?"AES-KW":o,s=n.iv,void 0!==window.msCrypto){e.next=21;break}return e.prev=2,e.next=5,a.importKey("raw",r,{name:f},!1,["wrapKey","unwrapKey"]);case 5:return c=e.sent,e.next=8,a.unwrapKey("raw",t,c,{name:f,iv:s},{name:"AES-GCM"},!0,["encrypt","decrypt"]);case 8:return u=e.sent,e.t0=Uint8Array,e.next=12,a.exportKey("raw",u);case 12:return e.t1=e.sent,e.abrupt("return",new e.t0(e.t1));case 16:throw e.prev=16,e.t2=e.catch(2),new Error("WebCrypto_FailedToUnwrapKey - ".concat(e.t2.message));case 19:e.next=22;break;case 21:throw new Error("ThrowAwayMsIeAsap");case 22:case"end":return e.stop()}},e,null,[[2,16]])}));return function(t,r,n,i){return e.apply(this,arguments)}}();t.unwrapKey=f;var s=function(){var e=(0,a.default)(i.default.mark(function e(t,r,n,a){var o,f,s,c,p,l,b,y,m,v,g;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(o=n.name,f=void 0===o?"AES-GCM":o,s=n.iv,c=n.additionalData,p=n.tagLength,l=u({name:f,iv:s,additionalData:c,tagLength:p}),void 0!==window.msCrypto){e.next=18;break}return e.prev=3,e.next=6,a.importKey("raw",r,l,!1,["encrypt","decrypt"]);case 6:return b=e.sent,e.next=9,a.encrypt(l,b,t);case 9:return y=e.sent,e.abrupt("return",new Uint8Array(y));case 13:throw e.prev=13,e.t0=e.catch(3),new Error("WebCrypto_EncryptionFailure: ".concat(e.t0.message));case 16:e.next=38;break;case 18:return e.prev=18,e.next=21,d("raw",r,l,!1,["encrypt","decrypt"],a);case 21:return m=e.sent,e.next=24,h(l,m,t,a);case 24:if(v=e.sent,"AES-GCM"!==f){e.next=32;break}return(g=new Uint8Array(v.ciphertext.byteLength+v.tag.byteLength)).set(new Uint8Array(v.ciphertext)),g.set(new Uint8Array(v.tag),v.ciphertext.byteLength),e.abrupt("return",g);case 32:return e.abrupt("return",new Uint8Array(v));case 33:e.next=38;break;case 35:throw e.prev=35,e.t1=e.catch(18),new Error("ThrowAwayMsIeAsap: ".concat(e.t1.message));case 38:case"end":return e.stop()}},e,null,[[3,13],[18,35]])}));return function(t,r,n,i){return e.apply(this,arguments)}}();t.encrypt=s;var c=function(){var e=(0,a.default)(i.default.mark(function e(t,r,n,a){var o,f,s,c,h,l,b,y,m,v,g;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(o=n.name,f=n.iv,s=n.additionalData,c=n.tagLength,h=u({name:o,iv:f,additionalData:s,tagLength:c}),window.msCrypto){e.next=18;break}return e.prev=3,e.next=6,a.importKey("raw",r,h,!1,["encrypt","decrypt"]);case 6:return l=e.sent,e.next=9,a.decrypt(h,l,t);case 9:return b=e.sent,e.abrupt("return",new Uint8Array(b));case 13:throw e.prev=13,e.t0=e.catch(3),new Error("WebCrypto_DecryptionFailure: ".concat(e.t0.message));case 16:e.next=39;break;case 18:return e.prev=18,e.next=21,d("raw",r,h,!1,["encrypt","decrypt"],a);case 21:if(y=e.sent,"AES-GCM"!==o){e.next=30;break}return v=t.slice(0,t.length-c),g=t.slice(t.length-c,t.length),e.next=27,p(Object.assign(h,{tag:g}),y,v,a);case 27:m=e.sent,e.next=33;break;case 30:return e.next=32,p(h,y,t,a);case 32:m=e.sent;case 33:return e.abrupt("return",new Uint8Array(m));case 36:throw e.prev=36,e.t1=e.catch(18),new Error("ThrowAwayMsIeAsap: ".concat(e.t1.message));case 39:case"end":return e.stop()}},e,null,[[3,13],[18,36]])}));return function(t,r,n,i){return e.apply(this,arguments)}}();t.decrypt=c;var u=function(e){var t=e.name,r=e.iv,n=e.additionalData,i=e.tagLength,a={};switch(t){case"AES-GCM":Object.assign(a,{name:t,iv:r,tagLength:8*i}),Object.assign(a,n.length>0?{additionalData:n}:{});break;case"AES-CBC":a.name=t,a.iv=r;break;case"AES-CTR":if(0===r.length||r.length>16)throw new Error("InvalidIVLength");a.name=t,a.counter=new Uint8Array(16),a.counter.set(r),a.counter[15]+=1,a.length=128}return a},d=function(e,t,r,n,i,a){return new Promise(function(o,f){var s=a.importKey(e,t,r,n,i);s.oncomplete=function(e){o(e.target.result)},s.onerror=function(){f("KeyImportingFailed")}})},h=function(e,t,r,n){return new Promise(function(i,a){var o=n.encrypt(e,t,r);o.oncomplete=function(e){i(e.target.result)},o.onerror=function(){a("EncryptionFailure")}})},p=function(e,t,r,n){return new Promise(function(i,a){var o=n.decrypt(e,t,r);o.oncomplete=function(e){i(e.target.result)},o.onerror=function(){a("DecryptionFailure")}})}},function(e,t,r){"use strict";var n=r(12);Object.defineProperty(t,"__esModule",{value:!0}),t.getRandomBytes=t.getRandomSampledString=t.getRandomAsciiString=t.getRandomString=void 0;var i=n(r(6));t.getRandomString=function(e){for(var t=a(e),r=a(e),n="",i=0;i1&&void 0!==d[1]?d[1]:"SHA-256",n=d.length>2&&void 0!==d[2]?d[2]:"binary",!(["hex","binary"].indexOf(n)<0)){e.next=4;break}throw new Error("UnsupportedOutputFormat");case 4:if("EC"!==t.kty){e.next=8;break}a=JSON.stringify({crv:t.crv,kty:t.kty,x:t.x,y:t.y}),e.next=13;break;case 8:if("RSA"!==t.kty){e.next=12;break}a=JSON.stringify({e:t.e,kty:t.kty,n:t.n}),e.next=13;break;case 12:throw new Error("UnsupportedKeyType");case 13:return c=new Uint8Array(s.from(a,"utf8")),e.next=16,f.default.compute(c,r);case 16:if(u=e.sent,"hex"!==n){e.next=21;break}return e.abrupt("return",o.default.encoder.arrayBufferToHexString(u));case 21:if("base64"!==n){e.next=25;break}return e.abrupt("return",o.default.encoder.encodeBase64(u));case 25:if("binary"!==n){e.next=27;break}return e.abrupt("return",u);case 27:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}();t.getJwkThumbprint=c},function(e,t,r){(function(e,r){var n=200,i="__lodash_hash_undefined__",a=9007199254740991,o="[object Arguments]",f="[object Boolean]",s="[object Date]",c="[object Function]",u="[object GeneratorFunction]",d="[object Map]",h="[object Number]",p="[object Object]",l="[object RegExp]",b="[object Set]",y="[object String]",m="[object Symbol]",v="[object ArrayBuffer]",g="[object DataView]",w="[object Float32Array]",_="[object Float64Array]",S="[object Int8Array]",A="[object Int16Array]",x="[object Int32Array]",M="[object Uint8Array]",k="[object Uint8ClampedArray]",E="[object Uint16Array]",P="[object Uint32Array]",B=/\w*$/,j=/^\[object .+?Constructor\]$/,I=/^(?:0|[1-9]\d*)$/,C={};C[o]=C["[object Array]"]=C[v]=C[g]=C[f]=C[s]=C[w]=C[_]=C[S]=C[A]=C[x]=C[d]=C[h]=C[p]=C[l]=C[b]=C[y]=C[m]=C[M]=C[k]=C[E]=C[P]=!0,C["[object Error]"]=C[c]=C["[object WeakMap]"]=!1;var U="object"==typeof e&&e&&e.Object===Object&&e,O="object"==typeof self&&self&&self.Object===Object&&self,R=U||O||Function("return this")(),K=t&&!t.nodeType&&t,z=K&&"object"==typeof r&&r&&!r.nodeType&&r,T=z&&z.exports===K;function N(e,t){return e.set(t[0],t[1]),e}function L(e,t){return e.add(t),e}function D(e,t,r,n){var i=-1,a=e?e.length:0;for(n&&a&&(r=e[++i]);++i-1},ke.prototype.set=function(e,t){var r=this.__data__,n=Ie(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},Ee.prototype.clear=function(){this.__data__={hash:new Me,map:new(pe||ke),string:new Me}},Ee.prototype.delete=function(e){return Ke(this,e).delete(e)},Ee.prototype.get=function(e){return Ke(this,e).get(e)},Ee.prototype.has=function(e){return Ke(this,e).has(e)},Ee.prototype.set=function(e,t){return Ke(this,e).set(e,t),this},Pe.prototype.clear=function(){this.__data__=new ke},Pe.prototype.delete=function(e){return this.__data__.delete(e)},Pe.prototype.get=function(e){return this.__data__.get(e)},Pe.prototype.has=function(e){return this.__data__.has(e)},Pe.prototype.set=function(e,t){var r=this.__data__;if(r instanceof ke){var i=r.__data__;if(!pe||i.length-1&&e%1==0&&e-1&&e%1==0&&e<=a}(e.length)&&!Ye(e)}var We=ue||function(){return!1};function Ye(e){var t=Ze(e)?ee.call(e):"";return t==c||t==u}function Ze(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ve(e){return Je(e)?Be(e):function(e){if(!De(e))return de(e);var t=[];for(var r in Object(e))Q.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}r.exports=function(e){return Ce(e,!0,!0)}}).call(this,r(32),r(33)(e))},function(e,t,r){"use strict";r.r(t);var n=r(0),i=r.n(n),a=r(1),o=r.n(a),f=r(6),s=r(3),c=r.n(s),u={namedCurves:{"P-256":{indutnyName:"p256",nodeName:"prime256v1",payloadSize:32},"P-384":{indutnyName:"p384",nodeName:"secp384r1",payloadSize:48},"P-521":{indutnyName:"p521",nodeName:"secp521r1",payloadSize:66},"P-256K":{indutnyName:"secp256k1",nodeName:"secp256k1",payloadSize:32}},hashes:{"SHA-256":{nodeName:"sha256"},"SHA-384":{nodeName:"sha384"},"SHA-512":{nodeName:"sha512"},"SHA-1":{nodeName:"sha1"}}},d=r(13),h=r.n(d),p=r(5),l=r.n(p).a.Buffer,b=h.a.bignum,y=function(e,t){var r=l.from(e),n=v.decode(r,"der"),i=u.namedCurves[t].payloadSize,a=new Uint8Array(n.r.toArray("be",i)),o=new Uint8Array(n.s.toArray("be",i)),f=new Uint8Array(2*i);return f.set(a),f.set(o,i),f},m=function(e,t){var r=u.namedCurves[t].payloadSize,n=e.slice(0,r),i=e.slice(r,e.length),a=v.encode({r:new b(n),s:new b(i)},"der");return new Uint8Array(a)},v=h.a.define("ECDSASignature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())}),g=function(){var e=o()(i.a.mark(function e(t,r){var n,a,o;return i.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.generateKey({name:"ECDSA",namedCurve:t,hash:{name:"SHA-256"}},!0,["sign","verify"]);case 2:return n=e.sent,e.next=5,r.exportKey("jwk",n.publicKey);case 5:return a=e.sent,e.next=8,r.exportKey("jwk",n.privateKey);case 8:return o=e.sent,["key_ops","alg","ext"].forEach(function(e){delete a[e],delete o[e]}),e.abrupt("return",{publicKey:a,privateKey:o});case 11:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}(),w=function(){var e=o()(i.a.mark(function e(t,r,n,a,o){var f,s,c;return i.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return f={name:"ECDSA",namedCurve:r.crv,hash:{name:n}},e.next=3,o.importKey("jwk",r,f,!1,["sign"]);case 3:return s=e.sent,e.next=6,o.sign(f,s,t);case 6:return c=e.sent,e.abrupt("return","raw"===a?new Uint8Array(c):m(new Uint8Array(c),r.crv));case 8:case"end":return e.stop()}},e)}));return function(t,r,n,i,a){return e.apply(this,arguments)}}(),_=function(){var e=o()(i.a.mark(function e(t,r,n,a,o,f){var s,c,u;return i.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return s={name:"ECDSA",namedCurve:n.crv,hash:{name:a}},e.next=3,f.importKey("jwk",n,s,!1,["verify"]);case 3:return c=e.sent,u="raw"===o?r:y(r,n.crv),e.next=7,f.verify(s,c,u,t);case 7:return e.abrupt("return",e.sent);case 8:case"end":return e.stop()}},e)}));return function(t,r,n,i,a,o){return e.apply(this,arguments)}}(),S=function(){var e=o()(i.a.mark(function e(t,r,n){var a,o,f,s;return i.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a={name:"ECDH",namedCurve:r.crv},e.next=3,n.importKey("jwk",r,a,!1,["deriveBits"]);case 3:return o=e.sent,e.next=6,n.importKey("jwk",t,a,!1,[]);case 6:return f=e.sent,s=function(){return 8*c.a.encoder.decodeBase64Url(r.x).length},e.t0=Uint8Array,e.next=11,n.deriveBits(Object.assign(a,{public:f}),o,s());case 11:return e.t1=e.sent,e.abrupt("return",new e.t0(e.t1));case 13:case"end":return e.stop()}},e)}));return function(t,r,n){return e.apply(this,arguments)}}(),A=r(9),x=function(){var e=o()(i.a.mark(function e(t,r){var n,a,o,f,s,c,d;return i.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if((n=r.ECDH(u.namedCurves[t].nodeName)).generateKeys(),a=new Uint8Array(n.getPublicKey()),o=new Uint8Array(n.getPrivateKey()),!(f=new A.Key("oct",a,{namedCurve:t})).isPrivate){e.next=7;break}throw new Error("NotPublicKeyForECCKeyGenNode");case 7:return e.next=9,f.export("jwk",{outputPublic:!0});case 9:if(s=e.sent,(c=new A.Key("oct",o,{namedCurve:t})).isPrivate){e.next=13;break}throw new Error("NotPrivateKeyForECCKeyGenNode");case 13:return e.next=15,c.export("jwk");case 15:return d=e.sent,e.abrupt("return",{publicKey:s,privateKey:d});case 17:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}(),M=function(){var e=o()(i.a.mark(function e(t,r,n,a,o){var f,s,c,d;return i.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if((f=new A.Key("jwk",r)).isPrivate){e.next=3;break}throw new Error("NotPrivateKeyForECCSignNode");case 3:return e.next=5,f.export("pem");case 5:return s=e.sent,(c=o.createSign(u.hashes[n].nodeName)).update(t),d=c.sign(s),e.abrupt("return","raw"===a?y(d,r.crv):d);case 10:case"end":return e.stop()}},e)}));return function(t,r,n,i,a){return e.apply(this,arguments)}}(),k=function(){var e=o()(i.a.mark(function e(t,r,n,a,o,f){var s,c,d,h;return i.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if((s=new A.Key("jwk",n)).isPrivate){e.next=3;break}throw new Error("NotPrivateKeyForECCVerifyNode");case 3:return e.next=5,s.export("pem",{outputPublic:!0,compact:!1});case 5:return c=e.sent,(d=f.createVerify(u.hashes[a].nodeName)).update(t),h="raw"===o?m(r,n.crv):r,e.abrupt("return",d.verify(c,h));case 10:case"end":return e.stop()}},e)}));return function(t,r,n,i,a,o){return e.apply(this,arguments)}}(),E=function(e,t,r){var n=u.namedCurves[t.crv].nodeName,i=u.namedCurves[t.crv].payloadSize,a=r.createECDH(n),o=c.a.encoder.decodeBase64Url(t.d),f=new Uint8Array(2*i+1);return f[0]=4,f.set(c.a.encoder.decodeBase64Url(e.x),1),f.set(c.a.encoder.decodeBase64Url(e.y),i+1),a.setPrivateKey(o),new Uint8Array(a.computeSecret(f))},P=r(29),B=r.n(P),j=r(15),I=r.n(j),C=r(28),U=r.n(C).a.ec,O=function(){var e=o()(i.a.mark(function e(t){var r,n,a,o,f,s,d,h,p,l;return i.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=u.namedCurves[t].indutnyName,n=new U(r),e.t0=n,e.t1=c.a.encoder,e.next=6,B.a.getRandomBytes(32);case 6:if(e.t2=e.sent,e.t3=e.t1.arrayBufferToString.call(e.t1,e.t2),e.t4={entropy:e.t3},a=e.t0.genKeyPair.call(e.t0,e.t4),o=u.namedCurves[t].payloadSize,f=new Uint8Array(a.getPublic("array")),s=new Uint8Array(a.getPrivate().toArray("be",o)),!(d=new A.Key("oct",f,{namedCurve:t})).isPrivate){e.next=16;break}throw new Error("NotPublicKeyForECCKeyGenPureJS");case 16:return e.next=18,d.export("jwk",{outputPublic:!0});case 18:if(h=e.sent,(p=new A.Key("oct",s,{namedCurve:t})).isPrivate){e.next=22;break}throw new Error("NotPrivateKeyForECCKeyGenPureJS");case 22:return e.next=24,p.export("jwk");case 24:return l=e.sent,e.abrupt("return",{publicKey:h,privateKey:l});case 26:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),R=function(){var e=o()(i.a.mark(function e(t,r,n,a){var o,f,s,c,d,h,p,l,b,y,v,g;return i.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(o=r.crv,f=u.namedCurves[o].indutnyName,s=new U(f),(c=new A.Key("jwk",r)).isPrivate){e.next=6;break}throw new Error("NotPrivateKeyForECCSignPureJS");case 6:return e.next=8,c.export("oct");case 8:return d=e.sent,h=s.keyFromPrivate(d),e.next=12,I.a.compute(t,n);case 12:return p=e.sent,l=h.sign(p),b=u.namedCurves[o].payloadSize,y=new Uint8Array(l.r.toArray("be",b)),v=new Uint8Array(l.s.toArray("be",b)),(g=new Uint8Array(y.length+v.length)).set(y),g.set(v,y.length),e.abrupt("return","raw"===a?g:m(g,o));case 21:case"end":return e.stop()}},e)}));return function(t,r,n,i){return e.apply(this,arguments)}}(),K=function(){var e=o()(i.a.mark(function e(t,r,n,a,o){var f,s,c,d,h,p,l,b,m,v;return i.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(f=n.crv,s=u.namedCurves[f].indutnyName,c=new U(s),!(d=new A.Key("jwk",n)).isPrivate){e.next=6;break}throw new Error("NotPublicKeyForECCVerifyPureJS");case 6:return e.next=8,d.export("oct",{compact:!1,outputPublic:!0});case 8:return h=e.sent,p=c.keyFromPublic(h),l=u.namedCurves[f].payloadSize,r instanceof Uint8Array||(r=new Uint8Array(r)),r="raw"===o?r:y(r,f),b=r.slice(0,l),m=r.slice(l,l+b.length),e.next=17,I.a.compute(t,a);case 17:return v=e.sent,e.next=20,p.verify(v,{s:m,r:b});case 20:return e.abrupt("return",e.sent);case 21:case"end":return e.stop()}},e)}));return function(t,r,n,i,a){return e.apply(this,arguments)}}(),z=function(){var e=o()(i.a.mark(function e(t,r){var n,a,o,f,s,c,d,h,p,l;return i.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=r.crv,a=u.namedCurves[n].indutnyName,o=new U(a),(f=new A.Key("jwk",r)).isPrivate){e.next=6;break}throw new Error("NotPrivateKeyForECCSDeriveKeyPureJS");case 6:return e.next=8,f.export("oct");case 8:if(s=e.sent,!(c=new A.Key("jwk",t)).isPrivate){e.next=12;break}throw new Error("NotPublicKeyForECCDeriveKeyPureJS");case 12:return e.next=14,c.export("oct",{compact:!1,outputPublic:!0});case 14:return d=e.sent,h=o.keyFromPrivate(s),p=o.keyFromPublic(d),l=u.namedCurves[n].payloadSize,e.abrupt("return",new Uint8Array(h.derive(p.getPublic()).toArray("be",l)));case 19:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}(),T=function(){var e=o()(i.a.mark(function e(){var t,r,n,a,o,s,c=arguments;return i.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=c.length>0&&void 0!==c[0]?c[0]:"P-256",r=f.getWebCrypto(),n=f.getNodeCrypto(),a=!0,s={},void 0===r||"function"!=typeof r.generateKey||"function"!=typeof r.exportKey){e.next=11;break}return e.next=8,g(t,r).catch(function(e){o=e.message,a=!1});case 8:s=e.sent,e.next=18;break;case 11:if(void 0===n){e.next=17;break}return e.next=14,x(t,n).catch(function(e){o=e.message,a=!1});case 14:s=e.sent,e.next=18;break;case 17:a=!1;case 18:if(!1!==a){e.next=22;break}return e.next=21,O(t).catch(function(e){throw o="".concat(o," => ").concat(e.message),new Error("UnsupportedEnvironment: ".concat(o))});case 21:s=e.sent;case 22:return e.abrupt("return",s);case 23:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),N=function(){var e=o()(i.a.mark(function e(t,r){var n,a,o,s,c,u,d,h=arguments;return i.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=h.length>2&&void 0!==h[2]?h[2]:"SHA-256","raw"===(a=h.length>3&&void 0!==h[3]?h[3]:"raw")||"der"===a){e.next=4;break}throw new Error("InvalidSignatureFormat");case 4:if(o=f.getWebCrypto(),s=f.getNodeCrypto(),c=!0,void 0===o||"function"!=typeof o.importKey||"function"!=typeof o.sign){e.next=13;break}return e.next=10,w(t,r,n,a,o).catch(function(e){u=e.message,c=!1});case 10:d=e.sent,e.next=20;break;case 13:if(void 0===s){e.next=19;break}return e.next=16,M(t,r,n,a,s).catch(function(e){u=e.message,c=!1});case 16:d=e.sent,e.next=20;break;case 19:c=!1;case 20:if(!1!==c){e.next=24;break}return e.next=23,R(t,r,n,a).catch(function(e){throw u="".concat(u," => ").concat(e.message),new Error("UnsupportedEnvironment: ".concat(u))});case 23:d=e.sent;case 24:return e.abrupt("return",d);case 25:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}(),L=function(){var e=o()(i.a.mark(function e(t,r,n){var a,o,s,c,u,d,h,p=arguments;return i.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(a=p.length>3&&void 0!==p[3]?p[3]:"SHA-256","raw"===(o=p.length>4&&void 0!==p[4]?p[4]:"raw")||"der"===o){e.next=4;break}throw new Error("InvalidSignatureFormat");case 4:if(s=f.getWebCrypto(),c=f.getNodeCrypto(),u=!0,void 0===s||"function"!=typeof s.importKey||"function"!=typeof s.verify){e.next=13;break}return e.next=10,_(t,r,n,a,o,s).catch(function(e){d=e.message,u=!1});case 10:h=e.sent,e.next=20;break;case 13:if(void 0===c){e.next=19;break}return e.next=16,k(t,r,n,a,o,c).catch(function(e){d=e.message,u=!1});case 16:h=e.sent,e.next=20;break;case 19:u=!1;case 20:if(!1!==u){e.next=24;break}return e.next=23,K(t,r,n,a,o).catch(function(e){throw d="".concat(d," => ").concat(e.message),new Error("UnsupportedEnvironment: ".concat(d))});case 23:h=e.sent;case 24:return e.abrupt("return",h);case 25:case"end":return e.stop()}},e)}));return function(t,r,n){return e.apply(this,arguments)}}(),D=function(){var e=o()(i.a.mark(function e(t,r){var n,a,o,s,c;return i.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t.crv===r.crv){e.next=2;break}throw new Error("UnmatchedCurveName");case 2:if(n=f.getWebCrypto(),a=f.getNodeCrypto(),o=!0,void 0===n||"function"!=typeof n.importKey||"function"!=typeof n.deriveBits){e.next=11;break}return e.next=8,S(t,r,n).catch(function(e){s=e.message,o=!1});case 8:c=e.sent,e.next=12;break;case 11:if(void 0!==a)try{c=E(t,r,a)}catch(e){s=e.message,o=!1}else o=!1;case 12:if(!1!==o){e.next=23;break}return e.prev=13,e.next=16,z(t,r);case 16:c=e.sent,e.next=23;break;case 19:throw e.prev=19,e.t0=e.catch(13),s="".concat(s," => ").concat(e.t0.message),new Error("UnsupportedEnvironment: ".concat(s));case 23:return e.abrupt("return",c);case 24:case"end":return e.stop()}},e,null,[[13,19]])}));return function(t,r){return e.apply(this,arguments)}}();r.d(t,"generateKey",function(){return T}),r.d(t,"sign",function(){return N}),r.d(t,"verify",function(){return L}),r.d(t,"deriveSecret",function(){return D});t.default={generateKey:T,sign:N,verify:L,deriveSecret:D}}])});