UNPKG

oidc-client

Version:

OpenID Connect (OIDC) & OAuth2 client library

1 lines 788 kB
!function t(e,i){if("object"==typeof exports&&"object"==typeof module)module.exports=i();else if("function"==typeof define&&define.amd)define([],i);else{var r=i();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(this,(function(){return function(t){var e={};function i(r){if(e[r])return e[r].exports;var n=e[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=t,i.c=e,i.d=function(t,e,r){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(r,n,function(e){return t[e]}.bind(null,n));return r},i.n=function(t){var e=t&&t.__esModule?function e(){return t.default}:function e(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=133)}([function(t,e){"function"==typeof Object.create?t.exports=function t(e,i){e.super_=i,e.prototype=Object.create(i.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function t(e,i){e.super_=i;var r=function(){};r.prototype=i.prototype,e.prototype=new r,e.prototype.constructor=e}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,i,r){return i&&t(e.prototype,i),r&&t(e,r),e}}();var n={debug:function t(){},info:function t(){},warn:function t(){},error:function t(){}},o=void 0,s=void 0;(e.Log=function(){function t(){!function e(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")}(this,t)}return t.reset=function t(){s=3,o=n},t.debug=function t(){if(s>=4){for(var e=arguments.length,i=Array(e),r=0;r<e;r++)i[r]=arguments[r];o.debug.apply(o,Array.from(i))}},t.info=function t(){if(s>=3){for(var e=arguments.length,i=Array(e),r=0;r<e;r++)i[r]=arguments[r];o.info.apply(o,Array.from(i))}},t.warn=function t(){if(s>=2){for(var e=arguments.length,i=Array(e),r=0;r<e;r++)i[r]=arguments[r];o.warn.apply(o,Array.from(i))}},t.error=function t(){if(s>=1){for(var e=arguments.length,i=Array(e),r=0;r<e;r++)i[r]=arguments[r];o.error.apply(o,Array.from(i))}},r(t,null,[{key:"NONE",get:function t(){return 0}},{key:"ERROR",get:function t(){return 1}},{key:"WARN",get:function t(){return 2}},{key:"INFO",get:function t(){return 3}},{key:"DEBUG",get:function t(){return 4}},{key:"level",get:function t(){return s},set:function t(e){if(!(0<=e&&e<=4))throw new Error("Invalid log level");s=e}},{key:"logger",get:function t(){return o},set:function t(e){if(!e.debug&&e.info&&(e.debug=e.info),!(e.debug&&e.info&&e.warn&&e.error))throw new Error("Invalid logger");o=e}}]),t}()).reset()},function(t,e,i){var r=i(5),n=r.Buffer;function o(t,e){for(var i in t)e[i]=t[i]}function s(t,e,i){return n(t,e,i)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=r:(o(r,e),e.Buffer=s),o(n,s),s.from=function(t,e,i){if("number"==typeof t)throw new TypeError("Argument must not be a number");return n(t,e,i)},s.alloc=function(t,e,i){if("number"!=typeof t)throw new TypeError("Argument must be a number");var r=n(t);return void 0!==e?"string"==typeof i?r.fill(e,i):r.fill(e):r.fill(0),r},s.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n(t)},s.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r.SlowBuffer(t)}},function(t,e){var i,r,n=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(i===setTimeout)return setTimeout(t,0);if((i===o||!i)&&setTimeout)return i=setTimeout,setTimeout(t,0);try{return i(t,0)}catch(e){try{return i.call(null,t,0)}catch(e){return i.call(this,t,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:o}catch(t){i=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(t){r=s}}();var h,u=[],f=!1,l=-1;function c(){f&&h&&(f=!1,h.length?u=h.concat(u):l=-1,u.length&&d())}function d(){if(!f){var t=a(c);f=!0;for(var e=u.length;e;){for(h=u,u=[];++l<e;)h&&h[l].run();l=-1,e=u.length}h=null,f=!1,function i(t){if(r===clearTimeout)return clearTimeout(t);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{return r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function m(){}n.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)e[i-1]=arguments[i];u.push(new p(t,e)),1!==u.length||f||a(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=m,n.addListener=m,n.once=m,n.off=m,n.removeListener=m,n.removeAllListeners=m,n.emit=m,n.prependListener=m,n.prependOnceListener=m,n.listeners=function(t){return[]},n.binding=function(t){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(t){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},function(t,e){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(t){"object"==typeof window&&(i=window)}t.exports=i},function(t,e){},function(t,e){function i(t,e){if(!t)throw new Error(e||"Assertion failed")}t.exports=i,i.equal=function t(e,i,r){if(e!=i)throw new Error(r||"Assertion failed: "+e+" != "+i)}},function(t,e,i){"use strict";var r=e,n=i(9),o=i(6),s=i(107);r.assert=o,r.toArray=s.toArray,r.zero2=s.zero2,r.toHex=s.toHex,r.encode=s.encode,r.getNAF=function a(t,e,i){var r=new Array(Math.max(t.bitLength(),i)+1);r.fill(0);for(var n=1<<e+1,o=t.clone(),s=0;s<r.length;s++){var a,h=o.andln(n-1);o.isOdd()?(a=h>(n>>1)-1?(n>>1)-h:h,o.isubn(a)):a=0,r[s]=a,o.iushrn(1)}return r},r.getJSF=function h(t,e){var i=[[],[]];t=t.clone(),e=e.clone();for(var r=0,n=0;t.cmpn(-r)>0||e.cmpn(-n)>0;){var o,s,a,h=t.andln(3)+r&3,u=e.andln(3)+n&3;if(3===h&&(h=-1),3===u&&(u=-1),0==(1&h))o=0;else o=3!==(a=t.andln(7)+r&7)&&5!==a||2!==u?h:-h;if(i[0].push(o),0==(1&u))s=0;else s=3!==(a=e.andln(7)+n&7)&&5!==a||2!==h?u:-u;i[1].push(s),2*r===o+1&&(r=1-r),2*n===s+1&&(n=1-n),t.iushrn(1),e.iushrn(1)}return i},r.cachedProperty=function u(t,e,i){var r="_"+e;t.prototype[e]=function t(){return void 0!==this[r]?this[r]:this[r]=i.call(this)}},r.parseBytes=function f(t){return"string"==typeof t?r.toArray(t,"hex"):t},r.intFromLE=function l(t){return new n(t,"hex","le")}},function(t,e,i){"use strict";var r=i(6),n=i(0);function o(t,e){return 55296==(64512&t.charCodeAt(e))&&(!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1)))}function s(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function a(t){return 1===t.length?"0"+t:t}function h(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}e.inherits=n,e.toArray=function u(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var i=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),n=0;n<t.length;n+=2)i.push(parseInt(t[n]+t[n+1],16))}else for(var r=0,n=0;n<t.length;n++){var s=t.charCodeAt(n);s<128?i[r++]=s:s<2048?(i[r++]=s>>6|192,i[r++]=63&s|128):o(t,n)?(s=65536+((1023&s)<<10)+(1023&t.charCodeAt(++n)),i[r++]=s>>18|240,i[r++]=s>>12&63|128,i[r++]=s>>6&63|128,i[r++]=63&s|128):(i[r++]=s>>12|224,i[r++]=s>>6&63|128,i[r++]=63&s|128)}else for(n=0;n<t.length;n++)i[n]=0|t[n];return i},e.toHex=function f(t){for(var e="",i=0;i<t.length;i++)e+=a(t[i].toString(16));return e},e.htonl=s,e.toHex32=function l(t,e){for(var i="",r=0;r<t.length;r++){var n=t[r];"little"===e&&(n=s(n)),i+=h(n.toString(16))}return i},e.zero2=a,e.zero8=h,e.join32=function c(t,e,i,n){var o=i-e;r(o%4==0);for(var s=new Array(o/4),a=0,h=e;a<s.length;a++,h+=4){var u;u="big"===n?t[h]<<24|t[h+1]<<16|t[h+2]<<8|t[h+3]:t[h+3]<<24|t[h+2]<<16|t[h+1]<<8|t[h],s[a]=u>>>0}return s},e.split32=function d(t,e){for(var i=new Array(4*t.length),r=0,n=0;r<t.length;r++,n+=4){var o=t[r];"big"===e?(i[n]=o>>>24,i[n+1]=o>>>16&255,i[n+2]=o>>>8&255,i[n+3]=255&o):(i[n+3]=o>>>24,i[n+2]=o>>>16&255,i[n+1]=o>>>8&255,i[n]=255&o)}return i},e.rotr32=function p(t,e){return t>>>e|t<<32-e},e.rotl32=function m(t,e){return t<<e|t>>>32-e},e.sum32=function g(t,e){return t+e>>>0},e.sum32_3=function v(t,e,i){return t+e+i>>>0},e.sum32_4=function b(t,e,i,r){return t+e+i+r>>>0},e.sum32_5=function y(t,e,i,r,n){return t+e+i+r+n>>>0},e.sum64=function w(t,e,i,r){var n=t[e],o=r+t[e+1]>>>0,s=(o<r?1:0)+i+n;t[e]=s>>>0,t[e+1]=o},e.sum64_hi=function _(t,e,i,r){return(e+r>>>0<e?1:0)+t+i>>>0},e.sum64_lo=function M(t,e,i,r){return e+r>>>0},e.sum64_4_hi=function S(t,e,i,r,n,o,s,a){var h=0,u=e;return h+=(u=u+r>>>0)<e?1:0,h+=(u=u+o>>>0)<o?1:0,t+i+n+s+(h+=(u=u+a>>>0)<a?1:0)>>>0},e.sum64_4_lo=function k(t,e,i,r,n,o,s,a){return e+r+o+a>>>0},e.sum64_5_hi=function E(t,e,i,r,n,o,s,a,h,u){var f=0,l=e;return f+=(l=l+r>>>0)<e?1:0,f+=(l=l+o>>>0)<o?1:0,f+=(l=l+a>>>0)<a?1:0,t+i+n+s+h+(f+=(l=l+u>>>0)<u?1:0)>>>0},e.sum64_5_lo=function R(t,e,i,r,n,o,s,a,h,u){return e+r+o+a+u>>>0},e.rotr64_hi=function A(t,e,i){return(e<<32-i|t>>>i)>>>0},e.rotr64_lo=function T(t,e,i){return(t<<32-i|e>>>i)>>>0},e.shr64_hi=function x(t,e,i){return t>>>i},e.shr64_lo=function I(t,e,i){return(t<<32-i|e>>>i)>>>0}},function(t,e,i){(function(t){!function(t,e){"use strict";function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var i=function(){};i.prototype=e.prototype,t.prototype=new i,t.prototype.constructor=t}function o(t,e,i){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(i=e,e=10),this._init(t||0,e||10,i||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s=i(206).Buffer}catch(t){}function a(t,e,i){for(var r=0,n=Math.min(t.length,i),o=e;o<n;o++){var s=t.charCodeAt(o)-48;r<<=4,r|=s>=49&&s<=54?s-49+10:s>=17&&s<=22?s-17+10:15&s}return r}function h(t,e,i,r){for(var n=0,o=Math.min(t.length,i),s=e;s<o;s++){var a=t.charCodeAt(s)-48;n*=r,n+=a>=49?a-49+10:a>=17?a-17+10:a}return n}o.isBN=function t(e){return e instanceof o||null!==e&&"object"==typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function t(e,i){return e.cmp(i)>0?e:i},o.min=function t(e,i){return e.cmp(i)<0?e:i},o.prototype._init=function t(e,i,n){if("number"==typeof e)return this._initNumber(e,i,n);if("object"==typeof e)return this._initArray(e,i,n);"hex"===i&&(i=16),r(i===(0|i)&&i>=2&&i<=36);var o=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&o++,16===i?this._parseHex(e,o):this._parseBase(e,i,o),"-"===e[0]&&(this.negative=1),this.strip(),"le"===n&&this._initArray(this.toArray(),i,n)},o.prototype._initNumber=function t(e,i,n){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):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),i,n)},o.prototype._initArray=function t(e,i,n){if(r("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 o=0;o<this.length;o++)this.words[o]=0;var s,a,h=0;if("be"===n)for(o=e.length-1,s=0;o>=0;o-=3)a=e[o]|e[o-1]<<8|e[o-2]<<16,this.words[s]|=a<<h&67108863,this.words[s+1]=a>>>26-h&67108863,(h+=24)>=26&&(h-=26,s++);else if("le"===n)for(o=0,s=0;o<e.length;o+=3)a=e[o]|e[o+1]<<8|e[o+2]<<16,this.words[s]|=a<<h&67108863,this.words[s+1]=a>>>26-h&67108863,(h+=24)>=26&&(h-=26,s++);return this.strip()},o.prototype._parseHex=function t(e,i){this.length=Math.ceil((e.length-i)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var n,o,s=0;for(r=e.length-6,n=0;r>=i;r-=6)o=a(e,r,r+6),this.words[n]|=o<<s&67108863,this.words[n+1]|=o>>>26-s&4194303,(s+=24)>=26&&(s-=26,n++);r+6!==i&&(o=a(e,i,r+6),this.words[n]|=o<<s&67108863,this.words[n+1]|=o>>>26-s&4194303),this.strip()},o.prototype._parseBase=function t(e,i,r){this.words=[0],this.length=1;for(var n=0,o=1;o<=67108863;o*=i)n++;n--,o=o/i|0;for(var s=e.length-r,a=s%n,u=Math.min(s,s-a)+r,f=0,l=r;l<u;l+=n)f=h(e,l,l+n,i),this.imuln(o),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f);if(0!==a){var c=1;for(f=h(e,l,e.length,i),l=0;l<a;l++)c*=i;this.imuln(c),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f)}},o.prototype.copy=function t(e){e.words=new Array(this.length);for(var i=0;i<this.length;i++)e.words[i]=this.words[i];e.length=this.length,e.negative=this.negative,e.red=this.red},o.prototype.clone=function t(){var e=new o(null);return this.copy(e),e},o.prototype._expand=function t(e){for(;this.length<e;)this.words[this.length++]=0;return this},o.prototype.strip=function t(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function t(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function t(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function c(t,e,i){i.negative=e.negative^t.negative;var r=t.length+e.length|0;i.length=r,r=r-1|0;var n=0|t.words[0],o=0|e.words[0],s=n*o,a=67108863&s,h=s/67108864|0;i.words[0]=a;for(var u=1;u<r;u++){for(var f=h>>>26,l=67108863&h,c=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=c;d++){var p=u-d|0;f+=(s=(n=0|t.words[p])*(o=0|e.words[d])+l)/67108864|0,l=67108863&s}i.words[u]=0|l,h=0|f}return 0!==h?i.words[u]=0|h:i.length--,i.strip()}o.prototype.toString=function t(e,i){var n;if(i=0|i||1,16===(e=e||10)||"hex"===e){n="";for(var o=0,s=0,a=0;a<this.length;a++){var h=this.words[a],c=(16777215&(h<<o|s)).toString(16);n=0!==(s=h>>>24-o&16777215)||a!==this.length-1?u[6-c.length]+c+n:c+n,(o+=2)>=26&&(o-=26,a--)}for(0!==s&&(n=s.toString(16)+n);n.length%i!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var d=f[e],p=l[e];n="";var m=this.clone();for(m.negative=0;!m.isZero();){var g=m.modn(p).toString(e);n=(m=m.idivn(p)).isZero()?g+n:u[d-g.length]+g+n}for(this.isZero()&&(n="0"+n);n.length%i!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function t(){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&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function t(){return this.toString(16)},o.prototype.toBuffer=function t(e,i){return r(void 0!==s),this.toArrayLike(s,e,i)},o.prototype.toArray=function t(e,i){return this.toArrayLike(Array,e,i)},o.prototype.toArrayLike=function t(e,i,n){var o=this.byteLength(),s=n||Math.max(1,o);r(o<=s,"byte array longer than desired length"),r(s>0,"Requested array length <= 0"),this.strip();var a,h,u="le"===i,f=new e(s),l=this.clone();if(u){for(h=0;!l.isZero();h++)a=l.andln(255),l.iushrn(8),f[h]=a;for(;h<s;h++)f[h]=0}else{for(h=0;h<s-o;h++)f[h]=0;for(h=0;!l.isZero();h++)a=l.andln(255),l.iushrn(8),f[s-h-1]=a}return f},Math.clz32?o.prototype._countBits=function t(e){return 32-Math.clz32(e)}:o.prototype._countBits=function t(e){var i=e,r=0;return i>=4096&&(r+=13,i>>>=13),i>=64&&(r+=7,i>>>=7),i>=8&&(r+=4,i>>>=4),i>=2&&(r+=2,i>>>=2),r+i},o.prototype._zeroBits=function t(e){if(0===e)return 26;var i=e,r=0;return 0==(8191&i)&&(r+=13,i>>>=13),0==(127&i)&&(r+=7,i>>>=7),0==(15&i)&&(r+=4,i>>>=4),0==(3&i)&&(r+=2,i>>>=2),0==(1&i)&&r++,r},o.prototype.bitLength=function t(){var e=this.words[this.length-1],i=this._countBits(e);return 26*(this.length-1)+i},o.prototype.zeroBits=function t(){if(this.isZero())return 0;for(var e=0,i=0;i<this.length;i++){var r=this._zeroBits(this.words[i]);if(e+=r,26!==r)break}return e},o.prototype.byteLength=function t(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function t(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},o.prototype.fromTwos=function t(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function t(){return 0!==this.negative},o.prototype.neg=function t(){return this.clone().ineg()},o.prototype.ineg=function t(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function t(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var i=0;i<e.length;i++)this.words[i]=this.words[i]|e.words[i];return this.strip()},o.prototype.ior=function t(e){return r(0==(this.negative|e.negative)),this.iuor(e)},o.prototype.or=function t(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function t(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function t(e){var i;i=this.length>e.length?e:this;for(var r=0;r<i.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=i.length,this.strip()},o.prototype.iand=function t(e){return r(0==(this.negative|e.negative)),this.iuand(e)},o.prototype.and=function t(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function t(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function t(e){var i,r;this.length>e.length?(i=this,r=e):(i=e,r=this);for(var n=0;n<r.length;n++)this.words[n]=i.words[n]^r.words[n];if(this!==i)for(;n<i.length;n++)this.words[n]=i.words[n];return this.length=i.length,this.strip()},o.prototype.ixor=function t(e){return r(0==(this.negative|e.negative)),this.iuxor(e)},o.prototype.xor=function t(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function t(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function t(e){r("number"==typeof e&&e>=0);var i=0|Math.ceil(e/26),n=e%26;this._expand(i),n>0&&i--;for(var o=0;o<i;o++)this.words[o]=67108863&~this.words[o];return n>0&&(this.words[o]=~this.words[o]&67108863>>26-n),this.strip()},o.prototype.notn=function t(e){return this.clone().inotn(e)},o.prototype.setn=function t(e,i){r("number"==typeof e&&e>=0);var n=e/26|0,o=e%26;return this._expand(n+1),this.words[n]=i?this.words[n]|1<<o:this.words[n]&~(1<<o),this.strip()},o.prototype.iadd=function t(e){var i,r,n;if(0!==this.negative&&0===e.negative)return this.negative=0,i=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,i=this.isub(e),e.negative=1,i._normSign();this.length>e.length?(r=this,n=e):(r=e,n=this);for(var o=0,s=0;s<n.length;s++)i=(0|r.words[s])+(0|n.words[s])+o,this.words[s]=67108863&i,o=i>>>26;for(;0!==o&&s<r.length;s++)i=(0|r.words[s])+o,this.words[s]=67108863&i,o=i>>>26;if(this.length=r.length,0!==o)this.words[this.length]=o,this.length++;else if(r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this},o.prototype.add=function t(e){var i;return 0!==e.negative&&0===this.negative?(e.negative=0,i=this.sub(e),e.negative^=1,i):0===e.negative&&0!==this.negative?(this.negative=0,i=e.sub(this),this.negative=1,i):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function t(e){if(0!==e.negative){e.negative=0;var i=this.iadd(e);return e.negative=1,i._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,o=this.cmp(e);if(0===o)return this.negative=0,this.length=1,this.words[0]=0,this;o>0?(r=this,n=e):(r=e,n=this);for(var s=0,a=0;a<n.length;a++)s=(i=(0|r.words[a])-(0|n.words[a])+s)>>26,this.words[a]=67108863&i;for(;0!==s&&a<r.length;a++)s=(i=(0|r.words[a])+s)>>26,this.words[a]=67108863&i;if(0===s&&a<r.length&&r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this.length=Math.max(this.length,a),r!==this&&(this.negative=1),this.strip()},o.prototype.sub=function t(e){return this.clone().isub(e)};var d=function t(e,i,r){var n,o,s,a=e.words,h=i.words,u=r.words,f=0,l=0|a[0],c=8191&l,d=l>>>13,p=0|a[1],m=8191&p,g=p>>>13,v=0|a[2],b=8191&v,y=v>>>13,w=0|a[3],_=8191&w,M=w>>>13,S=0|a[4],k=8191&S,E=S>>>13,R=0|a[5],A=8191&R,T=R>>>13,x=0|a[6],I=8191&x,P=x>>>13,L=0|a[7],B=8191&L,C=L>>>13,O=0|a[8],j=8191&O,U=O>>>13,N=0|a[9],q=8191&N,D=N>>>13,z=0|h[0],F=8191&z,W=z>>>13,H=0|h[1],K=8191&H,Z=H>>>13,V=0|h[2],J=8191&V,Y=V>>>13,X=0|h[3],G=8191&X,Q=X>>>13,$=0|h[4],tt=8191&$,et=$>>>13,it=0|h[5],rt=8191&it,nt=it>>>13,ot=0|h[6],st=8191&ot,at=ot>>>13,ht=0|h[7],ut=8191&ht,ft=ht>>>13,lt=0|h[8],ct=8191&lt,dt=lt>>>13,pt=0|h[9],mt=8191&pt,gt=pt>>>13;r.negative=e.negative^i.negative,r.length=19;var vt=(f+(n=Math.imul(c,F))|0)+((8191&(o=(o=Math.imul(c,W))+Math.imul(d,F)|0))<<13)|0;f=((s=Math.imul(d,W))+(o>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(m,F),o=(o=Math.imul(m,W))+Math.imul(g,F)|0,s=Math.imul(g,W);var bt=(f+(n=n+Math.imul(c,K)|0)|0)+((8191&(o=(o=o+Math.imul(c,Z)|0)+Math.imul(d,K)|0))<<13)|0;f=((s=s+Math.imul(d,Z)|0)+(o>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(b,F),o=(o=Math.imul(b,W))+Math.imul(y,F)|0,s=Math.imul(y,W),n=n+Math.imul(m,K)|0,o=(o=o+Math.imul(m,Z)|0)+Math.imul(g,K)|0,s=s+Math.imul(g,Z)|0;var yt=(f+(n=n+Math.imul(c,J)|0)|0)+((8191&(o=(o=o+Math.imul(c,Y)|0)+Math.imul(d,J)|0))<<13)|0;f=((s=s+Math.imul(d,Y)|0)+(o>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(_,F),o=(o=Math.imul(_,W))+Math.imul(M,F)|0,s=Math.imul(M,W),n=n+Math.imul(b,K)|0,o=(o=o+Math.imul(b,Z)|0)+Math.imul(y,K)|0,s=s+Math.imul(y,Z)|0,n=n+Math.imul(m,J)|0,o=(o=o+Math.imul(m,Y)|0)+Math.imul(g,J)|0,s=s+Math.imul(g,Y)|0;var wt=(f+(n=n+Math.imul(c,G)|0)|0)+((8191&(o=(o=o+Math.imul(c,Q)|0)+Math.imul(d,G)|0))<<13)|0;f=((s=s+Math.imul(d,Q)|0)+(o>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(k,F),o=(o=Math.imul(k,W))+Math.imul(E,F)|0,s=Math.imul(E,W),n=n+Math.imul(_,K)|0,o=(o=o+Math.imul(_,Z)|0)+Math.imul(M,K)|0,s=s+Math.imul(M,Z)|0,n=n+Math.imul(b,J)|0,o=(o=o+Math.imul(b,Y)|0)+Math.imul(y,J)|0,s=s+Math.imul(y,Y)|0,n=n+Math.imul(m,G)|0,o=(o=o+Math.imul(m,Q)|0)+Math.imul(g,G)|0,s=s+Math.imul(g,Q)|0;var _t=(f+(n=n+Math.imul(c,tt)|0)|0)+((8191&(o=(o=o+Math.imul(c,et)|0)+Math.imul(d,tt)|0))<<13)|0;f=((s=s+Math.imul(d,et)|0)+(o>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(A,F),o=(o=Math.imul(A,W))+Math.imul(T,F)|0,s=Math.imul(T,W),n=n+Math.imul(k,K)|0,o=(o=o+Math.imul(k,Z)|0)+Math.imul(E,K)|0,s=s+Math.imul(E,Z)|0,n=n+Math.imul(_,J)|0,o=(o=o+Math.imul(_,Y)|0)+Math.imul(M,J)|0,s=s+Math.imul(M,Y)|0,n=n+Math.imul(b,G)|0,o=(o=o+Math.imul(b,Q)|0)+Math.imul(y,G)|0,s=s+Math.imul(y,Q)|0,n=n+Math.imul(m,tt)|0,o=(o=o+Math.imul(m,et)|0)+Math.imul(g,tt)|0,s=s+Math.imul(g,et)|0;var Mt=(f+(n=n+Math.imul(c,rt)|0)|0)+((8191&(o=(o=o+Math.imul(c,nt)|0)+Math.imul(d,rt)|0))<<13)|0;f=((s=s+Math.imul(d,nt)|0)+(o>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(I,F),o=(o=Math.imul(I,W))+Math.imul(P,F)|0,s=Math.imul(P,W),n=n+Math.imul(A,K)|0,o=(o=o+Math.imul(A,Z)|0)+Math.imul(T,K)|0,s=s+Math.imul(T,Z)|0,n=n+Math.imul(k,J)|0,o=(o=o+Math.imul(k,Y)|0)+Math.imul(E,J)|0,s=s+Math.imul(E,Y)|0,n=n+Math.imul(_,G)|0,o=(o=o+Math.imul(_,Q)|0)+Math.imul(M,G)|0,s=s+Math.imul(M,Q)|0,n=n+Math.imul(b,tt)|0,o=(o=o+Math.imul(b,et)|0)+Math.imul(y,tt)|0,s=s+Math.imul(y,et)|0,n=n+Math.imul(m,rt)|0,o=(o=o+Math.imul(m,nt)|0)+Math.imul(g,rt)|0,s=s+Math.imul(g,nt)|0;var St=(f+(n=n+Math.imul(c,st)|0)|0)+((8191&(o=(o=o+Math.imul(c,at)|0)+Math.imul(d,st)|0))<<13)|0;f=((s=s+Math.imul(d,at)|0)+(o>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(B,F),o=(o=Math.imul(B,W))+Math.imul(C,F)|0,s=Math.imul(C,W),n=n+Math.imul(I,K)|0,o=(o=o+Math.imul(I,Z)|0)+Math.imul(P,K)|0,s=s+Math.imul(P,Z)|0,n=n+Math.imul(A,J)|0,o=(o=o+Math.imul(A,Y)|0)+Math.imul(T,J)|0,s=s+Math.imul(T,Y)|0,n=n+Math.imul(k,G)|0,o=(o=o+Math.imul(k,Q)|0)+Math.imul(E,G)|0,s=s+Math.imul(E,Q)|0,n=n+Math.imul(_,tt)|0,o=(o=o+Math.imul(_,et)|0)+Math.imul(M,tt)|0,s=s+Math.imul(M,et)|0,n=n+Math.imul(b,rt)|0,o=(o=o+Math.imul(b,nt)|0)+Math.imul(y,rt)|0,s=s+Math.imul(y,nt)|0,n=n+Math.imul(m,st)|0,o=(o=o+Math.imul(m,at)|0)+Math.imul(g,st)|0,s=s+Math.imul(g,at)|0;var kt=(f+(n=n+Math.imul(c,ut)|0)|0)+((8191&(o=(o=o+Math.imul(c,ft)|0)+Math.imul(d,ut)|0))<<13)|0;f=((s=s+Math.imul(d,ft)|0)+(o>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(j,F),o=(o=Math.imul(j,W))+Math.imul(U,F)|0,s=Math.imul(U,W),n=n+Math.imul(B,K)|0,o=(o=o+Math.imul(B,Z)|0)+Math.imul(C,K)|0,s=s+Math.imul(C,Z)|0,n=n+Math.imul(I,J)|0,o=(o=o+Math.imul(I,Y)|0)+Math.imul(P,J)|0,s=s+Math.imul(P,Y)|0,n=n+Math.imul(A,G)|0,o=(o=o+Math.imul(A,Q)|0)+Math.imul(T,G)|0,s=s+Math.imul(T,Q)|0,n=n+Math.imul(k,tt)|0,o=(o=o+Math.imul(k,et)|0)+Math.imul(E,tt)|0,s=s+Math.imul(E,et)|0,n=n+Math.imul(_,rt)|0,o=(o=o+Math.imul(_,nt)|0)+Math.imul(M,rt)|0,s=s+Math.imul(M,nt)|0,n=n+Math.imul(b,st)|0,o=(o=o+Math.imul(b,at)|0)+Math.imul(y,st)|0,s=s+Math.imul(y,at)|0,n=n+Math.imul(m,ut)|0,o=(o=o+Math.imul(m,ft)|0)+Math.imul(g,ut)|0,s=s+Math.imul(g,ft)|0;var Et=(f+(n=n+Math.imul(c,ct)|0)|0)+((8191&(o=(o=o+Math.imul(c,dt)|0)+Math.imul(d,ct)|0))<<13)|0;f=((s=s+Math.imul(d,dt)|0)+(o>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(q,F),o=(o=Math.imul(q,W))+Math.imul(D,F)|0,s=Math.imul(D,W),n=n+Math.imul(j,K)|0,o=(o=o+Math.imul(j,Z)|0)+Math.imul(U,K)|0,s=s+Math.imul(U,Z)|0,n=n+Math.imul(B,J)|0,o=(o=o+Math.imul(B,Y)|0)+Math.imul(C,J)|0,s=s+Math.imul(C,Y)|0,n=n+Math.imul(I,G)|0,o=(o=o+Math.imul(I,Q)|0)+Math.imul(P,G)|0,s=s+Math.imul(P,Q)|0,n=n+Math.imul(A,tt)|0,o=(o=o+Math.imul(A,et)|0)+Math.imul(T,tt)|0,s=s+Math.imul(T,et)|0,n=n+Math.imul(k,rt)|0,o=(o=o+Math.imul(k,nt)|0)+Math.imul(E,rt)|0,s=s+Math.imul(E,nt)|0,n=n+Math.imul(_,st)|0,o=(o=o+Math.imul(_,at)|0)+Math.imul(M,st)|0,s=s+Math.imul(M,at)|0,n=n+Math.imul(b,ut)|0,o=(o=o+Math.imul(b,ft)|0)+Math.imul(y,ut)|0,s=s+Math.imul(y,ft)|0,n=n+Math.imul(m,ct)|0,o=(o=o+Math.imul(m,dt)|0)+Math.imul(g,ct)|0,s=s+Math.imul(g,dt)|0;var Rt=(f+(n=n+Math.imul(c,mt)|0)|0)+((8191&(o=(o=o+Math.imul(c,gt)|0)+Math.imul(d,mt)|0))<<13)|0;f=((s=s+Math.imul(d,gt)|0)+(o>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(q,K),o=(o=Math.imul(q,Z))+Math.imul(D,K)|0,s=Math.imul(D,Z),n=n+Math.imul(j,J)|0,o=(o=o+Math.imul(j,Y)|0)+Math.imul(U,J)|0,s=s+Math.imul(U,Y)|0,n=n+Math.imul(B,G)|0,o=(o=o+Math.imul(B,Q)|0)+Math.imul(C,G)|0,s=s+Math.imul(C,Q)|0,n=n+Math.imul(I,tt)|0,o=(o=o+Math.imul(I,et)|0)+Math.imul(P,tt)|0,s=s+Math.imul(P,et)|0,n=n+Math.imul(A,rt)|0,o=(o=o+Math.imul(A,nt)|0)+Math.imul(T,rt)|0,s=s+Math.imul(T,nt)|0,n=n+Math.imul(k,st)|0,o=(o=o+Math.imul(k,at)|0)+Math.imul(E,st)|0,s=s+Math.imul(E,at)|0,n=n+Math.imul(_,ut)|0,o=(o=o+Math.imul(_,ft)|0)+Math.imul(M,ut)|0,s=s+Math.imul(M,ft)|0,n=n+Math.imul(b,ct)|0,o=(o=o+Math.imul(b,dt)|0)+Math.imul(y,ct)|0,s=s+Math.imul(y,dt)|0;var At=(f+(n=n+Math.imul(m,mt)|0)|0)+((8191&(o=(o=o+Math.imul(m,gt)|0)+Math.imul(g,mt)|0))<<13)|0;f=((s=s+Math.imul(g,gt)|0)+(o>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(q,J),o=(o=Math.imul(q,Y))+Math.imul(D,J)|0,s=Math.imul(D,Y),n=n+Math.imul(j,G)|0,o=(o=o+Math.imul(j,Q)|0)+Math.imul(U,G)|0,s=s+Math.imul(U,Q)|0,n=n+Math.imul(B,tt)|0,o=(o=o+Math.imul(B,et)|0)+Math.imul(C,tt)|0,s=s+Math.imul(C,et)|0,n=n+Math.imul(I,rt)|0,o=(o=o+Math.imul(I,nt)|0)+Math.imul(P,rt)|0,s=s+Math.imul(P,nt)|0,n=n+Math.imul(A,st)|0,o=(o=o+Math.imul(A,at)|0)+Math.imul(T,st)|0,s=s+Math.imul(T,at)|0,n=n+Math.imul(k,ut)|0,o=(o=o+Math.imul(k,ft)|0)+Math.imul(E,ut)|0,s=s+Math.imul(E,ft)|0,n=n+Math.imul(_,ct)|0,o=(o=o+Math.imul(_,dt)|0)+Math.imul(M,ct)|0,s=s+Math.imul(M,dt)|0;var Tt=(f+(n=n+Math.imul(b,mt)|0)|0)+((8191&(o=(o=o+Math.imul(b,gt)|0)+Math.imul(y,mt)|0))<<13)|0;f=((s=s+Math.imul(y,gt)|0)+(o>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(q,G),o=(o=Math.imul(q,Q))+Math.imul(D,G)|0,s=Math.imul(D,Q),n=n+Math.imul(j,tt)|0,o=(o=o+Math.imul(j,et)|0)+Math.imul(U,tt)|0,s=s+Math.imul(U,et)|0,n=n+Math.imul(B,rt)|0,o=(o=o+Math.imul(B,nt)|0)+Math.imul(C,rt)|0,s=s+Math.imul(C,nt)|0,n=n+Math.imul(I,st)|0,o=(o=o+Math.imul(I,at)|0)+Math.imul(P,st)|0,s=s+Math.imul(P,at)|0,n=n+Math.imul(A,ut)|0,o=(o=o+Math.imul(A,ft)|0)+Math.imul(T,ut)|0,s=s+Math.imul(T,ft)|0,n=n+Math.imul(k,ct)|0,o=(o=o+Math.imul(k,dt)|0)+Math.imul(E,ct)|0,s=s+Math.imul(E,dt)|0;var xt=(f+(n=n+Math.imul(_,mt)|0)|0)+((8191&(o=(o=o+Math.imul(_,gt)|0)+Math.imul(M,mt)|0))<<13)|0;f=((s=s+Math.imul(M,gt)|0)+(o>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(q,tt),o=(o=Math.imul(q,et))+Math.imul(D,tt)|0,s=Math.imul(D,et),n=n+Math.imul(j,rt)|0,o=(o=o+Math.imul(j,nt)|0)+Math.imul(U,rt)|0,s=s+Math.imul(U,nt)|0,n=n+Math.imul(B,st)|0,o=(o=o+Math.imul(B,at)|0)+Math.imul(C,st)|0,s=s+Math.imul(C,at)|0,n=n+Math.imul(I,ut)|0,o=(o=o+Math.imul(I,ft)|0)+Math.imul(P,ut)|0,s=s+Math.imul(P,ft)|0,n=n+Math.imul(A,ct)|0,o=(o=o+Math.imul(A,dt)|0)+Math.imul(T,ct)|0,s=s+Math.imul(T,dt)|0;var It=(f+(n=n+Math.imul(k,mt)|0)|0)+((8191&(o=(o=o+Math.imul(k,gt)|0)+Math.imul(E,mt)|0))<<13)|0;f=((s=s+Math.imul(E,gt)|0)+(o>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(q,rt),o=(o=Math.imul(q,nt))+Math.imul(D,rt)|0,s=Math.imul(D,nt),n=n+Math.imul(j,st)|0,o=(o=o+Math.imul(j,at)|0)+Math.imul(U,st)|0,s=s+Math.imul(U,at)|0,n=n+Math.imul(B,ut)|0,o=(o=o+Math.imul(B,ft)|0)+Math.imul(C,ut)|0,s=s+Math.imul(C,ft)|0,n=n+Math.imul(I,ct)|0,o=(o=o+Math.imul(I,dt)|0)+Math.imul(P,ct)|0,s=s+Math.imul(P,dt)|0;var Pt=(f+(n=n+Math.imul(A,mt)|0)|0)+((8191&(o=(o=o+Math.imul(A,gt)|0)+Math.imul(T,mt)|0))<<13)|0;f=((s=s+Math.imul(T,gt)|0)+(o>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(q,st),o=(o=Math.imul(q,at))+Math.imul(D,st)|0,s=Math.imul(D,at),n=n+Math.imul(j,ut)|0,o=(o=o+Math.imul(j,ft)|0)+Math.imul(U,ut)|0,s=s+Math.imul(U,ft)|0,n=n+Math.imul(B,ct)|0,o=(o=o+Math.imul(B,dt)|0)+Math.imul(C,ct)|0,s=s+Math.imul(C,dt)|0;var Lt=(f+(n=n+Math.imul(I,mt)|0)|0)+((8191&(o=(o=o+Math.imul(I,gt)|0)+Math.imul(P,mt)|0))<<13)|0;f=((s=s+Math.imul(P,gt)|0)+(o>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,n=Math.imul(q,ut),o=(o=Math.imul(q,ft))+Math.imul(D,ut)|0,s=Math.imul(D,ft),n=n+Math.imul(j,ct)|0,o=(o=o+Math.imul(j,dt)|0)+Math.imul(U,ct)|0,s=s+Math.imul(U,dt)|0;var Bt=(f+(n=n+Math.imul(B,mt)|0)|0)+((8191&(o=(o=o+Math.imul(B,gt)|0)+Math.imul(C,mt)|0))<<13)|0;f=((s=s+Math.imul(C,gt)|0)+(o>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,n=Math.imul(q,ct),o=(o=Math.imul(q,dt))+Math.imul(D,ct)|0,s=Math.imul(D,dt);var Ct=(f+(n=n+Math.imul(j,mt)|0)|0)+((8191&(o=(o=o+Math.imul(j,gt)|0)+Math.imul(U,mt)|0))<<13)|0;f=((s=s+Math.imul(U,gt)|0)+(o>>>13)|0)+(Ct>>>26)|0,Ct&=67108863;var Ot=(f+(n=Math.imul(q,mt))|0)+((8191&(o=(o=Math.imul(q,gt))+Math.imul(D,mt)|0))<<13)|0;return f=((s=Math.imul(D,gt))+(o>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=vt,u[1]=bt,u[2]=yt,u[3]=wt,u[4]=_t,u[5]=Mt,u[6]=St,u[7]=kt,u[8]=Et,u[9]=Rt,u[10]=At,u[11]=Tt,u[12]=xt,u[13]=It,u[14]=Pt,u[15]=Lt,u[16]=Bt,u[17]=Ct,u[18]=Ot,0!==f&&(u[19]=f,r.length++),r};function p(t,e,i){return(new m).mulp(t,e,i)}function m(t,e){this.x=t,this.y=e}Math.imul||(d=c),o.prototype.mulTo=function t(e,i){var r=this.length+e.length;return 10===this.length&&10===e.length?d(this,e,i):r<63?c(this,e,i):r<1024?function n(t,e,i){i.negative=e.negative^t.negative,i.length=t.length+e.length;for(var r=0,n=0,o=0;o<i.length-1;o++){var s=n;n=0;for(var a=67108863&r,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var f=o-u,l=(0|t.words[f])*(0|e.words[u]),c=67108863&l;a=67108863&(c=c+a|0),n+=(s=(s=s+(l/67108864|0)|0)+(c>>>26)|0)>>>26,s&=67108863}i.words[o]=a,r=s,s=n}return 0!==r?i.words[o]=r:i.length--,i.strip()}(this,e,i):p(this,e,i)},m.prototype.makeRBT=function t(e){for(var i=new Array(e),r=o.prototype._countBits(e)-1,n=0;n<e;n++)i[n]=this.revBin(n,r,e);return i},m.prototype.revBin=function t(e,i,r){if(0===e||e===r-1)return e;for(var n=0,o=0;o<i;o++)n|=(1&e)<<i-o-1,e>>=1;return n},m.prototype.permute=function t(e,i,r,n,o,s){for(var a=0;a<s;a++)n[a]=i[e[a]],o[a]=r[e[a]]},m.prototype.transform=function t(e,i,r,n,o,s){this.permute(s,e,i,r,n,o);for(var a=1;a<o;a<<=1)for(var h=a<<1,u=Math.cos(2*Math.PI/h),f=Math.sin(2*Math.PI/h),l=0;l<o;l+=h)for(var c=u,d=f,p=0;p<a;p++){var m=r[l+p],g=n[l+p],v=r[l+p+a],b=n[l+p+a],y=c*v-d*b;b=c*b+d*v,v=y,r[l+p]=m+v,n[l+p]=g+b,r[l+p+a]=m-v,n[l+p+a]=g-b,p!==h&&(y=u*c-f*d,d=u*d+f*c,c=y)}},m.prototype.guessLen13b=function t(e,i){var r=1|Math.max(i,e),n=1&r,o=0;for(r=r/2|0;r;r>>>=1)o++;return 1<<o+1+n},m.prototype.conjugate=function t(e,i,r){if(!(r<=1))for(var n=0;n<r/2;n++){var o=e[n];e[n]=e[r-n-1],e[r-n-1]=o,o=i[n],i[n]=-i[r-n-1],i[r-n-1]=-o}},m.prototype.normalize13b=function t(e,i){for(var r=0,n=0;n<i/2;n++){var o=8192*Math.round(e[2*n+1]/i)+Math.round(e[2*n]/i)+r;e[n]=67108863&o,r=o<67108864?0:o/67108864|0}return e},m.prototype.convert13b=function t(e,i,n,o){for(var s=0,a=0;a<i;a++)s+=0|e[a],n[2*a]=8191&s,s>>>=13,n[2*a+1]=8191&s,s>>>=13;for(a=2*i;a<o;++a)n[a]=0;r(0===s),r(0==(-8192&s))},m.prototype.stub=function t(e){for(var i=new Array(e),r=0;r<e;r++)i[r]=0;return i},m.prototype.mulp=function t(e,i,r){var n=2*this.guessLen13b(e.length,i.length),o=this.makeRBT(n),s=this.stub(n),a=new Array(n),h=new Array(n),u=new Array(n),f=new Array(n),l=new Array(n),c=new Array(n),d=r.words;d.length=n,this.convert13b(e.words,e.length,a,n),this.convert13b(i.words,i.length,f,n),this.transform(a,s,h,u,n,o),this.transform(f,s,l,c,n,o);for(var p=0;p<n;p++){var m=h[p]*l[p]-u[p]*c[p];u[p]=h[p]*c[p]+u[p]*l[p],h[p]=m}return this.conjugate(h,u,n),this.transform(h,u,d,s,n,o),this.conjugate(d,s,n),this.normalize13b(d,n),r.negative=e.negative^i.negative,r.length=e.length+i.length,r.strip()},o.prototype.mul=function t(e){var i=new o(null);return i.words=new Array(this.length+e.length),this.mulTo(e,i)},o.prototype.mulf=function t(e){var i=new o(null);return i.words=new Array(this.length+e.length),p(this,e,i)},o.prototype.imul=function t(e){return this.clone().mulTo(e,this)},o.prototype.imuln=function t(e){r("number"==typeof e),r(e<67108864);for(var i=0,n=0;n<this.length;n++){var o=(0|this.words[n])*e,s=(67108863&o)+(67108863&i);i>>=26,i+=o/67108864|0,i+=s>>>26,this.words[n]=67108863&s}return 0!==i&&(this.words[n]=i,this.length++),this},o.prototype.muln=function t(e){return this.clone().imuln(e)},o.prototype.sqr=function t(){return this.mul(this)},o.prototype.isqr=function t(){return this.imul(this.clone())},o.prototype.pow=function t(e){var i=function r(t){for(var e=new Array(t.bitLength()),i=0;i<e.length;i++){var r=i/26|0,n=i%26;e[i]=(t.words[r]&1<<n)>>>n}return e}(e);if(0===i.length)return new o(1);for(var n=this,s=0;s<i.length&&0===i[s];s++,n=n.sqr());if(++s<i.length)for(var a=n.sqr();s<i.length;s++,a=a.sqr())0!==i[s]&&(n=n.mul(a));return n},o.prototype.iushln=function t(e){r("number"==typeof e&&e>=0);var i,n=e%26,o=(e-n)/26,s=67108863>>>26-n<<26-n;if(0!==n){var a=0;for(i=0;i<this.length;i++){var h=this.words[i]&s,u=(0|this.words[i])-h<<n;this.words[i]=u|a,a=h>>>26-n}a&&(this.words[i]=a,this.length++)}if(0!==o){for(i=this.length-1;i>=0;i--)this.words[i+o]=this.words[i];for(i=0;i<o;i++)this.words[i]=0;this.length+=o}return this.strip()},o.prototype.ishln=function t(e){return r(0===this.negative),this.iushln(e)},o.prototype.iushrn=function t(e,i,n){var o;r("number"==typeof e&&e>=0),o=i?(i-i%26)/26:0;var s=e%26,a=Math.min((e-s)/26,this.length),h=67108863^67108863>>>s<<s,u=n;if(o-=a,o=Math.max(0,o),u){for(var f=0;f<a;f++)u.words[f]=this.words[f];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,f=0;f<this.length;f++)this.words[f]=this.words[f+a];else this.words[0]=0,this.length=1;var l=0;for(f=this.length-1;f>=0&&(0!==l||f>=o);f--){var c=0|this.words[f];this.words[f]=l<<26-s|c>>>s,l=c&h}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function t(e,i,n){return r(0===this.negative),this.iushrn(e,i,n)},o.prototype.shln=function t(e){return this.clone().ishln(e)},o.prototype.ushln=function t(e){return this.clone().iushln(e)},o.prototype.shrn=function t(e){return this.clone().ishrn(e)},o.prototype.ushrn=function t(e){return this.clone().iushrn(e)},o.prototype.testn=function t(e){r("number"==typeof e&&e>=0);var i=e%26,n=(e-i)/26,o=1<<i;return!(this.length<=n)&&!!(this.words[n]&o)},o.prototype.imaskn=function t(e){r("number"==typeof e&&e>=0);var i=e%26,n=(e-i)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==i&&n++,this.length=Math.min(n,this.length),0!==i){var o=67108863^67108863>>>i<<i;this.words[this.length-1]&=o}return this.strip()},o.prototype.maskn=function t(e){return this.clone().imaskn(e)},o.prototype.iaddn=function t(e){return r("number"==typeof e),r(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},o.prototype._iaddn=function t(e){this.words[0]+=e;for(var i=0;i<this.length&&this.words[i]>=67108864;i++)this.words[i]-=67108864,i===this.length-1?this.words[i+1]=1:this.words[i+1]++;return this.length=Math.max(this.length,i+1),this},o.prototype.isubn=function t(e){if(r("number"==typeof e),r(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 i=0;i<this.length&&this.words[i]<0;i++)this.words[i]+=67108864,this.words[i+1]-=1;return this.strip()},o.prototype.addn=function t(e){return this.clone().iaddn(e)},o.prototype.subn=function t(e){return this.clone().isubn(e)},o.prototype.iabs=function t(){return this.negative=0,this},o.prototype.abs=function t(){return this.clone().iabs()},o.prototype._ishlnsubmul=function t(e,i,n){var o,s,a=e.length+n;this._expand(a);var h=0;for(o=0;o<e.length;o++){s=(0|this.words[o+n])+h;var u=(0|e.words[o])*i;h=((s-=67108863&u)>>26)-(u/67108864|0),this.words[o+n]=67108863&s}for(;o<this.length-n;o++)h=(s=(0|this.words[o+n])+h)>>26,this.words[o+n]=67108863&s;if(0===h)return this.strip();for(r(-1===h),h=0,o=0;o<this.length;o++)h=(s=-(0|this.words[o])+h)>>26,this.words[o]=67108863&s;return this.negative=1,this.strip()},o.prototype._wordDiv=function t(e,i){var r=(this.length,e.length),n=this.clone(),s=e,a=0|s.words[s.length-1];0!==(r=26-this._countBits(a))&&(s=s.ushln(r),n.iushln(r),a=0|s.words[s.length-1]);var h,u=n.length-s.length;if("mod"!==i){(h=new o(null)).length=u+1,h.words=new Array(h.length);for(var f=0;f<h.length;f++)h.words[f]=0}var l=n.clone()._ishlnsubmul(s,1,u);0===l.negative&&(n=l,h&&(h.words[u]=1));for(var c=u-1;c>=0;c--){var d=67108864*(0|n.words[s.length+c])+(0|n.words[s.length+c-1]);for(d=Math.min(d/a|0,67108863),n._ishlnsubmul(s,d,c);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(s,1,c),n.isZero()||(n.negative^=1);h&&(h.words[c]=d)}return h&&h.strip(),n.strip(),"div"!==i&&0!==r&&n.iushrn(r),{div:h||null,mod:n}},o.prototype.divmod=function t(e,i,n){return r(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(h=this.neg().divmod(e,i),"mod"!==i&&(s=h.div.neg()),"div"!==i&&(a=h.mod.neg(),n&&0!==a.negative&&a.iadd(e)),{div:s,mod:a}):0===this.negative&&0!==e.negative?(h=this.divmod(e.neg(),i),"mod"!==i&&(s=h.div.neg()),{div:s,mod:h.mod}):0!=(this.negative&e.negative)?(h=this.neg().divmod(e.neg(),i),"div"!==i&&(a=h.mod.neg(),n&&0!==a.negative&&a.isub(e)),{div:h.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===i?{div:this.divn(e.words[0]),mod:null}:"mod"===i?{div:null,mod:new o(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modn(e.words[0]))}:this._wordDiv(e,i);var s,a,h},o.prototype.div=function t(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function t(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function t(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function t(e){var i=this.divmod(e);if(i.mod.isZero())return i.div;var r=0!==i.div.negative?i.mod.isub(e):i.mod,n=e.ushrn(1),o=e.andln(1),s=r.cmp(n);return s<0||1===o&&0===s?i.div:0!==i.div.negative?i.div.isubn(1):i.div.iaddn(1)},o.prototype.modn=function t(e){r(e<=67108863);for(var i=(1<<26)%e,n=0,o=this.length-1;o>=0;o--)n=(i*n+(0|this.words[o]))%e;return n},o.prototype.idivn=function t(e){r(e<=67108863);for(var i=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*i;this.words[n]=o/e|0,i=o%e}return this.strip()},o.prototype.divn=function t(e){return this.clone().idivn(e)},o.prototype.egcd=function t(e){r(0===e.negative),r(!e.isZero());var i=this,n=e.clone();i=0!==i.negative?i.umod(e):i.clone();for(var s=new o(1),a=new o(0),h=new o(0),u=new o(1),f=0;i.isEven()&&n.isEven();)i.iushrn(1),n.iushrn(1),++f;for(var l=n.clone(),c=i.clone();!i.isZero();){for(var d=0,p=1;0==(i.words[0]&p)&&d<26;++d,p<<=1);if(d>0)for(i.iushrn(d);d-- >0;)(s.isOdd()||a.isOdd())&&(s.iadd(l),a.isub(c)),s.iushrn(1),a.iushrn(1);for(var m=0,g=1;0==(n.words[0]&g)&&m<26;++m,g<<=1);if(m>0)for(n.iushrn(m);m-- >0;)(h.isOdd()||u.isOdd())&&(h.iadd(l),u.isub(c)),h.iushrn(1),u.iushrn(1);i.cmp(n)>=0?(i.isub(n),s.isub(h),a.isub(u)):(n.isub(i),h.isub(s),u.isub(a))}return{a:h,b:u,gcd:n.iushln(f)}},o.prototype._invmp=function t(e){r(0===e.negative),r(!e.isZero());var i=this,n=e.clone();i=0!==i.negative?i.umod(e):i.clone();for(var s,a=new o(1),h=new o(0),u=n.clone();i.cmpn(1)>0&&n.cmpn(1)>0;){for(var f=0,l=1;0==(i.words[0]&l)&&f<26;++f,l<<=1);if(f>0)for(i.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var c=0,d=1;0==(n.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(n.iushrn(c);c-- >0;)h.isOdd()&&h.iadd(u),h.iushrn(1);i.cmp(n)>=0?(i.isub(n),a.isub(h)):(n.isub(i),h.isub(a))}return(s=0===i.cmpn(1)?a:h).cmpn(0)<0&&s.iadd(e),s},o.prototype.gcd=function t(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var i=this.clone(),r=e.clone();i.negative=0,r.negative=0;for(var n=0;i.isEven()&&r.isEven();n++)i.iushrn(1),r.iushrn(1);for(;;){for(;i.isEven();)i.iushrn(1);for(;r.isEven();)r.iushrn(1);var o=i.cmp(r);if(o<0){var s=i;i=r,r=s}else if(0===o||0===r.cmpn(1))break;i.isub(r)}return r.iushln(n)},o.prototype.invm=function t(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function t(){return 0==(1&this.words[0])},o.prototype.isOdd=function t(){return 1==(1&this.words[0])},o.prototype.andln=function t(e){return this.words[0]&e},o.prototype.bincn=function t(e){r("number"==typeof e);var i=e%26,n=(e-i)/26,o=1<<i;if(this.length<=n)return this._expand(n+1),this.words[n]|=o,this;for(var s=o,a=n;0!==s&&a<this.length;a++){var h=0|this.words[a];s=(h+=s)>>>26,h&=67108863,this.words[a]=h}return 0!==s&&(this.words[a]=s,this.length++),this},o.prototype.isZero=function t(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function t(e){var i,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)i=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var o=0|this.words[0];i=o===e?0:o<e?-1:1}return 0!==this.negative?0|-i:i},o.prototype.cmp=function t(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var i=this.ucmp(e);return 0!==this.negative?0|-i:i},o.prototype.ucmp=function t(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var i=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],o=0|e.words[r];if(n!==o){n<o?i=-1:n>o&&(i=1);break}}return i},o.prototype.gtn=function t(e){return 1===this.cmpn(e)},o.prototype.gt=function t(e){return 1===this.cmp(e)},o.prototype.gten=function t(e){return this.cmpn(e)>=0},o.prototype.gte=function t(e){return this.cmp(e)>=0},o.prototype.ltn=function t(e){return-1===this.cmpn(e)},o.prototype.lt=function t(e){return-1===this.cmp(e)},o.prototype.lten=function t(e){return this.cmpn(e)<=0},o.prototype.lte=function t(e){return this.cmp(e)<=0},o.prototype.eqn=function t(e){return 0===this.cmpn(e)},o.prototype.eq=function t(e){return 0===this.cmp(e)},o.red=function t(e){return new M(e)},o.prototype.toRed=function t(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function t(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function t(e){return this.red=e,this},o.prototype.forceRed=function t(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function t(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function t(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function t(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function t(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function t(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function t(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function t(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function t(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function t(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function t(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function t(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function t(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function t(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var g={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function y(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function S(t){M.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(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)}v.prototype._tmp=function t(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},v.prototype.ireduce=function t(e){var i,r=e;do{this.split(r,this.tmp),i=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(i>this.n);var n=i<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function t(e,i){e.iushrn(this.n,0,i)},v.prototype.imulK=function t(e){return e.imul(this.k)},n(b,v),b.prototype.split=function t(e,i){for(var r=4194303,n=Math.min(e.length,9),o=0;o<n;o++)i.words[o]=e.words[o];if(i.length=n,e.length<=9)return e.words[0]=0,void(e.length=1);var s=e.words[9];for(i.words[i.length++]=s&r,o=10;o<e.length;o++){var a=0|e.words[o];e.words[o-10]=(a&r)<<4|s>>>22,s=a}s>>>=22,e.words[o-10]=s,0===s&&e.length>10?e.length-=10:e.length-=9},b.prototype.imulK=function t(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var i=0,r=0;r<e.length;r++){var n=0|e.words[r];i+=977*n,e.words[r]=67108863&i,i=64*n+(i/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},n(y,v),n(w,v),n(_,v),_.prototype.imulK=function t(e){for(var i=0,r=0;r<e.length;r++){var n=19*(0|e.words[r])+i,o=67108863&n;n>>>=26,e.words[r]=o,i=n}return 0!==i&&(e.words[e.length++]=i),e},o._prime=function t(e){if(g[e])return g[e];var t;if("k256"===e)t=new b;else if("p224"===e)t=new y;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new _}return g[e]=t,t},M.prototype._verify1=function t(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},M.prototype._verify2=function t(e,i){r(0==(e.negative|i.negative),"red works only with positives"),r(e.red&&e.red===i.red,"red works only with red numbers")},M.prototype.imod=function t(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},M.prototype.neg=function t(e){re