@fuzefinance/orderbook-bignumber
Version:
Node.js Lmit Order Book for high-frequency trading (HFT).
2 lines • 502 kB
JavaScript
/*! For license information please see index.js.LICENSE.txt */
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.exampleTypescriptPackage=e():t.exampleTypescriptPackage=e()}(this,(()=>(()=>{var __webpack_modules__={7568:(t,e,r)=>{var i=e;i.bignum=r(9404),i.define=r(7363).define,i.base=r(9673),i.constants=r(2153),i.decoders=r(2853),i.encoders=r(4669)},7363:(t,e,r)=>{var i=r(7568),n=r(6698);function o(t,e){this.name=t,this.body=e,this.decoders={},this.encoders={}}e.define=function(t,e){return new o(t,e)},o.prototype._createNamed=function(t){var e;try{e=r(8961).runInThisContext("(function "+this.name+"(entity) {\n this._initNamed(entity);\n})")}catch(t){e=function(t){this._initNamed(t)}}return n(e,t),e.prototype._initNamed=function(e){t.call(this,e)},new e(this)},o.prototype._getDecoder=function(t){return t=t||"der",this.decoders.hasOwnProperty(t)||(this.decoders[t]=this._createNamed(i.decoders[t])),this.decoders[t]},o.prototype.decode=function(t,e,r){return this._getDecoder(e).decode(t,r)},o.prototype._getEncoder=function(t){return t=t||"der",this.encoders.hasOwnProperty(t)||(this.encoders[t]=this._createNamed(i.encoders[t])),this.encoders[t]},o.prototype.encode=function(t,e,r){return this._getEncoder(e).encode(t,r)}},7227:(t,e,r)=>{var i=r(6698),n=r(9673).Reporter,o=r(8287).Buffer;function a(t,e){n.call(this,e),o.isBuffer(t)?(this.base=t,this.offset=0,this.length=t.length):this.error("Input not Buffer")}function s(t,e){if(Array.isArray(t))this.length=0,this.value=t.map((function(t){return t instanceof s||(t=new s(t,e)),this.length+=t.length,t}),this);else if("number"==typeof t){if(!(0<=t&&t<=255))return e.error("non-byte EncoderBuffer value");this.value=t,this.length=1}else if("string"==typeof t)this.value=t,this.length=o.byteLength(t);else{if(!o.isBuffer(t))return e.error("Unsupported type: "+typeof t);this.value=t,this.length=t.length}}i(a,n),e.t=a,a.prototype.save=function(){return{offset:this.offset,reporter:n.prototype.save.call(this)}},a.prototype.restore=function(t){var e=new a(this.base);return e.offset=t.offset,e.length=this.offset,this.offset=t.offset,n.prototype.restore.call(this,t.reporter),e},a.prototype.isEmpty=function(){return this.offset===this.length},a.prototype.readUInt8=function(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},a.prototype.skip=function(t,e){if(!(this.offset+t<=this.length))return this.error(e||"DecoderBuffer overrun");var r=new a(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+t,this.offset+=t,r},a.prototype.raw=function(t){return this.base.slice(t?t.offset:this.offset,this.length)},e.d=s,s.prototype.join=function(t,e){return t||(t=new o(this.length)),e||(e=0),0===this.length||(Array.isArray(this.value)?this.value.forEach((function(r){r.join(t,e),e+=r.length})):("number"==typeof this.value?t[e]=this.value:"string"==typeof this.value?t.write(this.value,e):o.isBuffer(this.value)&&this.value.copy(t,e),e+=this.length)),t}},9673:(t,e,r)=>{var i=e;i.Reporter=r(9220).a,i.DecoderBuffer=r(7227).t,i.EncoderBuffer=r(7227).d,i.Node=r(993)},993:(t,e,r)=>{var i=r(9673).Reporter,n=r(9673).EncoderBuffer,o=r(9673).DecoderBuffer,a=r(3349),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"],f=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(s);function h(t,e){var r={};this._baseState=r,r.enc=t,r.parent=e||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())}t.exports=h;var u=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];h.prototype.clone=function(){var t=this._baseState,e={};u.forEach((function(r){e[r]=t[r]}));var r=new this.constructor(e.parent);return r._baseState=e,r},h.prototype._wrap=function(){var t=this._baseState;f.forEach((function(e){this[e]=function(){var r=new this.constructor(this);return t.children.push(r),r[e].apply(r,arguments)}}),this)},h.prototype._init=function(t){var e=this._baseState;a(null===e.parent),t.call(this),e.children=e.children.filter((function(t){return t._baseState.parent===this}),this),a.equal(e.children.length,1,"Root node can have only one child")},h.prototype._useArgs=function(t){var e=this._baseState,r=t.filter((function(t){return t instanceof this.constructor}),this);t=t.filter((function(t){return!(t instanceof this.constructor)}),this),0!==r.length&&(a(null===e.children),e.children=r,r.forEach((function(t){t._baseState.parent=this}),this)),0!==t.length&&(a(null===e.args),e.args=t,e.reverseArgs=t.map((function(t){if("object"!=typeof t||t.constructor!==Object)return t;var e={};return Object.keys(t).forEach((function(r){r==(0|r)&&(r|=0);var i=t[r];e[i]=r})),e})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(t){h.prototype[t]=function(){var e=this._baseState;throw new Error(t+" not implemented for encoding: "+e.enc)}})),s.forEach((function(t){h.prototype[t]=function(){var e=this._baseState,r=Array.prototype.slice.call(arguments);return a(null===e.tag),e.tag=t,this._useArgs(r),this}})),h.prototype.use=function(t){a(t);var e=this._baseState;return a(null===e.use),e.use=t,this},h.prototype.optional=function(){return this._baseState.optional=!0,this},h.prototype.def=function(t){var e=this._baseState;return a(null===e.default),e.default=t,e.optional=!0,this},h.prototype.explicit=function(t){var e=this._baseState;return a(null===e.explicit&&null===e.implicit),e.explicit=t,this},h.prototype.implicit=function(t){var e=this._baseState;return a(null===e.explicit&&null===e.implicit),e.implicit=t,this},h.prototype.obj=function(){var t=this._baseState,e=Array.prototype.slice.call(arguments);return t.obj=!0,0!==e.length&&this._useArgs(e),this},h.prototype.key=function(t){var e=this._baseState;return a(null===e.key),e.key=t,this},h.prototype.any=function(){return this._baseState.any=!0,this},h.prototype.choice=function(t){var e=this._baseState;return a(null===e.choice),e.choice=t,this._useArgs(Object.keys(t).map((function(e){return t[e]}))),this},h.prototype.contains=function(t){var e=this._baseState;return a(null===e.use),e.contains=t,this},h.prototype._decode=function(t,e){var r=this._baseState;if(null===r.parent)return t.wrapResult(r.children[0]._decode(t,e));var i,n=r.default,a=!0,s=null;if(null!==r.key&&(s=t.enterKey(r.key)),r.optional){var f=null;if(null!==r.explicit?f=r.explicit:null!==r.implicit?f=r.implicit:null!==r.tag&&(f=r.tag),null!==f||r.any){if(a=this._peekTag(t,f,r.any),t.isError(a))return a}else{var h=t.save();try{null===r.choice?this._decodeGeneric(r.tag,t,e):this._decodeChoice(t,e),a=!0}catch(t){a=!1}t.restore(h)}}if(r.obj&&a&&(i=t.enterObject()),a){if(null!==r.explicit){var u=this._decodeTag(t,r.explicit);if(t.isError(u))return u;t=u}var c=t.offset;if(null===r.use&&null===r.choice){r.any&&(h=t.save());var d=this._decodeTag(t,null!==r.implicit?r.implicit:r.tag,r.any);if(t.isError(d))return d;r.any?n=t.raw(h):t=d}if(e&&e.track&&null!==r.tag&&e.track(t.path(),c,t.length,"tagged"),e&&e.track&&null!==r.tag&&e.track(t.path(),t.offset,t.length,"content"),r.any||(n=null===r.choice?this._decodeGeneric(r.tag,t,e):this._decodeChoice(t,e)),t.isError(n))return n;if(r.any||null!==r.choice||null===r.children||r.children.forEach((function(r){r._decode(t,e)})),r.contains&&("octstr"===r.tag||"bitstr"===r.tag)){var l=new o(n);n=this._getUse(r.contains,t._reporterState.obj)._decode(l,e)}}return r.obj&&a&&(n=t.leaveObject(i)),null===r.key||null===n&&!0!==a?null!==s&&t.exitKey(s):t.leaveKey(s,r.key,n),n},h.prototype._decodeGeneric=function(t,e,r){var i=this._baseState;return"seq"===t||"set"===t?null:"seqof"===t||"setof"===t?this._decodeList(e,t,i.args[0],r):/str$/.test(t)?this._decodeStr(e,t,r):"objid"===t&&i.args?this._decodeObjid(e,i.args[0],i.args[1],r):"objid"===t?this._decodeObjid(e,null,null,r):"gentime"===t||"utctime"===t?this._decodeTime(e,t,r):"null_"===t?this._decodeNull(e,r):"bool"===t?this._decodeBool(e,r):"objDesc"===t?this._decodeStr(e,t,r):"int"===t||"enum"===t?this._decodeInt(e,i.args&&i.args[0],r):null!==i.use?this._getUse(i.use,e._reporterState.obj)._decode(e,r):e.error("unknown tag: "+t)},h.prototype._getUse=function(t,e){var r=this._baseState;return r.useDecoder=this._use(t,e),a(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},h.prototype._decodeChoice=function(t,e){var r=this._baseState,i=null,n=!1;return Object.keys(r.choice).some((function(o){var a=t.save(),s=r.choice[o];try{var f=s._decode(t,e);if(t.isError(f))return!1;i={type:o,value:f},n=!0}catch(e){return t.restore(a),!1}return!0}),this),n?i:t.error("Choice not matched")},h.prototype._createEncoderBuffer=function(t){return new n(t,this.reporter)},h.prototype._encode=function(t,e,r){var i=this._baseState;if(null===i.default||i.default!==t){var n=this._encodeValue(t,e,r);if(void 0!==n&&!this._skipDefault(n,e,r))return n}},h.prototype._encodeValue=function(t,e,r){var n=this._baseState;if(null===n.parent)return n.children[0]._encode(t,e||new i);var o=null;if(this.reporter=e,n.optional&&void 0===t){if(null===n.default)return;t=n.default}var a=null,s=!1;if(n.any)o=this._createEncoderBuffer(t);else if(n.choice)o=this._encodeChoice(t,e);else if(n.contains)a=this._getUse(n.contains,r)._encode(t,e),s=!0;else if(n.children)a=n.children.map((function(r){if("null_"===r._baseState.tag)return r._encode(null,e,t);if(null===r._baseState.key)return e.error("Child should have a key");var i=e.enterKey(r._baseState.key);if("object"!=typeof t)return e.error("Child expected, but input is not object");var n=r._encode(t[r._baseState.key],e,t);return e.leaveKey(i),n}),this).filter((function(t){return t})),a=this._createEncoderBuffer(a);else if("seqof"===n.tag||"setof"===n.tag){if(!n.args||1!==n.args.length)return e.error("Too many args for : "+n.tag);if(!Array.isArray(t))return e.error("seqof/setof, but data is not Array");var f=this.clone();f._baseState.implicit=null,a=this._createEncoderBuffer(t.map((function(r){var i=this._baseState;return this._getUse(i.args[0],t)._encode(r,e)}),f))}else null!==n.use?o=this._getUse(n.use,r)._encode(t,e):(a=this._encodePrimitive(n.tag,t),s=!0);if(!n.any&&null===n.choice){var h=null!==n.implicit?n.implicit:n.tag,u=null===n.implicit?"universal":"context";null===h?null===n.use&&e.error("Tag could be omitted only for .use()"):null===n.use&&(o=this._encodeComposite(h,s,u,a))}return null!==n.explicit&&(o=this._encodeComposite(n.explicit,!1,"context",o)),o},h.prototype._encodeChoice=function(t,e){var r=this._baseState,i=r.choice[t.type];return i||a(!1,t.type+" not found in "+JSON.stringify(Object.keys(r.choice))),i._encode(t.value,e)},h.prototype._encodePrimitive=function(t,e){var r=this._baseState;if(/str$/.test(t))return this._encodeStr(e,t);if("objid"===t&&r.args)return this._encodeObjid(e,r.reverseArgs[0],r.args[1]);if("objid"===t)return this._encodeObjid(e,null,null);if("gentime"===t||"utctime"===t)return this._encodeTime(e,t);if("null_"===t)return this._encodeNull();if("int"===t||"enum"===t)return this._encodeInt(e,r.args&&r.reverseArgs[0]);if("bool"===t)return this._encodeBool(e);if("objDesc"===t)return this._encodeStr(e,t);throw new Error("Unsupported tag: "+t)},h.prototype._isNumstr=function(t){return/^[0-9 ]*$/.test(t)},h.prototype._isPrintstr=function(t){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(t)}},9220:(t,e,r)=>{var i=r(6698);function n(t){this._reporterState={obj:null,path:[],options:t||{},errors:[]}}function o(t,e){this.path=t,this.rethrow(e)}e.a=n,n.prototype.isError=function(t){return t instanceof o},n.prototype.save=function(){var t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}},n.prototype.restore=function(t){var e=this._reporterState;e.obj=t.obj,e.path=e.path.slice(0,t.pathLen)},n.prototype.enterKey=function(t){return this._reporterState.path.push(t)},n.prototype.exitKey=function(t){var e=this._reporterState;e.path=e.path.slice(0,t-1)},n.prototype.leaveKey=function(t,e,r){var i=this._reporterState;this.exitKey(t),null!==i.obj&&(i.obj[e]=r)},n.prototype.path=function(){return this._reporterState.path.join("/")},n.prototype.enterObject=function(){var t=this._reporterState,e=t.obj;return t.obj={},e},n.prototype.leaveObject=function(t){var e=this._reporterState,r=e.obj;return e.obj=t,r},n.prototype.error=function(t){var e,r=this._reporterState,i=t instanceof o;if(e=i?t:new o(r.path.map((function(t){return"["+JSON.stringify(t)+"]"})).join(""),t.message||t,t.stack),!r.options.partial)throw e;return i||r.errors.push(e),e},n.prototype.wrapResult=function(t){var e=this._reporterState;return e.options.partial?{result:this.isError(t)?null:t,errors:e.errors}:t},i(o,Error),o.prototype.rethrow=function(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,o),!this.stack)try{throw new Error(this.message)}catch(t){this.stack=t.stack}return this}},4598:(t,e,r)=>{var i=r(2153);e.tagClass={0:"universal",1:"application",2:"context",3:"private"},e.tagClassByName=i._reverse(e.tagClass),e.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"},e.tagByName=i._reverse(e.tag)},2153:(t,e,r)=>{var i=e;i._reverse=function(t){var e={};return Object.keys(t).forEach((function(r){(0|r)==r&&(r|=0);var i=t[r];e[i]=r})),e},i.der=r(4598)},2010:(t,e,r)=>{var i=r(6698),n=r(7568),o=n.base,a=n.bignum,s=n.constants.der;function f(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new h,this.tree._init(t.body)}function h(t){o.Node.call(this,"der",t)}function u(t,e){var r=t.readUInt8(e);if(t.isError(r))return r;var i=s.tagClass[r>>6],n=!(32&r);if(31&~r)r&=31;else{var o=r;for(r=0;!(128&~o);){if(o=t.readUInt8(e),t.isError(o))return o;r<<=7,r|=127&o}}return{cls:i,primitive:n,tag:r,tagStr:s.tag[r]}}function c(t,e,r){var i=t.readUInt8(r);if(t.isError(i))return i;if(!e&&128===i)return null;if(!(128&i))return i;var n=127&i;if(n>4)return t.error("length octect is too long");i=0;for(var o=0;o<n;o++){i<<=8;var a=t.readUInt8(r);if(t.isError(a))return a;i|=a}return i}t.exports=f,f.prototype.decode=function(t,e){return t instanceof o.DecoderBuffer||(t=new o.DecoderBuffer(t,e)),this.tree._decode(t,e)},i(h,o.Node),h.prototype._peekTag=function(t,e,r){if(t.isEmpty())return!1;var i=t.save(),n=u(t,'Failed to peek tag: "'+e+'"');return t.isError(n)?n:(t.restore(i),n.tag===e||n.tagStr===e||n.tagStr+"of"===e||r)},h.prototype._decodeTag=function(t,e,r){var i=u(t,'Failed to decode tag of "'+e+'"');if(t.isError(i))return i;var n=c(t,i.primitive,'Failed to get length of "'+e+'"');if(t.isError(n))return n;if(!r&&i.tag!==e&&i.tagStr!==e&&i.tagStr+"of"!==e)return t.error('Failed to match tag: "'+e+'"');if(i.primitive||null!==n)return t.skip(n,'Failed to match body of: "'+e+'"');var o=t.save(),a=this._skipUntilEnd(t,'Failed to skip indefinite length body: "'+this.tag+'"');return t.isError(a)?a:(n=t.offset-o.offset,t.restore(o),t.skip(n,'Failed to match body of: "'+e+'"'))},h.prototype._skipUntilEnd=function(t,e){for(;;){var r=u(t,e);if(t.isError(r))return r;var i,n=c(t,r.primitive,e);if(t.isError(n))return n;if(i=r.primitive||null!==n?t.skip(n):this._skipUntilEnd(t,e),t.isError(i))return i;if("end"===r.tagStr)break}},h.prototype._decodeList=function(t,e,r,i){for(var n=[];!t.isEmpty();){var o=this._peekTag(t,"end");if(t.isError(o))return o;var a=r.decode(t,"der",i);if(t.isError(a)&&o)break;n.push(a)}return n},h.prototype._decodeStr=function(t,e){if("bitstr"===e){var r=t.readUInt8();return t.isError(r)?r:{unused:r,data:t.raw()}}if("bmpstr"===e){var i=t.raw();if(i.length%2==1)return t.error("Decoding of string type: bmpstr length mismatch");for(var n="",o=0;o<i.length/2;o++)n+=String.fromCharCode(i.readUInt16BE(2*o));return n}if("numstr"===e){var a=t.raw().toString("ascii");return this._isNumstr(a)?a:t.error("Decoding of string type: numstr unsupported characters")}if("octstr"===e)return t.raw();if("objDesc"===e)return t.raw();if("printstr"===e){var s=t.raw().toString("ascii");return this._isPrintstr(s)?s:t.error("Decoding of string type: printstr unsupported characters")}return/str$/.test(e)?t.raw().toString():t.error("Decoding of string type: "+e+" unsupported")},h.prototype._decodeObjid=function(t,e,r){for(var i,n=[],o=0;!t.isEmpty();){var a=t.readUInt8();o<<=7,o|=127&a,128&a||(n.push(o),o=0)}128&a&&n.push(o);var s=n[0]/40|0,f=n[0]%40;if(i=r?n:[s,f].concat(n.slice(1)),e){var h=e[i.join(" ")];void 0===h&&(h=e[i.join(".")]),void 0!==h&&(i=h)}return i},h.prototype._decodeTime=function(t,e){var r=t.raw().toString();if("gentime"===e)var i=0|r.slice(0,4),n=0|r.slice(4,6),o=0|r.slice(6,8),a=0|r.slice(8,10),s=0|r.slice(10,12),f=0|r.slice(12,14);else{if("utctime"!==e)return t.error("Decoding "+e+" time is not supported yet");i=0|r.slice(0,2),n=0|r.slice(2,4),o=0|r.slice(4,6),a=0|r.slice(6,8),s=0|r.slice(8,10),f=0|r.slice(10,12),i=i<70?2e3+i:1900+i}return Date.UTC(i,n-1,o,a,s,f,0)},h.prototype._decodeNull=function(t){return null},h.prototype._decodeBool=function(t){var e=t.readUInt8();return t.isError(e)?e:0!==e},h.prototype._decodeInt=function(t,e){var r=t.raw(),i=new a(r);return e&&(i=e[i.toString(10)]||i),i},h.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getDecoder("der").tree}},2853:(t,e,r)=>{var i=e;i.der=r(2010),i.pem=r(8903)},8903:(t,e,r)=>{var i=r(6698),n=r(8287).Buffer,o=r(2010);function a(t){o.call(this,t),this.enc="pem"}i(a,o),t.exports=a,a.prototype.decode=function(t,e){for(var r=t.toString().split(/[\r\n]+/g),i=e.label.toUpperCase(),a=/^-----(BEGIN|END) ([^-]+)-----$/,s=-1,f=-1,h=0;h<r.length;h++){var u=r[h].match(a);if(null!==u&&u[2]===i){if(-1!==s){if("END"!==u[1])break;f=h;break}if("BEGIN"!==u[1])break;s=h}}if(-1===s||-1===f)throw new Error("PEM section not found for: "+i);var c=r.slice(s+1,f).join("");c.replace(/[^a-z0-9\+\/=]+/gi,"");var d=new n(c,"base64");return o.prototype.decode.call(this,d,e)}},82:(t,e,r)=>{var i=r(6698),n=r(8287).Buffer,o=r(7568),a=o.base,s=o.constants.der;function f(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new h,this.tree._init(t.body)}function h(t){a.Node.call(this,"der",t)}function u(t){return t<10?"0"+t:t}t.exports=f,f.prototype.encode=function(t,e){return this.tree._encode(t,e).join()},i(h,a.Node),h.prototype._encodeComposite=function(t,e,r,i){var o,a=function(t,e,r,i){var n;if("seqof"===t?t="seq":"setof"===t&&(t="set"),s.tagByName.hasOwnProperty(t))n=s.tagByName[t];else{if("number"!=typeof t||(0|t)!==t)return i.error("Unknown tag: "+t);n=t}return n>=31?i.error("Multi-octet tag encoding unsupported"):(e||(n|=32),n|=s.tagClassByName[r||"universal"]<<6)}(t,e,r,this.reporter);if(i.length<128)return(o=new n(2))[0]=a,o[1]=i.length,this._createEncoderBuffer([o,i]);for(var f=1,h=i.length;h>=256;h>>=8)f++;(o=new n(2+f))[0]=a,o[1]=128|f,h=1+f;for(var u=i.length;u>0;h--,u>>=8)o[h]=255&u;return this._createEncoderBuffer([o,i])},h.prototype._encodeStr=function(t,e){if("bitstr"===e)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===e){for(var r=new n(2*t.length),i=0;i<t.length;i++)r.writeUInt16BE(t.charCodeAt(i),2*i);return this._createEncoderBuffer(r)}return"numstr"===e?this._isNumstr(t)?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===e?this._isPrintstr(t)?this._createEncoderBuffer(t):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(e)||"objDesc"===e?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: "+e+" unsupported")},h.prototype._encodeObjid=function(t,e,r){if("string"==typeof t){if(!e)return this.reporter.error("string objid given, but no values map found");if(!e.hasOwnProperty(t))return this.reporter.error("objid not found in values map");t=e[t].split(/[\s\.]+/g);for(var i=0;i<t.length;i++)t[i]|=0}else if(Array.isArray(t))for(t=t.slice(),i=0;i<t.length;i++)t[i]|=0;if(!Array.isArray(t))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(t));if(!r){if(t[1]>=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,40*t[0]+t[1])}var o=0;for(i=0;i<t.length;i++){var a=t[i];for(o++;a>=128;a>>=7)o++}var s=new n(o),f=s.length-1;for(i=t.length-1;i>=0;i--)for(a=t[i],s[f--]=127&a;(a>>=7)>0;)s[f--]=128|127&a;return this._createEncoderBuffer(s)},h.prototype._encodeTime=function(t,e){var r,i=new Date(t);return"gentime"===e?r=[u(i.getFullYear()),u(i.getUTCMonth()+1),u(i.getUTCDate()),u(i.getUTCHours()),u(i.getUTCMinutes()),u(i.getUTCSeconds()),"Z"].join(""):"utctime"===e?r=[u(i.getFullYear()%100),u(i.getUTCMonth()+1),u(i.getUTCDate()),u(i.getUTCHours()),u(i.getUTCMinutes()),u(i.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+e+" time is not supported yet"),this._encodeStr(r,"octstr")},h.prototype._encodeNull=function(){return this._createEncoderBuffer("")},h.prototype._encodeInt=function(t,e){if("string"==typeof t){if(!e)return this.reporter.error("String int or enum given, but no values map");if(!e.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=e[t]}if("number"!=typeof t&&!n.isBuffer(t)){var r=t.toArray();!t.sign&&128&r[0]&&r.unshift(0),t=new n(r)}if(n.isBuffer(t)){var i=t.length;0===t.length&&i++;var o=new n(i);return t.copy(o),0===t.length&&(o[0]=0),this._createEncoderBuffer(o)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);i=1;for(var a=t;a>=256;a>>=8)i++;for(a=(o=new Array(i)).length-1;a>=0;a--)o[a]=255&t,t>>=8;return 128&o[0]&&o.unshift(0),this._createEncoderBuffer(new n(o))},h.prototype._encodeBool=function(t){return this._createEncoderBuffer(t?255:0)},h.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getEncoder("der").tree},h.prototype._skipDefault=function(t,e,r){var i,n=this._baseState;if(null===n.default)return!1;var o=t.join();if(void 0===n.defaultBuffer&&(n.defaultBuffer=this._encodeValue(n.default,e,r).join()),o.length!==n.defaultBuffer.length)return!1;for(i=0;i<o.length;i++)if(o[i]!==n.defaultBuffer[i])return!1;return!0}},4669:(t,e,r)=>{var i=e;i.der=r(82),i.pem=r(735)},735:(t,e,r)=>{var i=r(6698),n=r(82);function o(t){n.call(this,t),this.enc="pem"}i(o,n),t.exports=o,o.prototype.encode=function(t,e){for(var r=n.prototype.encode.call(this,t).toString("base64"),i=["-----BEGIN "+e.label+"-----"],o=0;o<r.length;o+=64)i.push(r.slice(o,o+64));return i.push("-----END "+e.label+"-----"),i.join("\n")}},7526:(t,e)=>{"use strict";e.byteLength=function(t){var e=s(t),r=e[0],i=e[1];return 3*(r+i)/4-i},e.toByteArray=function(t){var e,r,o=s(t),a=o[0],f=o[1],h=new n(function(t,e,r){return 3*(e+r)/4-r}(0,a,f)),u=0,c=f>0?a-4:a;for(r=0;r<c;r+=4)e=i[t.charCodeAt(r)]<<18|i[t.charCodeAt(r+1)]<<12|i[t.charCodeAt(r+2)]<<6|i[t.charCodeAt(r+3)],h[u++]=e>>16&255,h[u++]=e>>8&255,h[u++]=255&e;return 2===f&&(e=i[t.charCodeAt(r)]<<2|i[t.charCodeAt(r+1)]>>4,h[u++]=255&e),1===f&&(e=i[t.charCodeAt(r)]<<10|i[t.charCodeAt(r+1)]<<4|i[t.charCodeAt(r+2)]>>2,h[u++]=e>>8&255,h[u++]=255&e),h},e.fromByteArray=function(t){for(var e,i=t.length,n=i%3,o=[],a=16383,s=0,h=i-n;s<h;s+=a)o.push(f(t,s,s+a>h?h:s+a));return 1===n?(e=t[i-1],o.push(r[e>>2]+r[e<<4&63]+"==")):2===n&&(e=(t[i-2]<<8)+t[i-1],o.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),o.join("")};for(var r=[],i=[],n="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)r[a]=o[a],i[o.charCodeAt(a)]=a;function s(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function f(t,e,i){for(var n,o,a=[],s=e;s<i;s+=3)n=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),a.push(r[(o=n)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},1594:function(t,e,r){var i;!function(){"use strict";var n,o=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a=Math.ceil,s=Math.floor,f="[BigNumber Error] ",h=f+"Number primitive has more than 15 significant digits: ",u=1e14,c=14,d=9007199254740991,l=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],p=1e7,b=1e9;function m(t){var e=0|t;return t>0||t===e?e:e-1}function g(t){for(var e,r,i=1,n=t.length,o=t[0]+"";i<n;){for(e=t[i++]+"",r=c-e.length;r--;e="0"+e);o+=e}for(n=o.length;48===o.charCodeAt(--n););return o.slice(0,n+1||1)}function v(t,e){var r,i,n=t.c,o=e.c,a=t.s,s=e.s,f=t.e,h=e.e;if(!a||!s)return null;if(r=n&&!n[0],i=o&&!o[0],r||i)return r?i?0:-s:a;if(a!=s)return a;if(r=a<0,i=f==h,!n||!o)return i?0:!n^r?1:-1;if(!i)return f>h^r?1:-1;for(s=(f=n.length)<(h=o.length)?f:h,a=0;a<s;a++)if(n[a]!=o[a])return n[a]>o[a]^r?1:-1;return f==h?0:f>h^r?1:-1}function y(t,e,r,i){if(t<e||t>r||t!==s(t))throw Error(f+(i||"Argument")+("number"==typeof t?t<e||t>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function _(t){var e=t.c.length-1;return m(t.e/c)==e&&t.c[e]%2!=0}function w(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function M(t,e,r){var i,n;if(e<0){for(n=r+".";++e;n+=r);t=n+t}else if(++e>(i=t.length)){for(n=r,e-=i;--e;n+=r);t+=n}else e<i&&(t=t.slice(0,e)+"."+t.slice(e));return t}n=function t(e){var r,i,n,S,E,k,A,O,I,R,x=V.prototype={constructor:V,toString:null,valueOf:null},T=new V(1),B=20,L=4,P=-7,N=21,C=-1e7,j=1e7,D=!1,U=1,q=0,z={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},F="0123456789abcdefghijklmnopqrstuvwxyz",K=!0;function V(t,e){var r,a,f,u,l,p,b,m,g=this;if(!(g instanceof V))return new V(t,e);if(null==e){if(t&&!0===t._isBigNumber)return g.s=t.s,void(!t.c||t.e>j?g.c=g.e=null:t.e<C?g.c=[g.e=0]:(g.e=t.e,g.c=t.c.slice()));if((p="number"==typeof t)&&0*t==0){if(g.s=1/t<0?(t=-t,-1):1,t===~~t){for(u=0,l=t;l>=10;l/=10,u++);return void(u>j?g.c=g.e=null:(g.e=u,g.c=[t]))}m=String(t)}else{if(!o.test(m=String(t)))return n(g,m,p);g.s=45==m.charCodeAt(0)?(m=m.slice(1),-1):1}(u=m.indexOf("."))>-1&&(m=m.replace(".","")),(l=m.search(/e/i))>0?(u<0&&(u=l),u+=+m.slice(l+1),m=m.substring(0,l)):u<0&&(u=m.length)}else{if(y(e,2,F.length,"Base"),10==e&&K)return Y(g=new V(t),B+g.e+1,L);if(m=String(t),p="number"==typeof t){if(0*t!=0)return n(g,m,p,e);if(g.s=1/t<0?(m=m.slice(1),-1):1,V.DEBUG&&m.replace(/^0\.0*|\./,"").length>15)throw Error(h+t)}else g.s=45===m.charCodeAt(0)?(m=m.slice(1),-1):1;for(r=F.slice(0,e),u=l=0,b=m.length;l<b;l++)if(r.indexOf(a=m.charAt(l))<0){if("."==a){if(l>u){u=b;continue}}else if(!f&&(m==m.toUpperCase()&&(m=m.toLowerCase())||m==m.toLowerCase()&&(m=m.toUpperCase()))){f=!0,l=-1,u=0;continue}return n(g,String(t),p,e)}p=!1,(u=(m=i(m,e,10,g.s)).indexOf("."))>-1?m=m.replace(".",""):u=m.length}for(l=0;48===m.charCodeAt(l);l++);for(b=m.length;48===m.charCodeAt(--b););if(m=m.slice(l,++b)){if(b-=l,p&&V.DEBUG&&b>15&&(t>d||t!==s(t)))throw Error(h+g.s*t);if((u=u-l-1)>j)g.c=g.e=null;else if(u<C)g.c=[g.e=0];else{if(g.e=u,g.c=[],l=(u+1)%c,u<0&&(l+=c),l<b){for(l&&g.c.push(+m.slice(0,l)),b-=c;l<b;)g.c.push(+m.slice(l,l+=c));l=c-(m=m.slice(l)).length}else l-=b;for(;l--;m+="0");g.c.push(+m)}}else g.c=[g.e=0]}function H(t,e,r,i){var n,o,a,s,f;if(null==r?r=L:y(r,0,8),!t.c)return t.toString();if(n=t.c[0],a=t.e,null==e)f=g(t.c),f=1==i||2==i&&(a<=P||a>=N)?w(f,a):M(f,a,"0");else if(o=(t=Y(new V(t),e,r)).e,s=(f=g(t.c)).length,1==i||2==i&&(e<=o||o<=P)){for(;s<e;f+="0",s++);f=w(f,o)}else if(e-=a,f=M(f,o,"0"),o+1>s){if(--e>0)for(f+=".";e--;f+="0");}else if((e+=o-s)>0)for(o+1==s&&(f+=".");e--;f+="0");return t.s<0&&n?"-"+f:f}function W(t,e){for(var r,i,n=1,o=new V(t[0]);n<t.length;n++)(!(i=new V(t[n])).s||(r=v(o,i))===e||0===r&&o.s===e)&&(o=i);return o}function G(t,e,r){for(var i=1,n=e.length;!e[--n];e.pop());for(n=e[0];n>=10;n/=10,i++);return(r=i+r*c-1)>j?t.c=t.e=null:r<C?t.c=[t.e=0]:(t.e=r,t.c=e),t}function Y(t,e,r,i){var n,o,f,h,d,p,b,m=t.c,g=l;if(m){t:{for(n=1,h=m[0];h>=10;h/=10,n++);if((o=e-n)<0)o+=c,f=e,d=m[p=0],b=s(d/g[n-f-1]%10);else if((p=a((o+1)/c))>=m.length){if(!i)break t;for(;m.length<=p;m.push(0));d=b=0,n=1,f=(o%=c)-c+1}else{for(d=h=m[p],n=1;h>=10;h/=10,n++);b=(f=(o%=c)-c+n)<0?0:s(d/g[n-f-1]%10)}if(i=i||e<0||null!=m[p+1]||(f<0?d:d%g[n-f-1]),i=r<4?(b||i)&&(0==r||r==(t.s<0?3:2)):b>5||5==b&&(4==r||i||6==r&&(o>0?f>0?d/g[n-f]:0:m[p-1])%10&1||r==(t.s<0?8:7)),e<1||!m[0])return m.length=0,i?(e-=t.e+1,m[0]=g[(c-e%c)%c],t.e=-e||0):m[0]=t.e=0,t;if(0==o?(m.length=p,h=1,p--):(m.length=p+1,h=g[c-o],m[p]=f>0?s(d/g[n-f]%g[f])*h:0),i)for(;;){if(0==p){for(o=1,f=m[0];f>=10;f/=10,o++);for(f=m[0]+=h,h=1;f>=10;f/=10,h++);o!=h&&(t.e++,m[0]==u&&(m[0]=1));break}if(m[p]+=h,m[p]!=u)break;m[p--]=0,h=1}for(o=m.length;0===m[--o];m.pop());}t.e>j?t.c=t.e=null:t.e<C&&(t.c=[t.e=0])}return t}function Z(t){var e,r=t.e;return null===r?t.toString():(e=g(t.c),e=r<=P||r>=N?w(e,r):M(e,r,"0"),t.s<0?"-"+e:e)}return V.clone=t,V.ROUND_UP=0,V.ROUND_DOWN=1,V.ROUND_CEIL=2,V.ROUND_FLOOR=3,V.ROUND_HALF_UP=4,V.ROUND_HALF_DOWN=5,V.ROUND_HALF_EVEN=6,V.ROUND_HALF_CEIL=7,V.ROUND_HALF_FLOOR=8,V.EUCLID=9,V.config=V.set=function(t){var e,r;if(null!=t){if("object"!=typeof t)throw Error(f+"Object expected: "+t);if(t.hasOwnProperty(e="DECIMAL_PLACES")&&(y(r=t[e],0,b,e),B=r),t.hasOwnProperty(e="ROUNDING_MODE")&&(y(r=t[e],0,8,e),L=r),t.hasOwnProperty(e="EXPONENTIAL_AT")&&((r=t[e])&&r.pop?(y(r[0],-b,0,e),y(r[1],0,b,e),P=r[0],N=r[1]):(y(r,-b,b,e),P=-(N=r<0?-r:r))),t.hasOwnProperty(e="RANGE"))if((r=t[e])&&r.pop)y(r[0],-b,-1,e),y(r[1],1,b,e),C=r[0],j=r[1];else{if(y(r,-b,b,e),!r)throw Error(f+e+" cannot be zero: "+r);C=-(j=r<0?-r:r)}if(t.hasOwnProperty(e="CRYPTO")){if((r=t[e])!==!!r)throw Error(f+e+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw D=!r,Error(f+"crypto unavailable");D=r}else D=r}if(t.hasOwnProperty(e="MODULO_MODE")&&(y(r=t[e],0,9,e),U=r),t.hasOwnProperty(e="POW_PRECISION")&&(y(r=t[e],0,b,e),q=r),t.hasOwnProperty(e="FORMAT")){if("object"!=typeof(r=t[e]))throw Error(f+e+" not an object: "+r);z=r}if(t.hasOwnProperty(e="ALPHABET")){if("string"!=typeof(r=t[e])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(f+e+" invalid: "+r);K="0123456789"==r.slice(0,10),F=r}}return{DECIMAL_PLACES:B,ROUNDING_MODE:L,EXPONENTIAL_AT:[P,N],RANGE:[C,j],CRYPTO:D,MODULO_MODE:U,POW_PRECISION:q,FORMAT:z,ALPHABET:F}},V.isBigNumber=function(t){if(!t||!0!==t._isBigNumber)return!1;if(!V.DEBUG)return!0;var e,r,i=t.c,n=t.e,o=t.s;t:if("[object Array]"=={}.toString.call(i)){if((1===o||-1===o)&&n>=-b&&n<=b&&n===s(n)){if(0===i[0]){if(0===n&&1===i.length)return!0;break t}if((e=(n+1)%c)<1&&(e+=c),String(i[0]).length==e){for(e=0;e<i.length;e++)if((r=i[e])<0||r>=u||r!==s(r))break t;if(0!==r)return!0}}}else if(null===i&&null===n&&(null===o||1===o||-1===o))return!0;throw Error(f+"Invalid BigNumber: "+t)},V.maximum=V.max=function(){return W(arguments,-1)},V.minimum=V.min=function(){return W(arguments,1)},V.random=(S=9007199254740992,E=Math.random()*S&2097151?function(){return s(Math.random()*S)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(t){var e,r,i,n,o,h=0,u=[],d=new V(T);if(null==t?t=B:y(t,0,b),n=a(t/c),D)if(crypto.getRandomValues){for(e=crypto.getRandomValues(new Uint32Array(n*=2));h<n;)(o=131072*e[h]+(e[h+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),e[h]=r[0],e[h+1]=r[1]):(u.push(o%1e14),h+=2);h=n/2}else{if(!crypto.randomBytes)throw D=!1,Error(f+"crypto unavailable");for(e=crypto.randomBytes(n*=7);h<n;)(o=281474976710656*(31&e[h])+1099511627776*e[h+1]+4294967296*e[h+2]+16777216*e[h+3]+(e[h+4]<<16)+(e[h+5]<<8)+e[h+6])>=9e15?crypto.randomBytes(7).copy(e,h):(u.push(o%1e14),h+=7);h=n/7}if(!D)for(;h<n;)(o=E())<9e15&&(u[h++]=o%1e14);for(n=u[--h],t%=c,n&&t&&(o=l[c-t],u[h]=s(n/o)*o);0===u[h];u.pop(),h--);if(h<0)u=[i=0];else{for(i=-1;0===u[0];u.splice(0,1),i-=c);for(h=1,o=u[0];o>=10;o/=10,h++);h<c&&(i-=c-h)}return d.e=i,d.c=u,d}),V.sum=function(){for(var t=1,e=arguments,r=new V(e[0]);t<e.length;)r=r.plus(e[t++]);return r},i=function(){var t="0123456789";function e(t,e,r,i){for(var n,o,a=[0],s=0,f=t.length;s<f;){for(o=a.length;o--;a[o]*=e);for(a[0]+=i.indexOf(t.charAt(s++)),n=0;n<a.length;n++)a[n]>r-1&&(null==a[n+1]&&(a[n+1]=0),a[n+1]+=a[n]/r|0,a[n]%=r)}return a.reverse()}return function(i,n,o,a,s){var f,h,u,c,d,l,p,b,m=i.indexOf("."),v=B,y=L;for(m>=0&&(c=q,q=0,i=i.replace(".",""),l=(b=new V(n)).pow(i.length-m),q=c,b.c=e(M(g(l.c),l.e,"0"),10,o,t),b.e=b.c.length),u=c=(p=e(i,n,o,s?(f=F,t):(f=t,F))).length;0==p[--c];p.pop());if(!p[0])return f.charAt(0);if(m<0?--u:(l.c=p,l.e=u,l.s=a,p=(l=r(l,b,v,y,o)).c,d=l.r,u=l.e),m=p[h=u+v+1],c=o/2,d=d||h<0||null!=p[h+1],d=y<4?(null!=m||d)&&(0==y||y==(l.s<0?3:2)):m>c||m==c&&(4==y||d||6==y&&1&p[h-1]||y==(l.s<0?8:7)),h<1||!p[0])i=d?M(f.charAt(1),-v,f.charAt(0)):f.charAt(0);else{if(p.length=h,d)for(--o;++p[--h]>o;)p[h]=0,h||(++u,p=[1].concat(p));for(c=p.length;!p[--c];);for(m=0,i="";m<=c;i+=f.charAt(p[m++]));i=M(i,u,f.charAt(0))}return i}}(),r=function(){function t(t,e,r){var i,n,o,a,s=0,f=t.length,h=e%p,u=e/p|0;for(t=t.slice();f--;)s=((n=h*(o=t[f]%p)+(i=u*o+(a=t[f]/p|0)*h)%p*p+s)/r|0)+(i/p|0)+u*a,t[f]=n%r;return s&&(t=[s].concat(t)),t}function e(t,e,r,i){var n,o;if(r!=i)o=r>i?1:-1;else for(n=o=0;n<r;n++)if(t[n]!=e[n]){o=t[n]>e[n]?1:-1;break}return o}function r(t,e,r,i){for(var n=0;r--;)t[r]-=n,n=t[r]<e[r]?1:0,t[r]=n*i+t[r]-e[r];for(;!t[0]&&t.length>1;t.splice(0,1));}return function(i,n,o,a,f){var h,d,l,p,b,g,v,y,_,w,M,S,E,k,A,O,I,R=i.s==n.s?1:-1,x=i.c,T=n.c;if(!(x&&x[0]&&T&&T[0]))return new V(i.s&&n.s&&(x?!T||x[0]!=T[0]:T)?x&&0==x[0]||!T?0*R:R/0:NaN);for(_=(y=new V(R)).c=[],R=o+(d=i.e-n.e)+1,f||(f=u,d=m(i.e/c)-m(n.e/c),R=R/c|0),l=0;T[l]==(x[l]||0);l++);if(T[l]>(x[l]||0)&&d--,R<0)_.push(1),p=!0;else{for(k=x.length,O=T.length,l=0,R+=2,(b=s(f/(T[0]+1)))>1&&(T=t(T,b,f),x=t(x,b,f),O=T.length,k=x.length),E=O,M=(w=x.slice(0,O)).length;M<O;w[M++]=0);I=T.slice(),I=[0].concat(I),A=T[0],T[1]>=f/2&&A++;do{if(b=0,(h=e(T,w,O,M))<0){if(S=w[0],O!=M&&(S=S*f+(w[1]||0)),(b=s(S/A))>1)for(b>=f&&(b=f-1),v=(g=t(T,b,f)).length,M=w.length;1==e(g,w,v,M);)b--,r(g,O<v?I:T,v,f),v=g.length,h=1;else 0==b&&(h=b=1),v=(g=T.slice()).length;if(v<M&&(g=[0].concat(g)),r(w,g,M,f),M=w.length,-1==h)for(;e(T,w,O,M)<1;)b++,r(w,O<M?I:T,M,f),M=w.length}else 0===h&&(b++,w=[0]);_[l++]=b,w[0]?w[M++]=x[E]||0:(w=[x[E]],M=1)}while((E++<k||null!=w[0])&&R--);p=null!=w[0],_[0]||_.splice(0,1)}if(f==u){for(l=1,R=_[0];R>=10;R/=10,l++);Y(y,o+(y.e=l+d*c-1)+1,a,p)}else y.e=d,y.r=+p;return y}}(),k=/^(-?)0([xbo])(?=\w[\w.]*$)/i,A=/^([^.]+)\.$/,O=/^\.([^.]+)$/,I=/^-?(Infinity|NaN)$/,R=/^\s*\+(?=[\w.])|^\s+|\s+$/g,n=function(t,e,r,i){var n,o=r?e:e.replace(R,"");if(I.test(o))t.s=isNaN(o)?null:o<0?-1:1;else{if(!r&&(o=o.replace(k,(function(t,e,r){return n="x"==(r=r.toLowerCase())?16:"b"==r?2:8,i&&i!=n?t:e})),i&&(n=i,o=o.replace(A,"$1").replace(O,"0.$1")),e!=o))return new V(o,n);if(V.DEBUG)throw Error(f+"Not a"+(i?" base "+i:"")+" number: "+e);t.s=null}t.c=t.e=null},x.absoluteValue=x.abs=function(){var t=new V(this);return t.s<0&&(t.s=1),t},x.comparedTo=function(t,e){return v(this,new V(t,e))},x.decimalPlaces=x.dp=function(t,e){var r,i,n,o=this;if(null!=t)return y(t,0,b),null==e?e=L:y(e,0,8),Y(new V(o),t+o.e+1,e);if(!(r=o.c))return null;if(i=((n=r.length-1)-m(this.e/c))*c,n=r[n])for(;n%10==0;n/=10,i--);return i<0&&(i=0),i},x.dividedBy=x.div=function(t,e){return r(this,new V(t,e),B,L)},x.dividedToIntegerBy=x.idiv=function(t,e){return r(this,new V(t,e),0,1)},x.exponentiatedBy=x.pow=function(t,e){var r,i,n,o,h,u,d,l,p=this;if((t=new V(t)).c&&!t.isInteger())throw Error(f+"Exponent not an integer: "+Z(t));if(null!=e&&(e=new V(e)),h=t.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!t.c||!t.c[0])return l=new V(Math.pow(+Z(p),h?t.s*(2-_(t)):+Z(t))),e?l.mod(e):l;if(u=t.s<0,e){if(e.c?!e.c[0]:!e.s)return new V(NaN);(i=!u&&p.isInteger()&&e.isInteger())&&(p=p.mod(e))}else{if(t.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||h&&p.c[1]>=24e7:p.c[0]<8e13||h&&p.c[0]<=9999975e7)))return o=p.s<0&&_(t)?-0:0,p.e>-1&&(o=1/o),new V(u?1/o:o);q&&(o=a(q/c+2))}for(h?(r=new V(.5),u&&(t.s=1),d=_(t)):d=(n=Math.abs(+Z(t)))%2,l=new V(T);;){if(d){if(!(l=l.times(p)).c)break;o?l.c.length>o&&(l.c.length=o):i&&(l=l.mod(e))}if(n){if(0===(n=s(n/2)))break;d=n%2}else if(Y(t=t.times(r),t.e+1,1),t.e>14)d=_(t);else{if(0==(n=+Z(t)))break;d=n%2}p=p.times(p),o?p.c&&p.c.length>o&&(p.c.length=o):i&&(p=p.mod(e))}return i?l:(u&&(l=T.div(l)),e?l.mod(e):o?Y(l,q,L,void 0):l)},x.integerValue=function(t){var e=new V(this);return null==t?t=L:y(t,0,8),Y(e,e.e+1,t)},x.isEqualTo=x.eq=function(t,e){return 0===v(this,new V(t,e))},x.isFinite=function(){return!!this.c},x.isGreaterThan=x.gt=function(t,e){return v(this,new V(t,e))>0},x.isGreaterThanOrEqualTo=x.gte=function(t,e){return 1===(e=v(this,new V(t,e)))||0===e},x.isInteger=function(){return!!this.c&&m(this.e/c)>this.c.length-2},x.isLessThan=x.lt=function(t,e){return v(this,new V(t,e))<0},x.isLessThanOrEqualTo=x.lte=function(t,e){return-1===(e=v(this,new V(t,e)))||0===e},x.isNaN=function(){return!this.s},x.isNegative=function(){return this.s<0},x.isPositive=function(){return this.s>0},x.isZero=function(){return!!this.c&&0==this.c[0]},x.minus=function(t,e){var r,i,n,o,a=this,s=a.s;if(e=(t=new V(t,e)).s,!s||!e)return new V(NaN);if(s!=e)return t.s=-e,a.plus(t);var f=a.e/c,h=t.e/c,d=a.c,l=t.c;if(!f||!h){if(!d||!l)return d?(t.s=-e,t):new V(l?a:NaN);if(!d[0]||!l[0])return l[0]?(t.s=-e,t):new V(d[0]?a:3==L?-0:0)}if(f=m(f),h=m(h),d=d.slice(),s=f-h){for((o=s<0)?(s=-s,n=d):(h=f,n=l),n.reverse(),e=s;e--;n.push(0));n.reverse()}else for(i=(o=(s=d.length)<(e=l.length))?s:e,s=e=0;e<i;e++)if(d[e]!=l[e]){o=d[e]<l[e];break}if(o&&(n=d,d=l,l=n,t.s=-t.s),(e=(i=l.length)-(r=d.length))>0)for(;e--;d[r++]=0);for(e=u-1;i>s;){if(d[--i]<l[i]){for(r=i;r&&!d[--r];d[r]=e);--d[r],d[i]+=u}d[i]-=l[i]}for(;0==d[0];d.splice(0,1),--h);return d[0]?G(t,d,h):(t.s=3==L?-1:1,t.c=[t.e=0],t)},x.modulo=x.mod=function(t,e){var i,n,o=this;return t=new V(t,e),!o.c||!t.s||t.c&&!t.c[0]?new V(NaN):!t.c||o.c&&!o.c[0]?new V(o):(9==U?(n=t.s,t.s=1,i=r(o,t,0,3),t.s=n,i.s*=n):i=r(o,t,0,U),(t=o.minus(i.times(t))).c[0]||1!=U||(t.s=o.s),t)},x.multipliedBy=x.times=function(t,e){var r,i,n,o,a,s,f,h,d,l,b,g,v,y,_,w=this,M=w.c,S=(t=new V(t,e)).c;if(!(M&&S&&M[0]&&S[0]))return!w.s||!t.s||M&&!M[0]&&!S||S&&!S[0]&&!M?t.c=t.e=t.s=null:(t.s*=w.s,M&&S?(t.c=[0],t.e=0):t.c=t.e=null),t;for(i=m(w.e/c)+m(t.e/c),t.s*=w.s,(f=M.length)<(l=S.length)&&(v=M,M=S,S=v,n=f,f=l,l=n),n=f+l,v=[];n--;v.push(0));for(y=u,_=p,n=l;--n>=0;){for(r=0,b=S[n]%_,g=S[n]/_|0,o=n+(a=f);o>n;)r=((h=b*(h=M[--a]%_)+(s=g*h+(d=M[a]/_|0)*b)%_*_+v[o]+r)/y|0)+(s/_|0)+g*d,v[o--]=h%y;v[o]=r}return r?++i:v.splice(0,1),G(t,v,i)},x.negated=function(){var t=new V(this);return t.s=-t.s||null,t},x.plus=function(t,e){var r,i=this,n=i.s;if(e=(t=new V(t,e)).s,!n||!e)return new V(NaN);if(n!=e)return t.s=-e,i.minus(t);var o=i.e/c,a=t.e/c,s=i.c,f=t.c;if(!o||!a){if(!s||!f)return new V(n/0);if(!s[0]||!f[0])return f[0]?t:new V(s[0]?i:0*n)}if(o=m(o),a=m(a),s=s.slice(),n=o-a){for(n>0?(a=o,r=f):(n=-n,r=s),r.reverse();n--;r.push(0));r.reverse()}for((n=s.length)-(e=f.length)<0&&(r=f,f=s,s=r,e=n),n=0;e;)n=(s[--e]=s[e]+f[e]+n)/u|0,s[e]=u===s[e]?0:s[e]%u;return n&&(s=[n].concat(s),++a),G(t,s,a)},x.precision=x.sd=function(t,e){var r,i,n,o=this;if(null!=t&&t!==!!t)return y(t,1,b),null==e?e=L:y(e,0,8),Y(new V(o),t,e);if(!(r=o.c))return null;if(i=(n=r.length-1)*c+1,n=r[n]){for(;n%10==0;n/=10,i--);for(n=r[0];n>=10;n/=10,i++);}return t&&o.e+1>i&&(i=o.e+1),i},x.shiftedBy=function(t){return y(t,-9007199254740991,d),this.times("1e"+t)},x.squareRoot=x.sqrt=function(){var t,e,i,n,o,a=this,s=a.c,f=a.s,h=a.e,u=B+4,c=new V("0.5");if(1!==f||!s||!s[0])return new V(!f||f<0&&(!s||s[0])?NaN:s?a:1/0);if(0==(f=Math.sqrt(+Z(a)))||f==1/0?(((e=g(s)).length+h)%2==0&&(e+="0"),f=Math.sqrt(+e),h=m((h+1)/2)-(h<0||h%2),i=new V(e=f==1/0?"5e"+h:(e=f.toExponential()).slice(0,e.indexOf("e")+1)+h)):i=new V(f+""),i.c[0])for((f=(h=i.e)+u)<3&&(f=0);;)if(o=i,i=c.times(o.plus(r(a,o,u,1))),g(o.c).slice(0,f)===(e=g(i.c)).slice(0,f)){if(i.e<h&&--f,"9999"!=(e=e.slice(f-3,f+1))&&(n||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(Y(i,i.e+B+2,1),t=!i.times(i).eq(a));break}if(!n&&(Y(o,o.e+B+2,0),o.times(o).eq(a))){i=o;break}u+=4,f+=4,n=1}return Y(i,i.e+B+1,L,t)},x.toExponential=function(t,e){return null!=t&&(y(t,0,b),t++),H(this,t,e,1)},x.toFixed=function(t,e){return null!=t&&(y(t,0,b),t=t+this.e+1),H(this,t,e)},x.toFormat=function(t,e,r){var i,n=this;if(null==r)null!=t&&e&&"object"==typeof e?(r=e,e=null):t&&"object"==typeof t?(r=t,t=e=null):r=z;else if("object"!=typeof r)throw Error(f+"Argument not an object: "+r);if(i=n.toFixed(t,e),n.c){var o,a=i.split("."),s=+r.groupSize,h=+r.secondaryGroupSize,u=r.groupSeparator||"",c=a[0],d=a[1],l=n.s<0,p=l?c.slice(1):c,b=p.length;if(h&&(o=s,s=h,h=o,b-=o),s>0&&b>0){for(o=b%s||s,c=p.substr(0,o);o<b;o+=s)c+=u+p.substr(o,s);h>0&&(c+=u+p.slice(o)),l&&(c="-"+c)}i=d?c+(r.decimalSeparator||"")+((h=+r.fractionGroupSize)?d.replace(new RegExp("\\d{"+h+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):d):c}return(r.prefix||"")+i+(r.suffix||"")},x.toFraction=function(t){var e,i,n,o,a,s,h,u,d,p,b,m,v=this,y=v.c;if(null!=t&&(!(h=new V(t)).isInteger()&&(h.c||1!==h.s)||h.lt(T)))throw Error(f+"Argument "+(h.isInteger()?"out of range: ":"not an integer: ")+Z(h));if(!y)return new V(v);for(e=new V(T),d=i=new V(T),n=u=new V(T),m=g(y),a=e.e=m.length-v.e-1,e.c[0]=l[(s=a%c)<0?c+s:s],t=!t||h.comparedTo(e)>0?a>0?e:d:h,s=j,j=1/0,h=new V(m),u.c[0]=0;p=r(h,e,0,1),1!=(o=i.plus(p.times(n))).comparedTo(t);)i=n,n=o,d=u.plus(p.times(o=d)),u=o,e=h.minus(p.times(o=e)),h=o;return o=r(t.minus(i),n,0,1),u=u.plus(o.times(d)),i=i.plus(o.times(n)),u.s=d.s=v.s,b=r(d,n,a*=2,L).minus(v).abs().comparedTo(r(u,i,a,L).minus(v).abs())<1?[d,n]:[u,i],j=s,b},x.toNumber=function(){return+Z(this)},x.toPrecision=function(t,e){return null!=t&&y(t,1,b),H(this,t,e,2)},x.toString=function(t){var e,r=this,n=r.s,o=r.e;return null===o?n?(e="Infinity",n<0&&(e="-"+e)):e="NaN":(null==t?e=o<=P||o>=N?w(g(r.c),o):M(g(r.c),o,"0"):10===t&&K?e=M(g((r=Y(new V(r),B+o+1,L)).c),r.e,"0"):(y(t,2,F.length,"Base"),e=i(M(g(r.c),o,"0"),10,t,n,!0)),n<0&&r.c[0]&&(e="-"+e)),e},x.valueOf=x.toJSON=function(){return Z(this)},x._isBigNumber=!0,null!=e&&V.set(e),V}(),n.default=n.BigNumber=n,void 0===(i=function(){return n}.call(e,r,e,t))||(t.exports=i)}()},9404:function(t,e,r){!function(t,e){"use strict";function i(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var a;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(7790).Buffer}catch(t){}function s(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function f(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function h(t,e,r,i){for(var n=0,o=Math.min(t.length,r),a=e;a<o;a++){var s=t.charCodeAt(a)-48;n*=i,n+=s>=49?s-49+10:s>=17?s-17+10:s}return n}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<t.length&&(16===e?this._parseHex(t,n,r):(this._parseBase(t,e,n),"le"===r&&this._initArray(this.toArray(),e,r)))},o.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(i(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initArray=function(t,e,r){if(i("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,a,s=0;if("be"===r)for(n=t.length-1,o=0;n>=0;n-=3)a=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(n=0,o=0;n<t.length;n+=3)a=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var n,o=0,a=0;if("be"===r)for(i=t.length-1;i>=e;i-=2)n=f(t,e,i)<<o,this.words[a]|=67108863&n,o>=18?(o-=18,a+=1,this.words[a]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i<t.length;i+=2)n=f(t,e,i)<<o,this.words[a]|=67108863&n,o>=18?(o-=18,a+=1,this.words[a]|=n>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,a=o%i,s=Math.min(o,o-a)+r,f=0,u=r;u<s;u+=i)f=h(t,u,u+i,e),this.imuln(n),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f);if(0!==a){var c=1;for(f=h(t,u,t.length,e),u=0;u<a;u++)c*=e;this.imuln(c),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f)}this.strip()},o.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){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"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function l(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],a=n*o,s=67108863&a,f=a/67108864|0;r.words[0]=s;for(var h=1;h<i;h++){for(var u=f>>>26,c=67108863&f,d=Math.min(h,e.length-1),l=Math.max(0,h-t.length+1);l<=d;l++){var p=h-l|0;u+=(a=(n=0|t.words[p])*(o=0|e.words[l])+c)/67108864|0,c=67108863&a}r.words[h]=0|c,f=0|u}return 0!==f?r.words[h]=0|f:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,o=0,a=0;a<this.length;a++){var s=this.words[a],f=(16777215&(s<<n|o)).toString(16);o=s>>>24-n&16777215,(n+=2)>=26&&(n-=26,a--),r=0!==o||a!==this.length-1?u[6-f.length]+f+r:f+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var h=c[t],l=d[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var b=p.modn(l).toString(t);r=(p=p.idivn(l)).isZero()?b+r:u[h-b.length]+b+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return i(void 0!==a),this.toArrayLike(a,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),o=r||Math.max(1,n);i(n<=o,"byte array longer than desired length"),i(o>0,"Requested array length <= 0"),thi