tressa
Version:
A little test utility
3 lines • 310 kB
JavaScript
!function e(t,r,i){function n(f,o){if(!r[f]){if(!t[f]){var s="function"==typeof require&&require;if(!o&&s)return s(f,!0);if(a)return a(f,!0);var c=new Error("Cannot find module '"+f+"'");throw c.code="MODULE_NOT_FOUND",c}var h=r[f]={exports:{}};t[f][0].call(h.exports,function(e){var r=t[f][1][e];return n(r?r:e)},h,h.exports,e,t,r,i)}return r[f].exports}for(var a="function"==typeof require&&require,f=0;f<i.length;f++)n(i[f]);return n}({1:[function(e,t,r){(function(r){/*! (C) 2017 Andrea Giammarchi & Claudio D'angelis */
function i(e,t){try{console.assert.apply(console,arguments),e||(i.exitCode=1),"string"==typeof t&&e&&i.console.log("#green(✔) "+t)}catch(e){i.exitCode=1,i.console.error("#red(✖) "+e)}}i.title=function(e){i.testName=e,i.console.info("# "+e),console.time(e)},i.async=function(e,t){var r=Object,n=Object,a=setTimeout(function(){var t="*timeout* "+(e.name||e);n(t),i(!1,t)},t||i.timeout);return setTimeout(function(){e(function(){r.apply(null,arguments),clearTimeout(a)})}),"undefined"!=typeof Promise?new Promise(function(e,t){r=e,n=t}):null},i.timeout=1e4,i.assert=i.sync=i;try{i.console=e("consolemd")}catch(e){i.console="undefined"==typeof consolemd?console:consolemd}i.log=i.console.log,i.end=function(){var e=i.testName;e&&(console.log(Array(e.length+10).join("─")),console.timeEnd(e),console.log(""),i.testName="")};try{r.browser||r.on("exit",function(){i.end(),r.exit(i.exitCode||0)}),t.exports=i}catch(e){}}).call(this,e("_process"))},{_process:106,consolemd:48}],2:[function(e,t,r){var i=r;i.bignum=e("bn.js"),i.define=e("./asn1/api").define,i.base=e("./asn1/base"),i.constants=e("./asn1/constants"),i.decoders=e("./asn1/decoders"),i.encoders=e("./asn1/encoders")},{"./asn1/api":3,"./asn1/base":5,"./asn1/constants":9,"./asn1/decoders":11,"./asn1/encoders":14,"bn.js":17}],3:[function(e,t,r){function i(e,t){this.name=e,this.body=t,this.decoders={},this.encoders={}}var n=e("../asn1"),a=e("inherits"),f=r;f.define=function(e,t){return new i(e,t)},i.prototype._createNamed=function(t){var r;try{r=e("vm").runInThisContext("(function "+this.name+"(entity) {\n this._initNamed(entity);\n})")}catch(e){r=function(e){this._initNamed(e)}}return a(r,t),r.prototype._initNamed=function(e){t.call(this,e)},new r(this)},i.prototype._getDecoder=function(e){return e=e||"der",this.decoders.hasOwnProperty(e)||(this.decoders[e]=this._createNamed(n.decoders[e])),this.decoders[e]},i.prototype.decode=function(e,t,r){return this._getDecoder(t).decode(e,r)},i.prototype._getEncoder=function(e){return e=e||"der",this.encoders.hasOwnProperty(e)||(this.encoders[e]=this._createNamed(n.encoders[e])),this.encoders[e]},i.prototype.encode=function(e,t,r){return this._getEncoder(t).encode(e,r)}},{"../asn1":2,inherits:94,vm:137}],4:[function(e,t,r){function i(e,t){return f.call(this,t),o.isBuffer(e)?(this.base=e,this.offset=0,void(this.length=e.length)):void this.error("Input not Buffer")}function n(e,t){if(Array.isArray(e))this.length=0,this.value=e.map(function(e){return e instanceof n||(e=new n(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=o.byteLength(e);else{if(!o.isBuffer(e))return t.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}var a=e("inherits"),f=e("../base").Reporter,o=e("buffer").Buffer;a(i,f),r.DecoderBuffer=i,i.prototype.save=function(){return{offset:this.offset,reporter:f.prototype.save.call(this)}},i.prototype.restore=function(e){var t=new i(this.base);return t.offset=e.offset,t.length=this.offset,this.offset=e.offset,f.prototype.restore.call(this,e.reporter),t},i.prototype.isEmpty=function(){return this.offset===this.length},i.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")},i.prototype.skip=function(e,t){if(!(this.offset+e<=this.length))return this.error(t||"DecoderBuffer overrun");var r=new i(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+e,this.offset+=e,r},i.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)},r.EncoderBuffer=n,n.prototype.join=function(e,t){return e||(e=new o(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):o.isBuffer(this.value)&&this.value.copy(e,t),t+=this.length),e)}},{"../base":5,buffer:46,inherits:94}],5:[function(e,t,r){var i=r;i.Reporter=e("./reporter").Reporter,i.DecoderBuffer=e("./buffer").DecoderBuffer,i.EncoderBuffer=e("./buffer").EncoderBuffer,i.Node=e("./node")},{"./buffer":4,"./node":6,"./reporter":7}],6:[function(e,t,r){function i(e,t){var r={};this._baseState=r,r.enc=e,r.parent=t||null,r.children=null,r.tag=null,r.args=null,r.reverseArgs=null,r.choice=null,r.optional=!1,r.any=!1,r.obj=!1,r.use=null,r.useDecoder=null,r.key=null,r.default=null,r.explicit=null,r.implicit=null,r.contains=null,r.parent||(r.children=[],this._wrap())}var n=e("../base").Reporter,a=e("../base").EncoderBuffer,f=e("../base").DecoderBuffer,o=e("minimalistic-assert"),s=["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"],c=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(s),h=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];t.exports=i;var d=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];i.prototype.clone=function(){var e=this._baseState,t={};d.forEach(function(r){t[r]=e[r]});var r=new this.constructor(t.parent);return r._baseState=t,r},i.prototype._wrap=function(){var e=this._baseState;c.forEach(function(t){this[t]=function(){var r=new this.constructor(this);return e.children.push(r),r[t].apply(r,arguments)}},this)},i.prototype._init=function(e){var 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")},i.prototype._useArgs=function(e){var 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;var t={};return Object.keys(e).forEach(function(r){r==(0|r)&&(r|=0);var i=e[r];t[i]=r}),t}))},h.forEach(function(e){i.prototype[e]=function(){var t=this._baseState;throw new Error(e+" not implemented for encoding: "+t.enc)}}),s.forEach(function(e){i.prototype[e]=function(){var t=this._baseState,r=Array.prototype.slice.call(arguments);return o(null===t.tag),t.tag=e,this._useArgs(r),this}}),i.prototype.use=function(e){o(e);var t=this._baseState;return o(null===t.use),t.use=e,this},i.prototype.optional=function(){var e=this._baseState;return e.optional=!0,this},i.prototype.def=function(e){var t=this._baseState;return o(null===t.default),t.default=e,t.optional=!0,this},i.prototype.explicit=function(e){var t=this._baseState;return o(null===t.explicit&&null===t.implicit),t.explicit=e,this},i.prototype.implicit=function(e){var t=this._baseState;return o(null===t.explicit&&null===t.implicit),t.implicit=e,this},i.prototype.obj=function(){var e=this._baseState,t=Array.prototype.slice.call(arguments);return e.obj=!0,0!==t.length&&this._useArgs(t),this},i.prototype.key=function(e){var t=this._baseState;return o(null===t.key),t.key=e,this},i.prototype.any=function(){var e=this._baseState;return e.any=!0,this},i.prototype.choice=function(e){var t=this._baseState;return o(null===t.choice),t.choice=e,this._useArgs(Object.keys(e).map(function(t){return e[t]})),this},i.prototype.contains=function(e){var t=this._baseState;return o(null===t.use),t.contains=e,this},i.prototype._decode=function(e,t){var r=this._baseState;if(null===r.parent)return e.wrapResult(r.children[0]._decode(e,t));var i=r.default,n=!0,a=null;if(null!==r.key&&(a=e.enterKey(r.key)),r.optional){var o=null;if(null!==r.explicit?o=r.explicit:null!==r.implicit?o=r.implicit:null!==r.tag&&(o=r.tag),null!==o||r.any){if(n=this._peekTag(e,o,r.any),e.isError(n))return n}else{var s=e.save();try{null===r.choice?this._decodeGeneric(r.tag,e,t):this._decodeChoice(e,t),n=!0}catch(e){n=!1}e.restore(s)}}var c;if(r.obj&&n&&(c=e.enterObject()),n){if(null!==r.explicit){var h=this._decodeTag(e,r.explicit);if(e.isError(h))return h;e=h}var d=e.offset;if(null===r.use&&null===r.choice){if(r.any)var s=e.save();var u=this._decodeTag(e,null!==r.implicit?r.implicit:r.tag,r.any);if(e.isError(u))return u;r.any?i=e.raw(s):e=u}if(t&&t.track&&null!==r.tag&&t.track(e.path(),d,e.length,"tagged"),t&&t.track&&null!==r.tag&&t.track(e.path(),e.offset,e.length,"content"),i=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)){var l=new f(i);i=this._getUse(r.contains,e._reporterState.obj)._decode(l,t)}}return r.obj&&n&&(i=e.leaveObject(c)),null===r.key||null===i&&n!==!0?null!==a&&e.exitKey(a):e.leaveKey(a,r.key,i),i},i.prototype._decodeGeneric=function(e,t,r){var i=this._baseState;return"seq"===e||"set"===e?null:"seqof"===e||"setof"===e?this._decodeList(t,e,i.args[0],r):/str$/.test(e)?this._decodeStr(t,e,r):"objid"===e&&i.args?this._decodeObjid(t,i.args[0],i.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,i.args&&i.args[0],r):null!==i.use?this._getUse(i.use,t._reporterState.obj)._decode(t,r):t.error("unknown tag: "+e)},i.prototype._getUse=function(e,t){var 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},i.prototype._decodeChoice=function(e,t){var r=this._baseState,i=null,n=!1;return Object.keys(r.choice).some(function(a){var f=e.save(),o=r.choice[a];try{var s=o._decode(e,t);if(e.isError(s))return!1;i={type:a,value:s},n=!0}catch(t){return e.restore(f),!1}return!0},this),n?i:e.error("Choice not matched")},i.prototype._createEncoderBuffer=function(e){return new a(e,this.reporter)},i.prototype._encode=function(e,t,r){var i=this._baseState;if(null===i.default||i.default!==e){var n=this._encodeValue(e,t,r);if(void 0!==n&&!this._skipDefault(n,t,r))return n}},i.prototype._encodeValue=function(e,t,r){var i=this._baseState;if(null===i.parent)return i.children[0]._encode(e,t||new n);var a=null;if(this.reporter=t,i.optional&&void 0===e){if(null===i.default)return;e=i.default}var f=null,o=!1;if(i.any)a=this._createEncoderBuffer(e);else if(i.choice)a=this._encodeChoice(e,t);else if(i.contains)f=this._getUse(i.contains,r)._encode(e,t),o=!0;else if(i.children)f=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");var i=t.enterKey(r._baseState.key);if("object"!=typeof e)return t.error("Child expected, but input is not object");var n=r._encode(e[r._baseState.key],t,e);return t.leaveKey(i),n},this).filter(function(e){return e}),f=this._createEncoderBuffer(f);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");var s=this.clone();s._baseState.implicit=null,f=this._createEncoderBuffer(e.map(function(r){var i=this._baseState;return this._getUse(i.args[0],e)._encode(r,t)},s))}else null!==i.use?a=this._getUse(i.use,r)._encode(e,t):(f=this._encodePrimitive(i.tag,e),o=!0);var a;if(!i.any&&null===i.choice){var c=null!==i.implicit?i.implicit:i.tag,h=null===i.implicit?"universal":"context";null===c?null===i.use&&t.error("Tag could be ommited only for .use()"):null===i.use&&(a=this._encodeComposite(c,o,h,f))}return null!==i.explicit&&(a=this._encodeComposite(i.explicit,!1,"context",a)),a},i.prototype._encodeChoice=function(e,t){var r=this._baseState,i=r.choice[e.type];return i||o(!1,e.type+" not found in "+JSON.stringify(Object.keys(r.choice))),i._encode(e.value,t)},i.prototype._encodePrimitive=function(e,t){var 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)},i.prototype._isNumstr=function(e){return/^[0-9 ]*$/.test(e)},i.prototype._isPrintstr=function(e){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(e)}},{"../base":5,"minimalistic-assert":98}],7:[function(e,t,r){function i(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function n(e,t){this.path=e,this.rethrow(t)}var a=e("inherits");r.Reporter=i,i.prototype.isError=function(e){return e instanceof n},i.prototype.save=function(){var e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}},i.prototype.restore=function(e){var 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){var t=this._reporterState;t.path=t.path.slice(0,e-1)},i.prototype.leaveKey=function(e,t,r){var i=this._reporterState;this.exitKey(e),null!==i.obj&&(i.obj[t]=r)},i.prototype.path=function(){return this._reporterState.path.join("/")},i.prototype.enterObject=function(){var e=this._reporterState,t=e.obj;return e.obj={},t},i.prototype.leaveObject=function(e){var t=this._reporterState,r=t.obj;return t.obj=e,r},i.prototype.error=function(e){var t,r=this._reporterState,i=e instanceof n;if(t=i?e:new n(r.path.map(function(e){return"["+JSON.stringify(e)+"]"}).join(""),e.message||e,e.stack),!r.options.partial)throw t;return i||r.errors.push(t),t},i.prototype.wrapResult=function(e){var t=this._reporterState;return t.options.partial?{result:this.isError(e)?null:e,errors:t.errors}:e},a(n,Error),n.prototype.rethrow=function(e){if(this.message=e+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,n),!this.stack)try{throw new Error(this.message)}catch(e){this.stack=e.stack}return this}},{inherits:94}],8:[function(e,t,r){var i=e("../constants");r.tagClass={0:"universal",1:"application",2:"context",3:"private"},r.tagClassByName=i._reverse(r.tagClass),r.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"},r.tagByName=i._reverse(r.tag)},{"../constants":9}],9:[function(e,t,r){var i=r;i._reverse=function(e){var t={};return Object.keys(e).forEach(function(r){(0|r)==r&&(r|=0);var i=e[r];t[i]=r}),t},i.der=e("./der")},{"./der":8}],10:[function(e,t,r){function i(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new n,this.tree._init(e.body)}function n(e){c.Node.call(this,"der",e)}function a(e,t){var r=e.readUInt8(t);if(e.isError(r))return r;var i=d.tagClass[r>>6],n=0===(32&r);if(31===(31&r)){var a=r;for(r=0;128===(128&a);){if(a=e.readUInt8(t),e.isError(a))return a;r<<=7,r|=127&a}}else r&=31;var f=d.tag[r];return{cls:i,primitive:n,tag:r,tagStr:f}}function f(e,t,r){var i=e.readUInt8(r);if(e.isError(i))return i;if(!t&&128===i)return null;if(0===(128&i))return i;var n=127&i;if(n>4)return e.error("length octect is too long");i=0;for(var a=0;a<n;a++){i<<=8;var f=e.readUInt8(r);if(e.isError(f))return f;i|=f}return i}var o=e("inherits"),s=e("../../asn1"),c=s.base,h=s.bignum,d=s.constants.der;t.exports=i,i.prototype.decode=function(e,t){return e instanceof c.DecoderBuffer||(e=new c.DecoderBuffer(e,t)),this.tree._decode(e,t)},o(n,c.Node),n.prototype._peekTag=function(e,t,r){if(e.isEmpty())return!1;var i=e.save(),n=a(e,'Failed to peek tag: "'+t+'"');return e.isError(n)?n:(e.restore(i),n.tag===t||n.tagStr===t||n.tagStr+"of"===t||r)},n.prototype._decodeTag=function(e,t,r){var i=a(e,'Failed to decode tag of "'+t+'"');if(e.isError(i))return i;var n=f(e,i.primitive,'Failed to get length of "'+t+'"');if(e.isError(n))return n;if(!r&&i.tag!==t&&i.tagStr!==t&&i.tagStr+"of"!==t)return e.error('Failed to match tag: "'+t+'"');if(i.primitive||null!==n)return e.skip(n,'Failed to match body of: "'+t+'"');var o=e.save(),s=this._skipUntilEnd(e,'Failed to skip indefinite length body: "'+this.tag+'"');return e.isError(s)?s:(n=e.offset-o.offset,e.restore(o),e.skip(n,'Failed to match body of: "'+t+'"'))},n.prototype._skipUntilEnd=function(e,t){for(;;){var r=a(e,t);if(e.isError(r))return r;var i=f(e,r.primitive,t);if(e.isError(i))return i;var n;if(n=r.primitive||null!==i?e.skip(i):this._skipUntilEnd(e,t),e.isError(n))return n;if("end"===r.tagStr)break}},n.prototype._decodeList=function(e,t,r,i){for(var n=[];!e.isEmpty();){var a=this._peekTag(e,"end");if(e.isError(a))return a;var f=r.decode(e,"der",i);if(e.isError(f)&&a)break;n.push(f)}return n},n.prototype._decodeStr=function(e,t){if("bitstr"===t){var r=e.readUInt8();return e.isError(r)?r:{unused:r,data:e.raw()}}if("bmpstr"===t){var i=e.raw();if(i.length%2===1)return e.error("Decoding of string type: bmpstr length mismatch");for(var n="",a=0;a<i.length/2;a++)n+=String.fromCharCode(i.readUInt16BE(2*a));return n}if("numstr"===t){var f=e.raw().toString("ascii");return this._isNumstr(f)?f:e.error("Decoding of string type: numstr unsupported characters")}if("octstr"===t)return e.raw();if("objDesc"===t)return e.raw();if("printstr"===t){var o=e.raw().toString("ascii");return this._isPrintstr(o)?o:e.error("Decoding of string type: printstr unsupported characters")}return/str$/.test(t)?e.raw().toString():e.error("Decoding of string type: "+t+" unsupported")},n.prototype._decodeObjid=function(e,t,r){for(var i,n=[],a=0;!e.isEmpty();){var f=e.readUInt8();a<<=7,a|=127&f,0===(128&f)&&(n.push(a),a=0)}128&f&&n.push(a);var o=n[0]/40|0,s=n[0]%40;if(i=r?n:[o,s].concat(n.slice(1)),t){var c=t[i.join(" ")];void 0===c&&(c=t[i.join(".")]),void 0!==c&&(i=c)}return i},n.prototype._decodeTime=function(e,t){var r=e.raw().toString();if("gentime"===t)var i=0|r.slice(0,4),n=0|r.slice(4,6),a=0|r.slice(6,8),f=0|r.slice(8,10),o=0|r.slice(10,12),s=0|r.slice(12,14);else{if("utctime"!==t)return e.error("Decoding "+t+" time is not supported yet");var i=0|r.slice(0,2),n=0|r.slice(2,4),a=0|r.slice(4,6),f=0|r.slice(6,8),o=0|r.slice(8,10),s=0|r.slice(10,12);i=i<70?2e3+i:1900+i}return Date.UTC(i,n-1,a,f,o,s,0)},n.prototype._decodeNull=function(e){return null},n.prototype._decodeBool=function(e){var t=e.readUInt8();return e.isError(t)?t:0!==t},n.prototype._decodeInt=function(e,t){var r=e.raw(),i=new h(r);return t&&(i=t[i.toString(10)]||i),i},n.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getDecoder("der").tree}},{"../../asn1":2,inherits:94}],11:[function(e,t,r){var i=r;i.der=e("./der"),i.pem=e("./pem")},{"./der":10,"./pem":12}],12:[function(e,t,r){function i(e){f.call(this,e),this.enc="pem"}var n=e("inherits"),a=e("buffer").Buffer,f=e("./der");n(i,f),t.exports=i,i.prototype.decode=function(e,t){for(var r=e.toString().split(/[\r\n]+/g),i=t.label.toUpperCase(),n=/^-----(BEGIN|END) ([^-]+)-----$/,o=-1,s=-1,c=0;c<r.length;c++){var h=r[c].match(n);if(null!==h&&h[2]===i){if(o!==-1){if("END"!==h[1])break;s=c;break}if("BEGIN"!==h[1])break;o=c}}if(o===-1||s===-1)throw new Error("PEM section not found for: "+i);var d=r.slice(o+1,s).join("");d.replace(/[^a-z0-9\+\/=]+/gi,"");var u=new a(d,"base64");return f.prototype.decode.call(this,u,t)}},{"./der":10,buffer:46,inherits:94}],13:[function(e,t,r){function i(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new n,this.tree._init(e.body)}function n(e){h.Node.call(this,"der",e)}function a(e){return e<10?"0"+e:e}function f(e,t,r,i){var n;if("seqof"===e?e="seq":"setof"===e&&(e="set"),d.tagByName.hasOwnProperty(e))n=d.tagByName[e];else{if("number"!=typeof e||(0|e)!==e)return i.error("Unknown tag: "+e);n=e}return n>=31?i.error("Multi-octet tag encoding unsupported"):(t||(n|=32),n|=d.tagClassByName[r||"universal"]<<6)}var o=e("inherits"),s=e("buffer").Buffer,c=e("../../asn1"),h=c.base,d=c.constants.der;t.exports=i,i.prototype.encode=function(e,t){return this.tree._encode(e,t).join()},o(n,h.Node),n.prototype._encodeComposite=function(e,t,r,i){var n=f(e,t,r,this.reporter);if(i.length<128){var a=new s(2);return a[0]=n,a[1]=i.length,this._createEncoderBuffer([a,i])}for(var o=1,c=i.length;c>=256;c>>=8)o++;var a=new s(2+o);a[0]=n,a[1]=128|o;for(var c=1+o,h=i.length;h>0;c--,h>>=8)a[c]=255&h;return this._createEncoderBuffer([a,i])},n.prototype._encodeStr=function(e,t){if("bitstr"===t)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===t){for(var r=new s(2*e.length),i=0;i<e.length;i++)r.writeUInt16BE(e.charCodeAt(i),2*i);return this._createEncoderBuffer(r)}return"numstr"===t?this._isNumstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===t?this._isPrintstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(t)?this._createEncoderBuffer(e):"objDesc"===t?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: "+t+" unsupported")},n.prototype._encodeObjid=function(e,t,r){if("string"==typeof e){if(!t)return this.reporter.error("string objid given, but no values map found");if(!t.hasOwnProperty(e))return this.reporter.error("objid not found in values map");e=t[e].split(/[\s\.]+/g);for(var i=0;i<e.length;i++)e[i]|=0}else if(Array.isArray(e)){e=e.slice();for(var i=0;i<e.length;i++)e[i]|=0}if(!Array.isArray(e))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(e));if(!r){if(e[1]>=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,40*e[0]+e[1])}for(var n=0,i=0;i<e.length;i++){var a=e[i];for(n++;a>=128;a>>=7)n++}for(var f=new s(n),o=f.length-1,i=e.length-1;i>=0;i--){var a=e[i];for(f[o--]=127&a;(a>>=7)>0;)f[o--]=128|127&a}return this._createEncoderBuffer(f)},n.prototype._encodeTime=function(e,t){var r,i=new Date(e);return"gentime"===t?r=[a(i.getFullYear()),a(i.getUTCMonth()+1),a(i.getUTCDate()),a(i.getUTCHours()),a(i.getUTCMinutes()),a(i.getUTCSeconds()),"Z"].join(""):"utctime"===t?r=[a(i.getFullYear()%100),a(i.getUTCMonth()+1),a(i.getUTCDate()),a(i.getUTCHours()),a(i.getUTCMinutes()),a(i.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(r,"octstr")},n.prototype._encodeNull=function(){return this._createEncoderBuffer("")},n.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&&!s.isBuffer(e)){var r=e.toArray();!e.sign&&128&r[0]&&r.unshift(0),e=new s(r)}if(s.isBuffer(e)){var i=e.length;0===e.length&&i++;var n=new s(i);return e.copy(n),0===e.length&&(n[0]=0),this._createEncoderBuffer(n)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);for(var i=1,a=e;a>=256;a>>=8)i++;for(var n=new Array(i),a=n.length-1;a>=0;a--)n[a]=255&e,e>>=8;return 128&n[0]&&n.unshift(0),this._createEncoderBuffer(new s(n))},n.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},n.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getEncoder("der").tree},n.prototype._skipDefault=function(e,t,r){var i,n=this._baseState;if(null===n.default)return!1;var 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<a.length;i++)if(a[i]!==n.defaultBuffer[i])return!1;return!0}},{"../../asn1":2,buffer:46,inherits:94}],14:[function(e,t,r){var i=r;i.der=e("./der"),i.pem=e("./pem")},{"./der":13,"./pem":15}],15:[function(e,t,r){function i(e){a.call(this,e),this.enc="pem"}var n=e("inherits"),a=e("./der");n(i,a),t.exports=i,i.prototype.encode=function(e,t){for(var r=a.prototype.encode.call(this,e),i=r.toString("base64"),n=["-----BEGIN "+t.label+"-----"],f=0;f<i.length;f+=64)n.push(i.slice(f,f+64));return n.push("-----END "+t.label+"-----"),n.join("\n")}},{"./der":13,inherits:94}],16:[function(e,t,r){"use strict";function i(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function n(e){return 3*e.length/4-i(e)}function a(e){var t,r,n,a,f,o,s=e.length;f=i(e),o=new d(3*s/4-f),n=f>0?s-4:s;var c=0;for(t=0,r=0;t<n;t+=4,r+=3)a=h[e.charCodeAt(t)]<<18|h[e.charCodeAt(t+1)]<<12|h[e.charCodeAt(t+2)]<<6|h[e.charCodeAt(t+3)],o[c++]=a>>16&255,o[c++]=a>>8&255,o[c++]=255&a;return 2===f?(a=h[e.charCodeAt(t)]<<2|h[e.charCodeAt(t+1)]>>4,o[c++]=255&a):1===f&&(a=h[e.charCodeAt(t)]<<10|h[e.charCodeAt(t+1)]<<4|h[e.charCodeAt(t+2)]>>2,o[c++]=a>>8&255,o[c++]=255&a),o}function f(e){return c[e>>18&63]+c[e>>12&63]+c[e>>6&63]+c[63&e]}function o(e,t,r){for(var i,n=[],a=t;a<r;a+=3)i=(e[a]<<16)+(e[a+1]<<8)+e[a+2],n.push(f(i));return n.join("")}function s(e){for(var t,r=e.length,i=r%3,n="",a=[],f=16383,s=0,h=r-i;s<h;s+=f)a.push(o(e,s,s+f>h?h:s+f));return 1===i?(t=e[r-1],n+=c[t>>2],n+=c[t<<4&63],n+="=="):2===i&&(t=(e[r-2]<<8)+e[r-1],n+=c[t>>10],n+=c[t>>4&63],n+=c[t<<2&63],n+="="),a.push(n),a.join("")}r.byteLength=n,r.toByteArray=a,r.fromByteArray=s;for(var c=[],h=[],d="undefined"!=typeof Uint8Array?Uint8Array:Array,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l=0,p=u.length;l<p;++l)c[l]=u[l],h[u.charCodeAt(l)]=l;h["-".charCodeAt(0)]=62,h["_".charCodeAt(0)]=63},{}],17:[function(e,t,r){!function(t,r){"use strict";function i(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(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){return a.isBN(e)?e:(this.negative=0,this.words=null,this.length=0,this.red=null,void(null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))))}function f(e,t,r){for(var i=0,n=Math.min(e.length,r),a=t;a<n;a++){var f=e.charCodeAt(a)-48;i<<=4,i|=f>=49&&f<=54?f-49+10:f>=17&&f<=22?f-17+10:15&f}return i}function o(e,t,r,i){for(var n=0,a=Math.min(e.length,r),f=t;f<a;f++){var o=e.charCodeAt(f)-48;n*=i,n+=o>=49?o-49+10:o>=17?o-17+10:o}return n}function s(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var i=r/26|0,n=r%26;t[r]=(e.words[i]&1<<n)>>>n}return t}function c(e,t,r){r.negative=t.negative^e.negative;var i=e.length+t.length|0;r.length=i,i=i-1|0;var n=0|e.words[0],a=0|t.words[0],f=n*a,o=67108863&f,s=f/67108864|0;r.words[0]=o;for(var c=1;c<i;c++){for(var h=s>>>26,d=67108863&s,u=Math.min(c,t.length-1),l=Math.max(0,c-e.length+1);l<=u;l++){var p=c-l|0;n=0|e.words[p],a=0|t.words[l],f=n*a+d,h+=f/67108864|0,d=67108863&f}r.words[c]=0|d,s=0|h}return 0!==s?r.words[c]=0|s:r.length--,r.strip()}function h(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var i=0,n=0,a=0;a<r.length-1;a++){var f=n;n=0;for(var o=67108863&i,s=Math.min(a,t.length-1),c=Math.max(0,a-e.length+1);c<=s;c++){var h=a-c,d=0|e.words[h],u=0|t.words[c],l=d*u,p=67108863&l;f=f+(l/67108864|0)|0,p=p+o|0,o=67108863&p,f=f+(p>>>26)|0,n+=f>>>26,f&=67108863}r.words[a]=o,i=f,f=n}return 0!==i?r.words[a]=i:r.length--,r.strip()}function d(e,t,r){var i=new u;return i.mulp(e,t,r)}function u(e,t){this.x=e,this.y=t}function l(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 p(){l.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){l.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){l.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function m(){l.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function y(e){if("string"==typeof e){var t=a._prime(e);this.m=t.p,this.prime=t}else i(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function g(e){y.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)}"object"==typeof t?t.exports=a:r.BN=a,a.BN=a,a.wordSize=26;var w;try{w=e("buffer").Buffer}catch(e){}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),i(t===(0|t)&&t>=2&&t<=36),e=e.toString().replace(/\s+/g,"");var n=0;"-"===e[0]&&n++,16===t?this._parseHex(e,n):this._parseBase(e,t,n),"-"===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):(i(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(i("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 n=0;n<this.length;n++)this.words[n]=0;var a,f,o=0;if("be"===r)for(n=e.length-1,a=0;n>=0;n-=3)f=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[a]|=f<<o&67108863,this.words[a+1]=f>>>26-o&67108863,o+=24,o>=26&&(o-=26,a++);else if("le"===r)for(n=0,a=0;n<e.length;n+=3)f=e[n]|e[n+1]<<8|e[n+2]<<16,this.words[a]|=f<<o&67108863,this.words[a+1]=f>>>26-o&67108863,o+=24,o>=26&&(o-=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<this.length;r++)this.words[r]=0;var i,n,a=0;for(r=e.length-6,i=0;r>=t;r-=6)n=f(e,r,r+6),this.words[i]|=n<<a&67108863,this.words[i+1]|=n>>>26-a&4194303,a+=24,a>=26&&(a-=26,i++);r+6!==t&&(n=f(e,t,r+6),this.words[i]|=n<<a&67108863,this.words[i+1]|=n>>>26-a&4194303),this.strip()},a.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=t)i++;i--,n=n/t|0;for(var a=e.length-r,f=a%i,s=Math.min(a,a-f)+r,c=0,h=r;h<s;h+=i)c=o(e,h,h+i,t),this.imuln(n),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==f){var d=1;for(c=o(e,h,e.length,t),h=0;h<f;h++)d*=t;this.imuln(d),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}},a.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,
e.red=this.red},a.prototype.clone=function(){var e=new a(null);return this.copy(e),e},a.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},a.prototype.strip=function(){for(;this.length>1&&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?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var _=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],S=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],M=[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];a.prototype.toString=function(e,t){e=e||10,t=0|t||1;var r;if(16===e||"hex"===e){r="";for(var n=0,a=0,f=0;f<this.length;f++){var o=this.words[f],s=(16777215&(o<<n|a)).toString(16);a=o>>>24-n&16777215,r=0!==a||f!==this.length-1?_[6-s.length]+s+r:s+r,n+=2,n>=26&&(n-=26,f--)}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 c=S[e],h=M[e];r="";var d=this.clone();for(d.negative=0;!d.isZero();){var u=d.modn(h).toString(e);d=d.idivn(h),r=d.isZero()?u+r:_[c-u.length]+u+r}for(this.isZero()&&(r="0"+r);r.length%t!==0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!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&&i(!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 i("undefined"!=typeof w),this.toArrayLike(w,e,t)},a.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},a.prototype.toArrayLike=function(e,t,r){var n=this.byteLength(),a=r||Math.max(1,n);i(n<=a,"byte array longer than desired length"),i(a>0,"Requested array length <= 0"),this.strip();var f,o,s="le"===t,c=new e(a),h=this.clone();if(s){for(o=0;!h.isZero();o++)f=h.andln(255),h.iushrn(8),c[o]=f;for(;o<a;o++)c[o]=0}else{for(o=0;o<a-n;o++)c[o]=0;for(o=0;!h.isZero();o++)f=h.andln(255),h.iushrn(8),c[a-o-1]=f}return c},Math.clz32?a.prototype._countBits=function(e){return 32-Math.clz32(e)}:a.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},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;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},a.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},a.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},a.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},a.prototype.isNeg=function(){return 0!==this.negative},a.prototype.neg=function(){return this.clone().ineg()},a.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},a.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},a.prototype.ior=function(e){return i(0===(this.negative|e.negative)),this.iuor(e)},a.prototype.or=function(e){return this.length>e.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;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this.strip()},a.prototype.iand=function(e){return i(0===(this.negative|e.negative)),this.iuand(e)},a.prototype.and=function(e){return this.length>e.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 i=0;i<r.length;i++)this.words[i]=t.words[i]^r.words[i];if(this!==t)for(;i<t.length;i++)this.words[i]=t.words[i];return this.length=t.length,this.strip()},a.prototype.ixor=function(e){return i(0===(this.negative|e.negative)),this.iuxor(e)},a.prototype.xor=function(e){return this.length>e.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){i("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var n=0;n<t;n++)this.words[n]=67108863&~this.words[n];return r>0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},a.prototype.notn=function(e){return this.clone().inotn(e)},a.prototype.setn=function(e,t){i("number"==typeof e&&e>=0);var r=e/26|0,n=e%26;return this._expand(r+1),t?this.words[r]=this.words[r]|1<<n:this.words[r]=this.words[r]&~(1<<n),this.strip()},a.prototype.iadd=function(e){var t;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();var r,i;this.length>e.length?(r=this,i=e):(r=e,i=this);for(var n=0,a=0;a<i.length;a++)t=(0|r.words[a])+(0|i.words[a])+n,this.words[a]=67108863&t,n=t>>>26;for(;0!==n&&a<r.length;a++)t=(0|r.words[a])+n,this.words[a]=67108863&t,n=t>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this},a.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.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=this.cmp(e);if(0===r)return this.negative=0,this.length=1,this.words[0]=0,this;var i,n;r>0?(i=this,n=e):(i=e,n=this);for(var a=0,f=0;f<n.length;f++)t=(0|i.words[f])-(0|n.words[f])+a,a=t>>26,this.words[f]=67108863&t;for(;0!==a&&f<i.length;f++)t=(0|i.words[f])+a,a=t>>26,this.words[f]=67108863&t;if(0===a&&f<i.length&&i!==this)for(;f<i.length;f++)this.words[f]=i.words[f];return this.length=Math.max(this.length,f),i!==this&&(this.negative=1),this.strip()},a.prototype.sub=function(e){return this.clone().isub(e)};var E=function(e,t,r){var i,n,a,f=e.words,o=t.words,s=r.words,c=0,h=0|f[0],d=8191&h,u=h>>>13,l=0|f[1],p=8191&l,b=l>>>13,v=0|f[2],m=8191&v,y=v>>>13,g=0|f[3],w=8191&g,_=g>>>13,S=0|f[4],M=8191&S,E=S>>>13,k=0|f[5],A=8191&k,x=k>>>13,B=0|f[6],I=8191&B,R=B>>>13,j=0|f[7],P=8191&j,C=j>>>13,T=0|f[8],L=8191&T,z=T>>>13,D=0|f[9],q=8191&D,O=D>>>13,U=0|o[0],N=8191&U,K=U>>>13,F=0|o[1],Y=8191&F,H=F>>>13,X=0|o[2],W=8191&X,V=X>>>13,Z=0|o[3],J=8191&Z,$=Z>>>13,G=0|o[4],Q=8191&G,ee=G>>>13,te=0|o[5],re=8191&te,ie=te>>>13,ne=0|o[6],ae=8191&ne,fe=ne>>>13,oe=0|o[7],se=8191&oe,ce=oe>>>13,he=0|o[8],de=8191&he,ue=he>>>13,le=0|o[9],pe=8191&le,be=le>>>13;r.negative=e.negative^t.negative,r.length=19,i=Math.imul(d,N),n=Math.imul(d,K),n=n+Math.imul(u,N)|0,a=Math.imul(u,K);var ve=(c+i|0)+((8191&n)<<13)|0;c=(a+(n>>>13)|0)+(ve>>>26)|0,ve&=67108863,i=Math.imul(p,N),n=Math.imul(p,K),n=n+Math.imul(b,N)|0,a=Math.imul(b,K),i=i+Math.imul(d,Y)|0,n=n+Math.imul(d,H)|0,n=n+Math.imul(u,Y)|0,a=a+Math.imul(u,H)|0;var me=(c+i|0)+((8191&n)<<13)|0;c=(a+(n>>>13)|0)+(me>>>26)|0,me&=67108863,i=Math.imul(m,N),n=Math.imul(m,K),n=n+Math.imul(y,N)|0,a=Math.imul(y,K),i=i+Math.imul(p,Y)|0,n=n+Math.imul(p,H)|0,n=n+Math.imul(b,Y)|0,a=a+Math.imul(b,H)|0,i=i+Math.imul(d,W)|0,n=n+Math.imul(d,V)|0,n=n+Math.imul(u,W)|0,a=a+Math.imul(u,V)|0;var ye=(c+i|0)+((8191&n)<<13)|0;c=(a+(n>>>13)|0)+(ye>>>26)|0,ye&=67108863,i=Math.imul(w,N),n=Math.imul(w,K),n=n+Math.imul(_,N)|0,a=Math.imul(_,K),i=i+Math.imul(m,Y)|0,n=n+Math.imul(m,H)|0,n=n+Math.imul(y,Y)|0,a=a+Math.imul(y,H)|0,i=i+Math.imul(p,W)|0,n=n+Math.imul(p,V)|0,n=n+Math.imul(b,W)|0,a=a+Math.imul(b,V)|0,i=i+Math.imul(d,J)|0,n=n+Math.imul(d,$)|0,n=n+Math.imul(u,J)|0,a=a+Math.imul(u,$)|0;var ge=(c+i|0)+((8191&n)<<13)|0;c=(a+(n>>>13)|0)+(ge>>>26)|0,ge&=67108863,i=Math.imul(M,N),n=Math.imul(M,K),n=n+Math.imul(E,N)|0,a=Math.imul(E,K),i=i+Math.imul(w,Y)|0,n=n+Math.imul(w,H)|0,n=n+Math.imul(_,Y)|0,a=a+Math.imul(_,H)|0,i=i+Math.imul(m,W)|0,n=n+Math.imul(m,V)|0,n=n+Math.imul(y,W)|0,a=a+Math.imul(y,V)|0,i=i+Math.imul(p,J)|0,n=n+Math.imul(p,$)|0,n=n+Math.imul(b,J)|0,a=a+Math.imul(b,$)|0,i=i+Math.imul(d,Q)|0,n=n+Math.imul(d,ee)|0,n=n+Math.imul(u,Q)|0,a=a+Math.imul(u,ee)|0;var we=(c+i|0)+((8191&n)<<13)|0;c=(a+(n>>>13)|0)+(we>>>26)|0,we&=67108863,i=Math.imul(A,N),n=Math.imul(A,K),n=n+Math.imul(x,N)|0,a=Math.imul(x,K),i=i+Math.imul(M,Y)|0,n=n+Math.imul(M,H)|0,n=n+Math.imul(E,Y)|0,a=a+Math.imul(E,H)|0,i=i+Math.imul(w,W)|0,n=n+Math.imul(w,V)|0,n=n+Math.imul(_,W)|0,a=a+Math.imul(_,V)|0,i=i+Math.imul(m,J)|0,n=n+Math.imul(m,$)|0,n=n+Math.imul(y,J)|0,a=a+Math.imul(y,$)|0,i=i+Math.imul(p,Q)|0,n=n+Math.imul(p,ee)|0,n=n+Math.imul(b,Q)|0,a=a+Math.imul(b,ee)|0,i=i+Math.imul(d,re)|0,n=n+Math.imul(d,ie)|0,n=n+Math.imul(u,re)|0,a=a+Math.imul(u,ie)|0;var _e=(c+i|0)+((8191&n)<<13)|0;c=(a+(n>>>13)|0)+(_e>>>26)|0,_e&=67108863,i=Math.imul(I,N),n=Math.imul(I,K),n=n+Math.imul(R,N)|0,a=Math.imul(R,K),i=i+Math.imul(A,Y)|0,n=n+Math.imul(A,H)|0,n=n+Math.imul(x,Y)|0,a=a+Math.imul(x,H)|0,i=i+Math.imul(M,W)|0,n=n+Math.imul(M,V)|0,n=n+Math.imul(E,W)|0,a=a+Math.imul(E,V)|0,i=i+Math.imul(w,J)|0,n=n+Math.imul(w,$)|0,n=n+Math.imul(_,J)|0,a=a+Math.imul(_,$)|0,i=i+Math.imul(m,Q)|0,n=n+Math.imul(m,ee)|0,n=n+Math.imul(y,Q)|0,a=a+Math.imul(y,ee)|0,i=i+Math.imul(p,re)|0,n=n+Math.imul(p,ie)|0,n=n+Math.imul(b,re)|0,a=a+Math.imul(b,ie)|0,i=i+Math.imul(d,ae)|0,n=n+Math.imul(d,fe)|0,n=n+Math.imul(u,ae)|0,a=a+Math.imul(u,fe)|0;var Se=(c+i|0)+((8191&n)<<13)|0;c=(a+(n>>>13)|0)+(Se>>>26)|0,Se&=67108863,i=Math.imul(P,N),n=Math.imul(P,K),n=n+Math.imul(C,N)|0,a=Math.imul(C,K),i=i+Math.imul(I,Y)|0,n=n+Math.imul(I,H)|0,n=n+Math.imul(R,Y)|0,a=a+Math.imul(R,H)|0,i=i+Math.imul(A,W)|0,n=n+Math.imul(A,V)|0,n=n+Math.imul(x,W)|0,a=a+Math.imul(x,V)|0,i=i+Math.imul(M,J)|0,n=n+Math.imul(M,$)|0,n=n+Math.imul(E,J)|0,a=a+Math.imul(E,$)|0,i=i+Math.imul(w,Q)|0,n=n+Math.imul(w,ee)|0,n=n+Math.imul(_,Q)|0,a=a+Math.imul(_,ee)|0,i=i+Math.imul(m,re)|0,n=n+Math.imul(m,ie)|0,n=n+Math.imul(y,re)|0,a=a+Math.imul(y,ie)|0,i=i+Math.imul(p,ae)|0,n=n+Math.imul(p,fe)|0,n=n+Math.imul(b,ae)|0,a=a+Math.imul(b,fe)|0,i=i+Math.imul(d,se)|0,n=n+Math.imul(d,ce)|0,n=n+Math.imul(u,se)|0,a=a+Math.imul(u,ce)|0;var Me=(c+i|0)+((8191&n)<<13)|0;c=(a+(n>>>13)|0)+(Me>>>26)|0,Me&=67108863,i=Math.imul(L,N),n=Math.imul(L,K),n=n+Math.imul(z,N)|0,a=Math.imul(z,K),i=i+Math.imul(P,Y)|0,n=n+Math.imul(P,H)|0,n=n+Math.imul(C,Y)|0,a=a+Math.imul(C,H)|0,i=i+Math.imul(I,W)|0,n=n+Math.imul(I,V)|0,n=n+Math.imul(R,W)|0,a=a+Math.imul(R,V)|0,i=i+Math.imul(A,J)|0,n=n+Math.imul(A,$)|0,n=n+Math.imul(x,J)|0,a=a+Math.imul(x,$)|0,i=i+Math.imul(M,Q)|0,n=n+Math.imul(M,ee)|0,n=n+Math.imul(E,Q)|0,a=a+Math.imul(E,ee)|0,i=i+Math.imul(w,re)|0,n=n+Math.imul(w,ie)|0,n=n+Math.imul(_,re)|0,a=a+Math.imul(_,ie)|0,i=i+Math.imul(m,ae)|0,n=n+Math.imul(m,fe)|0,n=n+Math.imul(y,ae)|0,a=a+Math.imul(y,fe)|0,i=i+Math.imul(p,se)|0,n=n+Math.imul(p,ce)|0,n=n+Math.imul(b,se)|0,a=a+Math.imul(b,ce)|0,i=i+Math.imul(d,de)|0,n=n+Math.imul(d,ue)|0,n=n+Math.imul(u,de)|0,a=a+Math.imul(u,ue)|0;var Ee=(c+i|0)+((8191&n)<<13)|0;c=(a+(n>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,i=Math.imul(q,N),n=Math.imul(q,K),n=n+Math.imul(O,N)|0,a=Math.imul(O,K),i=i+Math.imul(L,Y)|0,n=n+Math.imul(L,H)|0,n=n+Math.imul(z,Y)|0,a=a+Math.imul(z,H)|0,i=i+Math.imul(P,W)|0,n=n+Math.imul(P,V)|0,n=n+Math.imul(C,W)|0,a=a+Math.imul(C,V)|0,i=i+Math.imul(I,J)|0,n=n+Math.imul(I,$)|0,n=n+Math.imul(R,J)|0,a=a+Math.imul(R,$)|0,i=i+Math.imul(A,Q)|0,n=n+Math.imul(A,ee)|0,n=n+Math.imul(x,Q)|0,a=a+Math.imul(x,ee)|0,i=i+Math.imul(M,re)|0,n=n+Math.imul(M,ie)|0,n=n+Math.imul(E,re)|0,a=a+Math.imul(E,ie)|0,i=i+Math.imul(w,ae)|0,n=n+Math.imul(w,fe)|0,n=n+Math.imul(_,ae)|0,a=a+Math.imul(_,fe)|0,i=i+Math.imul(m,se)|0,n=n+Math.imul(m,ce)|0,n=n+Math.imul(y,se)|0,a=a+Math.imul(y,ce)|0,i=i+Math.imul(p,de)|0,n=n+Math.imul(p,ue)|0,n=n+Math.imul(b,de)|0,a=a+Math.imul(b,ue)|0,i=i+Math.imul(d,pe)|0,n=n+Math.imul(d,be)|0,n=n+Math.imul(u,pe)|0,a=a+Math.imul(u,be)|0;var ke=(c+i|0)+((8191&n)<<13)|0;c=(a+(n>>>13)|0)+(ke>>>26)|0,ke&=67108863,i=Math.imul(q,Y),n=Math.imul(q,H),n=n+Math.imul(O,Y)|0,a=Math.imul(O,H),i=i+Math.imul(L,W)|0,n=n+Math.imul(L,V)|0,n=n+Math.imul(z,W)|0,a=a+Math.imul(z,V)|0,i=i+Math.imul(P,J)|0,n=n+Math.imul(P,$)|0,n=n+Math.imul(C,J)|0,a=a+Math.imul(C,$)|0,i=i+Math.imul(I,Q)|0,n=n+Math.imul(I,ee)|0,n=n+Math.imul(R,Q)|0,a=a+Math.imul(R,ee)|0,i=i+Math.imul(A,re)|0,n=n+Math.imul(A,ie)|0,n=n+Math.imul(x,re)|0,a=a+Math.imul(x,ie)|0,i=i+Math.imul(M,ae)|0,n=n+Math.imul(M,fe)|0,n=n+Math.imul(E,ae)|0,a=a+Math.imul(E,fe)|0,i=i+Math.imul(w,se)|0,n=n+Math.imul(w,ce)|0,n=n+Math.imul(_,se)|0,a=a+Math.imul(_,ce)|0,i=i+Math.imul(m,de)|0,n=n+Math.imul(m,ue)|0,n=n+Math.imul(y,de)|0,a=a+Math.imul(y,ue)|0,i=i+Math.imul(p,pe)|0,n=n+Math.imul(p,be)|0,n=n+Math.imul(b,pe)|0,a=a+Math.imul(b,be)|0;var Ae=(c+i|0)+((8191&n)<<13)|0;c=(a+(n>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,i=Math.imul(q,W),n=Math.imul(q,V),n=n+Math.imul(O,W)|0,a=Math.imul(O,V),i=i+Math.imul(L,J)|0,n=n+Math.imul(L,$)|0,n=n+Math.imul(z,J)|0,a=a+Math.imul(z,$)|0,i=i+Math.imul(P,Q)|0,n=n+Math.imul(P,ee)|0,n=n+Math.imul(C,Q)|0,a=a+Math.imul(C,ee)|0,i=i+Math.imul(I,re)|0,n=n+Math.imul(I,ie)|0,n=n+Math.imul(R,re)|0,a=a+Math.imul(R,ie)|0,i=i+Math.imul(A,ae)|0,n=n+Math.imul(A,fe)|0,n=n+Math.imul(x,ae)|0,a=a+Math.imul(x,fe)|0,i=i+Math.imul(M,se)|0,n=n+Math.imul(M,ce)|0,n=n+Math.imul(E,se)|0,a=a+Math.imul(E,ce)|0,i=i+Math.imul(w,de)|0,n=n+Math.imul(w,ue)|0,n=n+Math.imul(_,de)|0,a=a+Math.imul(_,ue)|0,i=i+Math.imul(m,pe)|0,n=n+Math.imul(m,be)|0,n=n+Math.imul(y,pe)|0,a=a+Math.imul(y,be)|0;var xe=(c+i|0)+((8191&n)<<13)|0;c=(a+(n>>>13)|0)+(xe>>>26)|0,xe&=67108863,i=Math.imul(q,J),n=Math.imul(q,$),n=n+Math.imul(O,J)|0,a=Math.imul(O,$),i=i+Math.imul(L,Q)|0,n=n+Math.imul(L,ee)|0,n=n+Math.imul(z,Q)|0,a=a+Math.imul(z,ee)|0,i=i+Math.imul(P,re)|0,n=n+Math.imul(P,ie)|0,n=n+Math.imul(C,re)|0,a=a+Math.imul(C,ie)|0,i=i+Math.imul(I,ae)|0,n=n+Math.imul(I,fe)|0,n=n+Math.imul(R,ae)|0,a=a+Math.imul(R,fe)|0,i=i+Math.imul(A,se)|0,n=n+Math.imul(A,ce)|0,n=n+Math.imul(x,se)|0,a=a+Math.imul(x,ce)|0,i=i+Math.imul(M,de)|0,n=n+Math.imul(M,ue)|0,n=n+Math.imul(E,de)|0,a=a+Math.imul(E,ue)|0,i=i+Math.imul(w,pe)|0,n=n+Math.imul(w,be)|0,n=n+Math.imul(_,pe)|0,a=a+Math.imul(_,be)|0;var Be=(c+i|0)+((8191&n)<<13)|0;c=(a+(n>>>13)|0)+(Be>>>26)|0,Be&=67108863,i=Math.imul(q,Q),n=Math.imul(q,ee),n=n+Math.imul(O,Q)|0,a=Math.imul(O,ee),i=i+Math.imul(L,re)|0,n=n+Math.imul(L,ie)|0,n=n+Math.imul(z,re)|0,a=a+Math.imul(z,ie)|0,i=i+Math.imul(P,ae)|0,n=n+Math.imul(P,fe)|0,n=n+Math.imul(C,ae)|0,a=a+Math.imul(C,fe)|0,i=i+Math.imul(I,se)|0,n=n+Math.imul(I,ce)|0,n=n+Math.imul(R,se)|0,a=a+Math.imul(R,ce)|0,i=i+Math.imul(A,de)|0,n=n+Math.imul(A,ue)|0,n=n+Math.imul(x,de)|0,a=a+Math.imul(x,ue)|0,i=i+Math.imul(M,pe)|0,n=n+Math.imul(M,be)|0,n=n+Math.imul(E,pe)|0,a=a+Math.imul(E,be)|0;var Ie=(c+i|0)+((8191&n)<<13)|0;c=(a+(n>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,i=Math.imul(q,re),n=Math.imul(q,ie),n=n+Math.imul(O,re)|0,a=Math.imul(O,ie),i=i+Math.imul(L,ae)|0,n=n+Math.imul(L,fe)|0,n=n+Math.imul(z,ae)|0,a=a+Math.imul(z,fe)|0,i=i+Math.imul(P,se)|0,n=n+Math.imul(P,ce)|0,n=n+Math.imul(C,se)|0,a=a+Math.imul(C,ce)|0,i=i+Math.imul(I,de)|0,n=n+Math.imul(I,ue)|0,n=n+Math.imul(R,de)|0,a=a+Math.imul(R,ue)|0,i=i+Math.imul(A,pe)|0,n=n+Math.imul(A,be)|0,n=n+Math.imul(x,pe)|0,a=a+Math.imul(x,be)|0;var Re=(c+i|0)+((8191&n)<<13)|0;c=(a+(n>>>13)|0)+(Re>>>26)|0,Re&=67108863,i=Math.imul(q,ae),n=Math.imul(q,fe),n=n+Math.imul(O,ae)|0,a=Math.imul(O,fe),i=i+Math.imul(L,se)|0,n=n+Math.imul(L,ce)|0,n=n+Math.imul(z,se)|0,a=a+Math.imul(z,ce)|0,i=i+Math.imul(P,de)|0,n=n+Math.imul(P,ue)|0,n=n+Math.imul(C,de)|0,a=a+Math.imul(C,ue)|0,i=i+Math.imul(I,pe)|0,n=n+Math.imul(I,be)|0,n=n+Math.imul(R,pe)|0,a=a+Math.imul(R,be)|0;var je=(c+i|0)+((8191&n)<<13)|0;c=(a+(n>>>13)|0)+(je>>>26)|0,je&=67108863,i=Math.imul(q,se),n=Math.imul(q,ce),n=n+Math.imul(O,se)|0,a=Math.imul(O,ce),i=i+Math.imul(L,de)|0,n=n+Math.imul(L,ue)|0,n=n+Math.imul(z,de)|0,a=a+