@eluvio/elv-client-js 3.2.27 → 3.2.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
- !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r=e();for(var n in r)("object"==typeof exports?exports:t)[n]=r[n]}}(window,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=47)}([function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}t.exports=function(t){var e=r(t);return null!=t&&("object"==e||"function"==e)}},function(t,e,r){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=r(33),o="object"==("undefined"==typeof self?"undefined":n(self))&&self&&self.Object===Object&&self,a=i||o||Function("return this")();t.exports=a},function(t,e){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}t.exports=function(t){return null!=t&&"object"==r(t)}},function(t,e,r){t.exports=r(48)},function(t,e){function r(t,e,r,n,i,o,a){try{var s=t[o](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,i)}t.exports=function(t){return function(){var e=this,n=arguments;return new Promise((function(i,o){var a=t.apply(e,n);function s(t){r(a,i,o,s,u,"next",t)}function u(t){r(a,i,o,s,u,"throw",t)}s(void 0)}))}},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"===("undefined"==typeof window?"undefined":r(window))&&(n=window)}t.exports=n},function(t,e,r){var n=r(80),i=r(81),o=r(82),a=r(83),s=r(84);function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=i,u.prototype.get=o,u.prototype.has=a,u.prototype.set=s,t.exports=u},function(t,e,r){var n=r(9);t.exports=function(t,e){for(var r=t.length;r--;)if(n(t[r][0],e))return r;return-1}},function(t,e){t.exports=function(t,e){return t===e||t!=t&&e!=e}},function(t,e,r){var n=r(32),i=r(91),o=r(92),a=n?n.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":a&&a in Object(t)?i(t):o(t)}},function(t,e,r){var n=r(17)(Object,"create");t.exports=n},function(t,e,r){var n=r(106);t.exports=function(t,e){var r=t.__data__;return n(e)?r["string"==typeof e?"string":"hash"]:r.map}},function(t,e){t.exports=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){function r(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}t.exports=function(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){"use strict";(function(t){
1
+ !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r=e();for(var n in r)("object"==typeof exports?exports:t)[n]=r[n]}}(window,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=51)}([function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}t.exports=function(t){var e=r(t);return null!=t&&("object"==e||"function"==e)}},function(t,e,r){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=r(37),o="object"==("undefined"==typeof self?"undefined":n(self))&&self&&self.Object===Object&&self,a=i||o||Function("return this")();t.exports=a},function(t,e,r){t.exports=r(52)},function(t,e){function r(t,e,r,n,i,o,a){try{var s=t[o](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,i)}t.exports=function(t){return function(){var e=this,n=arguments;return new Promise((function(i,o){var a=t.apply(e,n);function s(t){r(a,i,o,s,u,"next",t)}function u(t){r(a,i,o,s,u,"throw",t)}s(void 0)}))}},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"===("undefined"==typeof window?"undefined":r(window))&&(n=window)}t.exports=n},function(t,e){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}t.exports=function(t){return null!=t&&"object"==r(t)}},function(t,e){t.exports=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){"use strict";(function(t){
2
2
  /*!
3
3
  * The buffer module from node.js, for the browser.
4
4
  *
5
5
  * @author Feross Aboukhadijeh <http://feross.org>
6
6
  * @license MIT
7
7
  */
8
- var n=r(50),i=r(51),o=r(52);function a(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(t,e){if(a()<e)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=u.prototype:(null===t&&(t=new u(e)),t.length=e),t}function u(t,e,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return h(this,t)}return c(this,t,e,r)}function c(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);u.TYPED_ARRAY_SUPPORT?(t=e).__proto__=u.prototype:t=f(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!u.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|p(e,r),i=(t=s(t,n)).write(e,r);i!==n&&(t=t.slice(0,i));return t}(t,e,r):function(t,e){if(u.isBuffer(e)){var r=0|d(e.length);return 0===(t=s(t,r)).length||e.copy(t,0,0,r),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(n=e.length)!=n?s(t,0):f(t,e);if("Buffer"===e.type&&o(e.data))return f(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function l(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function h(t,e){if(l(e),t=s(t,e<0?0:0|d(e)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function f(t,e){var r=e.length<0?0:0|d(e.length);t=s(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function d(t){if(t>=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|t}function p(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return z(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return F(t).length;default:if(n)return z(t).length;e=(""+e).toLowerCase(),n=!0}}function m(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return T(this,e,r);case"utf8":case"utf-8":return S(this,e,r);case"ascii":return I(this,e,r);case"latin1":case"binary":return M(this,e,r);case"base64":return E(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function y(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function g(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:v(t,e,r,n,i);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):v(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function v(t,e,r,n,i){var o,a=1,s=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,r/=2}function c(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var l=-1;for(o=r;o<s;o++)if(c(t,o)===c(e,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===u)return l*a}else-1!==l&&(o-=o-l),l=-1}else for(r+u>s&&(r=s-u),o=r;o>=0;o--){for(var h=!0,f=0;f<u;f++)if(c(t,o+f)!==c(e,f)){h=!1;break}if(h)return o}return-1}function b(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a<n;++a){var s=parseInt(e.substr(2*a,2),16);if(isNaN(s))return a;t[r+a]=s}return a}function w(t,e,r,n){return H(z(e,t.length-r),t,r,n)}function _(t,e,r,n){return H(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function k(t,e,r,n){return _(t,e,r,n)}function x(t,e,r,n){return H(F(e),t,r,n)}function A(t,e,r,n){return H(function(t,e){for(var r,n,i,o=[],a=0;a<t.length&&!((e-=2)<0);++a)r=t.charCodeAt(a),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function E(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function S(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,a,s,u,c=t[i],l=null,h=c>239?4:c>223?3:c>191?2:1;if(i+h<=r)switch(h){case 1:c<128&&(l=c);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&c)<<6|63&o)>127&&(l=u);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&(u=(15&c)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&c)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(l=u)}null===l?(l=65533,h=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=h}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=4096));return r}(n)}e.Buffer=u,e.SlowBuffer=function(t){+t!=t&&(t=0);return u.alloc(+t)},e.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=a(),u.poolSize=8192,u._augment=function(t){return t.__proto__=u.prototype,t},u.from=function(t,e,r){return c(null,t,e,r)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(t,e,r){return function(t,e,r,n){return l(e),e<=0?s(t,e):void 0!==r?"string"==typeof n?s(t,e).fill(r,n):s(t,e).fill(r):s(t,e)}(null,t,e,r)},u.allocUnsafe=function(t){return h(null,t)},u.allocUnsafeSlow=function(t){return h(null,t)},u.isBuffer=function(t){return!(null==t||!t._isBuffer)},u.compare=function(t,e){if(!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!o(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=u.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var a=t[r];if(!u.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,i),i+=a.length}return n},u.byteLength=p,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)y(this,e,e+1);return this},u.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)y(this,e,e+3),y(this,e+1,e+2);return this},u.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)y(this,e,e+7),y(this,e+1,e+6),y(this,e+2,e+5),y(this,e+3,e+4);return this},u.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?S(this,0,t):m.apply(this,arguments)},u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),"<Buffer "+t+">"},u.prototype.compare=function(t,e,r,n,i){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(e>>>=0),s=Math.min(o,a),c=this.slice(n,i),l=t.slice(e,r),h=0;h<s;++h)if(c[h]!==l[h]){o=c[h],a=l[h];break}return o<a?-1:a<o?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return g(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return g(this,t,e,r,!1)},u.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return b(this,t,e,r);case"utf8":case"utf-8":return w(this,t,e,r);case"ascii":return _(this,t,e,r);case"latin1":case"binary":return k(this,t,e,r);case"base64":return x(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function I(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function M(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function T(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=B(t[o]);return i}function P(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function C(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function O(t,e,r,n,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function R(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i<o;++i)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function N(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i<o;++i)t[r+i]=e>>>8*(n?i:3-i)&255}function j(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function L(t,e,r,n,o){return o||j(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function U(t,e,r,n,o){return o||j(t,0,r,8),i.write(t,e,r,n,52,8),r+8}u.prototype.slice=function(t,e){var r,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t),u.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=u.prototype;else{var i=e-t;r=new u(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+t]}return r},u.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||C(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},u.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||C(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},u.prototype.readUInt8=function(t,e){return e||C(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||C(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||C(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||C(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return e||C(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||C(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||C(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return e||C(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){e||C(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){e||C(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return e||C(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return e||C(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return e||C(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||C(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||C(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||C(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||O(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},u.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||O(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||O(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||O(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):R(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||O(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):R(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||O(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):N(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||O(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):N(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);O(this,t,e,r,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o<r&&(a*=256);)t<0&&0===s&&0!==this[e+o-1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);O(this,t,e,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||O(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||O(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):R(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||O(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):R(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||O(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):N(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||O(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):N(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,r){return L(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return L(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return U(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return U(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i,o=n-r;if(this===t&&r<e&&e<n)for(i=o-1;i>=0;--i)t[i+e]=this[i+r];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o},u.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var a=u.isBuffer(t)?t:z(new u(t,n).toString()),s=a.length;for(o=0;o<r-e;++o)this[o+e]=a[o%s]}return this};var D=/[^+\/0-9A-Za-z-_]/g;function B(t){return t<16?"0"+t.toString(16):t.toString(16)}function z(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],a=0;a<n;++a){if((r=t.charCodeAt(a))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function F(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(D,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function H(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}}).call(this,r(6))},function(t,e,r){var n=r(90),i=r(96);t.exports=function(t,e){var r=i(t,e);return n(r)?r:void 0}},function(t,e,r){var n=r(10),i=r(1);t.exports=function(t){if(!i(t))return!1;var e=n(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}},function(t,e,r){var n=r(35);t.exports=function(t,e,r){"__proto__"==e&&n?n(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}},function(t,e,r){var n=r(18),i=r(40);t.exports=function(t){return null!=t&&i(t.length)&&!n(t)}},function(t,e,r){(function(e,n){var i=r(22),o=r(4),a=r(5),s=r(13),u=r(57);function c(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function l(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?c(Object(r),!0).forEach((function(e){s(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}void 0===e&&(e=r(16).Buffer);var h,f,d,p=r(61),m=r(64).default,y=r(65),g=r(25),v=r(69),b=r(70).utils,w=b.keccak256,_=b.getAddress,k={name:"Utils",nullAddress:"0x0000000000000000000000000000000000000000",weiPerEther:new m("1000000000000000000"),ToBigNumber:function(t){return new m(t)},WeiToEther:function(t){return k.ToBigNumber(t).div(k.weiPerEther)},EtherToWei:function(t){return k.ToBigNumber(t).times(k.weiPerEther)},FormatAddress:function(t){return t&&"string"==typeof t?((t=t.trim()).startsWith("0x")||(t="0x"+t),t.toLowerCase()):""},FormatSignature:function(t){return t=t.replace("0x",""),"ES256K_"+p.encode(e.from(t,"hex"))},DecodeVersionHash:function(t){if(!t.startsWith("hq__")&&!t.startsWith("tq__"))throw new Error('Invalid version hash: "'.concat(t,'"'));t=t.slice(4);var r=k.FromB58(t),n=r.slice(0,32),i=n.toString("hex");r=r.slice(32);for(var o=0;r[o]>=128;)o++;o++;var a=r.slice(0,o),s=y.decode(a);return r=r.slice(o),{digest:i,size:s,objectId:"iq__"+k.B58(r),partHash:"hqp_"+k.B58(e.concat([n,a]))}},DecodeSignedToken:function(t){var r=k.FromB58(t.slice(6)),n="0x".concat(r.slice(0,65).toString("hex")),i=JSON.parse(e.from(v.inflateRaw(r.slice(65))).toString("utf-8"));return i.adr=k.FormatAddress("0x".concat(e.from(i.adr,"base64").toString("hex"))),{payload:i,signature:n}},DecodeWriteToken:function(t){if(t.length<4)throw new Error('Invalid write token: ["'.concat(t,'"] (unknown prefix)'));var e;if(t.startsWith("tqw__")?(e="tq__",t=t.slice(5)):(e=t.slice(0,4),t=t.slice(4)),0===t.length)throw new Error('Invalid write token: ["'.concat(t,'"] (too short)'));switch(e){case"tqw_":case"tq__":case"tqpw":case"tqp_":case"tlro":break;default:throw new Error('Invalid write token: ["'.concat(t,'"] (unknown prefix)'))}var r,n,i,o,a,s=k.FromB58(t);function u(t,e){var r,n,i=y.decode(s,0),o=y.decode.bytes;return n=t?0===(r=s.slice(o+1,i+o)).length?"":e+k.B58(r):"0x"+(r=s.slice(o,i+o)).toString("hex"),s=s.slice(i+o),n}switch(e){case"tqw_":case"tqpw":r="0x"+s.toString("hex");break;case"tlro":case"tq__":n=u(!0,"iq__"),i=u(!0,"inod"),r=u(!1,"");break;case"tqp_":if(s.length<3)throw new Error('Invalid write token: ["'.concat(t,'"] (token truncated)'));o=s[0],a=s[1],s=s.slice(2),r=u(!1,"");break;default:throw new Error('Invalid write token: ["'.concat(t,'"] (unknown prefix)'))}return{tokenType:e,tokenId:r,objectId:n,nodeId:i,scheme:o,flags:a}},AddressToHash:function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t=t.replace(r?"0x04":"0x",""),p.encode(e.from(t,"hex"))},AddressToSpaceId:function(t){return"ispc"+k.AddressToHash(t)},AddressToLibraryId:function(t){return"ilib"+k.AddressToHash(t)},AddressToObjectId:function(t){return"iq__"+k.AddressToHash(t)},HashToAddress:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t=e?t:t.substr(4),k.FormatAddress((e?"0x04":"0x")+p.decode(t).toString("hex"))},EqualAddress:function(t,e){return!(!t||!e)&&k.FormatAddress(t)===k.FormatAddress(e)},EqualHash:function(t,e){return!(!t||!e)&&(!(t.length<=4||e.length<=4)&&k.HashToAddress(t)===k.HashToAddress(e))},ValidAddress:function(t){try{return _(t),!0}catch(t){return!1}},ValidHash:function(t){return k.ValidAddress(k.HashToAddress(t))},ToBytes32:function(t){return"0x"+t.split("").map((function(t){return t.charCodeAt(0).toString(16)})).join("").slice(0,64).padEnd(64,"0")},BufferToArrayBuffer:function(t){return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)},B64:function(t){return e.from(t,"utf-8").toString("base64")},FromB64:function(t){return e.from(t,"base64").toString("utf-8")},FromB64URL:function(t){var e=(t=t.replace(/-/g,"+").replace(/_/g,"/")).length%4;if(e){if(1===e)throw new Error("InvalidLengthError: Input base64url string is the wrong length to determine padding");t+=new Array(5-e).join("=")}return k.FromB64(t)},B58:function(t){return p.encode(e.from(t))},FromB58:function(t){return p.decode(t)},FromB58ToStr:function(t){return(new TextDecoder).decode(k.FromB58(t))},DecodeAuthorizationToken:function(t){var e=(t=decodeURIComponent(t)).split("."),r=u(e,2),n=r[0],i=r[1];return l(l({},n=JSON.parse(k.FromB64(n))),{},{signature:i})},LimitedMap:(d=a(o.mark((function t(e,r,n){var s,u,c,l,h;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s=0,u=!1,c=function(){var t=a(o.mark((function t(){var e;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!u){t.next=5;break}return t.next=3,new Promise((function(t){return setTimeout(t,10)}));case 3:t.next=0;break;case 5:return u=!0,e=s,s+=1,u=!1,t.abrupt("return",e);case 10:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),l=[],h=0,t.abrupt("return",new Promise((function(t,s){i(Array(e||1)).forEach(a(o.mark((function e(){var i;return o.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return h+=1,e.next=3,c();case 3:i=e.sent;case 4:if(!(i<r.length)){e.next=19;break}return e.prev=5,e.next=8,n(r[i],i);case 8:l[i]=e.sent,e.next=14;break;case 11:e.prev=11,e.t0=e.catch(5),s(e.t0);case 14:return e.next=16,c();case 16:i=e.sent,e.next=4;break;case 19:0==(h-=1)&&t(l);case 21:case"end":return e.stop()}}),e,null,[[5,11]])}))))})));case 6:case"end":return t.stop()}}),t)}))),function(t,e,r){return d.apply(this,arguments)}),ResponseToJson:(f=a(o.mark((function t(e){return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",k.ResponseToFormat("json",e));case 1:case"end":return t.stop()}}),t)}))),function(t){return f.apply(this,arguments)}),ResponseToFormat:(h=a(o.mark((function t(e,r){return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r;case 2:r=t.sent,t.t0=e.toLowerCase(),t.next="json"===t.t0?6:"text"===t.t0?9:"blob"===t.t0?12:"arraybuffer"===t.t0?15:"formdata"===t.t0?18:"buffer"===t.t0?21:24;break;case 6:return t.next=8,r.json();case 8:return t.abrupt("return",t.sent);case 9:return t.next=11,r.text();case 11:return t.abrupt("return",t.sent);case 12:return t.next=14,r.blob();case 14:return t.abrupt("return",t.sent);case 15:return t.next=17,r.arrayBuffer();case 17:return t.abrupt("return",t.sent);case 18:return t.next=20,r.formData();case 20:return t.abrupt("return",t.sent);case 21:return t.next=23,r.buffer();case 23:return t.abrupt("return",t.sent);case 24:return t.abrupt("return",r);case 25:case"end":return t.stop()}}),t)}))),function(t,e){return h.apply(this,arguments)}),ResizeImage:function(t){var e=t.imageUrl,r=t.height;return!e||e&&!e.startsWith("http")?e:(e=g(e).removeSearch("height").removeSearch("header-x_image_height"),r&&!isNaN(parseInt(r))&&e.addSearch("height",parseInt(r)),e.toString())},SafeTraverse:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];if(!t)return t;1===r.length&&Array.isArray(r[0])&&(r=r[0]);for(var i=t,o=0;o<r.length;o++)if(void 0===(i=i[r[o]]))return;return i},IsCloneable:function(t){if(Object(t)!==t)return!0;switch({}.toString.call(t).slice(8,-1)){case"Boolean":case"Number":case"String":case"Date":case"RegExp":case"Blob":case"FileList":case"ImageData":case"ImageBitmap":case"ArrayBuffer":return!0;case"Array":case"Object":return Object.keys(t).every((function(e){return k.IsCloneable(t[e])}));case"Map":return i(t.keys()).every(k.IsCloneable)&&i(t.values()).every(k.IsCloneable);case"Set":return i(t.keys()).every(k.IsCloneable);default:return!1}},MakeClonable:function(t){if(k.IsCloneable(t))return t;if(e.isBuffer(t))return k.BufferToArrayBuffer(t);switch({}.toString.call(t).slice(8,-1)){case"Response":case"Function":return;case"Boolean":case"Number":case"String":case"Date":case"RegExp":case"Blob":case"FileList":case"ImageData":case"ImageBitmap":case"ArrayBuffer":return t;case"Array":return t.map((function(t){return k.MakeClonable(t)}));case"Set":return new Set(Array.from(t.keys()).map((function(t){return k.MakeClonable(t)})));case"Map":var r=new Map;return Array.from(t.keys()).forEach((function(e){var n=k.MakeClonable(t.get(e));n&&r.set(e,n)})),r;case"Error":return t.message;case"Object":var n={};return Object.keys(t).map((function(e){var r=k.MakeClonable(t[e]);r&&(n[e]=r)})),n;default:return JSON.parse(JSON.stringify(t))}},PublicKeyToAddress:function(t){var r=new Uint8Array(e.from(t.replace("0x04",""),"hex")),n="0x"+w(r).slice(26);return k.FormatAddress(n)},PLATFORM_NODE:"node",PLATFORM_WEB:"web",PLATFORM_REACT_NATIVE:"react-native",Platform:function(){return"undefined"!=typeof navigator&&"ReactNative"===navigator.product?k.PLATFORM_REACT_NATIVE:void 0!==n&&void 0!==n.versions&&void 0!==n.versions.node?k.PLATFORM_NODE:k.PLATFORM_WEB}};t.exports=k}).call(this,r(16).Buffer,r(53))},function(t,e,r){var n=r(54),i=r(55),o=r(24),a=r(56);t.exports=function(t){return n(t)||i(t)||o(t)||a()},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){var n=r(23);t.exports=function(t,e){if(t){if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){(function(t){var n,i,o;function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}
8
+ var n=r(54),i=r(55),o=r(56);function a(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(t,e){if(a()<e)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=u.prototype:(null===t&&(t=new u(e)),t.length=e),t}function u(t,e,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return h(this,t)}return c(this,t,e,r)}function c(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);u.TYPED_ARRAY_SUPPORT?(t=e).__proto__=u.prototype:t=f(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!u.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|p(e,r),i=(t=s(t,n)).write(e,r);i!==n&&(t=t.slice(0,i));return t}(t,e,r):function(t,e){if(u.isBuffer(e)){var r=0|d(e.length);return 0===(t=s(t,r)).length||e.copy(t,0,0,r),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(n=e.length)!=n?s(t,0):f(t,e);if("Buffer"===e.type&&o(e.data))return f(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function l(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function h(t,e){if(l(e),t=s(t,e<0?0:0|d(e)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function f(t,e){var r=e.length<0?0:0|d(e.length);t=s(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function d(t){if(t>=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|t}function p(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return z(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return H(t).length;default:if(n)return z(t).length;e=(""+e).toLowerCase(),n=!0}}function y(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return T(this,e,r);case"utf8":case"utf-8":return E(this,e,r);case"ascii":return S(this,e,r);case"latin1":case"binary":return M(this,e,r);case"base64":return I(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function m(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function v(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:g(t,e,r,n,i);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):g(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function g(t,e,r,n,i){var o,a=1,s=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,r/=2}function c(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var l=-1;for(o=r;o<s;o++)if(c(t,o)===c(e,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===u)return l*a}else-1!==l&&(o-=o-l),l=-1}else for(r+u>s&&(r=s-u),o=r;o>=0;o--){for(var h=!0,f=0;f<u;f++)if(c(t,o+f)!==c(e,f)){h=!1;break}if(h)return o}return-1}function b(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a<n;++a){var s=parseInt(e.substr(2*a,2),16);if(isNaN(s))return a;t[r+a]=s}return a}function w(t,e,r,n){return F(z(e,t.length-r),t,r,n)}function _(t,e,r,n){return F(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function k(t,e,r,n){return _(t,e,r,n)}function x(t,e,r,n){return F(H(e),t,r,n)}function A(t,e,r,n){return F(function(t,e){for(var r,n,i,o=[],a=0;a<t.length&&!((e-=2)<0);++a)r=t.charCodeAt(a),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function I(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function E(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,a,s,u,c=t[i],l=null,h=c>239?4:c>223?3:c>191?2:1;if(i+h<=r)switch(h){case 1:c<128&&(l=c);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&c)<<6|63&o)>127&&(l=u);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&(u=(15&c)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&c)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(l=u)}null===l?(l=65533,h=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=h}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=4096));return r}(n)}e.Buffer=u,e.SlowBuffer=function(t){+t!=t&&(t=0);return u.alloc(+t)},e.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=a(),u.poolSize=8192,u._augment=function(t){return t.__proto__=u.prototype,t},u.from=function(t,e,r){return c(null,t,e,r)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(t,e,r){return function(t,e,r,n){return l(e),e<=0?s(t,e):void 0!==r?"string"==typeof n?s(t,e).fill(r,n):s(t,e).fill(r):s(t,e)}(null,t,e,r)},u.allocUnsafe=function(t){return h(null,t)},u.allocUnsafeSlow=function(t){return h(null,t)},u.isBuffer=function(t){return!(null==t||!t._isBuffer)},u.compare=function(t,e){if(!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!o(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=u.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var a=t[r];if(!u.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,i),i+=a.length}return n},u.byteLength=p,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)m(this,e,e+1);return this},u.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)m(this,e,e+3),m(this,e+1,e+2);return this},u.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)m(this,e,e+7),m(this,e+1,e+6),m(this,e+2,e+5),m(this,e+3,e+4);return this},u.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?E(this,0,t):y.apply(this,arguments)},u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),"<Buffer "+t+">"},u.prototype.compare=function(t,e,r,n,i){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(e>>>=0),s=Math.min(o,a),c=this.slice(n,i),l=t.slice(e,r),h=0;h<s;++h)if(c[h]!==l[h]){o=c[h],a=l[h];break}return o<a?-1:a<o?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return v(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return v(this,t,e,r,!1)},u.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return b(this,t,e,r);case"utf8":case"utf-8":return w(this,t,e,r);case"ascii":return _(this,t,e,r);case"latin1":case"binary":return k(this,t,e,r);case"base64":return x(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function S(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function M(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function T(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=B(t[o]);return i}function P(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function C(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function O(t,e,r,n,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function R(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i<o;++i)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function j(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i<o;++i)t[r+i]=e>>>8*(n?i:3-i)&255}function N(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function L(t,e,r,n,o){return o||N(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function U(t,e,r,n,o){return o||N(t,0,r,8),i.write(t,e,r,n,52,8),r+8}u.prototype.slice=function(t,e){var r,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t),u.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=u.prototype;else{var i=e-t;r=new u(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+t]}return r},u.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||C(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},u.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||C(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},u.prototype.readUInt8=function(t,e){return e||C(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||C(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||C(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||C(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return e||C(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||C(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||C(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return e||C(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){e||C(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){e||C(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return e||C(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return e||C(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return e||C(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||C(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||C(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||C(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||O(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},u.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||O(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||O(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||O(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):R(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||O(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):R(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||O(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):j(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||O(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):j(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);O(this,t,e,r,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o<r&&(a*=256);)t<0&&0===s&&0!==this[e+o-1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);O(this,t,e,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||O(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||O(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):R(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||O(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):R(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||O(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):j(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||O(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):j(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,r){return L(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return L(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return U(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return U(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i,o=n-r;if(this===t&&r<e&&e<n)for(i=o-1;i>=0;--i)t[i+e]=this[i+r];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o},u.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var a=u.isBuffer(t)?t:z(new u(t,n).toString()),s=a.length;for(o=0;o<r-e;++o)this[o+e]=a[o%s]}return this};var D=/[^+\/0-9A-Za-z-_]/g;function B(t){return t<16?"0"+t.toString(16):t.toString(16)}function z(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],a=0;a<n;++a){if((r=t.charCodeAt(a))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function H(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(D,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function F(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}}).call(this,r(5))},function(t,e,r){var n=r(80),i=r(81),o=r(82),a=r(83),s=r(84);function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=i,u.prototype.get=o,u.prototype.has=a,u.prototype.set=s,t.exports=u},function(t,e,r){var n=r(11);t.exports=function(t,e){for(var r=t.length;r--;)if(n(t[r][0],e))return r;return-1}},function(t,e){t.exports=function(t,e){return t===e||t!=t&&e!=e}},function(t,e,r){var n=r(36),i=r(91),o=r(92),a=n?n.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":a&&a in Object(t)?i(t):o(t)}},function(t,e,r){var n=r(18)(Object,"create");t.exports=n},function(t,e,r){var n=r(106);t.exports=function(t,e){var r=t.__data__;return n(e)?r["string"==typeof e?"string":"hash"]:r.map}},function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){function r(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}t.exports=function(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){(function(e,n){var i=r(22),o=r(3),a=r(4),s=r(7),u=r(61);function c(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function l(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?c(Object(r),!0).forEach((function(e){s(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}void 0===e&&(e=r(8).Buffer);var h,f,d,p=r(65),y=r(68).default,m=r(69),v=r(25),g=r(73),b=r(74).utils,w=b.keccak256,_=b.getAddress,k={name:"Utils",nullAddress:"0x0000000000000000000000000000000000000000",weiPerEther:new y("1000000000000000000"),ToBigNumber:function(t){return new y(t)},WeiToEther:function(t){return k.ToBigNumber(t).div(k.weiPerEther)},EtherToWei:function(t){return k.ToBigNumber(t).times(k.weiPerEther)},FormatAddress:function(t){return t&&"string"==typeof t?((t=t.trim()).startsWith("0x")||(t="0x"+t),t.toLowerCase()):""},FormatSignature:function(t){return t=t.replace("0x",""),"ES256K_"+p.encode(e.from(t,"hex"))},DecodeVersionHash:function(t){if(!t.startsWith("hq__")&&!t.startsWith("tq__"))throw new Error('Invalid version hash: "'.concat(t,'"'));t=t.slice(4);var r=k.FromB58(t),n=r.slice(0,32),i=n.toString("hex");r=r.slice(32);for(var o=0;r[o]>=128;)o++;o++;var a=r.slice(0,o),s=m.decode(a);return r=r.slice(o),{digest:i,size:s,objectId:"iq__"+k.B58(r),partHash:"hqp_"+k.B58(e.concat([n,a]))}},DecodeSignedToken:function(t){var r=k.FromB58(t.slice(6)),n="0x".concat(r.slice(0,65).toString("hex")),i=JSON.parse(e.from(g.inflateRaw(r.slice(65))).toString("utf-8"));return i.adr=k.FormatAddress("0x".concat(e.from(i.adr,"base64").toString("hex"))),{payload:i,signature:n}},DecodeWriteToken:function(t){if(t.length<4)throw new Error('Invalid write token: ["'.concat(t,'"] (unknown prefix)'));var e;if(t.startsWith("tqw__")?(e="tq__",t=t.slice(5)):(e=t.slice(0,4),t=t.slice(4)),0===t.length)throw new Error('Invalid write token: ["'.concat(t,'"] (too short)'));switch(e){case"tqw_":case"tq__":case"tqpw":case"tqp_":case"tlro":break;default:throw new Error('Invalid write token: ["'.concat(t,'"] (unknown prefix)'))}var r,n,i,o,a,s=k.FromB58(t);function u(t,e){var r,n,i=m.decode(s,0),o=m.decode.bytes;return n=t?0===(r=s.slice(o+1,i+o)).length?"":e+k.B58(r):"0x"+(r=s.slice(o,i+o)).toString("hex"),s=s.slice(i+o),n}switch(e){case"tqw_":case"tqpw":r="0x"+s.toString("hex");break;case"tlro":case"tq__":n=u(!0,"iq__"),i=u(!0,"inod"),r=u(!1,"");break;case"tqp_":if(s.length<3)throw new Error('Invalid write token: ["'.concat(t,'"] (token truncated)'));o=s[0],a=s[1],s=s.slice(2),r=u(!1,"");break;default:throw new Error('Invalid write token: ["'.concat(t,'"] (unknown prefix)'))}return{tokenType:e,tokenId:r,objectId:n,nodeId:i,scheme:o,flags:a}},AddressToHash:function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t=t.replace(r?"0x04":"0x",""),p.encode(e.from(t,"hex"))},AddressToSpaceId:function(t){return"ispc"+k.AddressToHash(t)},AddressToLibraryId:function(t){return"ilib"+k.AddressToHash(t)},AddressToObjectId:function(t){return"iq__"+k.AddressToHash(t)},HashToAddress:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t=e?t:t.substr(4),k.FormatAddress((e?"0x04":"0x")+p.decode(t).toString("hex"))},EqualAddress:function(t,e){return!(!t||!e)&&k.FormatAddress(t)===k.FormatAddress(e)},EqualHash:function(t,e){return!(!t||!e)&&(!(t.length<=4||e.length<=4)&&k.HashToAddress(t)===k.HashToAddress(e))},ValidAddress:function(t){try{return _(t),!0}catch(t){return!1}},ValidHash:function(t){return k.ValidAddress(k.HashToAddress(t))},ToBytes32:function(t){return"0x"+t.split("").map((function(t){return t.charCodeAt(0).toString(16)})).join("").slice(0,64).padEnd(64,"0")},BufferToArrayBuffer:function(t){return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)},B64:function(t){return e.from(t,"utf-8").toString("base64")},FromB64:function(t){return e.from(t,"base64").toString("utf-8")},FromB64URL:function(t){var e=(t=t.replace(/-/g,"+").replace(/_/g,"/")).length%4;if(e){if(1===e)throw new Error("InvalidLengthError: Input base64url string is the wrong length to determine padding");t+=new Array(5-e).join("=")}return k.FromB64(t)},B58:function(t){return p.encode(e.from(t))},FromB58:function(t){return p.decode(t)},FromB58ToStr:function(t){return(new TextDecoder).decode(k.FromB58(t))},DecodeAuthorizationToken:function(t){var e=(t=decodeURIComponent(t)).split("."),r=u(e,2),n=r[0],i=r[1];return l(l({},n=JSON.parse(k.FromB64(n))),{},{signature:i})},LimitedMap:(d=a(o.mark((function t(e,r,n){var s,u,c,l,h;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s=0,u=!1,c=function(){var t=a(o.mark((function t(){var e;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!u){t.next=5;break}return t.next=3,new Promise((function(t){return setTimeout(t,10)}));case 3:t.next=0;break;case 5:return u=!0,e=s,s+=1,u=!1,t.abrupt("return",e);case 10:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),l=[],h=0,t.abrupt("return",new Promise((function(t,s){i(Array(e||1)).forEach(a(o.mark((function e(){var i;return o.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return h+=1,e.next=3,c();case 3:i=e.sent;case 4:if(!(i<r.length)){e.next=19;break}return e.prev=5,e.next=8,n(r[i],i);case 8:l[i]=e.sent,e.next=14;break;case 11:e.prev=11,e.t0=e.catch(5),s(e.t0);case 14:return e.next=16,c();case 16:i=e.sent,e.next=4;break;case 19:0==(h-=1)&&t(l);case 21:case"end":return e.stop()}}),e,null,[[5,11]])}))))})));case 6:case"end":return t.stop()}}),t)}))),function(t,e,r){return d.apply(this,arguments)}),ResponseToJson:(f=a(o.mark((function t(e){return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",k.ResponseToFormat("json",e));case 1:case"end":return t.stop()}}),t)}))),function(t){return f.apply(this,arguments)}),ResponseToFormat:(h=a(o.mark((function t(e,r){return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r;case 2:r=t.sent,t.t0=e.toLowerCase(),t.next="json"===t.t0?6:"text"===t.t0?9:"blob"===t.t0?12:"arraybuffer"===t.t0?15:"formdata"===t.t0?18:"buffer"===t.t0?21:24;break;case 6:return t.next=8,r.json();case 8:return t.abrupt("return",t.sent);case 9:return t.next=11,r.text();case 11:return t.abrupt("return",t.sent);case 12:return t.next=14,r.blob();case 14:return t.abrupt("return",t.sent);case 15:return t.next=17,r.arrayBuffer();case 17:return t.abrupt("return",t.sent);case 18:return t.next=20,r.formData();case 20:return t.abrupt("return",t.sent);case 21:return t.next=23,r.buffer();case 23:return t.abrupt("return",t.sent);case 24:return t.abrupt("return",r);case 25:case"end":return t.stop()}}),t)}))),function(t,e){return h.apply(this,arguments)}),ResizeImage:function(t){var e=t.imageUrl,r=t.height;return!e||e&&!e.startsWith("http")?e:(e=v(e).removeSearch("height").removeSearch("header-x_image_height"),r&&!isNaN(parseInt(r))&&e.addSearch("height",parseInt(r)),e.toString())},SafeTraverse:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];if(!t)return t;1===r.length&&Array.isArray(r[0])&&(r=r[0]);for(var i=t,o=0;o<r.length;o++)if(void 0===(i=i[r[o]]))return;return i},IsCloneable:function(t){if(Object(t)!==t)return!0;switch({}.toString.call(t).slice(8,-1)){case"Boolean":case"Number":case"String":case"Date":case"RegExp":case"Blob":case"FileList":case"ImageData":case"ImageBitmap":case"ArrayBuffer":return!0;case"Array":case"Object":return Object.keys(t).every((function(e){return k.IsCloneable(t[e])}));case"Map":return i(t.keys()).every(k.IsCloneable)&&i(t.values()).every(k.IsCloneable);case"Set":return i(t.keys()).every(k.IsCloneable);default:return!1}},MakeClonable:function(t){if(k.IsCloneable(t))return t;if(e.isBuffer(t))return k.BufferToArrayBuffer(t);switch({}.toString.call(t).slice(8,-1)){case"Response":case"Function":return;case"Boolean":case"Number":case"String":case"Date":case"RegExp":case"Blob":case"FileList":case"ImageData":case"ImageBitmap":case"ArrayBuffer":return t;case"Array":return t.map((function(t){return k.MakeClonable(t)}));case"Set":return new Set(Array.from(t.keys()).map((function(t){return k.MakeClonable(t)})));case"Map":var r=new Map;return Array.from(t.keys()).forEach((function(e){var n=k.MakeClonable(t.get(e));n&&r.set(e,n)})),r;case"Error":return t.message;case"Object":var n={};return Object.keys(t).map((function(e){var r=k.MakeClonable(t[e]);r&&(n[e]=r)})),n;default:return JSON.parse(JSON.stringify(t))}},PublicKeyToAddress:function(t){var r=new Uint8Array(e.from(t.replace("0x04",""),"hex")),n="0x"+w(r).slice(26);return k.FormatAddress(n)},PLATFORM_NODE:"node",PLATFORM_WEB:"web",PLATFORM_REACT_NATIVE:"react-native",Platform:function(){return"undefined"!=typeof navigator&&"ReactNative"===navigator.product?k.PLATFORM_REACT_NATIVE:void 0!==n&&void 0!==n.versions&&void 0!==n.versions.node?k.PLATFORM_NODE:k.PLATFORM_WEB}};t.exports=k}).call(this,r(8).Buffer,r(57))},function(t,e,r){var n=r(90),i=r(96);t.exports=function(t,e){var r=i(t,e);return n(r)?r:void 0}},function(t,e,r){var n=r(12),i=r(1);t.exports=function(t){if(!i(t))return!1;var e=n(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}},function(t,e,r){var n=r(39);t.exports=function(t,e,r){"__proto__"==e&&n?n(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}},function(t,e,r){var n=r(19),i=r(44);t.exports=function(t){return null!=t&&i(t.length)&&!n(t)}},function(t,e,r){var n=r(58),i=r(59),o=r(24),a=r(60);t.exports=function(t){return n(t)||i(t)||o(t)||a()},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){var n=r(23);t.exports=function(t,e){if(t){if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){(function(t){var n,i,o;function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}
9
9
  /*!
10
10
  * URI.js - Mutating URLs
11
11
  *
@@ -17,8 +17,8 @@ var n=r(50),i=r(51),o=r(52);function a(){return u.TYPED_ARRAY_SUPPORT?2147483647
17
17
  * Licensed under
18
18
  * MIT License http://www.opensource.org/licenses/mit-license
19
19
  *
20
- */!function(s,u){"use strict";"object"===a(t)&&t.exports?t.exports=u(r(26),r(28),r(29)):(i=[r(26),r(28),r(29)],void 0===(o="function"==typeof(n=u)?n.apply(e,i):n)||(t.exports=o))}(0,(function(t,e,r,n){"use strict";var i=n&&n.URI;function o(t,e){var r=arguments.length>=1,n=arguments.length>=2;if(!(this instanceof o))return r?n?new o(t,e):new o(t):new o;if(void 0===t){if(r)throw new TypeError("undefined is not a valid argument for URI");t="undefined"!=typeof location?location.href+"":""}if(null===t&&r)throw new TypeError("null is not a valid argument for URI");return this.href(t),void 0!==e?this.absoluteTo(e):this}o.version="1.19.11";var s=o.prototype,u=Object.prototype.hasOwnProperty;function c(t){return t.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function l(t){return void 0===t?"Undefined":String(Object.prototype.toString.call(t)).slice(8,-1)}function h(t){return"Array"===l(t)}function f(t,e){var r,n,i={};if("RegExp"===l(e))i=null;else if(h(e))for(r=0,n=e.length;r<n;r++)i[e[r]]=!0;else i[e]=!0;for(r=0,n=t.length;r<n;r++){(i&&void 0!==i[t[r]]||!i&&e.test(t[r]))&&(t.splice(r,1),n--,r--)}return t}function d(t,e){var r,n;if(h(e)){for(r=0,n=e.length;r<n;r++)if(!d(t,e[r]))return!1;return!0}var i=l(e);for(r=0,n=t.length;r<n;r++)if("RegExp"===i){if("string"==typeof t[r]&&t[r].match(e))return!0}else if(t[r]===e)return!0;return!1}function p(t,e){if(!h(t)||!h(e))return!1;if(t.length!==e.length)return!1;t.sort(),e.sort();for(var r=0,n=t.length;r<n;r++)if(t[r]!==e[r])return!1;return!0}function m(t){return t.replace(/^\/+|\/+$/g,"")}function y(t){return escape(t)}function g(t){return encodeURIComponent(t).replace(/[!'()*]/g,y).replace(/\*/g,"%2A")}o._parts=function(){return{protocol:null,username:null,password:null,hostname:null,urn:null,port:null,path:null,query:null,fragment:null,preventInvalidHostname:o.preventInvalidHostname,duplicateQueryParameters:o.duplicateQueryParameters,escapeQuerySpace:o.escapeQuerySpace}},o.preventInvalidHostname=!1,o.duplicateQueryParameters=!1,o.escapeQuerySpace=!0,o.protocol_expression=/^[a-z][a-z0-9.+-]*$/i,o.idn_expression=/[^a-z0-9\._-]/i,o.punycode_expression=/(xn--)/i,o.ip4_expression=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,o.ip6_expression=/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,o.find_uri_expression=/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/gi,o.findUri={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi,end:/[\s\r\n]|$/,trim:/[`!()\[\]{};:'".,<>?«»“”„‘’]+$/,parens:/(\([^\)]*\)|\[[^\]]*\]|\{[^}]*\}|<[^>]*>)/g},o.leading_whitespace_expression=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,o.ascii_tab_whitespace=/[\u0009\u000A\u000D]+/g,o.defaultPorts={http:"80",https:"443",ftp:"21",gopher:"70",ws:"80",wss:"443"},o.hostProtocols=["http","https"],o.invalid_hostname_characters=/[^a-zA-Z0-9\.\-:_]/,o.domAttributes={a:"href",blockquote:"cite",link:"href",base:"href",script:"src",form:"action",img:"src",area:"href",iframe:"src",embed:"src",source:"src",track:"src",input:"src",audio:"src",video:"src"},o.getDomAttribute=function(t){if(t&&t.nodeName){var e=t.nodeName.toLowerCase();if("input"!==e||"image"===t.type)return o.domAttributes[e]}},o.encode=g,o.decode=decodeURIComponent,o.iso8859=function(){o.encode=escape,o.decode=unescape},o.unicode=function(){o.encode=g,o.decode=decodeURIComponent},o.characters={pathname:{encode:{expression:/%(24|26|2B|2C|3B|3D|3A|40)/gi,map:{"%24":"$","%26":"&","%2B":"+","%2C":",","%3B":";","%3D":"=","%3A":":","%40":"@"}},decode:{expression:/[\/\?#]/g,map:{"/":"%2F","?":"%3F","#":"%23"}}},reserved:{encode:{expression:/%(21|23|24|26|27|28|29|2A|2B|2C|2F|3A|3B|3D|3F|40|5B|5D)/gi,map:{"%3A":":","%2F":"/","%3F":"?","%23":"#","%5B":"[","%5D":"]","%40":"@","%21":"!","%24":"$","%26":"&","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"="}}},urnpath:{encode:{expression:/%(21|24|27|28|29|2A|2B|2C|3B|3D|40)/gi,map:{"%21":"!","%24":"$","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"=","%40":"@"}},decode:{expression:/[\/\?#:]/g,map:{"/":"%2F","?":"%3F","#":"%23",":":"%3A"}}}},o.encodeQuery=function(t,e){var r=o.encode(t+"");return void 0===e&&(e=o.escapeQuerySpace),e?r.replace(/%20/g,"+"):r},o.decodeQuery=function(t,e){t+="",void 0===e&&(e=o.escapeQuerySpace);try{return o.decode(e?t.replace(/\+/g,"%20"):t)}catch(e){return t}};var v,b={encode:"encode",decode:"decode"},w=function(t,e){return function(r){try{return o[e](r+"").replace(o.characters[t][e].expression,(function(r){return o.characters[t][e].map[r]}))}catch(t){return r}}};for(v in b)o[v+"PathSegment"]=w("pathname",b[v]),o[v+"UrnPathSegment"]=w("urnpath",b[v]);var _=function(t,e,r){return function(n){var i;i=r?function(t){return o[e](o[r](t))}:o[e];for(var a=(n+"").split(t),s=0,u=a.length;s<u;s++)a[s]=i(a[s]);return a.join(t)}};function k(t){return function(e,r){return void 0===e?this._parts[t]||"":(this._parts[t]=e||null,this.build(!r),this)}}function x(t,e){return function(r,n){return void 0===r?this._parts[t]||"":(null!==r&&(r+="").charAt(0)===e&&(r=r.substring(1)),this._parts[t]=r,this.build(!n),this)}}o.decodePath=_("/","decodePathSegment"),o.decodeUrnPath=_(":","decodeUrnPathSegment"),o.recodePath=_("/","encodePathSegment","decode"),o.recodeUrnPath=_(":","encodeUrnPathSegment","decode"),o.encodeReserved=w("reserved","encode"),o.parse=function(t,e){var r;return e||(e={preventInvalidHostname:o.preventInvalidHostname}),(r=(t=(t=t.replace(o.leading_whitespace_expression,"")).replace(o.ascii_tab_whitespace,"")).indexOf("#"))>-1&&(e.fragment=t.substring(r+1)||null,t=t.substring(0,r)),(r=t.indexOf("?"))>-1&&(e.query=t.substring(r+1)||null,t=t.substring(0,r)),"//"===(t=(t=t.replace(/^(https?|ftp|wss?)?:+[/\\]*/i,"$1://")).replace(/^[/\\]{2,}/i,"//")).substring(0,2)?(e.protocol=null,t=t.substring(2),t=o.parseAuthority(t,e)):(r=t.indexOf(":"))>-1&&(e.protocol=t.substring(0,r)||null,e.protocol&&!e.protocol.match(o.protocol_expression)?e.protocol=void 0:"//"===t.substring(r+1,r+3).replace(/\\/g,"/")?(t=t.substring(r+3),t=o.parseAuthority(t,e)):(t=t.substring(r+1),e.urn=!0)),e.path=t,e},o.parseHost=function(t,e){t||(t="");var r,n,i=(t=t.replace(/\\/g,"/")).indexOf("/");if(-1===i&&(i=t.length),"["===t.charAt(0))r=t.indexOf("]"),e.hostname=t.substring(1,r)||null,e.port=t.substring(r+2,i)||null,"/"===e.port&&(e.port=null);else{var a=t.indexOf(":"),s=t.indexOf("/"),u=t.indexOf(":",a+1);-1!==u&&(-1===s||u<s)?(e.hostname=t.substring(0,i)||null,e.port=null):(n=t.substring(0,i).split(":"),e.hostname=n[0]||null,e.port=n[1]||null)}return e.hostname&&"/"!==t.substring(i).charAt(0)&&(i++,t="/"+t),e.preventInvalidHostname&&o.ensureValidHostname(e.hostname,e.protocol),e.port&&o.ensureValidPort(e.port),t.substring(i)||"/"},o.parseAuthority=function(t,e){return t=o.parseUserinfo(t,e),o.parseHost(t,e)},o.parseUserinfo=function(t,e){var r=t;-1!==t.indexOf("\\")&&(t=t.replace(/\\/g,"/"));var n,i=t.indexOf("/"),a=t.lastIndexOf("@",i>-1?i:t.length-1);return a>-1&&(-1===i||a<i)?(n=t.substring(0,a).split(":"),e.username=n[0]?o.decode(n[0]):null,n.shift(),e.password=n[0]?o.decode(n.join(":")):null,t=r.substring(a+1)):(e.username=null,e.password=null),t},o.parseQuery=function(t,e){if(!t)return{};if(!(t=t.replace(/&+/g,"&").replace(/^\?*&*|&+$/g,"")))return{};for(var r,n,i,a={},s=t.split("&"),c=s.length,l=0;l<c;l++)r=s[l].split("="),n=o.decodeQuery(r.shift(),e),i=r.length?o.decodeQuery(r.join("="),e):null,"__proto__"!==n&&(u.call(a,n)?("string"!=typeof a[n]&&null!==a[n]||(a[n]=[a[n]]),a[n].push(i)):a[n]=i);return a},o.build=function(t){var e="",r=!1;return t.protocol&&(e+=t.protocol+":"),t.urn||!e&&!t.hostname||(e+="//",r=!0),e+=o.buildAuthority(t)||"","string"==typeof t.path&&("/"!==t.path.charAt(0)&&r&&(e+="/"),e+=t.path),"string"==typeof t.query&&t.query&&(e+="?"+t.query),"string"==typeof t.fragment&&t.fragment&&(e+="#"+t.fragment),e},o.buildHost=function(t){var e="";return t.hostname?(o.ip6_expression.test(t.hostname)?e+="["+t.hostname+"]":e+=t.hostname,t.port&&(e+=":"+t.port),e):""},o.buildAuthority=function(t){return o.buildUserinfo(t)+o.buildHost(t)},o.buildUserinfo=function(t){var e="";return t.username&&(e+=o.encode(t.username)),t.password&&(e+=":"+o.encode(t.password)),e&&(e+="@"),e},o.buildQuery=function(t,e,r){var n,i,a,s,c="";for(i in t)if("__proto__"!==i&&u.call(t,i))if(h(t[i]))for(n={},a=0,s=t[i].length;a<s;a++)void 0!==t[i][a]&&void 0===n[t[i][a]+""]&&(c+="&"+o.buildQueryParameter(i,t[i][a],r),!0!==e&&(n[t[i][a]+""]=!0));else void 0!==t[i]&&(c+="&"+o.buildQueryParameter(i,t[i],r));return c.substring(1)},o.buildQueryParameter=function(t,e,r){return o.encodeQuery(t,r)+(null!==e?"="+o.encodeQuery(e,r):"")},o.addQuery=function(t,e,r){if("object"===a(e))for(var n in e)u.call(e,n)&&o.addQuery(t,n,e[n]);else{if("string"!=typeof e)throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");if(void 0===t[e])return void(t[e]=r);"string"==typeof t[e]&&(t[e]=[t[e]]),h(r)||(r=[r]),t[e]=(t[e]||[]).concat(r)}},o.setQuery=function(t,e,r){if("object"===a(e))for(var n in e)u.call(e,n)&&o.setQuery(t,n,e[n]);else{if("string"!=typeof e)throw new TypeError("URI.setQuery() accepts an object, string as the name parameter");t[e]=void 0===r?null:r}},o.removeQuery=function(t,e,r){var n,i,s;if(h(e))for(n=0,i=e.length;n<i;n++)t[e[n]]=void 0;else if("RegExp"===l(e))for(s in t)e.test(s)&&(t[s]=void 0);else if("object"===a(e))for(s in e)u.call(e,s)&&o.removeQuery(t,s,e[s]);else{if("string"!=typeof e)throw new TypeError("URI.removeQuery() accepts an object, string, RegExp as the first parameter");void 0!==r?"RegExp"===l(r)?!h(t[e])&&r.test(t[e])?t[e]=void 0:t[e]=f(t[e],r):t[e]!==String(r)||h(r)&&1!==r.length?h(t[e])&&(t[e]=f(t[e],r)):t[e]=void 0:t[e]=void 0}},o.hasQuery=function(t,e,r,n){switch(l(e)){case"String":break;case"RegExp":for(var i in t)if(u.call(t,i)&&e.test(i)&&(void 0===r||o.hasQuery(t,i,r)))return!0;return!1;case"Object":for(var a in e)if(u.call(e,a)&&!o.hasQuery(t,a,e[a]))return!1;return!0;default:throw new TypeError("URI.hasQuery() accepts a string, regular expression or object as the name parameter")}switch(l(r)){case"Undefined":return e in t;case"Boolean":return r===Boolean(h(t[e])?t[e].length:t[e]);case"Function":return!!r(t[e],e,t);case"Array":return!!h(t[e])&&(n?d:p)(t[e],r);case"RegExp":return h(t[e])?!!n&&d(t[e],r):Boolean(t[e]&&t[e].match(r));case"Number":r=String(r);case"String":return h(t[e])?!!n&&d(t[e],r):t[e]===r;default:throw new TypeError("URI.hasQuery() accepts undefined, boolean, string, number, RegExp, Function as the value parameter")}},o.joinPaths=function(){for(var t=[],e=[],r=0,n=0;n<arguments.length;n++){var i=new o(arguments[n]);t.push(i);for(var a=i.segment(),s=0;s<a.length;s++)"string"==typeof a[s]&&e.push(a[s]),a[s]&&r++}if(!e.length||!r)return new o("");var u=new o("").segment(e);return""!==t[0].path()&&"/"!==t[0].path().slice(0,1)||u.path("/"+u.path()),u.normalize()},o.commonPath=function(t,e){var r,n=Math.min(t.length,e.length);for(r=0;r<n;r++)if(t.charAt(r)!==e.charAt(r)){r--;break}return r<1?t.charAt(0)===e.charAt(0)&&"/"===t.charAt(0)?"/":"":("/"===t.charAt(r)&&"/"===e.charAt(r)||(r=t.substring(0,r).lastIndexOf("/")),t.substring(0,r+1))},o.withinString=function(t,e,r){r||(r={});var n=r.start||o.findUri.start,i=r.end||o.findUri.end,a=r.trim||o.findUri.trim,s=r.parens||o.findUri.parens,u=/[a-z0-9-]=["']?$/i;for(n.lastIndex=0;;){var c=n.exec(t);if(!c)break;var l=c.index;if(r.ignoreHtml){var h=t.slice(Math.max(l-3,0),l);if(h&&u.test(h))continue}for(var f=l+t.slice(l).search(i),d=t.slice(l,f),p=-1;;){var m=s.exec(d);if(!m)break;var y=m.index+m[0].length;p=Math.max(p,y)}if(!((d=p>-1?d.slice(0,p)+d.slice(p).replace(a,""):d.replace(a,"")).length<=c[0].length||r.ignore&&r.ignore.test(d))){var g=e(d,l,f=l+d.length,t);void 0!==g?(g=String(g),t=t.slice(0,l)+g+t.slice(f),n.lastIndex=l+g.length):n.lastIndex=f}}return n.lastIndex=0,t},o.ensureValidHostname=function(e,r){var n=!!e,i=!1;if(!!r&&(i=d(o.hostProtocols,r)),i&&!n)throw new TypeError("Hostname cannot be empty, if protocol is "+r);if(e&&e.match(o.invalid_hostname_characters)){if(!t)throw new TypeError('Hostname "'+e+'" contains characters other than [A-Z0-9.-:_] and Punycode.js is not available');if(t.toASCII(e).match(o.invalid_hostname_characters))throw new TypeError('Hostname "'+e+'" contains characters other than [A-Z0-9.-:_]')}},o.ensureValidPort=function(t){if(t){var e=Number(t);if(!(/^[0-9]+$/.test(e)&&e>0&&e<65536))throw new TypeError('Port "'+t+'" is not a valid port')}},o.noConflict=function(t){if(t){var e={URI:this.noConflict()};return n.URITemplate&&"function"==typeof n.URITemplate.noConflict&&(e.URITemplate=n.URITemplate.noConflict()),n.IPv6&&"function"==typeof n.IPv6.noConflict&&(e.IPv6=n.IPv6.noConflict()),n.SecondLevelDomains&&"function"==typeof n.SecondLevelDomains.noConflict&&(e.SecondLevelDomains=n.SecondLevelDomains.noConflict()),e}return n.URI===this&&(n.URI=i),this},s.build=function(t){return!0===t?this._deferred_build=!0:(void 0===t||this._deferred_build)&&(this._string=o.build(this._parts),this._deferred_build=!1),this},s.clone=function(){return new o(this)},s.valueOf=s.toString=function(){return this.build(!1)._string},s.protocol=k("protocol"),s.username=k("username"),s.password=k("password"),s.hostname=k("hostname"),s.port=k("port"),s.query=x("query","?"),s.fragment=x("fragment","#"),s.search=function(t,e){var r=this.query(t,e);return"string"==typeof r&&r.length?"?"+r:r},s.hash=function(t,e){var r=this.fragment(t,e);return"string"==typeof r&&r.length?"#"+r:r},s.pathname=function(t,e){if(void 0===t||!0===t){var r=this._parts.path||(this._parts.hostname?"/":"");return t?(this._parts.urn?o.decodeUrnPath:o.decodePath)(r):r}return this._parts.urn?this._parts.path=t?o.recodeUrnPath(t):"":this._parts.path=t?o.recodePath(t):"/",this.build(!e),this},s.path=s.pathname,s.href=function(t,e){var r;if(void 0===t)return this.toString();this._string="",this._parts=o._parts();var n=t instanceof o,i="object"===a(t)&&(t.hostname||t.path||t.pathname);t.nodeName&&(t=t[o.getDomAttribute(t)]||"",i=!1);if(!n&&i&&void 0!==t.pathname&&(t=t.toString()),"string"==typeof t||t instanceof String)this._parts=o.parse(String(t),this._parts);else{if(!n&&!i)throw new TypeError("invalid input");var s=n?t._parts:t;for(r in s)"query"!==r&&u.call(this._parts,r)&&(this._parts[r]=s[r]);s.query&&this.query(s.query,!1)}return this.build(!e),this},s.is=function(t){var e=!1,n=!1,i=!1,a=!1,s=!1,u=!1,c=!1,l=!this._parts.urn;switch(this._parts.hostname&&(l=!1,n=o.ip4_expression.test(this._parts.hostname),i=o.ip6_expression.test(this._parts.hostname),s=(a=!(e=n||i))&&r&&r.has(this._parts.hostname),u=a&&o.idn_expression.test(this._parts.hostname),c=a&&o.punycode_expression.test(this._parts.hostname)),t.toLowerCase()){case"relative":return l;case"absolute":return!l;case"domain":case"name":return a;case"sld":return s;case"ip":return e;case"ip4":case"ipv4":case"inet4":return n;case"ip6":case"ipv6":case"inet6":return i;case"idn":return u;case"url":return!this._parts.urn;case"urn":return!!this._parts.urn;case"punycode":return c}return null};var A=s.protocol,E=s.port,S=s.hostname;s.protocol=function(t,e){if(t&&!(t=t.replace(/:(\/\/)?$/,"")).match(o.protocol_expression))throw new TypeError('Protocol "'+t+"\" contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]");return A.call(this,t,e)},s.scheme=s.protocol,s.port=function(t,e){return this._parts.urn?void 0===t?"":this:(void 0!==t&&(0===t&&(t=null),t&&(":"===(t+="").charAt(0)&&(t=t.substring(1)),o.ensureValidPort(t))),E.call(this,t,e))},s.hostname=function(t,e){if(this._parts.urn)return void 0===t?"":this;if(void 0!==t){var r={preventInvalidHostname:this._parts.preventInvalidHostname};if("/"!==o.parseHost(t,r))throw new TypeError('Hostname "'+t+'" contains characters other than [A-Z0-9.-]');t=r.hostname,this._parts.preventInvalidHostname&&o.ensureValidHostname(t,this._parts.protocol)}return S.call(this,t,e)},s.origin=function(t,e){if(this._parts.urn)return void 0===t?"":this;if(void 0===t){var r=this.protocol();return this.authority()?(r?r+"://":"")+this.authority():""}var n=o(t);return this.protocol(n.protocol()).authority(n.authority()).build(!e),this},s.host=function(t,e){if(this._parts.urn)return void 0===t?"":this;if(void 0===t)return this._parts.hostname?o.buildHost(this._parts):"";if("/"!==o.parseHost(t,this._parts))throw new TypeError('Hostname "'+t+'" contains characters other than [A-Z0-9.-]');return this.build(!e),this},s.authority=function(t,e){if(this._parts.urn)return void 0===t?"":this;if(void 0===t)return this._parts.hostname?o.buildAuthority(this._parts):"";if("/"!==o.parseAuthority(t,this._parts))throw new TypeError('Hostname "'+t+'" contains characters other than [A-Z0-9.-]');return this.build(!e),this},s.userinfo=function(t,e){if(this._parts.urn)return void 0===t?"":this;if(void 0===t){var r=o.buildUserinfo(this._parts);return r?r.substring(0,r.length-1):r}return"@"!==t[t.length-1]&&(t+="@"),o.parseUserinfo(t,this._parts),this.build(!e),this},s.resource=function(t,e){var r;return void 0===t?this.path()+this.search()+this.hash():(r=o.parse(t),this._parts.path=r.path,this._parts.query=r.query,this._parts.fragment=r.fragment,this.build(!e),this)},s.subdomain=function(t,e){if(this._parts.urn)return void 0===t?"":this;if(void 0===t){if(!this._parts.hostname||this.is("IP"))return"";var r=this._parts.hostname.length-this.domain().length-1;return this._parts.hostname.substring(0,r)||""}var n=this._parts.hostname.length-this.domain().length,i=this._parts.hostname.substring(0,n),a=new RegExp("^"+c(i));if(t&&"."!==t.charAt(t.length-1)&&(t+="."),-1!==t.indexOf(":"))throw new TypeError("Domains cannot contain colons");return t&&o.ensureValidHostname(t,this._parts.protocol),this._parts.hostname=this._parts.hostname.replace(a,t),this.build(!e),this},s.domain=function(t,e){if(this._parts.urn)return void 0===t?"":this;if("boolean"==typeof t&&(e=t,t=void 0),void 0===t){if(!this._parts.hostname||this.is("IP"))return"";var r=this._parts.hostname.match(/\./g);if(r&&r.length<2)return this._parts.hostname;var n=this._parts.hostname.length-this.tld(e).length-1;return n=this._parts.hostname.lastIndexOf(".",n-1)+1,this._parts.hostname.substring(n)||""}if(!t)throw new TypeError("cannot set domain empty");if(-1!==t.indexOf(":"))throw new TypeError("Domains cannot contain colons");if(o.ensureValidHostname(t,this._parts.protocol),!this._parts.hostname||this.is("IP"))this._parts.hostname=t;else{var i=new RegExp(c(this.domain())+"$");this._parts.hostname=this._parts.hostname.replace(i,t)}return this.build(!e),this},s.tld=function(t,e){if(this._parts.urn)return void 0===t?"":this;if("boolean"==typeof t&&(e=t,t=void 0),void 0===t){if(!this._parts.hostname||this.is("IP"))return"";var n=this._parts.hostname.lastIndexOf("."),i=this._parts.hostname.substring(n+1);return!0!==e&&r&&r.list[i.toLowerCase()]&&r.get(this._parts.hostname)||i}var o;if(!t)throw new TypeError("cannot set TLD empty");if(t.match(/[^a-zA-Z0-9-]/)){if(!r||!r.is(t))throw new TypeError('TLD "'+t+'" contains characters other than [A-Z0-9]');o=new RegExp(c(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(o,t)}else{if(!this._parts.hostname||this.is("IP"))throw new ReferenceError("cannot set TLD on non-domain host");o=new RegExp(c(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(o,t)}return this.build(!e),this},s.directory=function(t,e){if(this._parts.urn)return void 0===t?"":this;if(void 0===t||!0===t){if(!this._parts.path&&!this._parts.hostname)return"";if("/"===this._parts.path)return"/";var r=this._parts.path.length-this.filename().length-1,n=this._parts.path.substring(0,r)||(this._parts.hostname?"/":"");return t?o.decodePath(n):n}var i=this._parts.path.length-this.filename().length,a=this._parts.path.substring(0,i),s=new RegExp("^"+c(a));return this.is("relative")||(t||(t="/"),"/"!==t.charAt(0)&&(t="/"+t)),t&&"/"!==t.charAt(t.length-1)&&(t+="/"),t=o.recodePath(t),this._parts.path=this._parts.path.replace(s,t),this.build(!e),this},s.filename=function(t,e){if(this._parts.urn)return void 0===t?"":this;if("string"!=typeof t){if(!this._parts.path||"/"===this._parts.path)return"";var r=this._parts.path.lastIndexOf("/"),n=this._parts.path.substring(r+1);return t?o.decodePathSegment(n):n}var i=!1;"/"===t.charAt(0)&&(t=t.substring(1)),t.match(/\.?\//)&&(i=!0);var a=new RegExp(c(this.filename())+"$");return t=o.recodePath(t),this._parts.path=this._parts.path.replace(a,t),i?this.normalizePath(e):this.build(!e),this},s.suffix=function(t,e){if(this._parts.urn)return void 0===t?"":this;if(void 0===t||!0===t){if(!this._parts.path||"/"===this._parts.path)return"";var r,n,i=this.filename(),a=i.lastIndexOf(".");return-1===a?"":(r=i.substring(a+1),n=/^[a-z0-9%]+$/i.test(r)?r:"",t?o.decodePathSegment(n):n)}"."===t.charAt(0)&&(t=t.substring(1));var s,u=this.suffix();if(u)s=t?new RegExp(c(u)+"$"):new RegExp(c("."+u)+"$");else{if(!t)return this;this._parts.path+="."+o.recodePath(t)}return s&&(t=o.recodePath(t),this._parts.path=this._parts.path.replace(s,t)),this.build(!e),this},s.segment=function(t,e,r){var n=this._parts.urn?":":"/",i=this.path(),o="/"===i.substring(0,1),a=i.split(n);if(void 0!==t&&"number"!=typeof t&&(r=e,e=t,t=void 0),void 0!==t&&"number"!=typeof t)throw new Error('Bad segment "'+t+'", must be 0-based integer');if(o&&a.shift(),t<0&&(t=Math.max(a.length+t,0)),void 0===e)return void 0===t?a:a[t];if(null===t||void 0===a[t])if(h(e)){a=[];for(var s=0,u=e.length;s<u;s++)(e[s].length||a.length&&a[a.length-1].length)&&(a.length&&!a[a.length-1].length&&a.pop(),a.push(m(e[s])))}else(e||"string"==typeof e)&&(e=m(e),""===a[a.length-1]?a[a.length-1]=e:a.push(e));else e?a[t]=m(e):a.splice(t,1);return o&&a.unshift(""),this.path(a.join(n),r)},s.segmentCoded=function(t,e,r){var n,i,a;if("number"!=typeof t&&(r=e,e=t,t=void 0),void 0===e){if(h(n=this.segment(t,e,r)))for(i=0,a=n.length;i<a;i++)n[i]=o.decode(n[i]);else n=void 0!==n?o.decode(n):void 0;return n}if(h(e))for(i=0,a=e.length;i<a;i++)e[i]=o.encode(e[i]);else e="string"==typeof e||e instanceof String?o.encode(e):e;return this.segment(t,e,r)};var I=s.query;return s.query=function(t,e){if(!0===t)return o.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if("function"==typeof t){var r=o.parseQuery(this._parts.query,this._parts.escapeQuerySpace),n=t.call(this,r);return this._parts.query=o.buildQuery(n||r,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!e),this}return void 0!==t&&"string"!=typeof t?(this._parts.query=o.buildQuery(t,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!e),this):I.call(this,t,e)},s.setQuery=function(t,e,r){var n=o.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if("string"==typeof t||t instanceof String)n[t]=void 0!==e?e:null;else{if("object"!==a(t))throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");for(var i in t)u.call(t,i)&&(n[i]=t[i])}return this._parts.query=o.buildQuery(n,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),"string"!=typeof t&&(r=e),this.build(!r),this},s.addQuery=function(t,e,r){var n=o.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return o.addQuery(n,t,void 0===e?null:e),this._parts.query=o.buildQuery(n,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),"string"!=typeof t&&(r=e),this.build(!r),this},s.removeQuery=function(t,e,r){var n=o.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return o.removeQuery(n,t,e),this._parts.query=o.buildQuery(n,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),"string"!=typeof t&&(r=e),this.build(!r),this},s.hasQuery=function(t,e,r){var n=o.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return o.hasQuery(n,t,e,r)},s.setSearch=s.setQuery,s.addSearch=s.addQuery,s.removeSearch=s.removeQuery,s.hasSearch=s.hasQuery,s.normalize=function(){return this._parts.urn?this.normalizeProtocol(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build():this.normalizeProtocol(!1).normalizeHostname(!1).normalizePort(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build()},s.normalizeProtocol=function(t){return"string"==typeof this._parts.protocol&&(this._parts.protocol=this._parts.protocol.toLowerCase(),this.build(!t)),this},s.normalizeHostname=function(r){return this._parts.hostname&&(this.is("IDN")&&t?this._parts.hostname=t.toASCII(this._parts.hostname):this.is("IPv6")&&e&&(this._parts.hostname=e.best(this._parts.hostname)),this._parts.hostname=this._parts.hostname.toLowerCase(),this.build(!r)),this},s.normalizePort=function(t){return"string"==typeof this._parts.protocol&&this._parts.port===o.defaultPorts[this._parts.protocol]&&(this._parts.port=null,this.build(!t)),this},s.normalizePath=function(t){var e,r=this._parts.path;if(!r)return this;if(this._parts.urn)return this._parts.path=o.recodeUrnPath(this._parts.path),this.build(!t),this;if("/"===this._parts.path)return this;var n,i,a="";for("/"!==(r=o.recodePath(r)).charAt(0)&&(e=!0,r="/"+r),"/.."!==r.slice(-3)&&"/."!==r.slice(-2)||(r+="/"),r=r.replace(/(\/(\.\/)+)|(\/\.$)/g,"/").replace(/\/{2,}/g,"/"),e&&(a=r.substring(1).match(/^(\.\.\/)+/)||"")&&(a=a[0]);-1!==(n=r.search(/\/\.\.(\/|$)/));)0!==n?(-1===(i=r.substring(0,n).lastIndexOf("/"))&&(i=n),r=r.substring(0,i)+r.substring(n+3)):r=r.substring(3);return e&&this.is("relative")&&(r=a+r.substring(1)),this._parts.path=r,this.build(!t),this},s.normalizePathname=s.normalizePath,s.normalizeQuery=function(t){return"string"==typeof this._parts.query&&(this._parts.query.length?this.query(o.parseQuery(this._parts.query,this._parts.escapeQuerySpace)):this._parts.query=null,this.build(!t)),this},s.normalizeFragment=function(t){return this._parts.fragment||(this._parts.fragment=null,this.build(!t)),this},s.normalizeSearch=s.normalizeQuery,s.normalizeHash=s.normalizeFragment,s.iso8859=function(){var t=o.encode,e=o.decode;o.encode=escape,o.decode=decodeURIComponent;try{this.normalize()}finally{o.encode=t,o.decode=e}return this},s.unicode=function(){var t=o.encode,e=o.decode;o.encode=g,o.decode=unescape;try{this.normalize()}finally{o.encode=t,o.decode=e}return this},s.readable=function(){var e=this.clone();e.username("").password("").normalize();var r="";if(e._parts.protocol&&(r+=e._parts.protocol+"://"),e._parts.hostname&&(e.is("punycode")&&t?(r+=t.toUnicode(e._parts.hostname),e._parts.port&&(r+=":"+e._parts.port)):r+=e.host()),e._parts.hostname&&e._parts.path&&"/"!==e._parts.path.charAt(0)&&(r+="/"),r+=e.path(!0),e._parts.query){for(var n="",i=0,a=e._parts.query.split("&"),s=a.length;i<s;i++){var u=(a[i]||"").split("=");n+="&"+o.decodeQuery(u[0],this._parts.escapeQuerySpace).replace(/&/g,"%26"),void 0!==u[1]&&(n+="="+o.decodeQuery(u[1],this._parts.escapeQuerySpace).replace(/&/g,"%26"))}r+="?"+n.substring(1)}return r+=o.decodeQuery(e.hash(),!0)},s.absoluteTo=function(t){var e,r,n,i=this.clone(),a=["protocol","username","password","hostname","port"];if(this._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(t instanceof o||(t=new o(t)),i._parts.protocol)return i;if(i._parts.protocol=t._parts.protocol,this._parts.hostname)return i;for(r=0;n=a[r];r++)i._parts[n]=t._parts[n];return i._parts.path?(".."===i._parts.path.substring(-2)&&(i._parts.path+="/"),"/"!==i.path().charAt(0)&&(e=(e=t.directory())||(0===t.path().indexOf("/")?"/":""),i._parts.path=(e?e+"/":"")+i._parts.path,i.normalizePath())):(i._parts.path=t._parts.path,i._parts.query||(i._parts.query=t._parts.query)),i.build(),i},s.relativeTo=function(t){var e,r,n,i,a,s=this.clone().normalize();if(s._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(t=new o(t).normalize(),e=s._parts,r=t._parts,i=s.path(),a=t.path(),"/"!==i.charAt(0))throw new Error("URI is already relative");if("/"!==a.charAt(0))throw new Error("Cannot calculate a URI relative to another relative URI");if(e.protocol===r.protocol&&(e.protocol=null),e.username!==r.username||e.password!==r.password)return s.build();if(null!==e.protocol||null!==e.username||null!==e.password)return s.build();if(e.hostname!==r.hostname||e.port!==r.port)return s.build();if(e.hostname=null,e.port=null,i===a)return e.path="",s.build();if(!(n=o.commonPath(i,a)))return s.build();var u=r.path.substring(n.length).replace(/[^\/]*$/,"").replace(/.*?\//g,"../");return e.path=u+e.path.substring(n.length)||"./",s.build()},s.equals=function(t){var e,r,n,i,a,s=this.clone(),c=new o(t),l={};if(s.normalize(),c.normalize(),s.toString()===c.toString())return!0;if(n=s.query(),i=c.query(),s.query(""),c.query(""),s.toString()!==c.toString())return!1;if(n.length!==i.length)return!1;for(a in e=o.parseQuery(n,this._parts.escapeQuerySpace),r=o.parseQuery(i,this._parts.escapeQuerySpace),e)if(u.call(e,a)){if(h(e[a])){if(!p(e[a],r[a]))return!1}else if(e[a]!==r[a])return!1;l[a]=!0}for(a in r)if(u.call(r,a)&&!l[a])return!1;return!0},s.preventInvalidHostname=function(t){return this._parts.preventInvalidHostname=!!t,this},s.duplicateQueryParameters=function(t){return this._parts.duplicateQueryParameters=!!t,this},s.escapeQuerySpace=function(t){return this._parts.escapeQuerySpace=!!t,this},o}))}).call(this,r(0)(t))},function(t,e,r){(function(t,n){var i;function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}
21
- /*! https://mths.be/punycode v1.4.0 by @mathias */!function(a){var s="object"==o(e)&&e&&!e.nodeType&&e,u="object"==o(t)&&t&&!t.nodeType&&t,c="object"==(void 0===n?"undefined":o(n))&&n;c.global!==c&&c.window!==c&&c.self!==c||(a=c);var l,h,f=2147483647,d=/^xn--/,p=/[^\x20-\x7E]/,m=/[\x2E\u3002\uFF0E\uFF61]/g,y={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},g=Math.floor,v=String.fromCharCode;function b(t){throw new RangeError(y[t])}function w(t,e){for(var r=t.length,n=[];r--;)n[r]=e(t[r]);return n}function _(t,e){var r=t.split("@"),n="";return r.length>1&&(n=r[0]+"@",t=r[1]),n+w((t=t.replace(m,".")).split("."),e).join(".")}function k(t){for(var e,r,n=[],i=0,o=t.length;i<o;)(e=t.charCodeAt(i++))>=55296&&e<=56319&&i<o?56320==(64512&(r=t.charCodeAt(i++)))?n.push(((1023&e)<<10)+(1023&r)+65536):(n.push(e),i--):n.push(e);return n}function x(t){return w(t,(function(t){var e="";return t>65535&&(e+=v((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=v(t)})).join("")}function A(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function E(t,e,r){var n=0;for(t=r?g(t/700):t>>1,t+=g(t/e);t>455;n+=36)t=g(t/35);return g(n+36*t/(t+38))}function S(t){var e,r,n,i,o,a,s,u,c,l,h,d=[],p=t.length,m=0,y=128,v=72;for((r=t.lastIndexOf("-"))<0&&(r=0),n=0;n<r;++n)t.charCodeAt(n)>=128&&b("not-basic"),d.push(t.charCodeAt(n));for(i=r>0?r+1:0;i<p;){for(o=m,a=1,s=36;i>=p&&b("invalid-input"),((u=(h=t.charCodeAt(i++))-48<10?h-22:h-65<26?h-65:h-97<26?h-97:36)>=36||u>g((f-m)/a))&&b("overflow"),m+=u*a,!(u<(c=s<=v?1:s>=v+26?26:s-v));s+=36)a>g(f/(l=36-c))&&b("overflow"),a*=l;v=E(m-o,e=d.length+1,0==o),g(m/e)>f-y&&b("overflow"),y+=g(m/e),m%=e,d.splice(m++,0,y)}return x(d)}function I(t){var e,r,n,i,o,a,s,u,c,l,h,d,p,m,y,w=[];for(d=(t=k(t)).length,e=128,r=0,o=72,a=0;a<d;++a)(h=t[a])<128&&w.push(v(h));for(n=i=w.length,i&&w.push("-");n<d;){for(s=f,a=0;a<d;++a)(h=t[a])>=e&&h<s&&(s=h);for(s-e>g((f-r)/(p=n+1))&&b("overflow"),r+=(s-e)*p,e=s,a=0;a<d;++a)if((h=t[a])<e&&++r>f&&b("overflow"),h==e){for(u=r,c=36;!(u<(l=c<=o?1:c>=o+26?26:c-o));c+=36)y=u-l,m=36-l,w.push(v(A(l+y%m,0))),u=g(y/m);w.push(v(A(u,0))),o=E(r,p,n==i),r=0,++n}++r,++e}return w.join("")}if(l={version:"1.3.2",ucs2:{decode:k,encode:x},decode:S,encode:I,toASCII:function(t){return _(t,(function(t){return p.test(t)?"xn--"+I(t):t}))},toUnicode:function(t){return _(t,(function(t){return d.test(t)?S(t.slice(4).toLowerCase()):t}))}},"object"==o(r(27))&&r(27))void 0===(i=function(){return l}.call(e,r,e,t))||(t.exports=i);else if(s&&u)if(t.exports==s)u.exports=l;else for(h in l)l.hasOwnProperty(h)&&(s[h]=l[h]);else a.punycode=l}(this)}).call(this,r(0)(t),r(6))},function(t,e){(function(e){t.exports=e}).call(this,{})},function(t,e,r){(function(t){var n,i;function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}
20
+ */!function(s,u){"use strict";"object"===a(t)&&t.exports?t.exports=u(r(26),r(28),r(29)):(i=[r(26),r(28),r(29)],void 0===(o="function"==typeof(n=u)?n.apply(e,i):n)||(t.exports=o))}(0,(function(t,e,r,n){"use strict";var i=n&&n.URI;function o(t,e){var r=arguments.length>=1,n=arguments.length>=2;if(!(this instanceof o))return r?n?new o(t,e):new o(t):new o;if(void 0===t){if(r)throw new TypeError("undefined is not a valid argument for URI");t="undefined"!=typeof location?location.href+"":""}if(null===t&&r)throw new TypeError("null is not a valid argument for URI");return this.href(t),void 0!==e?this.absoluteTo(e):this}o.version="1.19.11";var s=o.prototype,u=Object.prototype.hasOwnProperty;function c(t){return t.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function l(t){return void 0===t?"Undefined":String(Object.prototype.toString.call(t)).slice(8,-1)}function h(t){return"Array"===l(t)}function f(t,e){var r,n,i={};if("RegExp"===l(e))i=null;else if(h(e))for(r=0,n=e.length;r<n;r++)i[e[r]]=!0;else i[e]=!0;for(r=0,n=t.length;r<n;r++){(i&&void 0!==i[t[r]]||!i&&e.test(t[r]))&&(t.splice(r,1),n--,r--)}return t}function d(t,e){var r,n;if(h(e)){for(r=0,n=e.length;r<n;r++)if(!d(t,e[r]))return!1;return!0}var i=l(e);for(r=0,n=t.length;r<n;r++)if("RegExp"===i){if("string"==typeof t[r]&&t[r].match(e))return!0}else if(t[r]===e)return!0;return!1}function p(t,e){if(!h(t)||!h(e))return!1;if(t.length!==e.length)return!1;t.sort(),e.sort();for(var r=0,n=t.length;r<n;r++)if(t[r]!==e[r])return!1;return!0}function y(t){return t.replace(/^\/+|\/+$/g,"")}function m(t){return escape(t)}function v(t){return encodeURIComponent(t).replace(/[!'()*]/g,m).replace(/\*/g,"%2A")}o._parts=function(){return{protocol:null,username:null,password:null,hostname:null,urn:null,port:null,path:null,query:null,fragment:null,preventInvalidHostname:o.preventInvalidHostname,duplicateQueryParameters:o.duplicateQueryParameters,escapeQuerySpace:o.escapeQuerySpace}},o.preventInvalidHostname=!1,o.duplicateQueryParameters=!1,o.escapeQuerySpace=!0,o.protocol_expression=/^[a-z][a-z0-9.+-]*$/i,o.idn_expression=/[^a-z0-9\._-]/i,o.punycode_expression=/(xn--)/i,o.ip4_expression=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,o.ip6_expression=/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,o.find_uri_expression=/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/gi,o.findUri={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi,end:/[\s\r\n]|$/,trim:/[`!()\[\]{};:'".,<>?«»“”„‘’]+$/,parens:/(\([^\)]*\)|\[[^\]]*\]|\{[^}]*\}|<[^>]*>)/g},o.leading_whitespace_expression=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,o.ascii_tab_whitespace=/[\u0009\u000A\u000D]+/g,o.defaultPorts={http:"80",https:"443",ftp:"21",gopher:"70",ws:"80",wss:"443"},o.hostProtocols=["http","https"],o.invalid_hostname_characters=/[^a-zA-Z0-9\.\-:_]/,o.domAttributes={a:"href",blockquote:"cite",link:"href",base:"href",script:"src",form:"action",img:"src",area:"href",iframe:"src",embed:"src",source:"src",track:"src",input:"src",audio:"src",video:"src"},o.getDomAttribute=function(t){if(t&&t.nodeName){var e=t.nodeName.toLowerCase();if("input"!==e||"image"===t.type)return o.domAttributes[e]}},o.encode=v,o.decode=decodeURIComponent,o.iso8859=function(){o.encode=escape,o.decode=unescape},o.unicode=function(){o.encode=v,o.decode=decodeURIComponent},o.characters={pathname:{encode:{expression:/%(24|26|2B|2C|3B|3D|3A|40)/gi,map:{"%24":"$","%26":"&","%2B":"+","%2C":",","%3B":";","%3D":"=","%3A":":","%40":"@"}},decode:{expression:/[\/\?#]/g,map:{"/":"%2F","?":"%3F","#":"%23"}}},reserved:{encode:{expression:/%(21|23|24|26|27|28|29|2A|2B|2C|2F|3A|3B|3D|3F|40|5B|5D)/gi,map:{"%3A":":","%2F":"/","%3F":"?","%23":"#","%5B":"[","%5D":"]","%40":"@","%21":"!","%24":"$","%26":"&","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"="}}},urnpath:{encode:{expression:/%(21|24|27|28|29|2A|2B|2C|3B|3D|40)/gi,map:{"%21":"!","%24":"$","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"=","%40":"@"}},decode:{expression:/[\/\?#:]/g,map:{"/":"%2F","?":"%3F","#":"%23",":":"%3A"}}}},o.encodeQuery=function(t,e){var r=o.encode(t+"");return void 0===e&&(e=o.escapeQuerySpace),e?r.replace(/%20/g,"+"):r},o.decodeQuery=function(t,e){t+="",void 0===e&&(e=o.escapeQuerySpace);try{return o.decode(e?t.replace(/\+/g,"%20"):t)}catch(e){return t}};var g,b={encode:"encode",decode:"decode"},w=function(t,e){return function(r){try{return o[e](r+"").replace(o.characters[t][e].expression,(function(r){return o.characters[t][e].map[r]}))}catch(t){return r}}};for(g in b)o[g+"PathSegment"]=w("pathname",b[g]),o[g+"UrnPathSegment"]=w("urnpath",b[g]);var _=function(t,e,r){return function(n){var i;i=r?function(t){return o[e](o[r](t))}:o[e];for(var a=(n+"").split(t),s=0,u=a.length;s<u;s++)a[s]=i(a[s]);return a.join(t)}};function k(t){return function(e,r){return void 0===e?this._parts[t]||"":(this._parts[t]=e||null,this.build(!r),this)}}function x(t,e){return function(r,n){return void 0===r?this._parts[t]||"":(null!==r&&(r+="").charAt(0)===e&&(r=r.substring(1)),this._parts[t]=r,this.build(!n),this)}}o.decodePath=_("/","decodePathSegment"),o.decodeUrnPath=_(":","decodeUrnPathSegment"),o.recodePath=_("/","encodePathSegment","decode"),o.recodeUrnPath=_(":","encodeUrnPathSegment","decode"),o.encodeReserved=w("reserved","encode"),o.parse=function(t,e){var r;return e||(e={preventInvalidHostname:o.preventInvalidHostname}),(r=(t=(t=t.replace(o.leading_whitespace_expression,"")).replace(o.ascii_tab_whitespace,"")).indexOf("#"))>-1&&(e.fragment=t.substring(r+1)||null,t=t.substring(0,r)),(r=t.indexOf("?"))>-1&&(e.query=t.substring(r+1)||null,t=t.substring(0,r)),"//"===(t=(t=t.replace(/^(https?|ftp|wss?)?:+[/\\]*/i,"$1://")).replace(/^[/\\]{2,}/i,"//")).substring(0,2)?(e.protocol=null,t=t.substring(2),t=o.parseAuthority(t,e)):(r=t.indexOf(":"))>-1&&(e.protocol=t.substring(0,r)||null,e.protocol&&!e.protocol.match(o.protocol_expression)?e.protocol=void 0:"//"===t.substring(r+1,r+3).replace(/\\/g,"/")?(t=t.substring(r+3),t=o.parseAuthority(t,e)):(t=t.substring(r+1),e.urn=!0)),e.path=t,e},o.parseHost=function(t,e){t||(t="");var r,n,i=(t=t.replace(/\\/g,"/")).indexOf("/");if(-1===i&&(i=t.length),"["===t.charAt(0))r=t.indexOf("]"),e.hostname=t.substring(1,r)||null,e.port=t.substring(r+2,i)||null,"/"===e.port&&(e.port=null);else{var a=t.indexOf(":"),s=t.indexOf("/"),u=t.indexOf(":",a+1);-1!==u&&(-1===s||u<s)?(e.hostname=t.substring(0,i)||null,e.port=null):(n=t.substring(0,i).split(":"),e.hostname=n[0]||null,e.port=n[1]||null)}return e.hostname&&"/"!==t.substring(i).charAt(0)&&(i++,t="/"+t),e.preventInvalidHostname&&o.ensureValidHostname(e.hostname,e.protocol),e.port&&o.ensureValidPort(e.port),t.substring(i)||"/"},o.parseAuthority=function(t,e){return t=o.parseUserinfo(t,e),o.parseHost(t,e)},o.parseUserinfo=function(t,e){var r=t;-1!==t.indexOf("\\")&&(t=t.replace(/\\/g,"/"));var n,i=t.indexOf("/"),a=t.lastIndexOf("@",i>-1?i:t.length-1);return a>-1&&(-1===i||a<i)?(n=t.substring(0,a).split(":"),e.username=n[0]?o.decode(n[0]):null,n.shift(),e.password=n[0]?o.decode(n.join(":")):null,t=r.substring(a+1)):(e.username=null,e.password=null),t},o.parseQuery=function(t,e){if(!t)return{};if(!(t=t.replace(/&+/g,"&").replace(/^\?*&*|&+$/g,"")))return{};for(var r,n,i,a={},s=t.split("&"),c=s.length,l=0;l<c;l++)r=s[l].split("="),n=o.decodeQuery(r.shift(),e),i=r.length?o.decodeQuery(r.join("="),e):null,"__proto__"!==n&&(u.call(a,n)?("string"!=typeof a[n]&&null!==a[n]||(a[n]=[a[n]]),a[n].push(i)):a[n]=i);return a},o.build=function(t){var e="",r=!1;return t.protocol&&(e+=t.protocol+":"),t.urn||!e&&!t.hostname||(e+="//",r=!0),e+=o.buildAuthority(t)||"","string"==typeof t.path&&("/"!==t.path.charAt(0)&&r&&(e+="/"),e+=t.path),"string"==typeof t.query&&t.query&&(e+="?"+t.query),"string"==typeof t.fragment&&t.fragment&&(e+="#"+t.fragment),e},o.buildHost=function(t){var e="";return t.hostname?(o.ip6_expression.test(t.hostname)?e+="["+t.hostname+"]":e+=t.hostname,t.port&&(e+=":"+t.port),e):""},o.buildAuthority=function(t){return o.buildUserinfo(t)+o.buildHost(t)},o.buildUserinfo=function(t){var e="";return t.username&&(e+=o.encode(t.username)),t.password&&(e+=":"+o.encode(t.password)),e&&(e+="@"),e},o.buildQuery=function(t,e,r){var n,i,a,s,c="";for(i in t)if("__proto__"!==i&&u.call(t,i))if(h(t[i]))for(n={},a=0,s=t[i].length;a<s;a++)void 0!==t[i][a]&&void 0===n[t[i][a]+""]&&(c+="&"+o.buildQueryParameter(i,t[i][a],r),!0!==e&&(n[t[i][a]+""]=!0));else void 0!==t[i]&&(c+="&"+o.buildQueryParameter(i,t[i],r));return c.substring(1)},o.buildQueryParameter=function(t,e,r){return o.encodeQuery(t,r)+(null!==e?"="+o.encodeQuery(e,r):"")},o.addQuery=function(t,e,r){if("object"===a(e))for(var n in e)u.call(e,n)&&o.addQuery(t,n,e[n]);else{if("string"!=typeof e)throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");if(void 0===t[e])return void(t[e]=r);"string"==typeof t[e]&&(t[e]=[t[e]]),h(r)||(r=[r]),t[e]=(t[e]||[]).concat(r)}},o.setQuery=function(t,e,r){if("object"===a(e))for(var n in e)u.call(e,n)&&o.setQuery(t,n,e[n]);else{if("string"!=typeof e)throw new TypeError("URI.setQuery() accepts an object, string as the name parameter");t[e]=void 0===r?null:r}},o.removeQuery=function(t,e,r){var n,i,s;if(h(e))for(n=0,i=e.length;n<i;n++)t[e[n]]=void 0;else if("RegExp"===l(e))for(s in t)e.test(s)&&(t[s]=void 0);else if("object"===a(e))for(s in e)u.call(e,s)&&o.removeQuery(t,s,e[s]);else{if("string"!=typeof e)throw new TypeError("URI.removeQuery() accepts an object, string, RegExp as the first parameter");void 0!==r?"RegExp"===l(r)?!h(t[e])&&r.test(t[e])?t[e]=void 0:t[e]=f(t[e],r):t[e]!==String(r)||h(r)&&1!==r.length?h(t[e])&&(t[e]=f(t[e],r)):t[e]=void 0:t[e]=void 0}},o.hasQuery=function(t,e,r,n){switch(l(e)){case"String":break;case"RegExp":for(var i in t)if(u.call(t,i)&&e.test(i)&&(void 0===r||o.hasQuery(t,i,r)))return!0;return!1;case"Object":for(var a in e)if(u.call(e,a)&&!o.hasQuery(t,a,e[a]))return!1;return!0;default:throw new TypeError("URI.hasQuery() accepts a string, regular expression or object as the name parameter")}switch(l(r)){case"Undefined":return e in t;case"Boolean":return r===Boolean(h(t[e])?t[e].length:t[e]);case"Function":return!!r(t[e],e,t);case"Array":return!!h(t[e])&&(n?d:p)(t[e],r);case"RegExp":return h(t[e])?!!n&&d(t[e],r):Boolean(t[e]&&t[e].match(r));case"Number":r=String(r);case"String":return h(t[e])?!!n&&d(t[e],r):t[e]===r;default:throw new TypeError("URI.hasQuery() accepts undefined, boolean, string, number, RegExp, Function as the value parameter")}},o.joinPaths=function(){for(var t=[],e=[],r=0,n=0;n<arguments.length;n++){var i=new o(arguments[n]);t.push(i);for(var a=i.segment(),s=0;s<a.length;s++)"string"==typeof a[s]&&e.push(a[s]),a[s]&&r++}if(!e.length||!r)return new o("");var u=new o("").segment(e);return""!==t[0].path()&&"/"!==t[0].path().slice(0,1)||u.path("/"+u.path()),u.normalize()},o.commonPath=function(t,e){var r,n=Math.min(t.length,e.length);for(r=0;r<n;r++)if(t.charAt(r)!==e.charAt(r)){r--;break}return r<1?t.charAt(0)===e.charAt(0)&&"/"===t.charAt(0)?"/":"":("/"===t.charAt(r)&&"/"===e.charAt(r)||(r=t.substring(0,r).lastIndexOf("/")),t.substring(0,r+1))},o.withinString=function(t,e,r){r||(r={});var n=r.start||o.findUri.start,i=r.end||o.findUri.end,a=r.trim||o.findUri.trim,s=r.parens||o.findUri.parens,u=/[a-z0-9-]=["']?$/i;for(n.lastIndex=0;;){var c=n.exec(t);if(!c)break;var l=c.index;if(r.ignoreHtml){var h=t.slice(Math.max(l-3,0),l);if(h&&u.test(h))continue}for(var f=l+t.slice(l).search(i),d=t.slice(l,f),p=-1;;){var y=s.exec(d);if(!y)break;var m=y.index+y[0].length;p=Math.max(p,m)}if(!((d=p>-1?d.slice(0,p)+d.slice(p).replace(a,""):d.replace(a,"")).length<=c[0].length||r.ignore&&r.ignore.test(d))){var v=e(d,l,f=l+d.length,t);void 0!==v?(v=String(v),t=t.slice(0,l)+v+t.slice(f),n.lastIndex=l+v.length):n.lastIndex=f}}return n.lastIndex=0,t},o.ensureValidHostname=function(e,r){var n=!!e,i=!1;if(!!r&&(i=d(o.hostProtocols,r)),i&&!n)throw new TypeError("Hostname cannot be empty, if protocol is "+r);if(e&&e.match(o.invalid_hostname_characters)){if(!t)throw new TypeError('Hostname "'+e+'" contains characters other than [A-Z0-9.-:_] and Punycode.js is not available');if(t.toASCII(e).match(o.invalid_hostname_characters))throw new TypeError('Hostname "'+e+'" contains characters other than [A-Z0-9.-:_]')}},o.ensureValidPort=function(t){if(t){var e=Number(t);if(!(/^[0-9]+$/.test(e)&&e>0&&e<65536))throw new TypeError('Port "'+t+'" is not a valid port')}},o.noConflict=function(t){if(t){var e={URI:this.noConflict()};return n.URITemplate&&"function"==typeof n.URITemplate.noConflict&&(e.URITemplate=n.URITemplate.noConflict()),n.IPv6&&"function"==typeof n.IPv6.noConflict&&(e.IPv6=n.IPv6.noConflict()),n.SecondLevelDomains&&"function"==typeof n.SecondLevelDomains.noConflict&&(e.SecondLevelDomains=n.SecondLevelDomains.noConflict()),e}return n.URI===this&&(n.URI=i),this},s.build=function(t){return!0===t?this._deferred_build=!0:(void 0===t||this._deferred_build)&&(this._string=o.build(this._parts),this._deferred_build=!1),this},s.clone=function(){return new o(this)},s.valueOf=s.toString=function(){return this.build(!1)._string},s.protocol=k("protocol"),s.username=k("username"),s.password=k("password"),s.hostname=k("hostname"),s.port=k("port"),s.query=x("query","?"),s.fragment=x("fragment","#"),s.search=function(t,e){var r=this.query(t,e);return"string"==typeof r&&r.length?"?"+r:r},s.hash=function(t,e){var r=this.fragment(t,e);return"string"==typeof r&&r.length?"#"+r:r},s.pathname=function(t,e){if(void 0===t||!0===t){var r=this._parts.path||(this._parts.hostname?"/":"");return t?(this._parts.urn?o.decodeUrnPath:o.decodePath)(r):r}return this._parts.urn?this._parts.path=t?o.recodeUrnPath(t):"":this._parts.path=t?o.recodePath(t):"/",this.build(!e),this},s.path=s.pathname,s.href=function(t,e){var r;if(void 0===t)return this.toString();this._string="",this._parts=o._parts();var n=t instanceof o,i="object"===a(t)&&(t.hostname||t.path||t.pathname);t.nodeName&&(t=t[o.getDomAttribute(t)]||"",i=!1);if(!n&&i&&void 0!==t.pathname&&(t=t.toString()),"string"==typeof t||t instanceof String)this._parts=o.parse(String(t),this._parts);else{if(!n&&!i)throw new TypeError("invalid input");var s=n?t._parts:t;for(r in s)"query"!==r&&u.call(this._parts,r)&&(this._parts[r]=s[r]);s.query&&this.query(s.query,!1)}return this.build(!e),this},s.is=function(t){var e=!1,n=!1,i=!1,a=!1,s=!1,u=!1,c=!1,l=!this._parts.urn;switch(this._parts.hostname&&(l=!1,n=o.ip4_expression.test(this._parts.hostname),i=o.ip6_expression.test(this._parts.hostname),s=(a=!(e=n||i))&&r&&r.has(this._parts.hostname),u=a&&o.idn_expression.test(this._parts.hostname),c=a&&o.punycode_expression.test(this._parts.hostname)),t.toLowerCase()){case"relative":return l;case"absolute":return!l;case"domain":case"name":return a;case"sld":return s;case"ip":return e;case"ip4":case"ipv4":case"inet4":return n;case"ip6":case"ipv6":case"inet6":return i;case"idn":return u;case"url":return!this._parts.urn;case"urn":return!!this._parts.urn;case"punycode":return c}return null};var A=s.protocol,I=s.port,E=s.hostname;s.protocol=function(t,e){if(t&&!(t=t.replace(/:(\/\/)?$/,"")).match(o.protocol_expression))throw new TypeError('Protocol "'+t+"\" contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]");return A.call(this,t,e)},s.scheme=s.protocol,s.port=function(t,e){return this._parts.urn?void 0===t?"":this:(void 0!==t&&(0===t&&(t=null),t&&(":"===(t+="").charAt(0)&&(t=t.substring(1)),o.ensureValidPort(t))),I.call(this,t,e))},s.hostname=function(t,e){if(this._parts.urn)return void 0===t?"":this;if(void 0!==t){var r={preventInvalidHostname:this._parts.preventInvalidHostname};if("/"!==o.parseHost(t,r))throw new TypeError('Hostname "'+t+'" contains characters other than [A-Z0-9.-]');t=r.hostname,this._parts.preventInvalidHostname&&o.ensureValidHostname(t,this._parts.protocol)}return E.call(this,t,e)},s.origin=function(t,e){if(this._parts.urn)return void 0===t?"":this;if(void 0===t){var r=this.protocol();return this.authority()?(r?r+"://":"")+this.authority():""}var n=o(t);return this.protocol(n.protocol()).authority(n.authority()).build(!e),this},s.host=function(t,e){if(this._parts.urn)return void 0===t?"":this;if(void 0===t)return this._parts.hostname?o.buildHost(this._parts):"";if("/"!==o.parseHost(t,this._parts))throw new TypeError('Hostname "'+t+'" contains characters other than [A-Z0-9.-]');return this.build(!e),this},s.authority=function(t,e){if(this._parts.urn)return void 0===t?"":this;if(void 0===t)return this._parts.hostname?o.buildAuthority(this._parts):"";if("/"!==o.parseAuthority(t,this._parts))throw new TypeError('Hostname "'+t+'" contains characters other than [A-Z0-9.-]');return this.build(!e),this},s.userinfo=function(t,e){if(this._parts.urn)return void 0===t?"":this;if(void 0===t){var r=o.buildUserinfo(this._parts);return r?r.substring(0,r.length-1):r}return"@"!==t[t.length-1]&&(t+="@"),o.parseUserinfo(t,this._parts),this.build(!e),this},s.resource=function(t,e){var r;return void 0===t?this.path()+this.search()+this.hash():(r=o.parse(t),this._parts.path=r.path,this._parts.query=r.query,this._parts.fragment=r.fragment,this.build(!e),this)},s.subdomain=function(t,e){if(this._parts.urn)return void 0===t?"":this;if(void 0===t){if(!this._parts.hostname||this.is("IP"))return"";var r=this._parts.hostname.length-this.domain().length-1;return this._parts.hostname.substring(0,r)||""}var n=this._parts.hostname.length-this.domain().length,i=this._parts.hostname.substring(0,n),a=new RegExp("^"+c(i));if(t&&"."!==t.charAt(t.length-1)&&(t+="."),-1!==t.indexOf(":"))throw new TypeError("Domains cannot contain colons");return t&&o.ensureValidHostname(t,this._parts.protocol),this._parts.hostname=this._parts.hostname.replace(a,t),this.build(!e),this},s.domain=function(t,e){if(this._parts.urn)return void 0===t?"":this;if("boolean"==typeof t&&(e=t,t=void 0),void 0===t){if(!this._parts.hostname||this.is("IP"))return"";var r=this._parts.hostname.match(/\./g);if(r&&r.length<2)return this._parts.hostname;var n=this._parts.hostname.length-this.tld(e).length-1;return n=this._parts.hostname.lastIndexOf(".",n-1)+1,this._parts.hostname.substring(n)||""}if(!t)throw new TypeError("cannot set domain empty");if(-1!==t.indexOf(":"))throw new TypeError("Domains cannot contain colons");if(o.ensureValidHostname(t,this._parts.protocol),!this._parts.hostname||this.is("IP"))this._parts.hostname=t;else{var i=new RegExp(c(this.domain())+"$");this._parts.hostname=this._parts.hostname.replace(i,t)}return this.build(!e),this},s.tld=function(t,e){if(this._parts.urn)return void 0===t?"":this;if("boolean"==typeof t&&(e=t,t=void 0),void 0===t){if(!this._parts.hostname||this.is("IP"))return"";var n=this._parts.hostname.lastIndexOf("."),i=this._parts.hostname.substring(n+1);return!0!==e&&r&&r.list[i.toLowerCase()]&&r.get(this._parts.hostname)||i}var o;if(!t)throw new TypeError("cannot set TLD empty");if(t.match(/[^a-zA-Z0-9-]/)){if(!r||!r.is(t))throw new TypeError('TLD "'+t+'" contains characters other than [A-Z0-9]');o=new RegExp(c(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(o,t)}else{if(!this._parts.hostname||this.is("IP"))throw new ReferenceError("cannot set TLD on non-domain host");o=new RegExp(c(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(o,t)}return this.build(!e),this},s.directory=function(t,e){if(this._parts.urn)return void 0===t?"":this;if(void 0===t||!0===t){if(!this._parts.path&&!this._parts.hostname)return"";if("/"===this._parts.path)return"/";var r=this._parts.path.length-this.filename().length-1,n=this._parts.path.substring(0,r)||(this._parts.hostname?"/":"");return t?o.decodePath(n):n}var i=this._parts.path.length-this.filename().length,a=this._parts.path.substring(0,i),s=new RegExp("^"+c(a));return this.is("relative")||(t||(t="/"),"/"!==t.charAt(0)&&(t="/"+t)),t&&"/"!==t.charAt(t.length-1)&&(t+="/"),t=o.recodePath(t),this._parts.path=this._parts.path.replace(s,t),this.build(!e),this},s.filename=function(t,e){if(this._parts.urn)return void 0===t?"":this;if("string"!=typeof t){if(!this._parts.path||"/"===this._parts.path)return"";var r=this._parts.path.lastIndexOf("/"),n=this._parts.path.substring(r+1);return t?o.decodePathSegment(n):n}var i=!1;"/"===t.charAt(0)&&(t=t.substring(1)),t.match(/\.?\//)&&(i=!0);var a=new RegExp(c(this.filename())+"$");return t=o.recodePath(t),this._parts.path=this._parts.path.replace(a,t),i?this.normalizePath(e):this.build(!e),this},s.suffix=function(t,e){if(this._parts.urn)return void 0===t?"":this;if(void 0===t||!0===t){if(!this._parts.path||"/"===this._parts.path)return"";var r,n,i=this.filename(),a=i.lastIndexOf(".");return-1===a?"":(r=i.substring(a+1),n=/^[a-z0-9%]+$/i.test(r)?r:"",t?o.decodePathSegment(n):n)}"."===t.charAt(0)&&(t=t.substring(1));var s,u=this.suffix();if(u)s=t?new RegExp(c(u)+"$"):new RegExp(c("."+u)+"$");else{if(!t)return this;this._parts.path+="."+o.recodePath(t)}return s&&(t=o.recodePath(t),this._parts.path=this._parts.path.replace(s,t)),this.build(!e),this},s.segment=function(t,e,r){var n=this._parts.urn?":":"/",i=this.path(),o="/"===i.substring(0,1),a=i.split(n);if(void 0!==t&&"number"!=typeof t&&(r=e,e=t,t=void 0),void 0!==t&&"number"!=typeof t)throw new Error('Bad segment "'+t+'", must be 0-based integer');if(o&&a.shift(),t<0&&(t=Math.max(a.length+t,0)),void 0===e)return void 0===t?a:a[t];if(null===t||void 0===a[t])if(h(e)){a=[];for(var s=0,u=e.length;s<u;s++)(e[s].length||a.length&&a[a.length-1].length)&&(a.length&&!a[a.length-1].length&&a.pop(),a.push(y(e[s])))}else(e||"string"==typeof e)&&(e=y(e),""===a[a.length-1]?a[a.length-1]=e:a.push(e));else e?a[t]=y(e):a.splice(t,1);return o&&a.unshift(""),this.path(a.join(n),r)},s.segmentCoded=function(t,e,r){var n,i,a;if("number"!=typeof t&&(r=e,e=t,t=void 0),void 0===e){if(h(n=this.segment(t,e,r)))for(i=0,a=n.length;i<a;i++)n[i]=o.decode(n[i]);else n=void 0!==n?o.decode(n):void 0;return n}if(h(e))for(i=0,a=e.length;i<a;i++)e[i]=o.encode(e[i]);else e="string"==typeof e||e instanceof String?o.encode(e):e;return this.segment(t,e,r)};var S=s.query;return s.query=function(t,e){if(!0===t)return o.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if("function"==typeof t){var r=o.parseQuery(this._parts.query,this._parts.escapeQuerySpace),n=t.call(this,r);return this._parts.query=o.buildQuery(n||r,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!e),this}return void 0!==t&&"string"!=typeof t?(this._parts.query=o.buildQuery(t,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!e),this):S.call(this,t,e)},s.setQuery=function(t,e,r){var n=o.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if("string"==typeof t||t instanceof String)n[t]=void 0!==e?e:null;else{if("object"!==a(t))throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");for(var i in t)u.call(t,i)&&(n[i]=t[i])}return this._parts.query=o.buildQuery(n,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),"string"!=typeof t&&(r=e),this.build(!r),this},s.addQuery=function(t,e,r){var n=o.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return o.addQuery(n,t,void 0===e?null:e),this._parts.query=o.buildQuery(n,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),"string"!=typeof t&&(r=e),this.build(!r),this},s.removeQuery=function(t,e,r){var n=o.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return o.removeQuery(n,t,e),this._parts.query=o.buildQuery(n,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),"string"!=typeof t&&(r=e),this.build(!r),this},s.hasQuery=function(t,e,r){var n=o.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return o.hasQuery(n,t,e,r)},s.setSearch=s.setQuery,s.addSearch=s.addQuery,s.removeSearch=s.removeQuery,s.hasSearch=s.hasQuery,s.normalize=function(){return this._parts.urn?this.normalizeProtocol(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build():this.normalizeProtocol(!1).normalizeHostname(!1).normalizePort(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build()},s.normalizeProtocol=function(t){return"string"==typeof this._parts.protocol&&(this._parts.protocol=this._parts.protocol.toLowerCase(),this.build(!t)),this},s.normalizeHostname=function(r){return this._parts.hostname&&(this.is("IDN")&&t?this._parts.hostname=t.toASCII(this._parts.hostname):this.is("IPv6")&&e&&(this._parts.hostname=e.best(this._parts.hostname)),this._parts.hostname=this._parts.hostname.toLowerCase(),this.build(!r)),this},s.normalizePort=function(t){return"string"==typeof this._parts.protocol&&this._parts.port===o.defaultPorts[this._parts.protocol]&&(this._parts.port=null,this.build(!t)),this},s.normalizePath=function(t){var e,r=this._parts.path;if(!r)return this;if(this._parts.urn)return this._parts.path=o.recodeUrnPath(this._parts.path),this.build(!t),this;if("/"===this._parts.path)return this;var n,i,a="";for("/"!==(r=o.recodePath(r)).charAt(0)&&(e=!0,r="/"+r),"/.."!==r.slice(-3)&&"/."!==r.slice(-2)||(r+="/"),r=r.replace(/(\/(\.\/)+)|(\/\.$)/g,"/").replace(/\/{2,}/g,"/"),e&&(a=r.substring(1).match(/^(\.\.\/)+/)||"")&&(a=a[0]);-1!==(n=r.search(/\/\.\.(\/|$)/));)0!==n?(-1===(i=r.substring(0,n).lastIndexOf("/"))&&(i=n),r=r.substring(0,i)+r.substring(n+3)):r=r.substring(3);return e&&this.is("relative")&&(r=a+r.substring(1)),this._parts.path=r,this.build(!t),this},s.normalizePathname=s.normalizePath,s.normalizeQuery=function(t){return"string"==typeof this._parts.query&&(this._parts.query.length?this.query(o.parseQuery(this._parts.query,this._parts.escapeQuerySpace)):this._parts.query=null,this.build(!t)),this},s.normalizeFragment=function(t){return this._parts.fragment||(this._parts.fragment=null,this.build(!t)),this},s.normalizeSearch=s.normalizeQuery,s.normalizeHash=s.normalizeFragment,s.iso8859=function(){var t=o.encode,e=o.decode;o.encode=escape,o.decode=decodeURIComponent;try{this.normalize()}finally{o.encode=t,o.decode=e}return this},s.unicode=function(){var t=o.encode,e=o.decode;o.encode=v,o.decode=unescape;try{this.normalize()}finally{o.encode=t,o.decode=e}return this},s.readable=function(){var e=this.clone();e.username("").password("").normalize();var r="";if(e._parts.protocol&&(r+=e._parts.protocol+"://"),e._parts.hostname&&(e.is("punycode")&&t?(r+=t.toUnicode(e._parts.hostname),e._parts.port&&(r+=":"+e._parts.port)):r+=e.host()),e._parts.hostname&&e._parts.path&&"/"!==e._parts.path.charAt(0)&&(r+="/"),r+=e.path(!0),e._parts.query){for(var n="",i=0,a=e._parts.query.split("&"),s=a.length;i<s;i++){var u=(a[i]||"").split("=");n+="&"+o.decodeQuery(u[0],this._parts.escapeQuerySpace).replace(/&/g,"%26"),void 0!==u[1]&&(n+="="+o.decodeQuery(u[1],this._parts.escapeQuerySpace).replace(/&/g,"%26"))}r+="?"+n.substring(1)}return r+=o.decodeQuery(e.hash(),!0)},s.absoluteTo=function(t){var e,r,n,i=this.clone(),a=["protocol","username","password","hostname","port"];if(this._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(t instanceof o||(t=new o(t)),i._parts.protocol)return i;if(i._parts.protocol=t._parts.protocol,this._parts.hostname)return i;for(r=0;n=a[r];r++)i._parts[n]=t._parts[n];return i._parts.path?(".."===i._parts.path.substring(-2)&&(i._parts.path+="/"),"/"!==i.path().charAt(0)&&(e=(e=t.directory())||(0===t.path().indexOf("/")?"/":""),i._parts.path=(e?e+"/":"")+i._parts.path,i.normalizePath())):(i._parts.path=t._parts.path,i._parts.query||(i._parts.query=t._parts.query)),i.build(),i},s.relativeTo=function(t){var e,r,n,i,a,s=this.clone().normalize();if(s._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(t=new o(t).normalize(),e=s._parts,r=t._parts,i=s.path(),a=t.path(),"/"!==i.charAt(0))throw new Error("URI is already relative");if("/"!==a.charAt(0))throw new Error("Cannot calculate a URI relative to another relative URI");if(e.protocol===r.protocol&&(e.protocol=null),e.username!==r.username||e.password!==r.password)return s.build();if(null!==e.protocol||null!==e.username||null!==e.password)return s.build();if(e.hostname!==r.hostname||e.port!==r.port)return s.build();if(e.hostname=null,e.port=null,i===a)return e.path="",s.build();if(!(n=o.commonPath(i,a)))return s.build();var u=r.path.substring(n.length).replace(/[^\/]*$/,"").replace(/.*?\//g,"../");return e.path=u+e.path.substring(n.length)||"./",s.build()},s.equals=function(t){var e,r,n,i,a,s=this.clone(),c=new o(t),l={};if(s.normalize(),c.normalize(),s.toString()===c.toString())return!0;if(n=s.query(),i=c.query(),s.query(""),c.query(""),s.toString()!==c.toString())return!1;if(n.length!==i.length)return!1;for(a in e=o.parseQuery(n,this._parts.escapeQuerySpace),r=o.parseQuery(i,this._parts.escapeQuerySpace),e)if(u.call(e,a)){if(h(e[a])){if(!p(e[a],r[a]))return!1}else if(e[a]!==r[a])return!1;l[a]=!0}for(a in r)if(u.call(r,a)&&!l[a])return!1;return!0},s.preventInvalidHostname=function(t){return this._parts.preventInvalidHostname=!!t,this},s.duplicateQueryParameters=function(t){return this._parts.duplicateQueryParameters=!!t,this},s.escapeQuerySpace=function(t){return this._parts.escapeQuerySpace=!!t,this},o}))}).call(this,r(0)(t))},function(t,e,r){(function(t,n){var i;function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}
21
+ /*! https://mths.be/punycode v1.4.0 by @mathias */!function(a){var s="object"==o(e)&&e&&!e.nodeType&&e,u="object"==o(t)&&t&&!t.nodeType&&t,c="object"==(void 0===n?"undefined":o(n))&&n;c.global!==c&&c.window!==c&&c.self!==c||(a=c);var l,h,f=2147483647,d=/^xn--/,p=/[^\x20-\x7E]/,y=/[\x2E\u3002\uFF0E\uFF61]/g,m={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},v=Math.floor,g=String.fromCharCode;function b(t){throw new RangeError(m[t])}function w(t,e){for(var r=t.length,n=[];r--;)n[r]=e(t[r]);return n}function _(t,e){var r=t.split("@"),n="";return r.length>1&&(n=r[0]+"@",t=r[1]),n+w((t=t.replace(y,".")).split("."),e).join(".")}function k(t){for(var e,r,n=[],i=0,o=t.length;i<o;)(e=t.charCodeAt(i++))>=55296&&e<=56319&&i<o?56320==(64512&(r=t.charCodeAt(i++)))?n.push(((1023&e)<<10)+(1023&r)+65536):(n.push(e),i--):n.push(e);return n}function x(t){return w(t,(function(t){var e="";return t>65535&&(e+=g((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=g(t)})).join("")}function A(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function I(t,e,r){var n=0;for(t=r?v(t/700):t>>1,t+=v(t/e);t>455;n+=36)t=v(t/35);return v(n+36*t/(t+38))}function E(t){var e,r,n,i,o,a,s,u,c,l,h,d=[],p=t.length,y=0,m=128,g=72;for((r=t.lastIndexOf("-"))<0&&(r=0),n=0;n<r;++n)t.charCodeAt(n)>=128&&b("not-basic"),d.push(t.charCodeAt(n));for(i=r>0?r+1:0;i<p;){for(o=y,a=1,s=36;i>=p&&b("invalid-input"),((u=(h=t.charCodeAt(i++))-48<10?h-22:h-65<26?h-65:h-97<26?h-97:36)>=36||u>v((f-y)/a))&&b("overflow"),y+=u*a,!(u<(c=s<=g?1:s>=g+26?26:s-g));s+=36)a>v(f/(l=36-c))&&b("overflow"),a*=l;g=I(y-o,e=d.length+1,0==o),v(y/e)>f-m&&b("overflow"),m+=v(y/e),y%=e,d.splice(y++,0,m)}return x(d)}function S(t){var e,r,n,i,o,a,s,u,c,l,h,d,p,y,m,w=[];for(d=(t=k(t)).length,e=128,r=0,o=72,a=0;a<d;++a)(h=t[a])<128&&w.push(g(h));for(n=i=w.length,i&&w.push("-");n<d;){for(s=f,a=0;a<d;++a)(h=t[a])>=e&&h<s&&(s=h);for(s-e>v((f-r)/(p=n+1))&&b("overflow"),r+=(s-e)*p,e=s,a=0;a<d;++a)if((h=t[a])<e&&++r>f&&b("overflow"),h==e){for(u=r,c=36;!(u<(l=c<=o?1:c>=o+26?26:c-o));c+=36)m=u-l,y=36-l,w.push(g(A(l+m%y,0))),u=v(m/y);w.push(g(A(u,0))),o=I(r,p,n==i),r=0,++n}++r,++e}return w.join("")}if(l={version:"1.3.2",ucs2:{decode:k,encode:x},decode:E,encode:S,toASCII:function(t){return _(t,(function(t){return p.test(t)?"xn--"+S(t):t}))},toUnicode:function(t){return _(t,(function(t){return d.test(t)?E(t.slice(4).toLowerCase()):t}))}},"object"==o(r(27))&&r(27))void 0===(i=function(){return l}.call(e,r,e,t))||(t.exports=i);else if(s&&u)if(t.exports==s)u.exports=l;else for(h in l)l.hasOwnProperty(h)&&(s[h]=l[h]);else a.punycode=l}(this)}).call(this,r(0)(t),r(5))},function(t,e){(function(e){t.exports=e}).call(this,{})},function(t,e,r){(function(t){var n,i;function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}
22
22
  /*!
23
23
  * URI.js - Mutating URLs
24
24
  * IPv6 Support
@@ -44,8 +44,8 @@ var n=r(50),i=r(51),o=r(52);function a(){return u.TYPED_ARRAY_SUPPORT?2147483647
44
44
  * Licensed under
45
45
  * MIT License http://www.opensource.org/licenses/mit-license
46
46
  *
47
- */!function(a,s){"use strict";"object"===o(t)&&t.exports?t.exports=s():void 0===(i="function"==typeof(n=s)?n.call(e,r,e,t):n)||(t.exports=i)}(0,(function(t){"use strict";var e=t&&t.SecondLevelDomains,r={list:{ac:" com gov mil net org ",ae:" ac co gov mil name net org pro sch ",af:" com edu gov net org ",al:" com edu gov mil net org ",ao:" co ed gv it og pb ",ar:" com edu gob gov int mil net org tur ",at:" ac co gv or ",au:" asn com csiro edu gov id net org ",ba:" co com edu gov mil net org rs unbi unmo unsa untz unze ",bb:" biz co com edu gov info net org store tv ",bh:" biz cc com edu gov info net org ",bn:" com edu gov net org ",bo:" com edu gob gov int mil net org tv ",br:" adm adv agr am arq art ato b bio blog bmd cim cng cnt com coop ecn edu eng esp etc eti far flog fm fnd fot fst g12 ggf gov imb ind inf jor jus lel mat med mil mus net nom not ntr odo org ppg pro psc psi qsl rec slg srv tmp trd tur tv vet vlog wiki zlg ",bs:" com edu gov net org ",bz:" du et om ov rg ",ca:" ab bc mb nb nf nl ns nt nu on pe qc sk yk ",ck:" biz co edu gen gov info net org ",cn:" ac ah bj com cq edu fj gd gov gs gx gz ha hb he hi hl hn jl js jx ln mil net nm nx org qh sc sd sh sn sx tj tw xj xz yn zj ",co:" com edu gov mil net nom org ",cr:" ac c co ed fi go or sa ",cy:" ac biz com ekloges gov ltd name net org parliament press pro tm ",do:" art com edu gob gov mil net org sld web ",dz:" art asso com edu gov net org pol ",ec:" com edu fin gov info med mil net org pro ",eg:" com edu eun gov mil name net org sci ",er:" com edu gov ind mil net org rochest w ",es:" com edu gob nom org ",et:" biz com edu gov info name net org ",fj:" ac biz com info mil name net org pro ",fk:" ac co gov net nom org ",fr:" asso com f gouv nom prd presse tm ",gg:" co net org ",gh:" com edu gov mil org ",gn:" ac com gov net org ",gr:" com edu gov mil net org ",gt:" com edu gob ind mil net org ",gu:" com edu gov net org ",hk:" com edu gov idv net org ",hu:" 2000 agrar bolt casino city co erotica erotika film forum games hotel info ingatlan jogasz konyvelo lakas media news org priv reklam sex shop sport suli szex tm tozsde utazas video ",id:" ac co go mil net or sch web ",il:" ac co gov idf k12 muni net org ",in:" ac co edu ernet firm gen gov i ind mil net nic org res ",iq:" com edu gov i mil net org ",ir:" ac co dnssec gov i id net org sch ",it:" edu gov ",je:" co net org ",jo:" com edu gov mil name net org sch ",jp:" ac ad co ed go gr lg ne or ",ke:" ac co go info me mobi ne or sc ",kh:" com edu gov mil net org per ",ki:" biz com de edu gov info mob net org tel ",km:" asso com coop edu gouv k medecin mil nom notaires pharmaciens presse tm veterinaire ",kn:" edu gov net org ",kr:" ac busan chungbuk chungnam co daegu daejeon es gangwon go gwangju gyeongbuk gyeonggi gyeongnam hs incheon jeju jeonbuk jeonnam k kg mil ms ne or pe re sc seoul ulsan ",kw:" com edu gov net org ",ky:" com edu gov net org ",kz:" com edu gov mil net org ",lb:" com edu gov net org ",lk:" assn com edu gov grp hotel int ltd net ngo org sch soc web ",lr:" com edu gov net org ",lv:" asn com conf edu gov id mil net org ",ly:" com edu gov id med net org plc sch ",ma:" ac co gov m net org press ",mc:" asso tm ",me:" ac co edu gov its net org priv ",mg:" com edu gov mil nom org prd tm ",mk:" com edu gov inf name net org pro ",ml:" com edu gov net org presse ",mn:" edu gov org ",mo:" com edu gov net org ",mt:" com edu gov net org ",mv:" aero biz com coop edu gov info int mil museum name net org pro ",mw:" ac co com coop edu gov int museum net org ",mx:" com edu gob net org ",my:" com edu gov mil name net org sch ",nf:" arts com firm info net other per rec store web ",ng:" biz com edu gov mil mobi name net org sch ",ni:" ac co com edu gob mil net nom org ",np:" com edu gov mil net org ",nr:" biz com edu gov info net org ",om:" ac biz co com edu gov med mil museum net org pro sch ",pe:" com edu gob mil net nom org sld ",ph:" com edu gov i mil net ngo org ",pk:" biz com edu fam gob gok gon gop gos gov net org web ",pl:" art bialystok biz com edu gda gdansk gorzow gov info katowice krakow lodz lublin mil net ngo olsztyn org poznan pwr radom slupsk szczecin torun warszawa waw wroc wroclaw zgora ",pr:" ac biz com edu est gov info isla name net org pro prof ",ps:" com edu gov net org plo sec ",pw:" belau co ed go ne or ",ro:" arts com firm info nom nt org rec store tm www ",rs:" ac co edu gov in org ",sb:" com edu gov net org ",sc:" com edu gov net org ",sh:" co com edu gov net nom org ",sl:" com edu gov net org ",st:" co com consulado edu embaixada gov mil net org principe saotome store ",sv:" com edu gob org red ",sz:" ac co org ",tr:" av bbs bel biz com dr edu gen gov info k12 name net org pol tel tsk tv web ",tt:" aero biz cat co com coop edu gov info int jobs mil mobi museum name net org pro tel travel ",tw:" club com ebiz edu game gov idv mil net org ",mu:" ac co com gov net or org ",mz:" ac co edu gov org ",na:" co com ",nz:" ac co cri geek gen govt health iwi maori mil net org parliament school ",pa:" abo ac com edu gob ing med net nom org sld ",pt:" com edu gov int net nome org publ ",py:" com edu gov mil net org ",qa:" com edu gov mil net org ",re:" asso com nom ",ru:" ac adygeya altai amur arkhangelsk astrakhan bashkiria belgorod bir bryansk buryatia cbg chel chelyabinsk chita chukotka chuvashia com dagestan e-burg edu gov grozny int irkutsk ivanovo izhevsk jar joshkar-ola kalmykia kaluga kamchatka karelia kazan kchr kemerovo khabarovsk khakassia khv kirov koenig komi kostroma kranoyarsk kuban kurgan kursk lipetsk magadan mari mari-el marine mil mordovia mosreg msk murmansk nalchik net nnov nov novosibirsk nsk omsk orenburg org oryol penza perm pp pskov ptz rnd ryazan sakhalin samara saratov simbirsk smolensk spb stavropol stv surgut tambov tatarstan tom tomsk tsaritsyn tsk tula tuva tver tyumen udm udmurtia ulan-ude vladikavkaz vladimir vladivostok volgograd vologda voronezh vrn vyatka yakutia yamal yekaterinburg yuzhno-sakhalinsk ",rw:" ac co com edu gouv gov int mil net ",sa:" com edu gov med net org pub sch ",sd:" com edu gov info med net org tv ",se:" a ac b bd c d e f g h i k l m n o org p parti pp press r s t tm u w x y z ",sg:" com edu gov idn net org per ",sn:" art com edu gouv org perso univ ",sy:" com edu gov mil net news org ",th:" ac co go in mi net or ",tj:" ac biz co com edu go gov info int mil name net nic org test web ",tn:" agrinet com defense edunet ens fin gov ind info intl mincom nat net org perso rnrt rns rnu tourism ",tz:" ac co go ne or ",ua:" biz cherkassy chernigov chernovtsy ck cn co com crimea cv dn dnepropetrovsk donetsk dp edu gov if in ivano-frankivsk kh kharkov kherson khmelnitskiy kiev kirovograd km kr ks kv lg lugansk lutsk lviv me mk net nikolaev od odessa org pl poltava pp rovno rv sebastopol sumy te ternopil uzhgorod vinnica vn zaporizhzhe zhitomir zp zt ",ug:" ac co go ne or org sc ",uk:" ac bl british-library co cym gov govt icnet jet lea ltd me mil mod national-library-scotland nel net nhs nic nls org orgn parliament plc police sch scot soc ",us:" dni fed isa kids nsn ",uy:" com edu gub mil net org ",ve:" co com edu gob info mil net org web ",vi:" co com k12 net org ",vn:" ac biz com edu gov health info int name net org pro ",ye:" co com gov ltd me net org plc ",yu:" ac co edu gov org ",za:" ac agric alt bourse city co cybernet db edu gov grondar iaccess imt inca landesign law mil net ngo nis nom olivetti org pix school tm web ",zm:" ac co com edu gov net org sch ",com:"ar br cn de eu gb gr hu jpn kr no qc ru sa se uk us uy za ",net:"gb jp se uk ",org:"ae",de:"com "},has:function(t){var e=t.lastIndexOf(".");if(e<=0||e>=t.length-1)return!1;var n=t.lastIndexOf(".",e-1);if(n<=0||n>=e-1)return!1;var i=r.list[t.slice(e+1)];return!!i&&i.indexOf(" "+t.slice(n+1,e)+" ")>=0},is:function(t){var e=t.lastIndexOf(".");if(e<=0||e>=t.length-1)return!1;if(t.lastIndexOf(".",e-1)>=0)return!1;var n=r.list[t.slice(e+1)];return!!n&&n.indexOf(" "+t.slice(0,e)+" ")>=0},get:function(t){var e=t.lastIndexOf(".");if(e<=0||e>=t.length-1)return null;var n=t.lastIndexOf(".",e-1);if(n<=0||n>=e-1)return null;var i=r.list[t.slice(e+1)];return i?i.indexOf(" "+t.slice(n+1,e)+" ")<0?null:t.slice(n+1):null},noConflict:function(){return t.SecondLevelDomains===this&&(t.SecondLevelDomains=e),this}};return r}))}).call(this,r(0)(t))},function(t,e){function r(e){return t.exports=r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,r(e)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){var n=r(17)(r(2),"Map");t.exports=n},function(t,e,r){var n=r(2).Symbol;t.exports=n},function(t,e,r){(function(e){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var n="object"==(void 0===e?"undefined":r(e))&&e&&e.Object===Object&&e;t.exports=n}).call(this,r(6))},function(t,e,r){var n=r(19),i=r(9);t.exports=function(t,e,r){(void 0!==r&&!i(t[e],r)||void 0===r&&!(e in t))&&n(t,e,r)}},function(t,e,r){var n=r(17),i=function(){try{var t=n(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=i},function(t,e,r){var n=r(120)(Object.getPrototypeOf,Object);t.exports=n},function(t,e){var r=Object.prototype;t.exports=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||r)}},function(t,e,r){var n=r(121),i=r(3),o=Object.prototype,a=o.hasOwnProperty,s=o.propertyIsEnumerable,u=n(function(){return arguments}())?n:function(t){return i(t)&&a.call(t,"callee")&&!s.call(t,"callee")};t.exports=u},function(t,e){var r=Array.isArray;t.exports=r},function(t,e){t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},function(t,e,r){(function(t){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=r(2),o=r(123),a="object"==n(e)&&e&&!e.nodeType&&e,s=a&&"object"==n(t)&&t&&!t.nodeType&&t,u=s&&s.exports===a?i.Buffer:void 0,c=(u?u.isBuffer:void 0)||o;t.exports=c}).call(this,r(0)(t))},function(t,e,r){var n=r(125),i=r(126),o=r(127),a=o&&o.isTypedArray,s=a?i(a):n;t.exports=s},function(t,e){t.exports=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}},function(t,e,r){var n=r(131),i=r(133),o=r(20);t.exports=function(t){return o(t)?n(t,!0):i(t)}},function(t,e){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var n=/^(?:0|[1-9]\d*)$/;t.exports=function(t,e){var i=r(t);return!!(e=null==e?9007199254740991:e)&&("number"==i||"symbol"!=i&&n.test(t))&&t>-1&&t%1==0&&t<e}},function(t,e){t.exports=function(t){return t}},function(t,e,r){var n=r(13),i=r(4),o=r(5),a=r(14),s=r(15);function u(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function c(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?u(Object(r),!0).forEach((function(e){n(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function l(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return h(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return h(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function h(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var f=r(49),d=r(21),p=r(71).permissionLevels,m=function(){"use strict";function t(){var e=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=r.target,s=r.timeout,u=void 0===s?30:s;a(this,t),this.permissionLevels=p,!n&&"undefined"!=typeof window&&window.parent&&(n=window.parent),this.target=n,this.timeout=u,this.utils=d;var c,h=l(this.AllowedMethods());try{var f=function(){var t=c.value;e[t]=function(){var r=o(i.mark((function r(n){var o;return i.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return(o=n&&n.callback)&&delete n.callback,r.next=4,e.SendMessage({options:{calledMethod:t,args:e.utils.MakeClonable(n)},callback:o});case 4:return r.abrupt("return",r.sent);case 5:case"end":return r.stop()}}),r)})));return function(t){return r.apply(this,arguments)}}()};for(h.s();!(c=h.n()).done;)f()}catch(t){h.e(t)}finally{h.f()}this.userProfileClient={};var m,y=l(this.AllowedUserProfileMethods());try{var g=function(){var r=m.value;e.userProfileClient[r]=function(){var n=o(i.mark((function n(o){var a;return i.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return(a=o&&o.callback)&&delete o.callback,n.next=4,e.SendMessage({options:{module:"userProfileClient",calledMethod:r,args:e.utils.MakeClonable(o),prompted:t.PromptedMethods().includes(r)},callback:a});case 4:return n.abrupt("return",n.sent);case 5:case"end":return n.stop()}}),n)})));return function(t){return n.apply(this,arguments)}}()};for(y.s();!(m=y.n()).done;)g()}catch(t){y.e(t)}finally{y.f()}}var e,r,n;return s(t,[{key:"PassRequest",value:(n=o(i.mark((function t(e){var r,n,o,a,s;return i.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.request,n=e.Respond,t.prev=1,r.callbackId&&(s=function(t){return n({type:"ElvFrameResponse",requestId:r.callbackId,response:t})}),t.next=5,this.SendMessage({options:r,callback:s});case 5:o=t.sent,t.next=11;break;case 8:t.prev=8,t.t0=t.catch(1),a=t.t0;case 11:return t.abrupt("return",{type:"ElvFrameResponse",requestId:r.requestId,response:o,error:a});case 12:case"end":return t.stop()}}),t,this,[[1,8]])}))),function(t){return n.apply(this,arguments)})},{key:"SendMessage",value:(r=o(i.mark((function e(r){var n,o,a,s,u,l,h,d,p,m;return i.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=r.options,o=void 0===n?{}:n,a=r.callback,s=r.noResponse,u=void 0!==s&&s,l=f.next(),a&&(h=f.next()),this.target.postMessage(c(c({},o),{},{type:"ElvFrameRequest",requestId:l,callbackId:h}),"*"),!u){e.next=6;break}return e.abrupt("return");case 6:return d=o.calledMethod||o.operation,p=t.FileMethods().includes(o.calledMethod),m=this.timeout,o.prompted||p?m=0:o.args&&o.args.fcTimeout&&(m=o.args.fcTimeout),e.next=12,this.AwaitMessage(l,m,a,h,d);case 12:return e.abrupt("return",e.sent);case 13:case"end":return e.stop()}}),e,this)}))),function(t){return r.apply(this,arguments)})},{key:"AwaitMessage",value:(e=o(i.mark((function t(e,r,n,a,s){return i.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,new Promise((function(t,u){var c,l,h,f=function(){l&&clearTimeout(l),r>0&&(l=setTimeout((function(){"undefined"!=typeof window&&(window.removeEventListener("message",c),h&&window.removeEventListener("message",h)),u("Request ".concat(e," timed out (").concat(s,")"))}),1e3*r))};a&&(h=function(t){try{f();var e=t.data;if("ElvFrameResponse"!==e.type||e.requestId!==a)return;n(e.response)}catch(t){console.error(t)}},window.addEventListener("message",h)),c=function(){var r=o(i.mark((function r(n){var o;return i.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(r.prev=0,"ElvFrameResponse"===(o=n.data).type&&o.requestId===e){r.next=4;break}return r.abrupt("return");case 4:clearTimeout(l),window.removeEventListener("message",c),h&&window.removeEventListener("message",h),o.error?u(o.error):t(o.response),r.next=16;break;case 10:r.prev=10,r.t0=r.catch(0),clearTimeout(l),window.removeEventListener("message",c),h&&window.removeEventListener("message",h),u(r.t0);case 16:case"end":return r.stop()}}),r,null,[[0,10]])})));return function(t){return r.apply(this,arguments)}}(),f(),window.addEventListener("message",c)}));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)}))),function(t,r,n,i,o){return e.apply(this,arguments)})},{key:"AllowedMethods",value:function(){return["AccessGroupManagers","AccessGroupMembers","AccessGroupOwner","AccessInfo","AccessRequest","AccessType","AddAccessGroupManager","AddAccessGroupMember","AddContentLibraryGroup","AddContentObjectGroupPermission","AddLibraryContentType","AssetMetadata","AvailableDRMs","AvailableOfferings","AwaitPending","BitmovinPlayoutOptions","BlockNumber","CallBitcodeMethod","CallContractMethod","CallContractMethodAndWait","ClearCache","ClearStaticToken","Collection","CollectionTransactions","ConfigUrl","ContentLibraries","ContentLibrary","ContentLibraryGroupPermissions","ContentLibraryOwner","ContentObject","ContentObjectAccessComplete","ContentObjectGraph","ContentObjectGroupPermissions","ContentObjectImageUrl","ContentObjectLibraryId","ContentObjectMetadata","ContentObjectOwner","ContentObjectTenantId","ContentObjectVersions","ContentObjects","ContentPart","ContentParts","ContentSpaceId","ContentType","ContentTypeOwner","ContentTypes","ContractAbi","ContractEvents","ContractMetadata","ContractName","CopyContentObject","CreateABRMezzanine","CreateAccessGroup","CreateAndFinalizeContentObject","CreateContentLibrary","CreateContentObject","CreateContentType","CreateEncryptionConk","CreateFileDirectories","CreateFileUploadJob","CreateLinks","CreateNTPInstance","CreateNonOwnerCap","CreatePart","CreateProductionMaster","CreateSignedToken","CurrentAccountAddress","CustomContractAddress","Decrypt","DecryptECIES","DefaultKMSAddress","DeleteAccessGroup","DeleteContentLibrary","DeleteContentObject","DeleteContentVersion","DeleteFiles","DeleteMetadata","DeleteNTPInstance","DeletePart","DeployContract","Download","DownloadEncrypted","DownloadFile","DownloadPart","EditAndFinalizeContentObject","EditContentObject","Encrypt","EncryptECIES","EncryptionConk","Events","ExtractEventFromLogs","ExtractValueFromEvent","FabricUrl","FileUrl","FinalizeABRMezzanine","FinalizeContentObject","FinalizePart","FinalizeStateChannelAccess","FinalizeUploadJob","FormatContractArguments","GenerateStateChannelToken","GetBalance","InitializeAuthPolicy","IssueNTPCode","IssueSignedNTPCode","LatestVersionHash","LibraryContentTypes","LinkAccessGroupToOauth","LinkData","LinkTarget","LinkUrl","ListAccessGroups","ListFiles","ListNTPInstances","LROStatus","MergeContractMetadata","MergeMetadata","MetadataAuth","MintNFT","NetworkInfo","NodeId","Nodes","NTPInstance","Permission","PlayoutOptions","PlayoutPathResolution","ProduceMetadataLinks","Proofs","PublicRep","PublishContentVersion","QParts","RedeemCode","RemoveAccessGroupManager","RemoveAccessGroupMember","RemoveContentObjectGroupPermission","RemoveContentLibraryGroup","RemoveLibraryContentType","Rep","ReplaceContractMetadata","ReplaceMetadata","Request","ResetRegion","SendFunds","SetAccessCharge","SetAuth","SetAuthContext","SetAuthPolicy","SetContentLibraryImage","SetContentObjectImage","SetCustomContentContract","SetGroupPermission","SetNodes","SetOauthToken","SetPolicyAuthorization","SetSignerFromOauthToken","SetStaticToken","SetVisibility","SetPermission","StartABRMezzanineJobs","SuspendNTPInstance","UnlinkAccessGroupFromOauth","UpdateContentObjectGraph","UpdateNTPInstance","UploadFileData","UploadFiles","UploadFilesFromS3","UploadJobStatus","UploadPart","UploadPartChunk","UploadStatus","UseRegion","VerifyContentObject","Visibility"]}},{key:"AllowedUserProfileMethods",value:function(){return["AccessLevel","CollectedTags","CreateWallet","DeleteUserMetadata","MergeUserMetadata","PublicUserMetadata","ReplaceUserMetadata","TenantId","UserMetadata","UserProfileImage","UserWalletAddress","UserWalletObjectInfo","WalletAddress"]}}],[{key:"PromptedMethods",value:function(){return["CollectedTags","DeleteUserMetadata","MergeUserMetadata","ReplaceUserMetadata","UserMetadata"]}},{key:"MetadataMethods",value:function(){return["DeleteUserMetadata","MergeUserMetadata","ReplaceUserMetadata","UserMetadata"]}},{key:"FileMethods",value:function(){return["DownloadFile","DownloadPart","UpdateContentObjectGraph","UploadFiles","UploadFilesFromS3","UploadPart","UploadPartChunk"]}}]),t}();e.FrameClient=m},function(t,e,r){(function(t){function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var r=function(t){"use strict";var r=Object.prototype,n=r.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var i=e&&e.prototype instanceof f?e:f,o=Object.create(i.prototype),a=new A(n||[]);return o._invoke=function(t,e,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return S()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=_(a,r);if(s){if(s===h)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=l(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===h)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,a),o}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var h={};function f(){}function d(){}function p(){}var m={};u(m,o,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(E([])));g&&g!==r&&n.call(g,o)&&(m=g);var v=p.prototype=f.prototype=Object.create(m);function b(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,r){var i;this._invoke=function(o,a){function s(){return new r((function(i,s){!function i(o,a,s,u){var c=l(t[o],t,a);if("throw"!==c.type){var h=c.arg,f=h.value;return f&&"object"===e(f)&&n.call(f,"__await")?r.resolve(f.__await).then((function(t){i("next",t,s,u)}),(function(t){i("throw",t,s,u)})):r.resolve(f).then((function(t){h.value=t,s(h)}),(function(t){return i("throw",t,s,u)}))}u(c.arg)}(o,a,i,s)}))}return i=i?i.then(s,s):s()}}function _(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,_(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=l(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,h;var i=n.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function x(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function E(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:S}}function S(){return{value:void 0,done:!0}}return d.prototype=p,u(v,"constructor",p),u(p,"constructor",d),d.displayName=u(p,s,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,u(t,s,"GeneratorFunction")),t.prototype=Object.create(v),t},t.awrap=function(t){return{__await:t}},b(w.prototype),u(w.prototype,a,(function(){return this})),t.AsyncIterator=w,t.async=function(e,r,n,i,o){void 0===o&&(o=Promise);var a=new w(c(e,r,n,i),o);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},b(v),u(v,s,"Generator"),u(v,o,(function(){return this})),u(v,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=E,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var s=n.call(o,"catchLoc"),u=n.call(o,"finallyLoc");if(s&&u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),x(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;x(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:E(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}("object"===e(t)?t.exports:{});try{regeneratorRuntime=r}catch(t){"object"===("undefined"==typeof globalThis?"undefined":e(globalThis))?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}}).call(this,r(0)(t))},function(t,e,r){var n=r(14),i=r(15),o=0,a=function(){"use strict";function t(){n(this,t)}return i(t,null,[{key:"next",value:function(){return++o}}]),t}();t.exports=a},function(t,e,r){"use strict";e.byteLength=function(t){var e=c(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,n=c(t),a=n[0],s=n[1],u=new o(function(t,e,r){return 3*(e+r)/4-r}(0,a,s)),l=0,h=s>0?a-4:a;for(r=0;r<h;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)],u[l++]=e>>16&255,u[l++]=e>>8&255,u[l++]=255&e;2===s&&(e=i[t.charCodeAt(r)]<<2|i[t.charCodeAt(r+1)]>>4,u[l++]=255&e);1===s&&(e=i[t.charCodeAt(r)]<<10|i[t.charCodeAt(r+1)]<<4|i[t.charCodeAt(r+2)]>>2,u[l++]=e>>8&255,u[l++]=255&e);return u},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],a=0,s=r-i;a<s;a+=16383)o.push(l(t,a,a+16383>s?s:a+16383));1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=a.length;s<u;++s)n[s]=a[s],i[a.charCodeAt(s)]=s;function c(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 l(t,e,r){for(var i,o,a=[],s=e;s<r;s+=3)i=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),a.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(t,e){
47
+ */!function(a,s){"use strict";"object"===o(t)&&t.exports?t.exports=s():void 0===(i="function"==typeof(n=s)?n.call(e,r,e,t):n)||(t.exports=i)}(0,(function(t){"use strict";var e=t&&t.SecondLevelDomains,r={list:{ac:" com gov mil net org ",ae:" ac co gov mil name net org pro sch ",af:" com edu gov net org ",al:" com edu gov mil net org ",ao:" co ed gv it og pb ",ar:" com edu gob gov int mil net org tur ",at:" ac co gv or ",au:" asn com csiro edu gov id net org ",ba:" co com edu gov mil net org rs unbi unmo unsa untz unze ",bb:" biz co com edu gov info net org store tv ",bh:" biz cc com edu gov info net org ",bn:" com edu gov net org ",bo:" com edu gob gov int mil net org tv ",br:" adm adv agr am arq art ato b bio blog bmd cim cng cnt com coop ecn edu eng esp etc eti far flog fm fnd fot fst g12 ggf gov imb ind inf jor jus lel mat med mil mus net nom not ntr odo org ppg pro psc psi qsl rec slg srv tmp trd tur tv vet vlog wiki zlg ",bs:" com edu gov net org ",bz:" du et om ov rg ",ca:" ab bc mb nb nf nl ns nt nu on pe qc sk yk ",ck:" biz co edu gen gov info net org ",cn:" ac ah bj com cq edu fj gd gov gs gx gz ha hb he hi hl hn jl js jx ln mil net nm nx org qh sc sd sh sn sx tj tw xj xz yn zj ",co:" com edu gov mil net nom org ",cr:" ac c co ed fi go or sa ",cy:" ac biz com ekloges gov ltd name net org parliament press pro tm ",do:" art com edu gob gov mil net org sld web ",dz:" art asso com edu gov net org pol ",ec:" com edu fin gov info med mil net org pro ",eg:" com edu eun gov mil name net org sci ",er:" com edu gov ind mil net org rochest w ",es:" com edu gob nom org ",et:" biz com edu gov info name net org ",fj:" ac biz com info mil name net org pro ",fk:" ac co gov net nom org ",fr:" asso com f gouv nom prd presse tm ",gg:" co net org ",gh:" com edu gov mil org ",gn:" ac com gov net org ",gr:" com edu gov mil net org ",gt:" com edu gob ind mil net org ",gu:" com edu gov net org ",hk:" com edu gov idv net org ",hu:" 2000 agrar bolt casino city co erotica erotika film forum games hotel info ingatlan jogasz konyvelo lakas media news org priv reklam sex shop sport suli szex tm tozsde utazas video ",id:" ac co go mil net or sch web ",il:" ac co gov idf k12 muni net org ",in:" ac co edu ernet firm gen gov i ind mil net nic org res ",iq:" com edu gov i mil net org ",ir:" ac co dnssec gov i id net org sch ",it:" edu gov ",je:" co net org ",jo:" com edu gov mil name net org sch ",jp:" ac ad co ed go gr lg ne or ",ke:" ac co go info me mobi ne or sc ",kh:" com edu gov mil net org per ",ki:" biz com de edu gov info mob net org tel ",km:" asso com coop edu gouv k medecin mil nom notaires pharmaciens presse tm veterinaire ",kn:" edu gov net org ",kr:" ac busan chungbuk chungnam co daegu daejeon es gangwon go gwangju gyeongbuk gyeonggi gyeongnam hs incheon jeju jeonbuk jeonnam k kg mil ms ne or pe re sc seoul ulsan ",kw:" com edu gov net org ",ky:" com edu gov net org ",kz:" com edu gov mil net org ",lb:" com edu gov net org ",lk:" assn com edu gov grp hotel int ltd net ngo org sch soc web ",lr:" com edu gov net org ",lv:" asn com conf edu gov id mil net org ",ly:" com edu gov id med net org plc sch ",ma:" ac co gov m net org press ",mc:" asso tm ",me:" ac co edu gov its net org priv ",mg:" com edu gov mil nom org prd tm ",mk:" com edu gov inf name net org pro ",ml:" com edu gov net org presse ",mn:" edu gov org ",mo:" com edu gov net org ",mt:" com edu gov net org ",mv:" aero biz com coop edu gov info int mil museum name net org pro ",mw:" ac co com coop edu gov int museum net org ",mx:" com edu gob net org ",my:" com edu gov mil name net org sch ",nf:" arts com firm info net other per rec store web ",ng:" biz com edu gov mil mobi name net org sch ",ni:" ac co com edu gob mil net nom org ",np:" com edu gov mil net org ",nr:" biz com edu gov info net org ",om:" ac biz co com edu gov med mil museum net org pro sch ",pe:" com edu gob mil net nom org sld ",ph:" com edu gov i mil net ngo org ",pk:" biz com edu fam gob gok gon gop gos gov net org web ",pl:" art bialystok biz com edu gda gdansk gorzow gov info katowice krakow lodz lublin mil net ngo olsztyn org poznan pwr radom slupsk szczecin torun warszawa waw wroc wroclaw zgora ",pr:" ac biz com edu est gov info isla name net org pro prof ",ps:" com edu gov net org plo sec ",pw:" belau co ed go ne or ",ro:" arts com firm info nom nt org rec store tm www ",rs:" ac co edu gov in org ",sb:" com edu gov net org ",sc:" com edu gov net org ",sh:" co com edu gov net nom org ",sl:" com edu gov net org ",st:" co com consulado edu embaixada gov mil net org principe saotome store ",sv:" com edu gob org red ",sz:" ac co org ",tr:" av bbs bel biz com dr edu gen gov info k12 name net org pol tel tsk tv web ",tt:" aero biz cat co com coop edu gov info int jobs mil mobi museum name net org pro tel travel ",tw:" club com ebiz edu game gov idv mil net org ",mu:" ac co com gov net or org ",mz:" ac co edu gov org ",na:" co com ",nz:" ac co cri geek gen govt health iwi maori mil net org parliament school ",pa:" abo ac com edu gob ing med net nom org sld ",pt:" com edu gov int net nome org publ ",py:" com edu gov mil net org ",qa:" com edu gov mil net org ",re:" asso com nom ",ru:" ac adygeya altai amur arkhangelsk astrakhan bashkiria belgorod bir bryansk buryatia cbg chel chelyabinsk chita chukotka chuvashia com dagestan e-burg edu gov grozny int irkutsk ivanovo izhevsk jar joshkar-ola kalmykia kaluga kamchatka karelia kazan kchr kemerovo khabarovsk khakassia khv kirov koenig komi kostroma kranoyarsk kuban kurgan kursk lipetsk magadan mari mari-el marine mil mordovia mosreg msk murmansk nalchik net nnov nov novosibirsk nsk omsk orenburg org oryol penza perm pp pskov ptz rnd ryazan sakhalin samara saratov simbirsk smolensk spb stavropol stv surgut tambov tatarstan tom tomsk tsaritsyn tsk tula tuva tver tyumen udm udmurtia ulan-ude vladikavkaz vladimir vladivostok volgograd vologda voronezh vrn vyatka yakutia yamal yekaterinburg yuzhno-sakhalinsk ",rw:" ac co com edu gouv gov int mil net ",sa:" com edu gov med net org pub sch ",sd:" com edu gov info med net org tv ",se:" a ac b bd c d e f g h i k l m n o org p parti pp press r s t tm u w x y z ",sg:" com edu gov idn net org per ",sn:" art com edu gouv org perso univ ",sy:" com edu gov mil net news org ",th:" ac co go in mi net or ",tj:" ac biz co com edu go gov info int mil name net nic org test web ",tn:" agrinet com defense edunet ens fin gov ind info intl mincom nat net org perso rnrt rns rnu tourism ",tz:" ac co go ne or ",ua:" biz cherkassy chernigov chernovtsy ck cn co com crimea cv dn dnepropetrovsk donetsk dp edu gov if in ivano-frankivsk kh kharkov kherson khmelnitskiy kiev kirovograd km kr ks kv lg lugansk lutsk lviv me mk net nikolaev od odessa org pl poltava pp rovno rv sebastopol sumy te ternopil uzhgorod vinnica vn zaporizhzhe zhitomir zp zt ",ug:" ac co go ne or org sc ",uk:" ac bl british-library co cym gov govt icnet jet lea ltd me mil mod national-library-scotland nel net nhs nic nls org orgn parliament plc police sch scot soc ",us:" dni fed isa kids nsn ",uy:" com edu gub mil net org ",ve:" co com edu gob info mil net org web ",vi:" co com k12 net org ",vn:" ac biz com edu gov health info int name net org pro ",ye:" co com gov ltd me net org plc ",yu:" ac co edu gov org ",za:" ac agric alt bourse city co cybernet db edu gov grondar iaccess imt inca landesign law mil net ngo nis nom olivetti org pix school tm web ",zm:" ac co com edu gov net org sch ",com:"ar br cn de eu gb gr hu jpn kr no qc ru sa se uk us uy za ",net:"gb jp se uk ",org:"ae",de:"com "},has:function(t){var e=t.lastIndexOf(".");if(e<=0||e>=t.length-1)return!1;var n=t.lastIndexOf(".",e-1);if(n<=0||n>=e-1)return!1;var i=r.list[t.slice(e+1)];return!!i&&i.indexOf(" "+t.slice(n+1,e)+" ")>=0},is:function(t){var e=t.lastIndexOf(".");if(e<=0||e>=t.length-1)return!1;if(t.lastIndexOf(".",e-1)>=0)return!1;var n=r.list[t.slice(e+1)];return!!n&&n.indexOf(" "+t.slice(0,e)+" ")>=0},get:function(t){var e=t.lastIndexOf(".");if(e<=0||e>=t.length-1)return null;var n=t.lastIndexOf(".",e-1);if(n<=0||n>=e-1)return null;var i=r.list[t.slice(e+1)];return i?i.indexOf(" "+t.slice(n+1,e)+" ")<0?null:t.slice(n+1):null},noConflict:function(){return t.SecondLevelDomains===this&&(t.SecondLevelDomains=e),this}};return r}))}).call(this,r(0)(t))},function(t,e){function r(e){return t.exports=r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,r(e)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){var n,i,o;function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}o=function(){function t(t){var e=[];if(0===t.length)return"";if("string"!=typeof t[0])throw new TypeError("Url must be a string. Received "+t[0]);if(t[0].match(/^[^/:]+:\/*$/)&&t.length>1){var r=t.shift();t[0]=r+t[0]}t[0].match(/^file:\/\/\//)?t[0]=t[0].replace(/^([^/:]+):\/*/,"$1:///"):t[0]=t[0].replace(/^([^/:]+):\/*/,"$1://");for(var n=0;n<t.length;n++){var i=t[n];if("string"!=typeof i)throw new TypeError("Url must be a string. Received "+i);""!==i&&(n>0&&(i=i.replace(/^[\/]+/,"")),i=n<t.length-1?i.replace(/[\/]+$/,""):i.replace(/[\/]+$/,"/"),e.push(i))}var o=e.join("/"),a=(o=o.replace(/\/(\?|&|#[^!])/g,"$1")).split("?");return o=a.shift()+(a.length>0?"?":"")+a.join("&")}return function(){return t("object"===a(arguments[0])?arguments[0]:[].slice.call(arguments))}},t.exports?t.exports=o():void 0===(i="function"==typeof(n=o)?n.call(e,r,e,t):n)||(t.exports=i)},function(t,e,r){"use strict";var n=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==n)return n;throw new Error("unable to locate global object")}();t.exports=e=n.fetch,n.fetch&&(e.default=n.fetch.bind(n)),e.Headers=n.Headers,e.Request=n.Request,e.Response=n.Response},function(t,e,r){var n=r(30),i=function(t,e){return"object"===n(e)&&"function"==typeof e[t]?e[t]:null},o=function(t){return"object"===n(t)?JSON.stringify(t):t};t.exports={LogMessage:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t.debug){var n=i("log",t.debugOptions),a=i("error",t.debugOptions),s="(elv-client-js#".concat(t.constructor.name,")"),u="\n".concat(s," ").concat(o(e),"\n");r?a?a(s,e):console.error(u):n?n(s,e):console.log(u)}}}},function(t,e,r){var n=r(17);e.ValidatePresence=function(t,e){if(!e)throw Error("".concat(t," not specified"))},e.ValidateLibrary=function(t){if(!t)throw Error("Library ID not specified");if(!t.toString().startsWith("i"))throw Error("Invalid library ID: ".concat(t))},e.ValidateObject=function(t){if(!t)throw Error("Object ID not specified");if(!t.toString().startsWith("i"))throw Error("Invalid object ID: ".concat(t))},e.ValidateVersion=function(t){if(!t)throw Error("Version hash not specified");if(!t.toString().startsWith("h"))throw Error("Invalid version hash: ".concat(t))},e.ValidateWriteToken=function(t){if(!t)throw Error("Write token not specified");if(!t.toString().startsWith("t"))throw Error("Invalid write token: ".concat(t))},e.ValidatePartHash=function(t){if(!t)throw Error("Part hash not specified");if(!t.toString().startsWith("hqp_")&&!t.toString().startsWith("hqpe"))throw Error("Invalid part hash: ".concat(t))},e.ValidateParameters=function(t){var r=t.libraryId,n=t.objectId,i=t.versionHash;i?e.ValidateVersion(i):(e.ValidateLibrary(r),e.ValidateObject(n))},e.ValidateAddress=function(t){if(!t)throw Error("Address not specified");if(!/^(0x)?[0-9a-f]{40}$/i.test(t.toLowerCase()))throw Error("Invalid address: ".concat(t));return n.FormatAddress(t)},e.ValidatePermission=function(t){if(t&&"full-access"!==t&&"no-access"!==t)throw Error("Invalid profile permission: ".concat(t));return t},e.ValidateDate=function(t){if(t){if(isNaN(new Date(t)))throw Error("Invalid date: ".concat(t));return new Date(t).getTime()}}},function(t,e,r){var n=r(18)(r(2),"Map");t.exports=n},function(t,e,r){var n=r(2).Symbol;t.exports=n},function(t,e,r){(function(e){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var n="object"==(void 0===e?"undefined":r(e))&&e&&e.Object===Object&&e;t.exports=n}).call(this,r(5))},function(t,e,r){var n=r(20),i=r(11);t.exports=function(t,e,r){(void 0!==r&&!i(t[e],r)||void 0===r&&!(e in t))&&n(t,e,r)}},function(t,e,r){var n=r(18),i=function(){try{var t=n(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=i},function(t,e,r){var n=r(120)(Object.getPrototypeOf,Object);t.exports=n},function(t,e){var r=Object.prototype;t.exports=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||r)}},function(t,e,r){var n=r(121),i=r(6),o=Object.prototype,a=o.hasOwnProperty,s=o.propertyIsEnumerable,u=n(function(){return arguments}())?n:function(t){return i(t)&&a.call(t,"callee")&&!s.call(t,"callee")};t.exports=u},function(t,e){var r=Array.isArray;t.exports=r},function(t,e){t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},function(t,e,r){(function(t){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=r(2),o=r(123),a="object"==n(e)&&e&&!e.nodeType&&e,s=a&&"object"==n(t)&&t&&!t.nodeType&&t,u=s&&s.exports===a?i.Buffer:void 0,c=(u?u.isBuffer:void 0)||o;t.exports=c}).call(this,r(0)(t))},function(t,e,r){var n=r(125),i=r(126),o=r(127),a=o&&o.isTypedArray,s=a?i(a):n;t.exports=s},function(t,e){t.exports=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}},function(t,e,r){var n=r(131),i=r(133),o=r(21);t.exports=function(t){return o(t)?n(t,!0):i(t)}},function(t,e){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var n=/^(?:0|[1-9]\d*)$/;t.exports=function(t,e){var i=r(t);return!!(e=null==e?9007199254740991:e)&&("number"==i||"symbol"!=i&&n.test(t))&&t>-1&&t%1==0&&t<e}},function(t,e){t.exports=function(t){return t}},function(t,e,r){var n=r(7),i=r(3),o=r(4),a=r(15),s=r(16);function u(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function c(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?u(Object(r),!0).forEach((function(e){n(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function l(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return h(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return h(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function h(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var f=r(53),d=r(17),p=r(75).permissionLevels,y=r(33).LogMessage,m=function(){"use strict";function t(){var e=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=r.target,s=r.timeout,u=void 0===s?30:s;a(this,t),this.permissionLevels=p,!n&&"undefined"!=typeof window&&window.parent&&(n=window.parent),this.target=n,this.timeout=u,this.utils=d;var c,h=l(this.AllowedMethods());try{var f=function(){var t=c.value;e[t]=function(){var r=o(i.mark((function r(n){var o;return i.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return(o=n&&n.callback)&&delete n.callback,r.next=4,e.SendMessage({options:{calledMethod:t,args:e.utils.MakeClonable(n)},callback:o});case 4:return r.abrupt("return",r.sent);case 5:case"end":return r.stop()}}),r)})));return function(t){return r.apply(this,arguments)}}()};for(h.s();!(c=h.n()).done;)f()}catch(t){h.e(t)}finally{h.f()}this.userProfileClient={};var y,m=l(this.AllowedUserProfileMethods());try{var v=function(){var r=y.value;e.userProfileClient[r]=function(){var n=o(i.mark((function n(o){var a;return i.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return(a=o&&o.callback)&&delete o.callback,n.next=4,e.SendMessage({options:{module:"userProfileClient",calledMethod:r,args:e.utils.MakeClonable(o),prompted:t.PromptedMethods().includes(r)},callback:a});case 4:return n.abrupt("return",n.sent);case 5:case"end":return n.stop()}}),n)})));return function(t){return n.apply(this,arguments)}}()};for(m.s();!(y=m.n()).done;)v()}catch(t){m.e(t)}finally{m.f()}}var e,r,n;return s(t,[{key:"Log",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];y(this,t,e)}},{key:"PassRequest",value:(n=o(i.mark((function t(e){var r,n,o,a,s;return i.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.request,n=e.Respond,t.prev=1,r.callbackId&&(s=function(t){return n({type:"ElvFrameResponse",requestId:r.callbackId,response:t})}),t.next=5,this.SendMessage({options:r,callback:s});case 5:o=t.sent,t.next=11;break;case 8:t.prev=8,t.t0=t.catch(1),a=t.t0;case 11:return t.abrupt("return",{type:"ElvFrameResponse",requestId:r.requestId,response:o,error:a});case 12:case"end":return t.stop()}}),t,this,[[1,8]])}))),function(t){return n.apply(this,arguments)})},{key:"SendMessage",value:(r=o(i.mark((function e(r){var n,o,a,s,u,l,h,d,p,y;return i.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=r.options,o=void 0===n?{}:n,a=r.callback,s=r.noResponse,u=void 0!==s&&s,l=f.next(),a&&(h=f.next()),this.target.postMessage(c(c({},o),{},{type:"ElvFrameRequest",requestId:l,callbackId:h}),"*"),!u){e.next=6;break}return e.abrupt("return");case 6:return d=o.calledMethod||o.operation,p=t.FileMethods().includes(o.calledMethod),y=this.timeout,o.prompted||p?y=0:o.args&&o.args.fcTimeout&&(y=o.args.fcTimeout),e.next=12,this.AwaitMessage(l,y,a,h,d);case 12:return e.abrupt("return",e.sent);case 13:case"end":return e.stop()}}),e,this)}))),function(t){return r.apply(this,arguments)})},{key:"AwaitMessage",value:(e=o(i.mark((function t(e,r,n,a,s){return i.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,new Promise((function(t,u){var c,l,h,f=function(){l&&clearTimeout(l),r>0&&(l=setTimeout((function(){"undefined"!=typeof window&&(window.removeEventListener("message",c),h&&window.removeEventListener("message",h)),u("Request ".concat(e," timed out (").concat(s,")"))}),1e3*r))};a&&(h=function(t){try{f();var e=t.data;if("ElvFrameResponse"!==e.type||e.requestId!==a)return;n(e.response)}catch(t){console.error(t)}},window.addEventListener("message",h)),c=function(){var r=o(i.mark((function r(n){var o;return i.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(r.prev=0,"ElvFrameResponse"===(o=n.data).type&&o.requestId===e){r.next=4;break}return r.abrupt("return");case 4:clearTimeout(l),window.removeEventListener("message",c),h&&window.removeEventListener("message",h),o.error?u(o.error):t(o.response),r.next=16;break;case 10:r.prev=10,r.t0=r.catch(0),clearTimeout(l),window.removeEventListener("message",c),h&&window.removeEventListener("message",h),u(r.t0);case 16:case"end":return r.stop()}}),r,null,[[0,10]])})));return function(t){return r.apply(this,arguments)}}(),f(),window.addEventListener("message",c)}));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)}))),function(t,r,n,i,o){return e.apply(this,arguments)})},{key:"AllowedMethods",value:function(){return["AccessGroupManagers","AccessGroupMembers","AccessGroupOwner","AccessInfo","AccessRequest","AccessType","AddAccessGroupManager","AddAccessGroupMember","AddContentLibraryGroup","AddContentObjectGroupPermission","AddLibraryContentType","AssetMetadata","AvailableDRMs","AvailableOfferings","AwaitPending","BitmovinPlayoutOptions","BlockNumber","CallBitcodeMethod","CallContractMethod","CallContractMethodAndWait","ClearCache","ClearStaticToken","Collection","CollectionTransactions","ConfigUrl","ContentLibraries","ContentLibrary","ContentLibraryGroupPermissions","ContentLibraryOwner","ContentObject","ContentObjectAccessComplete","ContentObjectGraph","ContentObjectGroupPermissions","ContentObjectImageUrl","ContentObjectLibraryId","ContentObjectMetadata","ContentObjectOwner","ContentObjectTenantId","ContentObjectVersions","ContentObjects","ContentPart","ContentParts","ContentSpaceId","ContentType","ContentTypeOwner","ContentTypes","ContractAbi","ContractEvents","ContractMetadata","ContractName","CopyContentObject","CreateABRMezzanine","CreateAccessGroup","CreateAndFinalizeContentObject","CreateContentLibrary","CreateContentObject","CreateContentType","CreateEncryptionConk","CreateFileDirectories","CreateFileUploadJob","CreateLinks","CreateNTPInstance","CreateNonOwnerCap","CreatePart","CreateProductionMaster","CreateSignedToken","CurrentAccountAddress","CustomContractAddress","Decrypt","DecryptECIES","DefaultKMSAddress","DeleteAccessGroup","DeleteContentLibrary","DeleteContentObject","DeleteContentVersion","DeleteFiles","DeleteMetadata","DeleteNTPInstance","DeletePart","DeployContract","Download","DownloadEncrypted","DownloadFile","DownloadPart","EditAndFinalizeContentObject","EditContentObject","Encrypt","EncryptECIES","EncryptionConk","Events","ExtractEventFromLogs","ExtractValueFromEvent","FabricUrl","FileUrl","FinalizeABRMezzanine","FinalizeContentObject","FinalizePart","FinalizeStateChannelAccess","FinalizeUploadJob","FormatContractArguments","GenerateStateChannelToken","GetBalance","InitializeAuthPolicy","IssueNTPCode","IssueSignedNTPCode","LatestVersionHash","LibraryContentTypes","LinkAccessGroupToOauth","LinkData","LinkTarget","LinkUrl","ListAccessGroups","ListFiles","ListNTPInstances","LROStatus","MergeContractMetadata","MergeMetadata","MetadataAuth","MintNFT","NetworkInfo","NodeId","Nodes","NTPInstance","Permission","PlayoutOptions","PlayoutPathResolution","ProduceMetadataLinks","Proofs","PublicRep","PublishContentVersion","QParts","RedeemCode","RemoveAccessGroupManager","RemoveAccessGroupMember","RemoveContentObjectGroupPermission","RemoveContentLibraryGroup","RemoveLibraryContentType","Rep","ReplaceContractMetadata","ReplaceMetadata","Request","ResetRegion","SendFunds","SetAccessCharge","SetAuth","SetAuthContext","SetAuthPolicy","SetContentLibraryImage","SetContentObjectImage","SetCustomContentContract","SetGroupPermission","SetNodes","SetOauthToken","SetPolicyAuthorization","SetSignerFromOauthToken","SetStaticToken","SetVisibility","SetPermission","StartABRMezzanineJobs","SuspendNTPInstance","UnlinkAccessGroupFromOauth","UpdateContentObjectGraph","UpdateNTPInstance","UploadFileData","UploadFilesFromS3","UploadJobStatus","UploadPart","UploadPartChunk","UploadStatus","UseRegion","VerifyContentObject","Visibility"]}},{key:"AllowedUserProfileMethods",value:function(){return["AccessLevel","CollectedTags","CreateWallet","DeleteUserMetadata","MergeUserMetadata","PublicUserMetadata","ReplaceUserMetadata","TenantId","UserMetadata","UserProfileImage","UserWalletAddress","UserWalletObjectInfo","WalletAddress"]}}],[{key:"PromptedMethods",value:function(){return["CollectedTags","DeleteUserMetadata","MergeUserMetadata","ReplaceUserMetadata","UserMetadata"]}},{key:"MetadataMethods",value:function(){return["DeleteUserMetadata","MergeUserMetadata","ReplaceUserMetadata","UserMetadata"]}},{key:"FileMethods",value:function(){return["DownloadFile","DownloadPart","UpdateContentObjectGraph","UploadFiles","UploadFilesFromS3","UploadPart","UploadPartChunk"]}}]),t}(),v=r(144).UploadFiles;m.prototype.UploadFiles=v,e.FrameClient=m},function(t,e,r){(function(t){function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var r=function(t){"use strict";var r=Object.prototype,n=r.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var i=e&&e.prototype instanceof f?e:f,o=Object.create(i.prototype),a=new A(n||[]);return o._invoke=function(t,e,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return E()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=_(a,r);if(s){if(s===h)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=l(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===h)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,a),o}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var h={};function f(){}function d(){}function p(){}var y={};u(y,o,(function(){return this}));var m=Object.getPrototypeOf,v=m&&m(m(I([])));v&&v!==r&&n.call(v,o)&&(y=v);var g=p.prototype=f.prototype=Object.create(y);function b(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,r){var i;this._invoke=function(o,a){function s(){return new r((function(i,s){!function i(o,a,s,u){var c=l(t[o],t,a);if("throw"!==c.type){var h=c.arg,f=h.value;return f&&"object"===e(f)&&n.call(f,"__await")?r.resolve(f.__await).then((function(t){i("next",t,s,u)}),(function(t){i("throw",t,s,u)})):r.resolve(f).then((function(t){h.value=t,s(h)}),(function(t){return i("throw",t,s,u)}))}u(c.arg)}(o,a,i,s)}))}return i=i?i.then(s,s):s()}}function _(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,_(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=l(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,h;var i=n.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function x(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function I(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:E}}function E(){return{value:void 0,done:!0}}return d.prototype=p,u(g,"constructor",p),u(p,"constructor",d),d.displayName=u(p,s,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,u(t,s,"GeneratorFunction")),t.prototype=Object.create(g),t},t.awrap=function(t){return{__await:t}},b(w.prototype),u(w.prototype,a,(function(){return this})),t.AsyncIterator=w,t.async=function(e,r,n,i,o){void 0===o&&(o=Promise);var a=new w(c(e,r,n,i),o);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},b(g),u(g,s,"Generator"),u(g,o,(function(){return this})),u(g,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=I,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var s=n.call(o,"catchLoc"),u=n.call(o,"finallyLoc");if(s&&u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),x(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;x(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:I(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}("object"===e(t)?t.exports:{});try{regeneratorRuntime=r}catch(t){"object"===("undefined"==typeof globalThis?"undefined":e(globalThis))?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}}).call(this,r(0)(t))},function(t,e,r){var n=r(15),i=r(16),o=0,a=function(){"use strict";function t(){n(this,t)}return i(t,null,[{key:"next",value:function(){return++o}}]),t}();t.exports=a},function(t,e,r){"use strict";e.byteLength=function(t){var e=c(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,n=c(t),a=n[0],s=n[1],u=new o(function(t,e,r){return 3*(e+r)/4-r}(0,a,s)),l=0,h=s>0?a-4:a;for(r=0;r<h;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)],u[l++]=e>>16&255,u[l++]=e>>8&255,u[l++]=255&e;2===s&&(e=i[t.charCodeAt(r)]<<2|i[t.charCodeAt(r+1)]>>4,u[l++]=255&e);1===s&&(e=i[t.charCodeAt(r)]<<10|i[t.charCodeAt(r+1)]<<4|i[t.charCodeAt(r+2)]>>2,u[l++]=e>>8&255,u[l++]=255&e);return u},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],a=0,s=r-i;a<s;a+=16383)o.push(l(t,a,a+16383>s?s:a+16383));1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=a.length;s<u;++s)n[s]=a[s],i[a.charCodeAt(s)]=s;function c(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 l(t,e,r){for(var i,o,a=[],s=e;s<r;s+=3)i=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),a.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(t,e){
48
48
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
49
- e.read=function(t,e,r,n,i){var o,a,s=8*i-n-1,u=(1<<s)-1,c=u>>1,l=-7,h=r?i-1:0,f=r?-1:1,d=t[e+h];for(h+=f,o=d&(1<<-l)-1,d>>=-l,l+=s;l>0;o=256*o+t[e+h],h+=f,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=n;l>0;a=256*a+t[e+h],h+=f,l-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,n),o-=c}return(d?-1:1)*a*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var a,s,u,c=8*o-i-1,l=(1<<c)-1,h=l>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+h>=1?f/u:f*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=l?(s=0,a=l):a+h>=1?(s=(e*u-1)*Math.pow(2,i),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[r+d]=255&s,d+=p,s/=256,i-=8);for(a=a<<i|s,c+=i;c>0;t[r+d]=255&a,d+=p,a/=256,c-=8);t[r+d-p]|=128*m}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e){var r,n,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(t){if(r===setTimeout)return setTimeout(t,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(t){r=o}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(t){n=a}}();var u,c=[],l=!1,h=-1;function f(){l&&u&&(l=!1,u.length?c=u.concat(c):h=-1,c.length&&d())}function d(){if(!l){var t=s(f);l=!0;for(var e=c.length;e;){for(u=c,c=[];++h<e;)u&&u[h].run();h=-1,e=c.length}u=null,l=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===a||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function m(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];c.push(new p(t,e)),1!==c.length||l||s(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e,r){var n=r(23);t.exports=function(t){if(Array.isArray(t))return n(t)},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){var n=r(58),i=r(59),o=r(24),a=r(60);t.exports=function(t,e){return n(t)||i(t,e)||o(t,e)||a()},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(t){if(Array.isArray(t))return t},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,o=[],a=!0,s=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(o.push(n.value),!e||o.length!==e);a=!0);}catch(t){s=!0,i=t}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){var n=r(62);t.exports=n("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},function(t,e,r){"use strict";var n=r(63).Buffer;t.exports=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r<e.length;r++)e[r]=255;for(var i=0;i<t.length;i++){var o=t.charAt(i),a=o.charCodeAt(0);if(255!==e[a])throw new TypeError(o+" is ambiguous");e[a]=i}var s=t.length,u=t.charAt(0),c=Math.log(s)/Math.log(256),l=Math.log(256)/Math.log(s);function h(t){if("string"!=typeof t)throw new TypeError("Expected String");if(0===t.length)return n.alloc(0);for(var r=0,i=0,o=0;t[r]===u;)i++,r++;for(var a=(t.length-r)*c+1>>>0,l=new Uint8Array(a);t[r];){var h=e[t.charCodeAt(r)];if(255===h)return;for(var f=0,d=a-1;(0!==h||f<o)&&-1!==d;d--,f++)h+=s*l[d]>>>0,l[d]=h%256>>>0,h=h/256>>>0;if(0!==h)throw new Error("Non-zero carry");o=f,r++}for(var p=a-o;p!==a&&0===l[p];)p++;var m=n.allocUnsafe(i+(a-p));m.fill(0,0,i);for(var y=i;p!==a;)m[y++]=l[p++];return m}return{encode:function(e){if((Array.isArray(e)||e instanceof Uint8Array)&&(e=n.from(e)),!n.isBuffer(e))throw new TypeError("Expected Buffer");if(0===e.length)return"";for(var r=0,i=0,o=0,a=e.length;o!==a&&0===e[o];)o++,r++;for(var c=(a-o)*l+1>>>0,h=new Uint8Array(c);o!==a;){for(var f=e[o],d=0,p=c-1;(0!==f||d<i)&&-1!==p;p--,d++)f+=256*h[p]>>>0,h[p]=f%s>>>0,f=f/s>>>0;if(0!==f)throw new Error("Non-zero carry");i=d,o++}for(var m=c-i;m!==c&&0===h[m];)m++;for(var y=u.repeat(r);m<c;++m)y+=t.charAt(h[m]);return y},decodeUnsafe:h,decode:function(t){var e=h(t);if(e)return e;throw new Error("Non-base"+s+" character")}}}},function(t,e,r){
49
+ e.read=function(t,e,r,n,i){var o,a,s=8*i-n-1,u=(1<<s)-1,c=u>>1,l=-7,h=r?i-1:0,f=r?-1:1,d=t[e+h];for(h+=f,o=d&(1<<-l)-1,d>>=-l,l+=s;l>0;o=256*o+t[e+h],h+=f,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=n;l>0;a=256*a+t[e+h],h+=f,l-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,n),o-=c}return(d?-1:1)*a*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var a,s,u,c=8*o-i-1,l=(1<<c)-1,h=l>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+h>=1?f/u:f*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=l?(s=0,a=l):a+h>=1?(s=(e*u-1)*Math.pow(2,i),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[r+d]=255&s,d+=p,s/=256,i-=8);for(a=a<<i|s,c+=i;c>0;t[r+d]=255&a,d+=p,a/=256,c-=8);t[r+d-p]|=128*y}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e){var r,n,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(t){if(r===setTimeout)return setTimeout(t,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(t){r=o}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(t){n=a}}();var u,c=[],l=!1,h=-1;function f(){l&&u&&(l=!1,u.length?c=u.concat(c):h=-1,c.length&&d())}function d(){if(!l){var t=s(f);l=!0;for(var e=c.length;e;){for(u=c,c=[];++h<e;)u&&u[h].run();h=-1,e=c.length}u=null,l=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===a||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function y(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];c.push(new p(t,e)),1!==c.length||l||s(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=y,i.addListener=y,i.once=y,i.off=y,i.removeListener=y,i.removeAllListeners=y,i.emit=y,i.prependListener=y,i.prependOnceListener=y,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e,r){var n=r(23);t.exports=function(t){if(Array.isArray(t))return n(t)},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){var n=r(62),i=r(63),o=r(24),a=r(64);t.exports=function(t,e){return n(t)||i(t,e)||o(t,e)||a()},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(t){if(Array.isArray(t))return t},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,o=[],a=!0,s=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(o.push(n.value),!e||o.length!==e);a=!0);}catch(t){s=!0,i=t}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){var n=r(66);t.exports=n("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},function(t,e,r){"use strict";var n=r(67).Buffer;t.exports=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r<e.length;r++)e[r]=255;for(var i=0;i<t.length;i++){var o=t.charAt(i),a=o.charCodeAt(0);if(255!==e[a])throw new TypeError(o+" is ambiguous");e[a]=i}var s=t.length,u=t.charAt(0),c=Math.log(s)/Math.log(256),l=Math.log(256)/Math.log(s);function h(t){if("string"!=typeof t)throw new TypeError("Expected String");if(0===t.length)return n.alloc(0);for(var r=0,i=0,o=0;t[r]===u;)i++,r++;for(var a=(t.length-r)*c+1>>>0,l=new Uint8Array(a);t[r];){var h=e[t.charCodeAt(r)];if(255===h)return;for(var f=0,d=a-1;(0!==h||f<o)&&-1!==d;d--,f++)h+=s*l[d]>>>0,l[d]=h%256>>>0,h=h/256>>>0;if(0!==h)throw new Error("Non-zero carry");o=f,r++}for(var p=a-o;p!==a&&0===l[p];)p++;var y=n.allocUnsafe(i+(a-p));y.fill(0,0,i);for(var m=i;p!==a;)y[m++]=l[p++];return y}return{encode:function(e){if((Array.isArray(e)||e instanceof Uint8Array)&&(e=n.from(e)),!n.isBuffer(e))throw new TypeError("Expected Buffer");if(0===e.length)return"";for(var r=0,i=0,o=0,a=e.length;o!==a&&0===e[o];)o++,r++;for(var c=(a-o)*l+1>>>0,h=new Uint8Array(c);o!==a;){for(var f=e[o],d=0,p=c-1;(0!==f||d<i)&&-1!==p;p--,d++)f+=256*h[p]>>>0,h[p]=f%s>>>0,f=f/s>>>0;if(0!==f)throw new Error("Non-zero carry");i=d,o++}for(var y=c-i;y!==c&&0===h[y];)y++;for(var m=u.repeat(r);y<c;++y)m+=t.charAt(h[y]);return m},decodeUnsafe:h,decode:function(t){var e=h(t);if(e)return e;throw new Error("Non-base"+s+" character")}}}},function(t,e,r){
50
50
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
51
- var n=r(16),i=n.Buffer;function o(t,e){for(var r in t)e[r]=t[r]}function a(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=n:(o(n,e),e.Buffer=a),a.prototype=Object.create(i.prototype),o(i,a),a.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},a.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},a.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},a.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},function(t,e,r){var n;function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}!function(o){"use strict";var a,s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,u="function"==typeof Symbol&&"symbol"==i(Symbol.iterator),c=Math.ceil,l=Math.floor,h="[BigNumber Error] ",f=h+"Number primitive has more than 15 significant digits: ",d=1e14,p=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],m=1e9;function y(t){var e=0|t;return t>0||t===e?e:e-1}function g(t){for(var e,r,n=1,i=t.length,o=t[0]+"";n<i;){for(r=14-(e=t[n++]+"").length;r--;e="0"+e);o+=e}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function v(t,e){var r,n,i=t.c,o=e.c,a=t.s,s=e.s,u=t.e,c=e.e;if(!a||!s)return null;if(r=i&&!i[0],n=o&&!o[0],r||n)return r?n?0:-s:a;if(a!=s)return a;if(r=a<0,n=u==c,!i||!o)return n?0:!i^r?1:-1;if(!n)return u>c^r?1:-1;for(s=(u=i.length)<(c=o.length)?u:c,a=0;a<s;a++)if(i[a]!=o[a])return i[a]>o[a]^r?1:-1;return u==c?0:u>c^r?1:-1}function b(t,e,r,n){if(t<e||t>r||t!==l(t))throw Error(h+(n||"Argument")+("number"==typeof t?t<e||t>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function w(t){var e=t.c.length-1;return y(t.e/14)==e&&t.c[e]%2!=0}function _(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function k(t,e,r){var n,i;if(e<0){for(i=r+".";++e;i+=r);t=i+t}else if(++e>(n=t.length)){for(i=r,e-=n;--e;i+=r);t+=i}else e<n&&(t=t.slice(0,e)+"."+t.slice(e));return t}(a=function t(e){var r,n,o,a,x,A,E,S,I,M=F.prototype={constructor:F,toString:null,valueOf:null},T=new F(1),P=20,C=4,O=-7,R=21,N=-1e7,j=1e7,L=!1,U=1,D=0,B={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},z="0123456789abcdefghijklmnopqrstuvwxyz";function F(t,e){var r,i,a,u,c,h,d,p,m=this;if(!(m instanceof F))return new F(t,e);if(null==e){if(t&&!0===t._isBigNumber)return m.s=t.s,void(!t.c||t.e>j?m.c=m.e=null:t.e<N?m.c=[m.e=0]:(m.e=t.e,m.c=t.c.slice()));if((h="number"==typeof t)&&0*t==0){if(m.s=1/t<0?(t=-t,-1):1,t===~~t){for(u=0,c=t;c>=10;c/=10,u++);return void(u>j?m.c=m.e=null:(m.e=u,m.c=[t]))}p=String(t)}else{if(!s.test(p=String(t)))return o(m,p,h);m.s=45==p.charCodeAt(0)?(p=p.slice(1),-1):1}(u=p.indexOf("."))>-1&&(p=p.replace(".","")),(c=p.search(/e/i))>0?(u<0&&(u=c),u+=+p.slice(c+1),p=p.substring(0,c)):u<0&&(u=p.length)}else{if(b(e,2,z.length,"Base"),10==e)return V(m=new F(t),P+m.e+1,C);if(p=String(t),h="number"==typeof t){if(0*t!=0)return o(m,p,h,e);if(m.s=1/t<0?(p=p.slice(1),-1):1,F.DEBUG&&p.replace(/^0\.0*|\./,"").length>15)throw Error(f+t)}else m.s=45===p.charCodeAt(0)?(p=p.slice(1),-1):1;for(r=z.slice(0,e),u=c=0,d=p.length;c<d;c++)if(r.indexOf(i=p.charAt(c))<0){if("."==i){if(c>u){u=d;continue}}else if(!a&&(p==p.toUpperCase()&&(p=p.toLowerCase())||p==p.toLowerCase()&&(p=p.toUpperCase()))){a=!0,c=-1,u=0;continue}return o(m,String(t),h,e)}h=!1,(u=(p=n(p,e,10,m.s)).indexOf("."))>-1?p=p.replace(".",""):u=p.length}for(c=0;48===p.charCodeAt(c);c++);for(d=p.length;48===p.charCodeAt(--d););if(p=p.slice(c,++d)){if(d-=c,h&&F.DEBUG&&d>15&&(t>9007199254740991||t!==l(t)))throw Error(f+m.s*t);if((u=u-c-1)>j)m.c=m.e=null;else if(u<N)m.c=[m.e=0];else{if(m.e=u,m.c=[],c=(u+1)%14,u<0&&(c+=14),c<d){for(c&&m.c.push(+p.slice(0,c)),d-=14;c<d;)m.c.push(+p.slice(c,c+=14));c=14-(p=p.slice(c)).length}else c-=d;for(;c--;p+="0");m.c.push(+p)}}else m.c=[m.e=0]}function H(t,e,r,n){var i,o,a,s,u;if(null==r?r=C:b(r,0,8),!t.c)return t.toString();if(i=t.c[0],a=t.e,null==e)u=g(t.c),u=1==n||2==n&&(a<=O||a>=R)?_(u,a):k(u,a,"0");else if(o=(t=V(new F(t),e,r)).e,s=(u=g(t.c)).length,1==n||2==n&&(e<=o||o<=O)){for(;s<e;u+="0",s++);u=_(u,o)}else if(e-=a,u=k(u,o,"0"),o+1>s){if(--e>0)for(u+=".";e--;u+="0");}else if((e+=o-s)>0)for(o+1==s&&(u+=".");e--;u+="0");return t.s<0&&i?"-"+u:u}function q(t,e){for(var r,n=1,i=new F(t[0]);n<t.length;n++){if(!(r=new F(t[n])).s){i=r;break}e.call(i,r)&&(i=r)}return i}function G(t,e,r){for(var n=1,i=e.length;!e[--i];e.pop());for(i=e[0];i>=10;i/=10,n++);return(r=n+14*r-1)>j?t.c=t.e=null:r<N?t.c=[t.e=0]:(t.e=r,t.c=e),t}function V(t,e,r,n){var i,o,a,s,u,h,f,m=t.c,y=p;if(m){t:{for(i=1,s=m[0];s>=10;s/=10,i++);if((o=e-i)<0)o+=14,a=e,f=(u=m[h=0])/y[i-a-1]%10|0;else if((h=c((o+1)/14))>=m.length){if(!n)break t;for(;m.length<=h;m.push(0));u=f=0,i=1,a=(o%=14)-14+1}else{for(u=s=m[h],i=1;s>=10;s/=10,i++);f=(a=(o%=14)-14+i)<0?0:u/y[i-a-1]%10|0}if(n=n||e<0||null!=m[h+1]||(a<0?u:u%y[i-a-1]),n=r<4?(f||n)&&(0==r||r==(t.s<0?3:2)):f>5||5==f&&(4==r||n||6==r&&(o>0?a>0?u/y[i-a]:0:m[h-1])%10&1||r==(t.s<0?8:7)),e<1||!m[0])return m.length=0,n?(e-=t.e+1,m[0]=y[(14-e%14)%14],t.e=-e||0):m[0]=t.e=0,t;if(0==o?(m.length=h,s=1,h--):(m.length=h+1,s=y[14-o],m[h]=a>0?l(u/y[i-a]%y[a])*s:0),n)for(;;){if(0==h){for(o=1,a=m[0];a>=10;a/=10,o++);for(a=m[0]+=s,s=1;a>=10;a/=10,s++);o!=s&&(t.e++,m[0]==d&&(m[0]=1));break}if(m[h]+=s,m[h]!=d)break;m[h--]=0,s=1}for(o=m.length;0===m[--o];m.pop());}t.e>j?t.c=t.e=null:t.e<N&&(t.c=[t.e=0])}return t}function K(t){var e,r=t.e;return null===r?t.toString():(e=g(t.c),e=r<=O||r>=R?_(e,r):k(e,r,"0"),t.s<0?"-"+e:e)}return F.clone=t,F.ROUND_UP=0,F.ROUND_DOWN=1,F.ROUND_CEIL=2,F.ROUND_FLOOR=3,F.ROUND_HALF_UP=4,F.ROUND_HALF_DOWN=5,F.ROUND_HALF_EVEN=6,F.ROUND_HALF_CEIL=7,F.ROUND_HALF_FLOOR=8,F.EUCLID=9,F.config=F.set=function(t){var e,r;if(null!=t){if("object"!=i(t))throw Error(h+"Object expected: "+t);if(t.hasOwnProperty(e="DECIMAL_PLACES")&&(b(r=t[e],0,m,e),P=r),t.hasOwnProperty(e="ROUNDING_MODE")&&(b(r=t[e],0,8,e),C=r),t.hasOwnProperty(e="EXPONENTIAL_AT")&&((r=t[e])&&r.pop?(b(r[0],-m,0,e),b(r[1],0,m,e),O=r[0],R=r[1]):(b(r,-m,m,e),O=-(R=r<0?-r:r))),t.hasOwnProperty(e="RANGE"))if((r=t[e])&&r.pop)b(r[0],-m,-1,e),b(r[1],1,m,e),N=r[0],j=r[1];else{if(b(r,-m,m,e),!r)throw Error(h+e+" cannot be zero: "+r);N=-(j=r<0?-r:r)}if(t.hasOwnProperty(e="CRYPTO")){if((r=t[e])!==!!r)throw Error(h+e+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw L=!r,Error(h+"crypto unavailable");L=r}else L=r}if(t.hasOwnProperty(e="MODULO_MODE")&&(b(r=t[e],0,9,e),U=r),t.hasOwnProperty(e="POW_PRECISION")&&(b(r=t[e],0,m,e),D=r),t.hasOwnProperty(e="FORMAT")){if("object"!=i(r=t[e]))throw Error(h+e+" not an object: "+r);B=r}if(t.hasOwnProperty(e="ALPHABET")){if("string"!=typeof(r=t[e])||/^.$|[+-.\s]|(.).*\1/.test(r))throw Error(h+e+" invalid: "+r);z=r}}return{DECIMAL_PLACES:P,ROUNDING_MODE:C,EXPONENTIAL_AT:[O,R],RANGE:[N,j],CRYPTO:L,MODULO_MODE:U,POW_PRECISION:D,FORMAT:B,ALPHABET:z}},F.isBigNumber=function(t){if(!t||!0!==t._isBigNumber)return!1;if(!F.DEBUG)return!0;var e,r,n=t.c,i=t.e,o=t.s;t:if("[object Array]"=={}.toString.call(n)){if((1===o||-1===o)&&i>=-m&&i<=m&&i===l(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break t}if((e=(i+1)%14)<1&&(e+=14),String(n[0]).length==e){for(e=0;e<n.length;e++)if((r=n[e])<0||r>=d||r!==l(r))break t;if(0!==r)return!0}}}else if(null===n&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(h+"Invalid BigNumber: "+t)},F.maximum=F.max=function(){return q(arguments,M.lt)},F.minimum=F.min=function(){return q(arguments,M.gt)},F.random=(a=9007199254740992*Math.random()&2097151?function(){return l(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(t){var e,r,n,i,o,s=0,u=[],f=new F(T);if(null==t?t=P:b(t,0,m),i=c(t/14),L)if(crypto.getRandomValues){for(e=crypto.getRandomValues(new Uint32Array(i*=2));s<i;)(o=131072*e[s]+(e[s+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),e[s]=r[0],e[s+1]=r[1]):(u.push(o%1e14),s+=2);s=i/2}else{if(!crypto.randomBytes)throw L=!1,Error(h+"crypto unavailable");for(e=crypto.randomBytes(i*=7);s<i;)(o=281474976710656*(31&e[s])+1099511627776*e[s+1]+4294967296*e[s+2]+16777216*e[s+3]+(e[s+4]<<16)+(e[s+5]<<8)+e[s+6])>=9e15?crypto.randomBytes(7).copy(e,s):(u.push(o%1e14),s+=7);s=i/7}if(!L)for(;s<i;)(o=a())<9e15&&(u[s++]=o%1e14);for(t%=14,(i=u[--s])&&t&&(o=p[14-t],u[s]=l(i/o)*o);0===u[s];u.pop(),s--);if(s<0)u=[n=0];else{for(n=-1;0===u[0];u.splice(0,1),n-=14);for(s=1,o=u[0];o>=10;o/=10,s++);s<14&&(n-=14-s)}return f.e=n,f.c=u,f}),F.sum=function(){for(var t=1,e=arguments,r=new F(e[0]);t<e.length;)r=r.plus(e[t++]);return r},n=function(){function t(t,e,r,n){for(var i,o,a=[0],s=0,u=t.length;s<u;){for(o=a.length;o--;a[o]*=e);for(a[0]+=n.indexOf(t.charAt(s++)),i=0;i<a.length;i++)a[i]>r-1&&(null==a[i+1]&&(a[i+1]=0),a[i+1]+=a[i]/r|0,a[i]%=r)}return a.reverse()}return function(e,n,i,o,a){var s,u,c,l,h,f,d,p,m=e.indexOf("."),y=P,v=C;for(m>=0&&(l=D,D=0,e=e.replace(".",""),f=(p=new F(n)).pow(e.length-m),D=l,p.c=t(k(g(f.c),f.e,"0"),10,i,"0123456789"),p.e=p.c.length),c=l=(d=t(e,n,i,a?(s=z,"0123456789"):(s="0123456789",z))).length;0==d[--l];d.pop());if(!d[0])return s.charAt(0);if(m<0?--c:(f.c=d,f.e=c,f.s=o,d=(f=r(f,p,y,v,i)).c,h=f.r,c=f.e),m=d[u=c+y+1],l=i/2,h=h||u<0||null!=d[u+1],h=v<4?(null!=m||h)&&(0==v||v==(f.s<0?3:2)):m>l||m==l&&(4==v||h||6==v&&1&d[u-1]||v==(f.s<0?8:7)),u<1||!d[0])e=h?k(s.charAt(1),-y,s.charAt(0)):s.charAt(0);else{if(d.length=u,h)for(--i;++d[--u]>i;)d[u]=0,u||(++c,d=[1].concat(d));for(l=d.length;!d[--l];);for(m=0,e="";m<=l;e+=s.charAt(d[m++]));e=k(e,c,s.charAt(0))}return e}}(),r=function(){function t(t,e,r){var n,i,o,a,s=0,u=t.length,c=e%1e7,l=e/1e7|0;for(t=t.slice();u--;)s=((i=c*(o=t[u]%1e7)+(n=l*o+(a=t[u]/1e7|0)*c)%1e7*1e7+s)/r|0)+(n/1e7|0)+l*a,t[u]=i%r;return s&&(t=[s].concat(t)),t}function e(t,e,r,n){var i,o;if(r!=n)o=r>n?1:-1;else for(i=o=0;i<r;i++)if(t[i]!=e[i]){o=t[i]>e[i]?1:-1;break}return o}function r(t,e,r,n){for(var i=0;r--;)t[r]-=i,i=t[r]<e[r]?1:0,t[r]=i*n+t[r]-e[r];for(;!t[0]&&t.length>1;t.splice(0,1));}return function(n,i,o,a,s){var u,c,h,f,p,m,g,v,b,w,_,k,x,A,E,S,I,M=n.s==i.s?1:-1,T=n.c,P=i.c;if(!(T&&T[0]&&P&&P[0]))return new F(n.s&&i.s&&(T?!P||T[0]!=P[0]:P)?T&&0==T[0]||!P?0*M:M/0:NaN);for(b=(v=new F(M)).c=[],M=o+(c=n.e-i.e)+1,s||(s=d,c=y(n.e/14)-y(i.e/14),M=M/14|0),h=0;P[h]==(T[h]||0);h++);if(P[h]>(T[h]||0)&&c--,M<0)b.push(1),f=!0;else{for(A=T.length,S=P.length,h=0,M+=2,(p=l(s/(P[0]+1)))>1&&(P=t(P,p,s),T=t(T,p,s),S=P.length,A=T.length),x=S,_=(w=T.slice(0,S)).length;_<S;w[_++]=0);I=P.slice(),I=[0].concat(I),E=P[0],P[1]>=s/2&&E++;do{if(p=0,(u=e(P,w,S,_))<0){if(k=w[0],S!=_&&(k=k*s+(w[1]||0)),(p=l(k/E))>1)for(p>=s&&(p=s-1),g=(m=t(P,p,s)).length,_=w.length;1==e(m,w,g,_);)p--,r(m,S<g?I:P,g,s),g=m.length,u=1;else 0==p&&(u=p=1),g=(m=P.slice()).length;if(g<_&&(m=[0].concat(m)),r(w,m,_,s),_=w.length,-1==u)for(;e(P,w,S,_)<1;)p++,r(w,S<_?I:P,_,s),_=w.length}else 0===u&&(p++,w=[0]);b[h++]=p,w[0]?w[_++]=T[x]||0:(w=[T[x]],_=1)}while((x++<A||null!=w[0])&&M--);f=null!=w[0],b[0]||b.splice(0,1)}if(s==d){for(h=1,M=b[0];M>=10;M/=10,h++);V(v,o+(v.e=h+14*c-1)+1,a,f)}else v.e=c,v.r=+f;return v}}(),x=/^(-?)0([xbo])(?=\w[\w.]*$)/i,A=/^([^.]+)\.$/,E=/^\.([^.]+)$/,S=/^-?(Infinity|NaN)$/,I=/^\s*\+(?=[\w.])|^\s+|\s+$/g,o=function(t,e,r,n){var i,o=r?e:e.replace(I,"");if(S.test(o))t.s=isNaN(o)?null:o<0?-1:1;else{if(!r&&(o=o.replace(x,(function(t,e,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?t:e})),n&&(i=n,o=o.replace(A,"$1").replace(E,"0.$1")),e!=o))return new F(o,i);if(F.DEBUG)throw Error(h+"Not a"+(n?" base "+n:"")+" number: "+e);t.s=null}t.c=t.e=null},M.absoluteValue=M.abs=function(){var t=new F(this);return t.s<0&&(t.s=1),t},M.comparedTo=function(t,e){return v(this,new F(t,e))},M.decimalPlaces=M.dp=function(t,e){var r,n,i,o=this;if(null!=t)return b(t,0,m),null==e?e=C:b(e,0,8),V(new F(o),t+o.e+1,e);if(!(r=o.c))return null;if(n=14*((i=r.length-1)-y(this.e/14)),i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},M.dividedBy=M.div=function(t,e){return r(this,new F(t,e),P,C)},M.dividedToIntegerBy=M.idiv=function(t,e){return r(this,new F(t,e),0,1)},M.exponentiatedBy=M.pow=function(t,e){var r,n,i,o,a,s,u,f,d=this;if((t=new F(t)).c&&!t.isInteger())throw Error(h+"Exponent not an integer: "+K(t));if(null!=e&&(e=new F(e)),a=t.e>14,!d.c||!d.c[0]||1==d.c[0]&&!d.e&&1==d.c.length||!t.c||!t.c[0])return f=new F(Math.pow(+K(d),a?2-w(t):+K(t))),e?f.mod(e):f;if(s=t.s<0,e){if(e.c?!e.c[0]:!e.s)return new F(NaN);(n=!s&&d.isInteger()&&e.isInteger())&&(d=d.mod(e))}else{if(t.e>9&&(d.e>0||d.e<-1||(0==d.e?d.c[0]>1||a&&d.c[1]>=24e7:d.c[0]<8e13||a&&d.c[0]<=9999975e7)))return o=d.s<0&&w(t)?-0:0,d.e>-1&&(o=1/o),new F(s?1/o:o);D&&(o=c(D/14+2))}for(a?(r=new F(.5),s&&(t.s=1),u=w(t)):u=(i=Math.abs(+K(t)))%2,f=new F(T);;){if(u){if(!(f=f.times(d)).c)break;o?f.c.length>o&&(f.c.length=o):n&&(f=f.mod(e))}if(i){if(0===(i=l(i/2)))break;u=i%2}else if(V(t=t.times(r),t.e+1,1),t.e>14)u=w(t);else{if(0===(i=+K(t)))break;u=i%2}d=d.times(d),o?d.c&&d.c.length>o&&(d.c.length=o):n&&(d=d.mod(e))}return n?f:(s&&(f=T.div(f)),e?f.mod(e):o?V(f,D,C,void 0):f)},M.integerValue=function(t){var e=new F(this);return null==t?t=C:b(t,0,8),V(e,e.e+1,t)},M.isEqualTo=M.eq=function(t,e){return 0===v(this,new F(t,e))},M.isFinite=function(){return!!this.c},M.isGreaterThan=M.gt=function(t,e){return v(this,new F(t,e))>0},M.isGreaterThanOrEqualTo=M.gte=function(t,e){return 1===(e=v(this,new F(t,e)))||0===e},M.isInteger=function(){return!!this.c&&y(this.e/14)>this.c.length-2},M.isLessThan=M.lt=function(t,e){return v(this,new F(t,e))<0},M.isLessThanOrEqualTo=M.lte=function(t,e){return-1===(e=v(this,new F(t,e)))||0===e},M.isNaN=function(){return!this.s},M.isNegative=function(){return this.s<0},M.isPositive=function(){return this.s>0},M.isZero=function(){return!!this.c&&0==this.c[0]},M.minus=function(t,e){var r,n,i,o,a=this,s=a.s;if(e=(t=new F(t,e)).s,!s||!e)return new F(NaN);if(s!=e)return t.s=-e,a.plus(t);var u=a.e/14,c=t.e/14,l=a.c,h=t.c;if(!u||!c){if(!l||!h)return l?(t.s=-e,t):new F(h?a:NaN);if(!l[0]||!h[0])return h[0]?(t.s=-e,t):new F(l[0]?a:3==C?-0:0)}if(u=y(u),c=y(c),l=l.slice(),s=u-c){for((o=s<0)?(s=-s,i=l):(c=u,i=h),i.reverse(),e=s;e--;i.push(0));i.reverse()}else for(n=(o=(s=l.length)<(e=h.length))?s:e,s=e=0;e<n;e++)if(l[e]!=h[e]){o=l[e]<h[e];break}if(o&&(i=l,l=h,h=i,t.s=-t.s),(e=(n=h.length)-(r=l.length))>0)for(;e--;l[r++]=0);for(e=d-1;n>s;){if(l[--n]<h[n]){for(r=n;r&&!l[--r];l[r]=e);--l[r],l[n]+=d}l[n]-=h[n]}for(;0==l[0];l.splice(0,1),--c);return l[0]?G(t,l,c):(t.s=3==C?-1:1,t.c=[t.e=0],t)},M.modulo=M.mod=function(t,e){var n,i,o=this;return t=new F(t,e),!o.c||!t.s||t.c&&!t.c[0]?new F(NaN):!t.c||o.c&&!o.c[0]?new F(o):(9==U?(i=t.s,t.s=1,n=r(o,t,0,3),t.s=i,n.s*=i):n=r(o,t,0,U),(t=o.minus(n.times(t))).c[0]||1!=U||(t.s=o.s),t)},M.multipliedBy=M.times=function(t,e){var r,n,i,o,a,s,u,c,l,h,f,p,m,g,v=this,b=v.c,w=(t=new F(t,e)).c;if(!(b&&w&&b[0]&&w[0]))return!v.s||!t.s||b&&!b[0]&&!w||w&&!w[0]&&!b?t.c=t.e=t.s=null:(t.s*=v.s,b&&w?(t.c=[0],t.e=0):t.c=t.e=null),t;for(n=y(v.e/14)+y(t.e/14),t.s*=v.s,(u=b.length)<(h=w.length)&&(m=b,b=w,w=m,i=u,u=h,h=i),i=u+h,m=[];i--;m.push(0));for(g=d,1e7,i=h;--i>=0;){for(r=0,f=w[i]%1e7,p=w[i]/1e7|0,o=i+(a=u);o>i;)r=((c=f*(c=b[--a]%1e7)+(s=p*c+(l=b[a]/1e7|0)*f)%1e7*1e7+m[o]+r)/g|0)+(s/1e7|0)+p*l,m[o--]=c%g;m[o]=r}return r?++n:m.splice(0,1),G(t,m,n)},M.negated=function(){var t=new F(this);return t.s=-t.s||null,t},M.plus=function(t,e){var r,n=this,i=n.s;if(e=(t=new F(t,e)).s,!i||!e)return new F(NaN);if(i!=e)return t.s=-e,n.minus(t);var o=n.e/14,a=t.e/14,s=n.c,u=t.c;if(!o||!a){if(!s||!u)return new F(i/0);if(!s[0]||!u[0])return u[0]?t:new F(s[0]?n:0*i)}if(o=y(o),a=y(a),s=s.slice(),i=o-a){for(i>0?(a=o,r=u):(i=-i,r=s),r.reverse();i--;r.push(0));r.reverse()}for((i=s.length)-(e=u.length)<0&&(r=u,u=s,s=r,e=i),i=0;e;)i=(s[--e]=s[e]+u[e]+i)/d|0,s[e]=d===s[e]?0:s[e]%d;return i&&(s=[i].concat(s),++a),G(t,s,a)},M.precision=M.sd=function(t,e){var r,n,i,o=this;if(null!=t&&t!==!!t)return b(t,1,m),null==e?e=C:b(e,0,8),V(new F(o),t,e);if(!(r=o.c))return null;if(n=14*(i=r.length-1)+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return t&&o.e+1>n&&(n=o.e+1),n},M.shiftedBy=function(t){return b(t,-9007199254740991,9007199254740991),this.times("1e"+t)},M.squareRoot=M.sqrt=function(){var t,e,n,i,o,a=this,s=a.c,u=a.s,c=a.e,l=P+4,h=new F("0.5");if(1!==u||!s||!s[0])return new F(!u||u<0&&(!s||s[0])?NaN:s?a:1/0);if(0==(u=Math.sqrt(+K(a)))||u==1/0?(((e=g(s)).length+c)%2==0&&(e+="0"),u=Math.sqrt(+e),c=y((c+1)/2)-(c<0||c%2),n=new F(e=u==1/0?"1e"+c:(e=u.toExponential()).slice(0,e.indexOf("e")+1)+c)):n=new F(u+""),n.c[0])for((u=(c=n.e)+l)<3&&(u=0);;)if(o=n,n=h.times(o.plus(r(a,o,l,1))),g(o.c).slice(0,u)===(e=g(n.c)).slice(0,u)){if(n.e<c&&--u,"9999"!=(e=e.slice(u-3,u+1))&&(i||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(V(n,n.e+P+2,1),t=!n.times(n).eq(a));break}if(!i&&(V(o,o.e+P+2,0),o.times(o).eq(a))){n=o;break}l+=4,u+=4,i=1}return V(n,n.e+P+1,C,t)},M.toExponential=function(t,e){return null!=t&&(b(t,0,m),t++),H(this,t,e,1)},M.toFixed=function(t,e){return null!=t&&(b(t,0,m),t=t+this.e+1),H(this,t,e)},M.toFormat=function(t,e,r){var n,o=this;if(null==r)null!=t&&e&&"object"==i(e)?(r=e,e=null):t&&"object"==i(t)?(r=t,t=e=null):r=B;else if("object"!=i(r))throw Error(h+"Argument not an object: "+r);if(n=o.toFixed(t,e),o.c){var a,s=n.split("."),u=+r.groupSize,c=+r.secondaryGroupSize,l=r.groupSeparator||"",f=s[0],d=s[1],p=o.s<0,m=p?f.slice(1):f,y=m.length;if(c&&(a=u,u=c,c=a,y-=a),u>0&&y>0){for(a=y%u||u,f=m.substr(0,a);a<y;a+=u)f+=l+m.substr(a,u);c>0&&(f+=l+m.slice(a)),p&&(f="-"+f)}n=d?f+(r.decimalSeparator||"")+((c=+r.fractionGroupSize)?d.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):d):f}return(r.prefix||"")+n+(r.suffix||"")},M.toFraction=function(t){var e,n,i,o,a,s,u,c,l,f,d,m,y=this,v=y.c;if(null!=t&&(!(u=new F(t)).isInteger()&&(u.c||1!==u.s)||u.lt(T)))throw Error(h+"Argument "+(u.isInteger()?"out of range: ":"not an integer: ")+K(u));if(!v)return new F(y);for(e=new F(T),l=n=new F(T),i=c=new F(T),m=g(v),a=e.e=m.length-y.e-1,e.c[0]=p[(s=a%14)<0?14+s:s],t=!t||u.comparedTo(e)>0?a>0?e:l:u,s=j,j=1/0,u=new F(m),c.c[0]=0;f=r(u,e,0,1),1!=(o=n.plus(f.times(i))).comparedTo(t);)n=i,i=o,l=c.plus(f.times(o=l)),c=o,e=u.minus(f.times(o=e)),u=o;return o=r(t.minus(n),i,0,1),c=c.plus(o.times(l)),n=n.plus(o.times(i)),c.s=l.s=y.s,d=r(l,i,a*=2,C).minus(y).abs().comparedTo(r(c,n,a,C).minus(y).abs())<1?[l,i]:[c,n],j=s,d},M.toNumber=function(){return+K(this)},M.toPrecision=function(t,e){return null!=t&&b(t,1,m),H(this,t,e,2)},M.toString=function(t){var e,r=this,i=r.s,o=r.e;return null===o?i?(e="Infinity",i<0&&(e="-"+e)):e="NaN":(null==t?e=o<=O||o>=R?_(g(r.c),o):k(g(r.c),o,"0"):10===t?e=k(g((r=V(new F(r),P+o+1,C)).c),r.e,"0"):(b(t,2,z.length,"Base"),e=n(k(g(r.c),o,"0"),10,t,i,!0)),i<0&&r.c[0]&&(e="-"+e)),e},M.valueOf=M.toJSON=function(){return K(this)},M._isBigNumber=!0,u&&(M[Symbol.toStringTag]="BigNumber",M[Symbol.for("nodejs.util.inspect.custom")]=M.valueOf),null!=e&&F.set(e),F}()).default=a.BigNumber=a,void 0===(n=function(){return a}.call(e,r,e,t))||(t.exports=n)}()},function(t,e,r){t.exports={encode:r(66),decode:r(67),encodingLength:r(68)}},function(t,e){t.exports=function t(e,n,i){n=n||[];var o=i=i||0;for(;e>=r;)n[i++]=255&e|128,e/=128;for(;-128&e;)n[i++]=255&e|128,e>>>=7;return n[i]=0|e,t.bytes=i-o+1,n};var r=Math.pow(2,31)},function(t,e){t.exports=function t(e,r){var n,i=0,o=0,a=r=r||0,s=e.length;do{if(a>=s)throw t.bytes=0,new RangeError("Could not decode varint");n=e[a++],i+=o<28?(127&n)<<o:(127&n)*Math.pow(2,o),o+=7}while(n>=128);return t.bytes=a-r,i}},function(t,e){var r=Math.pow(2,7),n=Math.pow(2,14),i=Math.pow(2,21),o=Math.pow(2,28),a=Math.pow(2,35),s=Math.pow(2,42),u=Math.pow(2,49),c=Math.pow(2,56),l=Math.pow(2,63);t.exports=function(t){return t<r?1:t<n?2:t<i?3:t<o?4:t<a?5:t<s?6:t<u?7:t<c?8:t<l?9:10}},function(t,e,r){"use strict";r.r(e),r.d(e,"Deflate",(function(){return We})),r.d(e,"Inflate",(function(){return Ye})),r.d(e,"constants",(function(){return rr})),r.d(e,"default",(function(){return nr})),r.d(e,"deflate",(function(){return Je})),r.d(e,"deflateRaw",(function(){return Qe})),r.d(e,"gzip",(function(){return $e})),r.d(e,"inflate",(function(){return Xe})),r.d(e,"inflateRaw",(function(){return tr})),r.d(e,"ungzip",(function(){return er}));function n(t){let e=t.length;for(;--e>=0;)t[e]=0}const i=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),o=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),a=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),s=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),u=new Array(576);n(u);const c=new Array(60);n(c);const l=new Array(512);n(l);const h=new Array(256);n(h);const f=new Array(29);n(f);const d=new Array(30);function p(t,e,r,n,i){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=t&&t.length}let m,y,g;function v(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}n(d);const b=t=>t<256?l[t]:l[256+(t>>>7)],w=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},_=(t,e,r)=>{t.bi_valid>16-r?(t.bi_buf|=e<<t.bi_valid&65535,w(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=r-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=r)},k=(t,e,r)=>{_(t,r[2*e],r[2*e+1])},x=(t,e)=>{let r=0;do{r|=1&t,t>>>=1,r<<=1}while(--e>0);return r>>>1},A=(t,e,r)=>{const n=new Array(16);let i,o,a=0;for(i=1;i<=15;i++)n[i]=a=a+r[i-1]<<1;for(o=0;o<=e;o++){let e=t[2*o+1];0!==e&&(t[2*o]=x(n[e]++,e))}},E=t=>{let e;for(e=0;e<286;e++)t.dyn_ltree[2*e]=0;for(e=0;e<30;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0},S=t=>{t.bi_valid>8?w(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},I=(t,e,r,n)=>{const i=2*e,o=2*r;return t[i]<t[o]||t[i]===t[o]&&n[e]<=n[r]},M=(t,e,r)=>{const n=t.heap[r];let i=r<<1;for(;i<=t.heap_len&&(i<t.heap_len&&I(e,t.heap[i+1],t.heap[i],t.depth)&&i++,!I(e,n,t.heap[i],t.depth));)t.heap[r]=t.heap[i],r=i,i<<=1;t.heap[r]=n},T=(t,e,r)=>{let n,a,s,u,c=0;if(0!==t.last_lit)do{n=t.pending_buf[t.d_buf+2*c]<<8|t.pending_buf[t.d_buf+2*c+1],a=t.pending_buf[t.l_buf+c],c++,0===n?k(t,a,e):(s=h[a],k(t,s+256+1,e),u=i[s],0!==u&&(a-=f[s],_(t,a,u)),n--,s=b(n),k(t,s,r),u=o[s],0!==u&&(n-=d[s],_(t,n,u)))}while(c<t.last_lit);k(t,256,e)},P=(t,e)=>{const r=e.dyn_tree,n=e.stat_desc.static_tree,i=e.stat_desc.has_stree,o=e.stat_desc.elems;let a,s,u,c=-1;for(t.heap_len=0,t.heap_max=573,a=0;a<o;a++)0!==r[2*a]?(t.heap[++t.heap_len]=c=a,t.depth[a]=0):r[2*a+1]=0;for(;t.heap_len<2;)u=t.heap[++t.heap_len]=c<2?++c:0,r[2*u]=1,t.depth[u]=0,t.opt_len--,i&&(t.static_len-=n[2*u+1]);for(e.max_code=c,a=t.heap_len>>1;a>=1;a--)M(t,r,a);u=o;do{a=t.heap[1],t.heap[1]=t.heap[t.heap_len--],M(t,r,1),s=t.heap[1],t.heap[--t.heap_max]=a,t.heap[--t.heap_max]=s,r[2*u]=r[2*a]+r[2*s],t.depth[u]=(t.depth[a]>=t.depth[s]?t.depth[a]:t.depth[s])+1,r[2*a+1]=r[2*s+1]=u,t.heap[1]=u++,M(t,r,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const r=e.dyn_tree,n=e.max_code,i=e.stat_desc.static_tree,o=e.stat_desc.has_stree,a=e.stat_desc.extra_bits,s=e.stat_desc.extra_base,u=e.stat_desc.max_length;let c,l,h,f,d,p,m=0;for(f=0;f<=15;f++)t.bl_count[f]=0;for(r[2*t.heap[t.heap_max]+1]=0,c=t.heap_max+1;c<573;c++)l=t.heap[c],f=r[2*r[2*l+1]+1]+1,f>u&&(f=u,m++),r[2*l+1]=f,l>n||(t.bl_count[f]++,d=0,l>=s&&(d=a[l-s]),p=r[2*l],t.opt_len+=p*(f+d),o&&(t.static_len+=p*(i[2*l+1]+d)));if(0!==m){do{for(f=u-1;0===t.bl_count[f];)f--;t.bl_count[f]--,t.bl_count[f+1]+=2,t.bl_count[u]--,m-=2}while(m>0);for(f=u;0!==f;f--)for(l=t.bl_count[f];0!==l;)h=t.heap[--c],h>n||(r[2*h+1]!==f&&(t.opt_len+=(f-r[2*h+1])*r[2*h],r[2*h+1]=f),l--)}})(t,e),A(r,c,t.bl_count)},C=(t,e,r)=>{let n,i,o=-1,a=e[1],s=0,u=7,c=4;for(0===a&&(u=138,c=3),e[2*(r+1)+1]=65535,n=0;n<=r;n++)i=a,a=e[2*(n+1)+1],++s<u&&i===a||(s<c?t.bl_tree[2*i]+=s:0!==i?(i!==o&&t.bl_tree[2*i]++,t.bl_tree[32]++):s<=10?t.bl_tree[34]++:t.bl_tree[36]++,s=0,o=i,0===a?(u=138,c=3):i===a?(u=6,c=3):(u=7,c=4))},O=(t,e,r)=>{let n,i,o=-1,a=e[1],s=0,u=7,c=4;for(0===a&&(u=138,c=3),n=0;n<=r;n++)if(i=a,a=e[2*(n+1)+1],!(++s<u&&i===a)){if(s<c)do{k(t,i,t.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&(k(t,i,t.bl_tree),s--),k(t,16,t.bl_tree),_(t,s-3,2)):s<=10?(k(t,17,t.bl_tree),_(t,s-3,3)):(k(t,18,t.bl_tree),_(t,s-11,7));s=0,o=i,0===a?(u=138,c=3):i===a?(u=6,c=3):(u=7,c=4)}};let R=!1;const N=(t,e,r,n)=>{_(t,0+(n?1:0),3),((t,e,r,n)=>{S(t),n&&(w(t,r),w(t,~r)),t.pending_buf.set(t.window.subarray(e,e+r),t.pending),t.pending+=r})(t,e,r,!0)};var j={_tr_init:t=>{R||((()=>{let t,e,r,n,s;const v=new Array(16);for(r=0,n=0;n<28;n++)for(f[n]=r,t=0;t<1<<i[n];t++)h[r++]=n;for(h[r-1]=n,s=0,n=0;n<16;n++)for(d[n]=s,t=0;t<1<<o[n];t++)l[s++]=n;for(s>>=7;n<30;n++)for(d[n]=s<<7,t=0;t<1<<o[n]-7;t++)l[256+s++]=n;for(e=0;e<=15;e++)v[e]=0;for(t=0;t<=143;)u[2*t+1]=8,t++,v[8]++;for(;t<=255;)u[2*t+1]=9,t++,v[9]++;for(;t<=279;)u[2*t+1]=7,t++,v[7]++;for(;t<=287;)u[2*t+1]=8,t++,v[8]++;for(A(u,287,v),t=0;t<30;t++)c[2*t+1]=5,c[2*t]=x(t,5);m=new p(u,i,257,286,15),y=new p(c,o,0,30,15),g=new p(new Array(0),a,0,19,7)})(),R=!0),t.l_desc=new v(t.dyn_ltree,m),t.d_desc=new v(t.dyn_dtree,y),t.bl_desc=new v(t.bl_tree,g),t.bi_buf=0,t.bi_valid=0,E(t)},_tr_stored_block:N,_tr_flush_block:(t,e,r,n)=>{let i,o,a=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,r=4093624447;for(e=0;e<=31;e++,r>>>=1)if(1&r&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<256;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0})(t)),P(t,t.l_desc),P(t,t.d_desc),a=(t=>{let e;for(C(t,t.dyn_ltree,t.l_desc.max_code),C(t,t.dyn_dtree,t.d_desc.max_code),P(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*s[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),i=t.opt_len+3+7>>>3,o=t.static_len+3+7>>>3,o<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==e?N(t,e,r,n):4===t.strategy||o===i?(_(t,2+(n?1:0),3),T(t,u,c)):(_(t,4+(n?1:0),3),((t,e,r,n)=>{let i;for(_(t,e-257,5),_(t,r-1,5),_(t,n-4,4),i=0;i<n;i++)_(t,t.bl_tree[2*s[i]+1],3);O(t,t.dyn_ltree,e-1),O(t,t.dyn_dtree,r-1)})(t,t.l_desc.max_code+1,t.d_desc.max_code+1,a+1),T(t,t.dyn_ltree,t.dyn_dtree)),E(t),n&&S(t)},_tr_tally:(t,e,r)=>(t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&r,t.last_lit++,0===e?t.dyn_ltree[2*r]++:(t.matches++,e--,t.dyn_ltree[2*(h[r]+256+1)]++,t.dyn_dtree[2*b(e)]++),t.last_lit===t.lit_bufsize-1),_tr_align:t=>{_(t,2,3),k(t,256,u),(t=>{16===t.bi_valid?(w(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(t)}};var L=(t,e,r,n)=>{let i=65535&t|0,o=t>>>16&65535|0,a=0;for(;0!==r;){a=r>2e3?2e3:r,r-=a;do{i=i+e[n++]|0,o=o+i|0}while(--a);i%=65521,o%=65521}return i|o<<16|0};const U=new Uint32Array((()=>{let t,e=[];for(var r=0;r<256;r++){t=r;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[r]=t}return e})());var D=(t,e,r,n)=>{const i=U,o=n+r;t^=-1;for(let r=n;r<o;r++)t=t>>>8^i[255&(t^e[r])];return-1^t},B={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},z={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:F,_tr_stored_block:H,_tr_flush_block:q,_tr_tally:G,_tr_align:V}=j,{Z_NO_FLUSH:K,Z_PARTIAL_FLUSH:Z,Z_FULL_FLUSH:W,Z_FINISH:J,Z_BLOCK:Q,Z_OK:$,Z_STREAM_END:Y,Z_STREAM_ERROR:X,Z_DATA_ERROR:tt,Z_BUF_ERROR:et,Z_DEFAULT_COMPRESSION:rt,Z_FILTERED:nt,Z_HUFFMAN_ONLY:it,Z_RLE:ot,Z_FIXED:at,Z_DEFAULT_STRATEGY:st,Z_UNKNOWN:ut,Z_DEFLATED:ct}=z,lt=(t,e)=>(t.msg=B[e],e),ht=t=>(t<<1)-(t>4?9:0),ft=t=>{let e=t.length;for(;--e>=0;)t[e]=0};let dt=(t,e,r)=>(e<<t.hash_shift^r)&t.hash_mask;const pt=t=>{const e=t.state;let r=e.pending;r>t.avail_out&&(r=t.avail_out),0!==r&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+r),t.next_out),t.next_out+=r,e.pending_out+=r,t.total_out+=r,t.avail_out-=r,e.pending-=r,0===e.pending&&(e.pending_out=0))},mt=(t,e)=>{q(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,pt(t.strm)},yt=(t,e)=>{t.pending_buf[t.pending++]=e},gt=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},vt=(t,e,r,n)=>{let i=t.avail_in;return i>n&&(i=n),0===i?0:(t.avail_in-=i,e.set(t.input.subarray(t.next_in,t.next_in+i),r),1===t.state.wrap?t.adler=L(t.adler,e,i,r):2===t.state.wrap&&(t.adler=D(t.adler,e,i,r)),t.next_in+=i,t.total_in+=i,i)},bt=(t,e)=>{let r,n,i=t.max_chain_length,o=t.strstart,a=t.prev_length,s=t.nice_match;const u=t.strstart>t.w_size-262?t.strstart-(t.w_size-262):0,c=t.window,l=t.w_mask,h=t.prev,f=t.strstart+258;let d=c[o+a-1],p=c[o+a];t.prev_length>=t.good_match&&(i>>=2),s>t.lookahead&&(s=t.lookahead);do{if(r=e,c[r+a]===p&&c[r+a-1]===d&&c[r]===c[o]&&c[++r]===c[o+1]){o+=2,r++;do{}while(c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&o<f);if(n=258-(f-o),o=f-258,n>a){if(t.match_start=e,a=n,n>=s)break;d=c[o+a-1],p=c[o+a]}}}while((e=h[e&l])>u&&0!=--i);return a<=t.lookahead?a:t.lookahead},wt=t=>{const e=t.w_size;let r,n,i,o,a;do{if(o=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-262)){t.window.set(t.window.subarray(e,e+e),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,n=t.hash_size,r=n;do{i=t.head[--r],t.head[r]=i>=e?i-e:0}while(--n);n=e,r=n;do{i=t.prev[--r],t.prev[r]=i>=e?i-e:0}while(--n);o+=e}if(0===t.strm.avail_in)break;if(n=vt(t.strm,t.window,t.strstart+t.lookahead,o),t.lookahead+=n,t.lookahead+t.insert>=3)for(a=t.strstart-t.insert,t.ins_h=t.window[a],t.ins_h=dt(t,t.ins_h,t.window[a+1]);t.insert&&(t.ins_h=dt(t,t.ins_h,t.window[a+3-1]),t.prev[a&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=a,a++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<262&&0!==t.strm.avail_in)},_t=(t,e)=>{let r,n;for(;;){if(t.lookahead<262){if(wt(t),t.lookahead<262&&e===K)return 1;if(0===t.lookahead)break}if(r=0,t.lookahead>=3&&(t.ins_h=dt(t,t.ins_h,t.window[t.strstart+3-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==r&&t.strstart-r<=t.w_size-262&&(t.match_length=bt(t,r)),t.match_length>=3)if(n=G(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=dt(t,t.ins_h,t.window[t.strstart+3-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=dt(t,t.ins_h,t.window[t.strstart+1]);else n=G(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(mt(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===J?(mt(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(mt(t,!1),0===t.strm.avail_out)?1:2},kt=(t,e)=>{let r,n,i;for(;;){if(t.lookahead<262){if(wt(t),t.lookahead<262&&e===K)return 1;if(0===t.lookahead)break}if(r=0,t.lookahead>=3&&(t.ins_h=dt(t,t.ins_h,t.window[t.strstart+3-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==r&&t.prev_length<t.max_lazy_match&&t.strstart-r<=t.w_size-262&&(t.match_length=bt(t,r),t.match_length<=5&&(t.strategy===nt||3===t.match_length&&t.strstart-t.match_start>4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-3,n=G(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=i&&(t.ins_h=dt(t,t.ins_h,t.window[t.strstart+3-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,n&&(mt(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(n=G(t,0,t.window[t.strstart-1]),n&&mt(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=G(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===J?(mt(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(mt(t,!1),0===t.strm.avail_out)?1:2};function xt(t,e,r,n,i){this.good_length=t,this.max_lazy=e,this.nice_length=r,this.max_chain=n,this.func=i}const At=[new xt(0,0,0,0,(t,e)=>{let r=65535;for(r>t.pending_buf_size-5&&(r=t.pending_buf_size-5);;){if(t.lookahead<=1){if(wt(t),0===t.lookahead&&e===K)return 1;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;const n=t.block_start+r;if((0===t.strstart||t.strstart>=n)&&(t.lookahead=t.strstart-n,t.strstart=n,mt(t,!1),0===t.strm.avail_out))return 1;if(t.strstart-t.block_start>=t.w_size-262&&(mt(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===J?(mt(t,!0),0===t.strm.avail_out?3:4):(t.strstart>t.block_start&&(mt(t,!1),t.strm.avail_out),1)}),new xt(4,4,8,4,_t),new xt(4,5,16,8,_t),new xt(4,6,32,32,_t),new xt(4,4,16,16,kt),new xt(8,16,32,32,kt),new xt(8,16,128,128,kt),new xt(8,32,128,256,kt),new xt(32,128,258,1024,kt),new xt(32,258,258,4096,kt)];function Et(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=ct,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),ft(this.dyn_ltree),ft(this.dyn_dtree),ft(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),ft(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),ft(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const St=t=>{if(!t||!t.state)return lt(t,X);t.total_in=t.total_out=0,t.data_type=ut;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?42:113,t.adler=2===e.wrap?0:1,e.last_flush=K,F(e),$},It=t=>{const e=St(t);var r;return e===$&&((r=t.state).window_size=2*r.w_size,ft(r.head),r.max_lazy_match=At[r.level].max_lazy,r.good_match=At[r.level].good_length,r.nice_match=At[r.level].nice_length,r.max_chain_length=At[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=2,r.match_available=0,r.ins_h=0),e},Mt=(t,e,r,n,i,o)=>{if(!t)return X;let a=1;if(e===rt&&(e=6),n<0?(a=0,n=-n):n>15&&(a=2,n-=16),i<1||i>9||r!==ct||n<8||n>15||e<0||e>9||o<0||o>at)return lt(t,X);8===n&&(n=9);const s=new Et;return t.state=s,s.strm=t,s.wrap=a,s.gzhead=null,s.w_bits=n,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+3-1)/3),s.window=new Uint8Array(2*s.w_size),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new Uint8Array(s.pending_buf_size),s.d_buf=1*s.lit_bufsize,s.l_buf=3*s.lit_bufsize,s.level=e,s.strategy=o,s.method=r,It(t)};var Tt={deflateInit:(t,e)=>Mt(t,e,ct,15,8,st),deflateInit2:Mt,deflateReset:It,deflateResetKeep:St,deflateSetHeader:(t,e)=>t&&t.state?2!==t.state.wrap?X:(t.state.gzhead=e,$):X,deflate:(t,e)=>{let r,n;if(!t||!t.state||e>Q||e<0)return t?lt(t,X):X;const i=t.state;if(!t.output||!t.input&&0!==t.avail_in||666===i.status&&e!==J)return lt(t,0===t.avail_out?et:X);i.strm=t;const o=i.last_flush;if(i.last_flush=e,42===i.status)if(2===i.wrap)t.adler=0,yt(i,31),yt(i,139),yt(i,8),i.gzhead?(yt(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),yt(i,255&i.gzhead.time),yt(i,i.gzhead.time>>8&255),yt(i,i.gzhead.time>>16&255),yt(i,i.gzhead.time>>24&255),yt(i,9===i.level?2:i.strategy>=it||i.level<2?4:0),yt(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(yt(i,255&i.gzhead.extra.length),yt(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=D(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(yt(i,0),yt(i,0),yt(i,0),yt(i,0),yt(i,0),yt(i,9===i.level?2:i.strategy>=it||i.level<2?4:0),yt(i,3),i.status=113);else{let e=ct+(i.w_bits-8<<4)<<8,r=-1;r=i.strategy>=it||i.level<2?0:i.level<6?1:6===i.level?2:3,e|=r<<6,0!==i.strstart&&(e|=32),e+=31-e%31,i.status=113,gt(i,e),0!==i.strstart&&(gt(i,t.adler>>>16),gt(i,65535&t.adler)),t.adler=1}if(69===i.status)if(i.gzhead.extra){for(r=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>r&&(t.adler=D(t.adler,i.pending_buf,i.pending-r,r)),pt(t),r=i.pending,i.pending!==i.pending_buf_size));)yt(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>r&&(t.adler=D(t.adler,i.pending_buf,i.pending-r,r)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(73===i.status)if(i.gzhead.name){r=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>r&&(t.adler=D(t.adler,i.pending_buf,i.pending-r,r)),pt(t),r=i.pending,i.pending===i.pending_buf_size)){n=1;break}n=i.gzindex<i.gzhead.name.length?255&i.gzhead.name.charCodeAt(i.gzindex++):0,yt(i,n)}while(0!==n);i.gzhead.hcrc&&i.pending>r&&(t.adler=D(t.adler,i.pending_buf,i.pending-r,r)),0===n&&(i.gzindex=0,i.status=91)}else i.status=91;if(91===i.status)if(i.gzhead.comment){r=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>r&&(t.adler=D(t.adler,i.pending_buf,i.pending-r,r)),pt(t),r=i.pending,i.pending===i.pending_buf_size)){n=1;break}n=i.gzindex<i.gzhead.comment.length?255&i.gzhead.comment.charCodeAt(i.gzindex++):0,yt(i,n)}while(0!==n);i.gzhead.hcrc&&i.pending>r&&(t.adler=D(t.adler,i.pending_buf,i.pending-r,r)),0===n&&(i.status=103)}else i.status=103;if(103===i.status&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&pt(t),i.pending+2<=i.pending_buf_size&&(yt(i,255&t.adler),yt(i,t.adler>>8&255),t.adler=0,i.status=113)):i.status=113),0!==i.pending){if(pt(t),0===t.avail_out)return i.last_flush=-1,$}else if(0===t.avail_in&&ht(e)<=ht(o)&&e!==J)return lt(t,et);if(666===i.status&&0!==t.avail_in)return lt(t,et);if(0!==t.avail_in||0!==i.lookahead||e!==K&&666!==i.status){let r=i.strategy===it?((t,e)=>{let r;for(;;){if(0===t.lookahead&&(wt(t),0===t.lookahead)){if(e===K)return 1;break}if(t.match_length=0,r=G(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(mt(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===J?(mt(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(mt(t,!1),0===t.strm.avail_out)?1:2})(i,e):i.strategy===ot?((t,e)=>{let r,n,i,o;const a=t.window;for(;;){if(t.lookahead<=258){if(wt(t),t.lookahead<=258&&e===K)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(i=t.strstart-1,n=a[i],n===a[++i]&&n===a[++i]&&n===a[++i])){o=t.strstart+258;do{}while(n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&i<o);t.match_length=258-(o-i),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(r=G(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=G(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(mt(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===J?(mt(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(mt(t,!1),0===t.strm.avail_out)?1:2})(i,e):At[i.level].func(i,e);if(3!==r&&4!==r||(i.status=666),1===r||3===r)return 0===t.avail_out&&(i.last_flush=-1),$;if(2===r&&(e===Z?V(i):e!==Q&&(H(i,0,0,!1),e===W&&(ft(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),pt(t),0===t.avail_out))return i.last_flush=-1,$}return e!==J?$:i.wrap<=0?Y:(2===i.wrap?(yt(i,255&t.adler),yt(i,t.adler>>8&255),yt(i,t.adler>>16&255),yt(i,t.adler>>24&255),yt(i,255&t.total_in),yt(i,t.total_in>>8&255),yt(i,t.total_in>>16&255),yt(i,t.total_in>>24&255)):(gt(i,t.adler>>>16),gt(i,65535&t.adler)),pt(t),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?$:Y)},deflateEnd:t=>{if(!t||!t.state)return X;const e=t.state.status;return 42!==e&&69!==e&&73!==e&&91!==e&&103!==e&&113!==e&&666!==e?lt(t,X):(t.state=null,113===e?lt(t,tt):$)},deflateSetDictionary:(t,e)=>{let r=e.length;if(!t||!t.state)return X;const n=t.state,i=n.wrap;if(2===i||1===i&&42!==n.status||n.lookahead)return X;if(1===i&&(t.adler=L(t.adler,e,r,0)),n.wrap=0,r>=n.w_size){0===i&&(ft(n.head),n.strstart=0,n.block_start=0,n.insert=0);let t=new Uint8Array(n.w_size);t.set(e.subarray(r-n.w_size,r),0),e=t,r=n.w_size}const o=t.avail_in,a=t.next_in,s=t.input;for(t.avail_in=r,t.next_in=0,t.input=e,wt(n);n.lookahead>=3;){let t=n.strstart,e=n.lookahead-2;do{n.ins_h=dt(n,n.ins_h,n.window[t+3-1]),n.prev[t&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=t,t++}while(--e);n.strstart=t,n.lookahead=2,wt(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,t.next_in=a,t.input=s,t.avail_in=o,n.wrap=i,$},deflateInfo:"pako deflate (from Nodeca project)"};const Pt=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var Ct=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const r=e.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(const e in r)Pt(r,e)&&(t[e]=r[e])}}return t},Ot=t=>{let e=0;for(let r=0,n=t.length;r<n;r++)e+=t[r].length;const r=new Uint8Array(e);for(let e=0,n=0,i=t.length;e<i;e++){let i=t[e];r.set(i,n),n+=i.length}return r};let Rt=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){Rt=!1}const Nt=new Uint8Array(256);for(let t=0;t<256;t++)Nt[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;Nt[254]=Nt[254]=1;var jt=t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,r,n,i,o,a=t.length,s=0;for(i=0;i<a;i++)r=t.charCodeAt(i),55296==(64512&r)&&i+1<a&&(n=t.charCodeAt(i+1),56320==(64512&n)&&(r=65536+(r-55296<<10)+(n-56320),i++)),s+=r<128?1:r<2048?2:r<65536?3:4;for(e=new Uint8Array(s),o=0,i=0;o<s;i++)r=t.charCodeAt(i),55296==(64512&r)&&i+1<a&&(n=t.charCodeAt(i+1),56320==(64512&n)&&(r=65536+(r-55296<<10)+(n-56320),i++)),r<128?e[o++]=r:r<2048?(e[o++]=192|r>>>6,e[o++]=128|63&r):r<65536?(e[o++]=224|r>>>12,e[o++]=128|r>>>6&63,e[o++]=128|63&r):(e[o++]=240|r>>>18,e[o++]=128|r>>>12&63,e[o++]=128|r>>>6&63,e[o++]=128|63&r);return e},Lt=(t,e)=>{const r=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let n,i;const o=new Array(2*r);for(i=0,n=0;n<r;){let e=t[n++];if(e<128){o[i++]=e;continue}let a=Nt[e];if(a>4)o[i++]=65533,n+=a-1;else{for(e&=2===a?31:3===a?15:7;a>1&&n<r;)e=e<<6|63&t[n++],a--;a>1?o[i++]=65533:e<65536?o[i++]=e:(e-=65536,o[i++]=55296|e>>10&1023,o[i++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&Rt)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let r="";for(let n=0;n<e;n++)r+=String.fromCharCode(t[n]);return r})(o,i)},Ut=(t,e)=>{(e=e||t.length)>t.length&&(e=t.length);let r=e-1;for(;r>=0&&128==(192&t[r]);)r--;return r<0||0===r?e:r+Nt[t[r]]>e?r:e};var Dt=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const Bt=Object.prototype.toString,{Z_NO_FLUSH:zt,Z_SYNC_FLUSH:Ft,Z_FULL_FLUSH:Ht,Z_FINISH:qt,Z_OK:Gt,Z_STREAM_END:Vt,Z_DEFAULT_COMPRESSION:Kt,Z_DEFAULT_STRATEGY:Zt,Z_DEFLATED:Wt}=z;function Jt(t){this.options=Ct({level:Kt,method:Wt,chunkSize:16384,windowBits:15,memLevel:8,strategy:Zt},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Dt,this.strm.avail_out=0;let r=Tt.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(r!==Gt)throw new Error(B[r]);if(e.header&&Tt.deflateSetHeader(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?jt(e.dictionary):"[object ArrayBuffer]"===Bt.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,r=Tt.deflateSetDictionary(this.strm,t),r!==Gt)throw new Error(B[r]);this._dict_set=!0}}function Qt(t,e){const r=new Jt(e);if(r.push(t,!0),r.err)throw r.msg||B[r.err];return r.result}Jt.prototype.push=function(t,e){const r=this.strm,n=this.options.chunkSize;let i,o;if(this.ended)return!1;for(o=e===~~e?e:!0===e?qt:zt,"string"==typeof t?r.input=jt(t):"[object ArrayBuffer]"===Bt.call(t)?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;;)if(0===r.avail_out&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),(o===Ft||o===Ht)&&r.avail_out<=6)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else{if(i=Tt.deflate(r,o),i===Vt)return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),i=Tt.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===Gt;if(0!==r.avail_out){if(o>0&&r.next_out>0)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else if(0===r.avail_in)break}else this.onData(r.output)}return!0},Jt.prototype.onData=function(t){this.chunks.push(t)},Jt.prototype.onEnd=function(t){t===Gt&&(this.result=Ot(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var $t={Deflate:Jt,deflate:Qt,deflateRaw:function(t,e){return(e=e||{}).raw=!0,Qt(t,e)},gzip:function(t,e){return(e=e||{}).gzip=!0,Qt(t,e)},constants:z};var Yt=function(t,e){let r,n,i,o,a,s,u,c,l,h,f,d,p,m,y,g,v,b,w,_,k,x,A,E;const S=t.state;r=t.next_in,A=t.input,n=r+(t.avail_in-5),i=t.next_out,E=t.output,o=i-(e-t.avail_out),a=i+(t.avail_out-257),s=S.dmax,u=S.wsize,c=S.whave,l=S.wnext,h=S.window,f=S.hold,d=S.bits,p=S.lencode,m=S.distcode,y=(1<<S.lenbits)-1,g=(1<<S.distbits)-1;t:do{d<15&&(f+=A[r++]<<d,d+=8,f+=A[r++]<<d,d+=8),v=p[f&y];e:for(;;){if(b=v>>>24,f>>>=b,d-=b,b=v>>>16&255,0===b)E[i++]=65535&v;else{if(!(16&b)){if(0==(64&b)){v=p[(65535&v)+(f&(1<<b)-1)];continue e}if(32&b){S.mode=12;break t}t.msg="invalid literal/length code",S.mode=30;break t}w=65535&v,b&=15,b&&(d<b&&(f+=A[r++]<<d,d+=8),w+=f&(1<<b)-1,f>>>=b,d-=b),d<15&&(f+=A[r++]<<d,d+=8,f+=A[r++]<<d,d+=8),v=m[f&g];r:for(;;){if(b=v>>>24,f>>>=b,d-=b,b=v>>>16&255,!(16&b)){if(0==(64&b)){v=m[(65535&v)+(f&(1<<b)-1)];continue r}t.msg="invalid distance code",S.mode=30;break t}if(_=65535&v,b&=15,d<b&&(f+=A[r++]<<d,d+=8,d<b&&(f+=A[r++]<<d,d+=8)),_+=f&(1<<b)-1,_>s){t.msg="invalid distance too far back",S.mode=30;break t}if(f>>>=b,d-=b,b=i-o,_>b){if(b=_-b,b>c&&S.sane){t.msg="invalid distance too far back",S.mode=30;break t}if(k=0,x=h,0===l){if(k+=u-b,b<w){w-=b;do{E[i++]=h[k++]}while(--b);k=i-_,x=E}}else if(l<b){if(k+=u+l-b,b-=l,b<w){w-=b;do{E[i++]=h[k++]}while(--b);if(k=0,l<w){b=l,w-=b;do{E[i++]=h[k++]}while(--b);k=i-_,x=E}}}else if(k+=l-b,b<w){w-=b;do{E[i++]=h[k++]}while(--b);k=i-_,x=E}for(;w>2;)E[i++]=x[k++],E[i++]=x[k++],E[i++]=x[k++],w-=3;w&&(E[i++]=x[k++],w>1&&(E[i++]=x[k++]))}else{k=i-_;do{E[i++]=E[k++],E[i++]=E[k++],E[i++]=E[k++],w-=3}while(w>2);w&&(E[i++]=E[k++],w>1&&(E[i++]=E[k++]))}break}}break}}while(r<n&&i<a);w=d>>3,r-=w,d-=w<<3,f&=(1<<d)-1,t.next_in=r,t.next_out=i,t.avail_in=r<n?n-r+5:5-(r-n),t.avail_out=i<a?a-i+257:257-(i-a),S.hold=f,S.bits=d};const Xt=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),te=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),ee=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),re=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var ne=(t,e,r,n,i,o,a,s)=>{const u=s.bits;let c,l,h,f,d,p,m=0,y=0,g=0,v=0,b=0,w=0,_=0,k=0,x=0,A=0,E=null,S=0;const I=new Uint16Array(16),M=new Uint16Array(16);let T,P,C,O=null,R=0;for(m=0;m<=15;m++)I[m]=0;for(y=0;y<n;y++)I[e[r+y]]++;for(b=u,v=15;v>=1&&0===I[v];v--);if(b>v&&(b=v),0===v)return i[o++]=20971520,i[o++]=20971520,s.bits=1,0;for(g=1;g<v&&0===I[g];g++);for(b<g&&(b=g),k=1,m=1;m<=15;m++)if(k<<=1,k-=I[m],k<0)return-1;if(k>0&&(0===t||1!==v))return-1;for(M[1]=0,m=1;m<15;m++)M[m+1]=M[m]+I[m];for(y=0;y<n;y++)0!==e[r+y]&&(a[M[e[r+y]]++]=y);if(0===t?(E=O=a,p=19):1===t?(E=Xt,S-=257,O=te,R-=257,p=256):(E=ee,O=re,p=-1),A=0,y=0,m=g,d=o,w=b,_=0,h=-1,x=1<<b,f=x-1,1===t&&x>852||2===t&&x>592)return 1;for(;;){T=m-_,a[y]<p?(P=0,C=a[y]):a[y]>p?(P=O[R+a[y]],C=E[S+a[y]]):(P=96,C=0),c=1<<m-_,l=1<<w,g=l;do{l-=c,i[d+(A>>_)+l]=T<<24|P<<16|C|0}while(0!==l);for(c=1<<m-1;A&c;)c>>=1;if(0!==c?(A&=c-1,A+=c):A=0,y++,0==--I[m]){if(m===v)break;m=e[r+a[y]]}if(m>b&&(A&f)!==h){for(0===_&&(_=b),d+=g,w=m-_,k=1<<w;w+_<v&&(k-=I[w+_],!(k<=0));)w++,k<<=1;if(x+=1<<w,1===t&&x>852||2===t&&x>592)return 1;h=A&f,i[h]=b<<24|w<<16|d-o|0}}return 0!==A&&(i[d+A]=m-_<<24|64<<16|0),s.bits=b,0};const{Z_FINISH:ie,Z_BLOCK:oe,Z_TREES:ae,Z_OK:se,Z_STREAM_END:ue,Z_NEED_DICT:ce,Z_STREAM_ERROR:le,Z_DATA_ERROR:he,Z_MEM_ERROR:fe,Z_BUF_ERROR:de,Z_DEFLATED:pe}=z,me=t=>(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function ye(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const ge=t=>{if(!t||!t.state)return le;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=1,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,se},ve=t=>{if(!t||!t.state)return le;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,ge(t)},be=(t,e)=>{let r;if(!t||!t.state)return le;const n=t.state;return e<0?(r=0,e=-e):(r=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?le:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=r,n.wbits=e,ve(t))},we=(t,e)=>{if(!t)return le;const r=new ye;t.state=r,r.window=null;const n=be(t,e);return n!==se&&(t.state=null),n};let _e,ke,xe=!0;const Ae=t=>{if(xe){_e=new Int32Array(512),ke=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(ne(1,t.lens,0,288,_e,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;ne(2,t.lens,0,32,ke,0,t.work,{bits:5}),xe=!1}t.lencode=_e,t.lenbits=9,t.distcode=ke,t.distbits=5},Ee=(t,e,r,n)=>{let i;const o=t.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new Uint8Array(o.wsize)),n>=o.wsize?(o.window.set(e.subarray(r-o.wsize,r),0),o.wnext=0,o.whave=o.wsize):(i=o.wsize-o.wnext,i>n&&(i=n),o.window.set(e.subarray(r-n,r-n+i),o.wnext),(n-=i)?(o.window.set(e.subarray(r-n,r),0),o.wnext=n,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i))),0};var Se={inflateReset:ve,inflateReset2:be,inflateResetKeep:ge,inflateInit:t=>we(t,15),inflateInit2:we,inflate:(t,e)=>{let r,n,i,o,a,s,u,c,l,h,f,d,p,m,y,g,v,b,w,_,k,x,A=0;const E=new Uint8Array(4);let S,I;const M=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return le;r=t.state,12===r.mode&&(r.mode=13),a=t.next_out,i=t.output,u=t.avail_out,o=t.next_in,n=t.input,s=t.avail_in,c=r.hold,l=r.bits,h=s,f=u,x=se;t:for(;;)switch(r.mode){case 1:if(0===r.wrap){r.mode=13;break}for(;l<16;){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}if(2&r.wrap&&35615===c){r.check=0,E[0]=255&c,E[1]=c>>>8&255,r.check=D(r.check,E,2,0),c=0,l=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&c)<<8)+(c>>8))%31){t.msg="incorrect header check",r.mode=30;break}if((15&c)!==pe){t.msg="unknown compression method",r.mode=30;break}if(c>>>=4,l-=4,k=8+(15&c),0===r.wbits)r.wbits=k;else if(k>r.wbits){t.msg="invalid window size",r.mode=30;break}r.dmax=1<<r.wbits,t.adler=r.check=1,r.mode=512&c?10:12,c=0,l=0;break;case 2:for(;l<16;){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}if(r.flags=c,(255&r.flags)!==pe){t.msg="unknown compression method",r.mode=30;break}if(57344&r.flags){t.msg="unknown header flags set",r.mode=30;break}r.head&&(r.head.text=c>>8&1),512&r.flags&&(E[0]=255&c,E[1]=c>>>8&255,r.check=D(r.check,E,2,0)),c=0,l=0,r.mode=3;case 3:for(;l<32;){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}r.head&&(r.head.time=c),512&r.flags&&(E[0]=255&c,E[1]=c>>>8&255,E[2]=c>>>16&255,E[3]=c>>>24&255,r.check=D(r.check,E,4,0)),c=0,l=0,r.mode=4;case 4:for(;l<16;){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}r.head&&(r.head.xflags=255&c,r.head.os=c>>8),512&r.flags&&(E[0]=255&c,E[1]=c>>>8&255,r.check=D(r.check,E,2,0)),c=0,l=0,r.mode=5;case 5:if(1024&r.flags){for(;l<16;){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}r.length=c,r.head&&(r.head.extra_len=c),512&r.flags&&(E[0]=255&c,E[1]=c>>>8&255,r.check=D(r.check,E,2,0)),c=0,l=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&(d=r.length,d>s&&(d=s),d&&(r.head&&(k=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(n.subarray(o,o+d),k)),512&r.flags&&(r.check=D(r.check,n,d,o)),s-=d,o+=d,r.length-=d),r.length))break t;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===s)break t;d=0;do{k=n[o+d++],r.head&&k&&r.length<65536&&(r.head.name+=String.fromCharCode(k))}while(k&&d<s);if(512&r.flags&&(r.check=D(r.check,n,d,o)),s-=d,o+=d,k)break t}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&r.flags){if(0===s)break t;d=0;do{k=n[o+d++],r.head&&k&&r.length<65536&&(r.head.comment+=String.fromCharCode(k))}while(k&&d<s);if(512&r.flags&&(r.check=D(r.check,n,d,o)),s-=d,o+=d,k)break t}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&r.flags){for(;l<16;){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}if(c!==(65535&r.check)){t.msg="header crc mismatch",r.mode=30;break}c=0,l=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=12;break;case 10:for(;l<32;){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}t.adler=r.check=me(c),c=0,l=0,r.mode=11;case 11:if(0===r.havedict)return t.next_out=a,t.avail_out=u,t.next_in=o,t.avail_in=s,r.hold=c,r.bits=l,ce;t.adler=r.check=1,r.mode=12;case 12:if(e===oe||e===ae)break t;case 13:if(r.last){c>>>=7&l,l-=7&l,r.mode=27;break}for(;l<3;){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}switch(r.last=1&c,c>>>=1,l-=1,3&c){case 0:r.mode=14;break;case 1:if(Ae(r),r.mode=20,e===ae){c>>>=2,l-=2;break t}break;case 2:r.mode=17;break;case 3:t.msg="invalid block type",r.mode=30}c>>>=2,l-=2;break;case 14:for(c>>>=7&l,l-=7&l;l<32;){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}if((65535&c)!=(c>>>16^65535)){t.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&c,c=0,l=0,r.mode=15,e===ae)break t;case 15:r.mode=16;case 16:if(d=r.length,d){if(d>s&&(d=s),d>u&&(d=u),0===d)break t;i.set(n.subarray(o,o+d),a),s-=d,o+=d,u-=d,a+=d,r.length-=d;break}r.mode=12;break;case 17:for(;l<14;){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}if(r.nlen=257+(31&c),c>>>=5,l-=5,r.ndist=1+(31&c),c>>>=5,l-=5,r.ncode=4+(15&c),c>>>=4,l-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=30;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;l<3;){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}r.lens[M[r.have++]]=7&c,c>>>=3,l-=3}for(;r.have<19;)r.lens[M[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,S={bits:r.lenbits},x=ne(0,r.lens,0,19,r.lencode,0,r.work,S),r.lenbits=S.bits,x){t.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;A=r.lencode[c&(1<<r.lenbits)-1],y=A>>>24,g=A>>>16&255,v=65535&A,!(y<=l);){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}if(v<16)c>>>=y,l-=y,r.lens[r.have++]=v;else{if(16===v){for(I=y+2;l<I;){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}if(c>>>=y,l-=y,0===r.have){t.msg="invalid bit length repeat",r.mode=30;break}k=r.lens[r.have-1],d=3+(3&c),c>>>=2,l-=2}else if(17===v){for(I=y+3;l<I;){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}c>>>=y,l-=y,k=0,d=3+(7&c),c>>>=3,l-=3}else{for(I=y+7;l<I;){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}c>>>=y,l-=y,k=0,d=11+(127&c),c>>>=7,l-=7}if(r.have+d>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=30;break}for(;d--;)r.lens[r.have++]=k}}if(30===r.mode)break;if(0===r.lens[256]){t.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,S={bits:r.lenbits},x=ne(1,r.lens,0,r.nlen,r.lencode,0,r.work,S),r.lenbits=S.bits,x){t.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,S={bits:r.distbits},x=ne(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,S),r.distbits=S.bits,x){t.msg="invalid distances set",r.mode=30;break}if(r.mode=20,e===ae)break t;case 20:r.mode=21;case 21:if(s>=6&&u>=258){t.next_out=a,t.avail_out=u,t.next_in=o,t.avail_in=s,r.hold=c,r.bits=l,Yt(t,f),a=t.next_out,i=t.output,u=t.avail_out,o=t.next_in,n=t.input,s=t.avail_in,c=r.hold,l=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;A=r.lencode[c&(1<<r.lenbits)-1],y=A>>>24,g=A>>>16&255,v=65535&A,!(y<=l);){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}if(g&&0==(240&g)){for(b=y,w=g,_=v;A=r.lencode[_+((c&(1<<b+w)-1)>>b)],y=A>>>24,g=A>>>16&255,v=65535&A,!(b+y<=l);){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}c>>>=b,l-=b,r.back+=b}if(c>>>=y,l-=y,r.back+=y,r.length=v,0===g){r.mode=26;break}if(32&g){r.back=-1,r.mode=12;break}if(64&g){t.msg="invalid literal/length code",r.mode=30;break}r.extra=15&g,r.mode=22;case 22:if(r.extra){for(I=r.extra;l<I;){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}r.length+=c&(1<<r.extra)-1,c>>>=r.extra,l-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;A=r.distcode[c&(1<<r.distbits)-1],y=A>>>24,g=A>>>16&255,v=65535&A,!(y<=l);){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}if(0==(240&g)){for(b=y,w=g,_=v;A=r.distcode[_+((c&(1<<b+w)-1)>>b)],y=A>>>24,g=A>>>16&255,v=65535&A,!(b+y<=l);){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}c>>>=b,l-=b,r.back+=b}if(c>>>=y,l-=y,r.back+=y,64&g){t.msg="invalid distance code",r.mode=30;break}r.offset=v,r.extra=15&g,r.mode=24;case 24:if(r.extra){for(I=r.extra;l<I;){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}r.offset+=c&(1<<r.extra)-1,c>>>=r.extra,l-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===u)break t;if(d=f-u,r.offset>d){if(d=r.offset-d,d>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=30;break}d>r.wnext?(d-=r.wnext,p=r.wsize-d):p=r.wnext-d,d>r.length&&(d=r.length),m=r.window}else m=i,p=a-r.offset,d=r.length;d>u&&(d=u),u-=d,r.length-=d;do{i[a++]=m[p++]}while(--d);0===r.length&&(r.mode=21);break;case 26:if(0===u)break t;i[a++]=r.length,u--,r.mode=21;break;case 27:if(r.wrap){for(;l<32;){if(0===s)break t;s--,c|=n[o++]<<l,l+=8}if(f-=u,t.total_out+=f,r.total+=f,f&&(t.adler=r.check=r.flags?D(r.check,i,f,a-f):L(r.check,i,f,a-f)),f=u,(r.flags?c:me(c))!==r.check){t.msg="incorrect data check",r.mode=30;break}c=0,l=0}r.mode=28;case 28:if(r.wrap&&r.flags){for(;l<32;){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}if(c!==(4294967295&r.total)){t.msg="incorrect length check",r.mode=30;break}c=0,l=0}r.mode=29;case 29:x=ue;break t;case 30:x=he;break t;case 31:return fe;case 32:default:return le}return t.next_out=a,t.avail_out=u,t.next_in=o,t.avail_in=s,r.hold=c,r.bits=l,(r.wsize||f!==t.avail_out&&r.mode<30&&(r.mode<27||e!==ie))&&Ee(t,t.output,t.next_out,f-t.avail_out),h-=t.avail_in,f-=t.avail_out,t.total_in+=h,t.total_out+=f,r.total+=f,r.wrap&&f&&(t.adler=r.check=r.flags?D(r.check,i,f,t.next_out-f):L(r.check,i,f,t.next_out-f)),t.data_type=r.bits+(r.last?64:0)+(12===r.mode?128:0)+(20===r.mode||15===r.mode?256:0),(0===h&&0===f||e===ie)&&x===se&&(x=de),x},inflateEnd:t=>{if(!t||!t.state)return le;let e=t.state;return e.window&&(e.window=null),t.state=null,se},inflateGetHeader:(t,e)=>{if(!t||!t.state)return le;const r=t.state;return 0==(2&r.wrap)?le:(r.head=e,e.done=!1,se)},inflateSetDictionary:(t,e)=>{const r=e.length;let n,i,o;return t&&t.state?(n=t.state,0!==n.wrap&&11!==n.mode?le:11===n.mode&&(i=1,i=L(i,e,r,0),i!==n.check)?he:(o=Ee(t,e,r,r),o?(n.mode=31,fe):(n.havedict=1,se))):le},inflateInfo:"pako inflate (from Nodeca project)"};var Ie=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const Me=Object.prototype.toString,{Z_NO_FLUSH:Te,Z_FINISH:Pe,Z_OK:Ce,Z_STREAM_END:Oe,Z_NEED_DICT:Re,Z_STREAM_ERROR:Ne,Z_DATA_ERROR:je,Z_MEM_ERROR:Le}=z;function Ue(t){this.options=Ct({chunkSize:65536,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Dt,this.strm.avail_out=0;let r=Se.inflateInit2(this.strm,e.windowBits);if(r!==Ce)throw new Error(B[r]);if(this.header=new Ie,Se.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=jt(e.dictionary):"[object ArrayBuffer]"===Me.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(r=Se.inflateSetDictionary(this.strm,e.dictionary),r!==Ce)))throw new Error(B[r])}function De(t,e){const r=new Ue(e);if(r.push(t),r.err)throw r.msg||B[r.err];return r.result}Ue.prototype.push=function(t,e){const r=this.strm,n=this.options.chunkSize,i=this.options.dictionary;let o,a,s;if(this.ended)return!1;for(a=e===~~e?e:!0===e?Pe:Te,"[object ArrayBuffer]"===Me.call(t)?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;;){for(0===r.avail_out&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),o=Se.inflate(r,a),o===Re&&i&&(o=Se.inflateSetDictionary(r,i),o===Ce?o=Se.inflate(r,a):o===je&&(o=Re));r.avail_in>0&&o===Oe&&r.state.wrap>0&&0!==t[r.next_in];)Se.inflateReset(r),o=Se.inflate(r,a);switch(o){case Ne:case je:case Re:case Le:return this.onEnd(o),this.ended=!0,!1}if(s=r.avail_out,r.next_out&&(0===r.avail_out||o===Oe))if("string"===this.options.to){let t=Ut(r.output,r.next_out),e=r.next_out-t,i=Lt(r.output,t);r.next_out=e,r.avail_out=n-e,e&&r.output.set(r.output.subarray(t,t+e),0),this.onData(i)}else this.onData(r.output.length===r.next_out?r.output:r.output.subarray(0,r.next_out));if(o!==Ce||0!==s){if(o===Oe)return o=Se.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(0===r.avail_in)break}}return!0},Ue.prototype.onData=function(t){this.chunks.push(t)},Ue.prototype.onEnd=function(t){t===Ce&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Ot(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var Be={Inflate:Ue,inflate:De,inflateRaw:function(t,e){return(e=e||{}).raw=!0,De(t,e)},ungzip:De,constants:z};const{Deflate:ze,deflate:Fe,deflateRaw:He,gzip:qe}=$t,{Inflate:Ge,inflate:Ve,inflateRaw:Ke,ungzip:Ze}=Be;var We=ze,Je=Fe,Qe=He,$e=qe,Ye=Ge,Xe=Ve,tr=Ke,er=Ze,rr=z,nr={Deflate:ze,deflate:Fe,deflateRaw:He,gzip:qe,Inflate:Ge,inflate:Ve,inflateRaw:Ke,ungzip:Ze,constants:z}},function(t,e,r){(function(r){var n,i,o,a;function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}a=function(){return function t(e,r,n){function i(a,s){if(!r[a]){if(!e[a]){var u=!1;if(!s&&u)return(void 0)(a,!0);if(o)return o(a,!0);throw(u=new Error("Cannot find module '"+a+"'")).code="MODULE_NOT_FOUND",u}u=r[a]={exports:{}},e[a][0].call(u.exports,(function(t){return i(e[a][1][t]||t)}),u,u.exports,t,e,r,n)}return r[a].exports}for(var o=!1,a=0;a<n.length;a++)i(n[a]);return i}({1:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.version="4.0.49"},{}],2:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./utils/properties");function i(){n.setType(this,"Signer")}i.isSigner=function(t){return n.isType(t,"Signer")},t=i,r.Signer=t},{"./utils/properties":74}],3:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./utils/bignumber");r.AddressZero="0x0000000000000000000000000000000000000000",r.HashZero="0x0000000000000000000000000000000000000000000000000000000000000000",r.EtherSymbol="Ξ",t=n.bigNumberify(-1),r.NegativeOne=t,t=n.bigNumberify(0),r.Zero=t,t=n.bigNumberify(1),r.One=t,t=n.bigNumberify(2),r.Two=t,t=n.bigNumberify("1000000000000000000"),r.WeiPerEther=t,n=n.bigNumberify("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),r.MaxUint256=n},{"./utils/bignumber":63}],4:[function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var a,u=t("./constants"),c=o(t("./errors")),l=t("./utils/abi-coder"),h=t("./utils/address"),f=t("./utils/bignumber"),d=t("./utils/bytes"),p=t("./utils/interface"),m=t("./utils/properties"),y=t("./providers/abstract-provider"),g=t("./abstract-signer"),v=(i(b,a=g.Signer),b.prototype.getAddress=function(){return Promise.resolve(this.address)},b.prototype._fail=function(t,e){return Promise.resolve().then((function(){c.throwError(t,c.UNSUPPORTED_OPERATION,{operation:e})}))},b.prototype.signMessage=function(t){return this._fail("VoidSigner cannot sign messages","signMessage")},b.prototype.sendTransaction=function(t){return this._fail("VoidSigner cannot sign transactions","sendTransaction")},b.prototype.connect=function(t){return new b(this.address,t)},b);function b(t,e){var r=a.call(this)||this;return m.defineReadOnly(r,"address",t),m.defineReadOnly(r,"provider",e),r}r.VoidSigner=v;var w={chainId:!0,data:!0,from:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0};function _(t,e,r){var n=t.interface.functions[e];return function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];var o={},a=null;if(e.length===n.inputs.length+1&&"object"==s(e[e.length-1]))for(var h in null!=(o=m.shallowCopy(e.pop())).blockTag&&(a=o.blockTag),delete o.blockTag,o)if(!w[h])throw new Error("unknown transaction override "+h);if(e.length!=n.inputs.length)throw new Error("incorrect number of arguments");return["data","to"].forEach((function(t){null!=o[t]&&c.throwError("cannot override "+t,c.UNSUPPORTED_OPERATION,{operation:t})})),o.to=t._deployed(a).then((function(){return t.addressPromise})),function t(e,r,n){if(Array.isArray(n)){var i=[];return n.forEach((function(n,o){var a=Array.isArray(r)?r[o]:r[n.name];i.push(t(e,a,n))})),Promise.all(i)}if("address"===n.type)return e.resolveName(r);if("tuple"===n.type)return t(e,r,n.components);var o=n.type.match(/(.*)(\[[0-9]*\]$)/);if(o){if(!Array.isArray(r))throw new Error("invalid value for array");var a=[],s={components:n.components,type:o[1]};return r.forEach((function(r){a.push(t(e,r,s))})),Promise.all(a)}return Promise.resolve(r)}(t.provider,e,n.inputs).then((function(e){if(o.data=n.encode(e),"call"===n.type)return r?Promise.resolve(u.Zero):(t.provider||c.throwError("call (constant functions) require a provider or a signer with a provider",c.UNSUPPORTED_OPERATION,{operation:"call"}),["gasLimit","gasPrice","value"].forEach((function(t){if(null!=o[t])throw new Error("call cannot override "+t)})),null==o.from&&t.signer&&(o.from=t.signer.getAddress()),t.provider.call(o,a).then((function(r){var i;d.hexDataLength(r)%32==4&&"0x08c379a0"===d.hexDataSlice(r,0,4)&&(i=l.defaultAbiCoder.decode(["string"],d.hexDataSlice(r,4)),c.throwError("call revert exception",c.CALL_EXCEPTION,{address:t.address,args:e,method:n.signature,errorSignature:"Error(string)",errorArgs:[i],reason:i,transaction:o}));try{var a=n.decode(r);return 1===n.outputs.length?a[0]:a}catch(i){throw"0x"===r&&0<n.outputs.length&&c.throwError("call exception",c.CALL_EXCEPTION,{address:t.address,method:n.signature,args:e}),i}})));if("transaction"===n.type)return r?(t.provider||c.throwError("estimate gas require a provider or a signer with a provider",c.UNSUPPORTED_OPERATION,{operation:"estimateGas"}),null==o.from&&t.signer&&(o.from=t.signer.getAddress()),t.provider.estimateGas(o)):(null==o.gasLimit&&null!=n.gas&&(o.gasLimit=f.bigNumberify(n.gas).add(21e3)),t.signer||c.throwError("sending a transaction requires a signer",c.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),null!=o.from&&c.throwError("cannot override from in a transaction",c.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),t.signer.sendTransaction(o).then((function(e){var r=e.wait.bind(e);return e.wait=function(e){return r(e).then((function(e){return e.events=e.logs.map((function(r){var n=m.deepCopy(r);return(r=t.interface.parseLog(r))&&(n.args=r.values,n.decode=r.decode,n.event=r.name,n.eventSignature=r.signature),n.removeListener=function(){return t.provider},n.getBlock=function(){return t.provider.getBlock(e.blockHash)},n.getTransaction=function(){return t.provider.getTransaction(e.transactionHash)},n.getTransactionReceipt=function(){return Promise.resolve(e)},n})),e}))},e})));throw new Error("invalid type - "+n.type)}))}}function k(t){return!t.address||null!=t.topics&&0!==t.topics.length?(t.address||"*")+"@"+(t.topics?t.topics.join(":"):""):"*"}var x=(A.prototype.deployed=function(){return this._deployed()},A.prototype._deployed=function(t){var e=this;return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then((function(){return e})):this._deployedPromise=this.provider.getCode(this.address,t).then((function(t){return"0x"===t&&c.throwError("contract not deployed",c.UNSUPPORTED_OPERATION,{contractAddress:e.address,operation:"getDeployed"}),e}))),this._deployedPromise},A.prototype.fallback=function(t){var e=this;this.signer||c.throwError("sending a transaction requires a signer",c.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});var r=m.shallowCopy(t||{});return["from","to"].forEach((function(t){null!=r[t]&&c.throwError("cannot override "+t,c.UNSUPPORTED_OPERATION,{operation:t})})),r.to=this.addressPromise,this.deployed().then((function(){return e.signer.sendTransaction(r)}))},A.prototype.connect=function(t){return"string"==typeof t&&(t=new v(t,this.provider)),t=new A(this.address,this.interface,t),this.deployTransaction&&m.defineReadOnly(t,"deployTransaction",this.deployTransaction),t},A.prototype.attach=function(t){return new A(t,this.interface,this.signer||this.provider)},A.isIndexed=function(t){return p.Interface.isIndexed(t)},A.prototype._getEventFilter=function(t){var e=this;if("string"==typeof t){if("*"===t)return{prepareEvent:function(t){var r=e.interface.parseLog(t);return r&&(t.args=r.values,t.decode=r.decode,t.event=r.name,t.eventSignature=r.signature),[t]},eventTag:"*",filter:{address:this.address}};-1!==t.indexOf("(")&&(t=l.formatSignature(l.parseSignature("event "+t)));var r=this.interface.events[t];r||c.throwError("unknown event - "+t,c.INVALID_ARGUMENT,{argumnet:"eventName",value:t});var n={address:this.address,topics:[r.topic]};return{prepareEvent:function(t){var e=r.decode(t.data,t.topics);return t.args=e,(e=Array.prototype.slice.call(e)).push(t),e},event:r,eventTag:k(n),filter:n}}n={address:this.address};var i=null;if(t.topics&&t.topics[0])for(var o in n.topics=t.topics,this.interface.events)if(-1!==o.indexOf("(")&&(o=this.interface.events[o]).topic===t.topics[0].toLowerCase()){i=o;break}return{prepareEvent:function(t){if(!i)return[t];var e=i.decode(t.data,t.topics);return t.args=e,(e=Array.prototype.slice.call(e)).push(t),e},event:i,eventTag:k(n),filter:n}},A.prototype._addEventListener=function(t,e,r){var n=this;function i(r){var i=m.deepCopy(r),o=t.prepareEvent(i);t.event&&(i.decode=t.event.decode,i.event=t.event.name,i.eventSignature=t.event.signature),i.removeListener=function(){n.removeListener(t.filter,e)},i.getBlock=function(){return n.provider.getBlock(r.blockHash)},i.getTransaction=function(){return n.provider.getTransaction(r.transactionHash)},i.getTransactionReceipt=function(){return n.provider.getTransactionReceipt(r.transactionHash)},n.emit.apply(n,[t.filter].concat(o))}this.provider||c.throwError("events require a provider or a signer with a provider",c.UNSUPPORTED_OPERATION,{operation:"once"}),this.provider.on(t.filter,i),this._events.push({eventFilter:t,listener:e,wrappedListener:i,once:r})},A.prototype.on=function(t,e){return this._addEventListener(this._getEventFilter(t),e,!1),this},A.prototype.once=function(t,e){return this._addEventListener(this._getEventFilter(t),e,!0),this},A.prototype.addListener=function(t,e){return this.on(t,e)},A.prototype.emit=function(t){for(var e=this,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];if(!this.provider)return!1;var i=!1,o=this._getEventFilter(t);return this._events=this._events.filter((function(t){return t.eventFilter.eventTag!==o.eventTag||(setTimeout((function(){t.listener.apply(e,r)}),0),i=!0,!t.once)})),i},A.prototype.listenerCount=function(t){if(!this.provider)return 0;var e=this._getEventFilter(t);return this._events.filter((function(t){return t.eventFilter.eventTag===e.eventTag})).length},A.prototype.listeners=function(t){if(!this.provider)return[];var e=this._getEventFilter(t);return this._events.filter((function(t){return t.eventFilter.eventTag===e.eventTag})).map((function(t){return t.listener}))},A.prototype.removeAllListeners=function(t){var e=this;if(!this.provider)return this;var r=this._getEventFilter(t);return this._events=this._events.filter((function(t){return t.eventFilter.eventTag!==r.eventTag||(e.provider.removeListener(t.eventFilter.filter,t.wrappedListener),!1)})),this},A.prototype.removeListener=function(t,e){var r=this;if(!this.provider)return this;var n=!1,i=this._getEventFilter(t);return this._events=this._events.filter((function(t){return t.eventFilter.eventTag!==i.eventTag||t.listener!==e||(r.provider.removeListener(t.eventFilter.filter,t.wrappedListener),!!n||!(n=!0))})),this},A);function A(t,e,r){var n=this;if(c.checkNew(this,A),p.Interface.isInterface(e)?m.defineReadOnly(this,"interface",e):m.defineReadOnly(this,"interface",new p.Interface(e)),g.Signer.isSigner(r)?(m.defineReadOnly(this,"provider",r.provider),m.defineReadOnly(this,"signer",r)):y.Provider.isProvider(r)?(m.defineReadOnly(this,"provider",r),m.defineReadOnly(this,"signer",null)):c.throwError("invalid signer or provider",c.INVALID_ARGUMENT,{arg:"signerOrProvider",value:r}),m.defineReadOnly(this,"estimate",{}),m.defineReadOnly(this,"functions",{}),m.defineReadOnly(this,"filters",{}),Object.keys(this.interface.events).forEach((function(t){var e=n.interface.events[t];m.defineReadOnly(n.filters,t,(function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return{address:n.address,topics:e.encodeTopics(t)}}))})),this._events=[],m.defineReadOnly(this,"address",t),this.provider)m.defineReadOnly(this,"addressPromise",this.provider.resolveName(t).then((function(t){if(null==t)throw new Error("name not found");return t})).catch((function(t){throw t})));else try{m.defineReadOnly(this,"addressPromise",Promise.resolve(h.getAddress(t)))}catch(e){c.throwError("provider is required to use non-address contract address",c.INVALID_ARGUMENT,{argument:"addressOrName",value:t})}Object.keys(this.interface.functions).forEach((function(t){var e=_(n,t,!1);null==n[t]?m.defineReadOnly(n,t,e):c.warn("WARNING: Multiple definitions for "+t),null==n.functions[t]&&(m.defineReadOnly(n.functions,t,e),m.defineReadOnly(n.estimate,t,_(n,t,!0)))}))}function E(t,e,r){var n=null;"string"==typeof e?n=e:d.isArrayish(e)?n=d.hexlify(e):"string"==typeof e.object?n=e.object:c.throwError("bytecode must be a valid hex string",c.INVALID_ARGUMENT,{arg:"bytecode",value:e}),"0x"!==n.substring(0,2)&&(n="0x"+n),d.isHexString(n)||c.throwError("bytecode must be a valid hex string",c.INVALID_ARGUMENT,{arg:"bytecode",value:e}),n.length%2!=0&&c.throwError("bytecode must be valid data (even length)",c.INVALID_ARGUMENT,{arg:"bytecode",value:e}),m.defineReadOnly(this,"bytecode",n),p.Interface.isInterface(t)?m.defineReadOnly(this,"interface",t):m.defineReadOnly(this,"interface",new p.Interface(t)),r&&!g.Signer.isSigner(r)&&c.throwError("invalid signer",c.INVALID_ARGUMENT,{arg:"signer",value:null}),m.defineReadOnly(this,"signer",r||null)}r.Contract=x,E.prototype.getDeployTransaction=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r={};if(t.length===this.interface.deployFunction.inputs.length+1)for(var n in r=m.shallowCopy(t.pop()))if(!w[n])throw new Error("unknown transaction override "+n);return["data","from","to"].forEach((function(t){null!=r[t]&&c.throwError("cannot override "+t,c.UNSUPPORTED_OPERATION,{operation:t})})),c.checkArgumentCount(t.length,this.interface.deployFunction.inputs.length," in Contract constructor"),r.data=this.interface.deployFunction.encode(this.bytecode,t),r},E.prototype.deploy=function(){for(var t=this,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=this.getDeployTransaction.apply(this,e);return this.signer.sendTransaction(n).then((function(e){var r=new x(h.getContractAddress(e),t.interface,t.signer);return m.defineReadOnly(r,"deployTransaction",e),r}))},E.prototype.attach=function(t){return new x(t,this.interface,this.signer)},E.prototype.connect=function(t){return new E(this.interface,this.bytecode,t)},E.fromSolidity=function(t,e){null==t&&c.throwError("missing compiler output",c.MISSING_ARGUMENT,{argument:"compilerOutput"});var r=(t="string"==typeof t?JSON.parse(t):t).abi,n=null;return t.bytecode?n=t.bytecode:t.evm&&t.evm.bytecode&&(n=t.evm.bytecode),new E(r,n,e)},i=E,r.ContractFactory=i},{"./abstract-signer":2,"./constants":3,"./errors":5,"./providers/abstract-provider":50,"./utils/abi-coder":59,"./utils/address":60,"./utils/bignumber":63,"./utils/bytes":64,"./utils/interface":69,"./utils/properties":74}],5:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./_version");r.UNKNOWN_ERROR="UNKNOWN_ERROR",r.NOT_IMPLEMENTED="NOT_IMPLEMENTED",r.MISSING_NEW="MISSING_NEW",r.CALL_EXCEPTION="CALL_EXCEPTION",r.INVALID_ARGUMENT="INVALID_ARGUMENT",r.MISSING_ARGUMENT="MISSING_ARGUMENT",r.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",r.NUMERIC_FAULT="NUMERIC_FAULT",r.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",r.NONCE_EXPIRED="NONCE_EXPIRED",r.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED";var i=!(r.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION"),o=!1;function a(t,e,i){if(o)throw new Error("unknown error");e=e||r.UNKNOWN_ERROR,i=i||{};var a=[];Object.keys(i).forEach((function(t){try{a.push(t+"="+JSON.stringify(i[t]))}catch(e){a.push(t+"="+JSON.stringify(i[t].toString()))}})),a.push("version="+n.version);var s=t;a.length&&(t+=" ("+a.join(", ")+")");var u=new Error(t);throw u.reason=s,u.code=e,Object.keys(i).forEach((function(t){u[t]=i[t]})),u}r.throwError=a,r.checkNew=function(t,e){t instanceof e||a("missing new",r.MISSING_NEW,{name:e.name})},r.checkArgumentCount=function(t,e,n){n=n||"",t<e&&a("missing argument"+n,r.MISSING_ARGUMENT,{count:t,expectedCount:e}),e<t&&a("too many arguments"+n,r.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})},r.setCensorship=function(t,e){i&&a("error censorship permanent",r.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),o=!!t,i=!!e},r.checkNormalize=function(){try{if(["NFD","NFC","NFKD","NFKC"].forEach((function(t){try{"test".normalize(t)}catch(e){throw new Error("missing "+t)}})),String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){a("platform missing String.prototype.normalize",r.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:t.message})}};var s={debug:1,default:2,info:2,warn:3,error:4,off:5},u=s.default;function c(t,e){u>s[t]||console.log.apply(console,e)}function l(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];c("warn",t)}r.setLogLevel=function(t){var e=s[t];null!=e?u=e:l("invliad log level - "+t)},r.warn=l,r.info=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];c("info",t)}},{"./_version":1}],6:[function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var i=t("./contract");r.Contract=i.Contract,r.ContractFactory=i.ContractFactory,r.VoidSigner=i.VoidSigner,i=t("./abstract-signer"),r.Signer=i.Signer,i=t("./wallet"),r.Wallet=i.Wallet,i=n(t("./constants")),r.constants=i;var o=n(t("./errors"));r.errors=o;var a=n(t("./providers"));r.providers=a;var s=n(t("./utils"));r.utils=s,n=n(t("./wordlists")),r.wordlists=n,n=t("./utils/shims"),r.platform=n.platform,t=t("./_version"),r.version=t.version,r.getDefaultProvider=function(t){var e=s.getNetwork(t=null==t?"homestead":t);return e&&e._defaultProvider||o.throwError("unsupported getDefaultProvider network",o.UNSUPPORTED_OPERATION,{operation:"getDefaultProvider",network:t}),e._defaultProvider(a)}},{"./_version":1,"./abstract-signer":2,"./constants":3,"./contract":4,"./errors":5,"./providers":54,"./utils":68,"./utils/shims":80,"./wallet":88,"./wordlists":89}],7:[function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0}),n=n(t("./ethers")),r.ethers=n,function(t){for(var e in t)r.hasOwnProperty(e)||(r[e]=t[e])}(t("./ethers"))},{"./ethers":6}],8:[function(t,e,r){"use strict";!function(t){function n(t){return parseInt(t)===t}function i(t){if(n(t.length)){for(var e=0;e<t.length;e++)if(!n(t[e])||t[e]<0||255<t[e])return;return 1}}function o(t,e){if(t.buffer&&ArrayBuffer.isView(t)&&"Uint8Array"===t.name)return e?t.slice?t.slice():Array.prototype.slice.call(t):t;if(Array.isArray(t)){if(!i(t))throw new Error("Array contains invalid value: "+t);return new Uint8Array(t)}if(n(t.length)&&i(t))return new Uint8Array(t);throw new Error("unsupported array-like object")}function a(t){return new Uint8Array(t)}function s(t,e,r,n,i){null==n&&null==i||(t=t.slice?t.slice(n,i):Array.prototype.slice.call(t,n,i)),e.set(t,r)}var u,c={toBytes:function(t){var e=[],r=0;for(t=encodeURI(t);r<t.length;){var n=t.charCodeAt(r++);37===n?(e.push(parseInt(t.substr(r,2),16)),r+=2):e.push(n)}return o(e)},fromBytes:function(t){for(var e=[],r=0;r<t.length;){var n=t[r];n<128?(e.push(String.fromCharCode(n)),r++):191<n&&n<224?(e.push(String.fromCharCode((31&n)<<6|63&t[r+1])),r+=2):(e.push(String.fromCharCode((15&n)<<12|(63&t[r+1])<<6|63&t[r+2])),r+=3)}return e.join("")}},l=(u="0123456789abcdef",{toBytes:function(t){for(var e=[],r=0;r<t.length;r+=2)e.push(parseInt(t.substr(r,2),16));return e},fromBytes:function(t){for(var e=[],r=0;r<t.length;r++){var n=t[r];e.push(u[(240&n)>>4]+u[15&n])}return e.join("")}}),h={16:10,24:12,32:14},f=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],d=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],p=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],m=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],y=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],g=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],v=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],b=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],w=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],_=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],k=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],x=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],A=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],E=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],S=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function I(t){for(var e=[],r=0;r<t.length;r+=4)e.push(t[r]<<24|t[r+1]<<16|t[r+2]<<8|t[r+3]);return e}var M=function t(e){if(!(this instanceof t))throw Error("AES must be instanitated with `new`");Object.defineProperty(this,"key",{value:o(e,!0)}),this._prepare()};M.prototype._prepare=function(){var t=h[this.key.length];if(null==t)throw new Error("invalid key size (must be 16, 24 or 32 bytes)");this._Ke=[],this._Kd=[];for(var e=0;e<=t;e++)this._Ke.push([0,0,0,0]),this._Kd.push([0,0,0,0]);var r,n=4*(t+1),i=this.key.length/4,o=I(this.key);for(e=0;e<i;e++)this._Ke[r=e>>2][e%4]=o[e],this._Kd[t-r][e%4]=o[e];for(var a,s=0,u=i;u<n;){if(a=o[i-1],o[0]^=d[a>>16&255]<<24^d[a>>8&255]<<16^d[255&a]<<8^d[a>>24&255]^f[s]<<24,s+=1,8!=i)for(e=1;e<i;e++)o[e]^=o[e-1];else{for(e=1;e<i/2;e++)o[e]^=o[e-1];for(a=o[i/2-1],o[i/2]^=d[255&a]^d[a>>8&255]<<8^d[a>>16&255]<<16^d[a>>24&255]<<24,e=i/2+1;e<i;e++)o[e]^=o[e-1]}for(e=0;e<i&&u<n;)this._Ke[c=u>>2][l=u%4]=o[e],this._Kd[t-c][l]=o[e++],u++}for(var c=1;c<t;c++)for(var l=0;l<4;l++)a=this._Kd[c][l],this._Kd[c][l]=x[a>>24&255]^A[a>>16&255]^E[a>>8&255]^S[255&a]},M.prototype.encrypt=function(t){if(16!=t.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var e=this._Ke.length-1,r=[0,0,0,0],n=I(t),i=0;i<4;i++)n[i]^=this._Ke[0][i];for(var o=1;o<e;o++){for(i=0;i<4;i++)r[i]=m[n[i]>>24&255]^y[n[(i+1)%4]>>16&255]^g[n[(i+2)%4]>>8&255]^v[255&n[(i+3)%4]]^this._Ke[o][i];n=r.slice()}var s,u=a(16);for(i=0;i<4;i++)s=this._Ke[e][i],u[4*i]=255&(d[n[i]>>24&255]^s>>24),u[4*i+1]=255&(d[n[(i+1)%4]>>16&255]^s>>16),u[4*i+2]=255&(d[n[(i+2)%4]>>8&255]^s>>8),u[4*i+3]=255&(d[255&n[(i+3)%4]]^s);return u},M.prototype.decrypt=function(t){if(16!=t.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var e=this._Kd.length-1,r=[0,0,0,0],n=I(t),i=0;i<4;i++)n[i]^=this._Kd[0][i];for(var o=1;o<e;o++){for(i=0;i<4;i++)r[i]=b[n[i]>>24&255]^w[n[(i+3)%4]>>16&255]^_[n[(i+2)%4]>>8&255]^k[255&n[(i+1)%4]]^this._Kd[o][i];n=r.slice()}var s,u=a(16);for(i=0;i<4;i++)s=this._Kd[e][i],u[4*i]=255&(p[n[i]>>24&255]^s>>24),u[4*i+1]=255&(p[n[(i+3)%4]>>16&255]^s>>16),u[4*i+2]=255&(p[n[(i+2)%4]>>8&255]^s>>8),u[4*i+3]=255&(p[255&n[(i+1)%4]]^s);return u};var T=function t(e){if(!(this instanceof t))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new M(e)};T.prototype.encrypt=function(t){if((t=o(t)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var e=a(t.length),r=a(16),n=0;n<t.length;n+=16)s(t,r,0,n,n+16),s(r=this._aes.encrypt(r),e,n);return e},T.prototype.decrypt=function(t){if((t=o(t)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var e=a(t.length),r=a(16),n=0;n<t.length;n+=16)s(t,r,0,n,n+16),s(r=this._aes.decrypt(r),e,n);return e};var P=function t(e,r){if(!(this instanceof t))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Block Chaining",this.name="cbc",r){if(16!=r.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else r=a(16);this._lastCipherblock=o(r,!0),this._aes=new M(e)};P.prototype.encrypt=function(t){if((t=o(t)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var e=a(t.length),r=a(16),n=0;n<t.length;n+=16){s(t,r,0,n,n+16);for(var i=0;i<16;i++)r[i]^=this._lastCipherblock[i];this._lastCipherblock=this._aes.encrypt(r),s(this._lastCipherblock,e,n)}return e},P.prototype.decrypt=function(t){if((t=o(t)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var e=a(t.length),r=a(16),n=0;n<t.length;n+=16){s(t,r,0,n,n+16),r=this._aes.decrypt(r);for(var i=0;i<16;i++)e[n+i]=r[i]^this._lastCipherblock[i];s(t,this._lastCipherblock,0,n,n+16)}return e};var C=function t(e,r,n){if(!(this instanceof t))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Feedback",this.name="cfb",r){if(16!=r.length)throw new Error("invalid initialation vector size (must be 16 size)")}else r=a(16);this.segmentSize=n=n||1,this._shiftRegister=o(r,!0),this._aes=new M(e)};C.prototype.encrypt=function(t){if(t.length%this.segmentSize!=0)throw new Error("invalid plaintext size (must be segmentSize bytes)");for(var e=o(t,!0),r=0;r<e.length;r+=this.segmentSize){for(var n=this._aes.encrypt(this._shiftRegister),i=0;i<this.segmentSize;i++)e[r+i]^=n[i];s(this._shiftRegister,this._shiftRegister,0,this.segmentSize),s(e,this._shiftRegister,16-this.segmentSize,r,r+this.segmentSize)}return e},C.prototype.decrypt=function(t){if(t.length%this.segmentSize!=0)throw new Error("invalid ciphertext size (must be segmentSize bytes)");for(var e=o(t,!0),r=0;r<e.length;r+=this.segmentSize){for(var n=this._aes.encrypt(this._shiftRegister),i=0;i<this.segmentSize;i++)e[r+i]^=n[i];s(this._shiftRegister,this._shiftRegister,0,this.segmentSize),s(t,this._shiftRegister,16-this.segmentSize,r,r+this.segmentSize)}return e};var O=function t(e,r){if(!(this instanceof t))throw Error("AES must be instanitated with `new`");if(this.description="Output Feedback",this.name="ofb",r){if(16!=r.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else r=a(16);this._lastPrecipher=o(r,!0),this._lastPrecipherIndex=16,this._aes=new M(e)};O.prototype.encrypt=function(t){for(var e=o(t,!0),r=0;r<e.length;r++)16===this._lastPrecipherIndex&&(this._lastPrecipher=this._aes.encrypt(this._lastPrecipher),this._lastPrecipherIndex=0),e[r]^=this._lastPrecipher[this._lastPrecipherIndex++];return e},O.prototype.decrypt=O.prototype.encrypt;var R=function t(e){if(!(this instanceof t))throw Error("Counter must be instanitated with `new`");"number"==typeof(e=0===e||e?e:1)?(this._counter=a(16),this.setValue(e)):this.setBytes(e)};R.prototype.setValue=function(t){if("number"!=typeof t||parseInt(t)!=t)throw new Error("invalid counter value (must be an integer)");for(var e=15;0<=e;--e)this._counter[e]=t%256,t>>=8},R.prototype.setBytes=function(t){if(16!=(t=o(t,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=t},R.prototype.increment=function(){for(var t=15;0<=t;t--){if(255!==this._counter[t]){this._counter[t]++;break}this._counter[t]=0}};var N=function t(e,r){if(!(this instanceof t))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",r instanceof R||(r=new R(r)),this._counter=r,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new M(e)};N.prototype.encrypt=function(t){for(var e=o(t,!0),r=0;r<e.length;r++)16===this._remainingCounterIndex&&(this._remainingCounter=this._aes.encrypt(this._counter._counter),this._remainingCounterIndex=0,this._counter.increment()),e[r]^=this._remainingCounter[this._remainingCounterIndex++];return e},N.prototype.decrypt=N.prototype.encrypt,c={AES:M,Counter:R,ModeOfOperation:{ecb:T,cbc:P,cfb:C,ofb:O,ctr:N},utils:{hex:l,utf8:c},padding:{pkcs7:{pad:function(t){var e=16-(t=o(t,!0)).length%16,r=a(t.length+e);s(t,r);for(var n=t.length;n<r.length;n++)r[n]=e;return r},strip:function(t){if((t=o(t,!0)).length<16)throw new Error("PKCS#7 invalid length");var e=t[t.length-1];if(16<e)throw new Error("PKCS#7 padding byte out of range");for(var r=t.length-e,n=0;n<e;n++)if(t[r+n]!==e)throw new Error("PKCS#7 invalid padding byte");var i=a(r);return s(t,i,0,0,r),i}}},_arrayTest:{coerceArray:o,createArray:a,copyArray:s}},void 0!==r?e.exports=c:(t.aesjs&&(c._aesjs=t.aesjs),t.aesjs=c)}(this)},{}],9:[function(t,e,r){!function(e,r){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){function r(){}t.super_=e,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)!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var a;"object"==s(e)?e.exports=o:r.BN=o,(o.BN=o).wordSize=26;try{a=("undefined"!=typeof window&&void 0!==window.Buffer?window:t("buffer")).Buffer}catch(e){}function u(t,e){return 65<=(e=t.charCodeAt(e))&&e<=70?e-55:97<=e&&e<=102?e-87:e-48&15}function c(t,e,r){var n=u(t,r);return e<=r-1&&(n|=u(t,r-1)<<4),n}function l(t,e,r,n){for(var i=0,o=Math.min(t.length,r),a=e;a<o;a++){var s=t.charCodeAt(a)-48;i*=n,i+=49<=s?s-49+10:17<=s?s-17+10:s}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==s(t)&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return 0<t.cmp(e)?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"==s(t))return this._initArray(t,e,r);n((e="hex"===e?16:e)===(0|e)&&2<=e&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,r):(this._parseBase(t,e,i),"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):(n(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(n("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 i,o,a=0;a<this.length;a++)this.words[a]=0;var s=0;if("be"===r)for(a=t.length-1,i=0;0<=a;a-=3)o=t[a]|t[a-1]<<8|t[a-2]<<16,this.words[i]|=o<<s&67108863,this.words[i+1]=o>>>26-s&67108863,26<=(s+=24)&&(s-=26,i++);else if("le"===r)for(i=a=0;a<t.length;a+=3)o=t[a]|t[a+1]<<8|t[a+2]<<16,this.words[i]|=o<<s&67108863,this.words[i+1]=o>>>26-s&67108863,26<=(s+=24)&&(s-=26,i++);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 n=0;n<this.length;n++)this.words[n]=0;var i,o=0,a=0;if("be"===r)for(n=t.length-1;e<=n;n-=2)i=c(t,e,n)<<o,this.words[a]|=67108863&i,18<=o?(o-=18,this.words[a+=1]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=c(t,e,n)<<o,this.words[a]|=67108863&i,18<=o?(o-=18,this.words[a+=1]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0];for(var n=0,i=this.length=1;i<=67108863;i*=e)n++;i=i/e|0;for(var o=t.length-r,a=o%--n,s=Math.min(o,o-a)+r,u=0,c=r;c<s;c+=n)u=l(t,c,c+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!=a){var h=1;for(u=l(t,c,t.length,e),c=0;c<a;c++)h*=e;this.imuln(h),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}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(;1<this.length&&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 h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],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 p(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0,i=(n=(r.length=n)-1|0,(a=(0|t.words[0])*(0|e.words[0]))/67108864|0);r.words[0]=67108863&a;for(var o=1;o<n;o++){for(var a,s=i>>>26,u=67108863&i,c=Math.min(o,e.length-1),l=Math.max(0,o-t.length+1);l<=c;l++)s+=(a=(0|t.words[o-l|0])*(0|e.words[l])+u)/67108864|0,u=67108863&a;r.words[o]=0|u,i=0|s}return 0!==i?r.words[o]=0|i:r.length--,r.strip()}o.prototype.toString=function(t,e){if(e=0|e||1,16===(t=t||10)||"hex"===t){u="";for(var r=0,i=0,o=0;o<this.length;o++){var a=this.words[o],s=(16777215&(a<<r|i)).toString(16),u=0!=(i=a>>>24-r&16777215)||o!==this.length-1?h[6-s.length]+s+u:s+u;26<=(r+=2)&&(r-=26,o--)}for(0!==i&&(u=i.toString(16)+u);u.length%e!=0;)u="0"+u;return 0!==this.negative?"-"+u:u}if(t===(0|t)&&2<=t&&t<=36){var c=f[t],l=d[t];for(u="",(p=this.clone()).negative=0;!p.isZero();){var p,m=p.modn(l).toString(t);u=(p=p.idivn(l)).isZero()?m+u:h[c-m.length]+m+u}for(this.isZero()&&(u="0"+u);u.length%e!=0;)u="0"+u;return 0!==this.negative?"-"+u:u}n(!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]:2<this.length&&n(!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 n(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 i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(0<o,"Requested array length <= 0"),this.strip(),e="le"===e;var a,s,u=new t(o),c=this.clone();if(e){for(s=0;!c.isZero();s++)a=c.andln(255),c.iushrn(8),u[s]=a;for(;s<o;s++)u[s]=0}else{for(s=0;s<o-i;s++)u[s]=0;for(s=0;!c.isZero();s++)a=c.andln(255),c.iushrn(8),u[o-s-1]=a}return u},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t;return t=0,4096<=e&&(t+=13,e>>>=13),64<=e&&(t+=7,e>>>=7),8<=e&&(t+=4,e>>>=4),2<=e&&(t+=2,e>>>=2),t+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t;return t=0,0==(8191&e)&&(t+=13,e>>>=13),0==(127&e)&&(t+=7,e>>>=7),0==(15&e)&&(t+=4,e>>>=4),0==(3&e)&&(t+=2,e>>>=2),0==(1&e)&&t++,t},o.prototype.bitLength=function(){var t=this.words[this.length-1];return t=this._countBits(t),26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},o.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){for(var e=this.length>t.length?t:this,r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},o.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){for(var e,r=this.length>t.length?(e=this,t):(e=t,this),n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this.strip()},o.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&0<=t);var e=0|Math.ceil(t/26);t%=26,this._expand(e),0<t&&e--;for(var r=0;r<e;r++)this.words[r]=67108863&~this.words[r];return 0<t&&(this.words[r]=~this.words[r]&67108863>>26-t),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&0<=t);var r=t/26|0;return t%=26,this._expand(1+r),this.words[r]=e?this.words[r]|1<<t:this.words[r]&~(1<<t),this.strip()},o.prototype.iadd=function(t){var e,r;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();for(var n=this.length>t.length?(r=this,t):(r=t,this),i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;for(var i=0<n?(r=this,t):(r=t,this),o=0,a=0;a<i.length;a++)o=(e=(0|r.words[a])-(0|i.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<r.length;a++)o=(e=(0|r.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<r.length&&r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this.length=Math.max(this.length,a),r!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var m=function(t,e,r){var n,i,o=t.words,a=e.words,s=r.words,u=(G=0|o[0],8191&G),c=G>>>13,l=8191&(V=0|o[1]),h=V>>>13,f=8191&(K=0|o[2]),d=K>>>13,p=8191&(n=0|o[3]),m=n>>>13,y=8191&(Z=0|o[4]),g=Z>>>13,v=8191&(W=0|o[5]),b=W>>>13,w=8191&(i=0|o[6]),_=i>>>13,k=8191&(J=0|o[7]),x=J>>>13,A=8191&(Q=0|o[8]),E=Q>>>13,S=8191&($=0|o[9]),I=$>>>13,M=8191&(Y=0|a[0]),T=Y>>>13,P=0|a[1],C=8191&P,O=P>>>13,R=0|a[2],N=8191&R,j=R>>>13,L=8191&(X=0|a[3]),U=X>>>13,D=0|a[4],B=8191&D,z=D>>>13,F=0|a[5],H=8191&F,q=F>>>13,G=0|a[6],V=8191&G,K=G>>>13,Z=8191&(n=0|a[7]),W=n>>>13,J=8191&(i=0|a[8]),Q=i>>>13,$=8191&(o=0|a[9]),Y=o>>>13;r.negative=t.negative^e.negative,r.length=19;var X=(0+Math.imul(u,M)|0)+((8191&(R=(R=Math.imul(u,T))+Math.imul(c,M)|0))<<13)|0,tt=((D=Math.imul(c,T))+(R>>>13)|0)+(X>>>26)|0;return X&=67108863,P=Math.imul(l,M),R=(R=Math.imul(l,T))+Math.imul(h,M)|0,D=Math.imul(h,T),F=(tt+(P+Math.imul(u,C)|0)|0)+((8191&(R=(R=R+Math.imul(u,O)|0)+Math.imul(c,C)|0))<<13)|0,tt=((D=D+Math.imul(c,O)|0)+(R>>>13)|0)+(F>>>26)|0,F&=67108863,P=Math.imul(f,M),R=(R=Math.imul(f,T))+Math.imul(d,M)|0,D=Math.imul(d,T),P=P+Math.imul(l,C)|0,R=(R=R+Math.imul(l,O)|0)+Math.imul(h,C)|0,D=D+Math.imul(h,O)|0,G=(tt+(P+Math.imul(u,N)|0)|0)+((8191&(R=(R=R+Math.imul(u,j)|0)+Math.imul(c,N)|0))<<13)|0,tt=((D=D+Math.imul(c,j)|0)+(R>>>13)|0)+(G>>>26)|0,G&=67108863,P=Math.imul(p,M),R=(R=Math.imul(p,T))+Math.imul(m,M)|0,D=Math.imul(m,T),P=P+Math.imul(f,C)|0,R=(R=R+Math.imul(f,O)|0)+Math.imul(d,C)|0,D=D+Math.imul(d,O)|0,P=P+Math.imul(l,N)|0,R=(R=R+Math.imul(l,j)|0)+Math.imul(h,N)|0,D=D+Math.imul(h,j)|0,n=(tt+(P+Math.imul(u,L)|0)|0)+((8191&(R=(R=R+Math.imul(u,U)|0)+Math.imul(c,L)|0))<<13)|0,tt=((D=D+Math.imul(c,U)|0)+(R>>>13)|0)+(n>>>26)|0,n&=67108863,P=Math.imul(y,M),R=(R=Math.imul(y,T))+Math.imul(g,M)|0,D=Math.imul(g,T),P=P+Math.imul(p,C)|0,R=(R=R+Math.imul(p,O)|0)+Math.imul(m,C)|0,D=D+Math.imul(m,O)|0,P=P+Math.imul(f,N)|0,R=(R=R+Math.imul(f,j)|0)+Math.imul(d,N)|0,D=D+Math.imul(d,j)|0,P=P+Math.imul(l,L)|0,R=(R=R+Math.imul(l,U)|0)+Math.imul(h,L)|0,D=D+Math.imul(h,U)|0,i=(tt+(P+Math.imul(u,B)|0)|0)+((8191&(R=(R=R+Math.imul(u,z)|0)+Math.imul(c,B)|0))<<13)|0,tt=((D=D+Math.imul(c,z)|0)+(R>>>13)|0)+(i>>>26)|0,i&=67108863,P=Math.imul(v,M),R=(R=Math.imul(v,T))+Math.imul(b,M)|0,D=Math.imul(b,T),P=P+Math.imul(y,C)|0,R=(R=R+Math.imul(y,O)|0)+Math.imul(g,C)|0,D=D+Math.imul(g,O)|0,P=P+Math.imul(p,N)|0,R=(R=R+Math.imul(p,j)|0)+Math.imul(m,N)|0,D=D+Math.imul(m,j)|0,P=P+Math.imul(f,L)|0,R=(R=R+Math.imul(f,U)|0)+Math.imul(d,L)|0,D=D+Math.imul(d,U)|0,P=P+Math.imul(l,B)|0,R=(R=R+Math.imul(l,z)|0)+Math.imul(h,B)|0,D=D+Math.imul(h,z)|0,a=(tt+(P+Math.imul(u,H)|0)|0)+((8191&(R=(R=R+Math.imul(u,q)|0)+Math.imul(c,H)|0))<<13)|0,tt=((D=D+Math.imul(c,q)|0)+(R>>>13)|0)+(a>>>26)|0,a&=67108863,P=Math.imul(w,M),R=(R=Math.imul(w,T))+Math.imul(_,M)|0,D=Math.imul(_,T),P=P+Math.imul(v,C)|0,R=(R=R+Math.imul(v,O)|0)+Math.imul(b,C)|0,D=D+Math.imul(b,O)|0,P=P+Math.imul(y,N)|0,R=(R=R+Math.imul(y,j)|0)+Math.imul(g,N)|0,D=D+Math.imul(g,j)|0,P=P+Math.imul(p,L)|0,R=(R=R+Math.imul(p,U)|0)+Math.imul(m,L)|0,D=D+Math.imul(m,U)|0,P=P+Math.imul(f,B)|0,R=(R=R+Math.imul(f,z)|0)+Math.imul(d,B)|0,D=D+Math.imul(d,z)|0,P=P+Math.imul(l,H)|0,R=(R=R+Math.imul(l,q)|0)+Math.imul(h,H)|0,D=D+Math.imul(h,q)|0,o=(tt+(P+Math.imul(u,V)|0)|0)+((8191&(R=(R=R+Math.imul(u,K)|0)+Math.imul(c,V)|0))<<13)|0,tt=((D=D+Math.imul(c,K)|0)+(R>>>13)|0)+(o>>>26)|0,o&=67108863,P=Math.imul(k,M),R=(R=Math.imul(k,T))+Math.imul(x,M)|0,D=Math.imul(x,T),P=P+Math.imul(w,C)|0,R=(R=R+Math.imul(w,O)|0)+Math.imul(_,C)|0,D=D+Math.imul(_,O)|0,P=P+Math.imul(v,N)|0,R=(R=R+Math.imul(v,j)|0)+Math.imul(b,N)|0,D=D+Math.imul(b,j)|0,P=P+Math.imul(y,L)|0,R=(R=R+Math.imul(y,U)|0)+Math.imul(g,L)|0,D=D+Math.imul(g,U)|0,P=P+Math.imul(p,B)|0,R=(R=R+Math.imul(p,z)|0)+Math.imul(m,B)|0,D=D+Math.imul(m,z)|0,P=P+Math.imul(f,H)|0,R=(R=R+Math.imul(f,q)|0)+Math.imul(d,H)|0,D=D+Math.imul(d,q)|0,P=P+Math.imul(l,V)|0,R=(R=R+Math.imul(l,K)|0)+Math.imul(h,V)|0,D=D+Math.imul(h,K)|0,t=(tt+(P+Math.imul(u,Z)|0)|0)+((8191&(R=(R=R+Math.imul(u,W)|0)+Math.imul(c,Z)|0))<<13)|0,tt=((D=D+Math.imul(c,W)|0)+(R>>>13)|0)+(t>>>26)|0,t&=67108863,P=Math.imul(A,M),R=(R=Math.imul(A,T))+Math.imul(E,M)|0,D=Math.imul(E,T),P=P+Math.imul(k,C)|0,R=(R=R+Math.imul(k,O)|0)+Math.imul(x,C)|0,D=D+Math.imul(x,O)|0,P=P+Math.imul(w,N)|0,R=(R=R+Math.imul(w,j)|0)+Math.imul(_,N)|0,D=D+Math.imul(_,j)|0,P=P+Math.imul(v,L)|0,R=(R=R+Math.imul(v,U)|0)+Math.imul(b,L)|0,D=D+Math.imul(b,U)|0,P=P+Math.imul(y,B)|0,R=(R=R+Math.imul(y,z)|0)+Math.imul(g,B)|0,D=D+Math.imul(g,z)|0,P=P+Math.imul(p,H)|0,R=(R=R+Math.imul(p,q)|0)+Math.imul(m,H)|0,D=D+Math.imul(m,q)|0,P=P+Math.imul(f,V)|0,R=(R=R+Math.imul(f,K)|0)+Math.imul(d,V)|0,D=D+Math.imul(d,K)|0,P=P+Math.imul(l,Z)|0,R=(R=R+Math.imul(l,W)|0)+Math.imul(h,Z)|0,D=D+Math.imul(h,W)|0,e=(tt+(P+Math.imul(u,J)|0)|0)+((8191&(R=(R=R+Math.imul(u,Q)|0)+Math.imul(c,J)|0))<<13)|0,tt=((D=D+Math.imul(c,Q)|0)+(R>>>13)|0)+(e>>>26)|0,e&=67108863,P=Math.imul(S,M),R=(R=Math.imul(S,T))+Math.imul(I,M)|0,D=Math.imul(I,T),P=P+Math.imul(A,C)|0,R=(R=R+Math.imul(A,O)|0)+Math.imul(E,C)|0,D=D+Math.imul(E,O)|0,P=P+Math.imul(k,N)|0,R=(R=R+Math.imul(k,j)|0)+Math.imul(x,N)|0,D=D+Math.imul(x,j)|0,P=P+Math.imul(w,L)|0,R=(R=R+Math.imul(w,U)|0)+Math.imul(_,L)|0,D=D+Math.imul(_,U)|0,P=P+Math.imul(v,B)|0,R=(R=R+Math.imul(v,z)|0)+Math.imul(b,B)|0,D=D+Math.imul(b,z)|0,P=P+Math.imul(y,H)|0,R=(R=R+Math.imul(y,q)|0)+Math.imul(g,H)|0,D=D+Math.imul(g,q)|0,P=P+Math.imul(p,V)|0,R=(R=R+Math.imul(p,K)|0)+Math.imul(m,V)|0,D=D+Math.imul(m,K)|0,P=P+Math.imul(f,Z)|0,R=(R=R+Math.imul(f,W)|0)+Math.imul(d,Z)|0,D=D+Math.imul(d,W)|0,P=P+Math.imul(l,J)|0,R=(R=R+Math.imul(l,Q)|0)+Math.imul(h,J)|0,D=D+Math.imul(h,Q)|0,u=(tt+(P+Math.imul(u,$)|0)|0)+((8191&(R=(R=R+Math.imul(u,Y)|0)+Math.imul(c,$)|0))<<13)|0,tt=((D=D+Math.imul(c,Y)|0)+(R>>>13)|0)+(u>>>26)|0,u&=67108863,P=Math.imul(S,C),R=(R=Math.imul(S,O))+Math.imul(I,C)|0,D=Math.imul(I,O),P=P+Math.imul(A,N)|0,R=(R=R+Math.imul(A,j)|0)+Math.imul(E,N)|0,D=D+Math.imul(E,j)|0,P=P+Math.imul(k,L)|0,R=(R=R+Math.imul(k,U)|0)+Math.imul(x,L)|0,D=D+Math.imul(x,U)|0,P=P+Math.imul(w,B)|0,R=(R=R+Math.imul(w,z)|0)+Math.imul(_,B)|0,D=D+Math.imul(_,z)|0,P=P+Math.imul(v,H)|0,R=(R=R+Math.imul(v,q)|0)+Math.imul(b,H)|0,D=D+Math.imul(b,q)|0,P=P+Math.imul(y,V)|0,R=(R=R+Math.imul(y,K)|0)+Math.imul(g,V)|0,D=D+Math.imul(g,K)|0,P=P+Math.imul(p,Z)|0,R=(R=R+Math.imul(p,W)|0)+Math.imul(m,Z)|0,D=D+Math.imul(m,W)|0,P=P+Math.imul(f,J)|0,R=(R=R+Math.imul(f,Q)|0)+Math.imul(d,J)|0,D=D+Math.imul(d,Q)|0,l=(tt+(P+Math.imul(l,$)|0)|0)+((8191&(R=(R=R+Math.imul(l,Y)|0)+Math.imul(h,$)|0))<<13)|0,tt=((D=D+Math.imul(h,Y)|0)+(R>>>13)|0)+(l>>>26)|0,l&=67108863,P=Math.imul(S,N),R=(R=Math.imul(S,j))+Math.imul(I,N)|0,D=Math.imul(I,j),P=P+Math.imul(A,L)|0,R=(R=R+Math.imul(A,U)|0)+Math.imul(E,L)|0,D=D+Math.imul(E,U)|0,P=P+Math.imul(k,B)|0,R=(R=R+Math.imul(k,z)|0)+Math.imul(x,B)|0,D=D+Math.imul(x,z)|0,P=P+Math.imul(w,H)|0,R=(R=R+Math.imul(w,q)|0)+Math.imul(_,H)|0,D=D+Math.imul(_,q)|0,P=P+Math.imul(v,V)|0,R=(R=R+Math.imul(v,K)|0)+Math.imul(b,V)|0,D=D+Math.imul(b,K)|0,P=P+Math.imul(y,Z)|0,R=(R=R+Math.imul(y,W)|0)+Math.imul(g,Z)|0,D=D+Math.imul(g,W)|0,P=P+Math.imul(p,J)|0,R=(R=R+Math.imul(p,Q)|0)+Math.imul(m,J)|0,D=D+Math.imul(m,Q)|0,f=(tt+(P+Math.imul(f,$)|0)|0)+((8191&(R=(R=R+Math.imul(f,Y)|0)+Math.imul(d,$)|0))<<13)|0,tt=((D=D+Math.imul(d,Y)|0)+(R>>>13)|0)+(f>>>26)|0,f&=67108863,P=Math.imul(S,L),R=(R=Math.imul(S,U))+Math.imul(I,L)|0,D=Math.imul(I,U),P=P+Math.imul(A,B)|0,R=(R=R+Math.imul(A,z)|0)+Math.imul(E,B)|0,D=D+Math.imul(E,z)|0,P=P+Math.imul(k,H)|0,R=(R=R+Math.imul(k,q)|0)+Math.imul(x,H)|0,D=D+Math.imul(x,q)|0,P=P+Math.imul(w,V)|0,R=(R=R+Math.imul(w,K)|0)+Math.imul(_,V)|0,D=D+Math.imul(_,K)|0,P=P+Math.imul(v,Z)|0,R=(R=R+Math.imul(v,W)|0)+Math.imul(b,Z)|0,D=D+Math.imul(b,W)|0,P=P+Math.imul(y,J)|0,R=(R=R+Math.imul(y,Q)|0)+Math.imul(g,J)|0,D=D+Math.imul(g,Q)|0,p=(tt+(P+Math.imul(p,$)|0)|0)+((8191&(R=(R=R+Math.imul(p,Y)|0)+Math.imul(m,$)|0))<<13)|0,tt=((D=D+Math.imul(m,Y)|0)+(R>>>13)|0)+(p>>>26)|0,p&=67108863,P=Math.imul(S,B),R=(R=Math.imul(S,z))+Math.imul(I,B)|0,D=Math.imul(I,z),P=P+Math.imul(A,H)|0,R=(R=R+Math.imul(A,q)|0)+Math.imul(E,H)|0,D=D+Math.imul(E,q)|0,P=P+Math.imul(k,V)|0,R=(R=R+Math.imul(k,K)|0)+Math.imul(x,V)|0,D=D+Math.imul(x,K)|0,P=P+Math.imul(w,Z)|0,R=(R=R+Math.imul(w,W)|0)+Math.imul(_,Z)|0,D=D+Math.imul(_,W)|0,P=P+Math.imul(v,J)|0,R=(R=R+Math.imul(v,Q)|0)+Math.imul(b,J)|0,D=D+Math.imul(b,Q)|0,y=(tt+(P+Math.imul(y,$)|0)|0)+((8191&(R=(R=R+Math.imul(y,Y)|0)+Math.imul(g,$)|0))<<13)|0,tt=((D=D+Math.imul(g,Y)|0)+(R>>>13)|0)+(y>>>26)|0,y&=67108863,P=Math.imul(S,H),R=(R=Math.imul(S,q))+Math.imul(I,H)|0,D=Math.imul(I,q),P=P+Math.imul(A,V)|0,R=(R=R+Math.imul(A,K)|0)+Math.imul(E,V)|0,D=D+Math.imul(E,K)|0,P=P+Math.imul(k,Z)|0,R=(R=R+Math.imul(k,W)|0)+Math.imul(x,Z)|0,D=D+Math.imul(x,W)|0,P=P+Math.imul(w,J)|0,R=(R=R+Math.imul(w,Q)|0)+Math.imul(_,J)|0,D=D+Math.imul(_,Q)|0,v=(tt+(P+Math.imul(v,$)|0)|0)+((8191&(R=(R=R+Math.imul(v,Y)|0)+Math.imul(b,$)|0))<<13)|0,tt=((D=D+Math.imul(b,Y)|0)+(R>>>13)|0)+(v>>>26)|0,v&=67108863,P=Math.imul(S,V),R=(R=Math.imul(S,K))+Math.imul(I,V)|0,D=Math.imul(I,K),P=P+Math.imul(A,Z)|0,R=(R=R+Math.imul(A,W)|0)+Math.imul(E,Z)|0,D=D+Math.imul(E,W)|0,P=P+Math.imul(k,J)|0,R=(R=R+Math.imul(k,Q)|0)+Math.imul(x,J)|0,D=D+Math.imul(x,Q)|0,w=(tt+(P+Math.imul(w,$)|0)|0)+((8191&(R=(R=R+Math.imul(w,Y)|0)+Math.imul(_,$)|0))<<13)|0,tt=((D=D+Math.imul(_,Y)|0)+(R>>>13)|0)+(w>>>26)|0,w&=67108863,P=Math.imul(S,Z),R=(R=Math.imul(S,W))+Math.imul(I,Z)|0,D=Math.imul(I,W),P=P+Math.imul(A,J)|0,R=(R=R+Math.imul(A,Q)|0)+Math.imul(E,J)|0,D=D+Math.imul(E,Q)|0,k=(tt+(P+Math.imul(k,$)|0)|0)+((8191&(R=(R=R+Math.imul(k,Y)|0)+Math.imul(x,$)|0))<<13)|0,tt=((D=D+Math.imul(x,Y)|0)+(R>>>13)|0)+(k>>>26)|0,k&=67108863,P=Math.imul(S,J),R=(R=Math.imul(S,Q))+Math.imul(I,J)|0,D=Math.imul(I,Q),A=(tt+(P+Math.imul(A,$)|0)|0)+((8191&(R=(R=R+Math.imul(A,Y)|0)+Math.imul(E,$)|0))<<13)|0,tt=((D=D+Math.imul(E,Y)|0)+(R>>>13)|0)+(A>>>26)|0,A&=67108863,$=(tt+Math.imul(S,$)|0)+((8191&(R=(R=Math.imul(S,Y))+Math.imul(I,$)|0))<<13)|0,tt=((D=Math.imul(I,Y))+(R>>>13)|0)+($>>>26)|0,$&=67108863,s[0]=X,s[1]=F,s[2]=G,s[3]=n,s[4]=i,s[5]=a,s[6]=o,s[7]=t,s[8]=e,s[9]=u,s[10]=l,s[11]=f,s[12]=p,s[13]=y,s[14]=v,s[15]=w,s[16]=k,s[17]=A,s[18]=$,0!=tt&&(s[19]=tt,r.length++),r};function y(t,e,r){return(new g).mulp(t,e,r)}function g(t,e){this.x=t,this.y=e}Math.imul||(m=p),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return e=(10===this.length&&10===t.length?m:r<63?p:r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o<r.length-1;o++){for(var a=i,s=(i=0,67108863&n),u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var l,h=(0|t.words[o-c])*(0|e.words[c]);s=67108863&(l=(l=67108863&h)+s|0),i+=(a=(a=a+(h/67108864|0)|0)+(l>>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}:y)(this,t,e)},g.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n<t;n++)e[n]=this.revBin(n,r,t);return e},g.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var n=0,i=0;i<e;i++)n|=(1&t)<<e-i-1,t>>=1;return n},g.prototype.permute=function(t,e,r,n,i,o){for(var a=0;a<o;a++)n[a]=e[t[a]],i[a]=r[t[a]]},g.prototype.transform=function(t,e,r,n,i,o){this.permute(o,t,e,r,n,i);for(var a=1;a<i;a<<=1)for(var s=a<<1,u=Math.cos(2*Math.PI/s),c=Math.sin(2*Math.PI/s),l=0;l<i;l+=s)for(var h=u,f=c,d=0;d<a;d++){var p=r[l+d],m=n[l+d],y=r[l+d+a],g=h*y-f*(v=n[l+d+a]),v=h*v+f*y;r[l+d]=p+(y=g),n[l+d]=m+v,r[l+d+a]=p-y,n[l+d+a]=m-v,d!==s&&(g=u*h-c*f,f=u*f+c*h,h=g)}},g.prototype.guessLen13b=function(t,e){t=1&(n=1|Math.max(e,t));for(var r=0,n=n/2|0;n;n>>>=1)r++;return 1<<r+1+t},g.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=t[n];t[n]=t[r-n-1],t[r-n-1]=i,i=e[n],e[n]=-e[r-n-1],e[r-n-1]=-i}},g.prototype.normalize13b=function(t,e){for(var r=0,n=0;n<e/2;n++){var i=8192*Math.round(t[2*n+1]/e)+Math.round(t[2*n]/e)+r;t[n]=67108863&i,r=i<67108864?0:i/67108864|0}return t},g.prototype.convert13b=function(t,e,r,i){for(var o=0,a=0;a<e;a++)o+=0|t[a],r[2*a]=8191&o,r[2*a+1]=8191&(o>>>=13),o>>>=13;for(a=2*e;a<i;++a)r[a]=0;n(0===o),n(0==(-8192&o))},g.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},g.prototype.mulp=function(t,e,r){var n=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(n),o=this.stub(n),a=new Array(n),s=new Array(n),u=new Array(n),c=new Array(n),l=new Array(n),h=new Array(n),f=r.words;f.length=n,this.convert13b(t.words,t.length,a,n),this.convert13b(e.words,e.length,c,n),this.transform(a,o,s,u,n,i),this.transform(c,o,l,h,n,i);for(var d=0;d<n;d++){var p=s[d]*l[d]-u[d]*h[d];u[d]=s[d]*h[d]+u[d]*l[d],s[d]=p}return this.conjugate(s,u,n),this.transform(s,u,f,o,n,i),this.conjugate(f,o,n),this.normalize13b(f,n),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),y(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){n("number"==typeof t),n(t<67108864);for(var e=0,r=0;r<this.length;r++){var i=(0|this.words[r])*t,o=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r%26;e[r]=(t.words[r/26|0]&1<<n)>>>n}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var i=r.sqr();n<e.length;n++,i=i.sqr())0!==e[n]&&(r=r.mul(i));return r},o.prototype.iushln=function(t){n("number"==typeof t&&0<=t);var e=t%26,r=(t-e)/26,i=67108863>>>26-e<<26-e;if(0!=e){for(var o=0,a=0;a<this.length;a++){var s=this.words[a]&i,u=(0|this.words[a])-s<<e;this.words[a]=u|o,o=s>>>26-e}o&&(this.words[a]=o,this.length++)}if(0!=r){for(a=this.length-1;0<=a;a--)this.words[a+r]=this.words[a];for(a=0;a<r;a++)this.words[a]=0;this.length+=r}return this.strip()},o.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,r){n("number"==typeof t&&0<=t);var i=e?(e-e%26)/26:0,o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0!==a)if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var l=0;for(c=this.length-1;0<=c&&(0!==l||i<=c);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&0<=t);var e=t%26;return t=(t-e)/26,!(this.length<=t||!(this.words[t]&1<<e))},o.prototype.imaskn=function(t){n("number"==typeof t&&0<=t);var e=t%26;return t=(t-e)/26,n(0===this.negative,"imaskn works only with positive numbers"),this.length<=t?this:(0!=e&&t++,this.length=Math.min(t,this.length),0!=e&&(this.words[this.length-1]&=67108863^67108863>>>e<<e),this.strip())},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return n("number"==typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?(1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0):(this.negative=0,this.isubn(t),this.negative=1),this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&67108864<=this.words[e];e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,--this.words[e+1];return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,r){var i=t.length+r;this._expand(i);for(var o=0,a=0;a<t.length;a++){var s=(0|this.words[a+r])+o,u=(0|t.words[a])*e;o=((s-=67108863&u)>>26)-(u/67108864|0),this.words[a+r]=67108863&s}for(;a<this.length-r;a++)o=(s=(0|this.words[a+r])+o)>>26,this.words[a+r]=67108863&s;if(0===o)return this.strip();for(n(-1===o),a=o=0;a<this.length;a++)o=(s=-(0|this.words[a])+o)>>26,this.words[a]=67108863&s;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,a=0|i.words[i.length-1];0!=(r=26-this._countBits(a))&&(i=i.ushln(r),n.iushln(r),a=0|i.words[i.length-1]);var s,u=n.length-i.length;if("mod"!==e){(s=new o(null)).length=1+u,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}0===(t=n.clone()._ishlnsubmul(i,1,u)).negative&&(n=t,s&&(s.words[u]=1));for(var l=u-1;0<=l;l--){var h=67108864*(0|n.words[i.length+l])+(0|n.words[i.length+l-1]);for(h=Math.min(h/a|0,67108863),n._ishlnsubmul(i,h,l);0!==n.negative;)h--,n.negative=0,n._ishlnsubmul(i,1,l),n.isZero()||(n.negative^=1);s&&(s.words[l]=h)}return s&&s.strip(),n.strip(),"div"!==e&&0!=r&&n.iushrn(r),{div:s||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:i,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),{div:i="mod"!==e?s.div.neg():i,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,a,s},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1);return t=t.andln(1),(n=r.cmp(n))<0||1===t&&0===n?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;0<=i;i--)r=(e*r+(0|this.words[i]))%t;return r},o.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;0<=r;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());for(var e=this,r=t.clone(),i=(e=0!==e.negative?e.umod(t):e.clone(),new o(1)),a=new o(0),s=new o(0),u=new o(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),h=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(0<f)for(e.iushrn(f);0<f--;)(i.isOdd()||a.isOdd())&&(i.iadd(l),a.isub(h)),i.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(0<p)for(r.iushrn(p);0<p--;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(h)),s.iushrn(1),u.iushrn(1);0<=e.cmp(r)?(e.isub(r),i.isub(s),a.isub(u)):(r.isub(e),s.isub(i),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());for(var e,r=this,i=t.clone(),a=(r=0!==r.negative?r.umod(t):r.clone(),new o(1)),s=new o(0),u=i.clone();0<r.cmpn(1)&&0<i.cmpn(1);){for(var c=0,l=1;0==(r.words[0]&l)&&c<26;++c,l<<=1);if(0<c)for(r.iushrn(c);0<c--;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,f=1;0==(i.words[0]&f)&&h<26;++h,f<<=1);if(0<h)for(i.iushrn(h);0<h--;)s.isOdd()&&s.iadd(u),s.iushrn(1);0<=r.cmp(i)?(r.isub(i),a.isub(s)):(i.isub(r),s.isub(a))}return(e=0===r.cmpn(1)?a:s).cmpn(0)<0&&e.iadd(t),e},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0;for(var n=r.negative=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t),t=(t-(e=t%26))/26;var e=1<<e;if(this.length<=t)return this._expand(1+t),this.words[t]|=e,this;for(var r=e,i=t;0!==r&&i<this.length;i++){var o=0|this.words[i];r=(o+=r)>>>26,o&=67108863,this.words[i]=o}return 0!==r&&(this.words[i]=r,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e=t<0;return 0===this.negative||e?0===this.negative&&e?1:(this.strip(),t=1<this.length?1:(n((t=e?-t:t)<=67108863,"Number is too big"),(e=0|this.words[0])===t?0:e<t?-1:1),0!==this.negative?0|-t:t):-1},o.prototype.cmp=function(t){return 0!==this.negative&&0===t.negative?-1:0===this.negative&&0!==t.negative?1:(t=this.ucmp(t),0!==this.negative?0|-t:t)},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;0<=r;r--){var n=0|this.words[r],i=0|t.words[r];if(n!=i){n<i?e=-1:i<n&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return 0<=this.cmpn(t)},o.prototype.gte=function(t){return 0<=this.cmp(t)},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new A(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function b(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function k(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function x(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(t){var e;"string"==typeof t?(e=o._prime(t),this.m=e.p,this.prime=e):(n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null)}function E(t){A.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}b.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function(t){for(var e,r=t;this.split(r,this.tmp),(e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength())>this.n;);return 0===(t=e<this.n?-1:r.ucmp(this.p))?(r.words[0]=0,r.length=1):0<t?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},b.prototype.split=function(t,e){t.iushrn(this.n,0,e)},b.prototype.imulK=function(t){return t.imul(this.k)},i(w,b),w.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n<r;n++)e.words[n]=t.words[n];if(e.length=r,t.length<=9)return t.words[0]=0,void(t.length=1);var i=t.words[9];for(e.words[e.length++]=4194303&i,n=10;n<t.length;n++){var o=0|t.words[n];t.words[n-10]=(4194303&o)<<4|i>>>22,i=o}0==(t.words[n-10]=i>>>=22)&&10<t.length?t.length-=10:t.length-=9},w.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(_,b),i(k,b),i(x,b),x.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new w;else if("p224"===t)e=new _;else if("p192"===t)e=new k;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new x}return v[t]=e},A.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},A.prototype.imod=function(t){return(this.prime?this.prime.ireduce(t):t.umod(this.m))._forceRed(this)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.prototype.add=function(t,e){return this._verify2(t,e),0<=(e=t.add(e)).cmp(this.m)&&e.isub(this.m),e._forceRed(this)},A.prototype.iadd=function(t,e){return this._verify2(t,e),0<=(e=t.iadd(e)).cmp(this.m)&&e.isub(this.m),e},A.prototype.sub=function(t,e){return this._verify2(t,e),(e=t.sub(e)).cmpn(0)<0&&e.iadd(this.m),e._forceRed(this)},A.prototype.isub=function(t,e){return this._verify2(t,e),(e=t.isub(e)).cmpn(0)<0&&e.iadd(this.m),e},A.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},A.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},A.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e)return e=this.m.add(new o(1)).iushrn(2),this.pow(t,e);for(var r=this.m.subn(1),i=0;!r.isZero()&&0===r.andln(1);)i++,r.iushrn(1);n(!r.isZero());for(var a=new o(1).toRed(this),s=a.redNeg(),u=this.m.subn(1).iushrn(1),c=new o(2*(c=this.m.bitLength())*c).toRed(this);0!==this.pow(c,u).cmp(s);)c.redIAdd(s);for(var l=this.pow(c,r),h=this.pow(t,r.addn(1).iushrn(1)),f=this.pow(t,r),d=i;0!==f.cmp(a);){for(var p=f,m=0;0!==p.cmp(a);m++)p=p.redSqr();n(m<d);var y=this.pow(l,new o(1).iushln(d-m-1));h=h.redMul(y),l=y.redSqr(),f=f.redMul(l),d=m}return h},A.prototype.invm=function(t){return 0!==(t=t._invmp(this.m)).negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},A.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var i=r[0],a=0,s=0,u=e.bitLength()%26;for(0===u&&(u=26),n=e.length-1;0<=n;n--){for(var c=e.words[n],l=u-1;0<=l;l--){var h=c>>l&1;i!==r[0]&&(i=this.sqr(i)),0!=h||0!==a?(a<<=1,a|=h,(4==++s||0===n&&0===l)&&(i=this.mul(i,r[a]),a=s=0)):s=0}u=26}return i},A.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},A.prototype.convertFrom=function(t){return(t=t.clone()).red=null,t},o.mont=function(t){return new E(t)},i(E,A),E.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},E.prototype.convertFrom=function(t){return(t=this.imod(t.mul(this.rinv))).red=null,t},E.prototype.imul=function(t,e){return t.isZero()||e.isZero()?(t.words[0]=0,t.length=1,t):(e=(t=t.imul(e)).maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),e=t=t.isub(e).iushrn(this.shift),0<=t.cmp(this.m)?e=t.isub(this.m):t.cmpn(0)<0&&(e=t.iadd(this.m)),e._forceRed(this))},E.prototype.mul=function(t,e){return t.isZero()||e.isZero()?new o(0)._forceRed(this):(e=(t=t.mul(e)).maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),e=t=t.isub(e).iushrn(this.shift),0<=t.cmp(this.m)?e=t.isub(this.m):t.cmpn(0)<0&&(e=t.iadd(this.m)),e._forceRed(this))},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)},{buffer:11}],10:[function(t,e,n){(function(t){(function(){e.exports=function(e){return e=new Uint8Array(e),(t.crypto||t.msCrypto).getRandomValues(e),e}}).call(this)}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],11:[function(t,e,r){},{}],12:[function(t,e,r){"use strict";r.version=t("../package.json").version,r.utils=t("./elliptic/utils"),r.rand=t("brorand"),r.curve=t("./elliptic/curve"),r.curves=t("./elliptic/curves"),r.ec=t("./elliptic/ec"),r.eddsa=t("./elliptic/eddsa")},{"../package.json":25,"./elliptic/curve":15,"./elliptic/curves":18,"./elliptic/ec":19,"./elliptic/eddsa":22,"./elliptic/utils":24,brorand:10}],13:[function(t,e,r){"use strict";var n=t("bn.js"),i=t("../utils"),o=i.getNAF,a=i.getJSF,s=i.assert;function u(t,e){this.type=t,this.p=new n(e.p,16),this.red=e.prime?n.red(e.prime):n.mont(this.p),this.zero=new n(0).toRed(this.red),this.one=new n(1).toRed(this.red),this.two=new n(2).toRed(this.red),this.n=e.n&&new n(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0,!(e=this.n&&this.p.div(this.n))||0<e.cmpn(100)?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function c(t,e){this.curve=t,this.type=e,this.precomputed=null}(e.exports=u).prototype.point=function(){throw new Error("Not implemented")},u.prototype.validate=function(){throw new Error("Not implemented")},u.prototype._fixedNafMul=function(t,e){s(t.precomputed);var r=t._getDoubles(),n=o(e,1,this._bitLength);e=(1<<r.step+1)-(r.step%2==0?2:1),e/=3;for(var i=[],a=0;a<n.length;a+=r.step){for(var u=0,c=a+r.step-1;a<=c;c--)u=(u<<1)+n[c];i.push(u)}for(var l=this.jpoint(null,null,null),h=this.jpoint(null,null,null),f=e;0<f;f--){for(a=0;a<i.length;a++)(u=i[a])===f?h=h.mixedAdd(r.points[a]):u===-f&&(h=h.mixedAdd(r.points[a].neg()));l=l.add(h)}return l.toP()},u.prototype._wnafMul=function(t,e){for(var r=t._getNAFPoints(4),n=r.wnd,i=r.points,a=o(e,n,this._bitLength),u=this.jpoint(null,null,null),c=a.length-1;0<=c;c--){for(var l=0;0<=c&&0===a[c];c--)l++;if(0<=c&&l++,u=u.dblp(l),c<0)break;var h=a[c];s(0!==h),u="affine"===t.type?0<h?u.mixedAdd(i[h-1>>1]):u.mixedAdd(i[-h-1>>1].neg()):0<h?u.add(i[h-1>>1]):u.add(i[-h-1>>1].neg())}return"affine"===t.type?u.toP():u},u.prototype._wnafMulAdd=function(t,e,r,n,i){for(var s=this._wnafT1,u=this._wnafT2,c=this._wnafT3,l=0,h=0;h<n;h++){var f,d=(f=e[h])._getNAFPoints(t);s[h]=d.wnd,u[h]=d.points}for(h=n-1;1<=h;h-=2){var p=h-1,m=h;if(1===s[p]&&1===s[m]){var y=[e[p],null,null,e[m]];0===e[p].y.cmp(e[m].y)?(y[1]=e[p].add(e[m]),y[2]=e[p].toJ().mixedAdd(e[m].neg())):0===e[p].y.cmp(e[m].y.redNeg())?(y[1]=e[p].toJ().mixedAdd(e[m]),y[2]=e[p].add(e[m].neg())):(y[1]=e[p].toJ().mixedAdd(e[m]),y[2]=e[p].toJ().mixedAdd(e[m].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],v=a(r[p],r[m]);for(l=Math.max(v[0].length,l),c[p]=new Array(l),c[m]=new Array(l),E=0;E<l;E++){var b=0|v[0][E],w=0|v[1][E];c[p][E]=g[3*(1+b)+(1+w)],c[m][E]=0,u[p]=y}}else c[p]=o(r[p],s[p],this._bitLength),c[m]=o(r[m],s[m],this._bitLength),l=Math.max(c[p].length,l),l=Math.max(c[m].length,l)}var _=this.jpoint(null,null,null),k=this._wnafT4;for(h=l;0<=h;h--){for(var x=0;0<=h;){for(var A=!0,E=0;E<n;E++)k[E]=0|c[E][h],0!==k[E]&&(A=!1);if(!A)break;x++,h--}if(0<=h&&x++,_=_.dblp(x),h<0)break;for(E=0;E<n;E++){var S=k[E];0!==S&&(0<S?f=u[E][S-1>>1]:S<0&&(f=u[E][-S-1>>1].neg()),_="affine"===f.type?_.mixedAdd(f):_.add(f))}}for(h=0;h<n;h++)u[h]=null;return i?_:_.toP()},(u.BasePoint=c).prototype.eq=function(){throw new Error("Not implemented")},c.prototype.validate=function(){return this.curve.validate(this)},u.prototype.decodePoint=function(t,e){if(t=i.toArray(t,e),e=this.p.byteLength(),(4===t[0]||6===t[0]||7===t[0])&&t.length-1==2*e)return 6===t[0]?s(t[t.length-1]%2==0):7===t[0]&&s(t[t.length-1]%2==1),this.point(t.slice(1,1+e),t.slice(1+e,1+2*e));if((2===t[0]||3===t[0])&&t.length-1===e)return this.pointFromX(t.slice(1,1+e),3===t[0]);throw new Error("Unknown point format")},c.prototype.encodeCompressed=function(t){return this.encode(t,!0)},c.prototype._encode=function(t){var e=this.curve.p.byteLength(),r=this.getX().toArray("be",e);return t?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",e))},c.prototype.encode=function(t,e){return i.encode(this._encode(e),t)},c.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},c.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var e=this.precomputed.doubles;return!!e&&e.points.length>=Math.ceil((t.bitLength()+1)/e.step)},c.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i<e;i+=t){for(var o=0;o<t;o++)n=n.dbl();r.push(n)}return{step:t,points:r}},c.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],r=(1<<t)-1,n=1==r?null:this.dbl(),i=1;i<r;i++)e[i]=e[i-1].add(n);return{wnd:t,points:e}},c.prototype._getBeta=function(){return null},c.prototype.dblp=function(t){for(var e=this,r=0;r<t;r++)e=e.dbl();return e}},{"../utils":24,"bn.js":9}],14:[function(t,e,r){e.exports={}},{}],15:[function(t,e,r){"use strict";r.base=t("./base"),r.short=t("./short"),r.mont=t("./mont"),r.edwards=t("./edwards")},{"./base":13,"./edwards":14,"./mont":16,"./short":17}],16:[function(t,e,r){arguments[4][14][0].apply(r,arguments)},{dup:14}],17:[function(t,e,r){"use strict";var n=t("../utils"),i=t("bn.js"),o=t("inherits"),a=t("./base"),s=n.assert;function u(t){a.call(this,"short",t),this.a=new i(t.a,16).toRed(this.red),this.b=new i(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function c(t,e,r,n){a.BasePoint.call(this,t,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(e,16),this.y=new i(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function l(t,e,r,n){a.BasePoint.call(this,t,"jacobian"),null===e&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new i(0)):(this.x=new i(e,16),this.y=new i(r,16),this.z=new i(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(u,a),(e.exports=u).prototype._getEndomorphism=function(t){var e,r,n;if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3))return r=(t.beta?new i(t.beta,16):r=(n=this._getEndoRoots(this.p))[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red),t.lambda?e=new i(t.lambda,16):(n=this._getEndoRoots(this.n),0===this.g.mul(n[0]).x.cmp(this.g.x.redMul(r))?e=n[0]:(e=n[1],s(0===this.g.mul(e).x.cmp(this.g.x.redMul(r))))),{beta:r,lambda:e,basis:t.basis?t.basis.map((function(t){return{a:new i(t.a,16),b:new i(t.b,16)}})):this._getEndoBasis(e)}},u.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:i.mont(t),r=(t=(r=new i(2).toRed(e).redInvm()).redNeg(),new i(3).toRed(e).redNeg().redSqrt().redMul(r));return[t.redAdd(r).fromRed(),t.redSub(r).fromRed()]},u.prototype._getEndoBasis=function(t){for(var e,r,n,o,a,s=this.n.ushrn(Math.floor(this.n.bitLength()/2)),u=t,c=this.n.clone(),l=new i(1),h=new i(0),f=new i(0),d=new i(1),p=0;0!==u.cmpn(0);){var m=c.div(u),y=c.sub(m.mul(u)),g=f.sub(m.mul(l));if(m=d.sub(m.mul(h)),!n&&y.cmp(s)<0)e=a.neg(),r=l,n=y.neg(),o=g;else if(n&&2==++p)break;c=u,u=a=y,f=l,l=g,d=h,h=m}var v=y.neg(),b=g;return t=n.sqr().add(o.sqr()),0<=v.sqr().add(b.sqr()).cmp(t)&&(v=e,b=r),n.negative&&(n=n.neg(),o=o.neg()),v.negative&&(v=v.neg(),b=b.neg()),[{a:n,b:o},{a:v,b:b}]},u.prototype._endoSplit=function(t){var e=(o=this.endo.basis)[0],r=(a=o[1]).b.mul(t).divRound(this.n),n=e.b.neg().mul(t).divRound(this.n),i=r.mul(e.a),o=n.mul(a.a),a=(e=r.mul(e.b),n.mul(a.b));return{k1:t.sub(i).sub(o),k2:e.add(a).neg()}},u.prototype.pointFromX=function(t,e){var r=(t=(t=new i(t,16)).red?t:t.toRed(this.red)).redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");return r=n.fromRed().isOdd(),(e&&!r||!e&&r)&&(n=n.redNeg()),this.point(t,n)},u.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y;return t=this.a.redMul(e),t=e.redSqr().redMul(e).redIAdd(t).redIAdd(this.b),0===r.redSqr().redISub(t).cmpn(0)},u.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o<t.length;o++){var a=this._endoSplit(e[o]),s=t[o],u=s._getBeta();a.k1.negative&&(a.k1.ineg(),s=s.neg(!0)),a.k2.negative&&(a.k2.ineg(),u=u.neg(!0)),n[2*o]=s,n[2*o+1]=u,i[2*o]=a.k1,i[2*o+1]=a.k2}r=this._wnafMulAdd(1,n,i,2*o,r);for(var c=0;c<2*o;c++)n[c]=null,i[c]=null;return r},o(c,a.BasePoint),u.prototype.point=function(t,e,r){return new c(this,t,e,r)},u.prototype.pointFromJSON=function(t,e){return c.fromJSON(this,t,e)},c.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var e,r,n=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);return t&&(e=this.curve,r=function(t){return e.point(t.x.redMul(e.endo.beta),t.y)},(t.beta=n).precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(r)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(r)}}),n}},c.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},c.fromJSON=function(t,e,r){"string"==typeof e&&(e=JSON.parse(e));var n=t.point(e[0],e[1],r);if(!e[2])return n;function i(e){return t.point(e[0],e[1],r)}return e=e[2],n.precomputed={beta:null,doubles:e.doubles&&{step:e.doubles.step,points:[n].concat(e.doubles.points.map(i))},naf:e.naf&&{wnd:e.naf.wnd,points:[n].concat(e.naf.points.map(i))}},n},c.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},c.prototype.isInfinity=function(){return this.inf},c.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);t=(e=0!==(e=this.y.redSub(t.y)).cmpn(0)?e.redMul(this.x.redSub(t.x).redInvm()):e).redSqr().redISub(this.x).redISub(t.x);var e=e.redMul(this.x.redSub(t)).redISub(this.y);return this.curve.point(t,e)},c.prototype.dbl=function(){if(this.inf)return this;if(0===(r=this.y.redAdd(this.y)).cmpn(0))return this.curve.point(null,null);var t=this.curve.a,e=this.x.redSqr(),r=r.redInvm();return r=(t=e.redAdd(e).redIAdd(e).redIAdd(t).redMul(r)).redSqr().redISub(this.x.redAdd(this.x)),t=t.redMul(this.x.redSub(r)).redISub(this.y),this.curve.point(r,t)},c.prototype.getX=function(){return this.x.fromRed()},c.prototype.getY=function(){return this.y.fromRed()},c.prototype.mul=function(t){return t=new i(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},c.prototype.mulAdd=function(t,e,r){return e=[this,e],r=[t,r],this.curve.endo?this.curve._endoWnafMulAdd(e,r):this.curve._wnafMulAdd(1,e,r,2)},c.prototype.jmulAdd=function(t,e,r){return e=[this,e],r=[t,r],this.curve.endo?this.curve._endoWnafMulAdd(e,r,!0):this.curve._wnafMulAdd(1,e,r,2,!0)},c.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},c.prototype.neg=function(t){if(this.inf)return this;var e,r=this.curve.point(this.x,this.y.redNeg());return t&&this.precomputed&&(e=this.precomputed,t=function(t){return t.neg()},r.precomputed={naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(t)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(t)}}),r},c.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(l,a.BasePoint),u.prototype.jpoint=function(t,e,r){return new l(this,t,e,r)},l.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=(r=this.z.redInvm()).redSqr(),e=this.x.redMul(t),r=this.y.redMul(t).redMul(r);return this.curve.point(e,r)},l.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},l.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),a=t.y.redMul(r.redMul(this.z));return e=n.redSub(i),r=o.redSub(a),0===e.cmpn(0)?0!==r.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl():(a=(i=e.redSqr()).redMul(e),n=n.redMul(i),i=r.redSqr().redIAdd(a).redISub(n).redISub(n),a=r.redMul(n.redISub(i)).redISub(o.redMul(a)),e=this.z.redMul(t.z).redMul(e),this.curve.jpoint(i,a,e))},l.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z);return t=r.redSub(n),e=i.redSub(o),0===t.cmpn(0)?0!==e.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl():(o=(n=t.redSqr()).redMul(t),r=r.redMul(n),n=e.redSqr().redIAdd(o).redISub(r).redISub(r),o=e.redMul(r.redISub(n)).redISub(i.redMul(o)),t=this.z.redMul(t),this.curve.jpoint(n,o,t))},l.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var e=this,r=0;r<t;r++)e=e.dbl();return e}var n=this.curve.a,i=this.curve.tinv,o=this.x,a=this.y,s=this.z,u=s.redSqr().redSqr(),c=a.redAdd(a);for(r=0;r<t;r++){var l=o.redSqr(),h=(d=c.redSqr()).redSqr(),f=l.redAdd(l).redIAdd(l).redIAdd(n.redMul(u)),d=(l=o.redMul(d),f.redSqr().redISub(l.redAdd(l)));l=l.redISub(d),f=(f=f.redMul(l)).redIAdd(f).redISub(h),l=c.redMul(s),r+1<t&&(u=u.redMul(h)),o=d,s=l,c=f}return this.curve.jpoint(o,c.redMul(i),s)},l.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},l.prototype._zeroDbl=function(){var t,e,r,n,i,o=this.zOne?(r=this.x.redSqr(),t=(n=this.y.redSqr()).redSqr(),i=(i=this.x.redAdd(n).redSqr().redISub(r).redISub(t)).redIAdd(i),n=(e=r.redAdd(r).redIAdd(r)).redSqr().redISub(i).redISub(i),r=(r=(r=t.redIAdd(t)).redIAdd(r)).redIAdd(r),e=e.redMul(i.redISub(t=n)).redISub(r),this.y.redAdd(this.y)):(i=this.x.redSqr(),o=(n=this.y.redSqr()).redSqr(),r=(r=this.x.redAdd(n).redSqr().redISub(i).redISub(o)).redIAdd(r),i=(n=i.redAdd(i).redIAdd(i)).redSqr(),o=(o=(o=o.redIAdd(o)).redIAdd(o)).redIAdd(o),t=i.redISub(r).redISub(r),e=n.redMul(r.redISub(t)).redISub(o),(o=this.y.redMul(this.z)).redIAdd(o));return this.curve.jpoint(t,e,o)},l.prototype._threeDbl=function(){var t,e,r,n,i,o,a,s;return this.zOne?(a=this.x.redSqr(),r=(t=this.y.redSqr()).redSqr(),o=(o=this.x.redAdd(t).redSqr().redISub(a).redISub(r)).redIAdd(o),e=n=(s=a.redAdd(a).redIAdd(a).redIAdd(this.curve.a)).redSqr().redISub(o).redISub(o),i=(i=(i=r.redIAdd(r)).redIAdd(i)).redIAdd(i),t=s.redMul(o.redISub(n)).redISub(i),a=this.y.redAdd(this.y)):(r=this.z.redSqr(),s=this.y.redSqr(),o=this.x.redMul(s),n=(n=this.x.redSub(r).redMul(this.x.redAdd(r))).redAdd(n).redIAdd(n),o=(i=(i=o.redIAdd(o)).redIAdd(i)).redAdd(i),e=n.redSqr().redISub(o),a=this.y.redAdd(this.z).redSqr().redISub(s).redISub(r),s=(s=(s=(s=s.redSqr()).redIAdd(s)).redIAdd(s)).redIAdd(s),t=n.redMul(i.redISub(e)).redISub(s)),this.curve.jpoint(e,t,a)},l.prototype._dbl=function(){var t=this.curve.a,e=this.x,r=this.y,n=this.z,i=n.redSqr().redSqr(),o=e.redSqr(),a=r.redSqr();return t=o.redAdd(o).redIAdd(o).redIAdd(t.redMul(i)),e=(i=(i=e.redAdd(e)).redIAdd(i)).redMul(a),i=t.redSqr().redISub(e.redAdd(e)),e=e.redISub(i),a=(a=(a=(a=a.redSqr()).redIAdd(a)).redIAdd(a)).redIAdd(a),a=t.redMul(e).redISub(a),n=r.redAdd(r).redMul(n),this.curve.jpoint(i,a,n)},l.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr(),n=e.redSqr(),i=t.redAdd(t).redIAdd(t),o=i.redSqr(),a=this.x.redAdd(e).redSqr().redISub(t).redISub(n);return t=(a=(a=(a=a.redIAdd(a)).redAdd(a).redIAdd(a)).redISub(o)).redSqr(),n=(n=(n=(n=n.redIAdd(n)).redIAdd(n)).redIAdd(n)).redIAdd(n),o=i.redIAdd(a).redSqr().redISub(o).redISub(t).redISub(n),e=(e=(e=e.redMul(o)).redIAdd(e)).redIAdd(e),e=(e=(e=this.x.redMul(t).redISub(e)).redIAdd(e)).redIAdd(e),o=(o=(o=(o=this.y.redMul(o.redMul(n.redISub(o)).redISub(a.redMul(t)))).redIAdd(o)).redIAdd(o)).redIAdd(o),t=this.z.redAdd(a).redSqr().redISub(r).redISub(t),this.curve.jpoint(e,o,t)},l.prototype.mul=function(t,e){return t=new i(t,e),this.curve._wnafMul(this,t)},l.prototype.eq=function(t){if("affine"===t.type)return this.eq(t.toJ());if(this===t)return!0;var e=this.z.redSqr(),r=t.z.redSqr();return 0===this.x.redMul(r).redISub(t.x.redMul(e)).cmpn(0)&&(e=e.redMul(this.z),r=r.redMul(t.z),0===this.y.redMul(r).redISub(t.y.redMul(e)).cmpn(0))},l.prototype.eqXToP=function(t){var e=this.z.redSqr(),r=t.toRed(this.curve.red).redMul(e);if(0===this.x.cmp(r))return!0;for(var n=t.clone(),i=this.curve.redN.redMul(e);;){if(n.iadd(this.curve.n),0<=n.cmp(this.curve.p))return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},l.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},l.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../utils":24,"./base":13,"bn.js":9,inherits:39}],18:[function(t,e,r){"use strict";var n,i=r,o=(r=t("hash.js"),t("./curve")),a=t("./utils").assert;function s(t){"short"===t.type?this.curve=new o.short(t):"edwards"===t.type?this.curve=new o.edwards(t):this.curve=new o.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function u(t,e){Object.defineProperty(i,t,{configurable:!0,enumerable:!0,get:function(){var r=new s(e);return Object.defineProperty(i,t,{configurable:!0,enumerable:!0,value:r}),r}})}i.PresetCurve=s,u("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),u("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),u("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),u("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:r.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),u("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:r.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),u("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),u("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=t("./precomputed/secp256k1")}catch(t){n=void 0}u("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})},{"./curve":15,"./precomputed/secp256k1":23,"./utils":24,"hash.js":26}],19:[function(t,e,r){"use strict";var n=t("bn.js"),i=t("hmac-drbg"),o=t("../utils"),a=t("../curves"),u=t("brorand"),c=o.assert,l=t("./key"),h=t("./signature");function f(t){if(!(this instanceof f))return new f(t);"string"==typeof t&&(c(Object.prototype.hasOwnProperty.call(a,t),"Unknown curve "+t),t=a[t]),t instanceof a.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}(e.exports=f).prototype.keyPair=function(t){return new l(this,t)},f.prototype.keyFromPrivate=function(t,e){return l.fromPrivate(this,t,e)},f.prototype.keyFromPublic=function(t,e){return l.fromPublic(this,t,e)},f.prototype.genKeyPair=function(t){for(var e=new i({hash:this.hash,pers:(t=t||{}).pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||u(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),o=this.n.sub(new n(2));;){var a=new n(e.generate(r));if(!(0<a.cmp(o)))return a.iaddn(1),this.keyFromPrivate(a)}},f.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return 0<r&&(t=t.ushrn(r)),!e&&0<=t.cmp(this.n)?t.sub(this.n):t},f.prototype.sign=function(t,e,r,o){"object"==s(r)&&(o=r,r=null),o=o||{},e=this.keyFromPrivate(e,r),t=this._truncateToN(new n(t,16));for(var a=this.n.byteLength(),u=(r=e.getPrivate().toArray("be",a),a=t.toArray("be",a),new i({hash:this.hash,entropy:r,nonce:a,pers:o.pers,persEnc:o.persEnc||"utf8"})),c=this.n.sub(new n(1)),l=0;;l++){var f=o.k?o.k(l):new n(u.generate(this.n.byteLength()));if(!((f=this._truncateToN(f,!0)).cmpn(1)<=0||0<=f.cmp(c))){var d=this.g.mul(f);if(!d.isInfinity()){var p=d.getX(),m=p.umod(this.n);if(0!==m.cmpn(0)&&0!==(f=(f=f.invm(this.n).mul(m.mul(e.getPrivate()).iadd(t))).umod(this.n)).cmpn(0))return p=(d.getY().isOdd()?1:0)|(0!==p.cmp(m)?2:0),o.canonical&&0<f.cmp(this.nh)&&(f=this.n.sub(f),p^=1),new h({r:m,s:f,recoveryParam:p})}}}},f.prototype.verify=function(t,e,r,i){return t=this._truncateToN(new n(t,16)),r=this.keyFromPublic(r,i),i=(e=new h(e,"hex")).r,e=e.s,!(i.cmpn(1)<0||0<=i.cmp(this.n))&&(!(e.cmpn(1)<0||0<=e.cmp(this.n))&&(t=(e=e.invm(this.n)).mul(t).umod(this.n),e=e.mul(i).umod(this.n),this.curve._maxwellTrick?!(o=this.g.jmulAdd(t,r.getPublic(),e)).isInfinity()&&o.eqXToP(i):!(o=this.g.mulAdd(t,r.getPublic(),e)).isInfinity()&&0===o.getX().umod(this.n).cmp(i)));var o},f.prototype.recoverPubKey=function(t,e,r,i){c((3&r)===r,"The recovery param is more than two bits"),e=new h(e,i);var o=this.n,a=new n(t),s=e.r;if(i=e.s,t=1&r,r>>=1,0<=s.cmp(this.curve.p.umod(this.curve.n))&&r)throw new Error("Unable to find sencond key candinate");return s=r?this.curve.pointFromX(s.add(this.curve.n),t):this.curve.pointFromX(s,t),e=e.r.invm(o),a=o.sub(a).mul(e).umod(o),o=i.mul(e).umod(o),this.g.mulAdd(a,s,o)},f.prototype.getKeyRecoveryParam=function(t,e,r,n){if(null!==(e=new h(e,n)).recoveryParam)return e.recoveryParam;for(var i,o=0;o<4;o++){try{i=this.recoverPubKey(t,e,o)}catch(t){continue}if(i.eq(r))return o}throw new Error("Unable to find valid recovery factor")}},{"../curves":18,"../utils":24,"./key":20,"./signature":21,"bn.js":9,brorand:10,"hmac-drbg":38}],20:[function(t,e,r){"use strict";var n=t("bn.js"),i=t("../utils").assert;function o(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}(e.exports=o).fromPublic=function(t,e,r){return e instanceof o?e:new o(t,{pub:e,pubEnc:r})},o.fromPrivate=function(t,e,r){return e instanceof o?e:new o(t,{priv:e,privEnc:r})},o.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(t,e){return"string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},o.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(t,e){this.priv=new n(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?i(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},o.prototype.derive=function(t){return t.validate()||i(t.validate(),"public point not validated"),t.mul(this.priv).getX()},o.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},o.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},o.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}},{"../utils":24,"bn.js":9}],21:[function(t,e,r){"use strict";var n=t("bn.js"),i=t("../utils"),o=i.assert;function a(t,e){if(t instanceof a)return t;this._importDER(t,e)||(o(t.r&&t.s,"Signature without r or s"),this.r=new n(t.r,16),this.s=new n(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function s(){this.place=0}function u(t,e){var r=t[e.place++];if(!(128&r))return r;var n=15&r;if(0==n||4<n)return!1;for(var i=0,o=0,a=e.place;o<n;o++,a++)i<<=8,i|=t[a],i>>>=0;return!(i<=127)&&(e.place=a,i)}function c(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e<r;)e++;return 0===e?t:t.slice(e)}function l(t,e){if(e<128)t.push(e);else{var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}(e.exports=a).prototype._importDER=function(t,e){t=i.toArray(t,e);var r=new s;if(48!==t[r.place++])return!1;var o=u(t,r);if(!1===o)return!1;if(o+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;if(!1===(e=u(t,r)))return!1;if(o=t.slice(r.place,e+r.place),r.place+=e,2!==t[r.place++])return!1;if(!1===(e=u(t,r)))return!1;if(t.length!==e+r.place)return!1;if(r=t.slice(r.place,e+r.place),0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===r[0]){if(!(128&r[1]))return!1;r=r.slice(1)}return this.r=new n(o),this.s=new n(r),!(this.recoveryParam=null)},a.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=c(e),r=c(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];return l(n,e.length),(n=n.concat(e)).push(2),l(n,r.length),e=n.concat(r),l(n=[48],e.length),n=n.concat(e),i.encode(n,t)}},{"../utils":24,"bn.js":9}],22:[function(t,e,r){arguments[4][14][0].apply(r,arguments)},{dup:14}],23:[function(t,e,r){e.exports=void 0},{}],24:[function(t,e,r){"use strict";var n=r,i=t("bn.js");r=t("minimalistic-assert"),t=t("minimalistic-crypto-utils"),n.assert=r,n.toArray=t.toArray,n.zero2=t.zero2,n.toHex=t.toHex,n.encode=t.encode,n.getNAF=function(t,e,r){var n=new Array(Math.max(t.bitLength(),r)+1);n.fill(0);for(var i=1<<e+1,o=t.clone(),a=0;a<n.length;a++){var s,u=o.andln(i-1);o.isOdd()?o.isubn(s=(i>>1)-1<u?(i>>1)-u:u):s=0,n[a]=s,o.iushrn(1)}return n},n.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n,i=0,o=0;0<t.cmpn(-i)||0<e.cmpn(-o);){var a,s=t.andln(3)+i&3,u=e.andln(3)+o&3;3===u&&(u=-1),a=0==(1&(s=3===s?-1:s))?0:3!=(n=t.andln(7)+i&7)&&5!==n||2!==u?s:-s,r[0].push(a),u=0==(1&u)?0:3!=(n=e.andln(7)+o&7)&&5!==n||2!==s?u:-u,r[1].push(u),2*i===a+1&&(i=1-i),2*o===u+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return r},n.cachedProperty=function(t,e,r){var n="_"+e;t.prototype[e]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},n.parseBytes=function(t){return"string"==typeof t?n.toArray(t,"hex"):t},n.intFromLE=function(t){return new i(t,"hex","le")}},{"bn.js":9,"minimalistic-assert":41,"minimalistic-crypto-utils":42}],25:[function(t,e,r){e.exports={version:"6.5.4"}},{}],26:[function(t,e,r){r.utils=t("./hash/utils"),r.common=t("./hash/common"),r.sha=t("./hash/sha"),r.ripemd=t("./hash/ripemd"),r.hmac=t("./hash/hmac"),r.sha1=r.sha.sha1,r.sha256=r.sha.sha256,r.sha224=r.sha.sha224,r.sha384=r.sha.sha384,r.sha512=r.sha.sha512,r.ripemd160=r.ripemd.ripemd160},{"./hash/common":27,"./hash/hmac":28,"./hash/ripemd":29,"./hash/sha":30,"./hash/utils":37}],27:[function(t,e,r){"use strict";var n=t("./utils"),i=t("minimalistic-assert");function o(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}(r.BlockHash=o).prototype.update=function(t,e){if(t=n.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){e=(t=this.pending).length%this._delta8,this.pending=t.slice(t.length-e,t.length),0===this.pending.length&&(this.pending=null),t=n.join32(t,0,t.length-e,this.endian);for(var r=0;r<t.length;r+=this._delta32)this._update(t,r,r+this._delta32)}return this},o.prototype.digest=function(t){return this.update(this._pad()),i(null===this.pending),this._digest(t)},o.prototype._pad=function(){var t=this.pendingTotal,e=this._delta8,r=e-(t+this.padLength)%e,n=new Array(r+this.padLength);n[0]=128;for(var i=1;i<r;i++)n[i]=0;if(t<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)n[i++]=0;n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=t>>>24&255,n[i++]=t>>>16&255,n[i++]=t>>>8&255,n[i++]=255&t}else for(n[i++]=255&t,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;o<this.padLength;o++)n[i++]=0;return n}},{"./utils":37,"minimalistic-assert":41}],28:[function(t,e,r){"use strict";var n=t("./utils"),i=t("minimalistic-assert");function o(t,e,r){if(!(this instanceof o))return new o(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(n.toArray(e,r))}(e.exports=o).prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),i(t.length<=this.blockSize);for(var e=t.length;e<this.blockSize;e++)t.push(0);for(e=0;e<t.length;e++)t[e]^=54;for(this.inner=(new this.Hash).update(t),e=0;e<t.length;e++)t[e]^=106;this.outer=(new this.Hash).update(t)},o.prototype.update=function(t,e){return this.inner.update(t,e),this},o.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)}},{"./utils":37,"minimalistic-assert":41}],29:[function(t,e,r){"use strict";var n=t("./utils"),i=(t=t("./common"),n.rotl32),o=n.sum32,a=n.sum32_3,s=n.sum32_4,u=t.BlockHash;function c(){if(!(this instanceof c))return new c;u.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function l(t,e,r,n){return t<=15?e^r^n:t<=31?e&r|~e&n:t<=47?(e|~r)^n:t<=63?e&n|r&~n:e^(r|~n)}n.inherits(c,u),(r.ripemd160=c).blockSize=512,c.outSize=160,c.hmacStrength=192,c.padLength=64,c.prototype._update=function(t,e){for(var r,n=b=this.h[0],u=x=this.h[1],c=k=this.h[2],m=_=this.h[3],y=w=this.h[4],g=0;g<80;g++){var v=o(i(s(b,l(g,x,k,_),t[h[g]+e],(r=g)<=15?0:r<=31?1518500249:r<=47?1859775393:r<=63?2400959708:2840853838),d[g]),w),b=w,w=_,_=i(k,10),k=x,x=v;v=o(i(s(n,l(79-g,u,c,m),t[f[g]+e],(r=g)<=15?1352829926:r<=31?1548603684:r<=47?1836072691:r<=63?2053994217:0),p[g]),y),n=y,y=m,m=i(c,10),c=u,u=v}v=a(this.h[1],k,m),this.h[1]=a(this.h[2],_,y),this.h[2]=a(this.h[3],w,n),this.h[3]=a(this.h[4],b,u),this.h[4]=a(this.h[0],x,c),this.h[0]=v},c.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"little"):n.split32(this.h,"little")};var h=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],f=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],d=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],p=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},{"./common":27,"./utils":37}],30:[function(t,e,r){"use strict";r.sha1=t("./sha/1"),r.sha224=t("./sha/224"),r.sha256=t("./sha/256"),r.sha384=t("./sha/384"),r.sha512=t("./sha/512")},{"./sha/1":31,"./sha/224":32,"./sha/256":33,"./sha/384":34,"./sha/512":35}],31:[function(t,e,r){arguments[4][14][0].apply(r,arguments)},{dup:14}],32:[function(t,e,r){arguments[4][14][0].apply(r,arguments)},{dup:14}],33:[function(t,e,r){"use strict";var n=t("../utils"),i=t("../common"),o=t("./common"),a=t("minimalistic-assert"),s=n.sum32,u=n.sum32_4,c=n.sum32_5,l=o.ch32,h=o.maj32,f=o.s0_256,d=o.s1_256,p=o.g0_256,m=o.g1_256,y=i.BlockHash,g=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function v(){if(!(this instanceof v))return new v;y.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=g,this.W=new Array(64)}n.inherits(v,y),(e.exports=v).blockSize=512,v.outSize=256,v.hmacStrength=192,v.padLength=64,v.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;n<r.length;n++)r[n]=u(m(r[n-2]),r[n-7],p(r[n-15]),r[n-16]);var i=this.h[0],o=this.h[1],y=this.h[2],g=this.h[3],v=this.h[4],b=this.h[5],w=this.h[6],_=this.h[7];for(a(this.k.length===r.length),n=0;n<r.length;n++){var k=c(_,d(v),l(v,b,w),this.k[n],r[n]),x=s(f(i),h(i,o,y));_=w,w=b,b=v,v=s(g,k),g=y,y=o,o=i,i=s(k,x)}this.h[0]=s(this.h[0],i),this.h[1]=s(this.h[1],o),this.h[2]=s(this.h[2],y),this.h[3]=s(this.h[3],g),this.h[4]=s(this.h[4],v),this.h[5]=s(this.h[5],b),this.h[6]=s(this.h[6],w),this.h[7]=s(this.h[7],_)},v.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},{"../common":27,"../utils":37,"./common":36,"minimalistic-assert":41}],34:[function(t,e,r){arguments[4][14][0].apply(r,arguments)},{dup:14}],35:[function(t,e,r){"use strict";var n=t("../utils"),i=t("../common"),o=t("minimalistic-assert"),a=n.rotr64_hi,s=n.rotr64_lo,u=n.shr64_hi,c=n.shr64_lo,l=n.sum64,h=n.sum64_hi,f=n.sum64_lo,d=n.sum64_4_hi,p=n.sum64_4_lo,m=n.sum64_5_hi,y=n.sum64_5_lo,g=i.BlockHash,v=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function b(){if(!(this instanceof b))return new b;g.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=v,this.W=new Array(160)}n.inherits(b,g),(e.exports=b).blockSize=1024,b.outSize=512,b.hmacStrength=192,b.padLength=128,b.prototype._prepareBlock=function(t,e){for(var r=this.W,n=0;n<32;n++)r[n]=t[e+n];for(;n<r.length;n+=2){var i=function(t,e){return(e=a(t,e,19)^a(e,t,29)^(e=u(t,e,6)))<0&&(e+=4294967296),e}(r[n-4],r[n-3]),o=function(t,e){return(e=s(t,e,19)^s(e,t,29)^(e=c(t,e,6)))<0&&(e+=4294967296),e}(r[n-4],r[n-3]),l=r[n-14],h=r[n-13],f=function(t,e){return(e=a(t,e,1)^a(t,e,8)^(e=u(t,e,7)))<0&&(e+=4294967296),e}(r[n-30],r[n-29]),m=function(t,e){return(e=s(t,e,1)^s(t,e,8)^(e=c(t,e,7)))<0&&(e+=4294967296),e}(r[n-30],r[n-29]),y=r[n-32],g=r[n-31];r[n]=d(i,o,l,h,f,m,y,g),r[n+1]=p(i,o,l,h,f,m,y,g)}},b.prototype._update=function(t,e){this._prepareBlock(t,e);var r=this.W,n=this.h[0],i=this.h[1],u=this.h[2],c=this.h[3],d=this.h[4],p=this.h[5],g=this.h[6],v=this.h[7],b=this.h[8],w=this.h[9],_=this.h[10],k=this.h[11],x=this.h[12],A=this.h[13],E=this.h[14],S=this.h[15];o(this.k.length===r.length);for(var I=0;I<r.length;I+=2){var M=E,T=S,P=function(t,e){return(t=a(t,e,14)^a(t,e,18)^(t=a(e,t,9)))<0&&(t+=4294967296),t}(b,w),C=function(t,e){return(t=s(t,e,14)^s(t,e,18)^(t=s(e,t,9)))<0&&(t+=4294967296),t}(b,w),O=function(t,e,r){return(r=t&e^~t&r)<0&&(r+=4294967296),r}(b,_,x),R=function(t,e,r){return(r=t&e^~t&r)<0&&(r+=4294967296),r}(w,k,A),N=this.k[I],j=this.k[I+1],L=r[I],U=r[I+1],D=m(M,T,P,C,O,R,N,j,L,U);L=y(M,T,P,C,O,R,N,j,L,U),M=function(t,e){return(t=a(t,e,28)^a(e,t,2)^(t=a(e,t,7)))<0&&(t+=4294967296),t}(n,i),T=function(t,e){return(t=s(t,e,28)^s(e,t,2)^(t=s(e,t,7)))<0&&(t+=4294967296),t}(n,i),P=function(t,e,r){return(r=t&e^t&r^e&r)<0&&(r+=4294967296),r}(n,u,d),C=function(t,e,r){return(r=t&e^t&r^e&r)<0&&(r+=4294967296),r}(i,c,p),U=h(M,T,P,C),C=f(M,T,P,C),E=x,S=A,x=_,A=k,_=b,k=w,b=h(g,v,D,L),w=f(v,v,D,L),g=d,v=p,d=u,p=c,u=n,c=i,n=h(D,L,U,C),i=f(D,L,U,C)}l(this.h,0,n,i),l(this.h,2,u,c),l(this.h,4,d,p),l(this.h,6,g,v),l(this.h,8,b,w),l(this.h,10,_,k),l(this.h,12,x,A),l(this.h,14,E,S)},b.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},{"../common":27,"../utils":37,"minimalistic-assert":41}],36:[function(t,e,r){"use strict";var n=t("../utils").rotr32;function i(t,e,r){return t&e^~t&r}function o(t,e,r){return t&e^t&r^e&r}r.ft_1=function(t,e,r,n){return 0===t?i(e,r,n):1===t||3===t?e^r^n:2===t?o(e,r,n):void 0},r.ch32=i,r.maj32=o,r.p32=function(t,e,r){return t^e^r},r.s0_256=function(t){return n(t,2)^n(t,13)^n(t,22)},r.s1_256=function(t){return n(t,6)^n(t,11)^n(t,25)},r.g0_256=function(t){return n(t,7)^n(t,18)^t>>>3},r.g1_256=function(t){return n(t,17)^n(t,19)^t>>>10}},{"../utils":37}],37:[function(t,e,r){"use strict";var n=t("minimalistic-assert");function i(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function o(t){return 1===t.length?"0"+t:t}function a(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}t=t("inherits"),r.inherits=t,r.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),n=0;n<t.length;n+=2)r.push(parseInt(t[n]+t[n+1],16))}else for(var n=0;n<t.length;n++){var i=(o=t.charCodeAt(n))>>8,o=255&o;i?r.push(i,o):r.push(o)}else for(n=0;n<t.length;n++)r[n]=0|t[n];return r},r.toHex=function(t){for(var e="",r=0;r<t.length;r++)e+=o(t[r].toString(16));return e},r.htonl=i,r.toHex32=function(t,e){for(var r="",n=0;n<t.length;n++){var o=t[n];r+=a((o="little"===e?i(o):o).toString(16))}return r},r.zero2=o,r.zero8=a,r.join32=function(t,e,r,i){n((r-=e)%4==0);for(var o=new Array(r/4),a=0,s=e;a<o.length;a++,s+=4){var u="big"===i?t[s]<<24|t[s+1]<<16|t[s+2]<<8|t[s+3]:t[s+3]<<24|t[s+2]<<16|t[s+1]<<8|t[s];o[a]=u>>>0}return o},r.split32=function(t,e){for(var r=new Array(4*t.length),n=0,i=0;n<t.length;n++,i+=4){var o=t[n];"big"===e?(r[i]=o>>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},r.rotr32=function(t,e){return t>>>e|t<<32-e},r.rotl32=function(t,e){return t<<e|t>>>32-e},r.sum32=function(t,e){return t+e>>>0},r.sum32_3=function(t,e,r){return t+e+r>>>0},r.sum32_4=function(t,e,r,n){return t+e+r+n>>>0},r.sum32_5=function(t,e,r,n,i){return t+e+r+n+i>>>0},r.sum64=function(t,e,r,n){var i=t[e],o=n+t[e+1]>>>0;t[e]=(o<n?1:0)+r+i>>>0,t[e+1]=o},r.sum64_hi=function(t,e,r,n){return(e+n>>>0<e?1:0)+t+r>>>0},r.sum64_lo=function(t,e,r,n){return e+n>>>0},r.sum64_4_hi=function(t,e,r,n,i,o,a,s){var u=0,c=e;return u+=(c=e+n>>>0)<e?1:0,u+=(c=c+o>>>0)<o?1:0,t+r+i+a+(u+=(c=c+s>>>0)<s?1:0)>>>0},r.sum64_4_lo=function(t,e,r,n,i,o,a,s){return e+n+o+s>>>0},r.sum64_5_hi=function(t,e,r,n,i,o,a,s,u,c){var l=0,h=e;return l+=(h=e+n>>>0)<e?1:0,l+=(h=h+o>>>0)<o?1:0,l+=(h=h+s>>>0)<s?1:0,t+r+i+a+u+(l+=(h=h+c>>>0)<c?1:0)>>>0},r.sum64_5_lo=function(t,e,r,n,i,o,a,s,u,c){return e+n+o+s+c>>>0},r.rotr64_hi=function(t,e,r){return(e<<32-r|t>>>r)>>>0},r.rotr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0},r.shr64_hi=function(t,e,r){return t>>>r},r.shr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0}},{inherits:39,"minimalistic-assert":41}],38:[function(t,e,r){"use strict";var n=t("hash.js"),i=t("minimalistic-crypto-utils"),o=t("minimalistic-assert");function a(t){if(!(this instanceof a))return new a(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=i.toArray(t.entropy,t.entropyEnc||"hex"),r=i.toArray(t.nonce,t.nonceEnc||"hex");t=i.toArray(t.pers,t.persEnc||"hex"),o(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,t)}(e.exports=a).prototype._init=function(t,e,r){r=t.concat(e).concat(r),this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var n=0;n<this.V.length;n++)this.K[n]=0,this.V[n]=1;this._update(r),this._reseed=1,this.reseedInterval=281474976710656},a.prototype._hmac=function(){return new n.hmac(this.hash,this.K)},a.prototype._update=function(t){var e=this._hmac().update(this.V).update([0]);t&&(e=e.update(t)),this.K=e.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},a.prototype.reseed=function(t,e,r,n){"string"!=typeof e&&(n=r,r=e,e=null),t=i.toArray(t,e),r=i.toArray(r,n),o(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},a.prototype.generate=function(t,e,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(n=r,r=e,e=null),r&&(r=i.toArray(r,n||"hex"),this._update(r));for(var o=[];o.length<t;)this.V=this._hmac().update(this.V).digest(),o=o.concat(this.V);return n=o.slice(0,t),this._update(r),this._reseed++,i.encode(n,e)}},{"hash.js":26,"minimalistic-assert":41,"minimalistic-crypto-utils":42}],39:[function(t,e,r){"function"==typeof Object.create?e.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(t,e){var r;e&&(t.super_=e,(r=function(){}).prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t)}},{}],40:[function(t,e,n){(function(t,r){(function(){!function(){"use strict";for(var n="object"==("undefined"==typeof window?"undefined":s(window))?window:{},i=!(n=!n.JS_SHA3_NO_NODE_JS&&"object"==s(t)&&t.versions&&t.versions.node?r:n).JS_SHA3_NO_COMMON_JS&&"object"==s(e)&&e.exports,o="0123456789abcdef".split(""),a=[0,8,16,24],u=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],c=[224,256,384,512],l=["hex","buffer","arrayBuffer","array"],h=function(t,e,r){return function(n){return new k(t,e,t).update(n)[r]()}},f=function(t,e,r){return function(n,i){return new k(t,e,i).update(n)[r]()}},d=function(t,e){var r=h(t,e,"hex");r.create=function(){return new k(t,e,t)},r.update=function(t){return r.create().update(t)};for(var n=0;n<l.length;++n){var i=l[n];r[i]=h(t,e,i)}return r},p=[{name:"keccak",padding:[1,256,65536,16777216],bits:c,createMethod:d},{name:"sha3",padding:[6,1536,393216,100663296],bits:c,createMethod:d},{name:"shake",padding:[31,7936,2031616,520093696],bits:[128,256],createMethod:function(t,e){var r=f(t,e,"hex");r.create=function(r){return new k(t,e,r)},r.update=function(t,e){return r.create(e).update(t)};for(var n=0;n<l.length;++n){var i=l[n];r[i]=f(t,e,i)}return r}}],m={},y=[],g=0;g<p.length;++g)for(var v=p[g],b=v.bits,w=0;w<b.length;++w){var _=v.name+"_"+b[w];y.push(_),m[_]=v.createMethod(b[w],v.padding)}function k(t,e,r){this.blocks=[],this.s=[],this.padding=e,this.outputBits=r,this.reset=!0,this.block=0,this.start=0,this.blockCount=1600-(t<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}k.prototype.update=function(t){for(var e,r,n="string"!=typeof t,i=(t=n&&t.constructor===ArrayBuffer?new Uint8Array(t):t).length,o=this.blocks,s=this.byteCount,u=this.blockCount,c=0,l=this.s;c<i;){if(this.reset)for(this.reset=!1,o[0]=this.block,e=1;e<u+1;++e)o[e]=0;if(n)for(e=this.start;c<i&&e<s;++c)o[e>>2]|=t[c]<<a[3&e++];else for(e=this.start;c<i&&e<s;++c)(r=t.charCodeAt(c))<128?o[e>>2]|=r<<a[3&e++]:(r<2048?o[e>>2]|=(192|r>>6)<<a[3&e++]:(r<55296||57344<=r?o[e>>2]|=(224|r>>12)<<a[3&e++]:(r=65536+((1023&r)<<10|1023&t.charCodeAt(++c)),o[e>>2]|=(240|r>>18)<<a[3&e++],o[e>>2]|=(128|r>>12&63)<<a[3&e++]),o[e>>2]|=(128|r>>6&63)<<a[3&e++]),o[e>>2]|=(128|63&r)<<a[3&e++]);if(s<=(this.lastByteIndex=e)){for(this.start=e-s,this.block=o[u],e=0;e<u;++e)l[e]^=o[e];x(l),this.reset=!0}else this.start=e}return this},k.prototype.finalize=function(){var t=this.blocks,e=this.lastByteIndex,r=this.blockCount,n=this.s;if(t[e>>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[r],e=1;e<r+1;++e)t[e]=0;for(t[r-1]|=2147483648,e=0;e<r;++e)n[e]^=t[e];x(n)},k.prototype.toString=k.prototype.hex=function(){this.finalize();for(var t,e=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,a=0,s=0,u="";s<n;){for(a=0;a<e&&s<n;++a,++s)t=r[a],u+=o[t>>4&15]+o[15&t]+o[t>>12&15]+o[t>>8&15]+o[t>>20&15]+o[t>>16&15]+o[t>>28&15]+o[t>>24&15];s%e==0&&(x(r),a=0)}return i&&(t=r[a],0<i&&(u+=o[t>>4&15]+o[15&t]),1<i&&(u+=o[t>>12&15]+o[t>>8&15]),2<i&&(u+=o[t>>20&15]+o[t>>16&15])),u},k.prototype.arrayBuffer=function(){this.finalize();for(var t=this.blockCount,e=this.s,r=this.outputBlocks,n=this.extraBytes,i=0,o=0,a=this.outputBits>>3,s=n?new ArrayBuffer(r+1<<2):new ArrayBuffer(a),u=new Uint32Array(s);o<r;){for(i=0;i<t&&o<r;++i,++o)u[o]=e[i];o%t==0&&x(e)}return n&&(u[i]=e[i],s=s.slice(0,a)),s},k.prototype.buffer=k.prototype.arrayBuffer,k.prototype.digest=k.prototype.array=function(){this.finalize();for(var t,e,r=this.blockCount,n=this.s,i=this.outputBlocks,o=this.extraBytes,a=0,s=0,u=[];s<i;){for(a=0;a<r&&s<i;++a,++s)e=n[a],u[t=s<<2]=255&e,u[t+1]=e>>8&255,u[t+2]=e>>16&255,u[t+3]=e>>24&255;s%r==0&&x(n)}return o&&(t=s<<2,e=n[a],0<o&&(u[t]=255&e),1<o&&(u[t+1]=e>>8&255),2<o&&(u[t+2]=e>>16&255)),u};var x=function(t){for(var e,r,n,i,o,a,s,c,l,h,f,d,p,m,y,g,v,b,w,_,k,x,A,E,S,I,M,T,P,C,O,R,N,j,L,U,D,B,z,F,H,q,G,V,K,Z,W,J,Q,$,Y=0;Y<48;Y+=2)M=t[0]^t[10]^t[20]^t[30]^t[40],T=t[1]^t[11]^t[21]^t[31]^t[41],F=t[2]^t[12]^t[22]^t[32]^t[42],z=t[3]^t[13]^t[23]^t[33]^t[43],R=t[4]^t[14]^t[24]^t[34]^t[44],O=t[5]^t[15]^t[25]^t[35]^t[45],Z=t[6]^t[16]^t[26]^t[36]^t[46],K=t[7]^t[17]^t[27]^t[37]^t[47],p=t[8]^t[18]^t[28]^t[38]^t[48],h=(m=t[9]^t[19]^t[29]^t[39]^t[49])^(z<<1|F>>>31),t[0]^=l=p^(F<<1|z>>>31),t[1]^=h,t[10]^=l,t[11]^=h,t[20]^=l,t[21]^=h,t[30]^=l,t[31]^=h,t[40]^=l,t[41]^=h,h=T^(O<<1|R>>>31),t[2]^=l=M^(R<<1|O>>>31),t[3]^=h,t[12]^=l,t[13]^=h,t[22]^=l,t[23]^=h,t[32]^=l,t[33]^=h,t[42]^=l,t[43]^=h,h=z^(K<<1|Z>>>31),t[4]^=l=F^(Z<<1|K>>>31),t[5]^=h,t[14]^=l,t[15]^=h,t[24]^=l,t[25]^=h,t[34]^=l,t[35]^=h,t[44]^=l,t[45]^=h,h=O^(m<<1|p>>>31),t[6]^=l=R^(p<<1|m>>>31),t[7]^=h,t[16]^=l,t[17]^=h,t[26]^=l,t[27]^=h,t[36]^=l,t[37]^=h,t[46]^=l,t[47]^=h,h=K^(T<<1|M>>>31),t[8]^=l=Z^(M<<1|T>>>31),t[9]^=h,t[18]^=l,t[19]^=h,t[28]^=l,t[29]^=h,t[38]^=l,t[39]^=h,t[48]^=l,t[49]^=h,e=t[0],r=t[1],N=t[11]<<4|t[10]>>>28,j=t[10]<<4|t[11]>>>28,y=t[20]<<3|t[21]>>>29,g=t[21]<<3|t[20]>>>29,W=t[31]<<9|t[30]>>>23,J=t[30]<<9|t[31]>>>23,P=t[40]<<18|t[41]>>>14,C=t[41]<<18|t[40]>>>14,k=t[2]<<1|t[3]>>>31,x=t[3]<<1|t[2]>>>31,n=t[13]<<12|t[12]>>>20,i=t[12]<<12|t[13]>>>20,L=t[22]<<10|t[23]>>>22,U=t[23]<<10|t[22]>>>22,v=t[33]<<13|t[32]>>>19,b=t[32]<<13|t[33]>>>19,Q=t[42]<<2|t[43]>>>30,$=t[43]<<2|t[42]>>>30,H=t[5]<<30|t[4]>>>2,q=t[4]<<30|t[5]>>>2,A=t[14]<<6|t[15]>>>26,E=t[15]<<6|t[14]>>>26,o=t[25]<<11|t[24]>>>21,a=t[24]<<11|t[25]>>>21,D=t[34]<<15|t[35]>>>17,B=t[35]<<15|t[34]>>>17,w=t[45]<<29|t[44]>>>3,_=t[44]<<29|t[45]>>>3,f=t[6]<<28|t[7]>>>4,d=t[7]<<28|t[6]>>>4,G=t[17]<<23|t[16]>>>9,V=t[16]<<23|t[17]>>>9,S=t[26]<<25|t[27]>>>7,I=t[27]<<25|t[26]>>>7,s=t[36]<<21|t[37]>>>11,c=t[37]<<21|t[36]>>>11,z=t[47]<<24|t[46]>>>8,F=t[46]<<24|t[47]>>>8,O=t[8]<<27|t[9]>>>5,R=t[9]<<27|t[8]>>>5,p=t[18]<<20|t[19]>>>12,m=t[19]<<20|t[18]>>>12,K=t[29]<<7|t[28]>>>25,Z=t[28]<<7|t[29]>>>25,M=t[38]<<8|t[39]>>>24,T=t[39]<<8|t[38]>>>24,l=t[48]<<14|t[49]>>>18,h=t[49]<<14|t[48]>>>18,t[0]=e^~n&o,t[1]=r^~i&a,t[10]=f^~p&y,t[11]=d^~m&g,t[20]=k^~A&S,t[21]=x^~E&I,t[30]=O^~N&L,t[31]=R^~j&U,t[40]=H^~G&K,t[41]=q^~V&Z,t[2]=n^~o&s,t[3]=i^~a&c,t[12]=p^~y&v,t[13]=m^~g&b,t[22]=A^~S&M,t[23]=E^~I&T,t[32]=N^~L&D,t[33]=j^~U&B,t[42]=G^~K&W,t[43]=V^~Z&J,t[4]=o^~s&l,t[5]=a^~c&h,t[14]=y^~v&w,t[15]=g^~b&_,t[24]=S^~M&P,t[25]=I^~T&C,t[34]=L^~D&z,t[35]=U^~B&F,t[44]=K^~W&Q,t[45]=Z^~J&$,t[6]=s^~l&e,t[7]=c^~h&r,t[16]=v^~w&f,t[17]=b^~_&d,t[26]=M^~P&k,t[27]=T^~C&x,t[36]=D^~z&O,t[37]=B^~F&R,t[46]=W^~Q&H,t[47]=J^~$&q,t[8]=l^~e&n,t[9]=h^~r&i,t[18]=w^~f&p,t[19]=_^~d&m,t[28]=P^~k&A,t[29]=C^~x&E,t[38]=z^~O&N,t[39]=F^~R&j,t[48]=Q^~H&G,t[49]=$^~q&V,t[0]^=u[Y],t[1]^=u[Y+1]};if(i)e.exports=m;else for(g=0;g<y.length;++g)n[y[g]]=m[y[g]]}()}).call(this)}).call(this,t("_process"),void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:43}],41:[function(t,e,r){(e.exports=function(t,e){if(!t)throw new Error(e||"Assertion failed")}).equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)}},{}],42:[function(t,e,r){"use strict";function n(t){return 1===t.length?"0"+t:t}function i(t){for(var e="",r=0;r<t.length;r++)e+=n(t[r].toString(16));return e}r.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"!=typeof t){for(var n=0;n<t.length;n++)r[n]=0|t[n];return r}if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),n=0;n<t.length;n+=2)r.push(parseInt(t[n]+t[n+1],16));else for(n=0;n<t.length;n++){var i=(o=t.charCodeAt(n))>>8,o=255&o;i?r.push(i,o):r.push(o)}return r},r.zero2=n,r.toHex=i,r.encode=function(t,e){return"hex"===e?i(t):t}},{}],43:[function(t,e,r){e.exports={browser:!0}},{}],44:[function(t,e,r){(function(t){(function(){"use strict";function n(t){var e=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],r=1779033703,n=3144134277,i=1013904242,o=2773480762,a=1359893119,s=2600822924,u=528734635,c=1541459225,l=new Array(64);function h(t){for(var h=0,f=t.length;64<=f;){for(var d,p,m,y,g=r,v=n,b=i,w=o,_=a,k=s,x=u,A=c,E=0;E<16;E++)l[E]=(255&t[p=h+4*E])<<24|(255&t[p+1])<<16|(255&t[p+2])<<8|255&t[p+3];for(E=16;E<64;E++)m=((d=l[E-2])>>>17|d<<15)^(d>>>19|d<<13)^d>>>10,d=l[E-15],l[E]=(m+l[E-7]|0)+((y=(d>>>7|d<<25)^(d>>>18|d<<14)^d>>>3)+l[E-16]|0)|0;for(E=0;E<64;E++)m=(((_>>>6|_<<26)^(_>>>11|_<<21)^(_>>>25|_<<7))+(_&k^~_&x)|0)+(A+(e[E]+l[E]|0)|0)|0,y=((g>>>2|g<<30)^(g>>>13|g<<19)^(g>>>22|g<<10))+(g&v^g&b^v&b)|0,A=x,x=k,k=_,_=w+m|0,w=b,b=v,v=g,g=m+y|0;r=r+g|0,n=n+v|0,i=i+b|0,o=o+w|0,a=a+_|0,s=s+k|0,u=u+x|0,c=c+A|0,h+=64,f-=64}}h(t);var f,d=t.length%64,p=t.length/536870912|0,m=t.length<<3,y=d<56?56:120,g=t.slice(t.length-d,t.length);for(g.push(128),f=1+d;f<y;f++)g.push(0);return g.push(p>>>24&255),g.push(p>>>16&255),g.push(p>>>8&255),g.push(p>>>0&255),g.push(m>>>24&255),g.push(m>>>16&255),g.push(m>>>8&255),g.push(m>>>0&255),h(g),[r>>>24&255,r>>>16&255,r>>>8&255,r>>>0&255,n>>>24&255,n>>>16&255,n>>>8&255,n>>>0&255,i>>>24&255,i>>>16&255,i>>>8&255,i>>>0&255,o>>>24&255,o>>>16&255,o>>>8&255,o>>>0&255,a>>>24&255,a>>>16&255,a>>>8&255,a>>>0&255,s>>>24&255,s>>>16&255,s>>>8&255,s>>>0&255,u>>>24&255,u>>>16&255,u>>>8&255,u>>>0&255,c>>>24&255,c>>>16&255,c>>>8&255,c>>>0&255]}function i(t,e,r){t=t.length<=64?t:n(t);for(var i=64+e.length+4,o=new Array(i),a=new Array(64),s=[],u=0;u<64;u++)o[u]=54;for(u=0;u<t.length;u++)o[u]^=t[u];for(u=0;u<e.length;u++)o[64+u]=e[u];for(u=i-4;u<i;u++)o[u]=0;for(u=0;u<64;u++)a[u]=92;for(u=0;u<t.length;u++)a[u]^=t[u];function c(){for(var t=i-1;i-4<=t;t--){if(o[t]++,o[t]<=255)return;o[t]=0}}for(;32<=r;)c(),s=s.concat(n(a.concat(n(o)))),r-=32;return 0<r&&(c(),s=s.concat(n(a.concat(n(o))).slice(0,r))),s}function o(t,e,r,n,i){var o;for(u(t,16*(2*r-1),i,0,16),o=0;o<2*r;o++)s(t,16*o,i,16),function(t,e){u(t,0,e,0,16);for(var r=8;0<r;r-=2)e[4]^=a(e[0]+e[12],7),e[8]^=a(e[4]+e[0],9),e[12]^=a(e[8]+e[4],13),e[0]^=a(e[12]+e[8],18),e[9]^=a(e[5]+e[1],7),e[13]^=a(e[9]+e[5],9),e[1]^=a(e[13]+e[9],13),e[5]^=a(e[1]+e[13],18),e[14]^=a(e[10]+e[6],7),e[2]^=a(e[14]+e[10],9),e[6]^=a(e[2]+e[14],13),e[10]^=a(e[6]+e[2],18),e[3]^=a(e[15]+e[11],7),e[7]^=a(e[3]+e[15],9),e[11]^=a(e[7]+e[3],13),e[15]^=a(e[11]+e[7],18),e[1]^=a(e[0]+e[3],7),e[2]^=a(e[1]+e[0],9),e[3]^=a(e[2]+e[1],13),e[0]^=a(e[3]+e[2],18),e[6]^=a(e[5]+e[4],7),e[7]^=a(e[6]+e[5],9),e[4]^=a(e[7]+e[6],13),e[5]^=a(e[4]+e[7],18),e[11]^=a(e[10]+e[9],7),e[8]^=a(e[11]+e[10],9),e[9]^=a(e[8]+e[11],13),e[10]^=a(e[9]+e[8],18),e[12]^=a(e[15]+e[14],7),e[13]^=a(e[12]+e[15],9),e[14]^=a(e[13]+e[12],13),e[15]^=a(e[14]+e[13],18);for(r=0;r<16;++r)t[r]+=e[r]}(i,n),u(i,0,t,e+16*o,16);for(o=0;o<r;o++)u(t,e+2*o*16,t,16*o,16);for(o=0;o<r;o++)u(t,e+16*(2*o+1),t,16*(o+r),16)}function a(t,e){return t<<e|t>>>32-e}function s(t,e,r,n){for(var i=0;i<n;i++)r[i]^=t[e+i]}function u(t,e,r,n,i){for(;i--;)r[n++]=t[e++]}function c(t){if(t&&"number"==typeof t.length){for(var e=0;e<t.length;e++){if("number"!=typeof t[e])return;var r=parseInt(t[e]);if(r!=t[e]||r<0||256<=r)return}return 1}}function l(t,e){var r=parseInt(t);if(t!=r)throw new Error("invalid "+e);return r}function h(e,r,n,a,h,f,p){if(!p)throw new Error("missing callback");if(n=l(n,"N"),a=l(a,"r"),h=l(h,"p"),f=l(f,"dkLen"),0===n||0!=(n&n-1))throw new Error("N must be power of 2");if(d/128/a<n)throw new Error("N too large");if(d/128/h<a)throw new Error("r too large");if(!c(e))throw new Error("password must be an array or buffer");if(e=Array.prototype.slice.call(e),!c(r))throw new Error("salt must be an array or buffer");r=Array.prototype.slice.call(r);for(var m=i(e,r,128*h*a),y=new Uint32Array(32*h*a),g=0;g<y.length;g++){var v=4*g;y[g]=(255&m[3+v])<<24|(255&m[2+v])<<16|(255&m[1+v])<<8|(255&m[0+v])<<0}var b,w,_=new Uint32Array(64*a),k=new Uint32Array(32*a*n),x=32*a,A=new Uint32Array(16),E=new Uint32Array(16),S=h*n*2,I=0,M=null,T=!1,P=0,C=0,O=parseInt(1e3/a),R=void 0!==t?t:setTimeout;!function t(){if(T)return p(new Error("cancelled"),I/S);switch(P){case 0:u(y,w=32*C*a,_,0,x),P=1,b=0;case 1:O<(c=n-b)&&(c=O);for(var r=0;r<c;r++)u(_,0,k,(b+r)*x,x),o(_,x,a,A,E);if(b+=c,I+=c,(d=parseInt(1e3*I/S))!==M){if(T=p(null,I/S))break;M=d}if(b<n)break;b=0,P=2;case 2:var c;for(O<(c=n-b)&&(c=O),r=0;r<c;r++){var l=_[16*(2*a-1)]&n-1;s(k,l*x,_,x),o(_,x,a,A,E)}if(b+=c,I+=c,(d=parseInt(1e3*I/S))!==M){if(T=p(null,I/S))break;M=d}if(b<n)break;if(u(_,0,y,w,x),++C<h){P=0;break}for(m=[],r=0;r<y.length;r++)m.push(y[r]>>0&255),m.push(y[r]>>8&255),m.push(y[r]>>16&255),m.push(y[r]>>24&255);var d=i(e,m,f);return p(null,1,d)}R(t)}()}var f,d;f=this,d=2147483647,void 0!==r?e.exports=h:f&&(f.scrypt&&(f._scrypt=f.scrypt),f.scrypt=h)}).call(this)}).call(this,t("timers").setImmediate)},{timers:46}],45:[function(t,e,n){(function(t,e,r){(function(){!function(e,r){"use strict";var n,i,o,a,s,u,c,l;function h(t){return i[n]=f.apply(r,t),n++}function f(t){var e=[].slice.call(arguments,1);return function(){"function"==typeof t?t.apply(r,e):new Function(""+t)()}}function d(t){if(o)setTimeout(f(d,t),0);else{var e=i[t];if(e){o=!0;try{e()}finally{p(t),o=!1}}}}function p(t){delete i[t]}e.setImmediate||(n=1,o=!(i={}),a=e.document,l=(l=Object.getPrototypeOf&&Object.getPrototypeOf(e))&&l.setTimeout?l:e,"[object process]"==={}.toString.call(e.process)?s=function(){var e=h(arguments);return t.nextTick(f(d,e)),e}:function(){if(e.postMessage&&!e.importScripts){var t=!0,r=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=r,t}}()?function(){function t(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(r)&&d(+t.data.slice(r.length))}var r="setImmediate$"+Math.random()+"$";e.addEventListener?e.addEventListener("message",t,!1):e.attachEvent("onmessage",t),s=function(){var t=h(arguments);return e.postMessage(r+t,"*"),t}}():s=e.MessageChannel?((c=new MessageChannel).port1.onmessage=function(t){d(t.data)},function(){var t=h(arguments);return c.port2.postMessage(t),t}):a&&"onreadystatechange"in a.createElement("script")?(u=a.documentElement,function(){var t=h(arguments),e=a.createElement("script");return e.onreadystatechange=function(){d(t),e.onreadystatechange=null,u.removeChild(e),e=null},u.appendChild(e),t}):function(){var t=h(arguments);return setTimeout(f(d,t),0),t},l.setImmediate=s,l.clearImmediate=p)}("undefined"==typeof self?void 0===e?this:e:self)}).call(this)}).call(this,t("_process"),void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("timers").clearImmediate)},{_process:43,timers:46}],46:[function(t,e,n){(function(t){(function(){e.exports={setImmediate:t.setImmediate}}).call(this)}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],47:[function(t,e,n){(function(t){(function(){var r,n,i;t.crypto&&crypto.getRandomValues&&(r=new Uint8Array(16),n=function(){return crypto.getRandomValues(r),r}),n||(i=new Array(16),n=function(){for(var t,e=0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),i[e]=t>>>((3&e)<<3)&255;return i}),e.exports=n}).call(this)}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],48:[function(t,e,r){for(var n=t("./rng"),i=[],o={},a=0;a<256;a++)i[a]=(a+256).toString(16).substr(1),o[i[a]]=a;function s(t,e){return e=e||0,i[t[e++]]+i[t[e++]]+i[t[e++]]+i[t[e++]]+"-"+i[t[e++]]+i[t[e++]]+"-"+i[t[e++]]+i[t[e++]]+"-"+i[t[e++]]+i[t[e++]]+"-"+i[t[e++]]+i[t[e++]]+i[t[e++]]+i[t[e++]]+i[t[e++]]+i[t[e++]]}var u=[1|(t=n())[0],t[1],t[2],t[3],t[4],t[5]],c=16383&(t[6]<<8|t[7]),l=0,h=0;function f(t,e,r){var i=e&&r||0;"string"==typeof t&&(e="binary"==t?new Array(16):null,t=null);var o=(t=t||{}).random||(t.rng||n)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,e)for(var a=0;a<16;a++)e[i+a]=o[a];return e||s(o)}(t=f).v1=function(t,e,r){var n=e&&r||0,i=e||[],o=void 0!==(t=t||{}).clockseq?t.clockseq:c,a=void 0!==t.msecs?t.msecs:(new Date).getTime(),f=void 0!==t.nsecs?t.nsecs:h+1;if((r=a-l+(f-h)/1e4)<0&&void 0===t.clockseq&&(o=o+1&16383),1e4<=(f=(r<0||l<a)&&void 0===t.nsecs?0:f))throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");l=a,c=o,f=(1e4*(268435455&(a+=122192928e5))+(h=f))%4294967296,i[n++]=f>>>24&255,i[n++]=f>>>16&255,i[n++]=f>>>8&255,i[n++]=255&f,a=a/4294967296*1e4&268435455,i[n++]=a>>>8&255,i[n++]=255&a,i[n++]=a>>>24&15|16,i[n++]=a>>>16&255,i[n++]=o>>>8|128,i[n++]=255&o;for(var d=t.node||u,p=0;p<6;p++)i[n+p]=d[p];return e||s(i)},t.v4=f,t.parse=function(t,e,r){var n=e&&r||0,i=0;for(e=e||[],t.toLowerCase().replace(/[0-9a-f]{2}/g,(function(t){i<16&&(e[n+i++]=o[t])}));i<16;)e[n+i++]=0;return e},t.unparse=s,e.exports=t},{"./rng":47}],49:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});try{e.exports.XMLHttpRequest=XMLHttpRequest}catch(t){console.log("Warning: XMLHttpRequest is not defined"),e.exports.XMLHttpRequest=null}},{}],50:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("../utils/properties");function i(){n.setType(this,"Provider")}i.isProvider=function(t){return n.isType(t,"Provider")},t=i,r.Provider=t},{"../utils/properties":74}],51:[function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var a=t("../utils/address"),u=t("../utils/bignumber"),c=t("../utils/bytes"),l=t("../constants"),h=t("../utils/hash"),f=t("../utils/networks"),d=t("../utils/properties"),p=t("../utils/rlp"),m=t("../utils/transaction"),y=t("../utils/utf8"),g=t("../utils/web"),v=o(t("../errors")),b=t("./abstract-provider");function w(t,e){var r,n={};for(r in t)try{var i=t[r](e[r]);void 0!==i&&(n[r]=i)}catch(t){throw t.checkKey=r,t.checkValue=e[r],t}return n}function _(t,e){return function(r){return null==r?e:t(r)}}function k(t){return function(e){if(!Array.isArray(e))throw new Error("not an array");var r=[];return e.forEach((function(e){r.push(t(e))})),r}}function x(t,e){return"string"==typeof t&&(e||"0x"===t.substring(0,2)||(t="0x"+t),32===c.hexDataLength(t))?t.toLowerCase():(v.throwError("invalid hash",v.INVALID_ARGUMENT,{arg:"hash",value:t}),null)}function A(t){return u.bigNumberify(t).toNumber()}function E(t){if(!c.isHexString(t))throw new Error("invalid uint256");for(;t.length<66;)t="0x0"+t.substring(2);return t}function S(t){if(null==t)return"latest";if("earliest"===t)return"0x0";if("latest"===t||"pending"===t)return t;if("number"==typeof t)return c.hexStripZeros(c.hexlify(t));if(c.isHexString(t))return c.hexStripZeros(t);throw new Error("invalid blockTag")}var I={hash:x,blockHash:_(x,null),blockNumber:_(A,null),transactionIndex:_(A,null),confirmations:_(A,null),from:a.getAddress,gasPrice:u.bigNumberify,gasLimit:u.bigNumberify,to:_(a.getAddress,null),value:u.bigNumberify,nonce:A,data:c.hexlify,r:_(E),s:_(E),v:_(A),creates:_(a.getAddress,null),raw:_(c.hexlify)};function M(t){null!=t.gas&&null==t.gasLimit&&(t.gasLimit=t.gas),t.to&&u.bigNumberify(t.to).isZero()&&(t.to="0x0000000000000000000000000000000000000000"),null!=t.input&&null==t.data&&(t.data=t.input),null==t.to&&null==t.creates&&(t.creates=a.getContractAddress(t)),t.raw||t.v&&t.r&&t.s&&(r=[c.stripZeros(c.hexlify(t.nonce)),c.stripZeros(c.hexlify(t.gasPrice)),c.stripZeros(c.hexlify(t.gasLimit)),t.to||"0x",c.stripZeros(c.hexlify(t.value||"0x")),c.hexlify(t.data||"0x"),c.stripZeros(c.hexlify(t.v||"0x")),c.stripZeros(c.hexlify(t.r)),c.stripZeros(c.hexlify(t.s))],t.raw=p.encode(r));var e=w(I,t),r=t.networkId;return null!=t.chainId&&null==r&&null==e.v&&(r=t.chainId),"number"!=typeof(r=c.isHexString(r)?u.bigNumberify(r).toNumber():r)&&null!=e.v&&((r=(e.v-35)/2)<0&&(r=0),r=parseInt(r)),e.networkId=r="number"!=typeof r?0:r,null==e.chainId&&null!=r&&(e.chainId=r),e.blockHash&&"x"===e.blockHash.replace(/0/g,"")&&(e.blockHash=null),e}var T={hash:x,parentHash:x,number:A,timestamp:A,nonce:_(c.hexlify),difficulty:function(t){t=u.bigNumberify(t);try{return t.toNumber()}catch(t){}return null},gasLimit:u.bigNumberify,gasUsed:u.bigNumberify,miner:a.getAddress,extraData:c.hexlify,transactions:_(k(x))},P=d.shallowCopy(T);function C(t,e){return null!=t.author&&null==t.miner&&(t.miner=t.author),w(e?P:T,t)}P.transactions=_(k(M));var O={from:_(a.getAddress),nonce:_(A),gasLimit:_(u.bigNumberify),gasPrice:_(u.bigNumberify),to:_(a.getAddress),value:_(u.bigNumberify),data:_(c.hexlify)};function R(t){return w(O,t)}var N={transactionLogIndex:_(A),transactionIndex:A,blockNumber:A,transactionHash:x,address:a.getAddress,topics:k(x),data:c.hexlify,logIndex:A,blockHash:x},j={to:_(a.getAddress,null),from:_(a.getAddress,null),contractAddress:_(a.getAddress,null),transactionIndex:A,root:_(x),gasUsed:u.bigNumberify,logsBloom:_(c.hexlify),blockHash:x,transactionHash:x,logs:k((function(t){return w(N,t)})),blockNumber:A,confirmations:_(A,null),cumulativeGasUsed:u.bigNumberify,status:_(A)};function L(t){return Array.isArray(t)?t.forEach((function(t){L(t)})):null!=t&&x(t),t}var U,D,B={fromBlock:_(S,void 0),toBlock:_(S,void 0),address:_(a.getAddress,void 0),topics:_(L,void 0)},z={blockHash:_(x,void 0),address:_(a.getAddress,void 0),topics:_(L,void 0)},F={blockNumber:_(A),blockHash:_(x),transactionIndex:A,removed:_((function(t){if("boolean"==typeof t)return t;if("string"==typeof t){if("true"===t)return!0;if("false"===t)return!1}throw new Error("invaid boolean - "+t)})),address:a.getAddress,data:(U=c.hexlify,function(t){return t?U(t):"0x"}),topics:k(x),transactionHash:x,logIndex:A};function H(t){return w(F,t)}function q(t){return t.map((function(t){return"string"==typeof t?t:Array.isArray(t)?(t.forEach((function(t){null!==t&&32!==c.hexDataLength(t)&&v.throwError("invalid topic",v.INVALID_ARGUMENT,{argument:"topic",value:t})})),t.join(",")):null===t?"":v.throwError("invalid topic value",v.INVALID_ARGUMENT,{argument:"topic",value:t})})).join("&")}function G(t){if("string"==typeof t){if(20===c.hexDataLength(t))return"address:"+a.getAddress(t);if(t=t.toLowerCase(),32===c.hexDataLength(t))return"tx:"+t;if(-1===t.indexOf(":"))return t}else{if(Array.isArray(t))return"filter::"+q(t);if(t&&"object"==s(t))return"filter:"+(t.address||"")+":"+q(t.topics||[])}throw new Error("invalid event - "+t)}function V(){return(new Date).getTime()}function K(t){var e,r=D.call(this)||this;return v.checkNew(r,b.Provider),t instanceof Promise?(d.defineReadOnly(r,"ready",t.then((function(t){return d.defineReadOnly(r,"_network",t),t}))),r.ready.catch((function(t){}))):(e=f.getNetwork(null==t?"homestead":t))?(d.defineReadOnly(r,"_network",e),d.defineReadOnly(r,"ready",Promise.resolve(r._network))):v.throwError("invalid network",v.INVALID_ARGUMENT,{arg:"network",value:t}),r._lastBlockNumber=-2,r._balances={},r._events=[],r._pollingInterval=4e3,r._emitted={block:-2},r._fastQueryDate=0,r}i(K,D=b.Provider),K.prototype._doPoll=function(){var t=this;this.getBlockNumber().then((function(e){if(t.polling&&(t._setFastBlockNumber(e),e!==t._lastBlockNumber)){-2===t._emitted.block&&(t._emitted.block=e-1);for(var r=t._emitted.block+1;r<=e;r++)t.emit("block",r);t._emitted.block!==e&&(t._emitted.block=e,Object.keys(t._emitted).forEach((function(r){var n;"block"===r||"pending"!==(n=t._emitted[r])&&12<e-n&&delete t._emitted[r]}))),-2===t._lastBlockNumber&&(t._lastBlockNumber=e-1);var n={},i={};return t._events.forEach((function(t){i[t.tag]=!0})),Object.keys(i).forEach((function(r){var i=r.split(":");switch(i[0]){case"tx":var o=i[1];t.getTransactionReceipt(o).then((function(e){return e&&null!=e.blockNumber&&(t._emitted["t:"+o]=e.blockNumber,t.emit(o,e)),null})).catch((function(e){t.emit("error",e)}));break;case"address":var a=i[1];t._balances[a]&&(n[a]=t._balances[a]),t.getBalance(a,"latest").then((function(e){var r=t._balances[a];if(!r||!e.eq(r))return t._balances[a]=e,t.emit(a,e),null})).catch((function(e){t.emit("error",e)}));break;case"filter":var s=i[2].split(/&/g).map((function(t){var e=t.split(",");return 1===e.length?""===e[0]?null:t:e.map((function(t){return""===t?null:t}))})),u={address:i[1],fromBlock:t._lastBlockNumber+1,toBlock:e,topics:s};u.address||delete u.address,t.getLogs(u).then((function(e){if(0!==e.length)return e.forEach((function(e){t._emitted["b:"+e.blockHash]=e.blockNumber,t._emitted["t:"+e.transactionHash]=e.blockNumber,t.emit(u,e)})),null})).catch((function(e){t.emit("error",e)}))}})),t._lastBlockNumber=e,t._balances=n,null}})).catch((function(t){})),this.doPoll()},K.prototype.resetEventsBlock=function(t){this._lastBlockNumber=t-1,this.polling&&this._doPoll()},Object.defineProperty(K.prototype,"network",{get:function(){return this._network},enumerable:!0,configurable:!0}),K.prototype.getNetwork=function(){return this.ready},Object.defineProperty(K.prototype,"blockNumber",{get:function(){return this._fastBlockNumber},enumerable:!0,configurable:!0}),Object.defineProperty(K.prototype,"polling",{get:function(){return null!=this._poller},set:function(t){var e=this;setTimeout((function(){t&&!e._poller?(e._poller=setInterval(e._doPoll.bind(e),e.pollingInterval),e._doPoll()):!t&&e._poller&&(clearInterval(e._poller),e._poller=null)}),0)},enumerable:!0,configurable:!0}),Object.defineProperty(K.prototype,"pollingInterval",{get:function(){return this._pollingInterval},set:function(t){var e=this;if("number"!=typeof t||t<=0||parseInt(String(t))!=t)throw new Error("invalid polling interval");this._pollingInterval=t,this._poller&&(clearInterval(this._poller),this._poller=setInterval((function(){e._doPoll()}),this._pollingInterval))},enumerable:!0,configurable:!0}),K.prototype._getFastBlockNumber=function(){var t=this,e=V();return e-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=e,this._fastBlockNumberPromise=this.getBlockNumber().then((function(e){return(null==t._fastBlockNumber||e>t._fastBlockNumber)&&(t._fastBlockNumber=e),t._fastBlockNumber}))),this._fastBlockNumberPromise},K.prototype._setFastBlockNumber=function(t){null!=this._fastBlockNumber&&t<this._fastBlockNumber||(this._fastQueryDate=V(),(null==this._fastBlockNumber||t>this._fastBlockNumber)&&(this._fastBlockNumber=t,this._fastBlockNumberPromise=Promise.resolve(t)))},K.prototype.waitForTransaction=function(t,e){var r=this;return null==e&&(e=1),this.getTransactionReceipt(t).then((function(n){return 0===e||n&&n.confirmations>=e?n:new Promise((function(n){r.on(t,(function i(o){o.confirmations<e||(r.removeListener(t,i),n(o))}))}))}))},K.prototype.getBlockNumber=function(){var t=this;return this.ready.then((function(){return t.perform("getBlockNumber",{}).then((function(e){var r=parseInt(e);if(r!=e)throw new Error("invalid response - getBlockNumber");return t._setFastBlockNumber(r),r}))}))},K.prototype.getGasPrice=function(){var t=this;return this.ready.then((function(){return t.perform("getGasPrice",{}).then((function(t){return u.bigNumberify(t)}))}))},K.prototype.getBalance=function(t,e){var r=this;return this.ready.then((function(){return d.resolveProperties({addressOrName:t,blockTag:e}).then((function(t){var e=t.addressOrName,n=t.blockTag;return r._getAddress(e).then((function(t){return t={address:t,blockTag:S(n)},r.perform("getBalance",t).then((function(t){return u.bigNumberify(t)}))}))}))}))},K.prototype.getTransactionCount=function(t,e){var r=this;return this.ready.then((function(){return d.resolveProperties({addressOrName:t,blockTag:e}).then((function(t){var e=t.addressOrName,n=t.blockTag;return r._getAddress(e).then((function(t){return t={address:t,blockTag:S(n)},r.perform("getTransactionCount",t).then((function(t){return u.bigNumberify(t).toNumber()}))}))}))}))},K.prototype.getCode=function(t,e){var r=this;return this.ready.then((function(){return d.resolveProperties({addressOrName:t,blockTag:e}).then((function(t){var e=t.addressOrName,n=t.blockTag;return r._getAddress(e).then((function(t){return t={address:t,blockTag:S(n)},r.perform("getCode",t).then((function(t){return c.hexlify(t)}))}))}))}))},K.prototype.getStorageAt=function(t,e,r){var n=this;return this.ready.then((function(){return d.resolveProperties({addressOrName:t,position:e,blockTag:r}).then((function(t){var e=t.addressOrName,r=t.position,i=t.blockTag;return n._getAddress(e).then((function(t){return t={address:t,blockTag:S(i),position:c.hexStripZeros(c.hexlify(r))},n.perform("getStorageAt",t).then((function(t){return c.hexlify(t)}))}))}))}))},K.prototype.sendTransaction=function(t){var e=this;return this.ready.then((function(){return d.resolveProperties({signedTransaction:t}).then((function(t){var r=t.signedTransaction;return t={signedTransaction:c.hexlify(r)},e.perform("sendTransaction",t).then((function(t){return e._wrapTransaction(m.parse(r),t)}),(function(t){throw t.transaction=m.parse(r),t.transaction.hash&&(t.transactionHash=t.transaction.hash),t}))}))}))},K.prototype._wrapTransaction=function(t,e){var r=this;if(null!=e&&32!==c.hexDataLength(e))throw new Error("invalid response - sendTransaction");var n=t;return null!=e&&t.hash!==e&&v.throwError("Transaction hash mismatch from Provider.sendTransaction.",v.UNKNOWN_ERROR,{expectedHash:t.hash,returnedHash:e}),n.wait=function(e){return 0!==e&&(r._emitted["t:"+t.hash]="pending"),r.waitForTransaction(t.hash,e).then((function(n){return null==n&&0===e?null:(r._emitted["t:"+t.hash]=n.blockNumber,0===n.status&&v.throwError("transaction failed",v.CALL_EXCEPTION,{transactionHash:t.hash,transaction:t}),n)}))},n},K.prototype.call=function(t,e){var r=this,n=d.shallowCopy(t);return this.ready.then((function(){return d.resolveProperties({blockTag:e,tx:n}).then((function(t){var e=t.blockTag;return t=t.tx,r._resolveNames(t,["to","from"]).then((function(t){return t={blockTag:S(e),transaction:R(t)},r.perform("call",t).then((function(t){return c.hexlify(t)}))}))}))}))},K.prototype.estimateGas=function(t){var e=this,r={to:t.to,from:t.from,data:t.data,gasPrice:t.gasPrice,value:t.value};return this.ready.then((function(){return d.resolveProperties(r).then((function(t){return e._resolveNames(t,["to","from"]).then((function(t){return t={transaction:R(t)},e.perform("estimateGas",t).then((function(t){return u.bigNumberify(t)}))}))}))}))},K.prototype.getBlock=function(t,e){var r=this;return this.ready.then((function(){return d.resolveProperties({blockHashOrBlockTag:t}).then((function(t){t=t.blockHashOrBlockTag;try{var n=c.hexlify(t);if(32===c.hexDataLength(n))return g.poll((function(){return r.perform("getBlock",{blockHash:n,includeTransactions:!!e}).then((function(t){return null==t?null==r._emitted["b:"+n]?null:void 0:C(t,e)}))}),{onceBlock:r})}catch(t){}try{var i=-128,o=S(t);return c.isHexString(o)&&(i=parseInt(o.substring(2),16)),g.poll((function(){return r.perform("getBlock",{blockTag:o,includeTransactions:!!e}).then((function(t){return null==t?i<=r._emitted.block?void 0:null:C(t,e)}))}),{onceBlock:r})}catch(t){}throw new Error("invalid block hash or block tag")}))}))},K.prototype.getTransaction=function(t){var e=this;return this.ready.then((function(){return d.resolveProperties({transactionHash:t}).then((function(t){var r=t.transactionHash,n={transactionHash:x(r,!0)};return g.poll((function(){return e.perform("getTransaction",n).then((function(t){if(null==t)return null==e._emitted["t:"+r]?null:void 0;var n=K.checkTransactionResponse(t);if(null==n.blockNumber)n.confirmations=0;else if(null==n.confirmations)return e._getFastBlockNumber().then((function(t){return t=t-n.blockNumber+1,n.confirmations=t=t<=0?1:t,e._wrapTransaction(n)}));return e._wrapTransaction(n)}))}),{onceBlock:e})}))}))},K.prototype.getTransactionReceipt=function(t){var e=this;return this.ready.then((function(){return d.resolveProperties({transactionHash:t}).then((function(t){var r=t.transactionHash,n={transactionHash:x(r,!0)};return g.poll((function(){return e.perform("getTransactionReceipt",n).then((function(t){if(null==t)return null==e._emitted["t:"+r]?null:void 0;if(null!=t.blockHash){var n,i=((t=w(j,n=t)).logs.forEach((function(t,e){null==t.transactionLogIndex&&(t.transactionLogIndex=e)})),null!=n.status&&(t.byzantium=!0),t);if(null==i.blockNumber)i.confirmations=0;else if(null==i.confirmations)return e._getFastBlockNumber().then((function(t){return t=t-i.blockNumber+1,i.confirmations=t=t<=0?1:t,i}));return i}}))}),{onceBlock:e})}))}))},K.prototype.getLogs=function(t){var e=this;return this.ready.then((function(){return d.resolveProperties(t).then((function(t){return e._resolveNames(t,["address"]).then((function(t){return t={filter:(t=t)&&t.blockHash?w(z,t):w(B,t)},e.perform("getLogs",t).then((function(t){return k(H)(t)}))}))}))}))},K.prototype.getEtherPrice=function(){var t=this;return this.ready.then((function(){return t.perform("getEtherPrice",{}).then((function(t){return t}))}))},K.prototype._getAddress=function(t){return this.resolveName(t).then((function(e){return null==e&&v.throwError("ENS name not configured",v.UNSUPPORTED_OPERATION,{operation:"resolveName("+JSON.stringify(t)+")"}),e}))},K.prototype._resolveNames=function(t,e){var r=[],n=d.shallowCopy(t);return e.forEach((function(t){null!=n[t]&&r.push(this._getAddress(n[t]).then((function(e){n[t]=e})))}),this),Promise.all(r).then((function(){return n}))},K.prototype._getResolver=function(t){var e=this;return this.getNetwork().then((function(r){r.ensAddress||v.throwError("network does not support ENS",v.UNSUPPORTED_OPERATION,{operation:"ENS",network:r.name});var n="0x0178b8bf"+h.namehash(t).substring(2);return n={to:r.ensAddress,data:n},e.call(n).then((function(t){return 32!==c.hexDataLength(t)||(t=a.getAddress(c.hexDataSlice(t,12)))===l.AddressZero?null:t}))}))},K.prototype.resolveName=function(t){var e=this;if(t instanceof Promise)return t.then((function(t){return e.resolveName(t)}));try{return Promise.resolve(a.getAddress(t))}catch(e){if(c.isHexString(t))throw e}var r=this,n=h.namehash(t);return this._getResolver(t).then((function(t){if(null==t)return null;var e="0x3b3b57de"+n.substring(2);return r.call({to:t,data:e})})).then((function(t){return 32!==c.hexDataLength(t)||(t=a.getAddress(c.hexDataSlice(t,12)))===l.AddressZero?null:t}))},K.prototype.lookupAddress=function(t){var e=this;if(t instanceof Promise)return t.then((function(t){return e.lookupAddress(t)}));var r=(t=a.getAddress(t)).substring(2)+".addr.reverse",n=h.namehash(r),i=this;return this._getResolver(r).then((function(t){if(!t)return null;var e="0x691f3431"+n.substring(2);return i.call({to:t,data:e})})).then((function(e){if(null==e)return null;if((e=e.substring(2)).length<64)return null;if((e=e.substring(64)).length<64)return null;var r=u.bigNumberify("0x"+e.substring(0,64)).toNumber();if(2*r>(e=e.substring(64)).length)return null;var n=y.toUtf8String("0x"+e.substring(0,2*r));return i.resolveName(n).then((function(e){return e!=t?null:n}))}))},K.checkTransactionResponse=M,K.prototype.doPoll=function(){},K.prototype.perform=function(t,e){return v.throwError(t+" not implemented",v.NOT_IMPLEMENTED,{operation:t}),null},K.prototype._startPending=function(){v.warn("WARNING: this provider does not support pending events")},K.prototype._stopPending=function(){},K.prototype._addEventListener=function(t,e,r){this._events.push({tag:G(t),listener:e,once:r}),"pending"===t&&this._startPending(),this.polling=!0},K.prototype.on=function(t,e){return this._addEventListener(t,e,!1),this},K.prototype.once=function(t,e){return this._addEventListener(t,e,!0),this},K.prototype.addEventListener=function(t,e){return this.on(t,e)},K.prototype.emit=function(t){for(var e=this,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var i=!1,o=G(t);return this._events=this._events.filter((function(t){return t.tag!==o||(setTimeout((function(){t.listener.apply(e,r)}),0),i=!0,!t.once)})),0===this.listenerCount()&&(this.polling=!1),i},K.prototype.listenerCount=function(t){if(!t)return this._events.length;var e=G(t);return this._events.filter((function(t){return t.tag===e})).length},K.prototype.listeners=function(t){var e=G(t);return this._events.filter((function(t){return t.tag===e})).map((function(t){return t.listener}))},K.prototype.removeAllListeners=function(t){var e;return null==t?(this._events=[],this._stopPending()):(e=G(t),this._events=this._events.filter((function(t){return t.tag!==e})),"pending"===t&&this._stopPending()),0===this._events.length&&(this.polling=!1),this},K.prototype.removeListener=function(t,e){var r=!1,n=G(t);return this._events=this._events.filter((function(t){return t.tag!==n||t.listener!=e||!!r||!(r=!0)})),"pending"===t&&0===this.listenerCount("pending")&&this._stopPending(),0===this.listenerCount()&&(this.polling=!1),this},i=K,r.BaseProvider=i,d.defineReadOnly(b.Provider,"inherits",d.inheritable(b.Provider))},{"../constants":3,"../errors":5,"../utils/address":60,"../utils/bignumber":63,"../utils/bytes":64,"../utils/hash":65,"../utils/networks":72,"../utils/properties":74,"../utils/rlp":76,"../utils/transaction":83,"../utils/utf8":85,"../utils/web":86,"./abstract-provider":50}],52:[function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var a,s=t("./base-provider"),u=t("../utils/bytes"),c=t("../utils/properties"),l=t("../utils/web"),h=o(t("../errors"));function f(t){var e,r,n=[];for(e in t)null!=t[e]&&(r=u.hexlify(t[e]),{gasLimit:!0,gasPrice:!0,nonce:!0,value:!0}[e]&&(r=u.hexStripZeros(r)),n.push(e+"="+r));return n.join("&")}function d(t){if(0==t.status&&("No records found"===t.message||"No transactions found"===t.message))return t.result;if(1==t.status&&"OK"==t.message)return t.result;var e=new Error("invalid response");throw e.result=JSON.stringify(t),e}function p(t){if("2.0"!=t.jsonrpc)throw(e=new Error("invalid response")).result=JSON.stringify(t),e;if(t.error){var e=new Error(t.error.message||"unknown error");throw t.error.code&&(e.code=t.error.code),t.error.data&&(e.data=t.error.data),e}return t.result}function m(t){if("pending"===t)throw new Error("pending not supported");return"latest"===t?t:parseInt(t.substring(2),16)}function y(t,e){var r=a.call(this,t)||this;h.checkNew(r,y),t="invalid";var n=null;switch(t=r.network?r.network.name:t){case"homestead":n="https://api.etherscan.io";break;case"ropsten":n="https://api-ropsten.etherscan.io";break;case"rinkeby":n="https://api-rinkeby.etherscan.io";break;case"kovan":n="https://api-kovan.etherscan.io";break;case"goerli":n="https://api-goerli.etherscan.io";break;default:throw new Error("unsupported network")}return c.defineReadOnly(r,"baseUrl",n),c.defineReadOnly(r,"apiKey",e||"8FG3JMZ9USS4NTA6YKEKHINU56SEPPVBJR"),r}i(y,a=s.BaseProvider),y.prototype.perform=function(t,e){var r,n=this,i=this.baseUrl,o="";function s(t,e){return l.fetchJson(t,null,e||p).then((function(e){return n.emit("debug",{action:"perform",request:t,response:e,provider:n}),e}))}switch(this.apiKey&&(o+="&apikey="+this.apiKey),t){case"getBlockNumber":return s(i+="/api?module=proxy&action=eth_blockNumber"+o);case"getGasPrice":return s(i+="/api?module=proxy&action=eth_gasPrice"+o);case"getBalance":return i+="/api?module=account&action=balance&address="+e.address,s(i+="&tag="+e.blockTag+o,d);case"getTransactionCount":return i+="/api?module=proxy&action=eth_getTransactionCount&address="+e.address,s(i+="&tag="+e.blockTag+o);case"getCode":return i+="/api?module=proxy&action=eth_getCode&address="+e.address,s(i+="&tag="+e.blockTag+o,p);case"getStorageAt":return i+="/api?module=proxy&action=eth_getStorageAt&address="+e.address,i+="&position="+e.position,s(i+="&tag="+e.blockTag+o,p);case"sendTransaction":return i+="/api?module=proxy&action=eth_sendRawTransaction&hex="+e.signedTransaction,s(i+=o).catch((function(t){throw t.responseText&&(0<=t.responseText.toLowerCase().indexOf("insufficient funds")&&h.throwError("insufficient funds",h.INSUFFICIENT_FUNDS,{}),0<=t.responseText.indexOf("same hash was already imported")&&h.throwError("nonce has already been used",h.NONCE_EXPIRED,{}),0<=t.responseText.indexOf("another transaction with same nonce")&&h.throwError("replacement fee too low",h.REPLACEMENT_UNDERPRICED,{})),t}));case"getBlock":return e.blockTag?(i+="/api?module=proxy&action=eth_getBlockByNumber&tag="+e.blockTag,e.includeTransactions?i+="&boolean=true":i+="&boolean=false",s(i+=o)):Promise.reject(new Error("getBlock by blockHash not implemeneted"));case"getTransaction":return i+="/api?module=proxy&action=eth_getTransactionByHash&txhash="+e.transactionHash,s(i+=o);case"getTransactionReceipt":return i+="/api?module=proxy&action=eth_getTransactionReceipt&txhash="+e.transactionHash,s(i+=o);case"call":return i+="/api?module=proxy&action=eth_call"+(r=(r=f(e.transaction))&&"&"+r),"latest"!==e.blockTag?Promise.reject(new Error("EtherscanProvider does not support blockTag for call")):s(i+=o);case"estimateGas":return i+="/api?module=proxy&action=eth_estimateGas&"+(r=(r=f(e.transaction))&&"&"+r),s(i+=o);case"getLogs":i+="/api?module=logs&action=getLogs";try{if(e.filter.fromBlock&&(i+="&fromBlock="+m(e.filter.fromBlock)),e.filter.toBlock&&(i+="&toBlock="+m(e.filter.toBlock)),e.filter.blockHash)try{h.throwError("Etherscan does not support blockHash filters",h.UNSUPPORTED_OPERATION,{operation:"getLogs(blockHash)"})}catch(t){return Promise.reject(t)}if(e.filter.address&&(i+="&address="+e.filter.address),e.filter.topics&&0<e.filter.topics.length){if(1<e.filter.topics.length)throw new Error("unsupported topic format");var u=e.filter.topics[0];if("string"!=typeof u||66!==u.length)throw new Error("unsupported topic0 format");i+="&topic0="+u}}catch(t){return Promise.reject(t)}var c=this;return s(i+=o,d).then((function(t){var e={},r=Promise.resolve();return t.forEach((function(t){r=r.then((function(){return null!=t.blockHash?null:(t.blockHash=e[t.transactionHash],null==t.blockHash?c.getTransaction(t.transactionHash).then((function(r){return e[t.transactionHash]=r.blockHash,t.blockHash=r.blockHash,null})):null)}))})),r.then((function(){return t}))}));case"getEtherPrice":return"homestead"!==this.network.name?Promise.resolve(0):(i+="/api?module=stats&action=ethprice",s(i+=o,d).then((function(t){return parseFloat(t.ethusd)})))}return a.prototype.perform.call(this,t,e)},y.prototype.getHistory=function(t,e,r){var n=this,i=this.baseUrl,o="";return this.apiKey&&(o+="&apikey="+this.apiKey),null==e&&(e=0),null==r&&(r=99999999),this.resolveName(t).then((function(t){return i+="/api?module=account&action=txlist&address="+t,i+="&startblock="+e,i+="&endblock="+r,i+="&sort=asc"+o,l.fetchJson(i,null,d).then((function(t){n.emit("debug",{action:"getHistory",request:i,response:t,provider:n});var e=[];return t.forEach((function(t){["contractAddress","to"].forEach((function(e){""==t[e]&&delete t[e]})),null==t.creates&&null!=t.contractAddress&&(t.creates=t.contractAddress);var r=s.BaseProvider.checkTransactionResponse(t);t.timeStamp&&(r.timestamp=parseInt(t.timeStamp)),e.push(r)})),e}))}))},i=y,r.EtherscanProvider=i},{"../errors":5,"../utils/bytes":64,"../utils/properties":74,"../utils/web":86,"./base-provider":51}],53:[function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var a,s=t("./base-provider"),u=o(t("../errors"));function c(t){var e=!0,r=null;return t.forEach((function(n){null!=n?null!=r?r.name===n.name&&r.chainId===n.chainId&&(r.ensAddress===n.ensAddress||null==r.ensAddress&&null==n.ensAddress)||u.throwError("provider mismatch",u.INVALID_ARGUMENT,{arg:"networks",value:t}):r=n:e=!1})),e}function l(t){var e,r=this;if(0===t.length)throw new Error("no providers");return r=c(t.map((function(t){return t.network})))?a.call(this,t[0].network)||this:(e=Promise.all(t.map((function(t){return t.getNetwork()}))).then((function(t){return c(t)||u.throwError("getNetwork returned null",u.UNKNOWN_ERROR,{}),t[0]})),a.call(this,e)||this),u.checkNew(r,l),r._providers=t.slice(0),r}i(l,a=s.BaseProvider),Object.defineProperty(l.prototype,"providers",{get:function(){return this._providers.slice(0)},enumerable:!0,configurable:!0}),l.prototype.perform=function(t,e){var r=this.providers;return new Promise((function(n,i){var o=null;!function a(){r.length?r.shift().perform(t,e).then((function(t){return n(t)})).catch((function(t){o=o||t,setTimeout(a,0)})):i(o)}()}))},i=l,r.FallbackProvider=i},{"../errors":5,"./base-provider":51}],54:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./abstract-provider");r.Provider=n.Provider,n=t("./base-provider"),r.BaseProvider=n.BaseProvider,n=t("./etherscan-provider"),r.EtherscanProvider=n.EtherscanProvider,n=t("./fallback-provider"),r.FallbackProvider=n.FallbackProvider,n=t("./ipc-provider"),r.IpcProvider=n.IpcProvider,n=t("./infura-provider"),r.InfuraProvider=n.InfuraProvider,n=t("./json-rpc-provider"),r.JsonRpcProvider=n.JsonRpcProvider,r.JsonRpcSigner=n.JsonRpcSigner,t=t("./web3-provider"),r.Web3Provider=t.Web3Provider},{"./abstract-provider":50,"./base-provider":51,"./etherscan-provider":52,"./fallback-provider":53,"./infura-provider":55,"./ipc-provider":56,"./json-rpc-provider":57,"./web3-provider":58}],55:[function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var a,s=t("./json-rpc-provider"),u=t("../utils/bytes"),c=t("../utils/networks"),l=t("../utils/properties"),h=o(t("../errors"));function f(t,e){var r=this,n=c.getNetwork(null==t?"homestead":t);null==e&&(e="7d0d81d0919f4f05b9ab6634be01ee73");var i=null;switch(n.name){case"homestead":i="mainnet.infura.io";break;case"ropsten":i="ropsten.infura.io";break;case"rinkeby":i="rinkeby.infura.io";break;case"goerli":i="goerli.infura.io";break;case"kovan":i="kovan.infura.io";break;default:h.throwError("unsupported network",h.INVALID_ARGUMENT,{argument:"network",value:t})}return u.isHexString("0x"+e,16)?(r=a.call(this,"https://"+i+"/v3/"+e,n)||this,l.defineReadOnly(r,"apiAccessToken",null),l.defineReadOnly(r,"projectId",e)):(h.warn("The legacy INFURA apiAccesToken API is deprecated; please upgrade to a Project ID instead (see INFURA dshboard; https://infura.io)"),r=a.call(this,"https://"+i+"/"+e,n)||this,l.defineReadOnly(r,"apiAccessToken",e),l.defineReadOnly(r,"projectId",null)),h.checkNew(r,f),r}i(f,a=s.JsonRpcProvider),f.prototype._startPending=function(){h.warn("WARNING: INFURA does not support pending filters")},f.prototype.getSigner=function(t){return h.throwError("INFURA does not support signing",h.UNSUPPORTED_OPERATION,{operation:"getSigner"})},f.prototype.listAccounts=function(){return Promise.resolve([])},i=f,r.InfuraProvider=i},{"../errors":5,"../utils/bytes":64,"../utils/networks":72,"../utils/properties":74,"./json-rpc-provider":57}],56:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0})},{}],57:[function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var a=t("./base-provider"),s=t("../abstract-signer"),u=o(t("../errors")),c=t("../utils/address"),l=t("../utils/bytes"),h=t("../utils/networks"),f=t("../utils/properties"),d=t("../utils/utf8"),p=t("../utils/web");function m(t){if(t.error){var e=new Error(t.error.message);throw e.code=t.error.code,e.data=t.error.data,e}return t.result}function y(t){return t&&t.toLowerCase()}var g,v={},b=42,w=(i(_,g=s.Signer),_.prototype.getAddress=function(){var t=this;return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then((function(e){return e.length<=t._index&&u.throwError("unknown account #"+t._index,u.UNSUPPORTED_OPERATION,{operation:"getAddress"}),t._address=c.getAddress(e[t._index]),t._address}))},_.prototype.getBalance=function(t){return this.provider.getBalance(this.getAddress(),t)},_.prototype.getTransactionCount=function(t){return this.provider.getTransactionCount(this.getAddress(),t)},_.prototype.sendUncheckedTransaction=function(t){var e=this;t=f.shallowCopy(t);var r,n=this.getAddress().then((function(t){return t&&t.toLowerCase()}));return null==t.gasLimit&&((r=f.shallowCopy(t)).from=n,t.gasLimit=this.provider.estimateGas(r)),Promise.all([f.resolveProperties(t),n]).then((function(t){var r=t[0],n=A.hexlifyTransaction(r);return n.from=t[1],e.provider.send("eth_sendTransaction",[n]).then((function(t){return t}),(function(t){throw t.responseText&&(0<=t.responseText.indexOf("insufficient funds")&&u.throwError("insufficient funds",u.INSUFFICIENT_FUNDS,{transaction:r}),0<=t.responseText.indexOf("nonce too low")&&u.throwError("nonce has already been used",u.NONCE_EXPIRED,{transaction:r}),0<=t.responseText.indexOf("replacement transaction underpriced")&&u.throwError("replacement fee too low",u.REPLACEMENT_UNDERPRICED,{transaction:r})),t}))}))},_.prototype.sendTransaction=function(t){var e=this;return this.sendUncheckedTransaction(t).then((function(t){return p.poll((function(){return e.provider.getTransaction(t).then((function(r){if(null!==r)return e.provider._wrapTransaction(r,t)}))}),{fastRetry:250,onceBlock:e.provider}).catch((function(e){throw e.transactionHash=t,e}))}))},_.prototype.signMessage=function(t){var e=this,r="string"==typeof t?d.toUtf8Bytes(t):t;return this.getAddress().then((function(t){return e.provider.send("eth_sign",[t.toLowerCase(),l.hexlify(r)])}))},_.prototype.unlock=function(t){var e=this.provider;return this.getAddress().then((function(r){return e.send("personal_unlockAccount",[r.toLowerCase(),t,null])}))},_);function _(t,e,r){var n=g.call(this)||this;if(u.checkNew(n,_),t!==v)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");return f.defineReadOnly(n,"provider",e),r?"string"==typeof r?f.defineReadOnly(n,"_address",c.getAddress(r)):"number"==typeof r?f.defineReadOnly(n,"_index",r):u.throwError("invalid address or index",u.INVALID_ARGUMENT,{argument:"addressOrIndex",value:r}):f.defineReadOnly(n,"_index",0),n}r.JsonRpcSigner=w;var k,x={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0},A=(i(E,k=a.BaseProvider),E.prototype.getSigner=function(t){return new w(v,this,t)},E.prototype.listAccounts=function(){return this.send("eth_accounts",[]).then((function(t){return t.map((function(t){return c.getAddress(t)}))}))},E.prototype.send=function(t,e){var r=this,n={method:t,params:e,id:b++,jsonrpc:"2.0"};return p.fetchJson(this.connection,JSON.stringify(n),m).then((function(t){return r.emit("debug",{action:"send",request:n,response:t,provider:r}),t}))},E.prototype.perform=function(t,e){switch(t){case"getBlockNumber":return this.send("eth_blockNumber",[]);case"getGasPrice":return this.send("eth_gasPrice",[]);case"getBalance":return this.send("eth_getBalance",[y(e.address),e.blockTag]);case"getTransactionCount":return this.send("eth_getTransactionCount",[y(e.address),e.blockTag]);case"getCode":return this.send("eth_getCode",[y(e.address),e.blockTag]);case"getStorageAt":return this.send("eth_getStorageAt",[y(e.address),e.position,e.blockTag]);case"sendTransaction":return this.send("eth_sendRawTransaction",[e.signedTransaction]).catch((function(t){throw t.responseText&&(0<t.responseText.indexOf("insufficient funds")&&u.throwError("insufficient funds",u.INSUFFICIENT_FUNDS,{}),0<t.responseText.indexOf("nonce too low")&&u.throwError("nonce has already been used",u.NONCE_EXPIRED,{}),0<t.responseText.indexOf("replacement transaction underpriced")&&u.throwError("replacement fee too low",u.REPLACEMENT_UNDERPRICED,{})),t}));case"getBlock":return e.blockTag?this.send("eth_getBlockByNumber",[e.blockTag,!!e.includeTransactions]):e.blockHash?this.send("eth_getBlockByHash",[e.blockHash,!!e.includeTransactions]):Promise.reject(new Error("invalid block tag or block hash"));case"getTransaction":return this.send("eth_getTransactionByHash",[e.transactionHash]);case"getTransactionReceipt":return this.send("eth_getTransactionReceipt",[e.transactionHash]);case"call":return this.send("eth_call",[E.hexlifyTransaction(e.transaction,{from:!0}),e.blockTag]);case"estimateGas":return this.send("eth_estimateGas",[E.hexlifyTransaction(e.transaction,{from:!0})]);case"getLogs":return e.filter&&null!=e.filter.address&&(e.filter.address=y(e.filter.address)),this.send("eth_getLogs",[e.filter])}return u.throwError(t+" not implemented",u.NOT_IMPLEMENTED,{operation:t}),null},E.prototype._startPending=function(){var t,e;null==this._pendingFilter&&(e=(t=this).send("eth_newPendingTransactionFilter",[]),(this._pendingFilter=e).then((function(r){return function n(){t.send("eth_getFilterChanges",[r]).then((function(r){if(t._pendingFilter!=e)return null;var n=Promise.resolve();return r.forEach((function(e){t._emitted["t:"+e.toLowerCase()]="pending",n=n.then((function(){return t.getTransaction(e).then((function(e){return t.emit("pending",e),null}))}))})),n.then((function(){return new Promise((function(t){setTimeout((function(){t()}),1e3)}))}))})).then((function(){return t._pendingFilter==e?(setTimeout((function(){n()}),0),null):void t.send("eth_uninstallFilter",[r])})).catch((function(t){}))}(),r})).catch((function(t){})))},E.prototype._stopPending=function(){this._pendingFilter=null},E.hexlifyTransaction=function(t,e){var r=f.shallowCopy(x);if(e)for(var n in e)e[n]&&(r[n]=!0);f.checkProperties(t,r);var i={};return["gasLimit","gasPrice","nonce","value"].forEach((function(e){var r;null!=t[e]&&(r=l.hexStripZeros(l.hexlify(t[e])),i[e="gasLimit"===e?"gas":e]=r)})),["from","to","data"].forEach((function(e){null!=t[e]&&(i[e]=l.hexlify(t[e]))})),i},E);function E(t,e){var r=this;return"string"==typeof t&&null===e&&h.getNetwork(t)&&(e=t,t=null),e||(e=new Promise((function(t,e){setTimeout((function(){r.send("net_version",[]).then((function(e){return t(h.getNetwork(parseInt(e)))})).catch((function(t){e(t)}))}))}))),r=k.call(this,e)||this,u.checkNew(r,E),r.connection="string"==typeof(t=t||"http://localhost:8545")?{url:t}:t,r}r.JsonRpcProvider=A},{"../abstract-signer":2,"../errors":5,"../utils/address":60,"../utils/bytes":64,"../utils/networks":72,"../utils/properties":74,"../utils/utf8":85,"../utils/web":86,"./base-provider":51}],58:[function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var a,s=t("./json-rpc-provider"),u=t("../utils/properties"),c=o(t("../errors")),l=42;function h(t,e){return e=a.call(this,t.host||t.path||"",e)||this,c.checkNew(e,h),t&&(t.sendAsync?e._sendAsync=t.sendAsync.bind(t):t.send&&(e._sendAsync=t.send.bind(t))),t&&e._sendAsync||c.throwError("invalid web3Provider",c.INVALID_ARGUMENT,{arg:"web3Provider",value:t}),u.defineReadOnly(e,"_web3Provider",t),u.defineReadOnly(e,"provider",t),e}i(h,a=s.JsonRpcProvider),h.prototype.send=function(t,e){var r=this;return"eth_sign"==t&&this._web3Provider.isMetaMask&&(t="personal_sign",e=[e[1],e[0]]),new Promise((function(n,i){var o={method:t,params:e,id:l++,jsonrpc:"2.0"};r._sendAsync(o,(function(t,e){if(t)i(t);else{if(e.error)return(t=new Error(e.error.message)).code=e.error.code,t.data=e.error.data,void i(t);n(e.result)}}))}))},i=h,r.Web3Provider=i},{"../errors":5,"../utils/properties":74,"./json-rpc-provider":57}],59:[function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var a=t("../constants"),u=o(t("../errors")),c=t("./address"),l=t("./bignumber"),h=t("./bytes"),f=t("./utf8"),d=t("./properties"),p=new RegExp(/^bytes([0-9]*)$/),m=new RegExp(/^(u?int)([0-9]*)$/),y=new RegExp(/^(.*)\[([0-9]*)\]$/);r.defaultCoerceFunc=function(t,e){return(t=t.match(m))&&parseInt(t[2])<=48?e.toNumber():e};var g=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$"),v=new RegExp("^[A-Za-z_][A-Za-z0-9_]*$");function b(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}function w(t,e){var r=t;function n(t){throw new Error('unexpected character "'+r[t]+'" at position '+t+' in "'+r+'"')}t=t.replace(/\s/g," ");for(var i={type:"",name:"",state:{allowType:!0}},o=i,a=0;a<t.length;a++){var s=t[a];switch(s){case"(":o.state.allowParams||n(a),o.state.allowType=!1,o.type=b(o.type),o.components=[{type:"",name:"",parent:o,state:{allowType:!0}}],o=o.components[0];break;case")":delete o.state,e&&"indexed"===o.name&&(o.indexed=!0,o.name=""),o.type=b(o.type);var u=o;(o=o.parent)||n(a),delete u.parent,o.state.allowParams=!1,o.state.allowName=!0,o.state.allowArray=!0;break;case",":delete o.state,e&&"indexed"===o.name&&(o.indexed=!0,o.name=""),o.type=b(o.type),u={type:"",name:"",parent:o.parent,state:{allowType:!0}},o.parent.components.push(u),delete o.parent,o=u;break;case" ":o.state.allowType&&""!==o.type&&(o.type=b(o.type),delete o.state.allowType,o.state.allowName=!0,o.state.allowParams=!0),o.state.allowName&&""!==o.name&&(e&&"indexed"===o.name?(o.indexed=!0,o.name=""):o.state.allowName=!1);break;case"[":o.state.allowArray||n(a),o.type+=s,o.state.allowArray=!1,o.state.allowName=!1,o.state.readArray=!0;break;case"]":o.state.readArray||n(a),o.type+=s,o.state.readArray=!1,o.state.allowArray=!0,o.state.allowName=!0;break;default:o.state.allowType?(o.type+=s,o.state.allowParams=!0,o.state.allowArray=!0):o.state.allowName?(o.name+=s,delete o.state.allowArray):o.state.readArray?o.type+=s:n(a)}}if(o.parent)throw new Error("unexpected eof");return delete i.state,e&&"indexed"===o.name&&(o.indexed=!0,o.name=""),i.type=b(i.type),i}function _(t){return ot(r.defaultCoerceFunc,t).type}function k(t,e,r,n,i){this.coerceFunc=t,this.name=e,this.type=r,this.localName=n,this.dynamic=i}r.parseParamType=function(t){return w(t,!0)},r.formatParamType=_,r.formatSignature=function(t){return t.name+"("+t.inputs.map(_).join(",")+")"},r.parseSignature=function(t){if("string"==typeof t)return"event "===(t=(t=(t=t.replace(/\s/g," ")).replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," ")).trim()).substring(0,6)?function(t){var e={anonymous:!1,inputs:[],name:"",type:"event"},r=t.match(g);if(!r)throw new Error("invalid event: "+t);if(e.name=r[1].trim(),nt(r[2]).forEach((function(t){(t=w(t,!0)).indexed=!!t.indexed,e.inputs.push(t)})),r[3].split(" ").forEach((function(t){switch(t){case"anonymous":e.anonymous=!0;break;case"":break;default:u.info("unknown modifier: "+t)}})),e.name&&!e.name.match(v))throw new Error('invalid identifier: "'+e.name+'"');return e}(t.substring(6).trim()):function(t){var e={constant:!1,gas:null,inputs:[],name:"",outputs:[],payable:!1,stateMutability:null,type:"function"},r=t.split("@");if(1!==r.length){if(2<r.length)throw new Error("invalid signature");if(!r[1].match(/^[0-9]+$/))throw new Error("invalid signature gas");e.gas=l.bigNumberify(r[1]),t=r[0]}if(!(t=(r=t.split(" returns "))[0].match(g)))throw new Error("invalid signature");if(e.name=t[1].trim(),!e.name.match(v))throw new Error('invalid identifier: "'+t[1]+'"');if(nt(t[2]).forEach((function(t){e.inputs.push(w(t))})),t[3].split(" ").forEach((function(t){switch(t){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:u.info("unknown modifier: "+t)}})),1<r.length){if(""!=(r=r[1].match(g))[1].trim()||""!=r[3].trim())throw new Error("unexpected tokens");nt(r[2]).forEach((function(t){e.outputs.push(w(t))}))}if("constructor"===e.name){if(e.type="constructor",e.outputs.length)throw new Error("constructor may not have outputs");delete e.name,delete e.outputs}return e}((t="function "===t.substring(0,9)?t.substring(9):t).trim());throw new Error("unknown signature")};var x,A=(i(E,x=k),E.prototype.encode=function(t){return this.coder.encode(t)},E.prototype.decode=function(t,e){return this.coder.decode(t,e)},E);function E(t){var e=x.call(this,t.coerceFunc,t.name,t.type,void 0,t.dynamic)||this;return d.defineReadOnly(e,"coder",t),e}var S,I=(i(M,S=k),M.prototype.encode=function(t){return h.arrayify([])},M.prototype.decode=function(t,e){if(e>t.length)throw new Error("invalid null");return{consumed:0,value:this.coerceFunc("null",void 0)}},M);function M(t,e){return S.call(this,t,"null","",e,!1)||this}var T,P=(i(C,T=k),C.prototype.encode=function(t){try{var e=l.bigNumberify(t);if(this.signed){var r=a.MaxUint256.maskn(8*this.size-1);if(e.gt(r))throw new Error("out-of-bounds");if(r=r.add(a.One).mul(a.NegativeOne),e.lt(r))throw new Error("out-of-bounds")}else if(e.lt(a.Zero)||e.gt(a.MaxUint256.maskn(8*this.size)))throw new Error("out-of-bounds");return e=e.toTwos(8*this.size).maskn(8*this.size),this.signed&&(e=e.fromTwos(8*this.size).toTwos(256)),h.padZeros(h.arrayify(e),32)}catch(e){u.throwError("invalid number value",u.INVALID_ARGUMENT,{arg:this.localName,coderType:this.name,value:t})}return null},C.prototype.decode=function(t,e){t.length<e+32&&u.throwError("insufficient data for "+this.name+" type",u.INVALID_ARGUMENT,{arg:this.localName,coderType:this.name,value:h.hexlify(t.slice(e,e+32))});var r=32-this.size;return e=l.bigNumberify(t.slice(e+r,e+32)),e=this.signed?e.fromTwos(8*this.size):e.maskn(8*this.size),{consumed:32,value:this.coerceFunc(this.name,e)}},C);function C(t,e,r,n){var i=this,o=(r?"int":"uint")+8*e;return(i=T.call(this,t,o,o,n,!1)||this).size=e,i.signed=r,i}var O,R=new P((function(t,e){return e}),32,!1,"none"),N=(i(j,O=k),j.prototype.encode=function(t){return R.encode(t?1:0)},j.prototype.decode=function(t,e){try{var r=R.decode(t,e)}catch(t){throw"insufficient data for uint256 type"===t.reason&&u.throwError("insufficient data for boolean type",u.INVALID_ARGUMENT,{arg:this.localName,coderType:"boolean",value:t.value}),t}return{consumed:r.consumed,value:this.coerceFunc("bool",!r.value.isZero())}},j);function j(t,e){return O.call(this,t,"bool","bool",e,!1)||this}var L,U=(i(D,L=k),D.prototype.encode=function(t){var e=new Uint8Array(32);try{var r=h.arrayify(t);if(r.length!==this.length)throw new Error("incorrect data length");e.set(r)}catch(e){u.throwError("invalid "+this.name+" value",u.INVALID_ARGUMENT,{arg:this.localName,coderType:this.name,value:e.value||t})}return e},D.prototype.decode=function(t,e){return t.length<e+32&&u.throwError("insufficient data for "+this.name+" type",u.INVALID_ARGUMENT,{arg:this.localName,coderType:this.name,value:h.hexlify(t.slice(e,e+32))}),{consumed:32,value:this.coerceFunc(this.name,h.hexlify(t.slice(e,e+this.length)))}},D);function D(t,e,r){var n=this,i="bytes"+e;return(n=L.call(this,t,i,i,r,!1)||this).length=e,n}var B,z,F,H=(i(q,B=k),q.prototype.encode=function(t){var e=new Uint8Array(32);try{e.set(h.arrayify(c.getAddress(t)),12)}catch(e){u.throwError("invalid address",u.INVALID_ARGUMENT,{arg:this.localName,coderType:"address",value:t})}return e},q.prototype.decode=function(t,e){return t.length<e+32&&u.throwError("insufficient data for address type",u.INVALID_ARGUMENT,{arg:this.localName,coderType:"address",value:h.hexlify(t.slice(e,e+32))}),{consumed:32,value:this.coerceFunc("address",c.getAddress(h.hexlify(t.slice(e+12,e+32))))}},q);function q(t,e){return B.call(this,t,"address","address",e,!1)||this}function G(t){var e=32*Math.ceil(t.length/32);return e=new Uint8Array(e-t.length),h.concat([R.encode(t.length),t,e])}function V(t,e,r){t.length<e+32&&u.throwError("insufficient data for dynamicBytes length",u.INVALID_ARGUMENT,{arg:r,coderType:"dynamicBytes",value:h.hexlify(t.slice(e,e+32))});var n=R.decode(t,e).value;try{n=n.toNumber()}catch(t){u.throwError("dynamic bytes count too large",u.INVALID_ARGUMENT,{arg:r,coderType:"dynamicBytes",value:n.toString()})}return t.length<e+32+n&&u.throwError("insufficient data for dynamicBytes type",u.INVALID_ARGUMENT,{arg:r,coderType:"dynamicBytes",value:h.hexlify(t.slice(e,e+32+n))}),{consumed:32+32*Math.ceil(n/32),value:t.slice(e+32,e+32+n)}}function K(t,e){return z.call(this,t,"bytes","bytes",e,!0)||this}function Z(t,e){return F.call(this,t,"string","string",e,!0)||this}function W(t){return 32*Math.ceil(t/32)}function J(t,e){var r;Array.isArray(e)||(e&&"object"==s(e)?(r=[],t.forEach((function(t){r.push(e[t.localName])})),e=r):u.throwError("invalid tuple value",u.INVALID_ARGUMENT,{coderType:"tuple",value:e})),t.length!==e.length&&u.throwError("types/value length mismatch",u.INVALID_ARGUMENT,{coderType:"tuple",value:e});var n=[];t.forEach((function(t,r){n.push({dynamic:t.dynamic,value:t.encode(e[r])})}));var i=0,o=0;n.forEach((function(t){t.dynamic?(i+=32,o+=W(t.value.length)):i+=W(t.value.length)}));var a=0,c=i,l=new Uint8Array(i+o);return n.forEach((function(t){t.dynamic?(l.set(R.encode(c),a),a+=32,l.set(t.value,c),c+=W(t.value.length)):(l.set(t.value,a),a+=W(t.value.length))})),l}function Q(t,e,r){var n=r,i=0,o=[];return t.forEach((function(t){var a,s;t.dynamic?(a=R.decode(e,r),(s=t.decode(e,n+a.value.toNumber())).consumed=a.consumed):s=t.decode(e,r),null!=s.value&&o.push(s.value),r+=s.consumed,i+=s.consumed})),t.forEach((function(t,e){(t=t.localName)&&null==o[t="length"===t?"_length":t]&&(o[t]=o[e])})),{value:o,consumed:i}}i(K,z=k),K.prototype.encode=function(t){try{return G(h.arrayify(t))}catch(t){u.throwError("invalid bytes value",u.INVALID_ARGUMENT,{arg:this.localName,coderType:"bytes",value:t.value})}return null},K.prototype.decode=function(t,e){return(e=V(t,e,this.localName)).value=this.coerceFunc("bytes",h.hexlify(e.value)),e},o=K,i(Z,F=k),Z.prototype.encode=function(t){return"string"!=typeof t&&u.throwError("invalid string value",u.INVALID_ARGUMENT,{arg:this.localName,coderType:"string",value:t}),G(f.toUtf8Bytes(t))},Z.prototype.decode=function(t,e){return(e=V(t,e,this.localName)).value=this.coerceFunc("string",f.toUtf8String(e.value)),e},t=Z;var $,Y=(i(X,$=k),X.prototype.encode=function(t){Array.isArray(t)||u.throwError("expected array value",u.INVALID_ARGUMENT,{arg:this.localName,coderType:"array",value:t});var e=this.length,r=new Uint8Array(0);-1===e&&(e=t.length,r=R.encode(e)),u.checkArgumentCount(e,t.length," in coder array"+(this.localName?" "+this.localName:""));for(var n=[],i=0;i<t.length;i++)n.push(this.coder);return h.concat([r,J(n,t)])},X.prototype.decode=function(t,e){var r=0,n=this.length;if(-1===n){try{var i=R.decode(t,e)}catch(t){u.throwError("insufficient data for dynamic array length",u.INVALID_ARGUMENT,{arg:this.localName,coderType:"array",value:t.value})}try{n=i.value.toNumber()}catch(t){u.throwError("array count too large",u.INVALID_ARGUMENT,{arg:this.localName,coderType:"array",value:i.value.toString()})}r+=i.consumed,e+=i.consumed}for(var o=[],a=0;a<n;a++)o.push(new A(this.coder));return(e=Q(o,t,e)).consumed+=r,e.value=this.coerceFunc(this.type,e.value),e},X);function X(t,e,r,n){var i=this,o=e.type+"["+(0<=r?r:"")+"]",a=-1===r||e.dynamic;return(i=$.call(this,t,"array",o,n,a)||this).coder=e,i.length=r,i}var tt,et=(i(rt,tt=k),rt.prototype.encode=function(t){return J(this.coders,t)},rt.prototype.decode=function(t,e){return(e=Q(this.coders,t,e)).value=this.coerceFunc(this.type,e.value),e},rt);function rt(t,e,r){var n=this,i=!1,o=[];e.forEach((function(t){t.dynamic&&(i=!0),o.push(t.type)}));var a="tuple("+o.join(",")+")";return(n=tt.call(this,t,"tuple",a,r,i)||this).coders=e,n}function nt(t){t=t.trim();for(var e=[],r="",n=0,i=0;i<t.length;i++){var o=t[i];if(","===o&&0===n)e.push(r),r="";else if(r+=o,"("===o)n++;else if(")"===o&&-1==--n)throw new Error("unbalanced parenthsis")}return r&&e.push(r),e}var it={address:H,bool:N,string:t,bytes:o};function ot(t,e){var r,n,i;if(i=it[e.type])return new i(t,e.name);if(i=e.type.match(m))return(0===(o=parseInt(i[2]||"256"))||256<o||o%8!=0)&&u.throwError("invalid "+i[1]+" bit length",u.INVALID_ARGUMENT,{arg:"param",value:e}),new P(t,o/8,"int"===i[1],e.name);if(i=e.type.match(p))return(0===(o=parseInt(i[1]))||32<o)&&u.throwError("invalid bytes length",u.INVALID_ARGUMENT,{arg:"param",value:e}),new U(t,o,e.name);if(i=e.type.match(y)){var o=parseInt(i[2]||"-1");return(e=d.shallowCopy(e)).type=i[1],e=d.deepCopy(e),new Y(t,ot(t,e),o,e.name)}return"tuple"===e.type.substring(0,5)?(r=t,i=e.components,o=e.name,n=[],(i=i||[]).forEach((function(t){n.push(ot(r,t))})),new et(r,n,o)):""===e.type?new I(t,e.name):(u.throwError("invalid type",u.INVALID_ARGUMENT,{arg:"type",value:e.type}),null)}function at(t){u.checkNew(this,at),t=t||r.defaultCoerceFunc,d.defineReadOnly(this,"coerceFunc",t)}at.prototype.encode=function(t,e){t.length!==e.length&&u.throwError("types/values length mismatch",u.INVALID_ARGUMENT,{count:{types:t.length,values:e.length},value:{types:t,values:e}});var r=[];return t.forEach((function(t){var e="string"==typeof t?w(t):t;r.push(ot(this.coerceFunc,e))}),this),h.hexlify(new et(this.coerceFunc,r,"_").encode(e))},at.prototype.decode=function(t,e){var r=[];return t.forEach((function(t){var e="string"==typeof t?w(t):d.deepCopy(t);r.push(ot(this.coerceFunc,e))}),this),new et(this.coerceFunc,r,"_").decode(h.arrayify(e),0).value},o=at,r.AbiCoder=o,r.defaultAbiCoder=new o},{"../constants":3,"../errors":5,"./address":60,"./bignumber":63,"./bytes":64,"./properties":74,"./utf8":85}],60:[function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:!0});var i=n(t("bn.js")),o=t("./bytes"),a=t("./keccak256"),s=t("./rlp"),u=t("../errors");function c(t){"string"==typeof t&&t.match(/^0x[0-9A-Fa-f]{40}$/)||u.throwError("invalid address",u.INVALID_ARGUMENT,{arg:"address",value:t});for(var e=(t=t.toLowerCase()).substring(2).split(""),r=new Uint8Array(40),n=0;n<40;n++)r[n]=e[n].charCodeAt(0);r=o.arrayify(a.keccak256(r));for(var i=0;i<40;i+=2)8<=r[i>>1]>>4&&(e[i]=e[i].toUpperCase()),8<=(15&r[i>>1])&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}for(var l={},h=0;h<10;h++)l[String(h)]=String(h);for(h=0;h<26;h++)l[String.fromCharCode(65+h)]=String(10+h);var f,d=Math.floor((f=9007199254740991,Math.log10?Math.log10(f):Math.log(f)/Math.LN10));function p(t){t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00";var e="";for(t.split("").forEach((function(t){e+=l[t]}));e.length>=d;){var r=e.substring(0,d);e=parseInt(r,10)%97+e.substring(r.length)}for(var n=String(98-parseInt(e,10)%97);n.length<2;)n="0"+n;return n}function m(t){var e=null;if("string"!=typeof t&&u.throwError("invalid address",u.INVALID_ARGUMENT,{arg:"address",value:t}),t.match(/^(0x)?[0-9a-fA-F]{40}$/))e=c(t="0x"!==t.substring(0,2)?"0x"+t:t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&u.throwError("bad address checksum",u.INVALID_ARGUMENT,{arg:"address",value:t});else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==p(t)&&u.throwError("bad icap checksum",u.INVALID_ARGUMENT,{arg:"address",value:t}),e=new i.default.BN(t.substring(4),36).toString(16);e.length<40;)e="0"+e;e=c("0x"+e)}else u.throwError("invalid address",u.INVALID_ARGUMENT,{arg:"address",value:t});return e}r.getAddress=m,r.getIcapAddress=function(t){for(var e=new i.default.BN(m(t).substring(2),16).toString(36).toUpperCase();e.length<30;)e="0"+e;return"XE"+p("XE00"+e)+e},r.getContractAddress=function(t){if(!t.from)throw new Error("missing from address");var e=t.nonce;return m("0x"+a.keccak256(s.encode([m(t.from),o.stripZeros(o.hexlify(e))])).substring(26))},r.getCreate2Address=function(t){var e=t.initCodeHash;t.initCode&&(e?a.keccak256(t.initCode)!==e&&u.throwError("initCode/initCodeHash mismatch",u.INVALID_ARGUMENT,{arg:"options",value:t}):e=a.keccak256(t.initCode)),e||u.throwError("missing initCode or initCodeHash",u.INVALID_ARGUMENT,{arg:"options",value:t});var r=m(t.from),n=o.arrayify(t.salt);return 32!==n.length&&u.throwError("invalid salt",u.INVALID_ARGUMENT,{arg:"options",value:t}),m("0x"+a.keccak256(o.concat(["0xff",r,n,e])).substring(26))}},{"../errors":5,"./bytes":64,"./keccak256":71,"./rlp":76,"bn.js":9}],61:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("../utils/bytes");e.exports={decode:function(t){t=atob(t);for(var e=[],r=0;r<t.length;r++)e.push(t.charCodeAt(r));return n.arrayify(e)},encode:function(t){t=n.arrayify(t);for(var e="",r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}}},{"../utils/bytes":64}],62:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./bytes"),i=t("./properties"),o=(a.prototype.encode=function(t){var e=n.arrayify(t);if(0===e.length)return"";for(var r=[0],i=0;i<e.length;++i){for(var o=e[i],a=0;a<r.length;++a)o+=r[a]<<8,r[a]=o%this.base,o=o/this.base|0;for(;0<o;)r.push(o%this.base),o=o/this.base|0}for(var s="",u=0;0===e[u]&&u<e.length-1;++u)s+=this._leader;for(var c=r.length-1;0<=c;--c)s+=this.alphabet[r[c]];return s},a.prototype.decode=function(t){if("string"!=typeof t)throw new TypeError("Expected String");var e=[];if(0===t.length)return new Uint8Array(e);e.push(0);for(var r=0;r<t.length;r++){var i=this._alphabetMap[t[r]];if(void 0===i)throw new Error("Non-base"+this.base+" character");for(var o=i,a=0;a<e.length;++a)o+=e[a]*this.base,e[a]=255&o,o>>=8;for(;0<o;)e.push(255&o),o>>=8}for(var s=0;t[s]===this._leader&&s<t.length-1;++s)e.push(0);return n.arrayify(new Uint8Array(e.reverse()))},a);function a(t){i.defineReadOnly(this,"alphabet",t),i.defineReadOnly(this,"base",t.length),i.defineReadOnly(this,"_alphabetMap",{}),i.defineReadOnly(this,"_leader",t.charAt(0));for(var e=0;e<t.length;e++)this._alphabetMap[t.charAt(e)]=e}t=new(r.BaseX=o)("abcdefghijklmnopqrstuvwxyz234567"),r.Base32=t,o=new o("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),r.Base58=o},{"./bytes":64,"./properties":74}],63:[function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var o=n(t("bn.js")),a=t("./bytes"),s=t("./properties"),u=i(t("../errors")),c=new o.default.BN(-1);function l(t){return"-"===(t=t.toString(16))[0]?t.length%2==0?"-0x0"+t.substring(1):"-0x"+t.substring(1):t.length%2==1?"0x0"+t:"0x"+t}function h(t){return d(y(t))}function f(t){return new p(l(t))}function d(t){return"-"===(t=t._hex)[0]?new o.default.BN(t.substring(3),16).mul(c):new o.default.BN(t.substring(2),16)}var p=(m.prototype.fromTwos=function(t){return f(d(this).fromTwos(t))},m.prototype.toTwos=function(t){return f(d(this).toTwos(t))},m.prototype.abs=function(){return"-"===this._hex[0]?f(d(this).mul(c)):this},m.prototype.add=function(t){return f(d(this).add(h(t)))},m.prototype.sub=function(t){return f(d(this).sub(h(t)))},m.prototype.div=function(t){return y(t).isZero()&&u.throwError("division by zero",u.NUMERIC_FAULT,{operation:"divide",fault:"division by zero"}),f(d(this).div(h(t)))},m.prototype.mul=function(t){return f(d(this).mul(h(t)))},m.prototype.mod=function(t){return f(d(this).mod(h(t)))},m.prototype.pow=function(t){return f(d(this).pow(h(t)))},m.prototype.maskn=function(t){return f(d(this).maskn(t))},m.prototype.eq=function(t){return d(this).eq(h(t))},m.prototype.lt=function(t){return d(this).lt(h(t))},m.prototype.lte=function(t){return d(this).lte(h(t))},m.prototype.gt=function(t){return d(this).gt(h(t))},m.prototype.gte=function(t){return d(this).gte(h(t))},m.prototype.isZero=function(){return d(this).isZero()},m.prototype.toNumber=function(){try{return d(this).toNumber()}catch(t){u.throwError("overflow",u.NUMERIC_FAULT,{operation:"setValue",fault:"overflow",details:t.message})}return null},m.prototype.toString=function(){return d(this).toString(10)},m.prototype.toHexString=function(){return this._hex},m.isBigNumber=function(t){return s.isType(t,"BigNumber")},m);function m(t){if(u.checkNew(this,m),s.setType(this,"BigNumber"),"string"==typeof t)a.isHexString(t)?s.defineReadOnly(this,"_hex",t="0x"==t?"0x0":t):"-"===t[0]&&a.isHexString(t.substring(1))?s.defineReadOnly(this,"_hex",t):t.match(/^-?[0-9]*$/)?s.defineReadOnly(this,"_hex",l(new o.default.BN(t=""==t?"0":t))):u.throwError("invalid BigNumber string value",u.INVALID_ARGUMENT,{arg:"value",value:t});else if("number"==typeof t){parseInt(String(t))!==t&&u.throwError("underflow",u.NUMERIC_FAULT,{operation:"setValue",fault:"underflow",value:t,outputValue:parseInt(String(t))});try{s.defineReadOnly(this,"_hex",l(new o.default.BN(t)))}catch(t){u.throwError("overflow",u.NUMERIC_FAULT,{operation:"setValue",fault:"overflow",details:t.message})}}else t instanceof m?s.defineReadOnly(this,"_hex",t._hex):t.toHexString?s.defineReadOnly(this,"_hex",l(h(t.toHexString()))):t._hex&&a.isHexString(t._hex)?s.defineReadOnly(this,"_hex",t._hex):a.isArrayish(t)?s.defineReadOnly(this,"_hex",l(new o.default.BN(a.hexlify(t).substring(2),16))):u.throwError("invalid BigNumber value",u.INVALID_ARGUMENT,{arg:"value",value:t})}function y(t){return p.isBigNumber(t)?t:new p(t)}r.BigNumber=p,r.bigNumberify=y},{"../errors":5,"./bytes":64,"./properties":74,"bn.js":9}],64:[function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var i=n(t("../errors"));function o(t){return!!t.toHexString}function a(t){return t.slice||(t.slice=function(){var e=Array.prototype.slice.call(arguments);return a(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function u(t){if(!t||parseInt(String(t.length))!=t.length||"string"==typeof t)return!1;for(var e=0;e<t.length;e++){var r=t[e];if(r<0||256<=r||parseInt(String(r))!=r)return!1}return!0}function c(t){if(null==t&&i.throwError("cannot convert null value to array",i.INVALID_ARGUMENT,{arg:"value",value:t}),"string"!=typeof(t=o(t)?t.toHexString():t))return u(t)?a(new Uint8Array(t)):(i.throwError("invalid arrayify value",null,{arg:"value",value:t,type:s(t)}),null);var e=t.match(/^(0x)?[0-9a-fA-F]*$/);e||i.throwError("invalid hexidecimal string",i.INVALID_ARGUMENT,{arg:"value",value:t}),"0x"!==e[1]&&i.throwError("hex string must have 0x prefix",i.INVALID_ARGUMENT,{arg:"value",value:t}),(t=t.substring(2)).length%2&&(t="0"+t);for(var r=[],n=0;n<t.length;n+=2)r.push(parseInt(t.substr(n,2),16));return a(new Uint8Array(r))}function l(t){for(var e=[],r=0,n=0;n<t.length;n++){var i=c(t[n]);e.push(i),r+=i.length}var o=new Uint8Array(r),s=0;for(n=0;n<e.length;n++)o.set(e[n],s),s+=e[n].length;return a(o)}function h(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}r.isHexable=o,r.isArrayish=u,r.arrayify=c,r.concat=l,r.stripZeros=function(t){var e=c(t);if(0===e.length)return e;for(var r=0;0===e[r];)r++;return r?e.slice(r):e},r.padZeros=function(t,e){if(e<(t=c(t)).length)throw new Error("cannot pad");var r=new Uint8Array(e);return r.set(t,e-t.length),a(r)},r.isHexString=h;var f="0123456789abcdef";function d(t){if(o(t))return t.toHexString();if("number"==typeof t){t<0&&i.throwError("cannot hexlify negative value",i.INVALID_ARGUMENT,{arg:"value",value:t}),9007199254740991<=t&&i.throwError("out-of-range",i.NUMERIC_FAULT,{operartion:"hexlify",fault:"out-of-safe-range"});for(var e="";t;)e=f[15&t]+e,t=Math.floor(t/16);return e.length?"0x"+(e=e.length%2?"0"+e:e):"0x00"}if("string"==typeof t){var r=t.match(/^(0x)?[0-9a-fA-F]*$/);return r||i.throwError("invalid hexidecimal string",i.INVALID_ARGUMENT,{arg:"value",value:t}),"0x"!==r[1]&&i.throwError("hex string must have 0x prefix",i.INVALID_ARGUMENT,{arg:"value",value:t}),t.length%2?"0x0"+t.substring(2):t}if(u(t)){for(var n=[],a=0;a<t.length;a++){var s=t[a];n.push(f[(240&s)>>4]+f[15&s])}return"0x"+n.join("")}return i.throwError("invalid hexlify value",null,{arg:"value",value:t}),"never"}function p(t,e){for(h(t)||i.throwError("invalid hex string",i.INVALID_ARGUMENT,{arg:"value",value:t});t.length<2*e+2;)t="0x0"+t.substring(2);return t}function m(t){var e=0,r="0x",n="0x";if((o=t)&&null!=o.r&&null!=o.s){null==t.v&&null==t.recoveryParam&&i.throwError("at least on of recoveryParam or v must be specified",i.INVALID_ARGUMENT,{argument:"signature",value:t}),r=p(t.r,32),n=p(t.s,32),"string"==typeof(e=t.v)&&(e=parseInt(e,16));var o=t.recoveryParam;e=27+(o=null==o&&null!=t.v?1-e%2:o)}else{if(65!==(t=c(t)).length)throw new Error("invalid signature");r=d(t.slice(0,32)),n=d(t.slice(32,64)),27!==(e=t[64])&&28!==e&&(e=27+e%2)}return{r:r,s:n,recoveryParam:e-27,v:e}}r.hexlify=d,r.hexDataLength=function(t){return h(t)&&t.length%2==0?(t.length-2)/2:null},r.hexDataSlice=function(t,e,r){return h(t)||i.throwError("invalid hex data",i.INVALID_ARGUMENT,{arg:"value",value:t}),t.length%2!=0&&i.throwError("hex data length must be even",i.INVALID_ARGUMENT,{arg:"value",value:t}),e=2+2*e,null!=r?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)},r.hexStripZeros=function(t){for(h(t)||i.throwError("invalid hex string",i.INVALID_ARGUMENT,{arg:"value",value:t});3<t.length&&"0x0"===t.substring(0,3);)t="0x"+t.substring(3);return t},r.hexZeroPad=p,r.splitSignature=m,r.joinSignature=function(t){return d(l([(t=m(t)).r,t.s,t.recoveryParam?"0x1c":"0x1b"]))}},{"../errors":5}],65:[function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var i=n(t("../errors")),o=t("./bytes"),a=t("./utf8"),s=t("./keccak256"),u=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),c=new RegExp("^((.*)\\.)?([^.]+)$"),l=new RegExp("^[a-z0-9.-]*$");r.namehash=function(t){"string"!=typeof t&&i.throwError("invalid address - "+String(t),i.INVALID_ARGUMENT,{argument:"name",value:t}),(t=t.toLowerCase()).match(l)||i.throwError("contains invalid UseSTD3ASCIIRules characters",i.INVALID_ARGUMENT,{argument:"name",value:t});for(var e=u;t.length;){var r=t.match(c),n=a.toUtf8Bytes(r[3]);e=s.keccak256(o.concat([e,s.keccak256(n)])),t=r[2]||""}return o.hexlify(e)},r.id=function(t){return s.keccak256(a.toUtf8Bytes(t))},r.hashMessage=function(t){return s.keccak256(o.concat([a.toUtf8Bytes("Ethereum Signed Message:\n"),a.toUtf8Bytes(String(t.length)),"string"==typeof t?a.toUtf8Bytes(t):t]))}},{"../errors":5,"./bytes":64,"./keccak256":71,"./utf8":85}],66:[function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var i=n(t("../errors")),o=t("../wordlists/lang-en"),a=t("./basex"),s=t("./bytes"),u=t("./bignumber"),c=t("./utf8"),l=t("./pbkdf2"),h=t("./hmac"),f=t("./properties"),d=t("./secp256k1"),p=t("./sha2"),m=u.bigNumberify("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),y=c.toUtf8Bytes("Bitcoin seed"),g=2147483648;function v(t){return(1<<t)-1<<8-t}function b(t){return s.hexZeroPad(s.hexlify(t),32)}function w(t){var e=s.hexDataSlice(p.sha256(p.sha256(t)),0,4);return a.Base58.encode(s.concat([t,e]))}var _={};r.defaultPath="m/44'/60'/0'/0/0";var k=(Object.defineProperty(x.prototype,"extendedKey",{get:function(){if(256<=this.depth)throw new Error("Depth too large!");return w(s.concat([null!=this.privateKey?"0x0488ADE4":"0x0488B21E",s.hexlify(this.depth),this.parentFingerprint,s.hexZeroPad(s.hexlify(this.index),4),this.chainCode,null!=this.privateKey?s.concat(["0x00",this.privateKey]):this.publicKey]))},enumerable:!0,configurable:!0}),x.prototype.neuter=function(){return new x(_,null,this.publicKey,this.parentFingerprint,this.chainCode,this.index,this.depth,null,this.path)},x.prototype._derive=function(t){if(4294967295<t)throw new Error("invalid index - "+String(t));var e=this.path;e&&(e+="/"+(t&~g));var r=new Uint8Array(37);if(t&g){if(!this.privateKey)throw new Error("cannot derive child of neutered node");r.set(s.arrayify(this.privateKey),1),e&&(e+="'")}else r.set(s.arrayify(this.publicKey));for(var n=24;0<=n;n-=8)r[33+(n>>3)]=t>>24-n&255;var i=(c=h.computeHmac(h.SupportedAlgorithms.sha512,this.chainCode,r)).slice(0,32),o=c.slice(32),a=null,c=null;return this.privateKey?a=b(u.bigNumberify(i).add(this.privateKey).mod(m)):c=new d.KeyPair(s.hexlify(i))._addPoint(this.publicKey),new x(_,a,c,this.fingerprint,b(o),t,this.depth+1,this.mnemonic,e)},x.prototype.derivePath=function(t){var e=t.split("/");if(0===e.length||"m"===e[0]&&0!==this.depth)throw new Error("invalid path - "+t);"m"===e[0]&&e.shift();for(var r=this,n=0;n<e.length;n++){var i=e[n];if(i.match(/^[0-9]+'$/)){var o=parseInt(i.substring(0,i.length-1));if(g<=o)throw new Error("invalid path index - "+i);r=r._derive(g+o)}else{if(!i.match(/^[0-9]+$/))throw new Error("invalid path component - "+i);if(o=parseInt(i),g<=o)throw new Error("invalid path index - "+i);r=r._derive(o)}}return r},x.isHDNode=function(t){return f.isType(t,"HDNode")},x);function x(t,e,r,n,o,a,u,c,l){if(i.checkNew(this,x),t!==_)throw new Error("HDNode constructor cannot be called directly");e?(e=new d.KeyPair(e),f.defineReadOnly(this,"privateKey",e.privateKey),f.defineReadOnly(this,"publicKey",e.compressedPublicKey)):(f.defineReadOnly(this,"privateKey",null),f.defineReadOnly(this,"publicKey",s.hexlify(r))),f.defineReadOnly(this,"parentFingerprint",n),f.defineReadOnly(this,"fingerprint",s.hexDataSlice(p.ripemd160(p.sha256(this.publicKey)),0,4)),f.defineReadOnly(this,"address",d.computeAddress(this.publicKey)),f.defineReadOnly(this,"chainCode",o),f.defineReadOnly(this,"index",a),f.defineReadOnly(this,"depth",u),f.defineReadOnly(this,"mnemonic",c),f.defineReadOnly(this,"path",l),f.setType(this,"HDNode")}function A(t,e){if((t=s.arrayify(t)).length<16||64<t.length)throw new Error("invalid seed");return t=s.arrayify(h.computeHmac(h.SupportedAlgorithms.sha512,y,t)),new k(_,b(t.slice(0,32)),null,"0x00000000",b(t.slice(32)),0,0,e,"m")}function E(t,e){return e=c.toUtf8Bytes("mnemonic"+(e=e||""),c.UnicodeNormalizationForm.NFKD),s.hexlify(l.pbkdf2(c.toUtf8Bytes(t,c.UnicodeNormalizationForm.NFKD),e,2048,64,"sha512"))}function S(t,e){e=e||o.langEn,i.checkNormalize();var r=e.split(t);if(r.length%3!=0)throw new Error("invalid mnemonic");for(var n=s.arrayify(new Uint8Array(Math.ceil(11*r.length/8))),a=0,u=0;u<r.length;u++){var c=e.getWordIndex(r[u].normalize("NFKD"));if(-1===c)throw new Error("invalid mnemonic");for(var l=0;l<11;l++)c&1<<10-l&&(n[a>>3]|=1<<7-a%8),a++}var h=32*r.length/3,f=v(r.length/3);if(t=s.arrayify(p.sha256(n.slice(0,h/8)))[0],(t&=f)!=(n[n.length-1]&f))throw new Error("invalid checksum");return s.hexlify(n.slice(0,h/8))}function I(t,e){if((t=s.arrayify(t)).length%4!=0||t.length<16||32<t.length)throw new Error("invalid entropy");for(var r=[0],n=11,i=0;i<t.length;i++)8<n?(r[r.length-1]<<=8,r[r.length-1]|=t[i],n-=8):(r[r.length-1]<<=n,r[r.length-1]|=t[i]>>8-n,r.push(t[i]&(1<<8-n)-1),n+=3);var a=s.arrayify(p.sha256(t))[0],u=t.length/4;return a&=v(u),r[r.length-1]<<=u,r[r.length-1]|=a>>8-u,(e=e||o.langEn).join(r.map((function(t){return e.getWord(t)})))}r.HDNode=k,r.fromExtendedKey=function(t){var e=a.Base58.decode(t);82===e.length&&w(e.slice(0,78))===t||i.throwError("invalid extended key",i.INVALID_ARGUMENT,{argument:"extendedKey",value:"[REDACTED]"});var r=e[4],n=s.hexlify(e.slice(5,9)),o=parseInt(s.hexlify(e.slice(9,13)).substring(2),16),u=s.hexlify(e.slice(13,45)),c=e.slice(45,78);switch(s.hexlify(e.slice(0,4))){case"0x0488b21e":case"0x043587cf":return new k(_,null,s.hexlify(c),n,u,o,r,null,null);case"0x0488ade4":case"0x04358394":if(0!==c[0])break;return new k(_,s.hexlify(c.slice(1)),null,n,u,o,r,null,null)}return i.throwError("invalid extended key",i.INVALID_ARGUMENT,{argument:"extendedKey",value:"[REDACTED]"})},r.fromMnemonic=function(t,e,r){return A(E(t=I(S(t,e),e),r),t)},r.fromSeed=function(t){return A(t,null)},r.mnemonicToSeed=E,r.mnemonicToEntropy=S,r.entropyToMnemonic=I,r.isValidMnemonic=function(t,e){try{return S(t,e),!0}catch(t){}return!1}},{"../errors":5,"../wordlists/lang-en":90,"./basex":62,"./bignumber":63,"./bytes":64,"./hmac":67,"./pbkdf2":73,"./properties":74,"./secp256k1":77,"./sha2":79,"./utf8":85}],67:[function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var i,o=n(t("hash.js")),a=t("../utils/bytes"),s=n(t("../errors"));(t=i=r.SupportedAlgorithms||(r.SupportedAlgorithms={})).sha256="sha256",t.sha512="sha512",r.computeHmac=function(t,e,r){return i[t]||s.throwError("unsupported algorithm "+t,s.UNSUPPORTED_OPERATION,{operation:"hmac",algorithm:t}),a.arrayify(o.hmac(o[t],a.arrayify(e)).update(a.arrayify(r)).digest())}},{"../errors":5,"../utils/bytes":64,"hash.js":26}],68:[function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var i=t("./abi-coder");r.AbiCoder=i.AbiCoder,r.defaultAbiCoder=i.defaultAbiCoder,r.formatSignature=i.formatSignature,r.formatParamType=i.formatParamType,r.parseSignature=i.parseSignature,r.parseParamType=i.parseParamType,i=t("./address"),r.getAddress=i.getAddress,r.getContractAddress=i.getContractAddress,r.getCreate2Address=i.getCreate2Address,r.getIcapAddress=i.getIcapAddress,i=n(t("./base64")),r.base64=i,i=t("./bignumber"),r.BigNumber=i.BigNumber,r.bigNumberify=i.bigNumberify,i=t("./bytes"),r.arrayify=i.arrayify,r.concat=i.concat,r.hexDataSlice=i.hexDataSlice,r.hexDataLength=i.hexDataLength,r.hexlify=i.hexlify,r.hexStripZeros=i.hexStripZeros,r.hexZeroPad=i.hexZeroPad,r.isHexString=i.isHexString,r.joinSignature=i.joinSignature,r.padZeros=i.padZeros,r.splitSignature=i.splitSignature,r.stripZeros=i.stripZeros,i=t("./hash"),r.hashMessage=i.hashMessage,r.id=i.id,r.namehash=i.namehash,i=n(t("./hdnode")),r.HDNode=i,i=t("./interface"),r.Interface=i.Interface,i=t("./json-wallet"),r.getJsonWalletAddress=i.getJsonWalletAddress,i=t("./keccak256"),r.keccak256=i.keccak256,i=t("./sha2"),r.sha256=i.sha256,i=t("./solidity"),r.solidityKeccak256=i.keccak256,r.solidityPack=i.pack,r.soliditySha256=i.sha256,i=t("./random-bytes"),r.randomBytes=i.randomBytes,i=t("./networks"),r.getNetwork=i.getNetwork,i=t("./properties"),r.checkProperties=i.checkProperties,r.deepCopy=i.deepCopy,r.defineReadOnly=i.defineReadOnly,r.resolveProperties=i.resolveProperties,r.shallowCopy=i.shallowCopy,n=n(t("./rlp")),r.RLP=n,n=t("./secp256k1"),r.computeAddress=n.computeAddress,r.computePublicKey=n.computePublicKey,r.recoverAddress=n.recoverAddress,r.recoverPublicKey=n.recoverPublicKey,r.verifyMessage=n.verifyMessage,n=t("./signing-key"),r.SigningKey=n.SigningKey,n=t("./transaction"),r.populateTransaction=n.populateTransaction,n=t("./transaction"),r.parseTransaction=n.parse,r.serializeTransaction=n.serialize,n=t("./utf8"),r.formatBytes32String=n.formatBytes32String,r.parseBytes32String=n.parseBytes32String,r.toUtf8Bytes=n.toUtf8Bytes,r.toUtf8String=n.toUtf8String,n=t("./units"),r.commify=n.commify,r.formatEther=n.formatEther,r.parseEther=n.parseEther,r.formatUnits=n.formatUnits,r.parseUnits=n.parseUnits,n=t("./web"),r.fetchJson=n.fetchJson,r.poll=n.poll,n=t("./hmac"),r.SupportedAlgorithms=n.SupportedAlgorithms,n=t("./utf8"),r.UnicodeNormalizationForm=n.UnicodeNormalizationForm,t=t("./wordlist"),r.Wordlist=t.Wordlist},{"./abi-coder":59,"./address":60,"./base64":61,"./bignumber":63,"./bytes":64,"./hash":65,"./hdnode":66,"./hmac":67,"./interface":69,"./json-wallet":70,"./keccak256":71,"./networks":72,"./properties":74,"./random-bytes":75,"./rlp":76,"./secp256k1":77,"./sha2":79,"./signing-key":81,"./solidity":82,"./transaction":83,"./units":84,"./utf8":85,"./web":86,"./wordlist":87}],69:[function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var a,s=t("./address"),u=t("./abi-coder"),c=t("./bignumber"),l=t("./bytes"),h=t("./hash"),f=t("./keccak256"),d=t("./properties"),p=o(t("../errors")),m=function(t){d.setType(this,"Indexed"),d.defineReadOnly(this,"hash",t)},y=(i(g,a=t=function(t){for(var e in d.setType(this,"Description"),t)d.defineReadOnly(this,e,d.deepCopy(t[e],!0));Object.freeze(this)}),g.prototype.encode=function(t,e){l.isHexString(t)||p.throwError("invalid contract bytecode",p.INVALID_ARGUMENT,{arg:"bytecode",value:t}),p.checkArgumentCount(e.length,this.inputs.length," in Interface constructor");try{return t+u.defaultAbiCoder.encode(this.inputs,e).substring(2)}catch(t){p.throwError("invalid constructor argument",p.INVALID_ARGUMENT,{arg:t.arg,reason:t.reason,value:t.value})}return null},g);function g(){return null!==a&&a.apply(this,arguments)||this}var v,b=(i(w,v=t),w.prototype.encode=function(t){p.checkArgumentCount(t.length,this.inputs.length," in interface function "+this.name);try{return this.sighash+u.defaultAbiCoder.encode(this.inputs,t).substring(2)}catch(t){p.throwError("invalid input argument",p.INVALID_ARGUMENT,{arg:t.arg,reason:t.reason,value:t.value})}return null},w.prototype.decode=function(t){try{return u.defaultAbiCoder.decode(this.outputs,l.arrayify(t))}catch(e){p.throwError("invalid data for function output",p.INVALID_ARGUMENT,{arg:"data",errorArg:e.arg,errorValue:e.value,value:t,reason:e.reason})}},w);function w(){return null!==v&&v.apply(this,arguments)||this}var _,k=(i(x,_=t),x);function x(){return null!==_&&_.apply(this,arguments)||this}var A,E=(i(S,A=t),S.prototype.encodeTopics=function(t){var e=this;t.length>this.inputs.length&&p.throwError("too many arguments for "+this.name,p.UNEXPECTED_ARGUMENT,{maxCount:t.length,expectedCount:this.inputs.length});var r=[];for(this.anonymous||r.push(this.topic),t.forEach((function(t,n){var i=e.inputs[n];i.indexed?null==t?r.push(null):"string"===i.type?r.push(h.id(t)):"bytes"===i.type?r.push(f.keccak256(t)):-1!==i.type.indexOf("[")||"tuple"===i.type.substring(0,5)?p.throwError("filtering with tuples or arrays not implemented yet; bug us on GitHub",p.NOT_IMPLEMENTED,{operation:"filter(array|tuple)"}):("address"===i.type&&s.getAddress(t),r.push(l.hexZeroPad(l.hexlify(t),32).toLowerCase())):null!=t&&p.throwError("cannot filter non-indexed parameters; must be null",p.INVALID_ARGUMENT,{argument:i.name||n,value:t})}));r.length&&null===r[r.length-1];)r.pop();return r},S.prototype.decode=function(t,e){null==e||this.anonymous||(e=e.slice(1));var r,n=[],i=[],o=[];this.inputs.forEach((function(t,e){t.indexed?"string"===t.type||"bytes"===t.type||0<=t.type.indexOf("[")||"tuple"===t.type.substring(0,5)?(n.push({type:"bytes32",name:t.name||""}),o.push(!0)):(n.push(t),o.push(!1)):(i.push(t),o.push(!1))})),null!=e&&(r=u.defaultAbiCoder.decode(n,l.concat(e)));var a=u.defaultAbiCoder.decode(i,l.arrayify(t)),s={},c=0,h=0;return this.inputs.forEach((function(t,n){t.indexed?null==e?s[n]=new m(null):o[n]?s[n]=new m(r[h++]):s[n]=r[h++]:s[n]=a[c++],t.name&&(s[t.name]=s[n])})),s.length=this.inputs.length,new k(s)},S);function S(){return null!==A&&A.apply(this,arguments)||this}var I,M=(i(T,I=t),T);function T(){return null!==I&&I.apply(this,arguments)||this}var P,C=(i(O,P=t),O);function O(){return null!==P&&P.apply(this,arguments)||this}function R(t){switch(t.type){case"constructor":var e=new y({inputs:t.inputs,payable:null==t.payable||!!t.payable});this.deployFunction||(this.deployFunction=e);break;case"function":var r=u.formatSignature(t).replace(/tuple/g,""),n=h.id(r).substring(0,10),i=!1;null!=t.constant?i=t.constant:null!=t.stateMutability&&(i="view"==t.stateMutability||"pure"==t.stateMutability),e=new b({inputs:t.inputs,outputs:t.outputs,gas:t.gas,payable:null==t.payable||!!t.payable,type:i?"call":"transaction",name:t.name,signature:r,sighash:n}),t.name&&(null==this.functions[t.name]?d.defineReadOnly(this.functions,t.name,e):p.warn("WARNING: Multiple definitions for "+t.name)),null==this.functions[e.signature]&&d.defineReadOnly(this.functions,e.signature,e);break;case"event":r=u.formatSignature(t).replace(/tuple/g,""),e=new E({name:t.name,signature:r,inputs:t.inputs,topic:h.id(r),anonymous:!!t.anonymous}),t.name&&null==this.events[t.name]&&d.defineReadOnly(this.events,t.name,e),null==this.events[e.signature]&&d.defineReadOnly(this.events,e.signature,e);break;case"receive":case"fallback":break;default:p.warn("WARNING: unsupported ABI type - "+t.type)}}function N(t){if(p.checkNew(this,N),"string"==typeof t){try{t=JSON.parse(t)}catch(e){p.throwError("could not parse ABI JSON",p.INVALID_ARGUMENT,{arg:"abi",errorMessage:e.message,value:t})}if(!Array.isArray(t))return p.throwError("invalid abi",p.INVALID_ARGUMENT,{arg:"abi",value:t}),null}d.defineReadOnly(this,"functions",{}),d.defineReadOnly(this,"events",{});var e=[];t.forEach((function(t){"string"==typeof t&&(t=u.parseSignature(t)),e.push(t)})),d.defineReadOnly(this,"abi",d.deepCopy(e,!0)),e.forEach(R,this),this.deployFunction||R.call(this,{type:"constructor",inputs:[]}),d.setType(this,"Interface")}N.prototype.parseTransaction=function(t){var e,r=t.data.substring(0,10).toLowerCase();for(e in this.functions)if(-1!==e.indexOf("(")){var n=this.functions[e];if(n.sighash===r){var i=u.defaultAbiCoder.decode(n.inputs,"0x"+t.data.substring(10));return new M({args:i,decode:n.decode,name:n.name,signature:n.signature,sighash:n.sighash,value:c.bigNumberify(t.value||"0")})}}return null},N.prototype.parseLog=function(t){for(var e in this.events)if(-1!==e.indexOf("(")&&!(e=this.events[e]).anonymous&&e.topic===t.topics[0])return new C({decode:e.decode,name:e.name,signature:e.signature,topic:e.topic,values:e.decode(t.data,t.topics)});return null},N.isInterface=function(t){return d.isType(t,"Interface")},N.isIndexed=function(t){return d.isType(t,"Indexed")},t=N,r.Interface=t},{"../errors":5,"./abi-coder":59,"./address":60,"./bignumber":63,"./bytes":64,"./hash":65,"./keccak256":71,"./properties":74}],70:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./address");function i(t){try{var e=JSON.parse(t)}catch(t){return!1}return e.encseed&&e.ethaddr}function o(t){try{var e=JSON.parse(t)}catch(t){return!1}return!(!e.version||parseInt(e.version)!==e.version||3!==parseInt(e.version))}r.isCrowdsaleWallet=i,r.isSecretStorageWallet=o,r.getJsonWalletAddress=function(t){if(i(t))try{return n.getAddress(JSON.parse(t).ethaddr)}catch(t){return null}if(o(t))try{return n.getAddress(JSON.parse(t).address)}catch(t){return null}return null}},{"./address":60}],71:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("js-sha3"),i=t("./bytes");r.keccak256=function(t){return"0x"+n.keccak_256(i.arrayify(t))}},{"./bytes":64,"js-sha3":40}],72:[function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var i=n(t("../errors"));function o(t){return function(e){var r=[];return e.InfuraProvider&&r.push(new e.InfuraProvider(t)),e.EtherscanProvider&&r.push(new e.EtherscanProvider(t)),0===r.length?null:e.FallbackProvider?new e.FallbackProvider(r):r[0]}}function a(t,e){return function(r){return r.JsonRpcProvider?new r.JsonRpcProvider(t,e):null}}var s={unspecified:{chainId:0,name:"unspecified"},homestead:n={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:o("homestead")},mainnet:n,morden:{chainId:2,name:"morden"},ropsten:t={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:o("ropsten")},testnet:t,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:o("rinkeby")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:o("goerli")},kovan:{chainId:42,name:"kovan",_defaultProvider:o("kovan")},classic:{chainId:61,name:"classic",_defaultProvider:a("https://web3.gastracker.io","classic")},classicTestnet:{chainId:62,name:"classicTestnet",_defaultProvider:a("https://web3.gastracker.io/morden","classicTestnet")}};r.getNetwork=function(t){if(null==t)return null;if("number"==typeof t){for(var e in s)if((e=s[e]).chainId===t)return{name:e.name,chainId:e.chainId,ensAddress:e.ensAddress||null,_defaultProvider:e._defaultProvider||null};return{chainId:t,name:"unknown"}}if("string"!=typeof t)return(r=s[t.name])?(0!==t.chainId&&t.chainId!==r.chainId&&i.throwError("network chainId mismatch",i.INVALID_ARGUMENT,{arg:"network",value:t}),{name:t.name,chainId:r.chainId,ensAddress:t.ensAddress||r.ensAddress||null,_defaultProvider:t._defaultProvider||r._defaultProvider||null}):("number"!=typeof t.chainId&&i.throwError("invalid network chainId",i.INVALID_ARGUMENT,{arg:"network",value:t}),t);var r=s[t];return null==r?null:{name:r.name,chainId:r.chainId,ensAddress:r.ensAddress,_defaultProvider:r._defaultProvider||null}}},{"../errors":5}],73:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("../utils/bytes"),i=t("./hmac");r.pbkdf2=function(t,e,r,o,a){var s;t=n.arrayify(t),e=n.arrayify(e);var u,c,l=1,h=new Uint8Array(o),f=new Uint8Array(e.length+4);f.set(e);for(var d=1;d<=l;d++){f[e.length]=d>>24&255,f[e.length+1]=d>>16&255,f[e.length+2]=d>>8&255,f[e.length+3]=255&d;var p=i.computeHmac(a,t,f);s||(s=p.length,c=new Uint8Array(s),u=o-((l=Math.ceil(o/s))-1)*s),c.set(p);for(var m=1;m<r;m++){p=i.computeHmac(a,t,p);for(var y=0;y<s;y++)c[y]^=p[y]}var g=(d-1)*s,v=d===l?u:s;h.set(n.arrayify(c).slice(0,v),g)}return n.arrayify(h)}},{"../utils/bytes":64,"./hmac":67}],74:[function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var i=n(t("../errors"));function o(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function a(t,e){return t&&t._ethersType===e}r.defineReadOnly=o,r.setType=function(t,e){Object.defineProperty(t,"_ethersType",{configurable:!1,value:e,writable:!1})},r.isType=a,r.resolveProperties=function(t){var e={},r=[];return Object.keys(t).forEach((function(n){var i=t[n];i instanceof Promise?r.push(i.then((function(t){return e[n]=t,null}))):e[n]=i})),Promise.all(r).then((function(){return e}))},r.checkProperties=function(t,e){t&&"object"==s(t)||i.throwError("invalid object",i.INVALID_ARGUMENT,{argument:"object",value:t}),Object.keys(t).forEach((function(r){e[r]||i.throwError("invalid object key - "+r,i.INVALID_ARGUMENT,{argument:"transaction",value:t,key:r})}))},r.shallowCopy=function(t){var e,r={};for(e in t)r[e]=t[e];return r};var u={boolean:!0,number:!0,string:!0};r.deepCopy=function t(e,r){if(null==e||u[s(e)])return e;if(Array.isArray(e)){var n=e.map((function(e){return t(e,r)}));return r&&Object.freeze(n),n}if("object"==s(e)){if(a(e,"BigNumber"))return e;if(a(e,"Description"))return e;if(a(e,"Indexed"))return e;var i;for(i in n={},e){var c=e[i];void 0!==c&&o(n,i,t(c,r))}return r&&Object.freeze(n),n}if("function"==typeof e)return e;throw new Error("Cannot deepCopy "+s(e))},r.inheritable=function t(e){return function(r){var n,i;i=e,(n=r).super_=i,n.prototype=Object.create(i.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),o(r,"inherits",t(r))}}},{"../errors":5}],75:[function(t,e,n){(function(e){(function(){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=t("../utils/bytes"),i=t("../utils/properties"),o=e.crypto||e.msCrypto;function a(t){if(t<=0||1024<t||parseInt(String(t))!=t)throw new Error("invalid length");return t=new Uint8Array(t),o.getRandomValues(t),r.arrayify(t)}o&&o.getRandomValues||(console.log("WARNING: Missing strong random number source; using weak randomBytes"),o={getRandomValues:function(t){for(var e=0;e<20;e++)for(var r=0;r<t.length;r++)e?t[r]^=Math.trunc(256*Math.random()):t[r]=Math.trunc(256*Math.random());return t},_weakCrypto:!0}),n.randomBytes=a,!0===o._weakCrypto&&i.defineReadOnly(a,"_weakCrypto",!0)}).call(this)}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utils/bytes":64,"../utils/properties":74}],76:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./bytes");function i(t){for(var e=[];t;)e.unshift(255&t),t>>=8;return e}function o(t,e,r){for(var n=0,i=0;i<r;i++)n=256*n+t[e+i];return n}function a(t,e,r,n){for(var i=[];r<e+1+n;){var o=s(t,r);if(i.push(o.result),e+1+n<(r+=o.consumed))throw new Error("invalid rlp")}return{consumed:1+n,result:i}}function s(t,e){if(0===t.length)throw new Error("invalid rlp data");if(248<=t[e]){if(e+1+(r=t[e]-247)>t.length)throw new Error("too short");if(e+1+r+(i=o(t,e+1,r))>t.length)throw new Error("to short");return a(t,e,e+1+r,r+i)}if(192<=t[e]){if(e+1+(i=t[e]-192)>t.length)throw new Error("invalid rlp data");return a(t,e,e+1,i)}if(184<=t[e]){var r;if(e+1+(r=t[e]-183)>t.length)throw new Error("invalid rlp data");if(e+1+r+(i=o(t,e+1,r))>t.length)throw new Error("invalid rlp data");return{consumed:1+r+i,result:n.hexlify(t.slice(e+1+r,e+1+r+i))}}if(128<=t[e]){var i;if(e+1+(i=t[e]-128)>t.length)throw new Error("invalid rlp data");return{consumed:1+i,result:n.hexlify(t.slice(e+1,e+1+i))}}return{consumed:1,result:n.hexlify(t[e])}}r.encode=function(t){return n.hexlify(function t(e){if(Array.isArray(e)){var r=[];return e.forEach((function(e){r=r.concat(t(e))})),r.length<=55?(r.unshift(192+r.length),r):((o=i(r.length)).unshift(247+o.length),o.concat(r))}var o;return 1===(e=Array.prototype.slice.call(n.arrayify(e))).length&&e[0]<=127?e:e.length<=55?(e.unshift(128+e.length),e):((o=i(e.length)).unshift(183+o.length),o.concat(e))}(t))},r.decode=function(t){var e=n.arrayify(t);if((t=s(e,0)).consumed!==e.length)throw new Error("invalid rlp data");return t.result}},{"./bytes":64}],77:[function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var i=t("elliptic"),o=t("./address"),a=t("./bytes"),s=t("./hash"),u=t("./keccak256"),c=t("./properties"),l=n(t("../errors")),h=null;function f(){return h=h||new i.ec("secp256k1")}var d=(p.prototype.sign=function(t){return{recoveryParam:(t=f().keyFromPrivate(a.arrayify(this.privateKey)).sign(a.arrayify(t),{canonical:!0})).recoveryParam,r:a.hexZeroPad("0x"+t.r.toString(16),32),s:a.hexZeroPad("0x"+t.s.toString(16),32),v:27+t.recoveryParam}},p.prototype.computeSharedSecret=function(t){var e=f().keyFromPrivate(a.arrayify(this.privateKey));return t=f().keyFromPublic(a.arrayify(m(t))),a.hexZeroPad("0x"+e.derive(t.getPublic()).toString(16),32)},p.prototype._addPoint=function(t){var e=f().keyFromPublic(a.arrayify(this.publicKey));return t=f().keyFromPublic(a.arrayify(t)),"0x"+e.pub.add(t.pub).encodeCompressed("hex")},p);function p(t){t=f().keyFromPrivate(a.arrayify(t)),c.defineReadOnly(this,"privateKey",a.hexlify(t.priv.toArray("be",32))),c.defineReadOnly(this,"publicKey","0x"+t.getPublic(!1,"hex")),c.defineReadOnly(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),c.defineReadOnly(this,"publicKeyBytes",t.getPublic().encode(null,!0))}function m(t,e){return 32!==(t=a.arrayify(t)).length?33===t.length?e?a.hexlify(t):"0x"+f().keyFromPublic(t).getPublic(!1,"hex"):65===t.length?e?"0x"+f().keyFromPublic(t).getPublic(!0,"hex"):a.hexlify(t):(l.throwError("invalid public or private key",l.INVALID_ARGUMENT,{arg:"key",value:"[REDACTED]"}),null):(t=new d(t),e?t.compressedPublicKey:t.publicKey)}function y(t){return t="0x"+m(t).slice(4),o.getAddress("0x"+u.keccak256(t).substring(26))}function g(t,e){var r=a.splitSignature(e);return e={r:a.arrayify(r.r),s:a.arrayify(r.s)},"0x"+f().recoverPubKey(a.arrayify(t),e,r.recoveryParam).encode("hex",!1)}function v(t,e){return y(g(a.arrayify(t),e))}r.KeyPair=d,r.computePublicKey=m,r.computeAddress=y,r.recoverPublicKey=g,r.recoverAddress=v,r.verifyMessage=function(t,e){return v(s.hashMessage(t),e)}},{"../errors":5,"./address":60,"./bytes":64,"./hash":65,"./keccak256":71,"./properties":74,elliptic:12}],78:[function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var o=n(t("aes-js")),a=n(t("scrypt-js")),s=n(t("uuid")),u=t("./signing-key"),c=i(t("./hdnode")),l=t("./address"),h=t("./bytes"),f=t("./pbkdf2"),d=t("./keccak256"),p=t("./utf8"),m=t("./random-bytes");function y(t){return"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),h.arrayify(t)}function g(t,e){for(t=String(t);t.length<e;)t="0"+t;return t}function v(t){return"string"==typeof t?p.toUtf8Bytes(t,p.UnicodeNormalizationForm.NFKC):h.arrayify(t)}function b(t,e){for(var r=t,n=e.toLowerCase().split("/"),i=0;i<n.length;i++){var o,a=null;for(o in r)if(o.toLowerCase()===n[i]){a=r[o];break}if(null===a)return null;r=a}return r}r.decryptCrowdsale=function(t,e){var r=JSON.parse(t);e=v(e);var n=l.getAddress(b(r,"ethaddr"));if(!(t=y(b(r,"encseed")))||t.length%16!=0)throw new Error("invalid encseed");r=f.pbkdf2(e,e,2e3,32,"sha256").slice(0,16),e=t.slice(0,16),t=t.slice(16),e=new o.default.ModeOfOperation.cbc(r,e);for(var i=h.arrayify(e.decrypt(t)),a=(i=o.default.padding.pkcs7.strip(i),""),s=0;s<i.length;s++)a+=String.fromCharCode(i[s]);if(t=p.toUtf8Bytes(a),(t=new u.SigningKey(d.keccak256(t))).address!==n)throw new Error("corrupt crowdsale wallet");return t},r.decrypt=function(t,e,r){function n(t,e){var r=y(b(i,"crypto/ciphertext"));if(h.hexlify((s=t.slice(16,32),d.keccak256(h.concat([s,r])))).substring(2)!==b(i,"crypto/mac").toLowerCase())return e(new Error("invalid password")),null;var n=function(t,e){if("aes-128-ctr"!==b(i,"crypto/cipher"))return null;var r=y(b(i,"crypto/cipherparams/iv"));return r=new o.default.Counter(r),r=new o.default.ModeOfOperation.ctr(t,r),h.arrayify(r.decrypt(e))}(t.slice(0,16),r),a=t.slice(32,64);if(!n)return e(new Error("unsupported cipher")),null;var s=new u.SigningKey(n);if(i.address&&s.address!==l.getAddress(i.address))return e(new Error("address mismatch")),null;if(r=b(i,"x-ethers/locale"),"0.1"===b(i,"x-ethers/version")&&(null==r||"en"===r)){if(t=y(b(i,"x-ethers/mnemonicCiphertext")),r=y(b(i,"x-ethers/mnemonicCounter")),r=new o.default.Counter(r),a=new o.default.ModeOfOperation.ctr(a,r),r=b(i,"x-ethers/path")||c.defaultPath,t=h.arrayify(a.decrypt(t)),t=c.entropyToMnemonic(t),(r=c.fromMnemonic(t).derivePath(r)).privateKey!=h.hexlify(n))return e(new Error("mnemonic mismatch")),null;s=new u.SigningKey(r)}return s}var i=JSON.parse(t),s=v(e);return new Promise((function(t,e){if((p=b(i,"crypto/kdf"))&&"string"==typeof p)if("scrypt"===p.toLowerCase()){var o=y(b(i,"crypto/kdfparams/salt")),u=parseInt(b(i,"crypto/kdfparams/n")),c=parseInt(b(i,"crypto/kdfparams/r")),l=parseInt(b(i,"crypto/kdfparams/p"));u&&c&&l?0==(u&u-1)?32===(d=parseInt(b(i,"crypto/kdfparams/dklen")))?(r&&r(0),a.default(s,o,u,c,l,64,(function(i,o,a){if(i)i.progress=o,e(i);else if(a)(a=n(a=h.arrayify(a),e))&&(r&&r(1),t(a));else if(r)return r(o)}))):e(new Error("unsupported key-derivation derived-key length")):e(new Error("unsupported key-derivation function parameter value for N")):e(new Error("unsupported key-derivation function parameters"))}else if("pbkdf2"===p.toLowerCase()){if(o=y(b(i,"crypto/kdfparams/salt")),l=null,"hmac-sha256"===(p=b(i,"crypto/kdfparams/prf")))l="sha256";else{if("hmac-sha512"!==p)return void e(new Error("unsupported prf"));l="sha512"}var d,p=parseInt(b(i,"crypto/kdfparams/c"));32===(d=parseInt(b(i,"crypto/kdfparams/dklen")))?(l=n(l=f.pbkdf2(s,o,p,d,l),e))&&t(l):e(new Error("unsupported key-derivation derived-key length"))}else e(new Error("unsupported key-derivation function"));else e(new Error("unsupported key-derivation function"))}))},r.encrypt=function(t,e,r,n){var i;if("function"!=typeof r||n||(n=r,r={}),r=r||{},32!==(i=u.SigningKey.isSigningKey(t)?h.arrayify(t.privateKey):h.arrayify(t)).length)throw new Error("invalid private key");var l=v(e),f=null;if(r.entropy&&(f=h.arrayify(r.entropy)),r.mnemonic)if(f){if(c.entropyToMnemonic(f)!==r.mnemonic)throw new Error("entropy and mnemonic mismatch")}else f=h.arrayify(c.mnemonicToEntropy(r.mnemonic,r.wordlist));var p=r.path;f&&!p&&(p=c.defaultPath);var y=(y=r.client)||"ethers.js",b=r.salt?h.arrayify(r.salt):m.randomBytes(32),w=null;if(r.iv){if(16!==(w=h.arrayify(r.iv)).length)throw new Error("invalid iv")}else w=m.randomBytes(16);var _=null;if(r.uuid){if(16!==(_=h.arrayify(r.uuid)).length)throw new Error("invalid uuid")}else _=m.randomBytes(16);var k=1<<17,x=8,A=1;return r.scrypt&&(r.scrypt.N&&(k=r.scrypt.N),r.scrypt.r&&(x=r.scrypt.r),r.scrypt.p&&(A=r.scrypt.p)),new Promise((function(t,e){n&&n(0),a.default(l,b,k,x,A,64,(function(a,c,l){if(a)a.progress=c,e(a);else if(l){var v=(l=h.arrayify(l)).slice(0,16),E=l.slice(16,32),S=l.slice(32,64);a=new u.SigningKey(i).address,l=new o.default.Counter(w),l=new o.default.ModeOfOperation.ctr(v,l),l=h.arrayify(l.encrypt(i)),E=d.keccak256(h.concat([E,l])),a={address:a.substring(2).toLowerCase(),id:s.default.v4({random:_}),version:3,Crypto:{cipher:"aes-128-ctr",cipherparams:{iv:h.hexlify(w).substring(2)},ciphertext:h.hexlify(l).substring(2),kdf:"scrypt",kdfparams:{salt:h.hexlify(b).substring(2),n:k,dklen:32,p:A,r:x},mac:E.substring(2)}},f&&(l=m.randomBytes(16),E=new o.default.Counter(l),S=new o.default.ModeOfOperation.ctr(S,E),E=h.arrayify(S.encrypt(f)),S=(S=new Date).getUTCFullYear()+"-"+g(S.getUTCMonth()+1,2)+"-"+g(S.getUTCDate(),2)+"T"+g(S.getUTCHours(),2)+"-"+g(S.getUTCMinutes(),2)+"-"+g(S.getUTCSeconds(),2)+".0Z",a["x-ethers"]={client:y,gethFilename:"UTC--"+S+"--"+a.address,mnemonicCounter:h.hexlify(l).substring(2),mnemonicCiphertext:h.hexlify(E).substring(2),path:p,version:"0.1"},r.wordlist&&"string"==typeof r.wordlist.locale&&(a["x-ethers"].locale=r.wordlist.locale)),n&&n(1),t(JSON.stringify(a))}else if(n)return n(c)}))}))}},{"./address":60,"./bytes":64,"./hdnode":66,"./keccak256":71,"./pbkdf2":73,"./random-bytes":75,"./signing-key":81,"./utf8":85,"aes-js":8,"scrypt-js":44,uuid:48}],79:[function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:!0});var i=n(t("hash.js")),o=t("./bytes");r.ripemd160=function(t){return"0x"+i.default.ripemd160().update(o.arrayify(t)).digest("hex")},r.sha256=function(t){return"0x"+i.default.sha256().update(o.arrayify(t)).digest("hex")},r.sha512=function(t){return"0x"+i.default.sha512().update(o.arrayify(t)).digest("hex")}},{"./bytes":64,"hash.js":26}],80:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),t("setimmediate"),r.platform="browser"},{setimmediate:45}],81:[function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var i=t("./hdnode"),o=t("./bytes"),a=t("./properties"),u=t("./secp256k1"),c=n(t("../errors"));function l(t){c.checkNew(this,l);var e=i.HDNode.isHDNode(t)?(a.defineReadOnly(this,"mnemonic",t.mnemonic),a.defineReadOnly(this,"path",t.path),o.arrayify(t.privateKey)):("string"==typeof t&&t.match(/^[0-9a-f]*$/i)&&64===t.length&&(t="0x"+t),o.arrayify(t));try{32!==e.length&&c.throwError("exactly 32 bytes required",c.INVALID_ARGUMENT,{arg:"privateKey",value:"[REDACTED]"})}catch(e){t={arg:"privateKey",reason:e.reason,value:"[REDACTED]"},e.value&&("number"==typeof e.value.length&&(t.length=e.value.length),t.type=s(e.value)),c.throwError("invalid private key",e.code,t)}a.defineReadOnly(this,"privateKey",o.hexlify(e)),a.defineReadOnly(this,"keyPair",new u.KeyPair(e)),a.defineReadOnly(this,"publicKey",this.keyPair.publicKey),a.defineReadOnly(this,"address",u.computeAddress(this.keyPair.publicKey)),a.setType(this,"SigningKey")}l.prototype.signDigest=function(t){return this.keyPair.sign(t)},l.prototype.computeSharedSecret=function(t){return this.keyPair.computeSharedSecret(o.arrayify(t))},l.isSigningKey=function(t){return a.isType(t,"SigningKey")},t=l,r.SigningKey=t},{"../errors":5,"./bytes":64,"./hdnode":66,"./properties":74,"./secp256k1":77}],82:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./bignumber"),i=t("./bytes"),o=t("./utf8"),a=t("./keccak256"),s=t("./sha2"),u=new RegExp("^bytes([0-9]+)$"),c=new RegExp("^(u?int)([0-9]*)$"),l=new RegExp("^(.*)\\[([0-9]*)\\]$");function h(t,e){if(t.length!=e.length)throw new Error("type/value count mismatch");var r=[];return t.forEach((function(t,a){r.push(function t(e,r,a){switch(e){case"address":return a?i.padZeros(r,32):i.arrayify(r);case"string":return o.toUtf8Bytes(r);case"bytes":return i.arrayify(r);case"bool":return r=r?"0x01":"0x00",a?i.padZeros(r,32):i.arrayify(r)}var s=e.match(c);if(s){if((h=parseInt(s[2]||"256"))%8!=0||0===h||256<h)throw new Error("invalid number type - "+e);return a&&(h=256),r=n.bigNumberify(r).toTwos(h),i.padZeros(r,h/8)}if(s=e.match(u)){var h=parseInt(s[1]);if(String(h)!=s[1]||0===h||32<h)throw new Error("invalid number type - "+e);if(i.arrayify(r).byteLength!==h)throw new Error("invalid value for "+e);return a?i.arrayify((r+"0000000000000000000000000000000000000000000000000000000000000000").substring(0,66)):r}if((s=e.match(l))&&Array.isArray(r)){var f=s[1];if(parseInt(s[2]||String(r.length))!=r.length)throw new Error("invalid value for "+e);var d=[];return r.forEach((function(e){d.push(t(f,e,!0))})),i.concat(d)}throw new Error("unknown type - "+e)}(t,e[a]))})),i.hexlify(i.concat(r))}r.pack=h,r.keccak256=function(t,e){return a.keccak256(h(t,e))},r.sha256=function(t,e){return s.sha256(h(t,e))}},{"./bignumber":63,"./bytes":64,"./keccak256":71,"./sha2":79,"./utf8":85}],83:[function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var i=t("../constants"),o=n(t("../errors")),a=t("./secp256k1"),s=t("./address"),u=t("./bignumber"),c=t("./bytes"),l=t("./keccak256"),h=t("./properties"),f=n(t("./rlp")),d=t("../providers/abstract-provider");function p(t){return"0x"===t?i.Zero:u.bigNumberify(t)}var m=[{name:"nonce",maxLength:32},{name:"gasPrice",maxLength:32},{name:"gasLimit",maxLength:32},{name:"to",length:20},{name:"value",maxLength:32},{name:"data"}],y={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0};r.serialize=function(t,e){h.checkProperties(t,y);var r=[];m.forEach((function(e){var n=t[e.name]||[];n=c.arrayify(c.hexlify(n)),e.length&&n.length!==e.length&&0<n.length&&o.throwError("invalid length for "+e.name,o.INVALID_ARGUMENT,{arg:"transaction"+e.name,value:n}),e.maxLength&&(n=c.stripZeros(n)).length>e.maxLength&&o.throwError("invalid length for "+e.name,o.INVALID_ARGUMENT,{arg:"transaction"+e.name,value:n}),r.push(c.hexlify(n))})),null!=t.chainId&&0!==t.chainId&&(r.push(c.hexlify(t.chainId)),r.push("0x"),r.push("0x"));var n=f.encode(r);return e?(e=27+(n=c.splitSignature(e)).recoveryParam,9===r.length&&(r.pop(),r.pop(),r.pop(),e+=2*t.chainId+8),r.push(c.hexlify(e)),r.push(c.stripZeros(c.arrayify(n.r))),r.push(c.stripZeros(c.arrayify(n.s))),f.encode(r)):n},r.parse=function(t){9!==(n=f.decode(t)).length&&6!==n.length&&o.throwError("invalid raw transaction",o.INVALID_ARGUMENT,{arg:"rawTransactin",value:t});var e={nonce:p(n[0]).toNumber(),gasPrice:p(n[1]),gasLimit:p(n[2]),to:"0x"===(r=n[3])?null:s.getAddress(r),value:p(n[4]),data:n[5],chainId:0};if(6===n.length)return e;try{e.v=u.bigNumberify(n[6]).toNumber()}catch(t){return o.info(t),e}if(e.r=c.hexZeroPad(n[7],32),e.s=c.hexZeroPad(n[8],32),u.bigNumberify(e.r).isZero()&&u.bigNumberify(e.s).isZero())e.chainId=e.v,e.v=0;else{e.chainId=Math.floor((e.v-35)/2),e.chainId<0&&(e.chainId=0);var r=e.v-27,n=n.slice(0,6);0!==e.chainId&&(n.push(c.hexlify(e.chainId)),n.push("0x"),n.push("0x"),r-=2*e.chainId+8),n=l.keccak256(f.encode(n));try{e.from=a.recoverAddress(n,{r:c.hexlify(e.r),s:c.hexlify(e.s),recoveryParam:r})}catch(t){o.info(t)}e.hash=l.keccak256(t)}return e},r.populateTransaction=function(t,e,r){d.Provider.isProvider(e)||o.throwError("missing provider",o.INVALID_ARGUMENT,{argument:"provider",value:e}),h.checkProperties(t,y);var n=h.shallowCopy(t);return null!=n.to&&(n.to=e.resolveName(n.to)),null==n.gasPrice&&(n.gasPrice=e.getGasPrice()),null==n.nonce&&(n.nonce=e.getTransactionCount(r)),null==n.gasLimit&&((t=h.shallowCopy(n)).from=r,n.gasLimit=e.estimateGas(t)),null==n.chainId&&(n.chainId=e.getNetwork().then((function(t){return t.chainId}))),h.resolveProperties(n)}},{"../constants":3,"../errors":5,"../providers/abstract-provider":50,"./address":60,"./bignumber":63,"./bytes":64,"./keccak256":71,"./properties":74,"./rlp":76,"./secp256k1":77}],84:[function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var i,o=t("../constants"),a=n(t("../errors")),s=t("./bignumber"),u={};function c(t){return{decimals:t.length-1,tenPower:s.bigNumberify(t)}}function l(t){var e=u[String(t).toLowerCase()];if(!e&&"number"==typeof t&&parseInt(String(t))==t&&0<=t&&t<=256){for(var r="1",n=0;n<t;n++)r+="0";e=c(r)}return e||a.throwError("invalid unitType",a.INVALID_ARGUMENT,{argument:"name",value:t}),e}function h(t,e){for(var r=l(e),n=(e=(t=s.bigNumberify(t)).lt(o.Zero),(t=e?t.mul(o.NegativeOne):t).mod(r.tenPower).toString());n.length<r.decimals;)n="0"+n;return n=n.match(/^([0-9]*[1-9]|0)(0*)/)[1],t=t.div(r.tenPower).toString()+"."+n,e?"-"+t:t}function f(t,e){var r=l(e=null==e?18:e);if("string"==typeof t&&t.match(/^-?[0-9.,]+$/)||a.throwError("invalid decimal value",a.INVALID_ARGUMENT,{arg:"value",value:t}),0===r.decimals)return s.bigNumberify(t);var n="-"===t.substring(0,1);"."===(t=n?t.substring(1):t)&&a.throwError("missing value",a.INVALID_ARGUMENT,{arg:"value",value:t}),2<(e=t.split(".")).length&&a.throwError("too many decimal points",a.INVALID_ARGUMENT,{arg:"value",value:t}),t=e[0];var i=e[1];for(t=t||"0",(i=i||"0").length>r.decimals&&a.throwError("underflow occurred",a.NUMERIC_FAULT,{operation:"division",fault:"underflow"});i.length<r.decimals;)i+="0";return e=s.bigNumberify(t),t=s.bigNumberify(i),t=e.mul(r.tenPower).add(t),n?t.mul(o.NegativeOne):t}i="1",["wei","kwei","Mwei","Gwei","szabo","finney","ether"].forEach((function(t){var e=c(i);u[t.toLowerCase()]=e,u[String(e.decimals)]=e,i+="000"})),r.commify=function(t){var e=String(t).split(".");(2<e.length||!e[0].match(/^-?[0-9]*$/)||e[1]&&!e[1].match(/^[0-9]*$/)||"."===t||"-."===t)&&a.throwError("invalid value",a.INVALID_ARGUMENT,{argument:"value",value:t});var r=e[0],n="";for("-"===r.substring(0,1)&&(n="-",r=r.substring(1));"0"===r.substring(0,1);)r=r.substring(1);""===r&&(r="0"),t="",2===e.length&&(t="."+(e[1]||"0"));for(var i=[];r.length;){if(r.length<=3){i.unshift(r);break}var o=r.length-3;i.unshift(r.substring(o)),r=r.substring(0,o)}return n+i.join(",")+t},r.formatUnits=h,r.parseUnits=f,r.formatEther=function(t){return h(t,18)},r.parseEther=function(t){return f(t,18)}},{"../constants":3,"../errors":5,"./bignumber":63}],85:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n,i=t("../constants"),o=t("../errors"),a=t("./bytes");function s(t,e){(e=void 0===e?n.current:e)!=n.current&&(o.checkNormalize(),t=t.normalize(e));for(var r=[],i=0;i<t.length;i++){var s=t.charCodeAt(i);if(s<128)r.push(s);else if(s<2048)r.push(s>>6|192),r.push(63&s|128);else if(55296==(64512&s)){i++;var u=t.charCodeAt(i);if(i>=t.length||56320!=(64512&u))throw new Error("invalid utf-8 string");r.push((s=65536+((1023&s)<<10)+(1023&u))>>18|240),r.push(s>>12&63|128),r.push(s>>6&63|128),r.push(63&s|128)}else r.push(s>>12|224),r.push(s>>6&63|128),r.push(63&s|128)}return a.arrayify(r)}function u(t,e){t=a.arrayify(t);for(var r="",n=0;n<t.length;){var i=t[n++];if(i>>7!=0){var o=null,s=null;if(192==(224&i))o=1,s=127;else if(224==(240&i))o=2,s=2047;else{if(240!=(248&i)){if(e)continue;if(128==(192&i))throw new Error("invalid utf8 byte sequence; unexpected continuation byte");throw new Error("invalid utf8 byte sequence; invalid prefix")}o=3,s=65535}if(n+o>t.length){if(!e)throw new Error("invalid utf8 byte sequence; too short");for(;n<t.length&&t[n]>>6==2;n++);}else{for(var u=i&(1<<8-o-1)-1,c=0;c<o;c++){var l=t[n];if(128!=(192&l)){u=null;break}u=u<<6|63&l,n++}if(null!==u)if(u<=s){if(!e)throw new Error("invalid utf8 byte sequence; overlong")}else if(1114111<u){if(!e)throw new Error("invalid utf8 byte sequence; out-of-range")}else if(55296<=u&&u<=57343){if(!e)throw new Error("invalid utf8 byte sequence; utf-16 surrogate")}else u<=65535?r+=String.fromCharCode(u):(u-=65536,r+=String.fromCharCode(55296+(u>>10&1023),56320+(1023&u)));else if(!e)throw new Error("invalid utf8 byte sequence; invalid continuation byte")}}else r+=String.fromCharCode(i)}return r}(t=n=r.UnicodeNormalizationForm||(r.UnicodeNormalizationForm={})).current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD",r.toUtf8Bytes=s,r.toUtf8String=u,r.formatBytes32String=function(t){if(31<(t=s(t)).length)throw new Error("bytes32 string must be less than 32 bytes");return a.hexlify(a.concat([t,i.HashZero]).slice(0,32))},r.parseBytes32String=function(t){var e=a.arrayify(t);if(32!==e.length)throw new Error("invalid bytes32 - not 32 bytes long");if(0!==e[31])throw new Error("invalid bytes32 string - no null terminator");for(var r=31;0===e[r-1];)r--;return u(e.slice(0,r))}},{"../constants":3,"../errors":5,"./bytes":64}],86:[function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var i=t("xmlhttprequest"),o=t("./base64"),a=t("./properties"),u=t("./utf8"),c=n(t("../errors"));r.fetchJson=function(t,e,r){var n,a={},l=null,h=12e4;if("string"==typeof t)l=t;else if("object"==s(t)){if(null==t.url&&c.throwError("missing URL",c.MISSING_ARGUMENT,{arg:"url"}),l=t.url,"number"==typeof t.timeout&&0<t.timeout&&(h=t.timeout),t.headers)for(var f in t.headers)a[f.toLowerCase()]={key:f,value:String(t.headers[f])};null!=t.user&&null!=t.password&&("https:"!==l.substring(0,6)&&!0!==t.allowInsecure&&c.throwError("basic authentication requires a secure https url",c.INVALID_ARGUMENT,{arg:"url",url:l,user:t.user,password:"[REDACTED]"}),n=t.user+":"+t.password,a.authorization={key:"Authorization",value:"Basic "+o.encode(u.toUtf8Bytes(n))})}return new Promise((function(t,n){function o(){null!=u&&(clearTimeout(u),u=null)}var s=new i.XMLHttpRequest,u=null;u=setTimeout((function(){null!=u&&(u=null,n(new Error("timeout")),setTimeout((function(){s.abort()}),0))}),h),e?(s.open("POST",l,!0),a["content-type"]={key:"Content-Type",value:"application/json"}):s.open("GET",l,!0),Object.keys(a).forEach((function(t){t=a[t],s.setRequestHeader(t.key,t.value)})),s.onreadystatechange=function(){if(4===s.readyState){if(200!=s.status){o();var i=new Error("invalid response - "+s.status);return i.statusCode=s.status,s.responseText&&(i.responseText=s.responseText),void n(i)}var a=null;try{a=JSON.parse(s.responseText)}catch(i){o();var u=new Error("invalid json response");return u.orginialError=i,u.responseText=s.responseText,null!=e&&(u.requestBody=e),u.url=l,void n(u)}if(r)try{a=r(a)}catch(i){return o(),i.url=l,i.body=e,i.responseText=s.responseText,void n(i)}o(),t(a)}},s.onerror=function(t){o(),n(t)};try{null!=e?s.send(e):s.send()}catch(u){o();var c=new Error("connection error");c.error=u,n(c)}}))},r.poll=function(t,e){return e=e||{},null==(e=a.shallowCopy(e)).floor&&(e.floor=0),null==e.ceiling&&(e.ceiling=1e4),null==e.interval&&(e.interval=250),new Promise((function(r,n){var i=null,o=!1,a=function(){return!o&&(o=!0,i&&clearTimeout(i),!0)};e.timeout&&(i=setTimeout((function(){a()&&n(new Error("timeout"))}),e.timeout));var s=e.fastRetry||null,u=0;!function i(){return t().then((function(t){return void 0!==t?a()&&r(t):e.onceBlock?e.onceBlock.once("block",i):o||(u++,(t=(t=e.interval*parseInt(String(Math.random()*Math.pow(2,u))))<e.floor?e.floor:t)>e.ceiling&&(t=e.ceiling),s&&(u--,t=s,s=null),setTimeout(i,t)),null}),(function(t){a()&&n(t)}))}()}))}},{"../errors":5,"./base64":61,"./properties":74,"./utf8":85,xmlhttprequest:49}],87:[function(t,e,n){(function(e){(function(){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var e=t("../utils/hash"),r=t("../utils/properties");n.check=function(t){for(var r=[],n=0;n<2048;n++){var i=t.getWord(n);if(n!==t.getWordIndex(i))return"0x";r.push(i)}return e.id(r.join("\n")+"\n")};var i=(o.prototype.split=function(t){return t.toLowerCase().split(/ +/g)},o.prototype.join=function(t){return t.join(" ")},o);function o(t){r.defineReadOnly(this,"locale",t)}n.Wordlist=i,n.register=function(t,e){e=e||t.locale}}).call(this)}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utils/hash":65,"../utils/properties":74}],88:[function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var a,s=t("./utils/bytes"),u=t("./utils/hash"),c=t("./utils/hdnode"),l=t("./utils/json-wallet"),h=t("./utils/keccak256"),f=t("./utils/properties"),d=t("./utils/random-bytes"),p=o(t("./utils/secret-storage")),m=t("./utils/signing-key"),y=t("./utils/transaction"),g=t("./abstract-signer"),v=t("./providers/abstract-provider"),b=o(t("./errors"));function w(t,e){var r=a.call(this)||this;return b.checkNew(r,w),m.SigningKey.isSigningKey(t)?f.defineReadOnly(r,"signingKey",t):f.defineReadOnly(r,"signingKey",new m.SigningKey(t)),f.defineReadOnly(r,"provider",e),r}i(w,a=g.Signer),Object.defineProperty(w.prototype,"address",{get:function(){return this.signingKey.address},enumerable:!0,configurable:!0}),Object.defineProperty(w.prototype,"mnemonic",{get:function(){return this.signingKey.mnemonic},enumerable:!0,configurable:!0}),Object.defineProperty(w.prototype,"path",{get:function(){return this.signingKey.path},enumerable:!0,configurable:!0}),Object.defineProperty(w.prototype,"privateKey",{get:function(){return this.signingKey.privateKey},enumerable:!0,configurable:!0}),w.prototype.connect=function(t){return v.Provider.isProvider(t)||b.throwError("invalid provider",b.INVALID_ARGUMENT,{argument:"provider",value:t}),new w(this.signingKey,t)},w.prototype.getAddress=function(){return Promise.resolve(this.address)},w.prototype.sign=function(t){var e=this;return f.resolveProperties(t).then((function(t){var r=y.serialize(t);return r=e.signingKey.signDigest(h.keccak256(r)),y.serialize(t,r)}))},w.prototype.signMessage=function(t){return Promise.resolve(s.joinSignature(this.signingKey.signDigest(u.hashMessage(t))))},w.prototype.getBalance=function(t){if(!this.provider)throw new Error("missing provider");return this.provider.getBalance(this.address,t)},w.prototype.getTransactionCount=function(t){if(!this.provider)throw new Error("missing provider");return this.provider.getTransactionCount(this.address,t)},w.prototype.sendTransaction=function(t){var e=this;if(!this.provider)throw new Error("missing provider");return null==t.nonce&&((t=f.shallowCopy(t)).nonce=this.getTransactionCount("pending")),y.populateTransaction(t,this.provider,this.address).then((function(t){return e.sign(t).then((function(t){return e.provider.sendTransaction(t)}))}))},w.prototype.encrypt=function(t,e,r){if("function"!=typeof e||r||(r=e,e={}),r&&"function"!=typeof r)throw new Error("invalid callback");return e=e||{},this.mnemonic&&((e=f.shallowCopy(e)).mnemonic=this.mnemonic,e.path=this.path),p.encrypt(this.privateKey,t,e,r)},w.createRandom=function(t){var e=d.randomBytes(16);return(t=t||{}).extraEntropy&&(e=s.arrayify(h.keccak256(s.concat([e,t.extraEntropy])).substring(0,34))),e=c.entropyToMnemonic(e,t.locale),w.fromMnemonic(e,t.path,t.locale)},w.fromEncryptedJson=function(t,e,r){if(l.isCrowdsaleWallet(t))try{r&&r(0);var n=p.decryptCrowdsale(t,e);return r&&r(1),Promise.resolve(new w(n))}catch(t){return Promise.reject(t)}else if(l.isSecretStorageWallet(t))return p.decrypt(t,e,r).then((function(t){return new w(t)}));return Promise.reject("invalid wallet JSON")},w.fromMnemonic=function(t,e,r){return e=e||c.defaultPath,new w(c.fromMnemonic(t,r).derivePath(e))},i=w,r.Wallet=i},{"./abstract-signer":2,"./errors":5,"./providers/abstract-provider":50,"./utils/bytes":64,"./utils/hash":65,"./utils/hdnode":66,"./utils/json-wallet":70,"./utils/keccak256":71,"./utils/properties":74,"./utils/random-bytes":75,"./utils/secret-storage":78,"./utils/signing-key":81,"./utils/transaction":83}],89:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),t=t("../wordlists/lang-en").langEn,r.en=t},{"../wordlists/lang-en":90}],90:[function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o,a=t("../utils/wordlist"),s=null;function u(t){if(null==s&&(s="AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo".replace(/([A-Z])/g," $1").toLowerCase().substring(1).split(" "),"0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"!==a.check(t)))throw s=null,new Error("BIP39 Wordlist for en (English) FAILED")}function c(){return o.call(this,"en")||this}i=new(i(c,o=a.Wordlist),c.prototype.getWord=function(t){return u(this),s[t]},c.prototype.getWordIndex=function(t){return u(this),s.indexOf(t)},c),r.langEn=i,a.register(i)},{"../utils/wordlist":87}]},{},[7])(7)},"object"==s(e)&&void 0!==t?t.exports=a():(i=[],void 0===(o="function"==typeof(n=a)?n.apply(e,i):n)||(t.exports=o))}).call(this,r(6))},function(t,e,r){var n=r(22),i=r(30),o=r(13),a=r(4),s=r(5);function u(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function c(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?u(Object(r),!0).forEach((function(e){o(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var l=r(72),h=r(73),f=r(76),d=f.ValidateLibrary,p=f.ValidateObject,m=f.ValidateVersion,y=f.ValidatePartHash,g=f.ValidateWriteToken,v=f.ValidateParameters,b=r(77);e.permissionLevels={owner:{short:"Owner Only",description:"Only the owner has access to the object and ability to change permissions",settings:{visibility:0,statusCode:-1,kmsConk:!1}},editable:{short:"Editable",description:"Members of the editors group have full access to the object and the ability to change permissions",settings:{visibility:0,statusCode:-1,kmsConk:!0}},viewable:{short:"Viewable",description:"In addition to editors, members of the 'accessor' group can have read-only access to the object including playing video and retrieving metadata, images and documents",settings:{visibility:0,statusCode:0,kmsConk:!0}},listable:{short:"Publicly Listable",description:"Anyone can list the public portion of this object but only accounts with specific rights can access",settings:{visibility:1,statusCode:0,kmsConk:!0}},public:{short:"Public",description:"Anyone can access this object",settings:{visibility:10,statusCode:0,kmsConk:!0}}},e.Visibility=function(){var t=s(a.mark((function t(e){var r,n,i=this;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.id,t.prev=1,n=this.utils.HashToAddress(r),this.visibilityInfo[n]||(this.visibilityInfo[n]=new Promise(function(){var t=s(a.mark((function t(e,o){return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,i.authClient.ContractHasMethod({contractAddress:n,methodName:"visibility"});case 3:if(t.sent){t.next=7;break}return e(0),t.abrupt("return");case 7:return t.t0=e,t.next=10,i.CallContractMethod({contractAddress:i.utils.HashToAddress(r),methodName:"visibility"});case 10:t.t1=t.sent,(0,t.t0)(t.t1),t.next=17;break;case 14:t.prev=14,t.t2=t.catch(0),o(t.t2);case 17:case"end":return t.stop()}}),t,null,[[0,14]])})));return function(e,r){return t.apply(this,arguments)}}())),t.prev=4,t.next=7,this.visibilityInfo[n];case 7:return t.abrupt("return",t.sent);case 10:throw t.prev=10,t.t0=t.catch(4),delete this.visibilityInfo[n],t.t0;case 14:t.next=21;break;case 16:if(t.prev=16,t.t1=t.catch(1),"CALL_EXCEPTION"!==t.t1.code){t.next=20;break}return t.abrupt("return",0);case 20:throw t.t1;case 21:case"end":return t.stop()}}),t,this,[[1,16],[4,10]])})));return function(e){return t.apply(this,arguments)}}(),e.Permission=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u,c,l=this;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.objectId,p(r),t.next=4,this.AccessType({id:r});case 4:if(t.t0=t.sent,t.t1=this.authClient.ACCESS_TYPES.OBJECT,t.t0===t.t1){t.next=8;break}throw Error("Permission only valid for normal content objects: "+r);case 8:return t.next=10,this.Visibility({id:r});case 10:return n=t.sent,t.next=13,this.CallContractMethod({contractAddress:this.utils.HashToAddress(r),methodName:"addressKMS"});case 13:if(i=t.sent,o=i&&"ikms".concat(this.utils.AddressToHash(i)),s=!1,!o){t.next=27;break}return t.t2=this,t.next=20,this.ContentObjectLibraryId({objectId:r});case 20:return t.t3=t.sent,t.t4=r,t.t5="eluv.caps.".concat(o),t.t6={libraryId:t.t3,objectId:t.t4,metadataSubtree:t.t5},t.next=26,t.t2.ContentObjectMetadata.call(t.t2,t.t6);case 26:s=!!t.sent;case 27:return t.next=29,this.CallContractMethod({contractAddress:this.utils.HashToAddress(r),methodName:"statusCode"});case 29:return u=t.sent,u=parseInt(u._hex,16),(c=Object.keys(this.permissionLevels).filter((function(t){var e=l.permissionLevels[t].settings;return n>=e.visibility&&u>=e.statusCode&&s===e.kmsConk})))||(c=s?["editable"]:["owner"]),t.abrupt("return",c.slice(-1)[0]);case 34:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.DefaultKMSAddress=s(a.mark((function t(){var e,r,n,i=arguments;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=i.length>0&&void 0!==i[0]?i[0]:{},r=e.tenantId,t.t0=r,!t.t0){t.next=8;break}return t.next=5,this.AccessType({id:r});case 5:t.t1=t.sent,t.t2=this.authClient.ACCESS_TYPES.TENANT,t.t0=t.t1===t.t2;case 8:if(!t.t0){t.next=14;break}return t.next=11,this.CallContractMethod({contractAddress:this.utils.HashToAddress(r),methodName:"addressKMS"});case 11:if(!(n=t.sent)){t.next=14;break}return t.abrupt("return",n);case 14:return t.next=16,this.CallContractMethod({contractAddress:this.contentSpaceAddress,methodName:"addressKMS"});case 16:return t.abrupt("return",t.sent);case 17:case"end":return t.stop()}}),t,this)}))),e.ContentSpaceId=function(){return this.contentSpaceId},e.ContentTypeOwner=function(){var t=s(a.mark((function t(e){var r,n,i,o;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.name,n=e.typeId,i=e.versionHash,t.next=3,this.ContentType({name:r,typeId:n,versionHash:i});case 3:return o=t.sent,t.t0=this.utils,t.next=7,this.ethClient.CallContractMethod({contractAddress:this.utils.HashToAddress(o.id),methodName:"owner",methodArgs:[]});case 7:return t.t1=t.sent,t.abrupt("return",t.t0.FormatAddress.call(t.t0,t.t1));case 9:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.ContentType=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.name,n=e.typeId,i=e.versionHash,o=e.publicOnly,s=void 0!==o&&o,this.Log("Retrieving content type: ".concat(r||n||i)),i&&(n=this.utils.DecodeVersionHash(i).objectId),!r){t.next=13;break}return this.Log("Looking up type by name in content space metadata..."),t.prev=5,t.next=8,this.ContentObjectMetadata({libraryId:this.contentSpaceLibraryId,objectId:this.contentSpaceObjectId,metadataSubtree:l("public","contentTypes",r)});case 8:n=t.sent,t.next=13;break;case 11:t.prev=11,t.t0=t.catch(5);case 13:if(n){t.next=23;break}return this.Log("Looking up type by name in available types..."),t.next=17,this.ContentTypes();case 17:if(u=t.sent,!r){t.next=22;break}return t.abrupt("return",Object.values(u).find((function(t){return(t.name||"").toLowerCase()===r.toLowerCase()})));case 22:return t.abrupt("return",Object.values(u).find((function(t){return t.hash===i})));case 23:if(i){t.next=27;break}return t.next=26,this.LatestVersionHash({objectId:n});case 26:i=t.sent;case 27:if(t.prev=27,this.Log("Looking up type by ID..."),!s){t.next=39;break}return t.next=32,this.ContentObjectMetadata({libraryId:this.contentSpaceLibraryId,objectId:n,versionHash:i,metadataSubtree:"public"});case 32:if(t.t1=t.sent,t.t1){t.next=35;break}t.t1={};case 35:t.t2=t.t1,c={public:t.t2},t.next=45;break;case 39:return t.next=41,this.ContentObjectMetadata({libraryId:this.contentSpaceLibraryId,objectId:n,versionHash:i});case 41:if(t.t3=t.sent,t.t3){t.next=44;break}t.t3={};case 44:c=t.t3;case 45:return t.abrupt("return",{id:n,hash:i,name:c.public&&c.public.name||c.name||n,meta:c});case 48:throw t.prev=48,t.t4=t.catch(27),this.Log("Error looking up content type:"),this.Log(t.t4),new Error("Content Type ".concat(r||n," is invalid"));case 53:case"end":return t.stop()}}),t,this,[[5,11],[27,48]])})));return function(e){return t.apply(this,arguments)}}(),e.ContentTypes=s(a.mark((function t(){var e,r,n,i=this;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.contentTypes=this.contentTypes||{},this.Log("Looking up all available content types"),t.next=4,this.Collection({collectionType:"contentTypes"});case 4:return e=t.sent,this.Log("Personally available types:"),this.Log(e),r={},t.prev=8,t.next=11,this.ContentObjectMetadata({libraryId:this.contentSpaceLibraryId,objectId:this.contentSpaceObjectId,metadataSubtree:"public/contentTypes"});case 11:if(t.t0=t.sent,t.t0){t.next=14;break}t.t0={};case 14:r=t.t0,t.next=19;break;case 17:t.prev=17,t.t1=t.catch(8);case 19:return n=Object.values(r).map((function(t){return i.utils.HashToAddress(t)})),this.Log("Content space types:"),this.Log(n),e=e.concat(n).filter((function(t){return t})).map((function(t){return i.utils.FormatAddress(t)})).filter((function(t,e,r){return r.indexOf(t)===e})),t.next=25,Promise.all(e.map(function(){var t=s(a.mark((function t(e){var r;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=i.utils.AddressToObjectId(e),i.contentTypes[r]){t.next=11;break}return t.prev=2,t.next=5,i.ContentType({typeId:r,publicOnly:!0});case 5:i.contentTypes[r]=t.sent,t.next=11;break;case 8:t.prev=8,t.t0=t.catch(2),console.error(t.t0);case 11:case"end":return t.stop()}}),t,null,[[2,8]])})));return function(e){return t.apply(this,arguments)}}()));case 25:return t.abrupt("return",this.contentTypes);case 26:case"end":return t.stop()}}),t,this,[[8,17]])}))),e.ContentLibraries=s(a.mark((function t(){var e,r=this;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.Collection({collectionType:"libraries"});case 2:return e=t.sent,t.abrupt("return",e.map((function(t){return r.utils.AddressToLibraryId(t)})));case 4:case"end":return t.stop()}}),t,this)}))),e.ContentLibrary=function(){var t=s(a.mark((function t(e){var r,n,i;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,d(r),n=l("qlibs",r),t.t0=this.utils,t.t1=this.HttpClient,t.next=7,this.authClient.AuthorizationHeader({libraryId:r});case 7:return t.t2=t.sent,t.t3=n,t.t4={headers:t.t2,method:"GET",path:t.t3},t.t5=t.t1.Request.call(t.t1,t.t4),t.next=13,t.t0.ResponseToJson.call(t.t0,t.t5);case 13:return i=t.sent,t.abrupt("return",c(c({},i),{},{meta:i.meta||{}}));case 15:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.ContentLibraryOwner=function(){var t=s(a.mark((function t(e){var r;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,d(r),t.t0=this.utils,t.next=5,this.ethClient.CallContractMethod({contractAddress:this.utils.HashToAddress(r),methodName:"owner",methodArgs:[]});case 5:return t.t1=t.sent,t.abrupt("return",t.t0.FormatAddress.call(t.t0,t.t1));case 7:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.LibraryContentTypes=function(){var t=s(a.mark((function t(e){var r,n,i,o=this;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,d(r),this.Log("Retrieving library content types for ".concat(r)),t.next=5,this.ethClient.CallContractMethod({contractAddress:this.utils.HashToAddress(r),methodName:"contentTypesLength",methodArgs:[]});case 5:if(n=t.sent.toNumber(),this.Log("".concat(n," types")),0!==n){t.next=9;break}return t.abrupt("return",{});case 9:return i={},t.next=12,Promise.all(Array.from(new Array(n),function(){var t=s(a.mark((function t(e,n){var s,u;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,o.ethClient.CallContractMethod({contractAddress:o.utils.HashToAddress(r),methodName:"contentTypes",methodArgs:[n]});case 2:return s=t.sent,u=o.utils.AddressToObjectId(s),t.next=6,o.ContentType({typeId:u});case 6:i[u]=t.sent;case 7:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}()));case 12:return this.Log(i),t.abrupt("return",i);case 14:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.ContentObjects=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,n=e.filterOptions,i=void 0===n?{}:n,d(r),this.Log("Retrieving content objects from ".concat(r)),o=l("qlibs",r,"q"),s={filter:[]},i.cacheId&&(s.cache_id=i.cacheId),i.start&&(s.start=i.start),i.limit&&(s.limit=i.limit),i.select&&(s.select=i.select),i.sort&&(s.sort_by=i.sort,i.sortDesc&&(s.sort_descending=!0)),u={eq:":eq:",neq:":ne:",lt:":lt:",lte:":le:",gt:":gt:",gte:":ge:",cnt:":co:",ncnt:":nc:"},c=function(t){var e=t.key,r=t.type,n=t.filter;s.filter.push("".concat(e).concat(u[r]).concat(n))},i.filter&&(Array.isArray(i.filter)?i.filter.forEach((function(t){return c(t)})):c(i.filter)),this.Log("Filter options:"),this.Log(i),t.t0=this.utils,t.t1=this.HttpClient,t.next=19,this.authClient.AuthorizationHeader({libraryId:r});case 19:return t.t2=t.sent,t.t3=o,t.t4=s,t.t5={headers:t.t2,method:"GET",path:t.t3,queryParams:t.t4},t.t6=t.t1.Request.call(t.t1,t.t5),t.next=26,t.t0.ResponseToJson.call(t.t0,t.t6);case 26:return t.abrupt("return",t.sent);case 27:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.ContentObject=function(){var t=s(a.mark((function t(e){var r,n,i,o;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,n=e.objectId,i=e.versionHash,v({libraryId:r,objectId:n,versionHash:i}),this.Log("Retrieving content object: ".concat(r||""," ").concat(n||i)),i&&(n=this.utils.DecodeVersionHash(i).objectId),o=l("q",i||n),t.t0=this.utils,t.t1=this.HttpClient,t.next=9,this.authClient.AuthorizationHeader({libraryId:r,objectId:n,versionHash:i});case 9:return t.t2=t.sent,t.t3=o,t.t4={headers:t.t2,method:"GET",path:t.t3},t.t5=t.t1.Request.call(t.t1,t.t4),t.next=15,t.t0.ResponseToJson.call(t.t0,t.t5);case 15:return t.abrupt("return",t.sent);case 16:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.ContentObjectOwner=function(){var t=s(a.mark((function t(e){var r;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.objectId,p(r),this.Log("Retrieving content object owner: ".concat(r)),t.t0=this.utils,t.next=6,this.ethClient.CallContractMethod({contractAddress:this.utils.HashToAddress(r),methodName:"owner",methodArgs:[]});case 6:return t.t1=t.sent,t.abrupt("return",t.t0.FormatAddress.call(t.t0,t.t1));case 8:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.ContentObjectTenantId=function(){var t=s(a.mark((function t(e){var r,n;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.objectId,(n=e.versionHash)?m(n):p(r),n&&(r=this.utils.DecodeVersionHash(n).objectId),this.objectTenantIds[r]){t.next=7;break}return t.next=6,this.authClient.MakeElvMasterCall({methodName:"elv_getTenantById",params:[this.contentSpaceId,r]});case 6:this.objectTenantIds[r]=t.sent;case 7:return t.abrupt("return",this.objectTenantIds[r]);case 8:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.ContentObjectLibraryId=function(){var t=s(a.mark((function t(e){var r,n,i=this;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.objectId,(n=e.versionHash)?m(n):p(r),n&&(r=this.utils.DecodeVersionHash(n).objectId),t.next=5,this.authClient.AccessType(r);case 5:t.t0=t.sent,t.next=t.t0===this.authClient.ACCESS_TYPES.LIBRARY?8:t.t0===this.authClient.ACCESS_TYPES.OBJECT?9:t.t0===this.authClient.ACCESS_TYPES.OTHER?20:21;break;case 8:return t.abrupt("return",this.utils.AddressToLibraryId(this.utils.HashToAddress(r)));case 9:return this.objectLibraryIds[r]||(this.Log("Retrieving content object library ID: ".concat(r||n)),this.objectLibraryIds[r]=new Promise(function(){var t=s(a.mark((function t(e,n){return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.t0=e,t.t1=i.utils,t.next=5,i.CallContractMethod({contractAddress:i.utils.HashToAddress(r),methodName:"libraryAddress"});case 5:t.t2=t.sent,t.t3=t.t1.AddressToLibraryId.call(t.t1,t.t2),(0,t.t0)(t.t3),t.next=13;break;case 10:t.prev=10,t.t4=t.catch(0),n(t.t4);case 13:case"end":return t.stop()}}),t,null,[[0,10]])})));return function(e,r){return t.apply(this,arguments)}}())),t.prev=10,t.next=13,this.objectLibraryIds[r];case 13:return t.abrupt("return",t.sent);case 16:throw t.prev=16,t.t1=t.catch(10),delete this.objectLibraryIds[r],t.t1;case 20:throw Error("Unable to retrieve library ID for ".concat(n||r,": Unknown type. (wrong network or deleted object?)"));case 21:return t.abrupt("return",this.contentSpaceLibraryId);case 22:case"end":return t.stop()}}),t,this,[[10,16]])})));return function(e){return t.apply(this,arguments)}}(),e.ProduceMetadataLinks=function(){var t=s(a.mark((function t(e){var r,n,o,u,h,f,d,p,m,y=this;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.libraryId,n=e.objectId,o=e.versionHash,u=e.path,h=void 0===u?"/":u,f=e.metadata,d=e.authorizationToken,p=e.noAuth,f&&"object"===i(f)){t.next=3;break}return t.abrupt("return",f);case 3:if(!Array.isArray(f)){t.next=7;break}return t.next=6,this.utils.LimitedMap(5,f,function(){var t=s(a.mark((function t(e,i){return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,y.ProduceMetadataLinks({libraryId:r,objectId:n,versionHash:o,path:l(h,i.toString()),metadata:e,authorizationToken:d,noAuth:p});case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}());case 6:return t.abrupt("return",t.sent);case 7:if(!f["/"]||!f["/"].match(/\.\/(rep|files)\/.+/)&&!f["/"].match(/^\/?qfab\/([\w]+)\/?(rep|files)\/.+/)){t.next=16;break}return t.t0=c,t.t1=c({},f),t.t2={},t.next=13,this.LinkUrl({libraryId:r,objectId:n,versionHash:o,linkPath:h,authorizationToken:d});case 13:return t.t3=t.sent,t.t4={url:t.t3},t.abrupt("return",(0,t.t0)(t.t1,t.t2,t.t4));case 16:return m={},t.next=19,this.utils.LimitedMap(5,Object.keys(f),function(){var t=s(a.mark((function t(e){return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,y.ProduceMetadataLinks({libraryId:r,objectId:n,versionHash:o,path:l(h,e),metadata:f[e],authorizationToken:d,noAuth:p});case 2:m[e]=t.sent;case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}());case 19:return t.abrupt("return",m);case 20:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.MetadataAuth=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u,c,l,h,f,d,p,m;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.libraryId,n=e.objectId,i=e.versionHash,o=e.path,s=void 0===o?"/":o,u=e.channelAuth,c=void 0!==u&&u,l=e.noAuth,h=void 0!==l&&l,v({libraryId:r,objectId:n,versionHash:i}),i&&(n=this.utils.DecodeVersionHash(i).objectId),h=this.noAuth||h,f=h,h){t.next=14;break}return t.next=8,this.Visibility({id:n});case 8:return p=t.sent,t.next=11,this.AccessType({id:n});case 11:d=t.sent,f=(s||"").replace(/^\/+/,"").startsWith("public"),h=p>=10||f&&p>=1;case 14:if(!this.oauthToken){t.next=22;break}return t.next=17,this.authClient.KMSAddress({objectId:n,versionHash:i});case 17:if(!(m=t.sent)||this.utils.EqualAddress(m,this.utils.nullAddress)){t.next=22;break}return t.next=21,this.authClient.AuthorizationToken({libraryId:r,objectId:n,versionHash:i,channelAuth:!0,oauthToken:this.oauthToken});case 21:return t.abrupt("return",t.sent);case 22:if(this.inaccessibleLibraries[r]||!f||d!==this.authClient.ACCESS_TYPES.OBJECT||c){t.next=48;break}if(t.prev=23,t.t0=this.authClient,t.t1=r,t.t1){t.next=30;break}return t.next=29,this.ContentObjectLibraryId({objectId:n,versionHash:i});case 29:t.t1=t.sent;case 30:return t.t2=t.t1,t.t3=h,t.t4={libraryId:t.t2,noAuth:t.t3},t.next=35,t.t0.AuthorizationToken.call(t.t0,t.t4);case 35:return t.abrupt("return",t.sent);case 38:if(t.prev=38,t.t5=t.catch(23),!t.t5.message||!t.t5.message.toLowerCase().startsWith("access denied")){t.next=45;break}return this.inaccessibleLibraries[r]=!0,t.next=44,this.authClient.AuthorizationToken({libraryId:r,objectId:n,versionHash:i,noAuth:h,channelAuth:c});case 44:return t.abrupt("return",t.sent);case 45:throw t.t5;case 46:t.next=51;break;case 48:return t.next=50,this.authClient.AuthorizationToken({libraryId:r,objectId:n,versionHash:i,noAuth:h,channelAuth:c});case 50:return t.abrupt("return",t.sent);case 51:case"end":return t.stop()}}),t,this,[[23,38]])})));return function(e){return t.apply(this,arguments)}}(),e.ContentObjectMetadata=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u,h,f,d,p,m,y,g,b,w,_,k,x,A,E,S,I,M,T,P,C,O,R,N;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,n=e.objectId,i=e.versionHash,o=e.writeToken,s=e.metadataSubtree,u=void 0===s?"/":s,h=e.queryParams,f=void 0===h?{}:h,d=e.select,p=void 0===d?[]:d,m=e.remove,y=void 0===m?[]:m,g=e.authorizationToken,b=e.noAuth,w=void 0!==b&&b,_=e.resolveLinks,k=void 0!==_&&_,x=e.resolveIncludeSource,A=void 0!==x&&x,E=e.resolveIgnoreErrors,S=void 0!==E&&E,I=e.linkDepthLimit,M=void 0===I?1:I,T=e.produceLinkUrls,P=void 0!==T&&T,v({libraryId:r,objectId:n,versionHash:i}),this.Log("Retrieving content object metadata: ".concat(r||""," ").concat(n||i," ").concat(o||"","\n Subtree: ").concat(u)),f=c({},f||{}),i&&(n=this.utils.DecodeVersionHash(i).objectId),C=l("q",o||i||n,"meta",u),t.next=8,this.MetadataAuth({libraryId:r,objectId:n,versionHash:i,path:u,noAuth:w});case 8:return O=t.sent,R=[g,f.authorization,O].flat().filter((function(t){return t})),delete f.authorization,t.prev=11,t.next=14,this.utils.ResponseToJson(this.HttpClient.Request({headers:{Authorization:R.map((function(t){return"Bearer ".concat(t)}))},queryParams:c(c({},f),{},{select:p,remove:y,link_depth:M,resolve:k,resolve_include_source:A,resolve_ignore_errors:S}),method:"GET",path:C}));case 14:N=t.sent,t.next=22;break;case 17:if(t.prev=17,t.t0=t.catch(11),404===t.t0.status){t.next=21;break}throw t.t0;case 21:N="/"===u?{}:void 0;case 22:if(P){t.next=24;break}return t.abrupt("return",N);case 24:return t.next=26,this.ProduceMetadataLinks({libraryId:r,objectId:n,versionHash:i,path:u,metadata:N,authorizationToken:g,noAuth:w});case 26:return t.abrupt("return",t.sent);case 27:case"end":return t.stop()}}),t,this,[[11,17]])})));return function(e){return t.apply(this,arguments)}}(),e.AssetMetadata=function(){var t=s(a.mark((function t(e){var r,i,o,s,u,h,f,d,p,m=this;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.libraryId,i=e.objectId,o=e.versionHash,s=e.metadata,u=e.localization,h=e.noAuth,f=e.produceLinkUrls,d=void 0!==f&&f,v({libraryId:r,objectId:i,versionHash:o}),i||(i=this.utils.DecodeVersionHash(o).objectId),s){t.next=12;break}return t.next=6,this.ContentObjectMetadata({libraryId:r,objectId:i,versionHash:o,metadataSubtree:"public/asset_metadata",resolveLinks:!0,linkDepthLimit:2,resolveIgnoreErrors:!0,produceLinkUrls:d,noAuth:h});case 6:if(t.t0=t.sent,t.t0){t.next=9;break}t.t0={};case 9:s=t.t0,t.next=16;break;case 12:if(!d){t.next=16;break}return t.next=15,this.ProduceMetadataLinks({libraryId:r,objectId:i,versionHash:o,path:l("public","asset_metadata"),metadata:s,noAuth:h});case 15:s=t.sent;case 16:return s.info||(s.info={}),p=c({},s),u&&u.reverse().forEach((function(t){var e,r=(e=m.utils).SafeTraverse.apply(e,[s].concat(n(t)))||{};p=b({},p,r,(function(t,e){return null===e||""===e?t:void 0}))})),t.abrupt("return",p);case 20:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.ContentObjectVersions=function(){var t=s(a.mark((function t(e){var r,n,i;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,n=e.objectId,v({libraryId:r,objectId:n}),this.Log("Retrieving content object versions: ".concat(r||""," ").concat(n)),i=l("qid",n),t.t0=this.utils,t.t1=this.HttpClient,t.next=8,this.authClient.AuthorizationHeader({libraryId:r,objectId:n});case 8:return t.t2=t.sent,t.t3=i,t.t4={headers:t.t2,method:"GET",path:t.t3},t.t5=t.t1.Request.call(t.t1,t.t4),t.abrupt("return",t.t0.ResponseToJson.call(t.t0,t.t5));case 13:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.LatestVersionHash=function(){var t=s(a.mark((function t(e){var r,n,i,o;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.objectId,(n=e.versionHash)&&(r=this.utils.DecodeVersionHash(n).objectId),p(r),t.prev=3,t.next=6,this.CallContractMethod({contractAddress:this.utils.HashToAddress(r),methodName:"objectHash"});case 6:i=t.sent,t.next=11;break;case 9:t.prev=9,t.t0=t.catch(3);case 11:if(i){t.next=20;break}return t.next=14,this.CallContractMethod({contractAddress:this.utils.HashToAddress(r),methodName:"countVersionHashes"});case 14:if((o=t.sent).toNumber()){t.next=17;break}throw Error("Unable to determine latest version hash for ".concat(n||r," - Item deleted?"));case 17:return t.next=19,this.CallContractMethod({contractAddress:this.utils.HashToAddress(r),methodName:"versionHashes",methodArgs:[o-1]});case 19:i=t.sent;case 20:return t.abrupt("return",i);case 21:case"end":return t.stop()}}),t,this,[[3,9]])})));return function(e){return t.apply(this,arguments)}}(),e.AvailableDRMs=s(a.mark((function t(){var e,r,n,i,o,s,u,c,l;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=["clear","aes-128"],"undefined"!=typeof window){t.next=3;break}return t.abrupt("return",e);case 3:if(window.navigator&&window.navigator.userAgent&&((r=window.navigator.userAgent.match(/(iPad|iPhone|iphone|iPod).*?(OS |os |OS_)(\d+((_|\.)\d)?((_|\.)\d)?)/))&&r[3]&&(n=r[3].split("_"),i=parseInt(n[0]),o=parseInt(n[1]),(i>13||13===i&&o>=1)&&(e[1]="sample-aes",e[2]="fairplay")),/^((?!chrome|android).)*safari/i.test(window.navigator.userAgent)&&(s=window.navigator.userAgent.match(/.+Version\/(\d+)\.(\d+)/))&&s[2]&&(u=parseInt(s[1]),c=parseInt(s[2]),(u>13||13===u&&c>=1)&&(e[1]="sample-aes",e[2]="fairplay"))),"undefined"==typeof window||"function"==typeof window.navigator.requestMediaKeySystemAccess){t.next=6;break}return t.abrupt("return",e);case 6:return t.prev=6,l=[{initDataTypes:["cenc"],audioCapabilities:[{contentType:'audio/mp4;codecs="mp4a.40.2"'}],videoCapabilities:[{contentType:'video/mp4;codecs="avc1.42E01E"'}]}],t.next=10,navigator.requestMediaKeySystemAccess("com.widevine.alpha",l);case 10:e.push("widevine"),t.next=15;break;case 13:t.prev=13,t.t0=t.catch(6);case 15:return t.abrupt("return",e);case 16:case"end":return t.stop()}}),t,null,[[6,13]])}))),e.PlayoutPathResolution=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u,c,h,f,d,p,m,y,g,v,b,w;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.libraryId,n=e.objectId,i=e.versionHash,o=e.writeToken,s=e.linkPath,u=e.handler,c=e.offering,h=void 0===c?"":c,f=e.signedLink,d=void 0!==f&&f,p=e.authorizationToken,r){t.next=5;break}return t.next=4,this.ContentObjectLibraryId({objectId:n});case 4:r=t.sent;case 5:if(i){t.next=9;break}return t.next=8,this.LatestVersionHash({objectId:n});case 8:i=t.sent;case 9:if(m=l("qlibs",r,"q",o||i,"rep",u,h,"options.json"),!s){t.next=26;break}return t.next=13,this.ContentObjectMetadata({libraryId:r,objectId:n,versionHash:i,writeToken:o,metadataSubtree:s,resolveLinks:!1,resolveIgnoreErrors:!0,resolveIncludeSource:!0,authorizationToken:p});case 13:if(w=t.sent,b=!!w&&!!w["/"]&&!w["/"].endsWith("options.json"),m=l("qlibs",r,"q",o||i,"meta",s),d){t.next=25;break}return t.next=19,this.LinkTarget({libraryId:r,objectId:n,versionHash:i,writeToken:o,linkPath:s,linkInfo:w,authorizationToken:p});case 19:return v=t.sent,g=this.utils.DecodeVersionHash(v).objectId,t.next=23,this.ContentObjectLibraryId({objectId:g});case 23:y=t.sent,b||h||(m=l("q",v,"rep",u,"options.json"));case 25:b&&(m=l(m,h,"options.json"));case 26:return t.abrupt("return",{path:m,multiOfferingLink:b,linkTarget:{libraryId:y,objectId:g,versionHash:v}});case 27:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.AvailableOfferings=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u,c,l,h,f,d,p;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.objectId,n=e.versionHash,i=e.writeToken,o=e.linkPath,s=e.signedLink,u=e.directLink,c=e.handler,l=void 0===c?"playout":c,h=e.authorizationToken,r||(r=this.utils.DecodeVersionHash(n).objectId),!u){t.next=15;break}return t.t0=this,t.next=6,this.ContentObjectLibraryId({objectId:r});case 6:return t.t1=t.sent,t.t2=r,t.t3=n,t.t4=o,t.t5=h,t.t6={libraryId:t.t1,objectId:t.t2,versionHash:t.t3,metadataSubtree:t.t4,resolveLinks:!0,authorizationToken:t.t5},t.next=14,t.t0.ContentObjectMetadata.call(t.t0,t.t6);case 14:return t.abrupt("return",t.sent);case 15:return t.next=17,this.PlayoutPathResolution({objectId:r,versionHash:n,writeToken:i,linkPath:o,signedLink:s,handler:l,authorizationToken:h});case 17:return f=t.sent,d=f.path,t.prev=19,t.t7=h,t.next=23,this.authClient.AuthorizationToken({objectId:r,channelAuth:!0,oauthToken:this.oauthToken});case 23:return t.t8=t.sent,p=[t.t7,t.t8].flat().filter((function(t){return t})),t.next=27,this.utils.ResponseToJson(this.HttpClient.Request({path:d,method:"GET",headers:{Authorization:"Bearer ".concat(p.join(","))}}));case 27:return t.abrupt("return",t.sent);case 30:if(t.prev=30,t.t9=t.catch(19),!t.t9.status||500!==parseInt(t.t9.status)){t.next=34;break}return t.abrupt("return",{});case 34:throw t.t9;case 35:case"end":return t.stop()}}),t,this,[[19,30]])})));return function(e){return t.apply(this,arguments)}}(),e.PlayoutOptions=function(){var t=s(a.mark((function t(e){var r,n,i,u,h,f,d,y,g,v,b,w,_,k,x,A,E,S,I,M,T,P,C,O,R,N,j,L,U,D,B,z,F,H,q,G,V,K,Z,W,J,Q,$,Y,X,tt,et=this;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.offeringURI,n=e.objectId,i=e.versionHash,u=e.writeToken,h=e.linkPath,f=e.signedLink,d=void 0!==f&&f,y=e.protocols,g=void 0===y?["dash","hls"]:y,v=e.handler,b=void 0===v?"playout":v,w=e.offering,_=void 0===w?"default":w,k=e.playoutType,x=e.drms,A=void 0===x?[]:x,E=e.context,S=e.hlsjsProfile,I=void 0===S||S,M=e.authorizationToken,T=e.options,P=void 0===T?{}:T,!r){t.next=8;break}if(C=r.match(/(hq__[^/]+)\/rep\/([^/]+)\/([^/]+)\/options.json/),i=C[1],b=C[2],_=C[3],i&&b&&_){t.next=8;break}throw Error("Invalid offering URI: ".concat(r));case 8:if(i?m(i):p(n),g=g.map((function(t){return t.toLowerCase()})),A=A.map((function(t){return t.toLowerCase()})),n){t.next=15;break}n=this.utils.DecodeVersionHash(i).objectId,t.next=19;break;case 15:if(i){t.next=19;break}return t.next=18,this.LatestVersionHash({objectId:n});case 18:i=t.sent;case 19:return t.next=21,this.ContentObjectLibraryId({objectId:n});case 21:if(O=t.sent,t.prev=22,h){t.next=29;break}return R=l("public","asset_metadata","sources",_),t.next=27,this.ContentObjectMetadata({libraryId:O,objectId:n,versionHash:i,metadataSubtree:R,authorizationToken:M});case 27:t.sent&&(h=R);case 29:t.next=33;break;case 31:t.prev=31,t.t0=t.catch(22);case 33:return t.next=35,this.PlayoutPathResolution({libraryId:O,objectId:n,versionHash:i,writeToken:u,linkPath:h,signedLink:d,handler:b,offering:_,authorizationToken:M});case 35:if(N=t.sent,j=N.path,L=N.linkTarget,t.t1=this.authClient,t.t2=L.objectId||n,t.t3=L.versionHash||i,t.t3){t.next=45;break}return t.next=44,this.LatestVersionHash({objectId:n});case 44:t.t3=t.sent;case 45:return t.t4=t.t3,t.t5=g,t.t6=A,t.t7=E,t.t8={objectId:t.t2,versionHash:t.t4,protocols:t.t5,drms:t.t6,context:t.t7},U=t.t1.AudienceData.call(t.t1,t.t8),t.t9=M,t.next=54,this.authClient.AuthorizationToken({libraryId:O,objectId:n,channelAuth:!0,oauthToken:this.oauthToken,audienceData:U});case 54:return t.t10=t.sent,D=[t.t9,t.t10].flat().filter((function(t){return t})),B=c({authorization:D,resolve:!!h},P),t.t11=Object,t.next=60,this.utils.ResponseToJson(this.HttpClient.Request({path:j,method:"GET",queryParams:B}));case 60:if(t.t12=t.sent,z=t.t11.values.call(t.t11,t.t12),d||!L.versionHash){t.next=68;break}return t.t13=M,t.next=66,this.authClient.AuthorizationToken({libraryId:L.libraryId,objectId:L.objectId,channelAuth:!0,oauthToken:this.oauthToken,audienceData:U});case 66:t.t14=t.sent,B.authorization=[t.t13,t.t14].flat().filter((function(t){return t}));case 68:F={},G=0;case 70:if(!(G<z.length)){t.next=116;break}if(V=z[G],K=V.properties.protocol,Z=V.properties.drm,H=H||V.sid,q=q||!!V.properties.multiview,H&&(B.sid=H),W=V.uri.split("?")[0],k&&(W=W.replace("playlist","playlist-".concat(k))),J=V.properties.license_servers,Q=V.properties.cert,I&&"hls"===K&&"aes-128"===Z&&(B.player_profile="hls-js"),t.t15=c,t.t16=c({},F[K]||{}),t.t17={},t.t18=c,t.t19=c({},(F[K]||{}).playoutMethods||{}),t.t20={},t.t21=o,t.t22={},t.t23=Z||"clear",!d){t.next=97;break}return t.next=94,this.LinkUrl({versionHash:i,linkPath:l(h,_,W),queryParams:B,noAuth:!0});case 94:t.t24=t.sent,t.next=100;break;case 97:return t.next=99,this.Rep({libraryId:L.libraryId||O,objectId:L.objectId||n,versionHash:L.versionHash||i,rep:l(b,_,W),noAuth:!0,queryParams:B});case 99:t.t24=t.sent;case 100:for($ in t.t25=t.t24,t.t26=Z?o({},Z,{licenseServers:J,cert:Q}):void 0,t.t27={playoutUrl:t.t25,drms:t.t26},t.t28=(0,t.t21)(t.t22,t.t23,t.t27),t.t29=(0,t.t18)(t.t19,t.t20,t.t28),t.t30={playoutMethods:t.t29},F[K]=(0,t.t15)(t.t16,t.t17,t.t30),F[K].playoutMethods)F[K].playoutMethods[$].drms&&F[K].playoutMethods[$].drms[Z]&&F[K].playoutMethods[$].drms[Z].cert&&((Y=new URL(F[K].playoutMethods[$].playoutUrl)).pathname=Y.pathname.split("/").slice(0,-1).concat(["drm.cert"]).join("/"),F[K].playoutMethods[$].drms[Z].cert_url=Y.toString());if(X=g.includes(K),tt=A.includes(Z||"clear")||0===A.length&&!Z,X&&tt){t.next=112;break}return t.abrupt("continue",113);case 112:(!F[K].playoutUrl||Z&&"clear"!==Z)&&(F[K].playoutUrl=F[K].playoutMethods[Z||"clear"].playoutUrl,F[K].drms=F[K].playoutMethods[Z||"clear"].drms);case 113:G++,t.next=70;break;case 116:return q&&H&&(F.sessionId=H,F.multiview=!0,F.AvailableViews=s(a.mark((function t(){return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=et.utils,t.next=3,et.HttpClient.Request({path:l("q",L.versionHash||i,"rep",b,_,"views.json"),method:"GET",queryParams:{sid:H,authorization:D}});case 3:return t.t1=t.sent,t.next=6,t.t0.ResponseToFormat.call(t.t0,"json",t.t1);case 6:return t.abrupt("return",t.sent);case 7:case"end":return t.stop()}}),t)}))),F.SwitchView=function(){var t=s(a.mark((function t(e){return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,et.HttpClient.Request({path:l("q",L.versionHash||i,"rep",b,_,"select_view"),method:"POST",queryParams:{sid:H,authorization:D},body:{view:e}});case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),this.Log(F),t.abrupt("return",F);case 119:case"end":return t.stop()}}),t,this,[[22,31]])})));return function(e){return t.apply(this,arguments)}}(),e.BitmovinPlayoutOptions=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u,c,l,h,f,d,y,g,v,b,w,_,k,x,A,E,S,I,M;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.objectId,n=e.versionHash,i=e.writeToken,o=e.linkPath,s=e.signedLink,u=void 0!==s&&s,c=e.protocols,l=void 0===c?["dash","hls"]:c,h=e.drms,f=void 0===h?[]:h,d=e.handler,y=void 0===d?"playout":d,g=e.offering,v=void 0===g?"default":g,b=e.playoutType,w=e.context,_=e.authorizationToken,k=e.options,x=void 0===k?{}:k,n?m(n):p(r),r||(r=this.utils.DecodeVersionHash(n).objectId),t.next=5,this.PlayoutOptions({objectId:r,versionHash:n,writeToken:i,linkPath:o,signedLink:u,protocols:l,drms:f,handler:y,offering:v,playoutType:b,hlsjsProfile:!1,context:w,authorizationToken:_,options:x});case 5:return delete(A=t.sent).playoutMethods,t.next=9,this.PlayoutPathResolution({objectId:r,versionHash:n,writeToken:i,linkPath:o,signedLink:u,handler:y,offering:v,authorizationToken:_});case 9:if(E=t.sent,S=E.linkTarget,I=[],_&&I.push(_),!u&&S.versionHash){t.next=21;break}return t.t0=I,t.next=17,this.authClient.AuthorizationToken({objectId:r,channelAuth:!0,oauthToken:this.oauthToken});case 17:t.t1=t.sent,t.t0.push.call(t.t0,t.t1),t.next=26;break;case 21:return t.t2=I,t.next=24,this.authClient.AuthorizationToken({libraryId:S.libraryId,objectId:S.objectId,channelAuth:!0,oauthToken:this.oauthToken});case 24:t.t3=t.sent,t.t2.push.call(t.t2,t.t3);case 26:return M={drm:{}},Object.keys(A).forEach((function(t){var e=A[t];M[t]=e.playoutUrl,e.drms&&Object.keys(e.drms).forEach((function(t){if(e.drms[t].licenseServers&&0!==e.drms[t].licenseServers.length){var r=function(t){return t.toLowerCase().startsWith("https")},n=e.drms[t].licenseServers;n.find(r)&&(n=n.filter(r));var i=n.sort((function(){return.5-Math.random()}))[0];M.drm[t]||(M.drm[t]={LA_URL:i,headers:{Authorization:"Bearer ".concat(I.flat().filter((function(t){return t})).join(","))}})}}))})),t.abrupt("return",M);case 29:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.CallBitcodeMethod=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u,c,h,f,d,p,m,y,g,b,w;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.libraryId,n=e.objectId,i=e.versionHash,o=e.writeToken,s=e.method,u=e.queryParams,c=void 0===u?{}:u,h=e.body,f=void 0===h?{}:h,d=e.headers,p=void 0===d?{}:d,m=e.constant,y=void 0===m||m,g=e.format,b=void 0===g?"json":g,v({libraryId:r,objectId:n,versionHash:i}),s){t.next=4;break}throw"Bitcode method not specified";case 4:if(i&&(n=this.utils.DecodeVersionHash(i).objectId),w=l("q",o||i||n,"call",s),r&&(w=l("qlibs",r,w)),p.authorization||p.Authorization){t.next=12;break}return t.next=11,this.authClient.AuthorizationHeader({libraryId:r,objectId:n,update:!y});case 11:p.Authorization=t.sent.Authorization;case 12:return this.Log("Calling bitcode method: ".concat(r||""," ").concat(n||i," ").concat(o||"","\n ").concat(y?"GET":"POST"," ").concat(w,"\n Query Params:\n ").concat(JSON.stringify(c||""),"\n Body:\n ").concat(JSON.stringify(f||""),"\n Headers\n ").concat(JSON.stringify(p||""))),t.t0=this.utils,t.t1=b,t.next=17,this.HttpClient.Request({body:f,headers:p,method:y?"GET":"POST",path:w,queryParams:c,failover:!1});case 17:return t.t2=t.sent,t.abrupt("return",t.t0.ResponseToFormat.call(t.t0,t.t1,t.t2));case 19:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.Rep=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u,c,l,h,f,d,p;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.libraryId,n=e.objectId,i=e.versionHash,o=e.rep,s=e.queryParams,u=void 0===s?{}:s,c=e.channelAuth,l=void 0!==c&&c,h=e.noAuth,f=void 0!==h&&h,d=e.noCache,p=void 0!==d&&d,v({libraryId:r,objectId:n,versionHash:i}),o){t.next=4;break}throw"Rep not specified";case 4:return t.abrupt("return",this.FabricUrl({libraryId:r,objectId:n,versionHash:i,rep:o,queryParams:u,channelAuth:l,noAuth:f,noCache:p}));case 5:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.PublicRep=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.libraryId,n=e.objectId,i=e.versionHash,o=e.rep,s=e.queryParams,u=void 0===s?{}:s,v({libraryId:r,objectId:n,versionHash:i}),o){t.next=4;break}throw"Rep not specified";case 4:return t.abrupt("return",this.FabricUrl({libraryId:r,objectId:n,versionHash:i,publicRep:o,queryParams:u,noAuth:!0}));case 5:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.FabricUrl=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u,h,f,d,p,m,y,g,b,w,_,k,x;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.libraryId,n=e.objectId,i=e.versionHash,o=e.writeToken,s=e.partHash,u=e.rep,h=e.publicRep,f=e.call,d=e.queryParams,p=void 0===d?{}:d,m=e.channelAuth,y=void 0!==m&&m,g=e.noAuth,b=void 0!==g&&g,w=e.noCache,_=void 0!==w&&w,(n||i)&&v({libraryId:r,objectId:n,versionHash:i}),i&&(n=this.utils.DecodeVersionHash(i).objectId),this.Log("Building Fabric URL:\n libraryId: ".concat(r,"\n objectId: ").concat(n,"\n versionHash: ").concat(i,"\n writeToken: ").concat(o,"\n partHash: ").concat(s,"\n rep: ").concat(u,"\n publicRep: ").concat(h,"\n call: ").concat(f,"\n channelAuth: ").concat(y,"\n noAuth: ").concat(b,"\n noCache: ").concat(_,"\n queryParams: ").concat(JSON.stringify(p||{},null,2))),k=[],p.authorization&&k.push(p.authorization),b&&p.authorization){t.next=12;break}return t.t0=k,t.next=10,this.authClient.AuthorizationToken({libraryId:r,objectId:n,versionHash:i,channelAuth:y,noAuth:b,noCache:_});case 10:t.t1=t.sent,t.t0.push.call(t.t0,t.t1);case 12:if(p=c(c({},p),{},{authorization:k.flat()}),!u&&!h||!n||i){t.next=17;break}return t.next=16,this.LatestVersionHash({objectId:n});case 16:i=t.sent;case 17:return x="",r?(x=l(x,"qlibs",r),(n||i)&&(x=l(x,"q",o||i||n))):i&&(x=l("q",i)),s?x=l(x,"data",s):u?x=l(x,"rep",u):h?x=l(x,"public",h):f&&(x=l(x,"call",f)),t.abrupt("return",this.HttpClient.URL({path:x,queryParams:p}));case 21:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.FileUrl=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u,h,f,d,p,m,y;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.libraryId,n=e.objectId,i=e.versionHash,o=e.writeToken,s=e.filePath,u=e.queryParams,h=void 0===u?{}:u,f=e.noCache,d=void 0!==f&&f,v({libraryId:r,objectId:n,versionHash:i}),s){t.next=4;break}throw"File path not specified";case 4:return i&&(n=this.utils.DecodeVersionHash(i).objectId),p=r?l("qlibs",r,"q",o||i||n):l("q",i),t.next=8,this.authClient.AuthorizationToken({libraryId:r,objectId:n,noCache:d});case 8:return m=t.sent,h=c(c({},h),{},{authorization:m}),t.next=12,this.ContentObjectMetadata({libraryId:r,objectId:n,versionHash:i,writeToken:o,metadataSubtree:l("files",s)});case 12:return y=t.sent,y&&y["."].encryption&&"cgck"===y["."].encryption.scheme?(p=l(p,"rep","files_download",s),h["header-x_decryption_mode"]="decrypt"):p=l(p,"files",s),t.abrupt("return",this.HttpClient.URL({path:p,queryParams:h}));case 16:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.ContentObjectImageUrl=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.libraryId,n=e.objectId,i=e.versionHash,o=e.height,s=e.imagePath,u=void 0===s?"public/display_image":s,v({libraryId:r,objectId:n,versionHash:i}),i){t.next=6;break}return t.next=5,this.LatestVersionHash({objectId:n});case 5:i=t.sent;case 6:if(this.Log("Retrieving content object image url: ".concat(r," ").concat(n," ").concat(i)),this.objectImageUrls[i]){t.next=26;break}return t.prev=8,t.next=11,this.ContentObjectMetadata({versionHash:i,metadataSubtree:u});case 11:if(t.sent){t.next=15;break}return this.Log("No image url set: ".concat(r," ").concat(n," ").concat(i)),t.abrupt("return");case 15:t.next=21;break;case 17:t.prev=17,t.t0=t.catch(8),this.Log("Unable to query for image metadata: ".concat(r," ").concat(n," ").concat(i),!0),this.Log(t.t0,!0);case 21:return c={},o&&!isNaN(parseInt(o))&&(c.height=parseInt(o)),t.next=25,this.LinkUrl({versionHash:i,linkPath:u,queryParams:c});case 25:this.objectImageUrls[i]=t.sent;case 26:return t.abrupt("return",this.objectImageUrls[i]);case 27:case"end":return t.stop()}}),t,this,[[8,17]])})));return function(e){return t.apply(this,arguments)}}(),e.ContentObjectGraph=function(){var t=s(a.mark((function t(e){var r,n,i,o,u,c,h,f,d,p,m=this;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,n=e.objectId,i=e.versionHash,o=e.autoUpdate,u=void 0!==o&&o,c=e.select,v({libraryId:r,objectId:n,versionHash:i}),this.Log("Retrieving content object graph: ".concat(r||""," ").concat(n||i)),i&&(n=this.utils.DecodeVersionHash(i).objectId),h=l("q",i||n,"links"),t.prev=5,t.t0=this.utils,t.t1=this.HttpClient,t.next=10,this.authClient.AuthorizationHeader({libraryId:r,objectId:n,versionHash:i});case 10:return t.t2=t.sent,t.t3={auto_update:u,select:c},t.t4=h,t.t5={headers:t.t2,queryParams:t.t3,method:"GET",path:t.t4},t.t6=t.t1.Request.call(t.t1,t.t5),t.next=17,t.t0.ResponseToJson.call(t.t0,t.t6);case 17:return t.abrupt("return",t.sent);case 20:if(t.prev=20,t.t7=t.catch(5),t.prev=22,(d=t.t7.body.errors[0].cause.cause.cause.cycle)&&0!==d.length){t.next=26;break}throw t.t7;case 26:return p={},t.next=29,Promise.all(d.map(function(){var t=s(a.mark((function t(e){var r,n;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!p[e]){t.next=2;break}return t.abrupt("return");case 2:return r=m.utils.DecodeVersionHash(e).objectId,t.next=5,m.ContentObjectMetadata({versionHash:e,metadataSubtree:"public/asset_metadata/display_title"});case 5:if(t.t2=t.sent,t.t2){t.next=10;break}return t.next=9,m.ContentObjectMetadata({versionHash:e,metadataSubtree:"public/name"});case 9:t.t2=t.sent;case 10:if(t.t1=t.t2,t.t1){t.next=15;break}return t.next=14,m.ContentObjectMetadata({versionHash:e,metadataSubtree:"name"});case 14:t.t1=t.sent;case 15:if(t.t0=t.t1,t.t0){t.next=18;break}t.t0=r;case 18:n=t.t0,p[e]={name:n,objectId:r};case 20:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 29:f=d.map((function(t){return"".concat(p[t].name," (").concat(p[t].objectId,")")})),t.next=35;break;case 32:throw t.prev=32,t.t8=t.catch(22),t.t7;case 35:throw new Error("Cycle found in links: ".concat(f.join(" -> ")));case 36:case"end":return t.stop()}}),t,this,[[5,20],[22,32]])})));return function(e){return t.apply(this,arguments)}}(),e.LinkTarget=function(){var t=s(a.mark((function t(e){var r,n,o,s,u,c,l,h,f;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.libraryId,n=e.objectId,o=e.versionHash,s=e.writeToken,u=e.linkPath,c=e.authorizationToken,l=e.linkInfo,v({libraryId:r,objectId:n,versionHash:o}),s&&g(s),o&&(n=this.utils.DecodeVersionHash(o).objectId),!s||r){t.next=8;break}return t.next=7,this.ContentObjectLibraryId({objectId:n});case 7:r=t.sent;case 8:if(l){t.next=12;break}return t.next=11,this.ContentObjectMetadata({libraryId:r,objectId:n,versionHash:o,writeToken:s,metadataSubtree:u,resolveLinks:!1,resolveIgnoreErrors:!0,resolveIncludeSource:!0,authorizationToken:c});case 11:l=t.sent;case 12:if(!l||!l["/"]){t.next=27;break}if((h=((l["/"]||"").match(/^\/?qfab\/([\w]+)\/?.+/)||[])[1])||(h=l["."].container),!h){t.next=19;break}return t.abrupt("return",h);case 19:if(!o){t.next=21;break}return t.abrupt("return",o);case 21:if(t.t0=o,t.t0){t.next=26;break}return t.next=25,this.LatestVersionHash({objectId:n});case 25:t.t0=t.sent;case 26:return t.abrupt("return",t.t0);case 27:return t.next=29,this.ContentObjectMetadata({libraryId:r,objectId:n,versionHash:o,writeToken:s,metadataSubtree:u,resolveIncludeSource:!0,authorizationToken:c});case 29:if((l=t.sent)&&l["."]){t.next=49;break}if("object"!==i(l)){t.next=38;break}if(t.t1=o,t.t1){t.next=37;break}return t.next=36,this.LatestVersionHash({objectId:n});case 36:t.t1=t.sent;case 37:return t.abrupt("return",t.t1);case 38:if(f=u.split("/").slice(0,-1).join("/")){t.next=46;break}if(t.t2=o,t.t2){t.next=45;break}return t.next=44,this.LatestVersionHash({objectId:n});case 44:t.t2=t.sent;case 45:return t.abrupt("return",t.t2);case 46:return t.next=48,this.ContentObjectMetadata({libraryId:r,objectId:n,versionHash:o,writeToken:s,metadataSubtree:f,resolveIncludeSource:!0,authorizationToken:c});case 48:l=t.sent;case 49:return t.abrupt("return",l["."].source);case 50:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.LinkUrl=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u,h,f,d,p,m,y,b,w,_;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.libraryId,n=e.objectId,i=e.versionHash,o=e.writeToken,s=e.linkPath,u=e.mimeType,h=e.authorizationToken,f=e.queryParams,d=void 0===f?{}:f,p=e.channelAuth,m=void 0!==p&&p,y=e.noAuth,b=void 0!==y&&y,v({libraryId:r,objectId:n,versionHash:i}),o&&g(o),s){t.next=5;break}throw Error("Link path not specified");case 5:return i&&(n=this.utils.DecodeVersionHash(i).objectId),w=r?l("qlibs",r,"q",o||i||n,"meta",s):l("q",i,"meta",s),_=[h],t.t0=_,t.next=11,this.MetadataAuth({libraryId:r,objectId:n,versionHash:i,path:s,channelAuth:m,noAuth:b});case 11:return t.t1=t.sent,t.t0.push.call(t.t0,t.t1),d.authorization&&_.push(d.authorization),d=c(c({},d),{},{authorization:_.flat().filter((function(t){return t})),resolve:!0}),u&&(d["header-accept"]=u),t.abrupt("return",this.HttpClient.URL({path:w,queryParams:d}));case 17:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.LinkData=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u,c,l,f,d,p;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,n=e.objectId,i=e.versionHash,o=e.writeToken,s=e.linkPath,u=e.queryParams,c=void 0===u?{}:u,l=e.format,f=void 0===l?"json":l,d=e.channelAuth,t.next=3,this.LinkUrl({libraryId:r,objectId:n,versionHash:i,writeToken:o,linkPath:s,queryParams:c,channelAuth:d});case 3:return p=t.sent,t.t0=this.utils,t.t1=f,t.next=8,h.Fetch(p);case 8:return t.t2=t.sent,t.abrupt("return",t.t0.ResponseToFormat.call(t.t0,t.t1,t.t2));case 10:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.CreateEncryptionConk=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u,c,l,h,f,d;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.libraryId,n=e.objectId,i=e.versionHash,o=e.writeToken,s=e.createKMSConk,u=void 0===s||s,!this.signer.remoteSigner){t.next=3;break}return t.abrupt("return");case 3:if(v({libraryId:r,objectId:n,versionHash:i}),g(o),n||(n=client.DecodeVersionHash(i).objectId),r){t.next=10;break}return t.next=9,this.ContentObjectLibraryId({objectId:n});case 9:r=t.sent;case 10:return c="eluv.caps.iusr".concat(this.utils.AddressToHash(this.signer.address)),t.next=13,this.ContentObjectMetadata({libraryId:r,objectId:n,writeToken:o,metadataSubtree:c});case 13:if(!(l=t.sent)){t.next=20;break}return t.next=17,this.Crypto.DecryptCap(l,this.signer.signingKey.privateKey);case 17:this.encryptionConks[n]=t.sent,t.next=34;break;case 20:return t.next=22,this.Crypto.GeneratePrimaryConk({spaceId:this.contentSpaceId,objectId:n});case 22:return this.encryptionConks[n]=t.sent,t.t0=this,t.t1=r,t.t2=n,t.t3=o,t.t4=c,t.next=30,this.Crypto.EncryptConk(this.encryptionConks[n],this.signer.signingKey.publicKey);case 30:return t.t5=t.sent,t.t6={libraryId:t.t1,objectId:t.t2,writeToken:t.t3,metadataSubtree:t.t4,metadata:t.t5},t.next=34,t.t0.ReplaceMetadata.call(t.t0,t.t6);case 34:if(!u){t.next=64;break}return t.prev=35,t.next=38,this.authClient.KMSAddress({objectId:n});case 38:return h=t.sent,t.next=41,this.authClient.KMSInfo({objectId:n});case 41:return f=t.sent.publicKey,d="eluv.caps.ikms".concat(this.utils.AddressToHash(h)),t.next=45,this.ContentObjectMetadata({libraryId:r,objectId:n,writeToken:o,metadataSubtree:d});case 45:if(t.sent){t.next=58;break}return t.t7=this,t.t8=r,t.t9=n,t.t10=o,t.t11=d,t.next=54,this.Crypto.EncryptConk(this.encryptionConks[n],f);case 54:return t.t12=t.sent,t.t13={libraryId:t.t8,objectId:t.t9,writeToken:t.t10,metadataSubtree:t.t11,metadata:t.t12},t.next=58,t.t7.ReplaceMetadata.call(t.t7,t.t13);case 58:t.next=64;break;case 60:t.prev=60,t.t14=t.catch(35),console.error("Failed to create encryption cap for KMS:"),console.error(t.t14);case 64:return t.abrupt("return",this.encryptionConks[n]);case 65:case"end":return t.stop()}}),t,this,[[35,60]])})));return function(e){return t.apply(this,arguments)}}(),e.EncryptionConk=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u,c,l,h,f,d;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,n=e.objectId,i=e.versionHash,o=e.writeToken,s=e.download,u=void 0!==s&&s,v({libraryId:r,objectId:n,versionHash:i}),o&&g(o),n||(n=client.DecodeVersionHash(i).objectId),t.next=6,this.authClient.Owner({id:n});case 6:return c=t.sent,l="eluv.caps.iusr".concat(this.utils.AddressToHash(this.signer.address)),t.next=10,this.ContentObjectMetadata({libraryId:r,objectId:n,metadataSubtree:l});case 10:if(h=t.sent,this.utils.EqualAddress(c,this.signer.address)||h){t.next=21;break}if(!u){t.next=18;break}return t.next=15,this.authClient.ReEncryptionConk({libraryId:r,objectId:n,versionHash:i});case 15:return t.abrupt("return",t.sent);case 18:return t.next=20,this.authClient.EncryptionConk({libraryId:r,objectId:n,versionHash:i});case 20:return t.abrupt("return",t.sent);case 21:if(this.encryptionConks[n]){t.next=38;break}return f="eluv.caps.iusr".concat(this.utils.AddressToHash(this.signer.address)),t.next=25,this.ContentObjectMetadata({libraryId:r,objectId:n,versionHash:i,writeToken:o,metadataSubtree:f});case 25:if(!(d=t.sent)){t.next=32;break}return t.next=29,this.Crypto.DecryptCap(d,this.signer.signingKey.privateKey);case 29:this.encryptionConks[n]=t.sent,t.next=38;break;case 32:if(!o){t.next=37;break}return t.next=35,this.CreateEncryptionConk({libraryId:r,objectId:n,versionHash:i,writeToken:o,createKMSConk:!1});case 35:t.next=38;break;case 37:throw"No encryption conk present for "+n;case 38:return t.abrupt("return",this.encryptionConks[n]);case 39:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.Encrypt=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,n=e.objectId,i=e.writeToken,o=e.chunk,v({libraryId:r,objectId:n}),t.next=4,this.EncryptionConk({libraryId:r,objectId:n,writeToken:i});case 4:return s=t.sent,t.next=7,this.Crypto.Encrypt(s,o);case 7:return u=t.sent,t.abrupt("return",u.buffer.slice(u.byteOffset,u.byteOffset+u.byteLength));case 9:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.Decrypt=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,n=e.objectId,i=e.writeToken,o=e.chunk,v({libraryId:r,objectId:n}),t.next=4,this.EncryptionConk({libraryId:r,objectId:n,writeToken:i,download:!0});case 4:return s=t.sent,t.next=7,this.Crypto.Decrypt(s,o);case 7:return u=t.sent,t.abrupt("return",u.buffer.slice(u.byteOffset,u.byteOffset+u.byteLength));case 9:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.AccessType=function(){var t=s(a.mark((function t(e){var r;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.id,t.next=3,this.authClient.AccessType(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.AccessInfo=function(){var t=s(a.mark((function t(e){var r,n,i;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.objectId,n=e.args,p(r),n||(n=[0,[],[]]),this.Log("Retrieving access info: ".concat(r)),t.next=6,this.ethClient.CallContractMethod({contractAddress:this.utils.HashToAddress(r),methodName:"getAccessInfo",methodArgs:n});case 6:return i=t.sent,this.Log(i),t.abrupt("return",{visibilityCode:i[0],visible:i[0]>=1,accessible:i[0]>=10,editable:i[0]>=100,hasAccess:0===i[1],accessCode:i[1],accessCharge:this.utils.WeiToEther(i[2]).toString()});case 9:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.AccessRequest=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u,c,l,h;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,n=e.objectId,i=e.versionHash,o=e.args,s=void 0===o?[]:o,u=e.update,c=void 0!==u&&u,l=e.noCache,h=void 0!==l&&l,v({libraryId:r,objectId:n,versionHash:i}),i&&(n=this.utils.DecodeVersionHash(i).objectId),t.next=5,this.authClient.MakeAccessRequest({libraryId:r,objectId:n,versionHash:i,args:s,update:c,skipCache:!0,noCache:h});case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.SetAuthContext=function(t){var e=t.context;if(e&&Object.values(e).find((function(t){return"string"!=typeof t})))throw Error("Context must be a map of string->string");this.authContext=e},e.GenerateStateChannelToken=function(){var t=s(a.mark((function t(e){var r,n,i,o,s;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.objectId,n=e.versionHash,i=e.context,o=e.noCache,s=void 0!==o&&o,n?m(n):p(r),!n){t.next=6;break}r=this.utils.DecodeVersionHash(n).objectId,t.next=10;break;case 6:if(this.stateChannelAccess[r]){t.next=10;break}return t.next=9,this.LatestVersionHash({objectId:r});case 9:n=t.sent;case 10:return this.stateChannelAccess[r]=n,t.next=13,this.authClient.AuthorizationToken({objectId:r,channelAuth:!0,oauthToken:this.oauthToken,context:i,noCache:s});case 13:return t.abrupt("return",t.sent);case 14:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.FinalizeStateChannelAccess=function(){var t=s(a.mark((function t(e){var r,n,i;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.objectId,n=e.versionHash,i=e.percentComplete,n?m(n):p(r),!n){t.next=6;break}r=this.utils.DecodeVersionHash(n).objectId,t.next=13;break;case 6:if(!this.stateChannelAccess[r]){t.next=10;break}n=this.stateChannelAccess[r],t.next=13;break;case 10:return t.next=12,this.LatestVersionHash({objectId:r});case 12:n=t.sent;case 13:return this.stateChannelAccess[r]=void 0,t.next=16,this.authClient.ChannelContentFinalize({objectId:r,versionHash:n,percent:i});case 16:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.ContentObjectAccessComplete=function(){var t=s(a.mark((function t(e){var r,n,i;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.objectId,n=e.score,i=void 0===n?100:n,p(r),!(i<0||i>100)){t.next=4;break}throw Error("Invalid AccessComplete score: "+i);case 4:return t.next=6,this.authClient.AccessComplete({id:r,score:i});case 6:return t.abrupt("return",t.sent);case 7:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.Collection=function(){var t=s(a.mark((function t(e){var r;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.collectionType,["accessGroups","contentObjects","contentTypes","contracts","libraries"].includes(r)){t.next=4;break}throw new Error("Invalid collection type: "+r);case 4:if(!this.signer){t.next=10;break}return t.next=7,this.userProfileClient.WalletAddress();case 7:t.t0=t.sent,t.next=11;break;case 10:t.t0=void 0;case 11:if(t.t0){t.next=14;break}throw new Error("Unable to get collection: User wallet doesn't exist");case 14:return this.Log("Retrieving ".concat(r," contract collection for user ").concat(this.signer.address)),t.next=17,this.ethClient.MakeProviderCall({methodName:"send",args:["elv_getWalletCollection",[this.contentSpaceId,"iusr".concat(this.utils.AddressToHash(this.signer.address)),r]]});case 17:if(t.t1=t.sent,t.t1){t.next=20;break}t.t1=[];case 20:return t.abrupt("return",t.t1);case 21:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.VerifyContentObject=function(){var t=s(a.mark((function t(e){var r,n,i;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,n=e.objectId,i=e.versionHash,v({libraryId:r,objectId:n,versionHash:i}),t.next=4,ContentObjectVerification.VerifyContentObject({client:this,libraryId:r,objectId:n,versionHash:i});case 4:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.Proofs=function(){var t=s(a.mark((function t(e){var r,n,i,o,s;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,n=e.objectId,i=e.versionHash,o=e.partHash,v({libraryId:r,objectId:n,versionHash:i}),y(o),i&&(n=this.utils.DecodeVersionHash(i).objectId),s=l("q",i||n,"data",o,"proofs"),t.t0=this.utils,t.t1=this.HttpClient,t.next=9,this.authClient.AuthorizationHeader({libraryId:r,objectId:n,versionHash:i});case 9:return t.t2=t.sent,t.t3=s,t.t4={headers:t.t2,method:"GET",path:t.t3},t.t5=t.t1.Request.call(t.t1,t.t4),t.abrupt("return",t.t0.ResponseToJson.call(t.t0,t.t5));case 14:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.QParts=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,n=e.objectId,i=e.partHash,o=e.format,s=void 0===o?"blob":o,v({libraryId:r,objectId:n,versionHash:versionHash}),y(i),u=l("qparts",i),t.t0=this.utils,t.t1=s,t.t2=this.HttpClient,t.next=9,this.authClient.AuthorizationHeader({libraryId:r,objectId:n,partHash:i});case 9:return t.t3=t.sent,t.t4=u,t.t5={headers:t.t3,method:"GET",path:t.t4},t.t6=t.t2.Request.call(t.t2,t.t5),t.abrupt("return",t.t0.ResponseToFormat.call(t.t0,t.t1,t.t6));case 14:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()},function(t,e,r){var n,i,o;function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}o=function(){function t(t){var e=[];if(0===t.length)return"";if("string"!=typeof t[0])throw new TypeError("Url must be a string. Received "+t[0]);if(t[0].match(/^[^/:]+:\/*$/)&&t.length>1){var r=t.shift();t[0]=r+t[0]}t[0].match(/^file:\/\/\//)?t[0]=t[0].replace(/^([^/:]+):\/*/,"$1:///"):t[0]=t[0].replace(/^([^/:]+):\/*/,"$1://");for(var n=0;n<t.length;n++){var i=t[n];if("string"!=typeof i)throw new TypeError("Url must be a string. Received "+i);""!==i&&(n>0&&(i=i.replace(/^[\/]+/,"")),i=n<t.length-1?i.replace(/[\/]+$/,""):i.replace(/[\/]+$/,"/"),e.push(i))}var o=e.join("/"),a=(o=o.replace(/\/(\?|&|#[^!])/g,"$1")).split("?");return o=a.shift()+(a.length>0?"?":"")+a.join("&")}return function(){return t("object"===a(arguments[0])?arguments[0]:[].slice.call(arguments))}},t.exports?t.exports=o():void 0===(i="function"==typeof(n=o)?n.call(e,r,e,t):n)||(t.exports=i)},function(t,e,r){var n=r(4),i=r(5),o=r(14),a=r(15),s=r(25),u="undefined"!=typeof fetch?fetch:r(74).default,c=r(75).LogMessage,l=function(){"use strict";function t(e){var r=e.uris,n=e.debug;o(this,t),this.uris=r,this.uriIndex=0,this.debug=n,this.draftURIs={}}var e;return a(t,[{key:"Log",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];c(this,t,e)}},{key:"BaseURI",value:function(){return new s(this.uris[this.uriIndex])}},{key:"RecordWriteToken",value:function(t){this.draftURIs[t]=this.BaseURI()}},{key:"RequestHeaders",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.Accept||(e.Accept="application/json"),"JSON"===t?e["Content-type"]="application/json":"BINARY"===t&&(e["Content-type"]="application/octet-stream"),e}},{key:"Request",value:(e=i(n.mark((function e(r){var i,o,a,s,u,c,l,h,f,d,p,m,y,g,v,b,w,_,k,x,A,E,S,I;return n.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=r.method,o=r.path,a=r.queryParams,s=void 0===a?{}:a,u=r.body,c=r.bodyType,l=void 0===c?"JSON":c,h=r.headers,f=void 0===h?{}:h,d=r.attempts,p=void 0===d?0:d,m=r.failover,y=void 0===m||m,g=r.forceFailover,v=void 0!==g&&g,b=this.BaseURI(),w=o.replace(/^\//,"").match(/(qlibs\/ilib[a-zA-Z0-9]+|q|qid)\/(tqw_[a-zA-Z0-9]+)/),(_=w?w[2]:void 0)&&(this.draftURIs[_]?b=this.draftURIs[_]:this.draftURIs[_]=b),k=b.path(o).query(s).hash(""),x={method:i,headers:this.RequestHeaders(l,f)},"POST"!==i&&"PUT"!==i&&"DELETE"!==i||(u&&"JSON"===l?x.body=JSON.stringify(u):u&&(x.body=u)),e.prev=8,e.next=11,t.Fetch(k.toString(),x);case 11:A=e.sent,e.next=17;break;case 14:e.prev=14,e.t0=e.catch(8),A={ok:!1,status:500,statusText:"ElvClient Error: "+e.t0.message,url:k.toString(),stack:e.t0.stack};case 17:if(A.ok){e.next=40;break}if(!(!_&&(y&&parseInt(A.status)>=500||v)&&p<this.uris.length)){e.next=24;break}return this.Log("HttpClient failing over from ".concat(this.BaseURI(),": ").concat(p+1," attempts"),!0),this.uriIndex=(this.uriIndex+1)%this.uris.length,e.next=23,this.Request({method:i,path:o,queryParams:s,body:u,bodyType:l,headers:f,attempts:p+1,forceFailover:v});case 23:return e.abrupt("return",e.sent);case 24:if(E=A.headers&&A.headers.get("content-type")||"",S="",!A.text||!A.json){e.next=37;break}if(!E.includes("application/json")){e.next=33;break}return e.next=30,A.json();case 30:e.t1=e.sent,e.next=36;break;case 33:return e.next=35,A.text();case 35:e.t1=e.sent;case 36:S=e.t1;case 37:throw I={name:"ElvHttpClientError",status:A.status,statusText:A.statusText,message:A.statusText,url:k.toString(),body:S,requestParams:x},this.Log(JSON.stringify(I,null,2),!0),I;case 40:return this.Log("".concat(A.status," - ").concat(i," ").concat(k.toString())),e.abrupt("return",A);case 42:case"end":return e.stop()}}),e,this,[[8,14]])}))),function(t){return e.apply(this,arguments)})},{key:"URL",value:function(t){var e=t.path,r=t.queryParams,n=void 0===r?{}:r;return this.BaseURI().path(e).query(n).hash("").toString()}}],[{key:"Fetch",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return u(t,e)}}]),t}();t.exports=l},function(t,e,r){"use strict";var n=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==n)return n;throw new Error("unable to locate global object")}();t.exports=e=n.fetch,n.fetch&&(e.default=n.fetch.bind(n)),e.Headers=n.Headers,e.Request=n.Request,e.Response=n.Response},function(t,e,r){var n=r(30),i=function(t,e){return"object"===n(e)&&"function"==typeof e[t]?e[t]:null},o=function(t){return"object"===n(t)?JSON.stringify(t):t};t.exports={LogMessage:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t.debug){var n=i("log",t.debugOptions),a=i("error",t.debugOptions),s="(elv-client-js#".concat(t.constructor.name,")"),u="\n".concat(s," ").concat(o(e),"\n");r?a?a(s,e):console.error(u):n?n(s,e):console.log(u)}}}},function(t,e,r){var n=r(21);e.ValidatePresence=function(t,e){if(!e)throw Error("".concat(t," not specified"))},e.ValidateLibrary=function(t){if(!t)throw Error("Library ID not specified");if(!t.toString().startsWith("i"))throw Error("Invalid library ID: ".concat(t))},e.ValidateObject=function(t){if(!t)throw Error("Object ID not specified");if(!t.toString().startsWith("i"))throw Error("Invalid object ID: ".concat(t))},e.ValidateVersion=function(t){if(!t)throw Error("Version hash not specified");if(!t.toString().startsWith("h"))throw Error("Invalid version hash: ".concat(t))},e.ValidateWriteToken=function(t){if(!t)throw Error("Write token not specified");if(!t.toString().startsWith("t"))throw Error("Invalid write token: ".concat(t))},e.ValidatePartHash=function(t){if(!t)throw Error("Part hash not specified");if(!t.toString().startsWith("hqp_")&&!t.toString().startsWith("hqpe"))throw Error("Invalid part hash: ".concat(t))},e.ValidateParameters=function(t){var r=t.libraryId,n=t.objectId,i=t.versionHash;i?e.ValidateVersion(i):(e.ValidateLibrary(r),e.ValidateObject(n))},e.ValidateAddress=function(t){if(!t)throw Error("Address not specified");if(!/^(0x)?[0-9a-f]{40}$/i.test(t.toLowerCase()))throw Error("Invalid address: ".concat(t));return n.FormatAddress(t)},e.ValidatePermission=function(t){if(t&&"full-access"!==t&&"no-access"!==t)throw Error("Invalid profile permission: ".concat(t));return t},e.ValidateDate=function(t){if(t){if(isNaN(new Date(t)))throw Error("Invalid date: ".concat(t));return new Date(t).getTime()}}},function(t,e,r){var n=r(78),i=r(135)((function(t,e,r,i){n(t,e,r,i)}));t.exports=i},function(t,e,r){var n=r(79),i=r(34),o=r(110),a=r(112),s=r(1),u=r(44),c=r(43);t.exports=function t(e,r,l,h,f){e!==r&&o(r,(function(o,u){if(f||(f=new n),s(o))a(e,r,u,l,t,h,f);else{var d=h?h(c(e,u),o,u+"",e,r,f):void 0;void 0===d&&(d=o),i(e,u,d)}}),u)}},function(t,e,r){var n=r(7),i=r(85),o=r(86),a=r(87),s=r(88),u=r(89);function c(t){var e=this.__data__=new n(t);this.size=e.size}c.prototype.clear=i,c.prototype.delete=o,c.prototype.get=a,c.prototype.has=s,c.prototype.set=u,t.exports=c},function(t,e){t.exports=function(){this.__data__=[],this.size=0}},function(t,e,r){var n=r(8),i=Array.prototype.splice;t.exports=function(t){var e=this.__data__,r=n(e,t);return!(r<0)&&(r==e.length-1?e.pop():i.call(e,r,1),--this.size,!0)}},function(t,e,r){var n=r(8);t.exports=function(t){var e=this.__data__,r=n(e,t);return r<0?void 0:e[r][1]}},function(t,e,r){var n=r(8);t.exports=function(t){return n(this.__data__,t)>-1}},function(t,e,r){var n=r(8);t.exports=function(t,e){var r=this.__data__,i=n(r,t);return i<0?(++this.size,r.push([t,e])):r[i][1]=e,this}},function(t,e,r){var n=r(7);t.exports=function(){this.__data__=new n,this.size=0}},function(t,e){t.exports=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}},function(t,e){t.exports=function(t){return this.__data__.get(t)}},function(t,e){t.exports=function(t){return this.__data__.has(t)}},function(t,e,r){var n=r(7),i=r(31),o=r(97);t.exports=function(t,e){var r=this.__data__;if(r instanceof n){var a=r.__data__;if(!i||a.length<199)return a.push([t,e]),this.size=++r.size,this;r=this.__data__=new o(a)}return r.set(t,e),this.size=r.size,this}},function(t,e,r){var n=r(18),i=r(93),o=r(1),a=r(95),s=/^\[object .+?Constructor\]$/,u=Function.prototype,c=Object.prototype,l=u.toString,h=c.hasOwnProperty,f=RegExp("^"+l.call(h).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!o(t)||i(t))&&(n(t)?f:s).test(a(t))}},function(t,e,r){var n=r(32),i=Object.prototype,o=i.hasOwnProperty,a=i.toString,s=n?n.toStringTag:void 0;t.exports=function(t){var e=o.call(t,s),r=t[s];try{t[s]=void 0;var n=!0}catch(t){}var i=a.call(t);return n&&(e?t[s]=r:delete t[s]),i}},function(t,e){var r=Object.prototype.toString;t.exports=function(t){return r.call(t)}},function(t,e,r){var n,i=r(94),o=(n=/[^.]+$/.exec(i&&i.keys&&i.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";t.exports=function(t){return!!o&&o in t}},function(t,e,r){var n=r(2)["__core-js_shared__"];t.exports=n},function(t,e){var r=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return r.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},function(t,e){t.exports=function(t,e){return null==t?void 0:t[e]}},function(t,e,r){var n=r(98),i=r(105),o=r(107),a=r(108),s=r(109);function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=i,u.prototype.get=o,u.prototype.has=a,u.prototype.set=s,t.exports=u},function(t,e,r){var n=r(99),i=r(7),o=r(31);t.exports=function(){this.size=0,this.__data__={hash:new n,map:new(o||i),string:new n}}},function(t,e,r){var n=r(100),i=r(101),o=r(102),a=r(103),s=r(104);function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=i,u.prototype.get=o,u.prototype.has=a,u.prototype.set=s,t.exports=u},function(t,e,r){var n=r(11);t.exports=function(){this.__data__=n?n(null):{},this.size=0}},function(t,e){t.exports=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}},function(t,e,r){var n=r(11),i=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;if(n){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return i.call(e,t)?e[t]:void 0}},function(t,e,r){var n=r(11),i=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;return n?void 0!==e[t]:i.call(e,t)}},function(t,e,r){var n=r(11);t.exports=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=n&&void 0===e?"__lodash_hash_undefined__":e,this}},function(t,e,r){var n=r(12);t.exports=function(t){var e=n(this,t).delete(t);return this.size-=e?1:0,e}},function(t,e){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}t.exports=function(t){var e=r(t);return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}},function(t,e,r){var n=r(12);t.exports=function(t){return n(this,t).get(t)}},function(t,e,r){var n=r(12);t.exports=function(t){return n(this,t).has(t)}},function(t,e,r){var n=r(12);t.exports=function(t,e){var r=n(this,t),i=r.size;return r.set(t,e),this.size+=r.size==i?0:1,this}},function(t,e,r){var n=r(111)();t.exports=n},function(t,e){t.exports=function(t){return function(e,r,n){for(var i=-1,o=Object(e),a=n(e),s=a.length;s--;){var u=a[t?s:++i];if(!1===r(o[u],u,o))break}return e}}},function(t,e,r){var n=r(34),i=r(113),o=r(114),a=r(117),s=r(118),u=r(38),c=r(39),l=r(122),h=r(41),f=r(18),d=r(1),p=r(124),m=r(42),y=r(43),g=r(128);t.exports=function(t,e,r,v,b,w,_){var k=y(t,r),x=y(e,r),A=_.get(x);if(A)n(t,r,A);else{var E=w?w(k,x,r+"",t,e,_):void 0,S=void 0===E;if(S){var I=c(x),M=!I&&h(x),T=!I&&!M&&m(x);E=x,I||M||T?c(k)?E=k:l(k)?E=a(k):M?(S=!1,E=i(x,!0)):T?(S=!1,E=o(x,!0)):E=[]:p(x)||u(x)?(E=k,u(k)?E=g(k):d(k)&&!f(k)||(E=s(x))):S=!1}S&&(_.set(x,E),b(E,x,v,w,_),_.delete(x)),n(t,r,E)}}},function(t,e,r){(function(t){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=r(2),o="object"==n(e)&&e&&!e.nodeType&&e,a=o&&"object"==n(t)&&t&&!t.nodeType&&t,s=a&&a.exports===o?i.Buffer:void 0,u=s?s.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var r=t.length,n=u?u(r):new t.constructor(r);return t.copy(n),n}}).call(this,r(0)(t))},function(t,e,r){var n=r(115);t.exports=function(t,e){var r=e?n(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}},function(t,e,r){var n=r(116);t.exports=function(t){var e=new t.constructor(t.byteLength);return new n(e).set(new n(t)),e}},function(t,e,r){var n=r(2).Uint8Array;t.exports=n},function(t,e){t.exports=function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}},function(t,e,r){var n=r(119),i=r(36),o=r(37);t.exports=function(t){return"function"!=typeof t.constructor||o(t)?{}:n(i(t))}},function(t,e,r){var n=r(1),i=Object.create,o=function(){function t(){}return function(e){if(!n(e))return{};if(i)return i(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();t.exports=o},function(t,e){t.exports=function(t,e){return function(r){return t(e(r))}}},function(t,e,r){var n=r(10),i=r(3);t.exports=function(t){return i(t)&&"[object Arguments]"==n(t)}},function(t,e,r){var n=r(20),i=r(3);t.exports=function(t){return i(t)&&n(t)}},function(t,e){t.exports=function(){return!1}},function(t,e,r){var n=r(10),i=r(36),o=r(3),a=Function.prototype,s=Object.prototype,u=a.toString,c=s.hasOwnProperty,l=u.call(Object);t.exports=function(t){if(!o(t)||"[object Object]"!=n(t))return!1;var e=i(t);if(null===e)return!0;var r=c.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&u.call(r)==l}},function(t,e,r){var n=r(10),i=r(40),o=r(3),a={};a["[object Float32Array]"]=a["[object Float64Array]"]=a["[object Int8Array]"]=a["[object Int16Array]"]=a["[object Int32Array]"]=a["[object Uint8Array]"]=a["[object Uint8ClampedArray]"]=a["[object Uint16Array]"]=a["[object Uint32Array]"]=!0,a["[object Arguments]"]=a["[object Array]"]=a["[object ArrayBuffer]"]=a["[object Boolean]"]=a["[object DataView]"]=a["[object Date]"]=a["[object Error]"]=a["[object Function]"]=a["[object Map]"]=a["[object Number]"]=a["[object Object]"]=a["[object RegExp]"]=a["[object Set]"]=a["[object String]"]=a["[object WeakMap]"]=!1,t.exports=function(t){return o(t)&&i(t.length)&&!!a[n(t)]}},function(t,e){t.exports=function(t){return function(e){return t(e)}}},function(t,e,r){(function(t){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=r(33),o="object"==n(e)&&e&&!e.nodeType&&e,a=o&&"object"==n(t)&&t&&!t.nodeType&&t,s=a&&a.exports===o&&i.process,u=function(){try{var t=a&&a.require&&a.require("util").types;return t||s&&s.binding&&s.binding("util")}catch(t){}}();t.exports=u}).call(this,r(0)(t))},function(t,e,r){var n=r(129),i=r(44);t.exports=function(t){return n(t,i(t))}},function(t,e,r){var n=r(130),i=r(19);t.exports=function(t,e,r,o){var a=!r;r||(r={});for(var s=-1,u=e.length;++s<u;){var c=e[s],l=o?o(r[c],t[c],c,r,t):void 0;void 0===l&&(l=t[c]),a?i(r,c,l):n(r,c,l)}return r}},function(t,e,r){var n=r(19),i=r(9),o=Object.prototype.hasOwnProperty;t.exports=function(t,e,r){var a=t[e];o.call(t,e)&&i(a,r)&&(void 0!==r||e in t)||n(t,e,r)}},function(t,e,r){var n=r(132),i=r(38),o=r(39),a=r(41),s=r(45),u=r(42),c=Object.prototype.hasOwnProperty;t.exports=function(t,e){var r=o(t),l=!r&&i(t),h=!r&&!l&&a(t),f=!r&&!l&&!h&&u(t),d=r||l||h||f,p=d?n(t.length,String):[],m=p.length;for(var y in t)!e&&!c.call(t,y)||d&&("length"==y||h&&("offset"==y||"parent"==y)||f&&("buffer"==y||"byteLength"==y||"byteOffset"==y)||s(y,m))||p.push(y);return p}},function(t,e){t.exports=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}},function(t,e,r){var n=r(1),i=r(37),o=r(134),a=Object.prototype.hasOwnProperty;t.exports=function(t){if(!n(t))return o(t);var e=i(t),r=[];for(var s in t)("constructor"!=s||!e&&a.call(t,s))&&r.push(s);return r}},function(t,e){t.exports=function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e}},function(t,e,r){var n=r(136),i=r(143);t.exports=function(t){return n((function(e,r){var n=-1,o=r.length,a=o>1?r[o-1]:void 0,s=o>2?r[2]:void 0;for(a=t.length>3&&"function"==typeof a?(o--,a):void 0,s&&i(r[0],r[1],s)&&(a=o<3?void 0:a,o=1),e=Object(e);++n<o;){var u=r[n];u&&t(e,u,n,a)}return e}))}},function(t,e,r){var n=r(46),i=r(137),o=r(139);t.exports=function(t,e){return o(i(t,e,n),t+"")}},function(t,e,r){var n=r(138),i=Math.max;t.exports=function(t,e,r){return e=i(void 0===e?t.length-1:e,0),function(){for(var o=arguments,a=-1,s=i(o.length-e,0),u=Array(s);++a<s;)u[a]=o[e+a];a=-1;for(var c=Array(e+1);++a<e;)c[a]=o[a];return c[e]=r(u),n(t,this,c)}}},function(t,e){t.exports=function(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}},function(t,e,r){var n=r(140),i=r(142)(n);t.exports=i},function(t,e,r){var n=r(141),i=r(35),o=r(46),a=i?function(t,e){return i(t,"toString",{configurable:!0,enumerable:!1,value:n(e),writable:!0})}:o;t.exports=a},function(t,e){t.exports=function(t){return function(){return t}}},function(t,e){var r=Date.now;t.exports=function(t){var e=0,n=0;return function(){var i=r(),o=16-(i-n);if(n=i,o>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}},function(t,e,r){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=r(9),o=r(20),a=r(45),s=r(1);t.exports=function(t,e,r){if(!s(r))return!1;var u=n(e);return!!("number"==u?o(r)&&a(e,r.length):"string"==u&&e in r)&&i(r[e],t)}}])}));
51
+ var n=r(8),i=n.Buffer;function o(t,e){for(var r in t)e[r]=t[r]}function a(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=n:(o(n,e),e.Buffer=a),a.prototype=Object.create(i.prototype),o(i,a),a.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},a.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},a.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},a.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},function(t,e,r){var n;function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}!function(o){"use strict";var a,s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,u="function"==typeof Symbol&&"symbol"==i(Symbol.iterator),c=Math.ceil,l=Math.floor,h="[BigNumber Error] ",f=h+"Number primitive has more than 15 significant digits: ",d=1e14,p=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],y=1e9;function m(t){var e=0|t;return t>0||t===e?e:e-1}function v(t){for(var e,r,n=1,i=t.length,o=t[0]+"";n<i;){for(r=14-(e=t[n++]+"").length;r--;e="0"+e);o+=e}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function g(t,e){var r,n,i=t.c,o=e.c,a=t.s,s=e.s,u=t.e,c=e.e;if(!a||!s)return null;if(r=i&&!i[0],n=o&&!o[0],r||n)return r?n?0:-s:a;if(a!=s)return a;if(r=a<0,n=u==c,!i||!o)return n?0:!i^r?1:-1;if(!n)return u>c^r?1:-1;for(s=(u=i.length)<(c=o.length)?u:c,a=0;a<s;a++)if(i[a]!=o[a])return i[a]>o[a]^r?1:-1;return u==c?0:u>c^r?1:-1}function b(t,e,r,n){if(t<e||t>r||t!==l(t))throw Error(h+(n||"Argument")+("number"==typeof t?t<e||t>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function w(t){var e=t.c.length-1;return m(t.e/14)==e&&t.c[e]%2!=0}function _(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function k(t,e,r){var n,i;if(e<0){for(i=r+".";++e;i+=r);t=i+t}else if(++e>(n=t.length)){for(i=r,e-=n;--e;i+=r);t+=i}else e<n&&(t=t.slice(0,e)+"."+t.slice(e));return t}(a=function t(e){var r,n,o,a,x,A,I,E,S,M=H.prototype={constructor:H,toString:null,valueOf:null},T=new H(1),P=20,C=4,O=-7,R=21,j=-1e7,N=1e7,L=!1,U=1,D=0,B={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},z="0123456789abcdefghijklmnopqrstuvwxyz";function H(t,e){var r,i,a,u,c,h,d,p,y=this;if(!(y instanceof H))return new H(t,e);if(null==e){if(t&&!0===t._isBigNumber)return y.s=t.s,void(!t.c||t.e>N?y.c=y.e=null:t.e<j?y.c=[y.e=0]:(y.e=t.e,y.c=t.c.slice()));if((h="number"==typeof t)&&0*t==0){if(y.s=1/t<0?(t=-t,-1):1,t===~~t){for(u=0,c=t;c>=10;c/=10,u++);return void(u>N?y.c=y.e=null:(y.e=u,y.c=[t]))}p=String(t)}else{if(!s.test(p=String(t)))return o(y,p,h);y.s=45==p.charCodeAt(0)?(p=p.slice(1),-1):1}(u=p.indexOf("."))>-1&&(p=p.replace(".","")),(c=p.search(/e/i))>0?(u<0&&(u=c),u+=+p.slice(c+1),p=p.substring(0,c)):u<0&&(u=p.length)}else{if(b(e,2,z.length,"Base"),10==e)return V(y=new H(t),P+y.e+1,C);if(p=String(t),h="number"==typeof t){if(0*t!=0)return o(y,p,h,e);if(y.s=1/t<0?(p=p.slice(1),-1):1,H.DEBUG&&p.replace(/^0\.0*|\./,"").length>15)throw Error(f+t)}else y.s=45===p.charCodeAt(0)?(p=p.slice(1),-1):1;for(r=z.slice(0,e),u=c=0,d=p.length;c<d;c++)if(r.indexOf(i=p.charAt(c))<0){if("."==i){if(c>u){u=d;continue}}else if(!a&&(p==p.toUpperCase()&&(p=p.toLowerCase())||p==p.toLowerCase()&&(p=p.toUpperCase()))){a=!0,c=-1,u=0;continue}return o(y,String(t),h,e)}h=!1,(u=(p=n(p,e,10,y.s)).indexOf("."))>-1?p=p.replace(".",""):u=p.length}for(c=0;48===p.charCodeAt(c);c++);for(d=p.length;48===p.charCodeAt(--d););if(p=p.slice(c,++d)){if(d-=c,h&&H.DEBUG&&d>15&&(t>9007199254740991||t!==l(t)))throw Error(f+y.s*t);if((u=u-c-1)>N)y.c=y.e=null;else if(u<j)y.c=[y.e=0];else{if(y.e=u,y.c=[],c=(u+1)%14,u<0&&(c+=14),c<d){for(c&&y.c.push(+p.slice(0,c)),d-=14;c<d;)y.c.push(+p.slice(c,c+=14));c=14-(p=p.slice(c)).length}else c-=d;for(;c--;p+="0");y.c.push(+p)}}else y.c=[y.e=0]}function F(t,e,r,n){var i,o,a,s,u;if(null==r?r=C:b(r,0,8),!t.c)return t.toString();if(i=t.c[0],a=t.e,null==e)u=v(t.c),u=1==n||2==n&&(a<=O||a>=R)?_(u,a):k(u,a,"0");else if(o=(t=V(new H(t),e,r)).e,s=(u=v(t.c)).length,1==n||2==n&&(e<=o||o<=O)){for(;s<e;u+="0",s++);u=_(u,o)}else if(e-=a,u=k(u,o,"0"),o+1>s){if(--e>0)for(u+=".";e--;u+="0");}else if((e+=o-s)>0)for(o+1==s&&(u+=".");e--;u+="0");return t.s<0&&i?"-"+u:u}function q(t,e){for(var r,n=1,i=new H(t[0]);n<t.length;n++){if(!(r=new H(t[n])).s){i=r;break}e.call(i,r)&&(i=r)}return i}function G(t,e,r){for(var n=1,i=e.length;!e[--i];e.pop());for(i=e[0];i>=10;i/=10,n++);return(r=n+14*r-1)>N?t.c=t.e=null:r<j?t.c=[t.e=0]:(t.e=r,t.c=e),t}function V(t,e,r,n){var i,o,a,s,u,h,f,y=t.c,m=p;if(y){t:{for(i=1,s=y[0];s>=10;s/=10,i++);if((o=e-i)<0)o+=14,a=e,f=(u=y[h=0])/m[i-a-1]%10|0;else if((h=c((o+1)/14))>=y.length){if(!n)break t;for(;y.length<=h;y.push(0));u=f=0,i=1,a=(o%=14)-14+1}else{for(u=s=y[h],i=1;s>=10;s/=10,i++);f=(a=(o%=14)-14+i)<0?0:u/m[i-a-1]%10|0}if(n=n||e<0||null!=y[h+1]||(a<0?u:u%m[i-a-1]),n=r<4?(f||n)&&(0==r||r==(t.s<0?3:2)):f>5||5==f&&(4==r||n||6==r&&(o>0?a>0?u/m[i-a]:0:y[h-1])%10&1||r==(t.s<0?8:7)),e<1||!y[0])return y.length=0,n?(e-=t.e+1,y[0]=m[(14-e%14)%14],t.e=-e||0):y[0]=t.e=0,t;if(0==o?(y.length=h,s=1,h--):(y.length=h+1,s=m[14-o],y[h]=a>0?l(u/m[i-a]%m[a])*s:0),n)for(;;){if(0==h){for(o=1,a=y[0];a>=10;a/=10,o++);for(a=y[0]+=s,s=1;a>=10;a/=10,s++);o!=s&&(t.e++,y[0]==d&&(y[0]=1));break}if(y[h]+=s,y[h]!=d)break;y[h--]=0,s=1}for(o=y.length;0===y[--o];y.pop());}t.e>N?t.c=t.e=null:t.e<j&&(t.c=[t.e=0])}return t}function K(t){var e,r=t.e;return null===r?t.toString():(e=v(t.c),e=r<=O||r>=R?_(e,r):k(e,r,"0"),t.s<0?"-"+e:e)}return H.clone=t,H.ROUND_UP=0,H.ROUND_DOWN=1,H.ROUND_CEIL=2,H.ROUND_FLOOR=3,H.ROUND_HALF_UP=4,H.ROUND_HALF_DOWN=5,H.ROUND_HALF_EVEN=6,H.ROUND_HALF_CEIL=7,H.ROUND_HALF_FLOOR=8,H.EUCLID=9,H.config=H.set=function(t){var e,r;if(null!=t){if("object"!=i(t))throw Error(h+"Object expected: "+t);if(t.hasOwnProperty(e="DECIMAL_PLACES")&&(b(r=t[e],0,y,e),P=r),t.hasOwnProperty(e="ROUNDING_MODE")&&(b(r=t[e],0,8,e),C=r),t.hasOwnProperty(e="EXPONENTIAL_AT")&&((r=t[e])&&r.pop?(b(r[0],-y,0,e),b(r[1],0,y,e),O=r[0],R=r[1]):(b(r,-y,y,e),O=-(R=r<0?-r:r))),t.hasOwnProperty(e="RANGE"))if((r=t[e])&&r.pop)b(r[0],-y,-1,e),b(r[1],1,y,e),j=r[0],N=r[1];else{if(b(r,-y,y,e),!r)throw Error(h+e+" cannot be zero: "+r);j=-(N=r<0?-r:r)}if(t.hasOwnProperty(e="CRYPTO")){if((r=t[e])!==!!r)throw Error(h+e+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw L=!r,Error(h+"crypto unavailable");L=r}else L=r}if(t.hasOwnProperty(e="MODULO_MODE")&&(b(r=t[e],0,9,e),U=r),t.hasOwnProperty(e="POW_PRECISION")&&(b(r=t[e],0,y,e),D=r),t.hasOwnProperty(e="FORMAT")){if("object"!=i(r=t[e]))throw Error(h+e+" not an object: "+r);B=r}if(t.hasOwnProperty(e="ALPHABET")){if("string"!=typeof(r=t[e])||/^.$|[+-.\s]|(.).*\1/.test(r))throw Error(h+e+" invalid: "+r);z=r}}return{DECIMAL_PLACES:P,ROUNDING_MODE:C,EXPONENTIAL_AT:[O,R],RANGE:[j,N],CRYPTO:L,MODULO_MODE:U,POW_PRECISION:D,FORMAT:B,ALPHABET:z}},H.isBigNumber=function(t){if(!t||!0!==t._isBigNumber)return!1;if(!H.DEBUG)return!0;var e,r,n=t.c,i=t.e,o=t.s;t:if("[object Array]"=={}.toString.call(n)){if((1===o||-1===o)&&i>=-y&&i<=y&&i===l(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break t}if((e=(i+1)%14)<1&&(e+=14),String(n[0]).length==e){for(e=0;e<n.length;e++)if((r=n[e])<0||r>=d||r!==l(r))break t;if(0!==r)return!0}}}else if(null===n&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(h+"Invalid BigNumber: "+t)},H.maximum=H.max=function(){return q(arguments,M.lt)},H.minimum=H.min=function(){return q(arguments,M.gt)},H.random=(a=9007199254740992*Math.random()&2097151?function(){return l(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(t){var e,r,n,i,o,s=0,u=[],f=new H(T);if(null==t?t=P:b(t,0,y),i=c(t/14),L)if(crypto.getRandomValues){for(e=crypto.getRandomValues(new Uint32Array(i*=2));s<i;)(o=131072*e[s]+(e[s+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),e[s]=r[0],e[s+1]=r[1]):(u.push(o%1e14),s+=2);s=i/2}else{if(!crypto.randomBytes)throw L=!1,Error(h+"crypto unavailable");for(e=crypto.randomBytes(i*=7);s<i;)(o=281474976710656*(31&e[s])+1099511627776*e[s+1]+4294967296*e[s+2]+16777216*e[s+3]+(e[s+4]<<16)+(e[s+5]<<8)+e[s+6])>=9e15?crypto.randomBytes(7).copy(e,s):(u.push(o%1e14),s+=7);s=i/7}if(!L)for(;s<i;)(o=a())<9e15&&(u[s++]=o%1e14);for(t%=14,(i=u[--s])&&t&&(o=p[14-t],u[s]=l(i/o)*o);0===u[s];u.pop(),s--);if(s<0)u=[n=0];else{for(n=-1;0===u[0];u.splice(0,1),n-=14);for(s=1,o=u[0];o>=10;o/=10,s++);s<14&&(n-=14-s)}return f.e=n,f.c=u,f}),H.sum=function(){for(var t=1,e=arguments,r=new H(e[0]);t<e.length;)r=r.plus(e[t++]);return r},n=function(){function t(t,e,r,n){for(var i,o,a=[0],s=0,u=t.length;s<u;){for(o=a.length;o--;a[o]*=e);for(a[0]+=n.indexOf(t.charAt(s++)),i=0;i<a.length;i++)a[i]>r-1&&(null==a[i+1]&&(a[i+1]=0),a[i+1]+=a[i]/r|0,a[i]%=r)}return a.reverse()}return function(e,n,i,o,a){var s,u,c,l,h,f,d,p,y=e.indexOf("."),m=P,g=C;for(y>=0&&(l=D,D=0,e=e.replace(".",""),f=(p=new H(n)).pow(e.length-y),D=l,p.c=t(k(v(f.c),f.e,"0"),10,i,"0123456789"),p.e=p.c.length),c=l=(d=t(e,n,i,a?(s=z,"0123456789"):(s="0123456789",z))).length;0==d[--l];d.pop());if(!d[0])return s.charAt(0);if(y<0?--c:(f.c=d,f.e=c,f.s=o,d=(f=r(f,p,m,g,i)).c,h=f.r,c=f.e),y=d[u=c+m+1],l=i/2,h=h||u<0||null!=d[u+1],h=g<4?(null!=y||h)&&(0==g||g==(f.s<0?3:2)):y>l||y==l&&(4==g||h||6==g&&1&d[u-1]||g==(f.s<0?8:7)),u<1||!d[0])e=h?k(s.charAt(1),-m,s.charAt(0)):s.charAt(0);else{if(d.length=u,h)for(--i;++d[--u]>i;)d[u]=0,u||(++c,d=[1].concat(d));for(l=d.length;!d[--l];);for(y=0,e="";y<=l;e+=s.charAt(d[y++]));e=k(e,c,s.charAt(0))}return e}}(),r=function(){function t(t,e,r){var n,i,o,a,s=0,u=t.length,c=e%1e7,l=e/1e7|0;for(t=t.slice();u--;)s=((i=c*(o=t[u]%1e7)+(n=l*o+(a=t[u]/1e7|0)*c)%1e7*1e7+s)/r|0)+(n/1e7|0)+l*a,t[u]=i%r;return s&&(t=[s].concat(t)),t}function e(t,e,r,n){var i,o;if(r!=n)o=r>n?1:-1;else for(i=o=0;i<r;i++)if(t[i]!=e[i]){o=t[i]>e[i]?1:-1;break}return o}function r(t,e,r,n){for(var i=0;r--;)t[r]-=i,i=t[r]<e[r]?1:0,t[r]=i*n+t[r]-e[r];for(;!t[0]&&t.length>1;t.splice(0,1));}return function(n,i,o,a,s){var u,c,h,f,p,y,v,g,b,w,_,k,x,A,I,E,S,M=n.s==i.s?1:-1,T=n.c,P=i.c;if(!(T&&T[0]&&P&&P[0]))return new H(n.s&&i.s&&(T?!P||T[0]!=P[0]:P)?T&&0==T[0]||!P?0*M:M/0:NaN);for(b=(g=new H(M)).c=[],M=o+(c=n.e-i.e)+1,s||(s=d,c=m(n.e/14)-m(i.e/14),M=M/14|0),h=0;P[h]==(T[h]||0);h++);if(P[h]>(T[h]||0)&&c--,M<0)b.push(1),f=!0;else{for(A=T.length,E=P.length,h=0,M+=2,(p=l(s/(P[0]+1)))>1&&(P=t(P,p,s),T=t(T,p,s),E=P.length,A=T.length),x=E,_=(w=T.slice(0,E)).length;_<E;w[_++]=0);S=P.slice(),S=[0].concat(S),I=P[0],P[1]>=s/2&&I++;do{if(p=0,(u=e(P,w,E,_))<0){if(k=w[0],E!=_&&(k=k*s+(w[1]||0)),(p=l(k/I))>1)for(p>=s&&(p=s-1),v=(y=t(P,p,s)).length,_=w.length;1==e(y,w,v,_);)p--,r(y,E<v?S:P,v,s),v=y.length,u=1;else 0==p&&(u=p=1),v=(y=P.slice()).length;if(v<_&&(y=[0].concat(y)),r(w,y,_,s),_=w.length,-1==u)for(;e(P,w,E,_)<1;)p++,r(w,E<_?S:P,_,s),_=w.length}else 0===u&&(p++,w=[0]);b[h++]=p,w[0]?w[_++]=T[x]||0:(w=[T[x]],_=1)}while((x++<A||null!=w[0])&&M--);f=null!=w[0],b[0]||b.splice(0,1)}if(s==d){for(h=1,M=b[0];M>=10;M/=10,h++);V(g,o+(g.e=h+14*c-1)+1,a,f)}else g.e=c,g.r=+f;return g}}(),x=/^(-?)0([xbo])(?=\w[\w.]*$)/i,A=/^([^.]+)\.$/,I=/^\.([^.]+)$/,E=/^-?(Infinity|NaN)$/,S=/^\s*\+(?=[\w.])|^\s+|\s+$/g,o=function(t,e,r,n){var i,o=r?e:e.replace(S,"");if(E.test(o))t.s=isNaN(o)?null:o<0?-1:1;else{if(!r&&(o=o.replace(x,(function(t,e,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?t:e})),n&&(i=n,o=o.replace(A,"$1").replace(I,"0.$1")),e!=o))return new H(o,i);if(H.DEBUG)throw Error(h+"Not a"+(n?" base "+n:"")+" number: "+e);t.s=null}t.c=t.e=null},M.absoluteValue=M.abs=function(){var t=new H(this);return t.s<0&&(t.s=1),t},M.comparedTo=function(t,e){return g(this,new H(t,e))},M.decimalPlaces=M.dp=function(t,e){var r,n,i,o=this;if(null!=t)return b(t,0,y),null==e?e=C:b(e,0,8),V(new H(o),t+o.e+1,e);if(!(r=o.c))return null;if(n=14*((i=r.length-1)-m(this.e/14)),i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},M.dividedBy=M.div=function(t,e){return r(this,new H(t,e),P,C)},M.dividedToIntegerBy=M.idiv=function(t,e){return r(this,new H(t,e),0,1)},M.exponentiatedBy=M.pow=function(t,e){var r,n,i,o,a,s,u,f,d=this;if((t=new H(t)).c&&!t.isInteger())throw Error(h+"Exponent not an integer: "+K(t));if(null!=e&&(e=new H(e)),a=t.e>14,!d.c||!d.c[0]||1==d.c[0]&&!d.e&&1==d.c.length||!t.c||!t.c[0])return f=new H(Math.pow(+K(d),a?2-w(t):+K(t))),e?f.mod(e):f;if(s=t.s<0,e){if(e.c?!e.c[0]:!e.s)return new H(NaN);(n=!s&&d.isInteger()&&e.isInteger())&&(d=d.mod(e))}else{if(t.e>9&&(d.e>0||d.e<-1||(0==d.e?d.c[0]>1||a&&d.c[1]>=24e7:d.c[0]<8e13||a&&d.c[0]<=9999975e7)))return o=d.s<0&&w(t)?-0:0,d.e>-1&&(o=1/o),new H(s?1/o:o);D&&(o=c(D/14+2))}for(a?(r=new H(.5),s&&(t.s=1),u=w(t)):u=(i=Math.abs(+K(t)))%2,f=new H(T);;){if(u){if(!(f=f.times(d)).c)break;o?f.c.length>o&&(f.c.length=o):n&&(f=f.mod(e))}if(i){if(0===(i=l(i/2)))break;u=i%2}else if(V(t=t.times(r),t.e+1,1),t.e>14)u=w(t);else{if(0===(i=+K(t)))break;u=i%2}d=d.times(d),o?d.c&&d.c.length>o&&(d.c.length=o):n&&(d=d.mod(e))}return n?f:(s&&(f=T.div(f)),e?f.mod(e):o?V(f,D,C,void 0):f)},M.integerValue=function(t){var e=new H(this);return null==t?t=C:b(t,0,8),V(e,e.e+1,t)},M.isEqualTo=M.eq=function(t,e){return 0===g(this,new H(t,e))},M.isFinite=function(){return!!this.c},M.isGreaterThan=M.gt=function(t,e){return g(this,new H(t,e))>0},M.isGreaterThanOrEqualTo=M.gte=function(t,e){return 1===(e=g(this,new H(t,e)))||0===e},M.isInteger=function(){return!!this.c&&m(this.e/14)>this.c.length-2},M.isLessThan=M.lt=function(t,e){return g(this,new H(t,e))<0},M.isLessThanOrEqualTo=M.lte=function(t,e){return-1===(e=g(this,new H(t,e)))||0===e},M.isNaN=function(){return!this.s},M.isNegative=function(){return this.s<0},M.isPositive=function(){return this.s>0},M.isZero=function(){return!!this.c&&0==this.c[0]},M.minus=function(t,e){var r,n,i,o,a=this,s=a.s;if(e=(t=new H(t,e)).s,!s||!e)return new H(NaN);if(s!=e)return t.s=-e,a.plus(t);var u=a.e/14,c=t.e/14,l=a.c,h=t.c;if(!u||!c){if(!l||!h)return l?(t.s=-e,t):new H(h?a:NaN);if(!l[0]||!h[0])return h[0]?(t.s=-e,t):new H(l[0]?a:3==C?-0:0)}if(u=m(u),c=m(c),l=l.slice(),s=u-c){for((o=s<0)?(s=-s,i=l):(c=u,i=h),i.reverse(),e=s;e--;i.push(0));i.reverse()}else for(n=(o=(s=l.length)<(e=h.length))?s:e,s=e=0;e<n;e++)if(l[e]!=h[e]){o=l[e]<h[e];break}if(o&&(i=l,l=h,h=i,t.s=-t.s),(e=(n=h.length)-(r=l.length))>0)for(;e--;l[r++]=0);for(e=d-1;n>s;){if(l[--n]<h[n]){for(r=n;r&&!l[--r];l[r]=e);--l[r],l[n]+=d}l[n]-=h[n]}for(;0==l[0];l.splice(0,1),--c);return l[0]?G(t,l,c):(t.s=3==C?-1:1,t.c=[t.e=0],t)},M.modulo=M.mod=function(t,e){var n,i,o=this;return t=new H(t,e),!o.c||!t.s||t.c&&!t.c[0]?new H(NaN):!t.c||o.c&&!o.c[0]?new H(o):(9==U?(i=t.s,t.s=1,n=r(o,t,0,3),t.s=i,n.s*=i):n=r(o,t,0,U),(t=o.minus(n.times(t))).c[0]||1!=U||(t.s=o.s),t)},M.multipliedBy=M.times=function(t,e){var r,n,i,o,a,s,u,c,l,h,f,p,y,v,g=this,b=g.c,w=(t=new H(t,e)).c;if(!(b&&w&&b[0]&&w[0]))return!g.s||!t.s||b&&!b[0]&&!w||w&&!w[0]&&!b?t.c=t.e=t.s=null:(t.s*=g.s,b&&w?(t.c=[0],t.e=0):t.c=t.e=null),t;for(n=m(g.e/14)+m(t.e/14),t.s*=g.s,(u=b.length)<(h=w.length)&&(y=b,b=w,w=y,i=u,u=h,h=i),i=u+h,y=[];i--;y.push(0));for(v=d,1e7,i=h;--i>=0;){for(r=0,f=w[i]%1e7,p=w[i]/1e7|0,o=i+(a=u);o>i;)r=((c=f*(c=b[--a]%1e7)+(s=p*c+(l=b[a]/1e7|0)*f)%1e7*1e7+y[o]+r)/v|0)+(s/1e7|0)+p*l,y[o--]=c%v;y[o]=r}return r?++n:y.splice(0,1),G(t,y,n)},M.negated=function(){var t=new H(this);return t.s=-t.s||null,t},M.plus=function(t,e){var r,n=this,i=n.s;if(e=(t=new H(t,e)).s,!i||!e)return new H(NaN);if(i!=e)return t.s=-e,n.minus(t);var o=n.e/14,a=t.e/14,s=n.c,u=t.c;if(!o||!a){if(!s||!u)return new H(i/0);if(!s[0]||!u[0])return u[0]?t:new H(s[0]?n:0*i)}if(o=m(o),a=m(a),s=s.slice(),i=o-a){for(i>0?(a=o,r=u):(i=-i,r=s),r.reverse();i--;r.push(0));r.reverse()}for((i=s.length)-(e=u.length)<0&&(r=u,u=s,s=r,e=i),i=0;e;)i=(s[--e]=s[e]+u[e]+i)/d|0,s[e]=d===s[e]?0:s[e]%d;return i&&(s=[i].concat(s),++a),G(t,s,a)},M.precision=M.sd=function(t,e){var r,n,i,o=this;if(null!=t&&t!==!!t)return b(t,1,y),null==e?e=C:b(e,0,8),V(new H(o),t,e);if(!(r=o.c))return null;if(n=14*(i=r.length-1)+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return t&&o.e+1>n&&(n=o.e+1),n},M.shiftedBy=function(t){return b(t,-9007199254740991,9007199254740991),this.times("1e"+t)},M.squareRoot=M.sqrt=function(){var t,e,n,i,o,a=this,s=a.c,u=a.s,c=a.e,l=P+4,h=new H("0.5");if(1!==u||!s||!s[0])return new H(!u||u<0&&(!s||s[0])?NaN:s?a:1/0);if(0==(u=Math.sqrt(+K(a)))||u==1/0?(((e=v(s)).length+c)%2==0&&(e+="0"),u=Math.sqrt(+e),c=m((c+1)/2)-(c<0||c%2),n=new H(e=u==1/0?"1e"+c:(e=u.toExponential()).slice(0,e.indexOf("e")+1)+c)):n=new H(u+""),n.c[0])for((u=(c=n.e)+l)<3&&(u=0);;)if(o=n,n=h.times(o.plus(r(a,o,l,1))),v(o.c).slice(0,u)===(e=v(n.c)).slice(0,u)){if(n.e<c&&--u,"9999"!=(e=e.slice(u-3,u+1))&&(i||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(V(n,n.e+P+2,1),t=!n.times(n).eq(a));break}if(!i&&(V(o,o.e+P+2,0),o.times(o).eq(a))){n=o;break}l+=4,u+=4,i=1}return V(n,n.e+P+1,C,t)},M.toExponential=function(t,e){return null!=t&&(b(t,0,y),t++),F(this,t,e,1)},M.toFixed=function(t,e){return null!=t&&(b(t,0,y),t=t+this.e+1),F(this,t,e)},M.toFormat=function(t,e,r){var n,o=this;if(null==r)null!=t&&e&&"object"==i(e)?(r=e,e=null):t&&"object"==i(t)?(r=t,t=e=null):r=B;else if("object"!=i(r))throw Error(h+"Argument not an object: "+r);if(n=o.toFixed(t,e),o.c){var a,s=n.split("."),u=+r.groupSize,c=+r.secondaryGroupSize,l=r.groupSeparator||"",f=s[0],d=s[1],p=o.s<0,y=p?f.slice(1):f,m=y.length;if(c&&(a=u,u=c,c=a,m-=a),u>0&&m>0){for(a=m%u||u,f=y.substr(0,a);a<m;a+=u)f+=l+y.substr(a,u);c>0&&(f+=l+y.slice(a)),p&&(f="-"+f)}n=d?f+(r.decimalSeparator||"")+((c=+r.fractionGroupSize)?d.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):d):f}return(r.prefix||"")+n+(r.suffix||"")},M.toFraction=function(t){var e,n,i,o,a,s,u,c,l,f,d,y,m=this,g=m.c;if(null!=t&&(!(u=new H(t)).isInteger()&&(u.c||1!==u.s)||u.lt(T)))throw Error(h+"Argument "+(u.isInteger()?"out of range: ":"not an integer: ")+K(u));if(!g)return new H(m);for(e=new H(T),l=n=new H(T),i=c=new H(T),y=v(g),a=e.e=y.length-m.e-1,e.c[0]=p[(s=a%14)<0?14+s:s],t=!t||u.comparedTo(e)>0?a>0?e:l:u,s=N,N=1/0,u=new H(y),c.c[0]=0;f=r(u,e,0,1),1!=(o=n.plus(f.times(i))).comparedTo(t);)n=i,i=o,l=c.plus(f.times(o=l)),c=o,e=u.minus(f.times(o=e)),u=o;return o=r(t.minus(n),i,0,1),c=c.plus(o.times(l)),n=n.plus(o.times(i)),c.s=l.s=m.s,d=r(l,i,a*=2,C).minus(m).abs().comparedTo(r(c,n,a,C).minus(m).abs())<1?[l,i]:[c,n],N=s,d},M.toNumber=function(){return+K(this)},M.toPrecision=function(t,e){return null!=t&&b(t,1,y),F(this,t,e,2)},M.toString=function(t){var e,r=this,i=r.s,o=r.e;return null===o?i?(e="Infinity",i<0&&(e="-"+e)):e="NaN":(null==t?e=o<=O||o>=R?_(v(r.c),o):k(v(r.c),o,"0"):10===t?e=k(v((r=V(new H(r),P+o+1,C)).c),r.e,"0"):(b(t,2,z.length,"Base"),e=n(k(v(r.c),o,"0"),10,t,i,!0)),i<0&&r.c[0]&&(e="-"+e)),e},M.valueOf=M.toJSON=function(){return K(this)},M._isBigNumber=!0,u&&(M[Symbol.toStringTag]="BigNumber",M[Symbol.for("nodejs.util.inspect.custom")]=M.valueOf),null!=e&&H.set(e),H}()).default=a.BigNumber=a,void 0===(n=function(){return a}.call(e,r,e,t))||(t.exports=n)}()},function(t,e,r){t.exports={encode:r(70),decode:r(71),encodingLength:r(72)}},function(t,e){t.exports=function t(e,n,i){n=n||[];var o=i=i||0;for(;e>=r;)n[i++]=255&e|128,e/=128;for(;-128&e;)n[i++]=255&e|128,e>>>=7;return n[i]=0|e,t.bytes=i-o+1,n};var r=Math.pow(2,31)},function(t,e){t.exports=function t(e,r){var n,i=0,o=0,a=r=r||0,s=e.length;do{if(a>=s)throw t.bytes=0,new RangeError("Could not decode varint");n=e[a++],i+=o<28?(127&n)<<o:(127&n)*Math.pow(2,o),o+=7}while(n>=128);return t.bytes=a-r,i}},function(t,e){var r=Math.pow(2,7),n=Math.pow(2,14),i=Math.pow(2,21),o=Math.pow(2,28),a=Math.pow(2,35),s=Math.pow(2,42),u=Math.pow(2,49),c=Math.pow(2,56),l=Math.pow(2,63);t.exports=function(t){return t<r?1:t<n?2:t<i?3:t<o?4:t<a?5:t<s?6:t<u?7:t<c?8:t<l?9:10}},function(t,e,r){"use strict";r.r(e),r.d(e,"Deflate",(function(){return We})),r.d(e,"Inflate",(function(){return $e})),r.d(e,"constants",(function(){return rr})),r.d(e,"default",(function(){return nr})),r.d(e,"deflate",(function(){return Je})),r.d(e,"deflateRaw",(function(){return Qe})),r.d(e,"gzip",(function(){return Ye})),r.d(e,"inflate",(function(){return Xe})),r.d(e,"inflateRaw",(function(){return tr})),r.d(e,"ungzip",(function(){return er}));function n(t){let e=t.length;for(;--e>=0;)t[e]=0}const i=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),o=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),a=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),s=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),u=new Array(576);n(u);const c=new Array(60);n(c);const l=new Array(512);n(l);const h=new Array(256);n(h);const f=new Array(29);n(f);const d=new Array(30);function p(t,e,r,n,i){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=t&&t.length}let y,m,v;function g(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}n(d);const b=t=>t<256?l[t]:l[256+(t>>>7)],w=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},_=(t,e,r)=>{t.bi_valid>16-r?(t.bi_buf|=e<<t.bi_valid&65535,w(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=r-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=r)},k=(t,e,r)=>{_(t,r[2*e],r[2*e+1])},x=(t,e)=>{let r=0;do{r|=1&t,t>>>=1,r<<=1}while(--e>0);return r>>>1},A=(t,e,r)=>{const n=new Array(16);let i,o,a=0;for(i=1;i<=15;i++)n[i]=a=a+r[i-1]<<1;for(o=0;o<=e;o++){let e=t[2*o+1];0!==e&&(t[2*o]=x(n[e]++,e))}},I=t=>{let e;for(e=0;e<286;e++)t.dyn_ltree[2*e]=0;for(e=0;e<30;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0},E=t=>{t.bi_valid>8?w(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},S=(t,e,r,n)=>{const i=2*e,o=2*r;return t[i]<t[o]||t[i]===t[o]&&n[e]<=n[r]},M=(t,e,r)=>{const n=t.heap[r];let i=r<<1;for(;i<=t.heap_len&&(i<t.heap_len&&S(e,t.heap[i+1],t.heap[i],t.depth)&&i++,!S(e,n,t.heap[i],t.depth));)t.heap[r]=t.heap[i],r=i,i<<=1;t.heap[r]=n},T=(t,e,r)=>{let n,a,s,u,c=0;if(0!==t.last_lit)do{n=t.pending_buf[t.d_buf+2*c]<<8|t.pending_buf[t.d_buf+2*c+1],a=t.pending_buf[t.l_buf+c],c++,0===n?k(t,a,e):(s=h[a],k(t,s+256+1,e),u=i[s],0!==u&&(a-=f[s],_(t,a,u)),n--,s=b(n),k(t,s,r),u=o[s],0!==u&&(n-=d[s],_(t,n,u)))}while(c<t.last_lit);k(t,256,e)},P=(t,e)=>{const r=e.dyn_tree,n=e.stat_desc.static_tree,i=e.stat_desc.has_stree,o=e.stat_desc.elems;let a,s,u,c=-1;for(t.heap_len=0,t.heap_max=573,a=0;a<o;a++)0!==r[2*a]?(t.heap[++t.heap_len]=c=a,t.depth[a]=0):r[2*a+1]=0;for(;t.heap_len<2;)u=t.heap[++t.heap_len]=c<2?++c:0,r[2*u]=1,t.depth[u]=0,t.opt_len--,i&&(t.static_len-=n[2*u+1]);for(e.max_code=c,a=t.heap_len>>1;a>=1;a--)M(t,r,a);u=o;do{a=t.heap[1],t.heap[1]=t.heap[t.heap_len--],M(t,r,1),s=t.heap[1],t.heap[--t.heap_max]=a,t.heap[--t.heap_max]=s,r[2*u]=r[2*a]+r[2*s],t.depth[u]=(t.depth[a]>=t.depth[s]?t.depth[a]:t.depth[s])+1,r[2*a+1]=r[2*s+1]=u,t.heap[1]=u++,M(t,r,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const r=e.dyn_tree,n=e.max_code,i=e.stat_desc.static_tree,o=e.stat_desc.has_stree,a=e.stat_desc.extra_bits,s=e.stat_desc.extra_base,u=e.stat_desc.max_length;let c,l,h,f,d,p,y=0;for(f=0;f<=15;f++)t.bl_count[f]=0;for(r[2*t.heap[t.heap_max]+1]=0,c=t.heap_max+1;c<573;c++)l=t.heap[c],f=r[2*r[2*l+1]+1]+1,f>u&&(f=u,y++),r[2*l+1]=f,l>n||(t.bl_count[f]++,d=0,l>=s&&(d=a[l-s]),p=r[2*l],t.opt_len+=p*(f+d),o&&(t.static_len+=p*(i[2*l+1]+d)));if(0!==y){do{for(f=u-1;0===t.bl_count[f];)f--;t.bl_count[f]--,t.bl_count[f+1]+=2,t.bl_count[u]--,y-=2}while(y>0);for(f=u;0!==f;f--)for(l=t.bl_count[f];0!==l;)h=t.heap[--c],h>n||(r[2*h+1]!==f&&(t.opt_len+=(f-r[2*h+1])*r[2*h],r[2*h+1]=f),l--)}})(t,e),A(r,c,t.bl_count)},C=(t,e,r)=>{let n,i,o=-1,a=e[1],s=0,u=7,c=4;for(0===a&&(u=138,c=3),e[2*(r+1)+1]=65535,n=0;n<=r;n++)i=a,a=e[2*(n+1)+1],++s<u&&i===a||(s<c?t.bl_tree[2*i]+=s:0!==i?(i!==o&&t.bl_tree[2*i]++,t.bl_tree[32]++):s<=10?t.bl_tree[34]++:t.bl_tree[36]++,s=0,o=i,0===a?(u=138,c=3):i===a?(u=6,c=3):(u=7,c=4))},O=(t,e,r)=>{let n,i,o=-1,a=e[1],s=0,u=7,c=4;for(0===a&&(u=138,c=3),n=0;n<=r;n++)if(i=a,a=e[2*(n+1)+1],!(++s<u&&i===a)){if(s<c)do{k(t,i,t.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&(k(t,i,t.bl_tree),s--),k(t,16,t.bl_tree),_(t,s-3,2)):s<=10?(k(t,17,t.bl_tree),_(t,s-3,3)):(k(t,18,t.bl_tree),_(t,s-11,7));s=0,o=i,0===a?(u=138,c=3):i===a?(u=6,c=3):(u=7,c=4)}};let R=!1;const j=(t,e,r,n)=>{_(t,0+(n?1:0),3),((t,e,r,n)=>{E(t),n&&(w(t,r),w(t,~r)),t.pending_buf.set(t.window.subarray(e,e+r),t.pending),t.pending+=r})(t,e,r,!0)};var N={_tr_init:t=>{R||((()=>{let t,e,r,n,s;const g=new Array(16);for(r=0,n=0;n<28;n++)for(f[n]=r,t=0;t<1<<i[n];t++)h[r++]=n;for(h[r-1]=n,s=0,n=0;n<16;n++)for(d[n]=s,t=0;t<1<<o[n];t++)l[s++]=n;for(s>>=7;n<30;n++)for(d[n]=s<<7,t=0;t<1<<o[n]-7;t++)l[256+s++]=n;for(e=0;e<=15;e++)g[e]=0;for(t=0;t<=143;)u[2*t+1]=8,t++,g[8]++;for(;t<=255;)u[2*t+1]=9,t++,g[9]++;for(;t<=279;)u[2*t+1]=7,t++,g[7]++;for(;t<=287;)u[2*t+1]=8,t++,g[8]++;for(A(u,287,g),t=0;t<30;t++)c[2*t+1]=5,c[2*t]=x(t,5);y=new p(u,i,257,286,15),m=new p(c,o,0,30,15),v=new p(new Array(0),a,0,19,7)})(),R=!0),t.l_desc=new g(t.dyn_ltree,y),t.d_desc=new g(t.dyn_dtree,m),t.bl_desc=new g(t.bl_tree,v),t.bi_buf=0,t.bi_valid=0,I(t)},_tr_stored_block:j,_tr_flush_block:(t,e,r,n)=>{let i,o,a=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,r=4093624447;for(e=0;e<=31;e++,r>>>=1)if(1&r&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<256;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0})(t)),P(t,t.l_desc),P(t,t.d_desc),a=(t=>{let e;for(C(t,t.dyn_ltree,t.l_desc.max_code),C(t,t.dyn_dtree,t.d_desc.max_code),P(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*s[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),i=t.opt_len+3+7>>>3,o=t.static_len+3+7>>>3,o<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==e?j(t,e,r,n):4===t.strategy||o===i?(_(t,2+(n?1:0),3),T(t,u,c)):(_(t,4+(n?1:0),3),((t,e,r,n)=>{let i;for(_(t,e-257,5),_(t,r-1,5),_(t,n-4,4),i=0;i<n;i++)_(t,t.bl_tree[2*s[i]+1],3);O(t,t.dyn_ltree,e-1),O(t,t.dyn_dtree,r-1)})(t,t.l_desc.max_code+1,t.d_desc.max_code+1,a+1),T(t,t.dyn_ltree,t.dyn_dtree)),I(t),n&&E(t)},_tr_tally:(t,e,r)=>(t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&r,t.last_lit++,0===e?t.dyn_ltree[2*r]++:(t.matches++,e--,t.dyn_ltree[2*(h[r]+256+1)]++,t.dyn_dtree[2*b(e)]++),t.last_lit===t.lit_bufsize-1),_tr_align:t=>{_(t,2,3),k(t,256,u),(t=>{16===t.bi_valid?(w(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(t)}};var L=(t,e,r,n)=>{let i=65535&t|0,o=t>>>16&65535|0,a=0;for(;0!==r;){a=r>2e3?2e3:r,r-=a;do{i=i+e[n++]|0,o=o+i|0}while(--a);i%=65521,o%=65521}return i|o<<16|0};const U=new Uint32Array((()=>{let t,e=[];for(var r=0;r<256;r++){t=r;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[r]=t}return e})());var D=(t,e,r,n)=>{const i=U,o=n+r;t^=-1;for(let r=n;r<o;r++)t=t>>>8^i[255&(t^e[r])];return-1^t},B={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},z={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:H,_tr_stored_block:F,_tr_flush_block:q,_tr_tally:G,_tr_align:V}=N,{Z_NO_FLUSH:K,Z_PARTIAL_FLUSH:Z,Z_FULL_FLUSH:W,Z_FINISH:J,Z_BLOCK:Q,Z_OK:Y,Z_STREAM_END:$,Z_STREAM_ERROR:X,Z_DATA_ERROR:tt,Z_BUF_ERROR:et,Z_DEFAULT_COMPRESSION:rt,Z_FILTERED:nt,Z_HUFFMAN_ONLY:it,Z_RLE:ot,Z_FIXED:at,Z_DEFAULT_STRATEGY:st,Z_UNKNOWN:ut,Z_DEFLATED:ct}=z,lt=(t,e)=>(t.msg=B[e],e),ht=t=>(t<<1)-(t>4?9:0),ft=t=>{let e=t.length;for(;--e>=0;)t[e]=0};let dt=(t,e,r)=>(e<<t.hash_shift^r)&t.hash_mask;const pt=t=>{const e=t.state;let r=e.pending;r>t.avail_out&&(r=t.avail_out),0!==r&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+r),t.next_out),t.next_out+=r,e.pending_out+=r,t.total_out+=r,t.avail_out-=r,e.pending-=r,0===e.pending&&(e.pending_out=0))},yt=(t,e)=>{q(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,pt(t.strm)},mt=(t,e)=>{t.pending_buf[t.pending++]=e},vt=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},gt=(t,e,r,n)=>{let i=t.avail_in;return i>n&&(i=n),0===i?0:(t.avail_in-=i,e.set(t.input.subarray(t.next_in,t.next_in+i),r),1===t.state.wrap?t.adler=L(t.adler,e,i,r):2===t.state.wrap&&(t.adler=D(t.adler,e,i,r)),t.next_in+=i,t.total_in+=i,i)},bt=(t,e)=>{let r,n,i=t.max_chain_length,o=t.strstart,a=t.prev_length,s=t.nice_match;const u=t.strstart>t.w_size-262?t.strstart-(t.w_size-262):0,c=t.window,l=t.w_mask,h=t.prev,f=t.strstart+258;let d=c[o+a-1],p=c[o+a];t.prev_length>=t.good_match&&(i>>=2),s>t.lookahead&&(s=t.lookahead);do{if(r=e,c[r+a]===p&&c[r+a-1]===d&&c[r]===c[o]&&c[++r]===c[o+1]){o+=2,r++;do{}while(c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&o<f);if(n=258-(f-o),o=f-258,n>a){if(t.match_start=e,a=n,n>=s)break;d=c[o+a-1],p=c[o+a]}}}while((e=h[e&l])>u&&0!=--i);return a<=t.lookahead?a:t.lookahead},wt=t=>{const e=t.w_size;let r,n,i,o,a;do{if(o=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-262)){t.window.set(t.window.subarray(e,e+e),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,n=t.hash_size,r=n;do{i=t.head[--r],t.head[r]=i>=e?i-e:0}while(--n);n=e,r=n;do{i=t.prev[--r],t.prev[r]=i>=e?i-e:0}while(--n);o+=e}if(0===t.strm.avail_in)break;if(n=gt(t.strm,t.window,t.strstart+t.lookahead,o),t.lookahead+=n,t.lookahead+t.insert>=3)for(a=t.strstart-t.insert,t.ins_h=t.window[a],t.ins_h=dt(t,t.ins_h,t.window[a+1]);t.insert&&(t.ins_h=dt(t,t.ins_h,t.window[a+3-1]),t.prev[a&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=a,a++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<262&&0!==t.strm.avail_in)},_t=(t,e)=>{let r,n;for(;;){if(t.lookahead<262){if(wt(t),t.lookahead<262&&e===K)return 1;if(0===t.lookahead)break}if(r=0,t.lookahead>=3&&(t.ins_h=dt(t,t.ins_h,t.window[t.strstart+3-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==r&&t.strstart-r<=t.w_size-262&&(t.match_length=bt(t,r)),t.match_length>=3)if(n=G(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=dt(t,t.ins_h,t.window[t.strstart+3-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=dt(t,t.ins_h,t.window[t.strstart+1]);else n=G(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(yt(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===J?(yt(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(yt(t,!1),0===t.strm.avail_out)?1:2},kt=(t,e)=>{let r,n,i;for(;;){if(t.lookahead<262){if(wt(t),t.lookahead<262&&e===K)return 1;if(0===t.lookahead)break}if(r=0,t.lookahead>=3&&(t.ins_h=dt(t,t.ins_h,t.window[t.strstart+3-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==r&&t.prev_length<t.max_lazy_match&&t.strstart-r<=t.w_size-262&&(t.match_length=bt(t,r),t.match_length<=5&&(t.strategy===nt||3===t.match_length&&t.strstart-t.match_start>4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-3,n=G(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=i&&(t.ins_h=dt(t,t.ins_h,t.window[t.strstart+3-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,n&&(yt(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(n=G(t,0,t.window[t.strstart-1]),n&&yt(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=G(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===J?(yt(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(yt(t,!1),0===t.strm.avail_out)?1:2};function xt(t,e,r,n,i){this.good_length=t,this.max_lazy=e,this.nice_length=r,this.max_chain=n,this.func=i}const At=[new xt(0,0,0,0,(t,e)=>{let r=65535;for(r>t.pending_buf_size-5&&(r=t.pending_buf_size-5);;){if(t.lookahead<=1){if(wt(t),0===t.lookahead&&e===K)return 1;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;const n=t.block_start+r;if((0===t.strstart||t.strstart>=n)&&(t.lookahead=t.strstart-n,t.strstart=n,yt(t,!1),0===t.strm.avail_out))return 1;if(t.strstart-t.block_start>=t.w_size-262&&(yt(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===J?(yt(t,!0),0===t.strm.avail_out?3:4):(t.strstart>t.block_start&&(yt(t,!1),t.strm.avail_out),1)}),new xt(4,4,8,4,_t),new xt(4,5,16,8,_t),new xt(4,6,32,32,_t),new xt(4,4,16,16,kt),new xt(8,16,32,32,kt),new xt(8,16,128,128,kt),new xt(8,32,128,256,kt),new xt(32,128,258,1024,kt),new xt(32,258,258,4096,kt)];function It(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=ct,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),ft(this.dyn_ltree),ft(this.dyn_dtree),ft(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),ft(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),ft(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Et=t=>{if(!t||!t.state)return lt(t,X);t.total_in=t.total_out=0,t.data_type=ut;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?42:113,t.adler=2===e.wrap?0:1,e.last_flush=K,H(e),Y},St=t=>{const e=Et(t);var r;return e===Y&&((r=t.state).window_size=2*r.w_size,ft(r.head),r.max_lazy_match=At[r.level].max_lazy,r.good_match=At[r.level].good_length,r.nice_match=At[r.level].nice_length,r.max_chain_length=At[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=2,r.match_available=0,r.ins_h=0),e},Mt=(t,e,r,n,i,o)=>{if(!t)return X;let a=1;if(e===rt&&(e=6),n<0?(a=0,n=-n):n>15&&(a=2,n-=16),i<1||i>9||r!==ct||n<8||n>15||e<0||e>9||o<0||o>at)return lt(t,X);8===n&&(n=9);const s=new It;return t.state=s,s.strm=t,s.wrap=a,s.gzhead=null,s.w_bits=n,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+3-1)/3),s.window=new Uint8Array(2*s.w_size),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new Uint8Array(s.pending_buf_size),s.d_buf=1*s.lit_bufsize,s.l_buf=3*s.lit_bufsize,s.level=e,s.strategy=o,s.method=r,St(t)};var Tt={deflateInit:(t,e)=>Mt(t,e,ct,15,8,st),deflateInit2:Mt,deflateReset:St,deflateResetKeep:Et,deflateSetHeader:(t,e)=>t&&t.state?2!==t.state.wrap?X:(t.state.gzhead=e,Y):X,deflate:(t,e)=>{let r,n;if(!t||!t.state||e>Q||e<0)return t?lt(t,X):X;const i=t.state;if(!t.output||!t.input&&0!==t.avail_in||666===i.status&&e!==J)return lt(t,0===t.avail_out?et:X);i.strm=t;const o=i.last_flush;if(i.last_flush=e,42===i.status)if(2===i.wrap)t.adler=0,mt(i,31),mt(i,139),mt(i,8),i.gzhead?(mt(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),mt(i,255&i.gzhead.time),mt(i,i.gzhead.time>>8&255),mt(i,i.gzhead.time>>16&255),mt(i,i.gzhead.time>>24&255),mt(i,9===i.level?2:i.strategy>=it||i.level<2?4:0),mt(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(mt(i,255&i.gzhead.extra.length),mt(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=D(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(mt(i,0),mt(i,0),mt(i,0),mt(i,0),mt(i,0),mt(i,9===i.level?2:i.strategy>=it||i.level<2?4:0),mt(i,3),i.status=113);else{let e=ct+(i.w_bits-8<<4)<<8,r=-1;r=i.strategy>=it||i.level<2?0:i.level<6?1:6===i.level?2:3,e|=r<<6,0!==i.strstart&&(e|=32),e+=31-e%31,i.status=113,vt(i,e),0!==i.strstart&&(vt(i,t.adler>>>16),vt(i,65535&t.adler)),t.adler=1}if(69===i.status)if(i.gzhead.extra){for(r=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>r&&(t.adler=D(t.adler,i.pending_buf,i.pending-r,r)),pt(t),r=i.pending,i.pending!==i.pending_buf_size));)mt(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>r&&(t.adler=D(t.adler,i.pending_buf,i.pending-r,r)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(73===i.status)if(i.gzhead.name){r=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>r&&(t.adler=D(t.adler,i.pending_buf,i.pending-r,r)),pt(t),r=i.pending,i.pending===i.pending_buf_size)){n=1;break}n=i.gzindex<i.gzhead.name.length?255&i.gzhead.name.charCodeAt(i.gzindex++):0,mt(i,n)}while(0!==n);i.gzhead.hcrc&&i.pending>r&&(t.adler=D(t.adler,i.pending_buf,i.pending-r,r)),0===n&&(i.gzindex=0,i.status=91)}else i.status=91;if(91===i.status)if(i.gzhead.comment){r=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>r&&(t.adler=D(t.adler,i.pending_buf,i.pending-r,r)),pt(t),r=i.pending,i.pending===i.pending_buf_size)){n=1;break}n=i.gzindex<i.gzhead.comment.length?255&i.gzhead.comment.charCodeAt(i.gzindex++):0,mt(i,n)}while(0!==n);i.gzhead.hcrc&&i.pending>r&&(t.adler=D(t.adler,i.pending_buf,i.pending-r,r)),0===n&&(i.status=103)}else i.status=103;if(103===i.status&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&pt(t),i.pending+2<=i.pending_buf_size&&(mt(i,255&t.adler),mt(i,t.adler>>8&255),t.adler=0,i.status=113)):i.status=113),0!==i.pending){if(pt(t),0===t.avail_out)return i.last_flush=-1,Y}else if(0===t.avail_in&&ht(e)<=ht(o)&&e!==J)return lt(t,et);if(666===i.status&&0!==t.avail_in)return lt(t,et);if(0!==t.avail_in||0!==i.lookahead||e!==K&&666!==i.status){let r=i.strategy===it?((t,e)=>{let r;for(;;){if(0===t.lookahead&&(wt(t),0===t.lookahead)){if(e===K)return 1;break}if(t.match_length=0,r=G(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(yt(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===J?(yt(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(yt(t,!1),0===t.strm.avail_out)?1:2})(i,e):i.strategy===ot?((t,e)=>{let r,n,i,o;const a=t.window;for(;;){if(t.lookahead<=258){if(wt(t),t.lookahead<=258&&e===K)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(i=t.strstart-1,n=a[i],n===a[++i]&&n===a[++i]&&n===a[++i])){o=t.strstart+258;do{}while(n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&i<o);t.match_length=258-(o-i),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(r=G(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=G(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(yt(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===J?(yt(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(yt(t,!1),0===t.strm.avail_out)?1:2})(i,e):At[i.level].func(i,e);if(3!==r&&4!==r||(i.status=666),1===r||3===r)return 0===t.avail_out&&(i.last_flush=-1),Y;if(2===r&&(e===Z?V(i):e!==Q&&(F(i,0,0,!1),e===W&&(ft(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),pt(t),0===t.avail_out))return i.last_flush=-1,Y}return e!==J?Y:i.wrap<=0?$:(2===i.wrap?(mt(i,255&t.adler),mt(i,t.adler>>8&255),mt(i,t.adler>>16&255),mt(i,t.adler>>24&255),mt(i,255&t.total_in),mt(i,t.total_in>>8&255),mt(i,t.total_in>>16&255),mt(i,t.total_in>>24&255)):(vt(i,t.adler>>>16),vt(i,65535&t.adler)),pt(t),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?Y:$)},deflateEnd:t=>{if(!t||!t.state)return X;const e=t.state.status;return 42!==e&&69!==e&&73!==e&&91!==e&&103!==e&&113!==e&&666!==e?lt(t,X):(t.state=null,113===e?lt(t,tt):Y)},deflateSetDictionary:(t,e)=>{let r=e.length;if(!t||!t.state)return X;const n=t.state,i=n.wrap;if(2===i||1===i&&42!==n.status||n.lookahead)return X;if(1===i&&(t.adler=L(t.adler,e,r,0)),n.wrap=0,r>=n.w_size){0===i&&(ft(n.head),n.strstart=0,n.block_start=0,n.insert=0);let t=new Uint8Array(n.w_size);t.set(e.subarray(r-n.w_size,r),0),e=t,r=n.w_size}const o=t.avail_in,a=t.next_in,s=t.input;for(t.avail_in=r,t.next_in=0,t.input=e,wt(n);n.lookahead>=3;){let t=n.strstart,e=n.lookahead-2;do{n.ins_h=dt(n,n.ins_h,n.window[t+3-1]),n.prev[t&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=t,t++}while(--e);n.strstart=t,n.lookahead=2,wt(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,t.next_in=a,t.input=s,t.avail_in=o,n.wrap=i,Y},deflateInfo:"pako deflate (from Nodeca project)"};const Pt=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var Ct=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const r=e.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(const e in r)Pt(r,e)&&(t[e]=r[e])}}return t},Ot=t=>{let e=0;for(let r=0,n=t.length;r<n;r++)e+=t[r].length;const r=new Uint8Array(e);for(let e=0,n=0,i=t.length;e<i;e++){let i=t[e];r.set(i,n),n+=i.length}return r};let Rt=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){Rt=!1}const jt=new Uint8Array(256);for(let t=0;t<256;t++)jt[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;jt[254]=jt[254]=1;var Nt=t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,r,n,i,o,a=t.length,s=0;for(i=0;i<a;i++)r=t.charCodeAt(i),55296==(64512&r)&&i+1<a&&(n=t.charCodeAt(i+1),56320==(64512&n)&&(r=65536+(r-55296<<10)+(n-56320),i++)),s+=r<128?1:r<2048?2:r<65536?3:4;for(e=new Uint8Array(s),o=0,i=0;o<s;i++)r=t.charCodeAt(i),55296==(64512&r)&&i+1<a&&(n=t.charCodeAt(i+1),56320==(64512&n)&&(r=65536+(r-55296<<10)+(n-56320),i++)),r<128?e[o++]=r:r<2048?(e[o++]=192|r>>>6,e[o++]=128|63&r):r<65536?(e[o++]=224|r>>>12,e[o++]=128|r>>>6&63,e[o++]=128|63&r):(e[o++]=240|r>>>18,e[o++]=128|r>>>12&63,e[o++]=128|r>>>6&63,e[o++]=128|63&r);return e},Lt=(t,e)=>{const r=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let n,i;const o=new Array(2*r);for(i=0,n=0;n<r;){let e=t[n++];if(e<128){o[i++]=e;continue}let a=jt[e];if(a>4)o[i++]=65533,n+=a-1;else{for(e&=2===a?31:3===a?15:7;a>1&&n<r;)e=e<<6|63&t[n++],a--;a>1?o[i++]=65533:e<65536?o[i++]=e:(e-=65536,o[i++]=55296|e>>10&1023,o[i++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&Rt)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let r="";for(let n=0;n<e;n++)r+=String.fromCharCode(t[n]);return r})(o,i)},Ut=(t,e)=>{(e=e||t.length)>t.length&&(e=t.length);let r=e-1;for(;r>=0&&128==(192&t[r]);)r--;return r<0||0===r?e:r+jt[t[r]]>e?r:e};var Dt=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const Bt=Object.prototype.toString,{Z_NO_FLUSH:zt,Z_SYNC_FLUSH:Ht,Z_FULL_FLUSH:Ft,Z_FINISH:qt,Z_OK:Gt,Z_STREAM_END:Vt,Z_DEFAULT_COMPRESSION:Kt,Z_DEFAULT_STRATEGY:Zt,Z_DEFLATED:Wt}=z;function Jt(t){this.options=Ct({level:Kt,method:Wt,chunkSize:16384,windowBits:15,memLevel:8,strategy:Zt},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Dt,this.strm.avail_out=0;let r=Tt.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(r!==Gt)throw new Error(B[r]);if(e.header&&Tt.deflateSetHeader(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?Nt(e.dictionary):"[object ArrayBuffer]"===Bt.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,r=Tt.deflateSetDictionary(this.strm,t),r!==Gt)throw new Error(B[r]);this._dict_set=!0}}function Qt(t,e){const r=new Jt(e);if(r.push(t,!0),r.err)throw r.msg||B[r.err];return r.result}Jt.prototype.push=function(t,e){const r=this.strm,n=this.options.chunkSize;let i,o;if(this.ended)return!1;for(o=e===~~e?e:!0===e?qt:zt,"string"==typeof t?r.input=Nt(t):"[object ArrayBuffer]"===Bt.call(t)?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;;)if(0===r.avail_out&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),(o===Ht||o===Ft)&&r.avail_out<=6)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else{if(i=Tt.deflate(r,o),i===Vt)return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),i=Tt.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===Gt;if(0!==r.avail_out){if(o>0&&r.next_out>0)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else if(0===r.avail_in)break}else this.onData(r.output)}return!0},Jt.prototype.onData=function(t){this.chunks.push(t)},Jt.prototype.onEnd=function(t){t===Gt&&(this.result=Ot(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var Yt={Deflate:Jt,deflate:Qt,deflateRaw:function(t,e){return(e=e||{}).raw=!0,Qt(t,e)},gzip:function(t,e){return(e=e||{}).gzip=!0,Qt(t,e)},constants:z};var $t=function(t,e){let r,n,i,o,a,s,u,c,l,h,f,d,p,y,m,v,g,b,w,_,k,x,A,I;const E=t.state;r=t.next_in,A=t.input,n=r+(t.avail_in-5),i=t.next_out,I=t.output,o=i-(e-t.avail_out),a=i+(t.avail_out-257),s=E.dmax,u=E.wsize,c=E.whave,l=E.wnext,h=E.window,f=E.hold,d=E.bits,p=E.lencode,y=E.distcode,m=(1<<E.lenbits)-1,v=(1<<E.distbits)-1;t:do{d<15&&(f+=A[r++]<<d,d+=8,f+=A[r++]<<d,d+=8),g=p[f&m];e:for(;;){if(b=g>>>24,f>>>=b,d-=b,b=g>>>16&255,0===b)I[i++]=65535&g;else{if(!(16&b)){if(0==(64&b)){g=p[(65535&g)+(f&(1<<b)-1)];continue e}if(32&b){E.mode=12;break t}t.msg="invalid literal/length code",E.mode=30;break t}w=65535&g,b&=15,b&&(d<b&&(f+=A[r++]<<d,d+=8),w+=f&(1<<b)-1,f>>>=b,d-=b),d<15&&(f+=A[r++]<<d,d+=8,f+=A[r++]<<d,d+=8),g=y[f&v];r:for(;;){if(b=g>>>24,f>>>=b,d-=b,b=g>>>16&255,!(16&b)){if(0==(64&b)){g=y[(65535&g)+(f&(1<<b)-1)];continue r}t.msg="invalid distance code",E.mode=30;break t}if(_=65535&g,b&=15,d<b&&(f+=A[r++]<<d,d+=8,d<b&&(f+=A[r++]<<d,d+=8)),_+=f&(1<<b)-1,_>s){t.msg="invalid distance too far back",E.mode=30;break t}if(f>>>=b,d-=b,b=i-o,_>b){if(b=_-b,b>c&&E.sane){t.msg="invalid distance too far back",E.mode=30;break t}if(k=0,x=h,0===l){if(k+=u-b,b<w){w-=b;do{I[i++]=h[k++]}while(--b);k=i-_,x=I}}else if(l<b){if(k+=u+l-b,b-=l,b<w){w-=b;do{I[i++]=h[k++]}while(--b);if(k=0,l<w){b=l,w-=b;do{I[i++]=h[k++]}while(--b);k=i-_,x=I}}}else if(k+=l-b,b<w){w-=b;do{I[i++]=h[k++]}while(--b);k=i-_,x=I}for(;w>2;)I[i++]=x[k++],I[i++]=x[k++],I[i++]=x[k++],w-=3;w&&(I[i++]=x[k++],w>1&&(I[i++]=x[k++]))}else{k=i-_;do{I[i++]=I[k++],I[i++]=I[k++],I[i++]=I[k++],w-=3}while(w>2);w&&(I[i++]=I[k++],w>1&&(I[i++]=I[k++]))}break}}break}}while(r<n&&i<a);w=d>>3,r-=w,d-=w<<3,f&=(1<<d)-1,t.next_in=r,t.next_out=i,t.avail_in=r<n?n-r+5:5-(r-n),t.avail_out=i<a?a-i+257:257-(i-a),E.hold=f,E.bits=d};const Xt=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),te=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),ee=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),re=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var ne=(t,e,r,n,i,o,a,s)=>{const u=s.bits;let c,l,h,f,d,p,y=0,m=0,v=0,g=0,b=0,w=0,_=0,k=0,x=0,A=0,I=null,E=0;const S=new Uint16Array(16),M=new Uint16Array(16);let T,P,C,O=null,R=0;for(y=0;y<=15;y++)S[y]=0;for(m=0;m<n;m++)S[e[r+m]]++;for(b=u,g=15;g>=1&&0===S[g];g--);if(b>g&&(b=g),0===g)return i[o++]=20971520,i[o++]=20971520,s.bits=1,0;for(v=1;v<g&&0===S[v];v++);for(b<v&&(b=v),k=1,y=1;y<=15;y++)if(k<<=1,k-=S[y],k<0)return-1;if(k>0&&(0===t||1!==g))return-1;for(M[1]=0,y=1;y<15;y++)M[y+1]=M[y]+S[y];for(m=0;m<n;m++)0!==e[r+m]&&(a[M[e[r+m]]++]=m);if(0===t?(I=O=a,p=19):1===t?(I=Xt,E-=257,O=te,R-=257,p=256):(I=ee,O=re,p=-1),A=0,m=0,y=v,d=o,w=b,_=0,h=-1,x=1<<b,f=x-1,1===t&&x>852||2===t&&x>592)return 1;for(;;){T=y-_,a[m]<p?(P=0,C=a[m]):a[m]>p?(P=O[R+a[m]],C=I[E+a[m]]):(P=96,C=0),c=1<<y-_,l=1<<w,v=l;do{l-=c,i[d+(A>>_)+l]=T<<24|P<<16|C|0}while(0!==l);for(c=1<<y-1;A&c;)c>>=1;if(0!==c?(A&=c-1,A+=c):A=0,m++,0==--S[y]){if(y===g)break;y=e[r+a[m]]}if(y>b&&(A&f)!==h){for(0===_&&(_=b),d+=v,w=y-_,k=1<<w;w+_<g&&(k-=S[w+_],!(k<=0));)w++,k<<=1;if(x+=1<<w,1===t&&x>852||2===t&&x>592)return 1;h=A&f,i[h]=b<<24|w<<16|d-o|0}}return 0!==A&&(i[d+A]=y-_<<24|64<<16|0),s.bits=b,0};const{Z_FINISH:ie,Z_BLOCK:oe,Z_TREES:ae,Z_OK:se,Z_STREAM_END:ue,Z_NEED_DICT:ce,Z_STREAM_ERROR:le,Z_DATA_ERROR:he,Z_MEM_ERROR:fe,Z_BUF_ERROR:de,Z_DEFLATED:pe}=z,ye=t=>(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function me(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const ve=t=>{if(!t||!t.state)return le;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=1,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,se},ge=t=>{if(!t||!t.state)return le;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,ve(t)},be=(t,e)=>{let r;if(!t||!t.state)return le;const n=t.state;return e<0?(r=0,e=-e):(r=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?le:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=r,n.wbits=e,ge(t))},we=(t,e)=>{if(!t)return le;const r=new me;t.state=r,r.window=null;const n=be(t,e);return n!==se&&(t.state=null),n};let _e,ke,xe=!0;const Ae=t=>{if(xe){_e=new Int32Array(512),ke=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(ne(1,t.lens,0,288,_e,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;ne(2,t.lens,0,32,ke,0,t.work,{bits:5}),xe=!1}t.lencode=_e,t.lenbits=9,t.distcode=ke,t.distbits=5},Ie=(t,e,r,n)=>{let i;const o=t.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new Uint8Array(o.wsize)),n>=o.wsize?(o.window.set(e.subarray(r-o.wsize,r),0),o.wnext=0,o.whave=o.wsize):(i=o.wsize-o.wnext,i>n&&(i=n),o.window.set(e.subarray(r-n,r-n+i),o.wnext),(n-=i)?(o.window.set(e.subarray(r-n,r),0),o.wnext=n,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i))),0};var Ee={inflateReset:ge,inflateReset2:be,inflateResetKeep:ve,inflateInit:t=>we(t,15),inflateInit2:we,inflate:(t,e)=>{let r,n,i,o,a,s,u,c,l,h,f,d,p,y,m,v,g,b,w,_,k,x,A=0;const I=new Uint8Array(4);let E,S;const M=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return le;r=t.state,12===r.mode&&(r.mode=13),a=t.next_out,i=t.output,u=t.avail_out,o=t.next_in,n=t.input,s=t.avail_in,c=r.hold,l=r.bits,h=s,f=u,x=se;t:for(;;)switch(r.mode){case 1:if(0===r.wrap){r.mode=13;break}for(;l<16;){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}if(2&r.wrap&&35615===c){r.check=0,I[0]=255&c,I[1]=c>>>8&255,r.check=D(r.check,I,2,0),c=0,l=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&c)<<8)+(c>>8))%31){t.msg="incorrect header check",r.mode=30;break}if((15&c)!==pe){t.msg="unknown compression method",r.mode=30;break}if(c>>>=4,l-=4,k=8+(15&c),0===r.wbits)r.wbits=k;else if(k>r.wbits){t.msg="invalid window size",r.mode=30;break}r.dmax=1<<r.wbits,t.adler=r.check=1,r.mode=512&c?10:12,c=0,l=0;break;case 2:for(;l<16;){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}if(r.flags=c,(255&r.flags)!==pe){t.msg="unknown compression method",r.mode=30;break}if(57344&r.flags){t.msg="unknown header flags set",r.mode=30;break}r.head&&(r.head.text=c>>8&1),512&r.flags&&(I[0]=255&c,I[1]=c>>>8&255,r.check=D(r.check,I,2,0)),c=0,l=0,r.mode=3;case 3:for(;l<32;){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}r.head&&(r.head.time=c),512&r.flags&&(I[0]=255&c,I[1]=c>>>8&255,I[2]=c>>>16&255,I[3]=c>>>24&255,r.check=D(r.check,I,4,0)),c=0,l=0,r.mode=4;case 4:for(;l<16;){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}r.head&&(r.head.xflags=255&c,r.head.os=c>>8),512&r.flags&&(I[0]=255&c,I[1]=c>>>8&255,r.check=D(r.check,I,2,0)),c=0,l=0,r.mode=5;case 5:if(1024&r.flags){for(;l<16;){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}r.length=c,r.head&&(r.head.extra_len=c),512&r.flags&&(I[0]=255&c,I[1]=c>>>8&255,r.check=D(r.check,I,2,0)),c=0,l=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&(d=r.length,d>s&&(d=s),d&&(r.head&&(k=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(n.subarray(o,o+d),k)),512&r.flags&&(r.check=D(r.check,n,d,o)),s-=d,o+=d,r.length-=d),r.length))break t;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===s)break t;d=0;do{k=n[o+d++],r.head&&k&&r.length<65536&&(r.head.name+=String.fromCharCode(k))}while(k&&d<s);if(512&r.flags&&(r.check=D(r.check,n,d,o)),s-=d,o+=d,k)break t}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&r.flags){if(0===s)break t;d=0;do{k=n[o+d++],r.head&&k&&r.length<65536&&(r.head.comment+=String.fromCharCode(k))}while(k&&d<s);if(512&r.flags&&(r.check=D(r.check,n,d,o)),s-=d,o+=d,k)break t}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&r.flags){for(;l<16;){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}if(c!==(65535&r.check)){t.msg="header crc mismatch",r.mode=30;break}c=0,l=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=12;break;case 10:for(;l<32;){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}t.adler=r.check=ye(c),c=0,l=0,r.mode=11;case 11:if(0===r.havedict)return t.next_out=a,t.avail_out=u,t.next_in=o,t.avail_in=s,r.hold=c,r.bits=l,ce;t.adler=r.check=1,r.mode=12;case 12:if(e===oe||e===ae)break t;case 13:if(r.last){c>>>=7&l,l-=7&l,r.mode=27;break}for(;l<3;){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}switch(r.last=1&c,c>>>=1,l-=1,3&c){case 0:r.mode=14;break;case 1:if(Ae(r),r.mode=20,e===ae){c>>>=2,l-=2;break t}break;case 2:r.mode=17;break;case 3:t.msg="invalid block type",r.mode=30}c>>>=2,l-=2;break;case 14:for(c>>>=7&l,l-=7&l;l<32;){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}if((65535&c)!=(c>>>16^65535)){t.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&c,c=0,l=0,r.mode=15,e===ae)break t;case 15:r.mode=16;case 16:if(d=r.length,d){if(d>s&&(d=s),d>u&&(d=u),0===d)break t;i.set(n.subarray(o,o+d),a),s-=d,o+=d,u-=d,a+=d,r.length-=d;break}r.mode=12;break;case 17:for(;l<14;){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}if(r.nlen=257+(31&c),c>>>=5,l-=5,r.ndist=1+(31&c),c>>>=5,l-=5,r.ncode=4+(15&c),c>>>=4,l-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=30;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;l<3;){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}r.lens[M[r.have++]]=7&c,c>>>=3,l-=3}for(;r.have<19;)r.lens[M[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,E={bits:r.lenbits},x=ne(0,r.lens,0,19,r.lencode,0,r.work,E),r.lenbits=E.bits,x){t.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;A=r.lencode[c&(1<<r.lenbits)-1],m=A>>>24,v=A>>>16&255,g=65535&A,!(m<=l);){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}if(g<16)c>>>=m,l-=m,r.lens[r.have++]=g;else{if(16===g){for(S=m+2;l<S;){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}if(c>>>=m,l-=m,0===r.have){t.msg="invalid bit length repeat",r.mode=30;break}k=r.lens[r.have-1],d=3+(3&c),c>>>=2,l-=2}else if(17===g){for(S=m+3;l<S;){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}c>>>=m,l-=m,k=0,d=3+(7&c),c>>>=3,l-=3}else{for(S=m+7;l<S;){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}c>>>=m,l-=m,k=0,d=11+(127&c),c>>>=7,l-=7}if(r.have+d>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=30;break}for(;d--;)r.lens[r.have++]=k}}if(30===r.mode)break;if(0===r.lens[256]){t.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,E={bits:r.lenbits},x=ne(1,r.lens,0,r.nlen,r.lencode,0,r.work,E),r.lenbits=E.bits,x){t.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,E={bits:r.distbits},x=ne(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,E),r.distbits=E.bits,x){t.msg="invalid distances set",r.mode=30;break}if(r.mode=20,e===ae)break t;case 20:r.mode=21;case 21:if(s>=6&&u>=258){t.next_out=a,t.avail_out=u,t.next_in=o,t.avail_in=s,r.hold=c,r.bits=l,$t(t,f),a=t.next_out,i=t.output,u=t.avail_out,o=t.next_in,n=t.input,s=t.avail_in,c=r.hold,l=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;A=r.lencode[c&(1<<r.lenbits)-1],m=A>>>24,v=A>>>16&255,g=65535&A,!(m<=l);){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}if(v&&0==(240&v)){for(b=m,w=v,_=g;A=r.lencode[_+((c&(1<<b+w)-1)>>b)],m=A>>>24,v=A>>>16&255,g=65535&A,!(b+m<=l);){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}c>>>=b,l-=b,r.back+=b}if(c>>>=m,l-=m,r.back+=m,r.length=g,0===v){r.mode=26;break}if(32&v){r.back=-1,r.mode=12;break}if(64&v){t.msg="invalid literal/length code",r.mode=30;break}r.extra=15&v,r.mode=22;case 22:if(r.extra){for(S=r.extra;l<S;){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}r.length+=c&(1<<r.extra)-1,c>>>=r.extra,l-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;A=r.distcode[c&(1<<r.distbits)-1],m=A>>>24,v=A>>>16&255,g=65535&A,!(m<=l);){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}if(0==(240&v)){for(b=m,w=v,_=g;A=r.distcode[_+((c&(1<<b+w)-1)>>b)],m=A>>>24,v=A>>>16&255,g=65535&A,!(b+m<=l);){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}c>>>=b,l-=b,r.back+=b}if(c>>>=m,l-=m,r.back+=m,64&v){t.msg="invalid distance code",r.mode=30;break}r.offset=g,r.extra=15&v,r.mode=24;case 24:if(r.extra){for(S=r.extra;l<S;){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}r.offset+=c&(1<<r.extra)-1,c>>>=r.extra,l-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===u)break t;if(d=f-u,r.offset>d){if(d=r.offset-d,d>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=30;break}d>r.wnext?(d-=r.wnext,p=r.wsize-d):p=r.wnext-d,d>r.length&&(d=r.length),y=r.window}else y=i,p=a-r.offset,d=r.length;d>u&&(d=u),u-=d,r.length-=d;do{i[a++]=y[p++]}while(--d);0===r.length&&(r.mode=21);break;case 26:if(0===u)break t;i[a++]=r.length,u--,r.mode=21;break;case 27:if(r.wrap){for(;l<32;){if(0===s)break t;s--,c|=n[o++]<<l,l+=8}if(f-=u,t.total_out+=f,r.total+=f,f&&(t.adler=r.check=r.flags?D(r.check,i,f,a-f):L(r.check,i,f,a-f)),f=u,(r.flags?c:ye(c))!==r.check){t.msg="incorrect data check",r.mode=30;break}c=0,l=0}r.mode=28;case 28:if(r.wrap&&r.flags){for(;l<32;){if(0===s)break t;s--,c+=n[o++]<<l,l+=8}if(c!==(4294967295&r.total)){t.msg="incorrect length check",r.mode=30;break}c=0,l=0}r.mode=29;case 29:x=ue;break t;case 30:x=he;break t;case 31:return fe;case 32:default:return le}return t.next_out=a,t.avail_out=u,t.next_in=o,t.avail_in=s,r.hold=c,r.bits=l,(r.wsize||f!==t.avail_out&&r.mode<30&&(r.mode<27||e!==ie))&&Ie(t,t.output,t.next_out,f-t.avail_out),h-=t.avail_in,f-=t.avail_out,t.total_in+=h,t.total_out+=f,r.total+=f,r.wrap&&f&&(t.adler=r.check=r.flags?D(r.check,i,f,t.next_out-f):L(r.check,i,f,t.next_out-f)),t.data_type=r.bits+(r.last?64:0)+(12===r.mode?128:0)+(20===r.mode||15===r.mode?256:0),(0===h&&0===f||e===ie)&&x===se&&(x=de),x},inflateEnd:t=>{if(!t||!t.state)return le;let e=t.state;return e.window&&(e.window=null),t.state=null,se},inflateGetHeader:(t,e)=>{if(!t||!t.state)return le;const r=t.state;return 0==(2&r.wrap)?le:(r.head=e,e.done=!1,se)},inflateSetDictionary:(t,e)=>{const r=e.length;let n,i,o;return t&&t.state?(n=t.state,0!==n.wrap&&11!==n.mode?le:11===n.mode&&(i=1,i=L(i,e,r,0),i!==n.check)?he:(o=Ie(t,e,r,r),o?(n.mode=31,fe):(n.havedict=1,se))):le},inflateInfo:"pako inflate (from Nodeca project)"};var Se=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const Me=Object.prototype.toString,{Z_NO_FLUSH:Te,Z_FINISH:Pe,Z_OK:Ce,Z_STREAM_END:Oe,Z_NEED_DICT:Re,Z_STREAM_ERROR:je,Z_DATA_ERROR:Ne,Z_MEM_ERROR:Le}=z;function Ue(t){this.options=Ct({chunkSize:65536,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Dt,this.strm.avail_out=0;let r=Ee.inflateInit2(this.strm,e.windowBits);if(r!==Ce)throw new Error(B[r]);if(this.header=new Se,Ee.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=Nt(e.dictionary):"[object ArrayBuffer]"===Me.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(r=Ee.inflateSetDictionary(this.strm,e.dictionary),r!==Ce)))throw new Error(B[r])}function De(t,e){const r=new Ue(e);if(r.push(t),r.err)throw r.msg||B[r.err];return r.result}Ue.prototype.push=function(t,e){const r=this.strm,n=this.options.chunkSize,i=this.options.dictionary;let o,a,s;if(this.ended)return!1;for(a=e===~~e?e:!0===e?Pe:Te,"[object ArrayBuffer]"===Me.call(t)?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;;){for(0===r.avail_out&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),o=Ee.inflate(r,a),o===Re&&i&&(o=Ee.inflateSetDictionary(r,i),o===Ce?o=Ee.inflate(r,a):o===Ne&&(o=Re));r.avail_in>0&&o===Oe&&r.state.wrap>0&&0!==t[r.next_in];)Ee.inflateReset(r),o=Ee.inflate(r,a);switch(o){case je:case Ne:case Re:case Le:return this.onEnd(o),this.ended=!0,!1}if(s=r.avail_out,r.next_out&&(0===r.avail_out||o===Oe))if("string"===this.options.to){let t=Ut(r.output,r.next_out),e=r.next_out-t,i=Lt(r.output,t);r.next_out=e,r.avail_out=n-e,e&&r.output.set(r.output.subarray(t,t+e),0),this.onData(i)}else this.onData(r.output.length===r.next_out?r.output:r.output.subarray(0,r.next_out));if(o!==Ce||0!==s){if(o===Oe)return o=Ee.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(0===r.avail_in)break}}return!0},Ue.prototype.onData=function(t){this.chunks.push(t)},Ue.prototype.onEnd=function(t){t===Ce&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Ot(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var Be={Inflate:Ue,inflate:De,inflateRaw:function(t,e){return(e=e||{}).raw=!0,De(t,e)},ungzip:De,constants:z};const{Deflate:ze,deflate:He,deflateRaw:Fe,gzip:qe}=Yt,{Inflate:Ge,inflate:Ve,inflateRaw:Ke,ungzip:Ze}=Be;var We=ze,Je=He,Qe=Fe,Ye=qe,$e=Ge,Xe=Ve,tr=Ke,er=Ze,rr=z,nr={Deflate:ze,deflate:He,deflateRaw:Fe,gzip:qe,Inflate:Ge,inflate:Ve,inflateRaw:Ke,ungzip:Ze,constants:z}},function(t,e,r){(function(r){var n,i,o,a;function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}a=function(){return function t(e,r,n){function i(a,s){if(!r[a]){if(!e[a]){var u=!1;if(!s&&u)return(void 0)(a,!0);if(o)return o(a,!0);throw(u=new Error("Cannot find module '"+a+"'")).code="MODULE_NOT_FOUND",u}u=r[a]={exports:{}},e[a][0].call(u.exports,(function(t){return i(e[a][1][t]||t)}),u,u.exports,t,e,r,n)}return r[a].exports}for(var o=!1,a=0;a<n.length;a++)i(n[a]);return i}({1:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.version="4.0.49"},{}],2:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./utils/properties");function i(){n.setType(this,"Signer")}i.isSigner=function(t){return n.isType(t,"Signer")},t=i,r.Signer=t},{"./utils/properties":74}],3:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./utils/bignumber");r.AddressZero="0x0000000000000000000000000000000000000000",r.HashZero="0x0000000000000000000000000000000000000000000000000000000000000000",r.EtherSymbol="Ξ",t=n.bigNumberify(-1),r.NegativeOne=t,t=n.bigNumberify(0),r.Zero=t,t=n.bigNumberify(1),r.One=t,t=n.bigNumberify(2),r.Two=t,t=n.bigNumberify("1000000000000000000"),r.WeiPerEther=t,n=n.bigNumberify("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),r.MaxUint256=n},{"./utils/bignumber":63}],4:[function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var a,u=t("./constants"),c=o(t("./errors")),l=t("./utils/abi-coder"),h=t("./utils/address"),f=t("./utils/bignumber"),d=t("./utils/bytes"),p=t("./utils/interface"),y=t("./utils/properties"),m=t("./providers/abstract-provider"),v=t("./abstract-signer"),g=(i(b,a=v.Signer),b.prototype.getAddress=function(){return Promise.resolve(this.address)},b.prototype._fail=function(t,e){return Promise.resolve().then((function(){c.throwError(t,c.UNSUPPORTED_OPERATION,{operation:e})}))},b.prototype.signMessage=function(t){return this._fail("VoidSigner cannot sign messages","signMessage")},b.prototype.sendTransaction=function(t){return this._fail("VoidSigner cannot sign transactions","sendTransaction")},b.prototype.connect=function(t){return new b(this.address,t)},b);function b(t,e){var r=a.call(this)||this;return y.defineReadOnly(r,"address",t),y.defineReadOnly(r,"provider",e),r}r.VoidSigner=g;var w={chainId:!0,data:!0,from:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0};function _(t,e,r){var n=t.interface.functions[e];return function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];var o={},a=null;if(e.length===n.inputs.length+1&&"object"==s(e[e.length-1]))for(var h in null!=(o=y.shallowCopy(e.pop())).blockTag&&(a=o.blockTag),delete o.blockTag,o)if(!w[h])throw new Error("unknown transaction override "+h);if(e.length!=n.inputs.length)throw new Error("incorrect number of arguments");return["data","to"].forEach((function(t){null!=o[t]&&c.throwError("cannot override "+t,c.UNSUPPORTED_OPERATION,{operation:t})})),o.to=t._deployed(a).then((function(){return t.addressPromise})),function t(e,r,n){if(Array.isArray(n)){var i=[];return n.forEach((function(n,o){var a=Array.isArray(r)?r[o]:r[n.name];i.push(t(e,a,n))})),Promise.all(i)}if("address"===n.type)return e.resolveName(r);if("tuple"===n.type)return t(e,r,n.components);var o=n.type.match(/(.*)(\[[0-9]*\]$)/);if(o){if(!Array.isArray(r))throw new Error("invalid value for array");var a=[],s={components:n.components,type:o[1]};return r.forEach((function(r){a.push(t(e,r,s))})),Promise.all(a)}return Promise.resolve(r)}(t.provider,e,n.inputs).then((function(e){if(o.data=n.encode(e),"call"===n.type)return r?Promise.resolve(u.Zero):(t.provider||c.throwError("call (constant functions) require a provider or a signer with a provider",c.UNSUPPORTED_OPERATION,{operation:"call"}),["gasLimit","gasPrice","value"].forEach((function(t){if(null!=o[t])throw new Error("call cannot override "+t)})),null==o.from&&t.signer&&(o.from=t.signer.getAddress()),t.provider.call(o,a).then((function(r){var i;d.hexDataLength(r)%32==4&&"0x08c379a0"===d.hexDataSlice(r,0,4)&&(i=l.defaultAbiCoder.decode(["string"],d.hexDataSlice(r,4)),c.throwError("call revert exception",c.CALL_EXCEPTION,{address:t.address,args:e,method:n.signature,errorSignature:"Error(string)",errorArgs:[i],reason:i,transaction:o}));try{var a=n.decode(r);return 1===n.outputs.length?a[0]:a}catch(i){throw"0x"===r&&0<n.outputs.length&&c.throwError("call exception",c.CALL_EXCEPTION,{address:t.address,method:n.signature,args:e}),i}})));if("transaction"===n.type)return r?(t.provider||c.throwError("estimate gas require a provider or a signer with a provider",c.UNSUPPORTED_OPERATION,{operation:"estimateGas"}),null==o.from&&t.signer&&(o.from=t.signer.getAddress()),t.provider.estimateGas(o)):(null==o.gasLimit&&null!=n.gas&&(o.gasLimit=f.bigNumberify(n.gas).add(21e3)),t.signer||c.throwError("sending a transaction requires a signer",c.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),null!=o.from&&c.throwError("cannot override from in a transaction",c.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),t.signer.sendTransaction(o).then((function(e){var r=e.wait.bind(e);return e.wait=function(e){return r(e).then((function(e){return e.events=e.logs.map((function(r){var n=y.deepCopy(r);return(r=t.interface.parseLog(r))&&(n.args=r.values,n.decode=r.decode,n.event=r.name,n.eventSignature=r.signature),n.removeListener=function(){return t.provider},n.getBlock=function(){return t.provider.getBlock(e.blockHash)},n.getTransaction=function(){return t.provider.getTransaction(e.transactionHash)},n.getTransactionReceipt=function(){return Promise.resolve(e)},n})),e}))},e})));throw new Error("invalid type - "+n.type)}))}}function k(t){return!t.address||null!=t.topics&&0!==t.topics.length?(t.address||"*")+"@"+(t.topics?t.topics.join(":"):""):"*"}var x=(A.prototype.deployed=function(){return this._deployed()},A.prototype._deployed=function(t){var e=this;return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then((function(){return e})):this._deployedPromise=this.provider.getCode(this.address,t).then((function(t){return"0x"===t&&c.throwError("contract not deployed",c.UNSUPPORTED_OPERATION,{contractAddress:e.address,operation:"getDeployed"}),e}))),this._deployedPromise},A.prototype.fallback=function(t){var e=this;this.signer||c.throwError("sending a transaction requires a signer",c.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});var r=y.shallowCopy(t||{});return["from","to"].forEach((function(t){null!=r[t]&&c.throwError("cannot override "+t,c.UNSUPPORTED_OPERATION,{operation:t})})),r.to=this.addressPromise,this.deployed().then((function(){return e.signer.sendTransaction(r)}))},A.prototype.connect=function(t){return"string"==typeof t&&(t=new g(t,this.provider)),t=new A(this.address,this.interface,t),this.deployTransaction&&y.defineReadOnly(t,"deployTransaction",this.deployTransaction),t},A.prototype.attach=function(t){return new A(t,this.interface,this.signer||this.provider)},A.isIndexed=function(t){return p.Interface.isIndexed(t)},A.prototype._getEventFilter=function(t){var e=this;if("string"==typeof t){if("*"===t)return{prepareEvent:function(t){var r=e.interface.parseLog(t);return r&&(t.args=r.values,t.decode=r.decode,t.event=r.name,t.eventSignature=r.signature),[t]},eventTag:"*",filter:{address:this.address}};-1!==t.indexOf("(")&&(t=l.formatSignature(l.parseSignature("event "+t)));var r=this.interface.events[t];r||c.throwError("unknown event - "+t,c.INVALID_ARGUMENT,{argumnet:"eventName",value:t});var n={address:this.address,topics:[r.topic]};return{prepareEvent:function(t){var e=r.decode(t.data,t.topics);return t.args=e,(e=Array.prototype.slice.call(e)).push(t),e},event:r,eventTag:k(n),filter:n}}n={address:this.address};var i=null;if(t.topics&&t.topics[0])for(var o in n.topics=t.topics,this.interface.events)if(-1!==o.indexOf("(")&&(o=this.interface.events[o]).topic===t.topics[0].toLowerCase()){i=o;break}return{prepareEvent:function(t){if(!i)return[t];var e=i.decode(t.data,t.topics);return t.args=e,(e=Array.prototype.slice.call(e)).push(t),e},event:i,eventTag:k(n),filter:n}},A.prototype._addEventListener=function(t,e,r){var n=this;function i(r){var i=y.deepCopy(r),o=t.prepareEvent(i);t.event&&(i.decode=t.event.decode,i.event=t.event.name,i.eventSignature=t.event.signature),i.removeListener=function(){n.removeListener(t.filter,e)},i.getBlock=function(){return n.provider.getBlock(r.blockHash)},i.getTransaction=function(){return n.provider.getTransaction(r.transactionHash)},i.getTransactionReceipt=function(){return n.provider.getTransactionReceipt(r.transactionHash)},n.emit.apply(n,[t.filter].concat(o))}this.provider||c.throwError("events require a provider or a signer with a provider",c.UNSUPPORTED_OPERATION,{operation:"once"}),this.provider.on(t.filter,i),this._events.push({eventFilter:t,listener:e,wrappedListener:i,once:r})},A.prototype.on=function(t,e){return this._addEventListener(this._getEventFilter(t),e,!1),this},A.prototype.once=function(t,e){return this._addEventListener(this._getEventFilter(t),e,!0),this},A.prototype.addListener=function(t,e){return this.on(t,e)},A.prototype.emit=function(t){for(var e=this,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];if(!this.provider)return!1;var i=!1,o=this._getEventFilter(t);return this._events=this._events.filter((function(t){return t.eventFilter.eventTag!==o.eventTag||(setTimeout((function(){t.listener.apply(e,r)}),0),i=!0,!t.once)})),i},A.prototype.listenerCount=function(t){if(!this.provider)return 0;var e=this._getEventFilter(t);return this._events.filter((function(t){return t.eventFilter.eventTag===e.eventTag})).length},A.prototype.listeners=function(t){if(!this.provider)return[];var e=this._getEventFilter(t);return this._events.filter((function(t){return t.eventFilter.eventTag===e.eventTag})).map((function(t){return t.listener}))},A.prototype.removeAllListeners=function(t){var e=this;if(!this.provider)return this;var r=this._getEventFilter(t);return this._events=this._events.filter((function(t){return t.eventFilter.eventTag!==r.eventTag||(e.provider.removeListener(t.eventFilter.filter,t.wrappedListener),!1)})),this},A.prototype.removeListener=function(t,e){var r=this;if(!this.provider)return this;var n=!1,i=this._getEventFilter(t);return this._events=this._events.filter((function(t){return t.eventFilter.eventTag!==i.eventTag||t.listener!==e||(r.provider.removeListener(t.eventFilter.filter,t.wrappedListener),!!n||!(n=!0))})),this},A);function A(t,e,r){var n=this;if(c.checkNew(this,A),p.Interface.isInterface(e)?y.defineReadOnly(this,"interface",e):y.defineReadOnly(this,"interface",new p.Interface(e)),v.Signer.isSigner(r)?(y.defineReadOnly(this,"provider",r.provider),y.defineReadOnly(this,"signer",r)):m.Provider.isProvider(r)?(y.defineReadOnly(this,"provider",r),y.defineReadOnly(this,"signer",null)):c.throwError("invalid signer or provider",c.INVALID_ARGUMENT,{arg:"signerOrProvider",value:r}),y.defineReadOnly(this,"estimate",{}),y.defineReadOnly(this,"functions",{}),y.defineReadOnly(this,"filters",{}),Object.keys(this.interface.events).forEach((function(t){var e=n.interface.events[t];y.defineReadOnly(n.filters,t,(function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return{address:n.address,topics:e.encodeTopics(t)}}))})),this._events=[],y.defineReadOnly(this,"address",t),this.provider)y.defineReadOnly(this,"addressPromise",this.provider.resolveName(t).then((function(t){if(null==t)throw new Error("name not found");return t})).catch((function(t){throw t})));else try{y.defineReadOnly(this,"addressPromise",Promise.resolve(h.getAddress(t)))}catch(e){c.throwError("provider is required to use non-address contract address",c.INVALID_ARGUMENT,{argument:"addressOrName",value:t})}Object.keys(this.interface.functions).forEach((function(t){var e=_(n,t,!1);null==n[t]?y.defineReadOnly(n,t,e):c.warn("WARNING: Multiple definitions for "+t),null==n.functions[t]&&(y.defineReadOnly(n.functions,t,e),y.defineReadOnly(n.estimate,t,_(n,t,!0)))}))}function I(t,e,r){var n=null;"string"==typeof e?n=e:d.isArrayish(e)?n=d.hexlify(e):"string"==typeof e.object?n=e.object:c.throwError("bytecode must be a valid hex string",c.INVALID_ARGUMENT,{arg:"bytecode",value:e}),"0x"!==n.substring(0,2)&&(n="0x"+n),d.isHexString(n)||c.throwError("bytecode must be a valid hex string",c.INVALID_ARGUMENT,{arg:"bytecode",value:e}),n.length%2!=0&&c.throwError("bytecode must be valid data (even length)",c.INVALID_ARGUMENT,{arg:"bytecode",value:e}),y.defineReadOnly(this,"bytecode",n),p.Interface.isInterface(t)?y.defineReadOnly(this,"interface",t):y.defineReadOnly(this,"interface",new p.Interface(t)),r&&!v.Signer.isSigner(r)&&c.throwError("invalid signer",c.INVALID_ARGUMENT,{arg:"signer",value:null}),y.defineReadOnly(this,"signer",r||null)}r.Contract=x,I.prototype.getDeployTransaction=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r={};if(t.length===this.interface.deployFunction.inputs.length+1)for(var n in r=y.shallowCopy(t.pop()))if(!w[n])throw new Error("unknown transaction override "+n);return["data","from","to"].forEach((function(t){null!=r[t]&&c.throwError("cannot override "+t,c.UNSUPPORTED_OPERATION,{operation:t})})),c.checkArgumentCount(t.length,this.interface.deployFunction.inputs.length," in Contract constructor"),r.data=this.interface.deployFunction.encode(this.bytecode,t),r},I.prototype.deploy=function(){for(var t=this,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=this.getDeployTransaction.apply(this,e);return this.signer.sendTransaction(n).then((function(e){var r=new x(h.getContractAddress(e),t.interface,t.signer);return y.defineReadOnly(r,"deployTransaction",e),r}))},I.prototype.attach=function(t){return new x(t,this.interface,this.signer)},I.prototype.connect=function(t){return new I(this.interface,this.bytecode,t)},I.fromSolidity=function(t,e){null==t&&c.throwError("missing compiler output",c.MISSING_ARGUMENT,{argument:"compilerOutput"});var r=(t="string"==typeof t?JSON.parse(t):t).abi,n=null;return t.bytecode?n=t.bytecode:t.evm&&t.evm.bytecode&&(n=t.evm.bytecode),new I(r,n,e)},i=I,r.ContractFactory=i},{"./abstract-signer":2,"./constants":3,"./errors":5,"./providers/abstract-provider":50,"./utils/abi-coder":59,"./utils/address":60,"./utils/bignumber":63,"./utils/bytes":64,"./utils/interface":69,"./utils/properties":74}],5:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./_version");r.UNKNOWN_ERROR="UNKNOWN_ERROR",r.NOT_IMPLEMENTED="NOT_IMPLEMENTED",r.MISSING_NEW="MISSING_NEW",r.CALL_EXCEPTION="CALL_EXCEPTION",r.INVALID_ARGUMENT="INVALID_ARGUMENT",r.MISSING_ARGUMENT="MISSING_ARGUMENT",r.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",r.NUMERIC_FAULT="NUMERIC_FAULT",r.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",r.NONCE_EXPIRED="NONCE_EXPIRED",r.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED";var i=!(r.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION"),o=!1;function a(t,e,i){if(o)throw new Error("unknown error");e=e||r.UNKNOWN_ERROR,i=i||{};var a=[];Object.keys(i).forEach((function(t){try{a.push(t+"="+JSON.stringify(i[t]))}catch(e){a.push(t+"="+JSON.stringify(i[t].toString()))}})),a.push("version="+n.version);var s=t;a.length&&(t+=" ("+a.join(", ")+")");var u=new Error(t);throw u.reason=s,u.code=e,Object.keys(i).forEach((function(t){u[t]=i[t]})),u}r.throwError=a,r.checkNew=function(t,e){t instanceof e||a("missing new",r.MISSING_NEW,{name:e.name})},r.checkArgumentCount=function(t,e,n){n=n||"",t<e&&a("missing argument"+n,r.MISSING_ARGUMENT,{count:t,expectedCount:e}),e<t&&a("too many arguments"+n,r.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})},r.setCensorship=function(t,e){i&&a("error censorship permanent",r.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),o=!!t,i=!!e},r.checkNormalize=function(){try{if(["NFD","NFC","NFKD","NFKC"].forEach((function(t){try{"test".normalize(t)}catch(e){throw new Error("missing "+t)}})),String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){a("platform missing String.prototype.normalize",r.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:t.message})}};var s={debug:1,default:2,info:2,warn:3,error:4,off:5},u=s.default;function c(t,e){u>s[t]||console.log.apply(console,e)}function l(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];c("warn",t)}r.setLogLevel=function(t){var e=s[t];null!=e?u=e:l("invliad log level - "+t)},r.warn=l,r.info=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];c("info",t)}},{"./_version":1}],6:[function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var i=t("./contract");r.Contract=i.Contract,r.ContractFactory=i.ContractFactory,r.VoidSigner=i.VoidSigner,i=t("./abstract-signer"),r.Signer=i.Signer,i=t("./wallet"),r.Wallet=i.Wallet,i=n(t("./constants")),r.constants=i;var o=n(t("./errors"));r.errors=o;var a=n(t("./providers"));r.providers=a;var s=n(t("./utils"));r.utils=s,n=n(t("./wordlists")),r.wordlists=n,n=t("./utils/shims"),r.platform=n.platform,t=t("./_version"),r.version=t.version,r.getDefaultProvider=function(t){var e=s.getNetwork(t=null==t?"homestead":t);return e&&e._defaultProvider||o.throwError("unsupported getDefaultProvider network",o.UNSUPPORTED_OPERATION,{operation:"getDefaultProvider",network:t}),e._defaultProvider(a)}},{"./_version":1,"./abstract-signer":2,"./constants":3,"./contract":4,"./errors":5,"./providers":54,"./utils":68,"./utils/shims":80,"./wallet":88,"./wordlists":89}],7:[function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0}),n=n(t("./ethers")),r.ethers=n,function(t){for(var e in t)r.hasOwnProperty(e)||(r[e]=t[e])}(t("./ethers"))},{"./ethers":6}],8:[function(t,e,r){"use strict";!function(t){function n(t){return parseInt(t)===t}function i(t){if(n(t.length)){for(var e=0;e<t.length;e++)if(!n(t[e])||t[e]<0||255<t[e])return;return 1}}function o(t,e){if(t.buffer&&ArrayBuffer.isView(t)&&"Uint8Array"===t.name)return e?t.slice?t.slice():Array.prototype.slice.call(t):t;if(Array.isArray(t)){if(!i(t))throw new Error("Array contains invalid value: "+t);return new Uint8Array(t)}if(n(t.length)&&i(t))return new Uint8Array(t);throw new Error("unsupported array-like object")}function a(t){return new Uint8Array(t)}function s(t,e,r,n,i){null==n&&null==i||(t=t.slice?t.slice(n,i):Array.prototype.slice.call(t,n,i)),e.set(t,r)}var u,c={toBytes:function(t){var e=[],r=0;for(t=encodeURI(t);r<t.length;){var n=t.charCodeAt(r++);37===n?(e.push(parseInt(t.substr(r,2),16)),r+=2):e.push(n)}return o(e)},fromBytes:function(t){for(var e=[],r=0;r<t.length;){var n=t[r];n<128?(e.push(String.fromCharCode(n)),r++):191<n&&n<224?(e.push(String.fromCharCode((31&n)<<6|63&t[r+1])),r+=2):(e.push(String.fromCharCode((15&n)<<12|(63&t[r+1])<<6|63&t[r+2])),r+=3)}return e.join("")}},l=(u="0123456789abcdef",{toBytes:function(t){for(var e=[],r=0;r<t.length;r+=2)e.push(parseInt(t.substr(r,2),16));return e},fromBytes:function(t){for(var e=[],r=0;r<t.length;r++){var n=t[r];e.push(u[(240&n)>>4]+u[15&n])}return e.join("")}}),h={16:10,24:12,32:14},f=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],d=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],p=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],y=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],m=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],v=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],g=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],b=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],w=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],_=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],k=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],x=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],A=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],I=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],E=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function S(t){for(var e=[],r=0;r<t.length;r+=4)e.push(t[r]<<24|t[r+1]<<16|t[r+2]<<8|t[r+3]);return e}var M=function t(e){if(!(this instanceof t))throw Error("AES must be instanitated with `new`");Object.defineProperty(this,"key",{value:o(e,!0)}),this._prepare()};M.prototype._prepare=function(){var t=h[this.key.length];if(null==t)throw new Error("invalid key size (must be 16, 24 or 32 bytes)");this._Ke=[],this._Kd=[];for(var e=0;e<=t;e++)this._Ke.push([0,0,0,0]),this._Kd.push([0,0,0,0]);var r,n=4*(t+1),i=this.key.length/4,o=S(this.key);for(e=0;e<i;e++)this._Ke[r=e>>2][e%4]=o[e],this._Kd[t-r][e%4]=o[e];for(var a,s=0,u=i;u<n;){if(a=o[i-1],o[0]^=d[a>>16&255]<<24^d[a>>8&255]<<16^d[255&a]<<8^d[a>>24&255]^f[s]<<24,s+=1,8!=i)for(e=1;e<i;e++)o[e]^=o[e-1];else{for(e=1;e<i/2;e++)o[e]^=o[e-1];for(a=o[i/2-1],o[i/2]^=d[255&a]^d[a>>8&255]<<8^d[a>>16&255]<<16^d[a>>24&255]<<24,e=i/2+1;e<i;e++)o[e]^=o[e-1]}for(e=0;e<i&&u<n;)this._Ke[c=u>>2][l=u%4]=o[e],this._Kd[t-c][l]=o[e++],u++}for(var c=1;c<t;c++)for(var l=0;l<4;l++)a=this._Kd[c][l],this._Kd[c][l]=x[a>>24&255]^A[a>>16&255]^I[a>>8&255]^E[255&a]},M.prototype.encrypt=function(t){if(16!=t.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var e=this._Ke.length-1,r=[0,0,0,0],n=S(t),i=0;i<4;i++)n[i]^=this._Ke[0][i];for(var o=1;o<e;o++){for(i=0;i<4;i++)r[i]=y[n[i]>>24&255]^m[n[(i+1)%4]>>16&255]^v[n[(i+2)%4]>>8&255]^g[255&n[(i+3)%4]]^this._Ke[o][i];n=r.slice()}var s,u=a(16);for(i=0;i<4;i++)s=this._Ke[e][i],u[4*i]=255&(d[n[i]>>24&255]^s>>24),u[4*i+1]=255&(d[n[(i+1)%4]>>16&255]^s>>16),u[4*i+2]=255&(d[n[(i+2)%4]>>8&255]^s>>8),u[4*i+3]=255&(d[255&n[(i+3)%4]]^s);return u},M.prototype.decrypt=function(t){if(16!=t.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var e=this._Kd.length-1,r=[0,0,0,0],n=S(t),i=0;i<4;i++)n[i]^=this._Kd[0][i];for(var o=1;o<e;o++){for(i=0;i<4;i++)r[i]=b[n[i]>>24&255]^w[n[(i+3)%4]>>16&255]^_[n[(i+2)%4]>>8&255]^k[255&n[(i+1)%4]]^this._Kd[o][i];n=r.slice()}var s,u=a(16);for(i=0;i<4;i++)s=this._Kd[e][i],u[4*i]=255&(p[n[i]>>24&255]^s>>24),u[4*i+1]=255&(p[n[(i+3)%4]>>16&255]^s>>16),u[4*i+2]=255&(p[n[(i+2)%4]>>8&255]^s>>8),u[4*i+3]=255&(p[255&n[(i+1)%4]]^s);return u};var T=function t(e){if(!(this instanceof t))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new M(e)};T.prototype.encrypt=function(t){if((t=o(t)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var e=a(t.length),r=a(16),n=0;n<t.length;n+=16)s(t,r,0,n,n+16),s(r=this._aes.encrypt(r),e,n);return e},T.prototype.decrypt=function(t){if((t=o(t)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var e=a(t.length),r=a(16),n=0;n<t.length;n+=16)s(t,r,0,n,n+16),s(r=this._aes.decrypt(r),e,n);return e};var P=function t(e,r){if(!(this instanceof t))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Block Chaining",this.name="cbc",r){if(16!=r.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else r=a(16);this._lastCipherblock=o(r,!0),this._aes=new M(e)};P.prototype.encrypt=function(t){if((t=o(t)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var e=a(t.length),r=a(16),n=0;n<t.length;n+=16){s(t,r,0,n,n+16);for(var i=0;i<16;i++)r[i]^=this._lastCipherblock[i];this._lastCipherblock=this._aes.encrypt(r),s(this._lastCipherblock,e,n)}return e},P.prototype.decrypt=function(t){if((t=o(t)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var e=a(t.length),r=a(16),n=0;n<t.length;n+=16){s(t,r,0,n,n+16),r=this._aes.decrypt(r);for(var i=0;i<16;i++)e[n+i]=r[i]^this._lastCipherblock[i];s(t,this._lastCipherblock,0,n,n+16)}return e};var C=function t(e,r,n){if(!(this instanceof t))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Feedback",this.name="cfb",r){if(16!=r.length)throw new Error("invalid initialation vector size (must be 16 size)")}else r=a(16);this.segmentSize=n=n||1,this._shiftRegister=o(r,!0),this._aes=new M(e)};C.prototype.encrypt=function(t){if(t.length%this.segmentSize!=0)throw new Error("invalid plaintext size (must be segmentSize bytes)");for(var e=o(t,!0),r=0;r<e.length;r+=this.segmentSize){for(var n=this._aes.encrypt(this._shiftRegister),i=0;i<this.segmentSize;i++)e[r+i]^=n[i];s(this._shiftRegister,this._shiftRegister,0,this.segmentSize),s(e,this._shiftRegister,16-this.segmentSize,r,r+this.segmentSize)}return e},C.prototype.decrypt=function(t){if(t.length%this.segmentSize!=0)throw new Error("invalid ciphertext size (must be segmentSize bytes)");for(var e=o(t,!0),r=0;r<e.length;r+=this.segmentSize){for(var n=this._aes.encrypt(this._shiftRegister),i=0;i<this.segmentSize;i++)e[r+i]^=n[i];s(this._shiftRegister,this._shiftRegister,0,this.segmentSize),s(t,this._shiftRegister,16-this.segmentSize,r,r+this.segmentSize)}return e};var O=function t(e,r){if(!(this instanceof t))throw Error("AES must be instanitated with `new`");if(this.description="Output Feedback",this.name="ofb",r){if(16!=r.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else r=a(16);this._lastPrecipher=o(r,!0),this._lastPrecipherIndex=16,this._aes=new M(e)};O.prototype.encrypt=function(t){for(var e=o(t,!0),r=0;r<e.length;r++)16===this._lastPrecipherIndex&&(this._lastPrecipher=this._aes.encrypt(this._lastPrecipher),this._lastPrecipherIndex=0),e[r]^=this._lastPrecipher[this._lastPrecipherIndex++];return e},O.prototype.decrypt=O.prototype.encrypt;var R=function t(e){if(!(this instanceof t))throw Error("Counter must be instanitated with `new`");"number"==typeof(e=0===e||e?e:1)?(this._counter=a(16),this.setValue(e)):this.setBytes(e)};R.prototype.setValue=function(t){if("number"!=typeof t||parseInt(t)!=t)throw new Error("invalid counter value (must be an integer)");for(var e=15;0<=e;--e)this._counter[e]=t%256,t>>=8},R.prototype.setBytes=function(t){if(16!=(t=o(t,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=t},R.prototype.increment=function(){for(var t=15;0<=t;t--){if(255!==this._counter[t]){this._counter[t]++;break}this._counter[t]=0}};var j=function t(e,r){if(!(this instanceof t))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",r instanceof R||(r=new R(r)),this._counter=r,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new M(e)};j.prototype.encrypt=function(t){for(var e=o(t,!0),r=0;r<e.length;r++)16===this._remainingCounterIndex&&(this._remainingCounter=this._aes.encrypt(this._counter._counter),this._remainingCounterIndex=0,this._counter.increment()),e[r]^=this._remainingCounter[this._remainingCounterIndex++];return e},j.prototype.decrypt=j.prototype.encrypt,c={AES:M,Counter:R,ModeOfOperation:{ecb:T,cbc:P,cfb:C,ofb:O,ctr:j},utils:{hex:l,utf8:c},padding:{pkcs7:{pad:function(t){var e=16-(t=o(t,!0)).length%16,r=a(t.length+e);s(t,r);for(var n=t.length;n<r.length;n++)r[n]=e;return r},strip:function(t){if((t=o(t,!0)).length<16)throw new Error("PKCS#7 invalid length");var e=t[t.length-1];if(16<e)throw new Error("PKCS#7 padding byte out of range");for(var r=t.length-e,n=0;n<e;n++)if(t[r+n]!==e)throw new Error("PKCS#7 invalid padding byte");var i=a(r);return s(t,i,0,0,r),i}}},_arrayTest:{coerceArray:o,createArray:a,copyArray:s}},void 0!==r?e.exports=c:(t.aesjs&&(c._aesjs=t.aesjs),t.aesjs=c)}(this)},{}],9:[function(t,e,r){!function(e,r){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){function r(){}t.super_=e,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)!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var a;"object"==s(e)?e.exports=o:r.BN=o,(o.BN=o).wordSize=26;try{a=("undefined"!=typeof window&&void 0!==window.Buffer?window:t("buffer")).Buffer}catch(e){}function u(t,e){return 65<=(e=t.charCodeAt(e))&&e<=70?e-55:97<=e&&e<=102?e-87:e-48&15}function c(t,e,r){var n=u(t,r);return e<=r-1&&(n|=u(t,r-1)<<4),n}function l(t,e,r,n){for(var i=0,o=Math.min(t.length,r),a=e;a<o;a++){var s=t.charCodeAt(a)-48;i*=n,i+=49<=s?s-49+10:17<=s?s-17+10:s}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==s(t)&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return 0<t.cmp(e)?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"==s(t))return this._initArray(t,e,r);n((e="hex"===e?16:e)===(0|e)&&2<=e&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,r):(this._parseBase(t,e,i),"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):(n(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(n("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 i,o,a=0;a<this.length;a++)this.words[a]=0;var s=0;if("be"===r)for(a=t.length-1,i=0;0<=a;a-=3)o=t[a]|t[a-1]<<8|t[a-2]<<16,this.words[i]|=o<<s&67108863,this.words[i+1]=o>>>26-s&67108863,26<=(s+=24)&&(s-=26,i++);else if("le"===r)for(i=a=0;a<t.length;a+=3)o=t[a]|t[a+1]<<8|t[a+2]<<16,this.words[i]|=o<<s&67108863,this.words[i+1]=o>>>26-s&67108863,26<=(s+=24)&&(s-=26,i++);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 n=0;n<this.length;n++)this.words[n]=0;var i,o=0,a=0;if("be"===r)for(n=t.length-1;e<=n;n-=2)i=c(t,e,n)<<o,this.words[a]|=67108863&i,18<=o?(o-=18,this.words[a+=1]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=c(t,e,n)<<o,this.words[a]|=67108863&i,18<=o?(o-=18,this.words[a+=1]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0];for(var n=0,i=this.length=1;i<=67108863;i*=e)n++;i=i/e|0;for(var o=t.length-r,a=o%--n,s=Math.min(o,o-a)+r,u=0,c=r;c<s;c+=n)u=l(t,c,c+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!=a){var h=1;for(u=l(t,c,t.length,e),c=0;c<a;c++)h*=e;this.imuln(h),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}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(;1<this.length&&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 h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],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 p(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0,i=(n=(r.length=n)-1|0,(a=(0|t.words[0])*(0|e.words[0]))/67108864|0);r.words[0]=67108863&a;for(var o=1;o<n;o++){for(var a,s=i>>>26,u=67108863&i,c=Math.min(o,e.length-1),l=Math.max(0,o-t.length+1);l<=c;l++)s+=(a=(0|t.words[o-l|0])*(0|e.words[l])+u)/67108864|0,u=67108863&a;r.words[o]=0|u,i=0|s}return 0!==i?r.words[o]=0|i:r.length--,r.strip()}o.prototype.toString=function(t,e){if(e=0|e||1,16===(t=t||10)||"hex"===t){u="";for(var r=0,i=0,o=0;o<this.length;o++){var a=this.words[o],s=(16777215&(a<<r|i)).toString(16),u=0!=(i=a>>>24-r&16777215)||o!==this.length-1?h[6-s.length]+s+u:s+u;26<=(r+=2)&&(r-=26,o--)}for(0!==i&&(u=i.toString(16)+u);u.length%e!=0;)u="0"+u;return 0!==this.negative?"-"+u:u}if(t===(0|t)&&2<=t&&t<=36){var c=f[t],l=d[t];for(u="",(p=this.clone()).negative=0;!p.isZero();){var p,y=p.modn(l).toString(t);u=(p=p.idivn(l)).isZero()?y+u:h[c-y.length]+y+u}for(this.isZero()&&(u="0"+u);u.length%e!=0;)u="0"+u;return 0!==this.negative?"-"+u:u}n(!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]:2<this.length&&n(!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 n(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 i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(0<o,"Requested array length <= 0"),this.strip(),e="le"===e;var a,s,u=new t(o),c=this.clone();if(e){for(s=0;!c.isZero();s++)a=c.andln(255),c.iushrn(8),u[s]=a;for(;s<o;s++)u[s]=0}else{for(s=0;s<o-i;s++)u[s]=0;for(s=0;!c.isZero();s++)a=c.andln(255),c.iushrn(8),u[o-s-1]=a}return u},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t;return t=0,4096<=e&&(t+=13,e>>>=13),64<=e&&(t+=7,e>>>=7),8<=e&&(t+=4,e>>>=4),2<=e&&(t+=2,e>>>=2),t+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t;return t=0,0==(8191&e)&&(t+=13,e>>>=13),0==(127&e)&&(t+=7,e>>>=7),0==(15&e)&&(t+=4,e>>>=4),0==(3&e)&&(t+=2,e>>>=2),0==(1&e)&&t++,t},o.prototype.bitLength=function(){var t=this.words[this.length-1];return t=this._countBits(t),26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},o.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){for(var e=this.length>t.length?t:this,r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},o.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){for(var e,r=this.length>t.length?(e=this,t):(e=t,this),n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this.strip()},o.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&0<=t);var e=0|Math.ceil(t/26);t%=26,this._expand(e),0<t&&e--;for(var r=0;r<e;r++)this.words[r]=67108863&~this.words[r];return 0<t&&(this.words[r]=~this.words[r]&67108863>>26-t),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&0<=t);var r=t/26|0;return t%=26,this._expand(1+r),this.words[r]=e?this.words[r]|1<<t:this.words[r]&~(1<<t),this.strip()},o.prototype.iadd=function(t){var e,r;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();for(var n=this.length>t.length?(r=this,t):(r=t,this),i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;for(var i=0<n?(r=this,t):(r=t,this),o=0,a=0;a<i.length;a++)o=(e=(0|r.words[a])-(0|i.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<r.length;a++)o=(e=(0|r.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<r.length&&r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this.length=Math.max(this.length,a),r!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var y=function(t,e,r){var n,i,o=t.words,a=e.words,s=r.words,u=(G=0|o[0],8191&G),c=G>>>13,l=8191&(V=0|o[1]),h=V>>>13,f=8191&(K=0|o[2]),d=K>>>13,p=8191&(n=0|o[3]),y=n>>>13,m=8191&(Z=0|o[4]),v=Z>>>13,g=8191&(W=0|o[5]),b=W>>>13,w=8191&(i=0|o[6]),_=i>>>13,k=8191&(J=0|o[7]),x=J>>>13,A=8191&(Q=0|o[8]),I=Q>>>13,E=8191&(Y=0|o[9]),S=Y>>>13,M=8191&($=0|a[0]),T=$>>>13,P=0|a[1],C=8191&P,O=P>>>13,R=0|a[2],j=8191&R,N=R>>>13,L=8191&(X=0|a[3]),U=X>>>13,D=0|a[4],B=8191&D,z=D>>>13,H=0|a[5],F=8191&H,q=H>>>13,G=0|a[6],V=8191&G,K=G>>>13,Z=8191&(n=0|a[7]),W=n>>>13,J=8191&(i=0|a[8]),Q=i>>>13,Y=8191&(o=0|a[9]),$=o>>>13;r.negative=t.negative^e.negative,r.length=19;var X=(0+Math.imul(u,M)|0)+((8191&(R=(R=Math.imul(u,T))+Math.imul(c,M)|0))<<13)|0,tt=((D=Math.imul(c,T))+(R>>>13)|0)+(X>>>26)|0;return X&=67108863,P=Math.imul(l,M),R=(R=Math.imul(l,T))+Math.imul(h,M)|0,D=Math.imul(h,T),H=(tt+(P+Math.imul(u,C)|0)|0)+((8191&(R=(R=R+Math.imul(u,O)|0)+Math.imul(c,C)|0))<<13)|0,tt=((D=D+Math.imul(c,O)|0)+(R>>>13)|0)+(H>>>26)|0,H&=67108863,P=Math.imul(f,M),R=(R=Math.imul(f,T))+Math.imul(d,M)|0,D=Math.imul(d,T),P=P+Math.imul(l,C)|0,R=(R=R+Math.imul(l,O)|0)+Math.imul(h,C)|0,D=D+Math.imul(h,O)|0,G=(tt+(P+Math.imul(u,j)|0)|0)+((8191&(R=(R=R+Math.imul(u,N)|0)+Math.imul(c,j)|0))<<13)|0,tt=((D=D+Math.imul(c,N)|0)+(R>>>13)|0)+(G>>>26)|0,G&=67108863,P=Math.imul(p,M),R=(R=Math.imul(p,T))+Math.imul(y,M)|0,D=Math.imul(y,T),P=P+Math.imul(f,C)|0,R=(R=R+Math.imul(f,O)|0)+Math.imul(d,C)|0,D=D+Math.imul(d,O)|0,P=P+Math.imul(l,j)|0,R=(R=R+Math.imul(l,N)|0)+Math.imul(h,j)|0,D=D+Math.imul(h,N)|0,n=(tt+(P+Math.imul(u,L)|0)|0)+((8191&(R=(R=R+Math.imul(u,U)|0)+Math.imul(c,L)|0))<<13)|0,tt=((D=D+Math.imul(c,U)|0)+(R>>>13)|0)+(n>>>26)|0,n&=67108863,P=Math.imul(m,M),R=(R=Math.imul(m,T))+Math.imul(v,M)|0,D=Math.imul(v,T),P=P+Math.imul(p,C)|0,R=(R=R+Math.imul(p,O)|0)+Math.imul(y,C)|0,D=D+Math.imul(y,O)|0,P=P+Math.imul(f,j)|0,R=(R=R+Math.imul(f,N)|0)+Math.imul(d,j)|0,D=D+Math.imul(d,N)|0,P=P+Math.imul(l,L)|0,R=(R=R+Math.imul(l,U)|0)+Math.imul(h,L)|0,D=D+Math.imul(h,U)|0,i=(tt+(P+Math.imul(u,B)|0)|0)+((8191&(R=(R=R+Math.imul(u,z)|0)+Math.imul(c,B)|0))<<13)|0,tt=((D=D+Math.imul(c,z)|0)+(R>>>13)|0)+(i>>>26)|0,i&=67108863,P=Math.imul(g,M),R=(R=Math.imul(g,T))+Math.imul(b,M)|0,D=Math.imul(b,T),P=P+Math.imul(m,C)|0,R=(R=R+Math.imul(m,O)|0)+Math.imul(v,C)|0,D=D+Math.imul(v,O)|0,P=P+Math.imul(p,j)|0,R=(R=R+Math.imul(p,N)|0)+Math.imul(y,j)|0,D=D+Math.imul(y,N)|0,P=P+Math.imul(f,L)|0,R=(R=R+Math.imul(f,U)|0)+Math.imul(d,L)|0,D=D+Math.imul(d,U)|0,P=P+Math.imul(l,B)|0,R=(R=R+Math.imul(l,z)|0)+Math.imul(h,B)|0,D=D+Math.imul(h,z)|0,a=(tt+(P+Math.imul(u,F)|0)|0)+((8191&(R=(R=R+Math.imul(u,q)|0)+Math.imul(c,F)|0))<<13)|0,tt=((D=D+Math.imul(c,q)|0)+(R>>>13)|0)+(a>>>26)|0,a&=67108863,P=Math.imul(w,M),R=(R=Math.imul(w,T))+Math.imul(_,M)|0,D=Math.imul(_,T),P=P+Math.imul(g,C)|0,R=(R=R+Math.imul(g,O)|0)+Math.imul(b,C)|0,D=D+Math.imul(b,O)|0,P=P+Math.imul(m,j)|0,R=(R=R+Math.imul(m,N)|0)+Math.imul(v,j)|0,D=D+Math.imul(v,N)|0,P=P+Math.imul(p,L)|0,R=(R=R+Math.imul(p,U)|0)+Math.imul(y,L)|0,D=D+Math.imul(y,U)|0,P=P+Math.imul(f,B)|0,R=(R=R+Math.imul(f,z)|0)+Math.imul(d,B)|0,D=D+Math.imul(d,z)|0,P=P+Math.imul(l,F)|0,R=(R=R+Math.imul(l,q)|0)+Math.imul(h,F)|0,D=D+Math.imul(h,q)|0,o=(tt+(P+Math.imul(u,V)|0)|0)+((8191&(R=(R=R+Math.imul(u,K)|0)+Math.imul(c,V)|0))<<13)|0,tt=((D=D+Math.imul(c,K)|0)+(R>>>13)|0)+(o>>>26)|0,o&=67108863,P=Math.imul(k,M),R=(R=Math.imul(k,T))+Math.imul(x,M)|0,D=Math.imul(x,T),P=P+Math.imul(w,C)|0,R=(R=R+Math.imul(w,O)|0)+Math.imul(_,C)|0,D=D+Math.imul(_,O)|0,P=P+Math.imul(g,j)|0,R=(R=R+Math.imul(g,N)|0)+Math.imul(b,j)|0,D=D+Math.imul(b,N)|0,P=P+Math.imul(m,L)|0,R=(R=R+Math.imul(m,U)|0)+Math.imul(v,L)|0,D=D+Math.imul(v,U)|0,P=P+Math.imul(p,B)|0,R=(R=R+Math.imul(p,z)|0)+Math.imul(y,B)|0,D=D+Math.imul(y,z)|0,P=P+Math.imul(f,F)|0,R=(R=R+Math.imul(f,q)|0)+Math.imul(d,F)|0,D=D+Math.imul(d,q)|0,P=P+Math.imul(l,V)|0,R=(R=R+Math.imul(l,K)|0)+Math.imul(h,V)|0,D=D+Math.imul(h,K)|0,t=(tt+(P+Math.imul(u,Z)|0)|0)+((8191&(R=(R=R+Math.imul(u,W)|0)+Math.imul(c,Z)|0))<<13)|0,tt=((D=D+Math.imul(c,W)|0)+(R>>>13)|0)+(t>>>26)|0,t&=67108863,P=Math.imul(A,M),R=(R=Math.imul(A,T))+Math.imul(I,M)|0,D=Math.imul(I,T),P=P+Math.imul(k,C)|0,R=(R=R+Math.imul(k,O)|0)+Math.imul(x,C)|0,D=D+Math.imul(x,O)|0,P=P+Math.imul(w,j)|0,R=(R=R+Math.imul(w,N)|0)+Math.imul(_,j)|0,D=D+Math.imul(_,N)|0,P=P+Math.imul(g,L)|0,R=(R=R+Math.imul(g,U)|0)+Math.imul(b,L)|0,D=D+Math.imul(b,U)|0,P=P+Math.imul(m,B)|0,R=(R=R+Math.imul(m,z)|0)+Math.imul(v,B)|0,D=D+Math.imul(v,z)|0,P=P+Math.imul(p,F)|0,R=(R=R+Math.imul(p,q)|0)+Math.imul(y,F)|0,D=D+Math.imul(y,q)|0,P=P+Math.imul(f,V)|0,R=(R=R+Math.imul(f,K)|0)+Math.imul(d,V)|0,D=D+Math.imul(d,K)|0,P=P+Math.imul(l,Z)|0,R=(R=R+Math.imul(l,W)|0)+Math.imul(h,Z)|0,D=D+Math.imul(h,W)|0,e=(tt+(P+Math.imul(u,J)|0)|0)+((8191&(R=(R=R+Math.imul(u,Q)|0)+Math.imul(c,J)|0))<<13)|0,tt=((D=D+Math.imul(c,Q)|0)+(R>>>13)|0)+(e>>>26)|0,e&=67108863,P=Math.imul(E,M),R=(R=Math.imul(E,T))+Math.imul(S,M)|0,D=Math.imul(S,T),P=P+Math.imul(A,C)|0,R=(R=R+Math.imul(A,O)|0)+Math.imul(I,C)|0,D=D+Math.imul(I,O)|0,P=P+Math.imul(k,j)|0,R=(R=R+Math.imul(k,N)|0)+Math.imul(x,j)|0,D=D+Math.imul(x,N)|0,P=P+Math.imul(w,L)|0,R=(R=R+Math.imul(w,U)|0)+Math.imul(_,L)|0,D=D+Math.imul(_,U)|0,P=P+Math.imul(g,B)|0,R=(R=R+Math.imul(g,z)|0)+Math.imul(b,B)|0,D=D+Math.imul(b,z)|0,P=P+Math.imul(m,F)|0,R=(R=R+Math.imul(m,q)|0)+Math.imul(v,F)|0,D=D+Math.imul(v,q)|0,P=P+Math.imul(p,V)|0,R=(R=R+Math.imul(p,K)|0)+Math.imul(y,V)|0,D=D+Math.imul(y,K)|0,P=P+Math.imul(f,Z)|0,R=(R=R+Math.imul(f,W)|0)+Math.imul(d,Z)|0,D=D+Math.imul(d,W)|0,P=P+Math.imul(l,J)|0,R=(R=R+Math.imul(l,Q)|0)+Math.imul(h,J)|0,D=D+Math.imul(h,Q)|0,u=(tt+(P+Math.imul(u,Y)|0)|0)+((8191&(R=(R=R+Math.imul(u,$)|0)+Math.imul(c,Y)|0))<<13)|0,tt=((D=D+Math.imul(c,$)|0)+(R>>>13)|0)+(u>>>26)|0,u&=67108863,P=Math.imul(E,C),R=(R=Math.imul(E,O))+Math.imul(S,C)|0,D=Math.imul(S,O),P=P+Math.imul(A,j)|0,R=(R=R+Math.imul(A,N)|0)+Math.imul(I,j)|0,D=D+Math.imul(I,N)|0,P=P+Math.imul(k,L)|0,R=(R=R+Math.imul(k,U)|0)+Math.imul(x,L)|0,D=D+Math.imul(x,U)|0,P=P+Math.imul(w,B)|0,R=(R=R+Math.imul(w,z)|0)+Math.imul(_,B)|0,D=D+Math.imul(_,z)|0,P=P+Math.imul(g,F)|0,R=(R=R+Math.imul(g,q)|0)+Math.imul(b,F)|0,D=D+Math.imul(b,q)|0,P=P+Math.imul(m,V)|0,R=(R=R+Math.imul(m,K)|0)+Math.imul(v,V)|0,D=D+Math.imul(v,K)|0,P=P+Math.imul(p,Z)|0,R=(R=R+Math.imul(p,W)|0)+Math.imul(y,Z)|0,D=D+Math.imul(y,W)|0,P=P+Math.imul(f,J)|0,R=(R=R+Math.imul(f,Q)|0)+Math.imul(d,J)|0,D=D+Math.imul(d,Q)|0,l=(tt+(P+Math.imul(l,Y)|0)|0)+((8191&(R=(R=R+Math.imul(l,$)|0)+Math.imul(h,Y)|0))<<13)|0,tt=((D=D+Math.imul(h,$)|0)+(R>>>13)|0)+(l>>>26)|0,l&=67108863,P=Math.imul(E,j),R=(R=Math.imul(E,N))+Math.imul(S,j)|0,D=Math.imul(S,N),P=P+Math.imul(A,L)|0,R=(R=R+Math.imul(A,U)|0)+Math.imul(I,L)|0,D=D+Math.imul(I,U)|0,P=P+Math.imul(k,B)|0,R=(R=R+Math.imul(k,z)|0)+Math.imul(x,B)|0,D=D+Math.imul(x,z)|0,P=P+Math.imul(w,F)|0,R=(R=R+Math.imul(w,q)|0)+Math.imul(_,F)|0,D=D+Math.imul(_,q)|0,P=P+Math.imul(g,V)|0,R=(R=R+Math.imul(g,K)|0)+Math.imul(b,V)|0,D=D+Math.imul(b,K)|0,P=P+Math.imul(m,Z)|0,R=(R=R+Math.imul(m,W)|0)+Math.imul(v,Z)|0,D=D+Math.imul(v,W)|0,P=P+Math.imul(p,J)|0,R=(R=R+Math.imul(p,Q)|0)+Math.imul(y,J)|0,D=D+Math.imul(y,Q)|0,f=(tt+(P+Math.imul(f,Y)|0)|0)+((8191&(R=(R=R+Math.imul(f,$)|0)+Math.imul(d,Y)|0))<<13)|0,tt=((D=D+Math.imul(d,$)|0)+(R>>>13)|0)+(f>>>26)|0,f&=67108863,P=Math.imul(E,L),R=(R=Math.imul(E,U))+Math.imul(S,L)|0,D=Math.imul(S,U),P=P+Math.imul(A,B)|0,R=(R=R+Math.imul(A,z)|0)+Math.imul(I,B)|0,D=D+Math.imul(I,z)|0,P=P+Math.imul(k,F)|0,R=(R=R+Math.imul(k,q)|0)+Math.imul(x,F)|0,D=D+Math.imul(x,q)|0,P=P+Math.imul(w,V)|0,R=(R=R+Math.imul(w,K)|0)+Math.imul(_,V)|0,D=D+Math.imul(_,K)|0,P=P+Math.imul(g,Z)|0,R=(R=R+Math.imul(g,W)|0)+Math.imul(b,Z)|0,D=D+Math.imul(b,W)|0,P=P+Math.imul(m,J)|0,R=(R=R+Math.imul(m,Q)|0)+Math.imul(v,J)|0,D=D+Math.imul(v,Q)|0,p=(tt+(P+Math.imul(p,Y)|0)|0)+((8191&(R=(R=R+Math.imul(p,$)|0)+Math.imul(y,Y)|0))<<13)|0,tt=((D=D+Math.imul(y,$)|0)+(R>>>13)|0)+(p>>>26)|0,p&=67108863,P=Math.imul(E,B),R=(R=Math.imul(E,z))+Math.imul(S,B)|0,D=Math.imul(S,z),P=P+Math.imul(A,F)|0,R=(R=R+Math.imul(A,q)|0)+Math.imul(I,F)|0,D=D+Math.imul(I,q)|0,P=P+Math.imul(k,V)|0,R=(R=R+Math.imul(k,K)|0)+Math.imul(x,V)|0,D=D+Math.imul(x,K)|0,P=P+Math.imul(w,Z)|0,R=(R=R+Math.imul(w,W)|0)+Math.imul(_,Z)|0,D=D+Math.imul(_,W)|0,P=P+Math.imul(g,J)|0,R=(R=R+Math.imul(g,Q)|0)+Math.imul(b,J)|0,D=D+Math.imul(b,Q)|0,m=(tt+(P+Math.imul(m,Y)|0)|0)+((8191&(R=(R=R+Math.imul(m,$)|0)+Math.imul(v,Y)|0))<<13)|0,tt=((D=D+Math.imul(v,$)|0)+(R>>>13)|0)+(m>>>26)|0,m&=67108863,P=Math.imul(E,F),R=(R=Math.imul(E,q))+Math.imul(S,F)|0,D=Math.imul(S,q),P=P+Math.imul(A,V)|0,R=(R=R+Math.imul(A,K)|0)+Math.imul(I,V)|0,D=D+Math.imul(I,K)|0,P=P+Math.imul(k,Z)|0,R=(R=R+Math.imul(k,W)|0)+Math.imul(x,Z)|0,D=D+Math.imul(x,W)|0,P=P+Math.imul(w,J)|0,R=(R=R+Math.imul(w,Q)|0)+Math.imul(_,J)|0,D=D+Math.imul(_,Q)|0,g=(tt+(P+Math.imul(g,Y)|0)|0)+((8191&(R=(R=R+Math.imul(g,$)|0)+Math.imul(b,Y)|0))<<13)|0,tt=((D=D+Math.imul(b,$)|0)+(R>>>13)|0)+(g>>>26)|0,g&=67108863,P=Math.imul(E,V),R=(R=Math.imul(E,K))+Math.imul(S,V)|0,D=Math.imul(S,K),P=P+Math.imul(A,Z)|0,R=(R=R+Math.imul(A,W)|0)+Math.imul(I,Z)|0,D=D+Math.imul(I,W)|0,P=P+Math.imul(k,J)|0,R=(R=R+Math.imul(k,Q)|0)+Math.imul(x,J)|0,D=D+Math.imul(x,Q)|0,w=(tt+(P+Math.imul(w,Y)|0)|0)+((8191&(R=(R=R+Math.imul(w,$)|0)+Math.imul(_,Y)|0))<<13)|0,tt=((D=D+Math.imul(_,$)|0)+(R>>>13)|0)+(w>>>26)|0,w&=67108863,P=Math.imul(E,Z),R=(R=Math.imul(E,W))+Math.imul(S,Z)|0,D=Math.imul(S,W),P=P+Math.imul(A,J)|0,R=(R=R+Math.imul(A,Q)|0)+Math.imul(I,J)|0,D=D+Math.imul(I,Q)|0,k=(tt+(P+Math.imul(k,Y)|0)|0)+((8191&(R=(R=R+Math.imul(k,$)|0)+Math.imul(x,Y)|0))<<13)|0,tt=((D=D+Math.imul(x,$)|0)+(R>>>13)|0)+(k>>>26)|0,k&=67108863,P=Math.imul(E,J),R=(R=Math.imul(E,Q))+Math.imul(S,J)|0,D=Math.imul(S,Q),A=(tt+(P+Math.imul(A,Y)|0)|0)+((8191&(R=(R=R+Math.imul(A,$)|0)+Math.imul(I,Y)|0))<<13)|0,tt=((D=D+Math.imul(I,$)|0)+(R>>>13)|0)+(A>>>26)|0,A&=67108863,Y=(tt+Math.imul(E,Y)|0)+((8191&(R=(R=Math.imul(E,$))+Math.imul(S,Y)|0))<<13)|0,tt=((D=Math.imul(S,$))+(R>>>13)|0)+(Y>>>26)|0,Y&=67108863,s[0]=X,s[1]=H,s[2]=G,s[3]=n,s[4]=i,s[5]=a,s[6]=o,s[7]=t,s[8]=e,s[9]=u,s[10]=l,s[11]=f,s[12]=p,s[13]=m,s[14]=g,s[15]=w,s[16]=k,s[17]=A,s[18]=Y,0!=tt&&(s[19]=tt,r.length++),r};function m(t,e,r){return(new v).mulp(t,e,r)}function v(t,e){this.x=t,this.y=e}Math.imul||(y=p),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return e=(10===this.length&&10===t.length?y:r<63?p:r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o<r.length-1;o++){for(var a=i,s=(i=0,67108863&n),u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var l,h=(0|t.words[o-c])*(0|e.words[c]);s=67108863&(l=(l=67108863&h)+s|0),i+=(a=(a=a+(h/67108864|0)|0)+(l>>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}:m)(this,t,e)},v.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n<t;n++)e[n]=this.revBin(n,r,t);return e},v.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var n=0,i=0;i<e;i++)n|=(1&t)<<e-i-1,t>>=1;return n},v.prototype.permute=function(t,e,r,n,i,o){for(var a=0;a<o;a++)n[a]=e[t[a]],i[a]=r[t[a]]},v.prototype.transform=function(t,e,r,n,i,o){this.permute(o,t,e,r,n,i);for(var a=1;a<i;a<<=1)for(var s=a<<1,u=Math.cos(2*Math.PI/s),c=Math.sin(2*Math.PI/s),l=0;l<i;l+=s)for(var h=u,f=c,d=0;d<a;d++){var p=r[l+d],y=n[l+d],m=r[l+d+a],v=h*m-f*(g=n[l+d+a]),g=h*g+f*m;r[l+d]=p+(m=v),n[l+d]=y+g,r[l+d+a]=p-m,n[l+d+a]=y-g,d!==s&&(v=u*h-c*f,f=u*f+c*h,h=v)}},v.prototype.guessLen13b=function(t,e){t=1&(n=1|Math.max(e,t));for(var r=0,n=n/2|0;n;n>>>=1)r++;return 1<<r+1+t},v.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=t[n];t[n]=t[r-n-1],t[r-n-1]=i,i=e[n],e[n]=-e[r-n-1],e[r-n-1]=-i}},v.prototype.normalize13b=function(t,e){for(var r=0,n=0;n<e/2;n++){var i=8192*Math.round(t[2*n+1]/e)+Math.round(t[2*n]/e)+r;t[n]=67108863&i,r=i<67108864?0:i/67108864|0}return t},v.prototype.convert13b=function(t,e,r,i){for(var o=0,a=0;a<e;a++)o+=0|t[a],r[2*a]=8191&o,r[2*a+1]=8191&(o>>>=13),o>>>=13;for(a=2*e;a<i;++a)r[a]=0;n(0===o),n(0==(-8192&o))},v.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},v.prototype.mulp=function(t,e,r){var n=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(n),o=this.stub(n),a=new Array(n),s=new Array(n),u=new Array(n),c=new Array(n),l=new Array(n),h=new Array(n),f=r.words;f.length=n,this.convert13b(t.words,t.length,a,n),this.convert13b(e.words,e.length,c,n),this.transform(a,o,s,u,n,i),this.transform(c,o,l,h,n,i);for(var d=0;d<n;d++){var p=s[d]*l[d]-u[d]*h[d];u[d]=s[d]*h[d]+u[d]*l[d],s[d]=p}return this.conjugate(s,u,n),this.transform(s,u,f,o,n,i),this.conjugate(f,o,n),this.normalize13b(f,n),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),m(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){n("number"==typeof t),n(t<67108864);for(var e=0,r=0;r<this.length;r++){var i=(0|this.words[r])*t,o=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r%26;e[r]=(t.words[r/26|0]&1<<n)>>>n}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var i=r.sqr();n<e.length;n++,i=i.sqr())0!==e[n]&&(r=r.mul(i));return r},o.prototype.iushln=function(t){n("number"==typeof t&&0<=t);var e=t%26,r=(t-e)/26,i=67108863>>>26-e<<26-e;if(0!=e){for(var o=0,a=0;a<this.length;a++){var s=this.words[a]&i,u=(0|this.words[a])-s<<e;this.words[a]=u|o,o=s>>>26-e}o&&(this.words[a]=o,this.length++)}if(0!=r){for(a=this.length-1;0<=a;a--)this.words[a+r]=this.words[a];for(a=0;a<r;a++)this.words[a]=0;this.length+=r}return this.strip()},o.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,r){n("number"==typeof t&&0<=t);var i=e?(e-e%26)/26:0,o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0!==a)if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var l=0;for(c=this.length-1;0<=c&&(0!==l||i<=c);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&0<=t);var e=t%26;return t=(t-e)/26,!(this.length<=t||!(this.words[t]&1<<e))},o.prototype.imaskn=function(t){n("number"==typeof t&&0<=t);var e=t%26;return t=(t-e)/26,n(0===this.negative,"imaskn works only with positive numbers"),this.length<=t?this:(0!=e&&t++,this.length=Math.min(t,this.length),0!=e&&(this.words[this.length-1]&=67108863^67108863>>>e<<e),this.strip())},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return n("number"==typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?(1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0):(this.negative=0,this.isubn(t),this.negative=1),this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&67108864<=this.words[e];e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,--this.words[e+1];return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,r){var i=t.length+r;this._expand(i);for(var o=0,a=0;a<t.length;a++){var s=(0|this.words[a+r])+o,u=(0|t.words[a])*e;o=((s-=67108863&u)>>26)-(u/67108864|0),this.words[a+r]=67108863&s}for(;a<this.length-r;a++)o=(s=(0|this.words[a+r])+o)>>26,this.words[a+r]=67108863&s;if(0===o)return this.strip();for(n(-1===o),a=o=0;a<this.length;a++)o=(s=-(0|this.words[a])+o)>>26,this.words[a]=67108863&s;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,a=0|i.words[i.length-1];0!=(r=26-this._countBits(a))&&(i=i.ushln(r),n.iushln(r),a=0|i.words[i.length-1]);var s,u=n.length-i.length;if("mod"!==e){(s=new o(null)).length=1+u,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}0===(t=n.clone()._ishlnsubmul(i,1,u)).negative&&(n=t,s&&(s.words[u]=1));for(var l=u-1;0<=l;l--){var h=67108864*(0|n.words[i.length+l])+(0|n.words[i.length+l-1]);for(h=Math.min(h/a|0,67108863),n._ishlnsubmul(i,h,l);0!==n.negative;)h--,n.negative=0,n._ishlnsubmul(i,1,l),n.isZero()||(n.negative^=1);s&&(s.words[l]=h)}return s&&s.strip(),n.strip(),"div"!==e&&0!=r&&n.iushrn(r),{div:s||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:i,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),{div:i="mod"!==e?s.div.neg():i,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,a,s},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1);return t=t.andln(1),(n=r.cmp(n))<0||1===t&&0===n?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;0<=i;i--)r=(e*r+(0|this.words[i]))%t;return r},o.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;0<=r;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());for(var e=this,r=t.clone(),i=(e=0!==e.negative?e.umod(t):e.clone(),new o(1)),a=new o(0),s=new o(0),u=new o(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),h=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(0<f)for(e.iushrn(f);0<f--;)(i.isOdd()||a.isOdd())&&(i.iadd(l),a.isub(h)),i.iushrn(1),a.iushrn(1);for(var p=0,y=1;0==(r.words[0]&y)&&p<26;++p,y<<=1);if(0<p)for(r.iushrn(p);0<p--;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(h)),s.iushrn(1),u.iushrn(1);0<=e.cmp(r)?(e.isub(r),i.isub(s),a.isub(u)):(r.isub(e),s.isub(i),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());for(var e,r=this,i=t.clone(),a=(r=0!==r.negative?r.umod(t):r.clone(),new o(1)),s=new o(0),u=i.clone();0<r.cmpn(1)&&0<i.cmpn(1);){for(var c=0,l=1;0==(r.words[0]&l)&&c<26;++c,l<<=1);if(0<c)for(r.iushrn(c);0<c--;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,f=1;0==(i.words[0]&f)&&h<26;++h,f<<=1);if(0<h)for(i.iushrn(h);0<h--;)s.isOdd()&&s.iadd(u),s.iushrn(1);0<=r.cmp(i)?(r.isub(i),a.isub(s)):(i.isub(r),s.isub(a))}return(e=0===r.cmpn(1)?a:s).cmpn(0)<0&&e.iadd(t),e},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0;for(var n=r.negative=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t),t=(t-(e=t%26))/26;var e=1<<e;if(this.length<=t)return this._expand(1+t),this.words[t]|=e,this;for(var r=e,i=t;0!==r&&i<this.length;i++){var o=0|this.words[i];r=(o+=r)>>>26,o&=67108863,this.words[i]=o}return 0!==r&&(this.words[i]=r,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e=t<0;return 0===this.negative||e?0===this.negative&&e?1:(this.strip(),t=1<this.length?1:(n((t=e?-t:t)<=67108863,"Number is too big"),(e=0|this.words[0])===t?0:e<t?-1:1),0!==this.negative?0|-t:t):-1},o.prototype.cmp=function(t){return 0!==this.negative&&0===t.negative?-1:0===this.negative&&0!==t.negative?1:(t=this.ucmp(t),0!==this.negative?0|-t:t)},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;0<=r;r--){var n=0|this.words[r],i=0|t.words[r];if(n!=i){n<i?e=-1:i<n&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return 0<=this.cmpn(t)},o.prototype.gte=function(t){return 0<=this.cmp(t)},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new A(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function b(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function k(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function x(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(t){var e;"string"==typeof t?(e=o._prime(t),this.m=e.p,this.prime=e):(n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null)}function I(t){A.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}b.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function(t){for(var e,r=t;this.split(r,this.tmp),(e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength())>this.n;);return 0===(t=e<this.n?-1:r.ucmp(this.p))?(r.words[0]=0,r.length=1):0<t?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},b.prototype.split=function(t,e){t.iushrn(this.n,0,e)},b.prototype.imulK=function(t){return t.imul(this.k)},i(w,b),w.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n<r;n++)e.words[n]=t.words[n];if(e.length=r,t.length<=9)return t.words[0]=0,void(t.length=1);var i=t.words[9];for(e.words[e.length++]=4194303&i,n=10;n<t.length;n++){var o=0|t.words[n];t.words[n-10]=(4194303&o)<<4|i>>>22,i=o}0==(t.words[n-10]=i>>>=22)&&10<t.length?t.length-=10:t.length-=9},w.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(_,b),i(k,b),i(x,b),x.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new w;else if("p224"===t)e=new _;else if("p192"===t)e=new k;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new x}return g[t]=e},A.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},A.prototype.imod=function(t){return(this.prime?this.prime.ireduce(t):t.umod(this.m))._forceRed(this)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.prototype.add=function(t,e){return this._verify2(t,e),0<=(e=t.add(e)).cmp(this.m)&&e.isub(this.m),e._forceRed(this)},A.prototype.iadd=function(t,e){return this._verify2(t,e),0<=(e=t.iadd(e)).cmp(this.m)&&e.isub(this.m),e},A.prototype.sub=function(t,e){return this._verify2(t,e),(e=t.sub(e)).cmpn(0)<0&&e.iadd(this.m),e._forceRed(this)},A.prototype.isub=function(t,e){return this._verify2(t,e),(e=t.isub(e)).cmpn(0)<0&&e.iadd(this.m),e},A.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},A.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},A.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e)return e=this.m.add(new o(1)).iushrn(2),this.pow(t,e);for(var r=this.m.subn(1),i=0;!r.isZero()&&0===r.andln(1);)i++,r.iushrn(1);n(!r.isZero());for(var a=new o(1).toRed(this),s=a.redNeg(),u=this.m.subn(1).iushrn(1),c=new o(2*(c=this.m.bitLength())*c).toRed(this);0!==this.pow(c,u).cmp(s);)c.redIAdd(s);for(var l=this.pow(c,r),h=this.pow(t,r.addn(1).iushrn(1)),f=this.pow(t,r),d=i;0!==f.cmp(a);){for(var p=f,y=0;0!==p.cmp(a);y++)p=p.redSqr();n(y<d);var m=this.pow(l,new o(1).iushln(d-y-1));h=h.redMul(m),l=m.redSqr(),f=f.redMul(l),d=y}return h},A.prototype.invm=function(t){return 0!==(t=t._invmp(this.m)).negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},A.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var i=r[0],a=0,s=0,u=e.bitLength()%26;for(0===u&&(u=26),n=e.length-1;0<=n;n--){for(var c=e.words[n],l=u-1;0<=l;l--){var h=c>>l&1;i!==r[0]&&(i=this.sqr(i)),0!=h||0!==a?(a<<=1,a|=h,(4==++s||0===n&&0===l)&&(i=this.mul(i,r[a]),a=s=0)):s=0}u=26}return i},A.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},A.prototype.convertFrom=function(t){return(t=t.clone()).red=null,t},o.mont=function(t){return new I(t)},i(I,A),I.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},I.prototype.convertFrom=function(t){return(t=this.imod(t.mul(this.rinv))).red=null,t},I.prototype.imul=function(t,e){return t.isZero()||e.isZero()?(t.words[0]=0,t.length=1,t):(e=(t=t.imul(e)).maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),e=t=t.isub(e).iushrn(this.shift),0<=t.cmp(this.m)?e=t.isub(this.m):t.cmpn(0)<0&&(e=t.iadd(this.m)),e._forceRed(this))},I.prototype.mul=function(t,e){return t.isZero()||e.isZero()?new o(0)._forceRed(this):(e=(t=t.mul(e)).maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),e=t=t.isub(e).iushrn(this.shift),0<=t.cmp(this.m)?e=t.isub(this.m):t.cmpn(0)<0&&(e=t.iadd(this.m)),e._forceRed(this))},I.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)},{buffer:11}],10:[function(t,e,n){(function(t){(function(){e.exports=function(e){return e=new Uint8Array(e),(t.crypto||t.msCrypto).getRandomValues(e),e}}).call(this)}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],11:[function(t,e,r){},{}],12:[function(t,e,r){"use strict";r.version=t("../package.json").version,r.utils=t("./elliptic/utils"),r.rand=t("brorand"),r.curve=t("./elliptic/curve"),r.curves=t("./elliptic/curves"),r.ec=t("./elliptic/ec"),r.eddsa=t("./elliptic/eddsa")},{"../package.json":25,"./elliptic/curve":15,"./elliptic/curves":18,"./elliptic/ec":19,"./elliptic/eddsa":22,"./elliptic/utils":24,brorand:10}],13:[function(t,e,r){"use strict";var n=t("bn.js"),i=t("../utils"),o=i.getNAF,a=i.getJSF,s=i.assert;function u(t,e){this.type=t,this.p=new n(e.p,16),this.red=e.prime?n.red(e.prime):n.mont(this.p),this.zero=new n(0).toRed(this.red),this.one=new n(1).toRed(this.red),this.two=new n(2).toRed(this.red),this.n=e.n&&new n(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0,!(e=this.n&&this.p.div(this.n))||0<e.cmpn(100)?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function c(t,e){this.curve=t,this.type=e,this.precomputed=null}(e.exports=u).prototype.point=function(){throw new Error("Not implemented")},u.prototype.validate=function(){throw new Error("Not implemented")},u.prototype._fixedNafMul=function(t,e){s(t.precomputed);var r=t._getDoubles(),n=o(e,1,this._bitLength);e=(1<<r.step+1)-(r.step%2==0?2:1),e/=3;for(var i=[],a=0;a<n.length;a+=r.step){for(var u=0,c=a+r.step-1;a<=c;c--)u=(u<<1)+n[c];i.push(u)}for(var l=this.jpoint(null,null,null),h=this.jpoint(null,null,null),f=e;0<f;f--){for(a=0;a<i.length;a++)(u=i[a])===f?h=h.mixedAdd(r.points[a]):u===-f&&(h=h.mixedAdd(r.points[a].neg()));l=l.add(h)}return l.toP()},u.prototype._wnafMul=function(t,e){for(var r=t._getNAFPoints(4),n=r.wnd,i=r.points,a=o(e,n,this._bitLength),u=this.jpoint(null,null,null),c=a.length-1;0<=c;c--){for(var l=0;0<=c&&0===a[c];c--)l++;if(0<=c&&l++,u=u.dblp(l),c<0)break;var h=a[c];s(0!==h),u="affine"===t.type?0<h?u.mixedAdd(i[h-1>>1]):u.mixedAdd(i[-h-1>>1].neg()):0<h?u.add(i[h-1>>1]):u.add(i[-h-1>>1].neg())}return"affine"===t.type?u.toP():u},u.prototype._wnafMulAdd=function(t,e,r,n,i){for(var s=this._wnafT1,u=this._wnafT2,c=this._wnafT3,l=0,h=0;h<n;h++){var f,d=(f=e[h])._getNAFPoints(t);s[h]=d.wnd,u[h]=d.points}for(h=n-1;1<=h;h-=2){var p=h-1,y=h;if(1===s[p]&&1===s[y]){var m=[e[p],null,null,e[y]];0===e[p].y.cmp(e[y].y)?(m[1]=e[p].add(e[y]),m[2]=e[p].toJ().mixedAdd(e[y].neg())):0===e[p].y.cmp(e[y].y.redNeg())?(m[1]=e[p].toJ().mixedAdd(e[y]),m[2]=e[p].add(e[y].neg())):(m[1]=e[p].toJ().mixedAdd(e[y]),m[2]=e[p].toJ().mixedAdd(e[y].neg()));var v=[-3,-1,-5,-7,0,7,5,1,3],g=a(r[p],r[y]);for(l=Math.max(g[0].length,l),c[p]=new Array(l),c[y]=new Array(l),I=0;I<l;I++){var b=0|g[0][I],w=0|g[1][I];c[p][I]=v[3*(1+b)+(1+w)],c[y][I]=0,u[p]=m}}else c[p]=o(r[p],s[p],this._bitLength),c[y]=o(r[y],s[y],this._bitLength),l=Math.max(c[p].length,l),l=Math.max(c[y].length,l)}var _=this.jpoint(null,null,null),k=this._wnafT4;for(h=l;0<=h;h--){for(var x=0;0<=h;){for(var A=!0,I=0;I<n;I++)k[I]=0|c[I][h],0!==k[I]&&(A=!1);if(!A)break;x++,h--}if(0<=h&&x++,_=_.dblp(x),h<0)break;for(I=0;I<n;I++){var E=k[I];0!==E&&(0<E?f=u[I][E-1>>1]:E<0&&(f=u[I][-E-1>>1].neg()),_="affine"===f.type?_.mixedAdd(f):_.add(f))}}for(h=0;h<n;h++)u[h]=null;return i?_:_.toP()},(u.BasePoint=c).prototype.eq=function(){throw new Error("Not implemented")},c.prototype.validate=function(){return this.curve.validate(this)},u.prototype.decodePoint=function(t,e){if(t=i.toArray(t,e),e=this.p.byteLength(),(4===t[0]||6===t[0]||7===t[0])&&t.length-1==2*e)return 6===t[0]?s(t[t.length-1]%2==0):7===t[0]&&s(t[t.length-1]%2==1),this.point(t.slice(1,1+e),t.slice(1+e,1+2*e));if((2===t[0]||3===t[0])&&t.length-1===e)return this.pointFromX(t.slice(1,1+e),3===t[0]);throw new Error("Unknown point format")},c.prototype.encodeCompressed=function(t){return this.encode(t,!0)},c.prototype._encode=function(t){var e=this.curve.p.byteLength(),r=this.getX().toArray("be",e);return t?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",e))},c.prototype.encode=function(t,e){return i.encode(this._encode(e),t)},c.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},c.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var e=this.precomputed.doubles;return!!e&&e.points.length>=Math.ceil((t.bitLength()+1)/e.step)},c.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i<e;i+=t){for(var o=0;o<t;o++)n=n.dbl();r.push(n)}return{step:t,points:r}},c.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],r=(1<<t)-1,n=1==r?null:this.dbl(),i=1;i<r;i++)e[i]=e[i-1].add(n);return{wnd:t,points:e}},c.prototype._getBeta=function(){return null},c.prototype.dblp=function(t){for(var e=this,r=0;r<t;r++)e=e.dbl();return e}},{"../utils":24,"bn.js":9}],14:[function(t,e,r){e.exports={}},{}],15:[function(t,e,r){"use strict";r.base=t("./base"),r.short=t("./short"),r.mont=t("./mont"),r.edwards=t("./edwards")},{"./base":13,"./edwards":14,"./mont":16,"./short":17}],16:[function(t,e,r){arguments[4][14][0].apply(r,arguments)},{dup:14}],17:[function(t,e,r){"use strict";var n=t("../utils"),i=t("bn.js"),o=t("inherits"),a=t("./base"),s=n.assert;function u(t){a.call(this,"short",t),this.a=new i(t.a,16).toRed(this.red),this.b=new i(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function c(t,e,r,n){a.BasePoint.call(this,t,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(e,16),this.y=new i(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function l(t,e,r,n){a.BasePoint.call(this,t,"jacobian"),null===e&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new i(0)):(this.x=new i(e,16),this.y=new i(r,16),this.z=new i(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(u,a),(e.exports=u).prototype._getEndomorphism=function(t){var e,r,n;if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3))return r=(t.beta?new i(t.beta,16):r=(n=this._getEndoRoots(this.p))[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red),t.lambda?e=new i(t.lambda,16):(n=this._getEndoRoots(this.n),0===this.g.mul(n[0]).x.cmp(this.g.x.redMul(r))?e=n[0]:(e=n[1],s(0===this.g.mul(e).x.cmp(this.g.x.redMul(r))))),{beta:r,lambda:e,basis:t.basis?t.basis.map((function(t){return{a:new i(t.a,16),b:new i(t.b,16)}})):this._getEndoBasis(e)}},u.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:i.mont(t),r=(t=(r=new i(2).toRed(e).redInvm()).redNeg(),new i(3).toRed(e).redNeg().redSqrt().redMul(r));return[t.redAdd(r).fromRed(),t.redSub(r).fromRed()]},u.prototype._getEndoBasis=function(t){for(var e,r,n,o,a,s=this.n.ushrn(Math.floor(this.n.bitLength()/2)),u=t,c=this.n.clone(),l=new i(1),h=new i(0),f=new i(0),d=new i(1),p=0;0!==u.cmpn(0);){var y=c.div(u),m=c.sub(y.mul(u)),v=f.sub(y.mul(l));if(y=d.sub(y.mul(h)),!n&&m.cmp(s)<0)e=a.neg(),r=l,n=m.neg(),o=v;else if(n&&2==++p)break;c=u,u=a=m,f=l,l=v,d=h,h=y}var g=m.neg(),b=v;return t=n.sqr().add(o.sqr()),0<=g.sqr().add(b.sqr()).cmp(t)&&(g=e,b=r),n.negative&&(n=n.neg(),o=o.neg()),g.negative&&(g=g.neg(),b=b.neg()),[{a:n,b:o},{a:g,b:b}]},u.prototype._endoSplit=function(t){var e=(o=this.endo.basis)[0],r=(a=o[1]).b.mul(t).divRound(this.n),n=e.b.neg().mul(t).divRound(this.n),i=r.mul(e.a),o=n.mul(a.a),a=(e=r.mul(e.b),n.mul(a.b));return{k1:t.sub(i).sub(o),k2:e.add(a).neg()}},u.prototype.pointFromX=function(t,e){var r=(t=(t=new i(t,16)).red?t:t.toRed(this.red)).redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");return r=n.fromRed().isOdd(),(e&&!r||!e&&r)&&(n=n.redNeg()),this.point(t,n)},u.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y;return t=this.a.redMul(e),t=e.redSqr().redMul(e).redIAdd(t).redIAdd(this.b),0===r.redSqr().redISub(t).cmpn(0)},u.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o<t.length;o++){var a=this._endoSplit(e[o]),s=t[o],u=s._getBeta();a.k1.negative&&(a.k1.ineg(),s=s.neg(!0)),a.k2.negative&&(a.k2.ineg(),u=u.neg(!0)),n[2*o]=s,n[2*o+1]=u,i[2*o]=a.k1,i[2*o+1]=a.k2}r=this._wnafMulAdd(1,n,i,2*o,r);for(var c=0;c<2*o;c++)n[c]=null,i[c]=null;return r},o(c,a.BasePoint),u.prototype.point=function(t,e,r){return new c(this,t,e,r)},u.prototype.pointFromJSON=function(t,e){return c.fromJSON(this,t,e)},c.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var e,r,n=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);return t&&(e=this.curve,r=function(t){return e.point(t.x.redMul(e.endo.beta),t.y)},(t.beta=n).precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(r)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(r)}}),n}},c.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},c.fromJSON=function(t,e,r){"string"==typeof e&&(e=JSON.parse(e));var n=t.point(e[0],e[1],r);if(!e[2])return n;function i(e){return t.point(e[0],e[1],r)}return e=e[2],n.precomputed={beta:null,doubles:e.doubles&&{step:e.doubles.step,points:[n].concat(e.doubles.points.map(i))},naf:e.naf&&{wnd:e.naf.wnd,points:[n].concat(e.naf.points.map(i))}},n},c.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},c.prototype.isInfinity=function(){return this.inf},c.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);t=(e=0!==(e=this.y.redSub(t.y)).cmpn(0)?e.redMul(this.x.redSub(t.x).redInvm()):e).redSqr().redISub(this.x).redISub(t.x);var e=e.redMul(this.x.redSub(t)).redISub(this.y);return this.curve.point(t,e)},c.prototype.dbl=function(){if(this.inf)return this;if(0===(r=this.y.redAdd(this.y)).cmpn(0))return this.curve.point(null,null);var t=this.curve.a,e=this.x.redSqr(),r=r.redInvm();return r=(t=e.redAdd(e).redIAdd(e).redIAdd(t).redMul(r)).redSqr().redISub(this.x.redAdd(this.x)),t=t.redMul(this.x.redSub(r)).redISub(this.y),this.curve.point(r,t)},c.prototype.getX=function(){return this.x.fromRed()},c.prototype.getY=function(){return this.y.fromRed()},c.prototype.mul=function(t){return t=new i(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},c.prototype.mulAdd=function(t,e,r){return e=[this,e],r=[t,r],this.curve.endo?this.curve._endoWnafMulAdd(e,r):this.curve._wnafMulAdd(1,e,r,2)},c.prototype.jmulAdd=function(t,e,r){return e=[this,e],r=[t,r],this.curve.endo?this.curve._endoWnafMulAdd(e,r,!0):this.curve._wnafMulAdd(1,e,r,2,!0)},c.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},c.prototype.neg=function(t){if(this.inf)return this;var e,r=this.curve.point(this.x,this.y.redNeg());return t&&this.precomputed&&(e=this.precomputed,t=function(t){return t.neg()},r.precomputed={naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(t)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(t)}}),r},c.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(l,a.BasePoint),u.prototype.jpoint=function(t,e,r){return new l(this,t,e,r)},l.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=(r=this.z.redInvm()).redSqr(),e=this.x.redMul(t),r=this.y.redMul(t).redMul(r);return this.curve.point(e,r)},l.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},l.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),a=t.y.redMul(r.redMul(this.z));return e=n.redSub(i),r=o.redSub(a),0===e.cmpn(0)?0!==r.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl():(a=(i=e.redSqr()).redMul(e),n=n.redMul(i),i=r.redSqr().redIAdd(a).redISub(n).redISub(n),a=r.redMul(n.redISub(i)).redISub(o.redMul(a)),e=this.z.redMul(t.z).redMul(e),this.curve.jpoint(i,a,e))},l.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z);return t=r.redSub(n),e=i.redSub(o),0===t.cmpn(0)?0!==e.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl():(o=(n=t.redSqr()).redMul(t),r=r.redMul(n),n=e.redSqr().redIAdd(o).redISub(r).redISub(r),o=e.redMul(r.redISub(n)).redISub(i.redMul(o)),t=this.z.redMul(t),this.curve.jpoint(n,o,t))},l.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var e=this,r=0;r<t;r++)e=e.dbl();return e}var n=this.curve.a,i=this.curve.tinv,o=this.x,a=this.y,s=this.z,u=s.redSqr().redSqr(),c=a.redAdd(a);for(r=0;r<t;r++){var l=o.redSqr(),h=(d=c.redSqr()).redSqr(),f=l.redAdd(l).redIAdd(l).redIAdd(n.redMul(u)),d=(l=o.redMul(d),f.redSqr().redISub(l.redAdd(l)));l=l.redISub(d),f=(f=f.redMul(l)).redIAdd(f).redISub(h),l=c.redMul(s),r+1<t&&(u=u.redMul(h)),o=d,s=l,c=f}return this.curve.jpoint(o,c.redMul(i),s)},l.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},l.prototype._zeroDbl=function(){var t,e,r,n,i,o=this.zOne?(r=this.x.redSqr(),t=(n=this.y.redSqr()).redSqr(),i=(i=this.x.redAdd(n).redSqr().redISub(r).redISub(t)).redIAdd(i),n=(e=r.redAdd(r).redIAdd(r)).redSqr().redISub(i).redISub(i),r=(r=(r=t.redIAdd(t)).redIAdd(r)).redIAdd(r),e=e.redMul(i.redISub(t=n)).redISub(r),this.y.redAdd(this.y)):(i=this.x.redSqr(),o=(n=this.y.redSqr()).redSqr(),r=(r=this.x.redAdd(n).redSqr().redISub(i).redISub(o)).redIAdd(r),i=(n=i.redAdd(i).redIAdd(i)).redSqr(),o=(o=(o=o.redIAdd(o)).redIAdd(o)).redIAdd(o),t=i.redISub(r).redISub(r),e=n.redMul(r.redISub(t)).redISub(o),(o=this.y.redMul(this.z)).redIAdd(o));return this.curve.jpoint(t,e,o)},l.prototype._threeDbl=function(){var t,e,r,n,i,o,a,s;return this.zOne?(a=this.x.redSqr(),r=(t=this.y.redSqr()).redSqr(),o=(o=this.x.redAdd(t).redSqr().redISub(a).redISub(r)).redIAdd(o),e=n=(s=a.redAdd(a).redIAdd(a).redIAdd(this.curve.a)).redSqr().redISub(o).redISub(o),i=(i=(i=r.redIAdd(r)).redIAdd(i)).redIAdd(i),t=s.redMul(o.redISub(n)).redISub(i),a=this.y.redAdd(this.y)):(r=this.z.redSqr(),s=this.y.redSqr(),o=this.x.redMul(s),n=(n=this.x.redSub(r).redMul(this.x.redAdd(r))).redAdd(n).redIAdd(n),o=(i=(i=o.redIAdd(o)).redIAdd(i)).redAdd(i),e=n.redSqr().redISub(o),a=this.y.redAdd(this.z).redSqr().redISub(s).redISub(r),s=(s=(s=(s=s.redSqr()).redIAdd(s)).redIAdd(s)).redIAdd(s),t=n.redMul(i.redISub(e)).redISub(s)),this.curve.jpoint(e,t,a)},l.prototype._dbl=function(){var t=this.curve.a,e=this.x,r=this.y,n=this.z,i=n.redSqr().redSqr(),o=e.redSqr(),a=r.redSqr();return t=o.redAdd(o).redIAdd(o).redIAdd(t.redMul(i)),e=(i=(i=e.redAdd(e)).redIAdd(i)).redMul(a),i=t.redSqr().redISub(e.redAdd(e)),e=e.redISub(i),a=(a=(a=(a=a.redSqr()).redIAdd(a)).redIAdd(a)).redIAdd(a),a=t.redMul(e).redISub(a),n=r.redAdd(r).redMul(n),this.curve.jpoint(i,a,n)},l.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr(),n=e.redSqr(),i=t.redAdd(t).redIAdd(t),o=i.redSqr(),a=this.x.redAdd(e).redSqr().redISub(t).redISub(n);return t=(a=(a=(a=a.redIAdd(a)).redAdd(a).redIAdd(a)).redISub(o)).redSqr(),n=(n=(n=(n=n.redIAdd(n)).redIAdd(n)).redIAdd(n)).redIAdd(n),o=i.redIAdd(a).redSqr().redISub(o).redISub(t).redISub(n),e=(e=(e=e.redMul(o)).redIAdd(e)).redIAdd(e),e=(e=(e=this.x.redMul(t).redISub(e)).redIAdd(e)).redIAdd(e),o=(o=(o=(o=this.y.redMul(o.redMul(n.redISub(o)).redISub(a.redMul(t)))).redIAdd(o)).redIAdd(o)).redIAdd(o),t=this.z.redAdd(a).redSqr().redISub(r).redISub(t),this.curve.jpoint(e,o,t)},l.prototype.mul=function(t,e){return t=new i(t,e),this.curve._wnafMul(this,t)},l.prototype.eq=function(t){if("affine"===t.type)return this.eq(t.toJ());if(this===t)return!0;var e=this.z.redSqr(),r=t.z.redSqr();return 0===this.x.redMul(r).redISub(t.x.redMul(e)).cmpn(0)&&(e=e.redMul(this.z),r=r.redMul(t.z),0===this.y.redMul(r).redISub(t.y.redMul(e)).cmpn(0))},l.prototype.eqXToP=function(t){var e=this.z.redSqr(),r=t.toRed(this.curve.red).redMul(e);if(0===this.x.cmp(r))return!0;for(var n=t.clone(),i=this.curve.redN.redMul(e);;){if(n.iadd(this.curve.n),0<=n.cmp(this.curve.p))return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},l.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},l.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../utils":24,"./base":13,"bn.js":9,inherits:39}],18:[function(t,e,r){"use strict";var n,i=r,o=(r=t("hash.js"),t("./curve")),a=t("./utils").assert;function s(t){"short"===t.type?this.curve=new o.short(t):"edwards"===t.type?this.curve=new o.edwards(t):this.curve=new o.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function u(t,e){Object.defineProperty(i,t,{configurable:!0,enumerable:!0,get:function(){var r=new s(e);return Object.defineProperty(i,t,{configurable:!0,enumerable:!0,value:r}),r}})}i.PresetCurve=s,u("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),u("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),u("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),u("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:r.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),u("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:r.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),u("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),u("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=t("./precomputed/secp256k1")}catch(t){n=void 0}u("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})},{"./curve":15,"./precomputed/secp256k1":23,"./utils":24,"hash.js":26}],19:[function(t,e,r){"use strict";var n=t("bn.js"),i=t("hmac-drbg"),o=t("../utils"),a=t("../curves"),u=t("brorand"),c=o.assert,l=t("./key"),h=t("./signature");function f(t){if(!(this instanceof f))return new f(t);"string"==typeof t&&(c(Object.prototype.hasOwnProperty.call(a,t),"Unknown curve "+t),t=a[t]),t instanceof a.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}(e.exports=f).prototype.keyPair=function(t){return new l(this,t)},f.prototype.keyFromPrivate=function(t,e){return l.fromPrivate(this,t,e)},f.prototype.keyFromPublic=function(t,e){return l.fromPublic(this,t,e)},f.prototype.genKeyPair=function(t){for(var e=new i({hash:this.hash,pers:(t=t||{}).pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||u(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),o=this.n.sub(new n(2));;){var a=new n(e.generate(r));if(!(0<a.cmp(o)))return a.iaddn(1),this.keyFromPrivate(a)}},f.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return 0<r&&(t=t.ushrn(r)),!e&&0<=t.cmp(this.n)?t.sub(this.n):t},f.prototype.sign=function(t,e,r,o){"object"==s(r)&&(o=r,r=null),o=o||{},e=this.keyFromPrivate(e,r),t=this._truncateToN(new n(t,16));for(var a=this.n.byteLength(),u=(r=e.getPrivate().toArray("be",a),a=t.toArray("be",a),new i({hash:this.hash,entropy:r,nonce:a,pers:o.pers,persEnc:o.persEnc||"utf8"})),c=this.n.sub(new n(1)),l=0;;l++){var f=o.k?o.k(l):new n(u.generate(this.n.byteLength()));if(!((f=this._truncateToN(f,!0)).cmpn(1)<=0||0<=f.cmp(c))){var d=this.g.mul(f);if(!d.isInfinity()){var p=d.getX(),y=p.umod(this.n);if(0!==y.cmpn(0)&&0!==(f=(f=f.invm(this.n).mul(y.mul(e.getPrivate()).iadd(t))).umod(this.n)).cmpn(0))return p=(d.getY().isOdd()?1:0)|(0!==p.cmp(y)?2:0),o.canonical&&0<f.cmp(this.nh)&&(f=this.n.sub(f),p^=1),new h({r:y,s:f,recoveryParam:p})}}}},f.prototype.verify=function(t,e,r,i){return t=this._truncateToN(new n(t,16)),r=this.keyFromPublic(r,i),i=(e=new h(e,"hex")).r,e=e.s,!(i.cmpn(1)<0||0<=i.cmp(this.n))&&(!(e.cmpn(1)<0||0<=e.cmp(this.n))&&(t=(e=e.invm(this.n)).mul(t).umod(this.n),e=e.mul(i).umod(this.n),this.curve._maxwellTrick?!(o=this.g.jmulAdd(t,r.getPublic(),e)).isInfinity()&&o.eqXToP(i):!(o=this.g.mulAdd(t,r.getPublic(),e)).isInfinity()&&0===o.getX().umod(this.n).cmp(i)));var o},f.prototype.recoverPubKey=function(t,e,r,i){c((3&r)===r,"The recovery param is more than two bits"),e=new h(e,i);var o=this.n,a=new n(t),s=e.r;if(i=e.s,t=1&r,r>>=1,0<=s.cmp(this.curve.p.umod(this.curve.n))&&r)throw new Error("Unable to find sencond key candinate");return s=r?this.curve.pointFromX(s.add(this.curve.n),t):this.curve.pointFromX(s,t),e=e.r.invm(o),a=o.sub(a).mul(e).umod(o),o=i.mul(e).umod(o),this.g.mulAdd(a,s,o)},f.prototype.getKeyRecoveryParam=function(t,e,r,n){if(null!==(e=new h(e,n)).recoveryParam)return e.recoveryParam;for(var i,o=0;o<4;o++){try{i=this.recoverPubKey(t,e,o)}catch(t){continue}if(i.eq(r))return o}throw new Error("Unable to find valid recovery factor")}},{"../curves":18,"../utils":24,"./key":20,"./signature":21,"bn.js":9,brorand:10,"hmac-drbg":38}],20:[function(t,e,r){"use strict";var n=t("bn.js"),i=t("../utils").assert;function o(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}(e.exports=o).fromPublic=function(t,e,r){return e instanceof o?e:new o(t,{pub:e,pubEnc:r})},o.fromPrivate=function(t,e,r){return e instanceof o?e:new o(t,{priv:e,privEnc:r})},o.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(t,e){return"string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},o.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(t,e){this.priv=new n(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?i(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},o.prototype.derive=function(t){return t.validate()||i(t.validate(),"public point not validated"),t.mul(this.priv).getX()},o.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},o.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},o.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}},{"../utils":24,"bn.js":9}],21:[function(t,e,r){"use strict";var n=t("bn.js"),i=t("../utils"),o=i.assert;function a(t,e){if(t instanceof a)return t;this._importDER(t,e)||(o(t.r&&t.s,"Signature without r or s"),this.r=new n(t.r,16),this.s=new n(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function s(){this.place=0}function u(t,e){var r=t[e.place++];if(!(128&r))return r;var n=15&r;if(0==n||4<n)return!1;for(var i=0,o=0,a=e.place;o<n;o++,a++)i<<=8,i|=t[a],i>>>=0;return!(i<=127)&&(e.place=a,i)}function c(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e<r;)e++;return 0===e?t:t.slice(e)}function l(t,e){if(e<128)t.push(e);else{var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}(e.exports=a).prototype._importDER=function(t,e){t=i.toArray(t,e);var r=new s;if(48!==t[r.place++])return!1;var o=u(t,r);if(!1===o)return!1;if(o+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;if(!1===(e=u(t,r)))return!1;if(o=t.slice(r.place,e+r.place),r.place+=e,2!==t[r.place++])return!1;if(!1===(e=u(t,r)))return!1;if(t.length!==e+r.place)return!1;if(r=t.slice(r.place,e+r.place),0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===r[0]){if(!(128&r[1]))return!1;r=r.slice(1)}return this.r=new n(o),this.s=new n(r),!(this.recoveryParam=null)},a.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=c(e),r=c(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];return l(n,e.length),(n=n.concat(e)).push(2),l(n,r.length),e=n.concat(r),l(n=[48],e.length),n=n.concat(e),i.encode(n,t)}},{"../utils":24,"bn.js":9}],22:[function(t,e,r){arguments[4][14][0].apply(r,arguments)},{dup:14}],23:[function(t,e,r){e.exports=void 0},{}],24:[function(t,e,r){"use strict";var n=r,i=t("bn.js");r=t("minimalistic-assert"),t=t("minimalistic-crypto-utils"),n.assert=r,n.toArray=t.toArray,n.zero2=t.zero2,n.toHex=t.toHex,n.encode=t.encode,n.getNAF=function(t,e,r){var n=new Array(Math.max(t.bitLength(),r)+1);n.fill(0);for(var i=1<<e+1,o=t.clone(),a=0;a<n.length;a++){var s,u=o.andln(i-1);o.isOdd()?o.isubn(s=(i>>1)-1<u?(i>>1)-u:u):s=0,n[a]=s,o.iushrn(1)}return n},n.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n,i=0,o=0;0<t.cmpn(-i)||0<e.cmpn(-o);){var a,s=t.andln(3)+i&3,u=e.andln(3)+o&3;3===u&&(u=-1),a=0==(1&(s=3===s?-1:s))?0:3!=(n=t.andln(7)+i&7)&&5!==n||2!==u?s:-s,r[0].push(a),u=0==(1&u)?0:3!=(n=e.andln(7)+o&7)&&5!==n||2!==s?u:-u,r[1].push(u),2*i===a+1&&(i=1-i),2*o===u+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return r},n.cachedProperty=function(t,e,r){var n="_"+e;t.prototype[e]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},n.parseBytes=function(t){return"string"==typeof t?n.toArray(t,"hex"):t},n.intFromLE=function(t){return new i(t,"hex","le")}},{"bn.js":9,"minimalistic-assert":41,"minimalistic-crypto-utils":42}],25:[function(t,e,r){e.exports={version:"6.5.4"}},{}],26:[function(t,e,r){r.utils=t("./hash/utils"),r.common=t("./hash/common"),r.sha=t("./hash/sha"),r.ripemd=t("./hash/ripemd"),r.hmac=t("./hash/hmac"),r.sha1=r.sha.sha1,r.sha256=r.sha.sha256,r.sha224=r.sha.sha224,r.sha384=r.sha.sha384,r.sha512=r.sha.sha512,r.ripemd160=r.ripemd.ripemd160},{"./hash/common":27,"./hash/hmac":28,"./hash/ripemd":29,"./hash/sha":30,"./hash/utils":37}],27:[function(t,e,r){"use strict";var n=t("./utils"),i=t("minimalistic-assert");function o(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}(r.BlockHash=o).prototype.update=function(t,e){if(t=n.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){e=(t=this.pending).length%this._delta8,this.pending=t.slice(t.length-e,t.length),0===this.pending.length&&(this.pending=null),t=n.join32(t,0,t.length-e,this.endian);for(var r=0;r<t.length;r+=this._delta32)this._update(t,r,r+this._delta32)}return this},o.prototype.digest=function(t){return this.update(this._pad()),i(null===this.pending),this._digest(t)},o.prototype._pad=function(){var t=this.pendingTotal,e=this._delta8,r=e-(t+this.padLength)%e,n=new Array(r+this.padLength);n[0]=128;for(var i=1;i<r;i++)n[i]=0;if(t<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)n[i++]=0;n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=t>>>24&255,n[i++]=t>>>16&255,n[i++]=t>>>8&255,n[i++]=255&t}else for(n[i++]=255&t,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;o<this.padLength;o++)n[i++]=0;return n}},{"./utils":37,"minimalistic-assert":41}],28:[function(t,e,r){"use strict";var n=t("./utils"),i=t("minimalistic-assert");function o(t,e,r){if(!(this instanceof o))return new o(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(n.toArray(e,r))}(e.exports=o).prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),i(t.length<=this.blockSize);for(var e=t.length;e<this.blockSize;e++)t.push(0);for(e=0;e<t.length;e++)t[e]^=54;for(this.inner=(new this.Hash).update(t),e=0;e<t.length;e++)t[e]^=106;this.outer=(new this.Hash).update(t)},o.prototype.update=function(t,e){return this.inner.update(t,e),this},o.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)}},{"./utils":37,"minimalistic-assert":41}],29:[function(t,e,r){"use strict";var n=t("./utils"),i=(t=t("./common"),n.rotl32),o=n.sum32,a=n.sum32_3,s=n.sum32_4,u=t.BlockHash;function c(){if(!(this instanceof c))return new c;u.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function l(t,e,r,n){return t<=15?e^r^n:t<=31?e&r|~e&n:t<=47?(e|~r)^n:t<=63?e&n|r&~n:e^(r|~n)}n.inherits(c,u),(r.ripemd160=c).blockSize=512,c.outSize=160,c.hmacStrength=192,c.padLength=64,c.prototype._update=function(t,e){for(var r,n=b=this.h[0],u=x=this.h[1],c=k=this.h[2],y=_=this.h[3],m=w=this.h[4],v=0;v<80;v++){var g=o(i(s(b,l(v,x,k,_),t[h[v]+e],(r=v)<=15?0:r<=31?1518500249:r<=47?1859775393:r<=63?2400959708:2840853838),d[v]),w),b=w,w=_,_=i(k,10),k=x,x=g;g=o(i(s(n,l(79-v,u,c,y),t[f[v]+e],(r=v)<=15?1352829926:r<=31?1548603684:r<=47?1836072691:r<=63?2053994217:0),p[v]),m),n=m,m=y,y=i(c,10),c=u,u=g}g=a(this.h[1],k,y),this.h[1]=a(this.h[2],_,m),this.h[2]=a(this.h[3],w,n),this.h[3]=a(this.h[4],b,u),this.h[4]=a(this.h[0],x,c),this.h[0]=g},c.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"little"):n.split32(this.h,"little")};var h=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],f=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],d=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],p=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},{"./common":27,"./utils":37}],30:[function(t,e,r){"use strict";r.sha1=t("./sha/1"),r.sha224=t("./sha/224"),r.sha256=t("./sha/256"),r.sha384=t("./sha/384"),r.sha512=t("./sha/512")},{"./sha/1":31,"./sha/224":32,"./sha/256":33,"./sha/384":34,"./sha/512":35}],31:[function(t,e,r){arguments[4][14][0].apply(r,arguments)},{dup:14}],32:[function(t,e,r){arguments[4][14][0].apply(r,arguments)},{dup:14}],33:[function(t,e,r){"use strict";var n=t("../utils"),i=t("../common"),o=t("./common"),a=t("minimalistic-assert"),s=n.sum32,u=n.sum32_4,c=n.sum32_5,l=o.ch32,h=o.maj32,f=o.s0_256,d=o.s1_256,p=o.g0_256,y=o.g1_256,m=i.BlockHash,v=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function g(){if(!(this instanceof g))return new g;m.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=v,this.W=new Array(64)}n.inherits(g,m),(e.exports=g).blockSize=512,g.outSize=256,g.hmacStrength=192,g.padLength=64,g.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;n<r.length;n++)r[n]=u(y(r[n-2]),r[n-7],p(r[n-15]),r[n-16]);var i=this.h[0],o=this.h[1],m=this.h[2],v=this.h[3],g=this.h[4],b=this.h[5],w=this.h[6],_=this.h[7];for(a(this.k.length===r.length),n=0;n<r.length;n++){var k=c(_,d(g),l(g,b,w),this.k[n],r[n]),x=s(f(i),h(i,o,m));_=w,w=b,b=g,g=s(v,k),v=m,m=o,o=i,i=s(k,x)}this.h[0]=s(this.h[0],i),this.h[1]=s(this.h[1],o),this.h[2]=s(this.h[2],m),this.h[3]=s(this.h[3],v),this.h[4]=s(this.h[4],g),this.h[5]=s(this.h[5],b),this.h[6]=s(this.h[6],w),this.h[7]=s(this.h[7],_)},g.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},{"../common":27,"../utils":37,"./common":36,"minimalistic-assert":41}],34:[function(t,e,r){arguments[4][14][0].apply(r,arguments)},{dup:14}],35:[function(t,e,r){"use strict";var n=t("../utils"),i=t("../common"),o=t("minimalistic-assert"),a=n.rotr64_hi,s=n.rotr64_lo,u=n.shr64_hi,c=n.shr64_lo,l=n.sum64,h=n.sum64_hi,f=n.sum64_lo,d=n.sum64_4_hi,p=n.sum64_4_lo,y=n.sum64_5_hi,m=n.sum64_5_lo,v=i.BlockHash,g=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function b(){if(!(this instanceof b))return new b;v.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=g,this.W=new Array(160)}n.inherits(b,v),(e.exports=b).blockSize=1024,b.outSize=512,b.hmacStrength=192,b.padLength=128,b.prototype._prepareBlock=function(t,e){for(var r=this.W,n=0;n<32;n++)r[n]=t[e+n];for(;n<r.length;n+=2){var i=function(t,e){return(e=a(t,e,19)^a(e,t,29)^(e=u(t,e,6)))<0&&(e+=4294967296),e}(r[n-4],r[n-3]),o=function(t,e){return(e=s(t,e,19)^s(e,t,29)^(e=c(t,e,6)))<0&&(e+=4294967296),e}(r[n-4],r[n-3]),l=r[n-14],h=r[n-13],f=function(t,e){return(e=a(t,e,1)^a(t,e,8)^(e=u(t,e,7)))<0&&(e+=4294967296),e}(r[n-30],r[n-29]),y=function(t,e){return(e=s(t,e,1)^s(t,e,8)^(e=c(t,e,7)))<0&&(e+=4294967296),e}(r[n-30],r[n-29]),m=r[n-32],v=r[n-31];r[n]=d(i,o,l,h,f,y,m,v),r[n+1]=p(i,o,l,h,f,y,m,v)}},b.prototype._update=function(t,e){this._prepareBlock(t,e);var r=this.W,n=this.h[0],i=this.h[1],u=this.h[2],c=this.h[3],d=this.h[4],p=this.h[5],v=this.h[6],g=this.h[7],b=this.h[8],w=this.h[9],_=this.h[10],k=this.h[11],x=this.h[12],A=this.h[13],I=this.h[14],E=this.h[15];o(this.k.length===r.length);for(var S=0;S<r.length;S+=2){var M=I,T=E,P=function(t,e){return(t=a(t,e,14)^a(t,e,18)^(t=a(e,t,9)))<0&&(t+=4294967296),t}(b,w),C=function(t,e){return(t=s(t,e,14)^s(t,e,18)^(t=s(e,t,9)))<0&&(t+=4294967296),t}(b,w),O=function(t,e,r){return(r=t&e^~t&r)<0&&(r+=4294967296),r}(b,_,x),R=function(t,e,r){return(r=t&e^~t&r)<0&&(r+=4294967296),r}(w,k,A),j=this.k[S],N=this.k[S+1],L=r[S],U=r[S+1],D=y(M,T,P,C,O,R,j,N,L,U);L=m(M,T,P,C,O,R,j,N,L,U),M=function(t,e){return(t=a(t,e,28)^a(e,t,2)^(t=a(e,t,7)))<0&&(t+=4294967296),t}(n,i),T=function(t,e){return(t=s(t,e,28)^s(e,t,2)^(t=s(e,t,7)))<0&&(t+=4294967296),t}(n,i),P=function(t,e,r){return(r=t&e^t&r^e&r)<0&&(r+=4294967296),r}(n,u,d),C=function(t,e,r){return(r=t&e^t&r^e&r)<0&&(r+=4294967296),r}(i,c,p),U=h(M,T,P,C),C=f(M,T,P,C),I=x,E=A,x=_,A=k,_=b,k=w,b=h(v,g,D,L),w=f(g,g,D,L),v=d,g=p,d=u,p=c,u=n,c=i,n=h(D,L,U,C),i=f(D,L,U,C)}l(this.h,0,n,i),l(this.h,2,u,c),l(this.h,4,d,p),l(this.h,6,v,g),l(this.h,8,b,w),l(this.h,10,_,k),l(this.h,12,x,A),l(this.h,14,I,E)},b.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},{"../common":27,"../utils":37,"minimalistic-assert":41}],36:[function(t,e,r){"use strict";var n=t("../utils").rotr32;function i(t,e,r){return t&e^~t&r}function o(t,e,r){return t&e^t&r^e&r}r.ft_1=function(t,e,r,n){return 0===t?i(e,r,n):1===t||3===t?e^r^n:2===t?o(e,r,n):void 0},r.ch32=i,r.maj32=o,r.p32=function(t,e,r){return t^e^r},r.s0_256=function(t){return n(t,2)^n(t,13)^n(t,22)},r.s1_256=function(t){return n(t,6)^n(t,11)^n(t,25)},r.g0_256=function(t){return n(t,7)^n(t,18)^t>>>3},r.g1_256=function(t){return n(t,17)^n(t,19)^t>>>10}},{"../utils":37}],37:[function(t,e,r){"use strict";var n=t("minimalistic-assert");function i(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function o(t){return 1===t.length?"0"+t:t}function a(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}t=t("inherits"),r.inherits=t,r.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),n=0;n<t.length;n+=2)r.push(parseInt(t[n]+t[n+1],16))}else for(var n=0;n<t.length;n++){var i=(o=t.charCodeAt(n))>>8,o=255&o;i?r.push(i,o):r.push(o)}else for(n=0;n<t.length;n++)r[n]=0|t[n];return r},r.toHex=function(t){for(var e="",r=0;r<t.length;r++)e+=o(t[r].toString(16));return e},r.htonl=i,r.toHex32=function(t,e){for(var r="",n=0;n<t.length;n++){var o=t[n];r+=a((o="little"===e?i(o):o).toString(16))}return r},r.zero2=o,r.zero8=a,r.join32=function(t,e,r,i){n((r-=e)%4==0);for(var o=new Array(r/4),a=0,s=e;a<o.length;a++,s+=4){var u="big"===i?t[s]<<24|t[s+1]<<16|t[s+2]<<8|t[s+3]:t[s+3]<<24|t[s+2]<<16|t[s+1]<<8|t[s];o[a]=u>>>0}return o},r.split32=function(t,e){for(var r=new Array(4*t.length),n=0,i=0;n<t.length;n++,i+=4){var o=t[n];"big"===e?(r[i]=o>>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},r.rotr32=function(t,e){return t>>>e|t<<32-e},r.rotl32=function(t,e){return t<<e|t>>>32-e},r.sum32=function(t,e){return t+e>>>0},r.sum32_3=function(t,e,r){return t+e+r>>>0},r.sum32_4=function(t,e,r,n){return t+e+r+n>>>0},r.sum32_5=function(t,e,r,n,i){return t+e+r+n+i>>>0},r.sum64=function(t,e,r,n){var i=t[e],o=n+t[e+1]>>>0;t[e]=(o<n?1:0)+r+i>>>0,t[e+1]=o},r.sum64_hi=function(t,e,r,n){return(e+n>>>0<e?1:0)+t+r>>>0},r.sum64_lo=function(t,e,r,n){return e+n>>>0},r.sum64_4_hi=function(t,e,r,n,i,o,a,s){var u=0,c=e;return u+=(c=e+n>>>0)<e?1:0,u+=(c=c+o>>>0)<o?1:0,t+r+i+a+(u+=(c=c+s>>>0)<s?1:0)>>>0},r.sum64_4_lo=function(t,e,r,n,i,o,a,s){return e+n+o+s>>>0},r.sum64_5_hi=function(t,e,r,n,i,o,a,s,u,c){var l=0,h=e;return l+=(h=e+n>>>0)<e?1:0,l+=(h=h+o>>>0)<o?1:0,l+=(h=h+s>>>0)<s?1:0,t+r+i+a+u+(l+=(h=h+c>>>0)<c?1:0)>>>0},r.sum64_5_lo=function(t,e,r,n,i,o,a,s,u,c){return e+n+o+s+c>>>0},r.rotr64_hi=function(t,e,r){return(e<<32-r|t>>>r)>>>0},r.rotr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0},r.shr64_hi=function(t,e,r){return t>>>r},r.shr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0}},{inherits:39,"minimalistic-assert":41}],38:[function(t,e,r){"use strict";var n=t("hash.js"),i=t("minimalistic-crypto-utils"),o=t("minimalistic-assert");function a(t){if(!(this instanceof a))return new a(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=i.toArray(t.entropy,t.entropyEnc||"hex"),r=i.toArray(t.nonce,t.nonceEnc||"hex");t=i.toArray(t.pers,t.persEnc||"hex"),o(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,t)}(e.exports=a).prototype._init=function(t,e,r){r=t.concat(e).concat(r),this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var n=0;n<this.V.length;n++)this.K[n]=0,this.V[n]=1;this._update(r),this._reseed=1,this.reseedInterval=281474976710656},a.prototype._hmac=function(){return new n.hmac(this.hash,this.K)},a.prototype._update=function(t){var e=this._hmac().update(this.V).update([0]);t&&(e=e.update(t)),this.K=e.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},a.prototype.reseed=function(t,e,r,n){"string"!=typeof e&&(n=r,r=e,e=null),t=i.toArray(t,e),r=i.toArray(r,n),o(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},a.prototype.generate=function(t,e,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(n=r,r=e,e=null),r&&(r=i.toArray(r,n||"hex"),this._update(r));for(var o=[];o.length<t;)this.V=this._hmac().update(this.V).digest(),o=o.concat(this.V);return n=o.slice(0,t),this._update(r),this._reseed++,i.encode(n,e)}},{"hash.js":26,"minimalistic-assert":41,"minimalistic-crypto-utils":42}],39:[function(t,e,r){"function"==typeof Object.create?e.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(t,e){var r;e&&(t.super_=e,(r=function(){}).prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t)}},{}],40:[function(t,e,n){(function(t,r){(function(){!function(){"use strict";for(var n="object"==("undefined"==typeof window?"undefined":s(window))?window:{},i=!(n=!n.JS_SHA3_NO_NODE_JS&&"object"==s(t)&&t.versions&&t.versions.node?r:n).JS_SHA3_NO_COMMON_JS&&"object"==s(e)&&e.exports,o="0123456789abcdef".split(""),a=[0,8,16,24],u=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],c=[224,256,384,512],l=["hex","buffer","arrayBuffer","array"],h=function(t,e,r){return function(n){return new k(t,e,t).update(n)[r]()}},f=function(t,e,r){return function(n,i){return new k(t,e,i).update(n)[r]()}},d=function(t,e){var r=h(t,e,"hex");r.create=function(){return new k(t,e,t)},r.update=function(t){return r.create().update(t)};for(var n=0;n<l.length;++n){var i=l[n];r[i]=h(t,e,i)}return r},p=[{name:"keccak",padding:[1,256,65536,16777216],bits:c,createMethod:d},{name:"sha3",padding:[6,1536,393216,100663296],bits:c,createMethod:d},{name:"shake",padding:[31,7936,2031616,520093696],bits:[128,256],createMethod:function(t,e){var r=f(t,e,"hex");r.create=function(r){return new k(t,e,r)},r.update=function(t,e){return r.create(e).update(t)};for(var n=0;n<l.length;++n){var i=l[n];r[i]=f(t,e,i)}return r}}],y={},m=[],v=0;v<p.length;++v)for(var g=p[v],b=g.bits,w=0;w<b.length;++w){var _=g.name+"_"+b[w];m.push(_),y[_]=g.createMethod(b[w],g.padding)}function k(t,e,r){this.blocks=[],this.s=[],this.padding=e,this.outputBits=r,this.reset=!0,this.block=0,this.start=0,this.blockCount=1600-(t<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}k.prototype.update=function(t){for(var e,r,n="string"!=typeof t,i=(t=n&&t.constructor===ArrayBuffer?new Uint8Array(t):t).length,o=this.blocks,s=this.byteCount,u=this.blockCount,c=0,l=this.s;c<i;){if(this.reset)for(this.reset=!1,o[0]=this.block,e=1;e<u+1;++e)o[e]=0;if(n)for(e=this.start;c<i&&e<s;++c)o[e>>2]|=t[c]<<a[3&e++];else for(e=this.start;c<i&&e<s;++c)(r=t.charCodeAt(c))<128?o[e>>2]|=r<<a[3&e++]:(r<2048?o[e>>2]|=(192|r>>6)<<a[3&e++]:(r<55296||57344<=r?o[e>>2]|=(224|r>>12)<<a[3&e++]:(r=65536+((1023&r)<<10|1023&t.charCodeAt(++c)),o[e>>2]|=(240|r>>18)<<a[3&e++],o[e>>2]|=(128|r>>12&63)<<a[3&e++]),o[e>>2]|=(128|r>>6&63)<<a[3&e++]),o[e>>2]|=(128|63&r)<<a[3&e++]);if(s<=(this.lastByteIndex=e)){for(this.start=e-s,this.block=o[u],e=0;e<u;++e)l[e]^=o[e];x(l),this.reset=!0}else this.start=e}return this},k.prototype.finalize=function(){var t=this.blocks,e=this.lastByteIndex,r=this.blockCount,n=this.s;if(t[e>>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[r],e=1;e<r+1;++e)t[e]=0;for(t[r-1]|=2147483648,e=0;e<r;++e)n[e]^=t[e];x(n)},k.prototype.toString=k.prototype.hex=function(){this.finalize();for(var t,e=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,a=0,s=0,u="";s<n;){for(a=0;a<e&&s<n;++a,++s)t=r[a],u+=o[t>>4&15]+o[15&t]+o[t>>12&15]+o[t>>8&15]+o[t>>20&15]+o[t>>16&15]+o[t>>28&15]+o[t>>24&15];s%e==0&&(x(r),a=0)}return i&&(t=r[a],0<i&&(u+=o[t>>4&15]+o[15&t]),1<i&&(u+=o[t>>12&15]+o[t>>8&15]),2<i&&(u+=o[t>>20&15]+o[t>>16&15])),u},k.prototype.arrayBuffer=function(){this.finalize();for(var t=this.blockCount,e=this.s,r=this.outputBlocks,n=this.extraBytes,i=0,o=0,a=this.outputBits>>3,s=n?new ArrayBuffer(r+1<<2):new ArrayBuffer(a),u=new Uint32Array(s);o<r;){for(i=0;i<t&&o<r;++i,++o)u[o]=e[i];o%t==0&&x(e)}return n&&(u[i]=e[i],s=s.slice(0,a)),s},k.prototype.buffer=k.prototype.arrayBuffer,k.prototype.digest=k.prototype.array=function(){this.finalize();for(var t,e,r=this.blockCount,n=this.s,i=this.outputBlocks,o=this.extraBytes,a=0,s=0,u=[];s<i;){for(a=0;a<r&&s<i;++a,++s)e=n[a],u[t=s<<2]=255&e,u[t+1]=e>>8&255,u[t+2]=e>>16&255,u[t+3]=e>>24&255;s%r==0&&x(n)}return o&&(t=s<<2,e=n[a],0<o&&(u[t]=255&e),1<o&&(u[t+1]=e>>8&255),2<o&&(u[t+2]=e>>16&255)),u};var x=function(t){for(var e,r,n,i,o,a,s,c,l,h,f,d,p,y,m,v,g,b,w,_,k,x,A,I,E,S,M,T,P,C,O,R,j,N,L,U,D,B,z,H,F,q,G,V,K,Z,W,J,Q,Y,$=0;$<48;$+=2)M=t[0]^t[10]^t[20]^t[30]^t[40],T=t[1]^t[11]^t[21]^t[31]^t[41],H=t[2]^t[12]^t[22]^t[32]^t[42],z=t[3]^t[13]^t[23]^t[33]^t[43],R=t[4]^t[14]^t[24]^t[34]^t[44],O=t[5]^t[15]^t[25]^t[35]^t[45],Z=t[6]^t[16]^t[26]^t[36]^t[46],K=t[7]^t[17]^t[27]^t[37]^t[47],p=t[8]^t[18]^t[28]^t[38]^t[48],h=(y=t[9]^t[19]^t[29]^t[39]^t[49])^(z<<1|H>>>31),t[0]^=l=p^(H<<1|z>>>31),t[1]^=h,t[10]^=l,t[11]^=h,t[20]^=l,t[21]^=h,t[30]^=l,t[31]^=h,t[40]^=l,t[41]^=h,h=T^(O<<1|R>>>31),t[2]^=l=M^(R<<1|O>>>31),t[3]^=h,t[12]^=l,t[13]^=h,t[22]^=l,t[23]^=h,t[32]^=l,t[33]^=h,t[42]^=l,t[43]^=h,h=z^(K<<1|Z>>>31),t[4]^=l=H^(Z<<1|K>>>31),t[5]^=h,t[14]^=l,t[15]^=h,t[24]^=l,t[25]^=h,t[34]^=l,t[35]^=h,t[44]^=l,t[45]^=h,h=O^(y<<1|p>>>31),t[6]^=l=R^(p<<1|y>>>31),t[7]^=h,t[16]^=l,t[17]^=h,t[26]^=l,t[27]^=h,t[36]^=l,t[37]^=h,t[46]^=l,t[47]^=h,h=K^(T<<1|M>>>31),t[8]^=l=Z^(M<<1|T>>>31),t[9]^=h,t[18]^=l,t[19]^=h,t[28]^=l,t[29]^=h,t[38]^=l,t[39]^=h,t[48]^=l,t[49]^=h,e=t[0],r=t[1],j=t[11]<<4|t[10]>>>28,N=t[10]<<4|t[11]>>>28,m=t[20]<<3|t[21]>>>29,v=t[21]<<3|t[20]>>>29,W=t[31]<<9|t[30]>>>23,J=t[30]<<9|t[31]>>>23,P=t[40]<<18|t[41]>>>14,C=t[41]<<18|t[40]>>>14,k=t[2]<<1|t[3]>>>31,x=t[3]<<1|t[2]>>>31,n=t[13]<<12|t[12]>>>20,i=t[12]<<12|t[13]>>>20,L=t[22]<<10|t[23]>>>22,U=t[23]<<10|t[22]>>>22,g=t[33]<<13|t[32]>>>19,b=t[32]<<13|t[33]>>>19,Q=t[42]<<2|t[43]>>>30,Y=t[43]<<2|t[42]>>>30,F=t[5]<<30|t[4]>>>2,q=t[4]<<30|t[5]>>>2,A=t[14]<<6|t[15]>>>26,I=t[15]<<6|t[14]>>>26,o=t[25]<<11|t[24]>>>21,a=t[24]<<11|t[25]>>>21,D=t[34]<<15|t[35]>>>17,B=t[35]<<15|t[34]>>>17,w=t[45]<<29|t[44]>>>3,_=t[44]<<29|t[45]>>>3,f=t[6]<<28|t[7]>>>4,d=t[7]<<28|t[6]>>>4,G=t[17]<<23|t[16]>>>9,V=t[16]<<23|t[17]>>>9,E=t[26]<<25|t[27]>>>7,S=t[27]<<25|t[26]>>>7,s=t[36]<<21|t[37]>>>11,c=t[37]<<21|t[36]>>>11,z=t[47]<<24|t[46]>>>8,H=t[46]<<24|t[47]>>>8,O=t[8]<<27|t[9]>>>5,R=t[9]<<27|t[8]>>>5,p=t[18]<<20|t[19]>>>12,y=t[19]<<20|t[18]>>>12,K=t[29]<<7|t[28]>>>25,Z=t[28]<<7|t[29]>>>25,M=t[38]<<8|t[39]>>>24,T=t[39]<<8|t[38]>>>24,l=t[48]<<14|t[49]>>>18,h=t[49]<<14|t[48]>>>18,t[0]=e^~n&o,t[1]=r^~i&a,t[10]=f^~p&m,t[11]=d^~y&v,t[20]=k^~A&E,t[21]=x^~I&S,t[30]=O^~j&L,t[31]=R^~N&U,t[40]=F^~G&K,t[41]=q^~V&Z,t[2]=n^~o&s,t[3]=i^~a&c,t[12]=p^~m&g,t[13]=y^~v&b,t[22]=A^~E&M,t[23]=I^~S&T,t[32]=j^~L&D,t[33]=N^~U&B,t[42]=G^~K&W,t[43]=V^~Z&J,t[4]=o^~s&l,t[5]=a^~c&h,t[14]=m^~g&w,t[15]=v^~b&_,t[24]=E^~M&P,t[25]=S^~T&C,t[34]=L^~D&z,t[35]=U^~B&H,t[44]=K^~W&Q,t[45]=Z^~J&Y,t[6]=s^~l&e,t[7]=c^~h&r,t[16]=g^~w&f,t[17]=b^~_&d,t[26]=M^~P&k,t[27]=T^~C&x,t[36]=D^~z&O,t[37]=B^~H&R,t[46]=W^~Q&F,t[47]=J^~Y&q,t[8]=l^~e&n,t[9]=h^~r&i,t[18]=w^~f&p,t[19]=_^~d&y,t[28]=P^~k&A,t[29]=C^~x&I,t[38]=z^~O&j,t[39]=H^~R&N,t[48]=Q^~F&G,t[49]=Y^~q&V,t[0]^=u[$],t[1]^=u[$+1]};if(i)e.exports=y;else for(v=0;v<m.length;++v)n[m[v]]=y[m[v]]}()}).call(this)}).call(this,t("_process"),void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:43}],41:[function(t,e,r){(e.exports=function(t,e){if(!t)throw new Error(e||"Assertion failed")}).equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)}},{}],42:[function(t,e,r){"use strict";function n(t){return 1===t.length?"0"+t:t}function i(t){for(var e="",r=0;r<t.length;r++)e+=n(t[r].toString(16));return e}r.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"!=typeof t){for(var n=0;n<t.length;n++)r[n]=0|t[n];return r}if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),n=0;n<t.length;n+=2)r.push(parseInt(t[n]+t[n+1],16));else for(n=0;n<t.length;n++){var i=(o=t.charCodeAt(n))>>8,o=255&o;i?r.push(i,o):r.push(o)}return r},r.zero2=n,r.toHex=i,r.encode=function(t,e){return"hex"===e?i(t):t}},{}],43:[function(t,e,r){e.exports={browser:!0}},{}],44:[function(t,e,r){(function(t){(function(){"use strict";function n(t){var e=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],r=1779033703,n=3144134277,i=1013904242,o=2773480762,a=1359893119,s=2600822924,u=528734635,c=1541459225,l=new Array(64);function h(t){for(var h=0,f=t.length;64<=f;){for(var d,p,y,m,v=r,g=n,b=i,w=o,_=a,k=s,x=u,A=c,I=0;I<16;I++)l[I]=(255&t[p=h+4*I])<<24|(255&t[p+1])<<16|(255&t[p+2])<<8|255&t[p+3];for(I=16;I<64;I++)y=((d=l[I-2])>>>17|d<<15)^(d>>>19|d<<13)^d>>>10,d=l[I-15],l[I]=(y+l[I-7]|0)+((m=(d>>>7|d<<25)^(d>>>18|d<<14)^d>>>3)+l[I-16]|0)|0;for(I=0;I<64;I++)y=(((_>>>6|_<<26)^(_>>>11|_<<21)^(_>>>25|_<<7))+(_&k^~_&x)|0)+(A+(e[I]+l[I]|0)|0)|0,m=((v>>>2|v<<30)^(v>>>13|v<<19)^(v>>>22|v<<10))+(v&g^v&b^g&b)|0,A=x,x=k,k=_,_=w+y|0,w=b,b=g,g=v,v=y+m|0;r=r+v|0,n=n+g|0,i=i+b|0,o=o+w|0,a=a+_|0,s=s+k|0,u=u+x|0,c=c+A|0,h+=64,f-=64}}h(t);var f,d=t.length%64,p=t.length/536870912|0,y=t.length<<3,m=d<56?56:120,v=t.slice(t.length-d,t.length);for(v.push(128),f=1+d;f<m;f++)v.push(0);return v.push(p>>>24&255),v.push(p>>>16&255),v.push(p>>>8&255),v.push(p>>>0&255),v.push(y>>>24&255),v.push(y>>>16&255),v.push(y>>>8&255),v.push(y>>>0&255),h(v),[r>>>24&255,r>>>16&255,r>>>8&255,r>>>0&255,n>>>24&255,n>>>16&255,n>>>8&255,n>>>0&255,i>>>24&255,i>>>16&255,i>>>8&255,i>>>0&255,o>>>24&255,o>>>16&255,o>>>8&255,o>>>0&255,a>>>24&255,a>>>16&255,a>>>8&255,a>>>0&255,s>>>24&255,s>>>16&255,s>>>8&255,s>>>0&255,u>>>24&255,u>>>16&255,u>>>8&255,u>>>0&255,c>>>24&255,c>>>16&255,c>>>8&255,c>>>0&255]}function i(t,e,r){t=t.length<=64?t:n(t);for(var i=64+e.length+4,o=new Array(i),a=new Array(64),s=[],u=0;u<64;u++)o[u]=54;for(u=0;u<t.length;u++)o[u]^=t[u];for(u=0;u<e.length;u++)o[64+u]=e[u];for(u=i-4;u<i;u++)o[u]=0;for(u=0;u<64;u++)a[u]=92;for(u=0;u<t.length;u++)a[u]^=t[u];function c(){for(var t=i-1;i-4<=t;t--){if(o[t]++,o[t]<=255)return;o[t]=0}}for(;32<=r;)c(),s=s.concat(n(a.concat(n(o)))),r-=32;return 0<r&&(c(),s=s.concat(n(a.concat(n(o))).slice(0,r))),s}function o(t,e,r,n,i){var o;for(u(t,16*(2*r-1),i,0,16),o=0;o<2*r;o++)s(t,16*o,i,16),function(t,e){u(t,0,e,0,16);for(var r=8;0<r;r-=2)e[4]^=a(e[0]+e[12],7),e[8]^=a(e[4]+e[0],9),e[12]^=a(e[8]+e[4],13),e[0]^=a(e[12]+e[8],18),e[9]^=a(e[5]+e[1],7),e[13]^=a(e[9]+e[5],9),e[1]^=a(e[13]+e[9],13),e[5]^=a(e[1]+e[13],18),e[14]^=a(e[10]+e[6],7),e[2]^=a(e[14]+e[10],9),e[6]^=a(e[2]+e[14],13),e[10]^=a(e[6]+e[2],18),e[3]^=a(e[15]+e[11],7),e[7]^=a(e[3]+e[15],9),e[11]^=a(e[7]+e[3],13),e[15]^=a(e[11]+e[7],18),e[1]^=a(e[0]+e[3],7),e[2]^=a(e[1]+e[0],9),e[3]^=a(e[2]+e[1],13),e[0]^=a(e[3]+e[2],18),e[6]^=a(e[5]+e[4],7),e[7]^=a(e[6]+e[5],9),e[4]^=a(e[7]+e[6],13),e[5]^=a(e[4]+e[7],18),e[11]^=a(e[10]+e[9],7),e[8]^=a(e[11]+e[10],9),e[9]^=a(e[8]+e[11],13),e[10]^=a(e[9]+e[8],18),e[12]^=a(e[15]+e[14],7),e[13]^=a(e[12]+e[15],9),e[14]^=a(e[13]+e[12],13),e[15]^=a(e[14]+e[13],18);for(r=0;r<16;++r)t[r]+=e[r]}(i,n),u(i,0,t,e+16*o,16);for(o=0;o<r;o++)u(t,e+2*o*16,t,16*o,16);for(o=0;o<r;o++)u(t,e+16*(2*o+1),t,16*(o+r),16)}function a(t,e){return t<<e|t>>>32-e}function s(t,e,r,n){for(var i=0;i<n;i++)r[i]^=t[e+i]}function u(t,e,r,n,i){for(;i--;)r[n++]=t[e++]}function c(t){if(t&&"number"==typeof t.length){for(var e=0;e<t.length;e++){if("number"!=typeof t[e])return;var r=parseInt(t[e]);if(r!=t[e]||r<0||256<=r)return}return 1}}function l(t,e){var r=parseInt(t);if(t!=r)throw new Error("invalid "+e);return r}function h(e,r,n,a,h,f,p){if(!p)throw new Error("missing callback");if(n=l(n,"N"),a=l(a,"r"),h=l(h,"p"),f=l(f,"dkLen"),0===n||0!=(n&n-1))throw new Error("N must be power of 2");if(d/128/a<n)throw new Error("N too large");if(d/128/h<a)throw new Error("r too large");if(!c(e))throw new Error("password must be an array or buffer");if(e=Array.prototype.slice.call(e),!c(r))throw new Error("salt must be an array or buffer");r=Array.prototype.slice.call(r);for(var y=i(e,r,128*h*a),m=new Uint32Array(32*h*a),v=0;v<m.length;v++){var g=4*v;m[v]=(255&y[3+g])<<24|(255&y[2+g])<<16|(255&y[1+g])<<8|(255&y[0+g])<<0}var b,w,_=new Uint32Array(64*a),k=new Uint32Array(32*a*n),x=32*a,A=new Uint32Array(16),I=new Uint32Array(16),E=h*n*2,S=0,M=null,T=!1,P=0,C=0,O=parseInt(1e3/a),R=void 0!==t?t:setTimeout;!function t(){if(T)return p(new Error("cancelled"),S/E);switch(P){case 0:u(m,w=32*C*a,_,0,x),P=1,b=0;case 1:O<(c=n-b)&&(c=O);for(var r=0;r<c;r++)u(_,0,k,(b+r)*x,x),o(_,x,a,A,I);if(b+=c,S+=c,(d=parseInt(1e3*S/E))!==M){if(T=p(null,S/E))break;M=d}if(b<n)break;b=0,P=2;case 2:var c;for(O<(c=n-b)&&(c=O),r=0;r<c;r++){var l=_[16*(2*a-1)]&n-1;s(k,l*x,_,x),o(_,x,a,A,I)}if(b+=c,S+=c,(d=parseInt(1e3*S/E))!==M){if(T=p(null,S/E))break;M=d}if(b<n)break;if(u(_,0,m,w,x),++C<h){P=0;break}for(y=[],r=0;r<m.length;r++)y.push(m[r]>>0&255),y.push(m[r]>>8&255),y.push(m[r]>>16&255),y.push(m[r]>>24&255);var d=i(e,y,f);return p(null,1,d)}R(t)}()}var f,d;f=this,d=2147483647,void 0!==r?e.exports=h:f&&(f.scrypt&&(f._scrypt=f.scrypt),f.scrypt=h)}).call(this)}).call(this,t("timers").setImmediate)},{timers:46}],45:[function(t,e,n){(function(t,e,r){(function(){!function(e,r){"use strict";var n,i,o,a,s,u,c,l;function h(t){return i[n]=f.apply(r,t),n++}function f(t){var e=[].slice.call(arguments,1);return function(){"function"==typeof t?t.apply(r,e):new Function(""+t)()}}function d(t){if(o)setTimeout(f(d,t),0);else{var e=i[t];if(e){o=!0;try{e()}finally{p(t),o=!1}}}}function p(t){delete i[t]}e.setImmediate||(n=1,o=!(i={}),a=e.document,l=(l=Object.getPrototypeOf&&Object.getPrototypeOf(e))&&l.setTimeout?l:e,"[object process]"==={}.toString.call(e.process)?s=function(){var e=h(arguments);return t.nextTick(f(d,e)),e}:function(){if(e.postMessage&&!e.importScripts){var t=!0,r=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=r,t}}()?function(){function t(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(r)&&d(+t.data.slice(r.length))}var r="setImmediate$"+Math.random()+"$";e.addEventListener?e.addEventListener("message",t,!1):e.attachEvent("onmessage",t),s=function(){var t=h(arguments);return e.postMessage(r+t,"*"),t}}():s=e.MessageChannel?((c=new MessageChannel).port1.onmessage=function(t){d(t.data)},function(){var t=h(arguments);return c.port2.postMessage(t),t}):a&&"onreadystatechange"in a.createElement("script")?(u=a.documentElement,function(){var t=h(arguments),e=a.createElement("script");return e.onreadystatechange=function(){d(t),e.onreadystatechange=null,u.removeChild(e),e=null},u.appendChild(e),t}):function(){var t=h(arguments);return setTimeout(f(d,t),0),t},l.setImmediate=s,l.clearImmediate=p)}("undefined"==typeof self?void 0===e?this:e:self)}).call(this)}).call(this,t("_process"),void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("timers").clearImmediate)},{_process:43,timers:46}],46:[function(t,e,n){(function(t){(function(){e.exports={setImmediate:t.setImmediate}}).call(this)}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],47:[function(t,e,n){(function(t){(function(){var r,n,i;t.crypto&&crypto.getRandomValues&&(r=new Uint8Array(16),n=function(){return crypto.getRandomValues(r),r}),n||(i=new Array(16),n=function(){for(var t,e=0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),i[e]=t>>>((3&e)<<3)&255;return i}),e.exports=n}).call(this)}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],48:[function(t,e,r){for(var n=t("./rng"),i=[],o={},a=0;a<256;a++)i[a]=(a+256).toString(16).substr(1),o[i[a]]=a;function s(t,e){return e=e||0,i[t[e++]]+i[t[e++]]+i[t[e++]]+i[t[e++]]+"-"+i[t[e++]]+i[t[e++]]+"-"+i[t[e++]]+i[t[e++]]+"-"+i[t[e++]]+i[t[e++]]+"-"+i[t[e++]]+i[t[e++]]+i[t[e++]]+i[t[e++]]+i[t[e++]]+i[t[e++]]}var u=[1|(t=n())[0],t[1],t[2],t[3],t[4],t[5]],c=16383&(t[6]<<8|t[7]),l=0,h=0;function f(t,e,r){var i=e&&r||0;"string"==typeof t&&(e="binary"==t?new Array(16):null,t=null);var o=(t=t||{}).random||(t.rng||n)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,e)for(var a=0;a<16;a++)e[i+a]=o[a];return e||s(o)}(t=f).v1=function(t,e,r){var n=e&&r||0,i=e||[],o=void 0!==(t=t||{}).clockseq?t.clockseq:c,a=void 0!==t.msecs?t.msecs:(new Date).getTime(),f=void 0!==t.nsecs?t.nsecs:h+1;if((r=a-l+(f-h)/1e4)<0&&void 0===t.clockseq&&(o=o+1&16383),1e4<=(f=(r<0||l<a)&&void 0===t.nsecs?0:f))throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");l=a,c=o,f=(1e4*(268435455&(a+=122192928e5))+(h=f))%4294967296,i[n++]=f>>>24&255,i[n++]=f>>>16&255,i[n++]=f>>>8&255,i[n++]=255&f,a=a/4294967296*1e4&268435455,i[n++]=a>>>8&255,i[n++]=255&a,i[n++]=a>>>24&15|16,i[n++]=a>>>16&255,i[n++]=o>>>8|128,i[n++]=255&o;for(var d=t.node||u,p=0;p<6;p++)i[n+p]=d[p];return e||s(i)},t.v4=f,t.parse=function(t,e,r){var n=e&&r||0,i=0;for(e=e||[],t.toLowerCase().replace(/[0-9a-f]{2}/g,(function(t){i<16&&(e[n+i++]=o[t])}));i<16;)e[n+i++]=0;return e},t.unparse=s,e.exports=t},{"./rng":47}],49:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});try{e.exports.XMLHttpRequest=XMLHttpRequest}catch(t){console.log("Warning: XMLHttpRequest is not defined"),e.exports.XMLHttpRequest=null}},{}],50:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("../utils/properties");function i(){n.setType(this,"Provider")}i.isProvider=function(t){return n.isType(t,"Provider")},t=i,r.Provider=t},{"../utils/properties":74}],51:[function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var a=t("../utils/address"),u=t("../utils/bignumber"),c=t("../utils/bytes"),l=t("../constants"),h=t("../utils/hash"),f=t("../utils/networks"),d=t("../utils/properties"),p=t("../utils/rlp"),y=t("../utils/transaction"),m=t("../utils/utf8"),v=t("../utils/web"),g=o(t("../errors")),b=t("./abstract-provider");function w(t,e){var r,n={};for(r in t)try{var i=t[r](e[r]);void 0!==i&&(n[r]=i)}catch(t){throw t.checkKey=r,t.checkValue=e[r],t}return n}function _(t,e){return function(r){return null==r?e:t(r)}}function k(t){return function(e){if(!Array.isArray(e))throw new Error("not an array");var r=[];return e.forEach((function(e){r.push(t(e))})),r}}function x(t,e){return"string"==typeof t&&(e||"0x"===t.substring(0,2)||(t="0x"+t),32===c.hexDataLength(t))?t.toLowerCase():(g.throwError("invalid hash",g.INVALID_ARGUMENT,{arg:"hash",value:t}),null)}function A(t){return u.bigNumberify(t).toNumber()}function I(t){if(!c.isHexString(t))throw new Error("invalid uint256");for(;t.length<66;)t="0x0"+t.substring(2);return t}function E(t){if(null==t)return"latest";if("earliest"===t)return"0x0";if("latest"===t||"pending"===t)return t;if("number"==typeof t)return c.hexStripZeros(c.hexlify(t));if(c.isHexString(t))return c.hexStripZeros(t);throw new Error("invalid blockTag")}var S={hash:x,blockHash:_(x,null),blockNumber:_(A,null),transactionIndex:_(A,null),confirmations:_(A,null),from:a.getAddress,gasPrice:u.bigNumberify,gasLimit:u.bigNumberify,to:_(a.getAddress,null),value:u.bigNumberify,nonce:A,data:c.hexlify,r:_(I),s:_(I),v:_(A),creates:_(a.getAddress,null),raw:_(c.hexlify)};function M(t){null!=t.gas&&null==t.gasLimit&&(t.gasLimit=t.gas),t.to&&u.bigNumberify(t.to).isZero()&&(t.to="0x0000000000000000000000000000000000000000"),null!=t.input&&null==t.data&&(t.data=t.input),null==t.to&&null==t.creates&&(t.creates=a.getContractAddress(t)),t.raw||t.v&&t.r&&t.s&&(r=[c.stripZeros(c.hexlify(t.nonce)),c.stripZeros(c.hexlify(t.gasPrice)),c.stripZeros(c.hexlify(t.gasLimit)),t.to||"0x",c.stripZeros(c.hexlify(t.value||"0x")),c.hexlify(t.data||"0x"),c.stripZeros(c.hexlify(t.v||"0x")),c.stripZeros(c.hexlify(t.r)),c.stripZeros(c.hexlify(t.s))],t.raw=p.encode(r));var e=w(S,t),r=t.networkId;return null!=t.chainId&&null==r&&null==e.v&&(r=t.chainId),"number"!=typeof(r=c.isHexString(r)?u.bigNumberify(r).toNumber():r)&&null!=e.v&&((r=(e.v-35)/2)<0&&(r=0),r=parseInt(r)),e.networkId=r="number"!=typeof r?0:r,null==e.chainId&&null!=r&&(e.chainId=r),e.blockHash&&"x"===e.blockHash.replace(/0/g,"")&&(e.blockHash=null),e}var T={hash:x,parentHash:x,number:A,timestamp:A,nonce:_(c.hexlify),difficulty:function(t){t=u.bigNumberify(t);try{return t.toNumber()}catch(t){}return null},gasLimit:u.bigNumberify,gasUsed:u.bigNumberify,miner:a.getAddress,extraData:c.hexlify,transactions:_(k(x))},P=d.shallowCopy(T);function C(t,e){return null!=t.author&&null==t.miner&&(t.miner=t.author),w(e?P:T,t)}P.transactions=_(k(M));var O={from:_(a.getAddress),nonce:_(A),gasLimit:_(u.bigNumberify),gasPrice:_(u.bigNumberify),to:_(a.getAddress),value:_(u.bigNumberify),data:_(c.hexlify)};function R(t){return w(O,t)}var j={transactionLogIndex:_(A),transactionIndex:A,blockNumber:A,transactionHash:x,address:a.getAddress,topics:k(x),data:c.hexlify,logIndex:A,blockHash:x},N={to:_(a.getAddress,null),from:_(a.getAddress,null),contractAddress:_(a.getAddress,null),transactionIndex:A,root:_(x),gasUsed:u.bigNumberify,logsBloom:_(c.hexlify),blockHash:x,transactionHash:x,logs:k((function(t){return w(j,t)})),blockNumber:A,confirmations:_(A,null),cumulativeGasUsed:u.bigNumberify,status:_(A)};function L(t){return Array.isArray(t)?t.forEach((function(t){L(t)})):null!=t&&x(t),t}var U,D,B={fromBlock:_(E,void 0),toBlock:_(E,void 0),address:_(a.getAddress,void 0),topics:_(L,void 0)},z={blockHash:_(x,void 0),address:_(a.getAddress,void 0),topics:_(L,void 0)},H={blockNumber:_(A),blockHash:_(x),transactionIndex:A,removed:_((function(t){if("boolean"==typeof t)return t;if("string"==typeof t){if("true"===t)return!0;if("false"===t)return!1}throw new Error("invaid boolean - "+t)})),address:a.getAddress,data:(U=c.hexlify,function(t){return t?U(t):"0x"}),topics:k(x),transactionHash:x,logIndex:A};function F(t){return w(H,t)}function q(t){return t.map((function(t){return"string"==typeof t?t:Array.isArray(t)?(t.forEach((function(t){null!==t&&32!==c.hexDataLength(t)&&g.throwError("invalid topic",g.INVALID_ARGUMENT,{argument:"topic",value:t})})),t.join(",")):null===t?"":g.throwError("invalid topic value",g.INVALID_ARGUMENT,{argument:"topic",value:t})})).join("&")}function G(t){if("string"==typeof t){if(20===c.hexDataLength(t))return"address:"+a.getAddress(t);if(t=t.toLowerCase(),32===c.hexDataLength(t))return"tx:"+t;if(-1===t.indexOf(":"))return t}else{if(Array.isArray(t))return"filter::"+q(t);if(t&&"object"==s(t))return"filter:"+(t.address||"")+":"+q(t.topics||[])}throw new Error("invalid event - "+t)}function V(){return(new Date).getTime()}function K(t){var e,r=D.call(this)||this;return g.checkNew(r,b.Provider),t instanceof Promise?(d.defineReadOnly(r,"ready",t.then((function(t){return d.defineReadOnly(r,"_network",t),t}))),r.ready.catch((function(t){}))):(e=f.getNetwork(null==t?"homestead":t))?(d.defineReadOnly(r,"_network",e),d.defineReadOnly(r,"ready",Promise.resolve(r._network))):g.throwError("invalid network",g.INVALID_ARGUMENT,{arg:"network",value:t}),r._lastBlockNumber=-2,r._balances={},r._events=[],r._pollingInterval=4e3,r._emitted={block:-2},r._fastQueryDate=0,r}i(K,D=b.Provider),K.prototype._doPoll=function(){var t=this;this.getBlockNumber().then((function(e){if(t.polling&&(t._setFastBlockNumber(e),e!==t._lastBlockNumber)){-2===t._emitted.block&&(t._emitted.block=e-1);for(var r=t._emitted.block+1;r<=e;r++)t.emit("block",r);t._emitted.block!==e&&(t._emitted.block=e,Object.keys(t._emitted).forEach((function(r){var n;"block"===r||"pending"!==(n=t._emitted[r])&&12<e-n&&delete t._emitted[r]}))),-2===t._lastBlockNumber&&(t._lastBlockNumber=e-1);var n={},i={};return t._events.forEach((function(t){i[t.tag]=!0})),Object.keys(i).forEach((function(r){var i=r.split(":");switch(i[0]){case"tx":var o=i[1];t.getTransactionReceipt(o).then((function(e){return e&&null!=e.blockNumber&&(t._emitted["t:"+o]=e.blockNumber,t.emit(o,e)),null})).catch((function(e){t.emit("error",e)}));break;case"address":var a=i[1];t._balances[a]&&(n[a]=t._balances[a]),t.getBalance(a,"latest").then((function(e){var r=t._balances[a];if(!r||!e.eq(r))return t._balances[a]=e,t.emit(a,e),null})).catch((function(e){t.emit("error",e)}));break;case"filter":var s=i[2].split(/&/g).map((function(t){var e=t.split(",");return 1===e.length?""===e[0]?null:t:e.map((function(t){return""===t?null:t}))})),u={address:i[1],fromBlock:t._lastBlockNumber+1,toBlock:e,topics:s};u.address||delete u.address,t.getLogs(u).then((function(e){if(0!==e.length)return e.forEach((function(e){t._emitted["b:"+e.blockHash]=e.blockNumber,t._emitted["t:"+e.transactionHash]=e.blockNumber,t.emit(u,e)})),null})).catch((function(e){t.emit("error",e)}))}})),t._lastBlockNumber=e,t._balances=n,null}})).catch((function(t){})),this.doPoll()},K.prototype.resetEventsBlock=function(t){this._lastBlockNumber=t-1,this.polling&&this._doPoll()},Object.defineProperty(K.prototype,"network",{get:function(){return this._network},enumerable:!0,configurable:!0}),K.prototype.getNetwork=function(){return this.ready},Object.defineProperty(K.prototype,"blockNumber",{get:function(){return this._fastBlockNumber},enumerable:!0,configurable:!0}),Object.defineProperty(K.prototype,"polling",{get:function(){return null!=this._poller},set:function(t){var e=this;setTimeout((function(){t&&!e._poller?(e._poller=setInterval(e._doPoll.bind(e),e.pollingInterval),e._doPoll()):!t&&e._poller&&(clearInterval(e._poller),e._poller=null)}),0)},enumerable:!0,configurable:!0}),Object.defineProperty(K.prototype,"pollingInterval",{get:function(){return this._pollingInterval},set:function(t){var e=this;if("number"!=typeof t||t<=0||parseInt(String(t))!=t)throw new Error("invalid polling interval");this._pollingInterval=t,this._poller&&(clearInterval(this._poller),this._poller=setInterval((function(){e._doPoll()}),this._pollingInterval))},enumerable:!0,configurable:!0}),K.prototype._getFastBlockNumber=function(){var t=this,e=V();return e-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=e,this._fastBlockNumberPromise=this.getBlockNumber().then((function(e){return(null==t._fastBlockNumber||e>t._fastBlockNumber)&&(t._fastBlockNumber=e),t._fastBlockNumber}))),this._fastBlockNumberPromise},K.prototype._setFastBlockNumber=function(t){null!=this._fastBlockNumber&&t<this._fastBlockNumber||(this._fastQueryDate=V(),(null==this._fastBlockNumber||t>this._fastBlockNumber)&&(this._fastBlockNumber=t,this._fastBlockNumberPromise=Promise.resolve(t)))},K.prototype.waitForTransaction=function(t,e){var r=this;return null==e&&(e=1),this.getTransactionReceipt(t).then((function(n){return 0===e||n&&n.confirmations>=e?n:new Promise((function(n){r.on(t,(function i(o){o.confirmations<e||(r.removeListener(t,i),n(o))}))}))}))},K.prototype.getBlockNumber=function(){var t=this;return this.ready.then((function(){return t.perform("getBlockNumber",{}).then((function(e){var r=parseInt(e);if(r!=e)throw new Error("invalid response - getBlockNumber");return t._setFastBlockNumber(r),r}))}))},K.prototype.getGasPrice=function(){var t=this;return this.ready.then((function(){return t.perform("getGasPrice",{}).then((function(t){return u.bigNumberify(t)}))}))},K.prototype.getBalance=function(t,e){var r=this;return this.ready.then((function(){return d.resolveProperties({addressOrName:t,blockTag:e}).then((function(t){var e=t.addressOrName,n=t.blockTag;return r._getAddress(e).then((function(t){return t={address:t,blockTag:E(n)},r.perform("getBalance",t).then((function(t){return u.bigNumberify(t)}))}))}))}))},K.prototype.getTransactionCount=function(t,e){var r=this;return this.ready.then((function(){return d.resolveProperties({addressOrName:t,blockTag:e}).then((function(t){var e=t.addressOrName,n=t.blockTag;return r._getAddress(e).then((function(t){return t={address:t,blockTag:E(n)},r.perform("getTransactionCount",t).then((function(t){return u.bigNumberify(t).toNumber()}))}))}))}))},K.prototype.getCode=function(t,e){var r=this;return this.ready.then((function(){return d.resolveProperties({addressOrName:t,blockTag:e}).then((function(t){var e=t.addressOrName,n=t.blockTag;return r._getAddress(e).then((function(t){return t={address:t,blockTag:E(n)},r.perform("getCode",t).then((function(t){return c.hexlify(t)}))}))}))}))},K.prototype.getStorageAt=function(t,e,r){var n=this;return this.ready.then((function(){return d.resolveProperties({addressOrName:t,position:e,blockTag:r}).then((function(t){var e=t.addressOrName,r=t.position,i=t.blockTag;return n._getAddress(e).then((function(t){return t={address:t,blockTag:E(i),position:c.hexStripZeros(c.hexlify(r))},n.perform("getStorageAt",t).then((function(t){return c.hexlify(t)}))}))}))}))},K.prototype.sendTransaction=function(t){var e=this;return this.ready.then((function(){return d.resolveProperties({signedTransaction:t}).then((function(t){var r=t.signedTransaction;return t={signedTransaction:c.hexlify(r)},e.perform("sendTransaction",t).then((function(t){return e._wrapTransaction(y.parse(r),t)}),(function(t){throw t.transaction=y.parse(r),t.transaction.hash&&(t.transactionHash=t.transaction.hash),t}))}))}))},K.prototype._wrapTransaction=function(t,e){var r=this;if(null!=e&&32!==c.hexDataLength(e))throw new Error("invalid response - sendTransaction");var n=t;return null!=e&&t.hash!==e&&g.throwError("Transaction hash mismatch from Provider.sendTransaction.",g.UNKNOWN_ERROR,{expectedHash:t.hash,returnedHash:e}),n.wait=function(e){return 0!==e&&(r._emitted["t:"+t.hash]="pending"),r.waitForTransaction(t.hash,e).then((function(n){return null==n&&0===e?null:(r._emitted["t:"+t.hash]=n.blockNumber,0===n.status&&g.throwError("transaction failed",g.CALL_EXCEPTION,{transactionHash:t.hash,transaction:t}),n)}))},n},K.prototype.call=function(t,e){var r=this,n=d.shallowCopy(t);return this.ready.then((function(){return d.resolveProperties({blockTag:e,tx:n}).then((function(t){var e=t.blockTag;return t=t.tx,r._resolveNames(t,["to","from"]).then((function(t){return t={blockTag:E(e),transaction:R(t)},r.perform("call",t).then((function(t){return c.hexlify(t)}))}))}))}))},K.prototype.estimateGas=function(t){var e=this,r={to:t.to,from:t.from,data:t.data,gasPrice:t.gasPrice,value:t.value};return this.ready.then((function(){return d.resolveProperties(r).then((function(t){return e._resolveNames(t,["to","from"]).then((function(t){return t={transaction:R(t)},e.perform("estimateGas",t).then((function(t){return u.bigNumberify(t)}))}))}))}))},K.prototype.getBlock=function(t,e){var r=this;return this.ready.then((function(){return d.resolveProperties({blockHashOrBlockTag:t}).then((function(t){t=t.blockHashOrBlockTag;try{var n=c.hexlify(t);if(32===c.hexDataLength(n))return v.poll((function(){return r.perform("getBlock",{blockHash:n,includeTransactions:!!e}).then((function(t){return null==t?null==r._emitted["b:"+n]?null:void 0:C(t,e)}))}),{onceBlock:r})}catch(t){}try{var i=-128,o=E(t);return c.isHexString(o)&&(i=parseInt(o.substring(2),16)),v.poll((function(){return r.perform("getBlock",{blockTag:o,includeTransactions:!!e}).then((function(t){return null==t?i<=r._emitted.block?void 0:null:C(t,e)}))}),{onceBlock:r})}catch(t){}throw new Error("invalid block hash or block tag")}))}))},K.prototype.getTransaction=function(t){var e=this;return this.ready.then((function(){return d.resolveProperties({transactionHash:t}).then((function(t){var r=t.transactionHash,n={transactionHash:x(r,!0)};return v.poll((function(){return e.perform("getTransaction",n).then((function(t){if(null==t)return null==e._emitted["t:"+r]?null:void 0;var n=K.checkTransactionResponse(t);if(null==n.blockNumber)n.confirmations=0;else if(null==n.confirmations)return e._getFastBlockNumber().then((function(t){return t=t-n.blockNumber+1,n.confirmations=t=t<=0?1:t,e._wrapTransaction(n)}));return e._wrapTransaction(n)}))}),{onceBlock:e})}))}))},K.prototype.getTransactionReceipt=function(t){var e=this;return this.ready.then((function(){return d.resolveProperties({transactionHash:t}).then((function(t){var r=t.transactionHash,n={transactionHash:x(r,!0)};return v.poll((function(){return e.perform("getTransactionReceipt",n).then((function(t){if(null==t)return null==e._emitted["t:"+r]?null:void 0;if(null!=t.blockHash){var n,i=((t=w(N,n=t)).logs.forEach((function(t,e){null==t.transactionLogIndex&&(t.transactionLogIndex=e)})),null!=n.status&&(t.byzantium=!0),t);if(null==i.blockNumber)i.confirmations=0;else if(null==i.confirmations)return e._getFastBlockNumber().then((function(t){return t=t-i.blockNumber+1,i.confirmations=t=t<=0?1:t,i}));return i}}))}),{onceBlock:e})}))}))},K.prototype.getLogs=function(t){var e=this;return this.ready.then((function(){return d.resolveProperties(t).then((function(t){return e._resolveNames(t,["address"]).then((function(t){return t={filter:(t=t)&&t.blockHash?w(z,t):w(B,t)},e.perform("getLogs",t).then((function(t){return k(F)(t)}))}))}))}))},K.prototype.getEtherPrice=function(){var t=this;return this.ready.then((function(){return t.perform("getEtherPrice",{}).then((function(t){return t}))}))},K.prototype._getAddress=function(t){return this.resolveName(t).then((function(e){return null==e&&g.throwError("ENS name not configured",g.UNSUPPORTED_OPERATION,{operation:"resolveName("+JSON.stringify(t)+")"}),e}))},K.prototype._resolveNames=function(t,e){var r=[],n=d.shallowCopy(t);return e.forEach((function(t){null!=n[t]&&r.push(this._getAddress(n[t]).then((function(e){n[t]=e})))}),this),Promise.all(r).then((function(){return n}))},K.prototype._getResolver=function(t){var e=this;return this.getNetwork().then((function(r){r.ensAddress||g.throwError("network does not support ENS",g.UNSUPPORTED_OPERATION,{operation:"ENS",network:r.name});var n="0x0178b8bf"+h.namehash(t).substring(2);return n={to:r.ensAddress,data:n},e.call(n).then((function(t){return 32!==c.hexDataLength(t)||(t=a.getAddress(c.hexDataSlice(t,12)))===l.AddressZero?null:t}))}))},K.prototype.resolveName=function(t){var e=this;if(t instanceof Promise)return t.then((function(t){return e.resolveName(t)}));try{return Promise.resolve(a.getAddress(t))}catch(e){if(c.isHexString(t))throw e}var r=this,n=h.namehash(t);return this._getResolver(t).then((function(t){if(null==t)return null;var e="0x3b3b57de"+n.substring(2);return r.call({to:t,data:e})})).then((function(t){return 32!==c.hexDataLength(t)||(t=a.getAddress(c.hexDataSlice(t,12)))===l.AddressZero?null:t}))},K.prototype.lookupAddress=function(t){var e=this;if(t instanceof Promise)return t.then((function(t){return e.lookupAddress(t)}));var r=(t=a.getAddress(t)).substring(2)+".addr.reverse",n=h.namehash(r),i=this;return this._getResolver(r).then((function(t){if(!t)return null;var e="0x691f3431"+n.substring(2);return i.call({to:t,data:e})})).then((function(e){if(null==e)return null;if((e=e.substring(2)).length<64)return null;if((e=e.substring(64)).length<64)return null;var r=u.bigNumberify("0x"+e.substring(0,64)).toNumber();if(2*r>(e=e.substring(64)).length)return null;var n=m.toUtf8String("0x"+e.substring(0,2*r));return i.resolveName(n).then((function(e){return e!=t?null:n}))}))},K.checkTransactionResponse=M,K.prototype.doPoll=function(){},K.prototype.perform=function(t,e){return g.throwError(t+" not implemented",g.NOT_IMPLEMENTED,{operation:t}),null},K.prototype._startPending=function(){g.warn("WARNING: this provider does not support pending events")},K.prototype._stopPending=function(){},K.prototype._addEventListener=function(t,e,r){this._events.push({tag:G(t),listener:e,once:r}),"pending"===t&&this._startPending(),this.polling=!0},K.prototype.on=function(t,e){return this._addEventListener(t,e,!1),this},K.prototype.once=function(t,e){return this._addEventListener(t,e,!0),this},K.prototype.addEventListener=function(t,e){return this.on(t,e)},K.prototype.emit=function(t){for(var e=this,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var i=!1,o=G(t);return this._events=this._events.filter((function(t){return t.tag!==o||(setTimeout((function(){t.listener.apply(e,r)}),0),i=!0,!t.once)})),0===this.listenerCount()&&(this.polling=!1),i},K.prototype.listenerCount=function(t){if(!t)return this._events.length;var e=G(t);return this._events.filter((function(t){return t.tag===e})).length},K.prototype.listeners=function(t){var e=G(t);return this._events.filter((function(t){return t.tag===e})).map((function(t){return t.listener}))},K.prototype.removeAllListeners=function(t){var e;return null==t?(this._events=[],this._stopPending()):(e=G(t),this._events=this._events.filter((function(t){return t.tag!==e})),"pending"===t&&this._stopPending()),0===this._events.length&&(this.polling=!1),this},K.prototype.removeListener=function(t,e){var r=!1,n=G(t);return this._events=this._events.filter((function(t){return t.tag!==n||t.listener!=e||!!r||!(r=!0)})),"pending"===t&&0===this.listenerCount("pending")&&this._stopPending(),0===this.listenerCount()&&(this.polling=!1),this},i=K,r.BaseProvider=i,d.defineReadOnly(b.Provider,"inherits",d.inheritable(b.Provider))},{"../constants":3,"../errors":5,"../utils/address":60,"../utils/bignumber":63,"../utils/bytes":64,"../utils/hash":65,"../utils/networks":72,"../utils/properties":74,"../utils/rlp":76,"../utils/transaction":83,"../utils/utf8":85,"../utils/web":86,"./abstract-provider":50}],52:[function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var a,s=t("./base-provider"),u=t("../utils/bytes"),c=t("../utils/properties"),l=t("../utils/web"),h=o(t("../errors"));function f(t){var e,r,n=[];for(e in t)null!=t[e]&&(r=u.hexlify(t[e]),{gasLimit:!0,gasPrice:!0,nonce:!0,value:!0}[e]&&(r=u.hexStripZeros(r)),n.push(e+"="+r));return n.join("&")}function d(t){if(0==t.status&&("No records found"===t.message||"No transactions found"===t.message))return t.result;if(1==t.status&&"OK"==t.message)return t.result;var e=new Error("invalid response");throw e.result=JSON.stringify(t),e}function p(t){if("2.0"!=t.jsonrpc)throw(e=new Error("invalid response")).result=JSON.stringify(t),e;if(t.error){var e=new Error(t.error.message||"unknown error");throw t.error.code&&(e.code=t.error.code),t.error.data&&(e.data=t.error.data),e}return t.result}function y(t){if("pending"===t)throw new Error("pending not supported");return"latest"===t?t:parseInt(t.substring(2),16)}function m(t,e){var r=a.call(this,t)||this;h.checkNew(r,m),t="invalid";var n=null;switch(t=r.network?r.network.name:t){case"homestead":n="https://api.etherscan.io";break;case"ropsten":n="https://api-ropsten.etherscan.io";break;case"rinkeby":n="https://api-rinkeby.etherscan.io";break;case"kovan":n="https://api-kovan.etherscan.io";break;case"goerli":n="https://api-goerli.etherscan.io";break;default:throw new Error("unsupported network")}return c.defineReadOnly(r,"baseUrl",n),c.defineReadOnly(r,"apiKey",e||"8FG3JMZ9USS4NTA6YKEKHINU56SEPPVBJR"),r}i(m,a=s.BaseProvider),m.prototype.perform=function(t,e){var r,n=this,i=this.baseUrl,o="";function s(t,e){return l.fetchJson(t,null,e||p).then((function(e){return n.emit("debug",{action:"perform",request:t,response:e,provider:n}),e}))}switch(this.apiKey&&(o+="&apikey="+this.apiKey),t){case"getBlockNumber":return s(i+="/api?module=proxy&action=eth_blockNumber"+o);case"getGasPrice":return s(i+="/api?module=proxy&action=eth_gasPrice"+o);case"getBalance":return i+="/api?module=account&action=balance&address="+e.address,s(i+="&tag="+e.blockTag+o,d);case"getTransactionCount":return i+="/api?module=proxy&action=eth_getTransactionCount&address="+e.address,s(i+="&tag="+e.blockTag+o);case"getCode":return i+="/api?module=proxy&action=eth_getCode&address="+e.address,s(i+="&tag="+e.blockTag+o,p);case"getStorageAt":return i+="/api?module=proxy&action=eth_getStorageAt&address="+e.address,i+="&position="+e.position,s(i+="&tag="+e.blockTag+o,p);case"sendTransaction":return i+="/api?module=proxy&action=eth_sendRawTransaction&hex="+e.signedTransaction,s(i+=o).catch((function(t){throw t.responseText&&(0<=t.responseText.toLowerCase().indexOf("insufficient funds")&&h.throwError("insufficient funds",h.INSUFFICIENT_FUNDS,{}),0<=t.responseText.indexOf("same hash was already imported")&&h.throwError("nonce has already been used",h.NONCE_EXPIRED,{}),0<=t.responseText.indexOf("another transaction with same nonce")&&h.throwError("replacement fee too low",h.REPLACEMENT_UNDERPRICED,{})),t}));case"getBlock":return e.blockTag?(i+="/api?module=proxy&action=eth_getBlockByNumber&tag="+e.blockTag,e.includeTransactions?i+="&boolean=true":i+="&boolean=false",s(i+=o)):Promise.reject(new Error("getBlock by blockHash not implemeneted"));case"getTransaction":return i+="/api?module=proxy&action=eth_getTransactionByHash&txhash="+e.transactionHash,s(i+=o);case"getTransactionReceipt":return i+="/api?module=proxy&action=eth_getTransactionReceipt&txhash="+e.transactionHash,s(i+=o);case"call":return i+="/api?module=proxy&action=eth_call"+(r=(r=f(e.transaction))&&"&"+r),"latest"!==e.blockTag?Promise.reject(new Error("EtherscanProvider does not support blockTag for call")):s(i+=o);case"estimateGas":return i+="/api?module=proxy&action=eth_estimateGas&"+(r=(r=f(e.transaction))&&"&"+r),s(i+=o);case"getLogs":i+="/api?module=logs&action=getLogs";try{if(e.filter.fromBlock&&(i+="&fromBlock="+y(e.filter.fromBlock)),e.filter.toBlock&&(i+="&toBlock="+y(e.filter.toBlock)),e.filter.blockHash)try{h.throwError("Etherscan does not support blockHash filters",h.UNSUPPORTED_OPERATION,{operation:"getLogs(blockHash)"})}catch(t){return Promise.reject(t)}if(e.filter.address&&(i+="&address="+e.filter.address),e.filter.topics&&0<e.filter.topics.length){if(1<e.filter.topics.length)throw new Error("unsupported topic format");var u=e.filter.topics[0];if("string"!=typeof u||66!==u.length)throw new Error("unsupported topic0 format");i+="&topic0="+u}}catch(t){return Promise.reject(t)}var c=this;return s(i+=o,d).then((function(t){var e={},r=Promise.resolve();return t.forEach((function(t){r=r.then((function(){return null!=t.blockHash?null:(t.blockHash=e[t.transactionHash],null==t.blockHash?c.getTransaction(t.transactionHash).then((function(r){return e[t.transactionHash]=r.blockHash,t.blockHash=r.blockHash,null})):null)}))})),r.then((function(){return t}))}));case"getEtherPrice":return"homestead"!==this.network.name?Promise.resolve(0):(i+="/api?module=stats&action=ethprice",s(i+=o,d).then((function(t){return parseFloat(t.ethusd)})))}return a.prototype.perform.call(this,t,e)},m.prototype.getHistory=function(t,e,r){var n=this,i=this.baseUrl,o="";return this.apiKey&&(o+="&apikey="+this.apiKey),null==e&&(e=0),null==r&&(r=99999999),this.resolveName(t).then((function(t){return i+="/api?module=account&action=txlist&address="+t,i+="&startblock="+e,i+="&endblock="+r,i+="&sort=asc"+o,l.fetchJson(i,null,d).then((function(t){n.emit("debug",{action:"getHistory",request:i,response:t,provider:n});var e=[];return t.forEach((function(t){["contractAddress","to"].forEach((function(e){""==t[e]&&delete t[e]})),null==t.creates&&null!=t.contractAddress&&(t.creates=t.contractAddress);var r=s.BaseProvider.checkTransactionResponse(t);t.timeStamp&&(r.timestamp=parseInt(t.timeStamp)),e.push(r)})),e}))}))},i=m,r.EtherscanProvider=i},{"../errors":5,"../utils/bytes":64,"../utils/properties":74,"../utils/web":86,"./base-provider":51}],53:[function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var a,s=t("./base-provider"),u=o(t("../errors"));function c(t){var e=!0,r=null;return t.forEach((function(n){null!=n?null!=r?r.name===n.name&&r.chainId===n.chainId&&(r.ensAddress===n.ensAddress||null==r.ensAddress&&null==n.ensAddress)||u.throwError("provider mismatch",u.INVALID_ARGUMENT,{arg:"networks",value:t}):r=n:e=!1})),e}function l(t){var e,r=this;if(0===t.length)throw new Error("no providers");return r=c(t.map((function(t){return t.network})))?a.call(this,t[0].network)||this:(e=Promise.all(t.map((function(t){return t.getNetwork()}))).then((function(t){return c(t)||u.throwError("getNetwork returned null",u.UNKNOWN_ERROR,{}),t[0]})),a.call(this,e)||this),u.checkNew(r,l),r._providers=t.slice(0),r}i(l,a=s.BaseProvider),Object.defineProperty(l.prototype,"providers",{get:function(){return this._providers.slice(0)},enumerable:!0,configurable:!0}),l.prototype.perform=function(t,e){var r=this.providers;return new Promise((function(n,i){var o=null;!function a(){r.length?r.shift().perform(t,e).then((function(t){return n(t)})).catch((function(t){o=o||t,setTimeout(a,0)})):i(o)}()}))},i=l,r.FallbackProvider=i},{"../errors":5,"./base-provider":51}],54:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./abstract-provider");r.Provider=n.Provider,n=t("./base-provider"),r.BaseProvider=n.BaseProvider,n=t("./etherscan-provider"),r.EtherscanProvider=n.EtherscanProvider,n=t("./fallback-provider"),r.FallbackProvider=n.FallbackProvider,n=t("./ipc-provider"),r.IpcProvider=n.IpcProvider,n=t("./infura-provider"),r.InfuraProvider=n.InfuraProvider,n=t("./json-rpc-provider"),r.JsonRpcProvider=n.JsonRpcProvider,r.JsonRpcSigner=n.JsonRpcSigner,t=t("./web3-provider"),r.Web3Provider=t.Web3Provider},{"./abstract-provider":50,"./base-provider":51,"./etherscan-provider":52,"./fallback-provider":53,"./infura-provider":55,"./ipc-provider":56,"./json-rpc-provider":57,"./web3-provider":58}],55:[function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var a,s=t("./json-rpc-provider"),u=t("../utils/bytes"),c=t("../utils/networks"),l=t("../utils/properties"),h=o(t("../errors"));function f(t,e){var r=this,n=c.getNetwork(null==t?"homestead":t);null==e&&(e="7d0d81d0919f4f05b9ab6634be01ee73");var i=null;switch(n.name){case"homestead":i="mainnet.infura.io";break;case"ropsten":i="ropsten.infura.io";break;case"rinkeby":i="rinkeby.infura.io";break;case"goerli":i="goerli.infura.io";break;case"kovan":i="kovan.infura.io";break;default:h.throwError("unsupported network",h.INVALID_ARGUMENT,{argument:"network",value:t})}return u.isHexString("0x"+e,16)?(r=a.call(this,"https://"+i+"/v3/"+e,n)||this,l.defineReadOnly(r,"apiAccessToken",null),l.defineReadOnly(r,"projectId",e)):(h.warn("The legacy INFURA apiAccesToken API is deprecated; please upgrade to a Project ID instead (see INFURA dshboard; https://infura.io)"),r=a.call(this,"https://"+i+"/"+e,n)||this,l.defineReadOnly(r,"apiAccessToken",e),l.defineReadOnly(r,"projectId",null)),h.checkNew(r,f),r}i(f,a=s.JsonRpcProvider),f.prototype._startPending=function(){h.warn("WARNING: INFURA does not support pending filters")},f.prototype.getSigner=function(t){return h.throwError("INFURA does not support signing",h.UNSUPPORTED_OPERATION,{operation:"getSigner"})},f.prototype.listAccounts=function(){return Promise.resolve([])},i=f,r.InfuraProvider=i},{"../errors":5,"../utils/bytes":64,"../utils/networks":72,"../utils/properties":74,"./json-rpc-provider":57}],56:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0})},{}],57:[function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var a=t("./base-provider"),s=t("../abstract-signer"),u=o(t("../errors")),c=t("../utils/address"),l=t("../utils/bytes"),h=t("../utils/networks"),f=t("../utils/properties"),d=t("../utils/utf8"),p=t("../utils/web");function y(t){if(t.error){var e=new Error(t.error.message);throw e.code=t.error.code,e.data=t.error.data,e}return t.result}function m(t){return t&&t.toLowerCase()}var v,g={},b=42,w=(i(_,v=s.Signer),_.prototype.getAddress=function(){var t=this;return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then((function(e){return e.length<=t._index&&u.throwError("unknown account #"+t._index,u.UNSUPPORTED_OPERATION,{operation:"getAddress"}),t._address=c.getAddress(e[t._index]),t._address}))},_.prototype.getBalance=function(t){return this.provider.getBalance(this.getAddress(),t)},_.prototype.getTransactionCount=function(t){return this.provider.getTransactionCount(this.getAddress(),t)},_.prototype.sendUncheckedTransaction=function(t){var e=this;t=f.shallowCopy(t);var r,n=this.getAddress().then((function(t){return t&&t.toLowerCase()}));return null==t.gasLimit&&((r=f.shallowCopy(t)).from=n,t.gasLimit=this.provider.estimateGas(r)),Promise.all([f.resolveProperties(t),n]).then((function(t){var r=t[0],n=A.hexlifyTransaction(r);return n.from=t[1],e.provider.send("eth_sendTransaction",[n]).then((function(t){return t}),(function(t){throw t.responseText&&(0<=t.responseText.indexOf("insufficient funds")&&u.throwError("insufficient funds",u.INSUFFICIENT_FUNDS,{transaction:r}),0<=t.responseText.indexOf("nonce too low")&&u.throwError("nonce has already been used",u.NONCE_EXPIRED,{transaction:r}),0<=t.responseText.indexOf("replacement transaction underpriced")&&u.throwError("replacement fee too low",u.REPLACEMENT_UNDERPRICED,{transaction:r})),t}))}))},_.prototype.sendTransaction=function(t){var e=this;return this.sendUncheckedTransaction(t).then((function(t){return p.poll((function(){return e.provider.getTransaction(t).then((function(r){if(null!==r)return e.provider._wrapTransaction(r,t)}))}),{fastRetry:250,onceBlock:e.provider}).catch((function(e){throw e.transactionHash=t,e}))}))},_.prototype.signMessage=function(t){var e=this,r="string"==typeof t?d.toUtf8Bytes(t):t;return this.getAddress().then((function(t){return e.provider.send("eth_sign",[t.toLowerCase(),l.hexlify(r)])}))},_.prototype.unlock=function(t){var e=this.provider;return this.getAddress().then((function(r){return e.send("personal_unlockAccount",[r.toLowerCase(),t,null])}))},_);function _(t,e,r){var n=v.call(this)||this;if(u.checkNew(n,_),t!==g)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");return f.defineReadOnly(n,"provider",e),r?"string"==typeof r?f.defineReadOnly(n,"_address",c.getAddress(r)):"number"==typeof r?f.defineReadOnly(n,"_index",r):u.throwError("invalid address or index",u.INVALID_ARGUMENT,{argument:"addressOrIndex",value:r}):f.defineReadOnly(n,"_index",0),n}r.JsonRpcSigner=w;var k,x={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0},A=(i(I,k=a.BaseProvider),I.prototype.getSigner=function(t){return new w(g,this,t)},I.prototype.listAccounts=function(){return this.send("eth_accounts",[]).then((function(t){return t.map((function(t){return c.getAddress(t)}))}))},I.prototype.send=function(t,e){var r=this,n={method:t,params:e,id:b++,jsonrpc:"2.0"};return p.fetchJson(this.connection,JSON.stringify(n),y).then((function(t){return r.emit("debug",{action:"send",request:n,response:t,provider:r}),t}))},I.prototype.perform=function(t,e){switch(t){case"getBlockNumber":return this.send("eth_blockNumber",[]);case"getGasPrice":return this.send("eth_gasPrice",[]);case"getBalance":return this.send("eth_getBalance",[m(e.address),e.blockTag]);case"getTransactionCount":return this.send("eth_getTransactionCount",[m(e.address),e.blockTag]);case"getCode":return this.send("eth_getCode",[m(e.address),e.blockTag]);case"getStorageAt":return this.send("eth_getStorageAt",[m(e.address),e.position,e.blockTag]);case"sendTransaction":return this.send("eth_sendRawTransaction",[e.signedTransaction]).catch((function(t){throw t.responseText&&(0<t.responseText.indexOf("insufficient funds")&&u.throwError("insufficient funds",u.INSUFFICIENT_FUNDS,{}),0<t.responseText.indexOf("nonce too low")&&u.throwError("nonce has already been used",u.NONCE_EXPIRED,{}),0<t.responseText.indexOf("replacement transaction underpriced")&&u.throwError("replacement fee too low",u.REPLACEMENT_UNDERPRICED,{})),t}));case"getBlock":return e.blockTag?this.send("eth_getBlockByNumber",[e.blockTag,!!e.includeTransactions]):e.blockHash?this.send("eth_getBlockByHash",[e.blockHash,!!e.includeTransactions]):Promise.reject(new Error("invalid block tag or block hash"));case"getTransaction":return this.send("eth_getTransactionByHash",[e.transactionHash]);case"getTransactionReceipt":return this.send("eth_getTransactionReceipt",[e.transactionHash]);case"call":return this.send("eth_call",[I.hexlifyTransaction(e.transaction,{from:!0}),e.blockTag]);case"estimateGas":return this.send("eth_estimateGas",[I.hexlifyTransaction(e.transaction,{from:!0})]);case"getLogs":return e.filter&&null!=e.filter.address&&(e.filter.address=m(e.filter.address)),this.send("eth_getLogs",[e.filter])}return u.throwError(t+" not implemented",u.NOT_IMPLEMENTED,{operation:t}),null},I.prototype._startPending=function(){var t,e;null==this._pendingFilter&&(e=(t=this).send("eth_newPendingTransactionFilter",[]),(this._pendingFilter=e).then((function(r){return function n(){t.send("eth_getFilterChanges",[r]).then((function(r){if(t._pendingFilter!=e)return null;var n=Promise.resolve();return r.forEach((function(e){t._emitted["t:"+e.toLowerCase()]="pending",n=n.then((function(){return t.getTransaction(e).then((function(e){return t.emit("pending",e),null}))}))})),n.then((function(){return new Promise((function(t){setTimeout((function(){t()}),1e3)}))}))})).then((function(){return t._pendingFilter==e?(setTimeout((function(){n()}),0),null):void t.send("eth_uninstallFilter",[r])})).catch((function(t){}))}(),r})).catch((function(t){})))},I.prototype._stopPending=function(){this._pendingFilter=null},I.hexlifyTransaction=function(t,e){var r=f.shallowCopy(x);if(e)for(var n in e)e[n]&&(r[n]=!0);f.checkProperties(t,r);var i={};return["gasLimit","gasPrice","nonce","value"].forEach((function(e){var r;null!=t[e]&&(r=l.hexStripZeros(l.hexlify(t[e])),i[e="gasLimit"===e?"gas":e]=r)})),["from","to","data"].forEach((function(e){null!=t[e]&&(i[e]=l.hexlify(t[e]))})),i},I);function I(t,e){var r=this;return"string"==typeof t&&null===e&&h.getNetwork(t)&&(e=t,t=null),e||(e=new Promise((function(t,e){setTimeout((function(){r.send("net_version",[]).then((function(e){return t(h.getNetwork(parseInt(e)))})).catch((function(t){e(t)}))}))}))),r=k.call(this,e)||this,u.checkNew(r,I),r.connection="string"==typeof(t=t||"http://localhost:8545")?{url:t}:t,r}r.JsonRpcProvider=A},{"../abstract-signer":2,"../errors":5,"../utils/address":60,"../utils/bytes":64,"../utils/networks":72,"../utils/properties":74,"../utils/utf8":85,"../utils/web":86,"./base-provider":51}],58:[function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var a,s=t("./json-rpc-provider"),u=t("../utils/properties"),c=o(t("../errors")),l=42;function h(t,e){return e=a.call(this,t.host||t.path||"",e)||this,c.checkNew(e,h),t&&(t.sendAsync?e._sendAsync=t.sendAsync.bind(t):t.send&&(e._sendAsync=t.send.bind(t))),t&&e._sendAsync||c.throwError("invalid web3Provider",c.INVALID_ARGUMENT,{arg:"web3Provider",value:t}),u.defineReadOnly(e,"_web3Provider",t),u.defineReadOnly(e,"provider",t),e}i(h,a=s.JsonRpcProvider),h.prototype.send=function(t,e){var r=this;return"eth_sign"==t&&this._web3Provider.isMetaMask&&(t="personal_sign",e=[e[1],e[0]]),new Promise((function(n,i){var o={method:t,params:e,id:l++,jsonrpc:"2.0"};r._sendAsync(o,(function(t,e){if(t)i(t);else{if(e.error)return(t=new Error(e.error.message)).code=e.error.code,t.data=e.error.data,void i(t);n(e.result)}}))}))},i=h,r.Web3Provider=i},{"../errors":5,"../utils/properties":74,"./json-rpc-provider":57}],59:[function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var a=t("../constants"),u=o(t("../errors")),c=t("./address"),l=t("./bignumber"),h=t("./bytes"),f=t("./utf8"),d=t("./properties"),p=new RegExp(/^bytes([0-9]*)$/),y=new RegExp(/^(u?int)([0-9]*)$/),m=new RegExp(/^(.*)\[([0-9]*)\]$/);r.defaultCoerceFunc=function(t,e){return(t=t.match(y))&&parseInt(t[2])<=48?e.toNumber():e};var v=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$"),g=new RegExp("^[A-Za-z_][A-Za-z0-9_]*$");function b(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}function w(t,e){var r=t;function n(t){throw new Error('unexpected character "'+r[t]+'" at position '+t+' in "'+r+'"')}t=t.replace(/\s/g," ");for(var i={type:"",name:"",state:{allowType:!0}},o=i,a=0;a<t.length;a++){var s=t[a];switch(s){case"(":o.state.allowParams||n(a),o.state.allowType=!1,o.type=b(o.type),o.components=[{type:"",name:"",parent:o,state:{allowType:!0}}],o=o.components[0];break;case")":delete o.state,e&&"indexed"===o.name&&(o.indexed=!0,o.name=""),o.type=b(o.type);var u=o;(o=o.parent)||n(a),delete u.parent,o.state.allowParams=!1,o.state.allowName=!0,o.state.allowArray=!0;break;case",":delete o.state,e&&"indexed"===o.name&&(o.indexed=!0,o.name=""),o.type=b(o.type),u={type:"",name:"",parent:o.parent,state:{allowType:!0}},o.parent.components.push(u),delete o.parent,o=u;break;case" ":o.state.allowType&&""!==o.type&&(o.type=b(o.type),delete o.state.allowType,o.state.allowName=!0,o.state.allowParams=!0),o.state.allowName&&""!==o.name&&(e&&"indexed"===o.name?(o.indexed=!0,o.name=""):o.state.allowName=!1);break;case"[":o.state.allowArray||n(a),o.type+=s,o.state.allowArray=!1,o.state.allowName=!1,o.state.readArray=!0;break;case"]":o.state.readArray||n(a),o.type+=s,o.state.readArray=!1,o.state.allowArray=!0,o.state.allowName=!0;break;default:o.state.allowType?(o.type+=s,o.state.allowParams=!0,o.state.allowArray=!0):o.state.allowName?(o.name+=s,delete o.state.allowArray):o.state.readArray?o.type+=s:n(a)}}if(o.parent)throw new Error("unexpected eof");return delete i.state,e&&"indexed"===o.name&&(o.indexed=!0,o.name=""),i.type=b(i.type),i}function _(t){return ot(r.defaultCoerceFunc,t).type}function k(t,e,r,n,i){this.coerceFunc=t,this.name=e,this.type=r,this.localName=n,this.dynamic=i}r.parseParamType=function(t){return w(t,!0)},r.formatParamType=_,r.formatSignature=function(t){return t.name+"("+t.inputs.map(_).join(",")+")"},r.parseSignature=function(t){if("string"==typeof t)return"event "===(t=(t=(t=t.replace(/\s/g," ")).replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," ")).trim()).substring(0,6)?function(t){var e={anonymous:!1,inputs:[],name:"",type:"event"},r=t.match(v);if(!r)throw new Error("invalid event: "+t);if(e.name=r[1].trim(),nt(r[2]).forEach((function(t){(t=w(t,!0)).indexed=!!t.indexed,e.inputs.push(t)})),r[3].split(" ").forEach((function(t){switch(t){case"anonymous":e.anonymous=!0;break;case"":break;default:u.info("unknown modifier: "+t)}})),e.name&&!e.name.match(g))throw new Error('invalid identifier: "'+e.name+'"');return e}(t.substring(6).trim()):function(t){var e={constant:!1,gas:null,inputs:[],name:"",outputs:[],payable:!1,stateMutability:null,type:"function"},r=t.split("@");if(1!==r.length){if(2<r.length)throw new Error("invalid signature");if(!r[1].match(/^[0-9]+$/))throw new Error("invalid signature gas");e.gas=l.bigNumberify(r[1]),t=r[0]}if(!(t=(r=t.split(" returns "))[0].match(v)))throw new Error("invalid signature");if(e.name=t[1].trim(),!e.name.match(g))throw new Error('invalid identifier: "'+t[1]+'"');if(nt(t[2]).forEach((function(t){e.inputs.push(w(t))})),t[3].split(" ").forEach((function(t){switch(t){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:u.info("unknown modifier: "+t)}})),1<r.length){if(""!=(r=r[1].match(v))[1].trim()||""!=r[3].trim())throw new Error("unexpected tokens");nt(r[2]).forEach((function(t){e.outputs.push(w(t))}))}if("constructor"===e.name){if(e.type="constructor",e.outputs.length)throw new Error("constructor may not have outputs");delete e.name,delete e.outputs}return e}((t="function "===t.substring(0,9)?t.substring(9):t).trim());throw new Error("unknown signature")};var x,A=(i(I,x=k),I.prototype.encode=function(t){return this.coder.encode(t)},I.prototype.decode=function(t,e){return this.coder.decode(t,e)},I);function I(t){var e=x.call(this,t.coerceFunc,t.name,t.type,void 0,t.dynamic)||this;return d.defineReadOnly(e,"coder",t),e}var E,S=(i(M,E=k),M.prototype.encode=function(t){return h.arrayify([])},M.prototype.decode=function(t,e){if(e>t.length)throw new Error("invalid null");return{consumed:0,value:this.coerceFunc("null",void 0)}},M);function M(t,e){return E.call(this,t,"null","",e,!1)||this}var T,P=(i(C,T=k),C.prototype.encode=function(t){try{var e=l.bigNumberify(t);if(this.signed){var r=a.MaxUint256.maskn(8*this.size-1);if(e.gt(r))throw new Error("out-of-bounds");if(r=r.add(a.One).mul(a.NegativeOne),e.lt(r))throw new Error("out-of-bounds")}else if(e.lt(a.Zero)||e.gt(a.MaxUint256.maskn(8*this.size)))throw new Error("out-of-bounds");return e=e.toTwos(8*this.size).maskn(8*this.size),this.signed&&(e=e.fromTwos(8*this.size).toTwos(256)),h.padZeros(h.arrayify(e),32)}catch(e){u.throwError("invalid number value",u.INVALID_ARGUMENT,{arg:this.localName,coderType:this.name,value:t})}return null},C.prototype.decode=function(t,e){t.length<e+32&&u.throwError("insufficient data for "+this.name+" type",u.INVALID_ARGUMENT,{arg:this.localName,coderType:this.name,value:h.hexlify(t.slice(e,e+32))});var r=32-this.size;return e=l.bigNumberify(t.slice(e+r,e+32)),e=this.signed?e.fromTwos(8*this.size):e.maskn(8*this.size),{consumed:32,value:this.coerceFunc(this.name,e)}},C);function C(t,e,r,n){var i=this,o=(r?"int":"uint")+8*e;return(i=T.call(this,t,o,o,n,!1)||this).size=e,i.signed=r,i}var O,R=new P((function(t,e){return e}),32,!1,"none"),j=(i(N,O=k),N.prototype.encode=function(t){return R.encode(t?1:0)},N.prototype.decode=function(t,e){try{var r=R.decode(t,e)}catch(t){throw"insufficient data for uint256 type"===t.reason&&u.throwError("insufficient data for boolean type",u.INVALID_ARGUMENT,{arg:this.localName,coderType:"boolean",value:t.value}),t}return{consumed:r.consumed,value:this.coerceFunc("bool",!r.value.isZero())}},N);function N(t,e){return O.call(this,t,"bool","bool",e,!1)||this}var L,U=(i(D,L=k),D.prototype.encode=function(t){var e=new Uint8Array(32);try{var r=h.arrayify(t);if(r.length!==this.length)throw new Error("incorrect data length");e.set(r)}catch(e){u.throwError("invalid "+this.name+" value",u.INVALID_ARGUMENT,{arg:this.localName,coderType:this.name,value:e.value||t})}return e},D.prototype.decode=function(t,e){return t.length<e+32&&u.throwError("insufficient data for "+this.name+" type",u.INVALID_ARGUMENT,{arg:this.localName,coderType:this.name,value:h.hexlify(t.slice(e,e+32))}),{consumed:32,value:this.coerceFunc(this.name,h.hexlify(t.slice(e,e+this.length)))}},D);function D(t,e,r){var n=this,i="bytes"+e;return(n=L.call(this,t,i,i,r,!1)||this).length=e,n}var B,z,H,F=(i(q,B=k),q.prototype.encode=function(t){var e=new Uint8Array(32);try{e.set(h.arrayify(c.getAddress(t)),12)}catch(e){u.throwError("invalid address",u.INVALID_ARGUMENT,{arg:this.localName,coderType:"address",value:t})}return e},q.prototype.decode=function(t,e){return t.length<e+32&&u.throwError("insufficient data for address type",u.INVALID_ARGUMENT,{arg:this.localName,coderType:"address",value:h.hexlify(t.slice(e,e+32))}),{consumed:32,value:this.coerceFunc("address",c.getAddress(h.hexlify(t.slice(e+12,e+32))))}},q);function q(t,e){return B.call(this,t,"address","address",e,!1)||this}function G(t){var e=32*Math.ceil(t.length/32);return e=new Uint8Array(e-t.length),h.concat([R.encode(t.length),t,e])}function V(t,e,r){t.length<e+32&&u.throwError("insufficient data for dynamicBytes length",u.INVALID_ARGUMENT,{arg:r,coderType:"dynamicBytes",value:h.hexlify(t.slice(e,e+32))});var n=R.decode(t,e).value;try{n=n.toNumber()}catch(t){u.throwError("dynamic bytes count too large",u.INVALID_ARGUMENT,{arg:r,coderType:"dynamicBytes",value:n.toString()})}return t.length<e+32+n&&u.throwError("insufficient data for dynamicBytes type",u.INVALID_ARGUMENT,{arg:r,coderType:"dynamicBytes",value:h.hexlify(t.slice(e,e+32+n))}),{consumed:32+32*Math.ceil(n/32),value:t.slice(e+32,e+32+n)}}function K(t,e){return z.call(this,t,"bytes","bytes",e,!0)||this}function Z(t,e){return H.call(this,t,"string","string",e,!0)||this}function W(t){return 32*Math.ceil(t/32)}function J(t,e){var r;Array.isArray(e)||(e&&"object"==s(e)?(r=[],t.forEach((function(t){r.push(e[t.localName])})),e=r):u.throwError("invalid tuple value",u.INVALID_ARGUMENT,{coderType:"tuple",value:e})),t.length!==e.length&&u.throwError("types/value length mismatch",u.INVALID_ARGUMENT,{coderType:"tuple",value:e});var n=[];t.forEach((function(t,r){n.push({dynamic:t.dynamic,value:t.encode(e[r])})}));var i=0,o=0;n.forEach((function(t){t.dynamic?(i+=32,o+=W(t.value.length)):i+=W(t.value.length)}));var a=0,c=i,l=new Uint8Array(i+o);return n.forEach((function(t){t.dynamic?(l.set(R.encode(c),a),a+=32,l.set(t.value,c),c+=W(t.value.length)):(l.set(t.value,a),a+=W(t.value.length))})),l}function Q(t,e,r){var n=r,i=0,o=[];return t.forEach((function(t){var a,s;t.dynamic?(a=R.decode(e,r),(s=t.decode(e,n+a.value.toNumber())).consumed=a.consumed):s=t.decode(e,r),null!=s.value&&o.push(s.value),r+=s.consumed,i+=s.consumed})),t.forEach((function(t,e){(t=t.localName)&&null==o[t="length"===t?"_length":t]&&(o[t]=o[e])})),{value:o,consumed:i}}i(K,z=k),K.prototype.encode=function(t){try{return G(h.arrayify(t))}catch(t){u.throwError("invalid bytes value",u.INVALID_ARGUMENT,{arg:this.localName,coderType:"bytes",value:t.value})}return null},K.prototype.decode=function(t,e){return(e=V(t,e,this.localName)).value=this.coerceFunc("bytes",h.hexlify(e.value)),e},o=K,i(Z,H=k),Z.prototype.encode=function(t){return"string"!=typeof t&&u.throwError("invalid string value",u.INVALID_ARGUMENT,{arg:this.localName,coderType:"string",value:t}),G(f.toUtf8Bytes(t))},Z.prototype.decode=function(t,e){return(e=V(t,e,this.localName)).value=this.coerceFunc("string",f.toUtf8String(e.value)),e},t=Z;var Y,$=(i(X,Y=k),X.prototype.encode=function(t){Array.isArray(t)||u.throwError("expected array value",u.INVALID_ARGUMENT,{arg:this.localName,coderType:"array",value:t});var e=this.length,r=new Uint8Array(0);-1===e&&(e=t.length,r=R.encode(e)),u.checkArgumentCount(e,t.length," in coder array"+(this.localName?" "+this.localName:""));for(var n=[],i=0;i<t.length;i++)n.push(this.coder);return h.concat([r,J(n,t)])},X.prototype.decode=function(t,e){var r=0,n=this.length;if(-1===n){try{var i=R.decode(t,e)}catch(t){u.throwError("insufficient data for dynamic array length",u.INVALID_ARGUMENT,{arg:this.localName,coderType:"array",value:t.value})}try{n=i.value.toNumber()}catch(t){u.throwError("array count too large",u.INVALID_ARGUMENT,{arg:this.localName,coderType:"array",value:i.value.toString()})}r+=i.consumed,e+=i.consumed}for(var o=[],a=0;a<n;a++)o.push(new A(this.coder));return(e=Q(o,t,e)).consumed+=r,e.value=this.coerceFunc(this.type,e.value),e},X);function X(t,e,r,n){var i=this,o=e.type+"["+(0<=r?r:"")+"]",a=-1===r||e.dynamic;return(i=Y.call(this,t,"array",o,n,a)||this).coder=e,i.length=r,i}var tt,et=(i(rt,tt=k),rt.prototype.encode=function(t){return J(this.coders,t)},rt.prototype.decode=function(t,e){return(e=Q(this.coders,t,e)).value=this.coerceFunc(this.type,e.value),e},rt);function rt(t,e,r){var n=this,i=!1,o=[];e.forEach((function(t){t.dynamic&&(i=!0),o.push(t.type)}));var a="tuple("+o.join(",")+")";return(n=tt.call(this,t,"tuple",a,r,i)||this).coders=e,n}function nt(t){t=t.trim();for(var e=[],r="",n=0,i=0;i<t.length;i++){var o=t[i];if(","===o&&0===n)e.push(r),r="";else if(r+=o,"("===o)n++;else if(")"===o&&-1==--n)throw new Error("unbalanced parenthsis")}return r&&e.push(r),e}var it={address:F,bool:j,string:t,bytes:o};function ot(t,e){var r,n,i;if(i=it[e.type])return new i(t,e.name);if(i=e.type.match(y))return(0===(o=parseInt(i[2]||"256"))||256<o||o%8!=0)&&u.throwError("invalid "+i[1]+" bit length",u.INVALID_ARGUMENT,{arg:"param",value:e}),new P(t,o/8,"int"===i[1],e.name);if(i=e.type.match(p))return(0===(o=parseInt(i[1]))||32<o)&&u.throwError("invalid bytes length",u.INVALID_ARGUMENT,{arg:"param",value:e}),new U(t,o,e.name);if(i=e.type.match(m)){var o=parseInt(i[2]||"-1");return(e=d.shallowCopy(e)).type=i[1],e=d.deepCopy(e),new $(t,ot(t,e),o,e.name)}return"tuple"===e.type.substring(0,5)?(r=t,i=e.components,o=e.name,n=[],(i=i||[]).forEach((function(t){n.push(ot(r,t))})),new et(r,n,o)):""===e.type?new S(t,e.name):(u.throwError("invalid type",u.INVALID_ARGUMENT,{arg:"type",value:e.type}),null)}function at(t){u.checkNew(this,at),t=t||r.defaultCoerceFunc,d.defineReadOnly(this,"coerceFunc",t)}at.prototype.encode=function(t,e){t.length!==e.length&&u.throwError("types/values length mismatch",u.INVALID_ARGUMENT,{count:{types:t.length,values:e.length},value:{types:t,values:e}});var r=[];return t.forEach((function(t){var e="string"==typeof t?w(t):t;r.push(ot(this.coerceFunc,e))}),this),h.hexlify(new et(this.coerceFunc,r,"_").encode(e))},at.prototype.decode=function(t,e){var r=[];return t.forEach((function(t){var e="string"==typeof t?w(t):d.deepCopy(t);r.push(ot(this.coerceFunc,e))}),this),new et(this.coerceFunc,r,"_").decode(h.arrayify(e),0).value},o=at,r.AbiCoder=o,r.defaultAbiCoder=new o},{"../constants":3,"../errors":5,"./address":60,"./bignumber":63,"./bytes":64,"./properties":74,"./utf8":85}],60:[function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:!0});var i=n(t("bn.js")),o=t("./bytes"),a=t("./keccak256"),s=t("./rlp"),u=t("../errors");function c(t){"string"==typeof t&&t.match(/^0x[0-9A-Fa-f]{40}$/)||u.throwError("invalid address",u.INVALID_ARGUMENT,{arg:"address",value:t});for(var e=(t=t.toLowerCase()).substring(2).split(""),r=new Uint8Array(40),n=0;n<40;n++)r[n]=e[n].charCodeAt(0);r=o.arrayify(a.keccak256(r));for(var i=0;i<40;i+=2)8<=r[i>>1]>>4&&(e[i]=e[i].toUpperCase()),8<=(15&r[i>>1])&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}for(var l={},h=0;h<10;h++)l[String(h)]=String(h);for(h=0;h<26;h++)l[String.fromCharCode(65+h)]=String(10+h);var f,d=Math.floor((f=9007199254740991,Math.log10?Math.log10(f):Math.log(f)/Math.LN10));function p(t){t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00";var e="";for(t.split("").forEach((function(t){e+=l[t]}));e.length>=d;){var r=e.substring(0,d);e=parseInt(r,10)%97+e.substring(r.length)}for(var n=String(98-parseInt(e,10)%97);n.length<2;)n="0"+n;return n}function y(t){var e=null;if("string"!=typeof t&&u.throwError("invalid address",u.INVALID_ARGUMENT,{arg:"address",value:t}),t.match(/^(0x)?[0-9a-fA-F]{40}$/))e=c(t="0x"!==t.substring(0,2)?"0x"+t:t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&u.throwError("bad address checksum",u.INVALID_ARGUMENT,{arg:"address",value:t});else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==p(t)&&u.throwError("bad icap checksum",u.INVALID_ARGUMENT,{arg:"address",value:t}),e=new i.default.BN(t.substring(4),36).toString(16);e.length<40;)e="0"+e;e=c("0x"+e)}else u.throwError("invalid address",u.INVALID_ARGUMENT,{arg:"address",value:t});return e}r.getAddress=y,r.getIcapAddress=function(t){for(var e=new i.default.BN(y(t).substring(2),16).toString(36).toUpperCase();e.length<30;)e="0"+e;return"XE"+p("XE00"+e)+e},r.getContractAddress=function(t){if(!t.from)throw new Error("missing from address");var e=t.nonce;return y("0x"+a.keccak256(s.encode([y(t.from),o.stripZeros(o.hexlify(e))])).substring(26))},r.getCreate2Address=function(t){var e=t.initCodeHash;t.initCode&&(e?a.keccak256(t.initCode)!==e&&u.throwError("initCode/initCodeHash mismatch",u.INVALID_ARGUMENT,{arg:"options",value:t}):e=a.keccak256(t.initCode)),e||u.throwError("missing initCode or initCodeHash",u.INVALID_ARGUMENT,{arg:"options",value:t});var r=y(t.from),n=o.arrayify(t.salt);return 32!==n.length&&u.throwError("invalid salt",u.INVALID_ARGUMENT,{arg:"options",value:t}),y("0x"+a.keccak256(o.concat(["0xff",r,n,e])).substring(26))}},{"../errors":5,"./bytes":64,"./keccak256":71,"./rlp":76,"bn.js":9}],61:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("../utils/bytes");e.exports={decode:function(t){t=atob(t);for(var e=[],r=0;r<t.length;r++)e.push(t.charCodeAt(r));return n.arrayify(e)},encode:function(t){t=n.arrayify(t);for(var e="",r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}}},{"../utils/bytes":64}],62:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./bytes"),i=t("./properties"),o=(a.prototype.encode=function(t){var e=n.arrayify(t);if(0===e.length)return"";for(var r=[0],i=0;i<e.length;++i){for(var o=e[i],a=0;a<r.length;++a)o+=r[a]<<8,r[a]=o%this.base,o=o/this.base|0;for(;0<o;)r.push(o%this.base),o=o/this.base|0}for(var s="",u=0;0===e[u]&&u<e.length-1;++u)s+=this._leader;for(var c=r.length-1;0<=c;--c)s+=this.alphabet[r[c]];return s},a.prototype.decode=function(t){if("string"!=typeof t)throw new TypeError("Expected String");var e=[];if(0===t.length)return new Uint8Array(e);e.push(0);for(var r=0;r<t.length;r++){var i=this._alphabetMap[t[r]];if(void 0===i)throw new Error("Non-base"+this.base+" character");for(var o=i,a=0;a<e.length;++a)o+=e[a]*this.base,e[a]=255&o,o>>=8;for(;0<o;)e.push(255&o),o>>=8}for(var s=0;t[s]===this._leader&&s<t.length-1;++s)e.push(0);return n.arrayify(new Uint8Array(e.reverse()))},a);function a(t){i.defineReadOnly(this,"alphabet",t),i.defineReadOnly(this,"base",t.length),i.defineReadOnly(this,"_alphabetMap",{}),i.defineReadOnly(this,"_leader",t.charAt(0));for(var e=0;e<t.length;e++)this._alphabetMap[t.charAt(e)]=e}t=new(r.BaseX=o)("abcdefghijklmnopqrstuvwxyz234567"),r.Base32=t,o=new o("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),r.Base58=o},{"./bytes":64,"./properties":74}],63:[function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var o=n(t("bn.js")),a=t("./bytes"),s=t("./properties"),u=i(t("../errors")),c=new o.default.BN(-1);function l(t){return"-"===(t=t.toString(16))[0]?t.length%2==0?"-0x0"+t.substring(1):"-0x"+t.substring(1):t.length%2==1?"0x0"+t:"0x"+t}function h(t){return d(m(t))}function f(t){return new p(l(t))}function d(t){return"-"===(t=t._hex)[0]?new o.default.BN(t.substring(3),16).mul(c):new o.default.BN(t.substring(2),16)}var p=(y.prototype.fromTwos=function(t){return f(d(this).fromTwos(t))},y.prototype.toTwos=function(t){return f(d(this).toTwos(t))},y.prototype.abs=function(){return"-"===this._hex[0]?f(d(this).mul(c)):this},y.prototype.add=function(t){return f(d(this).add(h(t)))},y.prototype.sub=function(t){return f(d(this).sub(h(t)))},y.prototype.div=function(t){return m(t).isZero()&&u.throwError("division by zero",u.NUMERIC_FAULT,{operation:"divide",fault:"division by zero"}),f(d(this).div(h(t)))},y.prototype.mul=function(t){return f(d(this).mul(h(t)))},y.prototype.mod=function(t){return f(d(this).mod(h(t)))},y.prototype.pow=function(t){return f(d(this).pow(h(t)))},y.prototype.maskn=function(t){return f(d(this).maskn(t))},y.prototype.eq=function(t){return d(this).eq(h(t))},y.prototype.lt=function(t){return d(this).lt(h(t))},y.prototype.lte=function(t){return d(this).lte(h(t))},y.prototype.gt=function(t){return d(this).gt(h(t))},y.prototype.gte=function(t){return d(this).gte(h(t))},y.prototype.isZero=function(){return d(this).isZero()},y.prototype.toNumber=function(){try{return d(this).toNumber()}catch(t){u.throwError("overflow",u.NUMERIC_FAULT,{operation:"setValue",fault:"overflow",details:t.message})}return null},y.prototype.toString=function(){return d(this).toString(10)},y.prototype.toHexString=function(){return this._hex},y.isBigNumber=function(t){return s.isType(t,"BigNumber")},y);function y(t){if(u.checkNew(this,y),s.setType(this,"BigNumber"),"string"==typeof t)a.isHexString(t)?s.defineReadOnly(this,"_hex",t="0x"==t?"0x0":t):"-"===t[0]&&a.isHexString(t.substring(1))?s.defineReadOnly(this,"_hex",t):t.match(/^-?[0-9]*$/)?s.defineReadOnly(this,"_hex",l(new o.default.BN(t=""==t?"0":t))):u.throwError("invalid BigNumber string value",u.INVALID_ARGUMENT,{arg:"value",value:t});else if("number"==typeof t){parseInt(String(t))!==t&&u.throwError("underflow",u.NUMERIC_FAULT,{operation:"setValue",fault:"underflow",value:t,outputValue:parseInt(String(t))});try{s.defineReadOnly(this,"_hex",l(new o.default.BN(t)))}catch(t){u.throwError("overflow",u.NUMERIC_FAULT,{operation:"setValue",fault:"overflow",details:t.message})}}else t instanceof y?s.defineReadOnly(this,"_hex",t._hex):t.toHexString?s.defineReadOnly(this,"_hex",l(h(t.toHexString()))):t._hex&&a.isHexString(t._hex)?s.defineReadOnly(this,"_hex",t._hex):a.isArrayish(t)?s.defineReadOnly(this,"_hex",l(new o.default.BN(a.hexlify(t).substring(2),16))):u.throwError("invalid BigNumber value",u.INVALID_ARGUMENT,{arg:"value",value:t})}function m(t){return p.isBigNumber(t)?t:new p(t)}r.BigNumber=p,r.bigNumberify=m},{"../errors":5,"./bytes":64,"./properties":74,"bn.js":9}],64:[function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var i=n(t("../errors"));function o(t){return!!t.toHexString}function a(t){return t.slice||(t.slice=function(){var e=Array.prototype.slice.call(arguments);return a(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function u(t){if(!t||parseInt(String(t.length))!=t.length||"string"==typeof t)return!1;for(var e=0;e<t.length;e++){var r=t[e];if(r<0||256<=r||parseInt(String(r))!=r)return!1}return!0}function c(t){if(null==t&&i.throwError("cannot convert null value to array",i.INVALID_ARGUMENT,{arg:"value",value:t}),"string"!=typeof(t=o(t)?t.toHexString():t))return u(t)?a(new Uint8Array(t)):(i.throwError("invalid arrayify value",null,{arg:"value",value:t,type:s(t)}),null);var e=t.match(/^(0x)?[0-9a-fA-F]*$/);e||i.throwError("invalid hexidecimal string",i.INVALID_ARGUMENT,{arg:"value",value:t}),"0x"!==e[1]&&i.throwError("hex string must have 0x prefix",i.INVALID_ARGUMENT,{arg:"value",value:t}),(t=t.substring(2)).length%2&&(t="0"+t);for(var r=[],n=0;n<t.length;n+=2)r.push(parseInt(t.substr(n,2),16));return a(new Uint8Array(r))}function l(t){for(var e=[],r=0,n=0;n<t.length;n++){var i=c(t[n]);e.push(i),r+=i.length}var o=new Uint8Array(r),s=0;for(n=0;n<e.length;n++)o.set(e[n],s),s+=e[n].length;return a(o)}function h(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}r.isHexable=o,r.isArrayish=u,r.arrayify=c,r.concat=l,r.stripZeros=function(t){var e=c(t);if(0===e.length)return e;for(var r=0;0===e[r];)r++;return r?e.slice(r):e},r.padZeros=function(t,e){if(e<(t=c(t)).length)throw new Error("cannot pad");var r=new Uint8Array(e);return r.set(t,e-t.length),a(r)},r.isHexString=h;var f="0123456789abcdef";function d(t){if(o(t))return t.toHexString();if("number"==typeof t){t<0&&i.throwError("cannot hexlify negative value",i.INVALID_ARGUMENT,{arg:"value",value:t}),9007199254740991<=t&&i.throwError("out-of-range",i.NUMERIC_FAULT,{operartion:"hexlify",fault:"out-of-safe-range"});for(var e="";t;)e=f[15&t]+e,t=Math.floor(t/16);return e.length?"0x"+(e=e.length%2?"0"+e:e):"0x00"}if("string"==typeof t){var r=t.match(/^(0x)?[0-9a-fA-F]*$/);return r||i.throwError("invalid hexidecimal string",i.INVALID_ARGUMENT,{arg:"value",value:t}),"0x"!==r[1]&&i.throwError("hex string must have 0x prefix",i.INVALID_ARGUMENT,{arg:"value",value:t}),t.length%2?"0x0"+t.substring(2):t}if(u(t)){for(var n=[],a=0;a<t.length;a++){var s=t[a];n.push(f[(240&s)>>4]+f[15&s])}return"0x"+n.join("")}return i.throwError("invalid hexlify value",null,{arg:"value",value:t}),"never"}function p(t,e){for(h(t)||i.throwError("invalid hex string",i.INVALID_ARGUMENT,{arg:"value",value:t});t.length<2*e+2;)t="0x0"+t.substring(2);return t}function y(t){var e=0,r="0x",n="0x";if((o=t)&&null!=o.r&&null!=o.s){null==t.v&&null==t.recoveryParam&&i.throwError("at least on of recoveryParam or v must be specified",i.INVALID_ARGUMENT,{argument:"signature",value:t}),r=p(t.r,32),n=p(t.s,32),"string"==typeof(e=t.v)&&(e=parseInt(e,16));var o=t.recoveryParam;e=27+(o=null==o&&null!=t.v?1-e%2:o)}else{if(65!==(t=c(t)).length)throw new Error("invalid signature");r=d(t.slice(0,32)),n=d(t.slice(32,64)),27!==(e=t[64])&&28!==e&&(e=27+e%2)}return{r:r,s:n,recoveryParam:e-27,v:e}}r.hexlify=d,r.hexDataLength=function(t){return h(t)&&t.length%2==0?(t.length-2)/2:null},r.hexDataSlice=function(t,e,r){return h(t)||i.throwError("invalid hex data",i.INVALID_ARGUMENT,{arg:"value",value:t}),t.length%2!=0&&i.throwError("hex data length must be even",i.INVALID_ARGUMENT,{arg:"value",value:t}),e=2+2*e,null!=r?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)},r.hexStripZeros=function(t){for(h(t)||i.throwError("invalid hex string",i.INVALID_ARGUMENT,{arg:"value",value:t});3<t.length&&"0x0"===t.substring(0,3);)t="0x"+t.substring(3);return t},r.hexZeroPad=p,r.splitSignature=y,r.joinSignature=function(t){return d(l([(t=y(t)).r,t.s,t.recoveryParam?"0x1c":"0x1b"]))}},{"../errors":5}],65:[function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var i=n(t("../errors")),o=t("./bytes"),a=t("./utf8"),s=t("./keccak256"),u=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),c=new RegExp("^((.*)\\.)?([^.]+)$"),l=new RegExp("^[a-z0-9.-]*$");r.namehash=function(t){"string"!=typeof t&&i.throwError("invalid address - "+String(t),i.INVALID_ARGUMENT,{argument:"name",value:t}),(t=t.toLowerCase()).match(l)||i.throwError("contains invalid UseSTD3ASCIIRules characters",i.INVALID_ARGUMENT,{argument:"name",value:t});for(var e=u;t.length;){var r=t.match(c),n=a.toUtf8Bytes(r[3]);e=s.keccak256(o.concat([e,s.keccak256(n)])),t=r[2]||""}return o.hexlify(e)},r.id=function(t){return s.keccak256(a.toUtf8Bytes(t))},r.hashMessage=function(t){return s.keccak256(o.concat([a.toUtf8Bytes("Ethereum Signed Message:\n"),a.toUtf8Bytes(String(t.length)),"string"==typeof t?a.toUtf8Bytes(t):t]))}},{"../errors":5,"./bytes":64,"./keccak256":71,"./utf8":85}],66:[function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var i=n(t("../errors")),o=t("../wordlists/lang-en"),a=t("./basex"),s=t("./bytes"),u=t("./bignumber"),c=t("./utf8"),l=t("./pbkdf2"),h=t("./hmac"),f=t("./properties"),d=t("./secp256k1"),p=t("./sha2"),y=u.bigNumberify("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),m=c.toUtf8Bytes("Bitcoin seed"),v=2147483648;function g(t){return(1<<t)-1<<8-t}function b(t){return s.hexZeroPad(s.hexlify(t),32)}function w(t){var e=s.hexDataSlice(p.sha256(p.sha256(t)),0,4);return a.Base58.encode(s.concat([t,e]))}var _={};r.defaultPath="m/44'/60'/0'/0/0";var k=(Object.defineProperty(x.prototype,"extendedKey",{get:function(){if(256<=this.depth)throw new Error("Depth too large!");return w(s.concat([null!=this.privateKey?"0x0488ADE4":"0x0488B21E",s.hexlify(this.depth),this.parentFingerprint,s.hexZeroPad(s.hexlify(this.index),4),this.chainCode,null!=this.privateKey?s.concat(["0x00",this.privateKey]):this.publicKey]))},enumerable:!0,configurable:!0}),x.prototype.neuter=function(){return new x(_,null,this.publicKey,this.parentFingerprint,this.chainCode,this.index,this.depth,null,this.path)},x.prototype._derive=function(t){if(4294967295<t)throw new Error("invalid index - "+String(t));var e=this.path;e&&(e+="/"+(t&~v));var r=new Uint8Array(37);if(t&v){if(!this.privateKey)throw new Error("cannot derive child of neutered node");r.set(s.arrayify(this.privateKey),1),e&&(e+="'")}else r.set(s.arrayify(this.publicKey));for(var n=24;0<=n;n-=8)r[33+(n>>3)]=t>>24-n&255;var i=(c=h.computeHmac(h.SupportedAlgorithms.sha512,this.chainCode,r)).slice(0,32),o=c.slice(32),a=null,c=null;return this.privateKey?a=b(u.bigNumberify(i).add(this.privateKey).mod(y)):c=new d.KeyPair(s.hexlify(i))._addPoint(this.publicKey),new x(_,a,c,this.fingerprint,b(o),t,this.depth+1,this.mnemonic,e)},x.prototype.derivePath=function(t){var e=t.split("/");if(0===e.length||"m"===e[0]&&0!==this.depth)throw new Error("invalid path - "+t);"m"===e[0]&&e.shift();for(var r=this,n=0;n<e.length;n++){var i=e[n];if(i.match(/^[0-9]+'$/)){var o=parseInt(i.substring(0,i.length-1));if(v<=o)throw new Error("invalid path index - "+i);r=r._derive(v+o)}else{if(!i.match(/^[0-9]+$/))throw new Error("invalid path component - "+i);if(o=parseInt(i),v<=o)throw new Error("invalid path index - "+i);r=r._derive(o)}}return r},x.isHDNode=function(t){return f.isType(t,"HDNode")},x);function x(t,e,r,n,o,a,u,c,l){if(i.checkNew(this,x),t!==_)throw new Error("HDNode constructor cannot be called directly");e?(e=new d.KeyPair(e),f.defineReadOnly(this,"privateKey",e.privateKey),f.defineReadOnly(this,"publicKey",e.compressedPublicKey)):(f.defineReadOnly(this,"privateKey",null),f.defineReadOnly(this,"publicKey",s.hexlify(r))),f.defineReadOnly(this,"parentFingerprint",n),f.defineReadOnly(this,"fingerprint",s.hexDataSlice(p.ripemd160(p.sha256(this.publicKey)),0,4)),f.defineReadOnly(this,"address",d.computeAddress(this.publicKey)),f.defineReadOnly(this,"chainCode",o),f.defineReadOnly(this,"index",a),f.defineReadOnly(this,"depth",u),f.defineReadOnly(this,"mnemonic",c),f.defineReadOnly(this,"path",l),f.setType(this,"HDNode")}function A(t,e){if((t=s.arrayify(t)).length<16||64<t.length)throw new Error("invalid seed");return t=s.arrayify(h.computeHmac(h.SupportedAlgorithms.sha512,m,t)),new k(_,b(t.slice(0,32)),null,"0x00000000",b(t.slice(32)),0,0,e,"m")}function I(t,e){return e=c.toUtf8Bytes("mnemonic"+(e=e||""),c.UnicodeNormalizationForm.NFKD),s.hexlify(l.pbkdf2(c.toUtf8Bytes(t,c.UnicodeNormalizationForm.NFKD),e,2048,64,"sha512"))}function E(t,e){e=e||o.langEn,i.checkNormalize();var r=e.split(t);if(r.length%3!=0)throw new Error("invalid mnemonic");for(var n=s.arrayify(new Uint8Array(Math.ceil(11*r.length/8))),a=0,u=0;u<r.length;u++){var c=e.getWordIndex(r[u].normalize("NFKD"));if(-1===c)throw new Error("invalid mnemonic");for(var l=0;l<11;l++)c&1<<10-l&&(n[a>>3]|=1<<7-a%8),a++}var h=32*r.length/3,f=g(r.length/3);if(t=s.arrayify(p.sha256(n.slice(0,h/8)))[0],(t&=f)!=(n[n.length-1]&f))throw new Error("invalid checksum");return s.hexlify(n.slice(0,h/8))}function S(t,e){if((t=s.arrayify(t)).length%4!=0||t.length<16||32<t.length)throw new Error("invalid entropy");for(var r=[0],n=11,i=0;i<t.length;i++)8<n?(r[r.length-1]<<=8,r[r.length-1]|=t[i],n-=8):(r[r.length-1]<<=n,r[r.length-1]|=t[i]>>8-n,r.push(t[i]&(1<<8-n)-1),n+=3);var a=s.arrayify(p.sha256(t))[0],u=t.length/4;return a&=g(u),r[r.length-1]<<=u,r[r.length-1]|=a>>8-u,(e=e||o.langEn).join(r.map((function(t){return e.getWord(t)})))}r.HDNode=k,r.fromExtendedKey=function(t){var e=a.Base58.decode(t);82===e.length&&w(e.slice(0,78))===t||i.throwError("invalid extended key",i.INVALID_ARGUMENT,{argument:"extendedKey",value:"[REDACTED]"});var r=e[4],n=s.hexlify(e.slice(5,9)),o=parseInt(s.hexlify(e.slice(9,13)).substring(2),16),u=s.hexlify(e.slice(13,45)),c=e.slice(45,78);switch(s.hexlify(e.slice(0,4))){case"0x0488b21e":case"0x043587cf":return new k(_,null,s.hexlify(c),n,u,o,r,null,null);case"0x0488ade4":case"0x04358394":if(0!==c[0])break;return new k(_,s.hexlify(c.slice(1)),null,n,u,o,r,null,null)}return i.throwError("invalid extended key",i.INVALID_ARGUMENT,{argument:"extendedKey",value:"[REDACTED]"})},r.fromMnemonic=function(t,e,r){return A(I(t=S(E(t,e),e),r),t)},r.fromSeed=function(t){return A(t,null)},r.mnemonicToSeed=I,r.mnemonicToEntropy=E,r.entropyToMnemonic=S,r.isValidMnemonic=function(t,e){try{return E(t,e),!0}catch(t){}return!1}},{"../errors":5,"../wordlists/lang-en":90,"./basex":62,"./bignumber":63,"./bytes":64,"./hmac":67,"./pbkdf2":73,"./properties":74,"./secp256k1":77,"./sha2":79,"./utf8":85}],67:[function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var i,o=n(t("hash.js")),a=t("../utils/bytes"),s=n(t("../errors"));(t=i=r.SupportedAlgorithms||(r.SupportedAlgorithms={})).sha256="sha256",t.sha512="sha512",r.computeHmac=function(t,e,r){return i[t]||s.throwError("unsupported algorithm "+t,s.UNSUPPORTED_OPERATION,{operation:"hmac",algorithm:t}),a.arrayify(o.hmac(o[t],a.arrayify(e)).update(a.arrayify(r)).digest())}},{"../errors":5,"../utils/bytes":64,"hash.js":26}],68:[function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var i=t("./abi-coder");r.AbiCoder=i.AbiCoder,r.defaultAbiCoder=i.defaultAbiCoder,r.formatSignature=i.formatSignature,r.formatParamType=i.formatParamType,r.parseSignature=i.parseSignature,r.parseParamType=i.parseParamType,i=t("./address"),r.getAddress=i.getAddress,r.getContractAddress=i.getContractAddress,r.getCreate2Address=i.getCreate2Address,r.getIcapAddress=i.getIcapAddress,i=n(t("./base64")),r.base64=i,i=t("./bignumber"),r.BigNumber=i.BigNumber,r.bigNumberify=i.bigNumberify,i=t("./bytes"),r.arrayify=i.arrayify,r.concat=i.concat,r.hexDataSlice=i.hexDataSlice,r.hexDataLength=i.hexDataLength,r.hexlify=i.hexlify,r.hexStripZeros=i.hexStripZeros,r.hexZeroPad=i.hexZeroPad,r.isHexString=i.isHexString,r.joinSignature=i.joinSignature,r.padZeros=i.padZeros,r.splitSignature=i.splitSignature,r.stripZeros=i.stripZeros,i=t("./hash"),r.hashMessage=i.hashMessage,r.id=i.id,r.namehash=i.namehash,i=n(t("./hdnode")),r.HDNode=i,i=t("./interface"),r.Interface=i.Interface,i=t("./json-wallet"),r.getJsonWalletAddress=i.getJsonWalletAddress,i=t("./keccak256"),r.keccak256=i.keccak256,i=t("./sha2"),r.sha256=i.sha256,i=t("./solidity"),r.solidityKeccak256=i.keccak256,r.solidityPack=i.pack,r.soliditySha256=i.sha256,i=t("./random-bytes"),r.randomBytes=i.randomBytes,i=t("./networks"),r.getNetwork=i.getNetwork,i=t("./properties"),r.checkProperties=i.checkProperties,r.deepCopy=i.deepCopy,r.defineReadOnly=i.defineReadOnly,r.resolveProperties=i.resolveProperties,r.shallowCopy=i.shallowCopy,n=n(t("./rlp")),r.RLP=n,n=t("./secp256k1"),r.computeAddress=n.computeAddress,r.computePublicKey=n.computePublicKey,r.recoverAddress=n.recoverAddress,r.recoverPublicKey=n.recoverPublicKey,r.verifyMessage=n.verifyMessage,n=t("./signing-key"),r.SigningKey=n.SigningKey,n=t("./transaction"),r.populateTransaction=n.populateTransaction,n=t("./transaction"),r.parseTransaction=n.parse,r.serializeTransaction=n.serialize,n=t("./utf8"),r.formatBytes32String=n.formatBytes32String,r.parseBytes32String=n.parseBytes32String,r.toUtf8Bytes=n.toUtf8Bytes,r.toUtf8String=n.toUtf8String,n=t("./units"),r.commify=n.commify,r.formatEther=n.formatEther,r.parseEther=n.parseEther,r.formatUnits=n.formatUnits,r.parseUnits=n.parseUnits,n=t("./web"),r.fetchJson=n.fetchJson,r.poll=n.poll,n=t("./hmac"),r.SupportedAlgorithms=n.SupportedAlgorithms,n=t("./utf8"),r.UnicodeNormalizationForm=n.UnicodeNormalizationForm,t=t("./wordlist"),r.Wordlist=t.Wordlist},{"./abi-coder":59,"./address":60,"./base64":61,"./bignumber":63,"./bytes":64,"./hash":65,"./hdnode":66,"./hmac":67,"./interface":69,"./json-wallet":70,"./keccak256":71,"./networks":72,"./properties":74,"./random-bytes":75,"./rlp":76,"./secp256k1":77,"./sha2":79,"./signing-key":81,"./solidity":82,"./transaction":83,"./units":84,"./utf8":85,"./web":86,"./wordlist":87}],69:[function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var a,s=t("./address"),u=t("./abi-coder"),c=t("./bignumber"),l=t("./bytes"),h=t("./hash"),f=t("./keccak256"),d=t("./properties"),p=o(t("../errors")),y=function(t){d.setType(this,"Indexed"),d.defineReadOnly(this,"hash",t)},m=(i(v,a=t=function(t){for(var e in d.setType(this,"Description"),t)d.defineReadOnly(this,e,d.deepCopy(t[e],!0));Object.freeze(this)}),v.prototype.encode=function(t,e){l.isHexString(t)||p.throwError("invalid contract bytecode",p.INVALID_ARGUMENT,{arg:"bytecode",value:t}),p.checkArgumentCount(e.length,this.inputs.length," in Interface constructor");try{return t+u.defaultAbiCoder.encode(this.inputs,e).substring(2)}catch(t){p.throwError("invalid constructor argument",p.INVALID_ARGUMENT,{arg:t.arg,reason:t.reason,value:t.value})}return null},v);function v(){return null!==a&&a.apply(this,arguments)||this}var g,b=(i(w,g=t),w.prototype.encode=function(t){p.checkArgumentCount(t.length,this.inputs.length," in interface function "+this.name);try{return this.sighash+u.defaultAbiCoder.encode(this.inputs,t).substring(2)}catch(t){p.throwError("invalid input argument",p.INVALID_ARGUMENT,{arg:t.arg,reason:t.reason,value:t.value})}return null},w.prototype.decode=function(t){try{return u.defaultAbiCoder.decode(this.outputs,l.arrayify(t))}catch(e){p.throwError("invalid data for function output",p.INVALID_ARGUMENT,{arg:"data",errorArg:e.arg,errorValue:e.value,value:t,reason:e.reason})}},w);function w(){return null!==g&&g.apply(this,arguments)||this}var _,k=(i(x,_=t),x);function x(){return null!==_&&_.apply(this,arguments)||this}var A,I=(i(E,A=t),E.prototype.encodeTopics=function(t){var e=this;t.length>this.inputs.length&&p.throwError("too many arguments for "+this.name,p.UNEXPECTED_ARGUMENT,{maxCount:t.length,expectedCount:this.inputs.length});var r=[];for(this.anonymous||r.push(this.topic),t.forEach((function(t,n){var i=e.inputs[n];i.indexed?null==t?r.push(null):"string"===i.type?r.push(h.id(t)):"bytes"===i.type?r.push(f.keccak256(t)):-1!==i.type.indexOf("[")||"tuple"===i.type.substring(0,5)?p.throwError("filtering with tuples or arrays not implemented yet; bug us on GitHub",p.NOT_IMPLEMENTED,{operation:"filter(array|tuple)"}):("address"===i.type&&s.getAddress(t),r.push(l.hexZeroPad(l.hexlify(t),32).toLowerCase())):null!=t&&p.throwError("cannot filter non-indexed parameters; must be null",p.INVALID_ARGUMENT,{argument:i.name||n,value:t})}));r.length&&null===r[r.length-1];)r.pop();return r},E.prototype.decode=function(t,e){null==e||this.anonymous||(e=e.slice(1));var r,n=[],i=[],o=[];this.inputs.forEach((function(t,e){t.indexed?"string"===t.type||"bytes"===t.type||0<=t.type.indexOf("[")||"tuple"===t.type.substring(0,5)?(n.push({type:"bytes32",name:t.name||""}),o.push(!0)):(n.push(t),o.push(!1)):(i.push(t),o.push(!1))})),null!=e&&(r=u.defaultAbiCoder.decode(n,l.concat(e)));var a=u.defaultAbiCoder.decode(i,l.arrayify(t)),s={},c=0,h=0;return this.inputs.forEach((function(t,n){t.indexed?null==e?s[n]=new y(null):o[n]?s[n]=new y(r[h++]):s[n]=r[h++]:s[n]=a[c++],t.name&&(s[t.name]=s[n])})),s.length=this.inputs.length,new k(s)},E);function E(){return null!==A&&A.apply(this,arguments)||this}var S,M=(i(T,S=t),T);function T(){return null!==S&&S.apply(this,arguments)||this}var P,C=(i(O,P=t),O);function O(){return null!==P&&P.apply(this,arguments)||this}function R(t){switch(t.type){case"constructor":var e=new m({inputs:t.inputs,payable:null==t.payable||!!t.payable});this.deployFunction||(this.deployFunction=e);break;case"function":var r=u.formatSignature(t).replace(/tuple/g,""),n=h.id(r).substring(0,10),i=!1;null!=t.constant?i=t.constant:null!=t.stateMutability&&(i="view"==t.stateMutability||"pure"==t.stateMutability),e=new b({inputs:t.inputs,outputs:t.outputs,gas:t.gas,payable:null==t.payable||!!t.payable,type:i?"call":"transaction",name:t.name,signature:r,sighash:n}),t.name&&(null==this.functions[t.name]?d.defineReadOnly(this.functions,t.name,e):p.warn("WARNING: Multiple definitions for "+t.name)),null==this.functions[e.signature]&&d.defineReadOnly(this.functions,e.signature,e);break;case"event":r=u.formatSignature(t).replace(/tuple/g,""),e=new I({name:t.name,signature:r,inputs:t.inputs,topic:h.id(r),anonymous:!!t.anonymous}),t.name&&null==this.events[t.name]&&d.defineReadOnly(this.events,t.name,e),null==this.events[e.signature]&&d.defineReadOnly(this.events,e.signature,e);break;case"receive":case"fallback":break;default:p.warn("WARNING: unsupported ABI type - "+t.type)}}function j(t){if(p.checkNew(this,j),"string"==typeof t){try{t=JSON.parse(t)}catch(e){p.throwError("could not parse ABI JSON",p.INVALID_ARGUMENT,{arg:"abi",errorMessage:e.message,value:t})}if(!Array.isArray(t))return p.throwError("invalid abi",p.INVALID_ARGUMENT,{arg:"abi",value:t}),null}d.defineReadOnly(this,"functions",{}),d.defineReadOnly(this,"events",{});var e=[];t.forEach((function(t){"string"==typeof t&&(t=u.parseSignature(t)),e.push(t)})),d.defineReadOnly(this,"abi",d.deepCopy(e,!0)),e.forEach(R,this),this.deployFunction||R.call(this,{type:"constructor",inputs:[]}),d.setType(this,"Interface")}j.prototype.parseTransaction=function(t){var e,r=t.data.substring(0,10).toLowerCase();for(e in this.functions)if(-1!==e.indexOf("(")){var n=this.functions[e];if(n.sighash===r){var i=u.defaultAbiCoder.decode(n.inputs,"0x"+t.data.substring(10));return new M({args:i,decode:n.decode,name:n.name,signature:n.signature,sighash:n.sighash,value:c.bigNumberify(t.value||"0")})}}return null},j.prototype.parseLog=function(t){for(var e in this.events)if(-1!==e.indexOf("(")&&!(e=this.events[e]).anonymous&&e.topic===t.topics[0])return new C({decode:e.decode,name:e.name,signature:e.signature,topic:e.topic,values:e.decode(t.data,t.topics)});return null},j.isInterface=function(t){return d.isType(t,"Interface")},j.isIndexed=function(t){return d.isType(t,"Indexed")},t=j,r.Interface=t},{"../errors":5,"./abi-coder":59,"./address":60,"./bignumber":63,"./bytes":64,"./hash":65,"./keccak256":71,"./properties":74}],70:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./address");function i(t){try{var e=JSON.parse(t)}catch(t){return!1}return e.encseed&&e.ethaddr}function o(t){try{var e=JSON.parse(t)}catch(t){return!1}return!(!e.version||parseInt(e.version)!==e.version||3!==parseInt(e.version))}r.isCrowdsaleWallet=i,r.isSecretStorageWallet=o,r.getJsonWalletAddress=function(t){if(i(t))try{return n.getAddress(JSON.parse(t).ethaddr)}catch(t){return null}if(o(t))try{return n.getAddress(JSON.parse(t).address)}catch(t){return null}return null}},{"./address":60}],71:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("js-sha3"),i=t("./bytes");r.keccak256=function(t){return"0x"+n.keccak_256(i.arrayify(t))}},{"./bytes":64,"js-sha3":40}],72:[function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var i=n(t("../errors"));function o(t){return function(e){var r=[];return e.InfuraProvider&&r.push(new e.InfuraProvider(t)),e.EtherscanProvider&&r.push(new e.EtherscanProvider(t)),0===r.length?null:e.FallbackProvider?new e.FallbackProvider(r):r[0]}}function a(t,e){return function(r){return r.JsonRpcProvider?new r.JsonRpcProvider(t,e):null}}var s={unspecified:{chainId:0,name:"unspecified"},homestead:n={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:o("homestead")},mainnet:n,morden:{chainId:2,name:"morden"},ropsten:t={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:o("ropsten")},testnet:t,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:o("rinkeby")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:o("goerli")},kovan:{chainId:42,name:"kovan",_defaultProvider:o("kovan")},classic:{chainId:61,name:"classic",_defaultProvider:a("https://web3.gastracker.io","classic")},classicTestnet:{chainId:62,name:"classicTestnet",_defaultProvider:a("https://web3.gastracker.io/morden","classicTestnet")}};r.getNetwork=function(t){if(null==t)return null;if("number"==typeof t){for(var e in s)if((e=s[e]).chainId===t)return{name:e.name,chainId:e.chainId,ensAddress:e.ensAddress||null,_defaultProvider:e._defaultProvider||null};return{chainId:t,name:"unknown"}}if("string"!=typeof t)return(r=s[t.name])?(0!==t.chainId&&t.chainId!==r.chainId&&i.throwError("network chainId mismatch",i.INVALID_ARGUMENT,{arg:"network",value:t}),{name:t.name,chainId:r.chainId,ensAddress:t.ensAddress||r.ensAddress||null,_defaultProvider:t._defaultProvider||r._defaultProvider||null}):("number"!=typeof t.chainId&&i.throwError("invalid network chainId",i.INVALID_ARGUMENT,{arg:"network",value:t}),t);var r=s[t];return null==r?null:{name:r.name,chainId:r.chainId,ensAddress:r.ensAddress,_defaultProvider:r._defaultProvider||null}}},{"../errors":5}],73:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("../utils/bytes"),i=t("./hmac");r.pbkdf2=function(t,e,r,o,a){var s;t=n.arrayify(t),e=n.arrayify(e);var u,c,l=1,h=new Uint8Array(o),f=new Uint8Array(e.length+4);f.set(e);for(var d=1;d<=l;d++){f[e.length]=d>>24&255,f[e.length+1]=d>>16&255,f[e.length+2]=d>>8&255,f[e.length+3]=255&d;var p=i.computeHmac(a,t,f);s||(s=p.length,c=new Uint8Array(s),u=o-((l=Math.ceil(o/s))-1)*s),c.set(p);for(var y=1;y<r;y++){p=i.computeHmac(a,t,p);for(var m=0;m<s;m++)c[m]^=p[m]}var v=(d-1)*s,g=d===l?u:s;h.set(n.arrayify(c).slice(0,g),v)}return n.arrayify(h)}},{"../utils/bytes":64,"./hmac":67}],74:[function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var i=n(t("../errors"));function o(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function a(t,e){return t&&t._ethersType===e}r.defineReadOnly=o,r.setType=function(t,e){Object.defineProperty(t,"_ethersType",{configurable:!1,value:e,writable:!1})},r.isType=a,r.resolveProperties=function(t){var e={},r=[];return Object.keys(t).forEach((function(n){var i=t[n];i instanceof Promise?r.push(i.then((function(t){return e[n]=t,null}))):e[n]=i})),Promise.all(r).then((function(){return e}))},r.checkProperties=function(t,e){t&&"object"==s(t)||i.throwError("invalid object",i.INVALID_ARGUMENT,{argument:"object",value:t}),Object.keys(t).forEach((function(r){e[r]||i.throwError("invalid object key - "+r,i.INVALID_ARGUMENT,{argument:"transaction",value:t,key:r})}))},r.shallowCopy=function(t){var e,r={};for(e in t)r[e]=t[e];return r};var u={boolean:!0,number:!0,string:!0};r.deepCopy=function t(e,r){if(null==e||u[s(e)])return e;if(Array.isArray(e)){var n=e.map((function(e){return t(e,r)}));return r&&Object.freeze(n),n}if("object"==s(e)){if(a(e,"BigNumber"))return e;if(a(e,"Description"))return e;if(a(e,"Indexed"))return e;var i;for(i in n={},e){var c=e[i];void 0!==c&&o(n,i,t(c,r))}return r&&Object.freeze(n),n}if("function"==typeof e)return e;throw new Error("Cannot deepCopy "+s(e))},r.inheritable=function t(e){return function(r){var n,i;i=e,(n=r).super_=i,n.prototype=Object.create(i.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),o(r,"inherits",t(r))}}},{"../errors":5}],75:[function(t,e,n){(function(e){(function(){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=t("../utils/bytes"),i=t("../utils/properties"),o=e.crypto||e.msCrypto;function a(t){if(t<=0||1024<t||parseInt(String(t))!=t)throw new Error("invalid length");return t=new Uint8Array(t),o.getRandomValues(t),r.arrayify(t)}o&&o.getRandomValues||(console.log("WARNING: Missing strong random number source; using weak randomBytes"),o={getRandomValues:function(t){for(var e=0;e<20;e++)for(var r=0;r<t.length;r++)e?t[r]^=Math.trunc(256*Math.random()):t[r]=Math.trunc(256*Math.random());return t},_weakCrypto:!0}),n.randomBytes=a,!0===o._weakCrypto&&i.defineReadOnly(a,"_weakCrypto",!0)}).call(this)}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utils/bytes":64,"../utils/properties":74}],76:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./bytes");function i(t){for(var e=[];t;)e.unshift(255&t),t>>=8;return e}function o(t,e,r){for(var n=0,i=0;i<r;i++)n=256*n+t[e+i];return n}function a(t,e,r,n){for(var i=[];r<e+1+n;){var o=s(t,r);if(i.push(o.result),e+1+n<(r+=o.consumed))throw new Error("invalid rlp")}return{consumed:1+n,result:i}}function s(t,e){if(0===t.length)throw new Error("invalid rlp data");if(248<=t[e]){if(e+1+(r=t[e]-247)>t.length)throw new Error("too short");if(e+1+r+(i=o(t,e+1,r))>t.length)throw new Error("to short");return a(t,e,e+1+r,r+i)}if(192<=t[e]){if(e+1+(i=t[e]-192)>t.length)throw new Error("invalid rlp data");return a(t,e,e+1,i)}if(184<=t[e]){var r;if(e+1+(r=t[e]-183)>t.length)throw new Error("invalid rlp data");if(e+1+r+(i=o(t,e+1,r))>t.length)throw new Error("invalid rlp data");return{consumed:1+r+i,result:n.hexlify(t.slice(e+1+r,e+1+r+i))}}if(128<=t[e]){var i;if(e+1+(i=t[e]-128)>t.length)throw new Error("invalid rlp data");return{consumed:1+i,result:n.hexlify(t.slice(e+1,e+1+i))}}return{consumed:1,result:n.hexlify(t[e])}}r.encode=function(t){return n.hexlify(function t(e){if(Array.isArray(e)){var r=[];return e.forEach((function(e){r=r.concat(t(e))})),r.length<=55?(r.unshift(192+r.length),r):((o=i(r.length)).unshift(247+o.length),o.concat(r))}var o;return 1===(e=Array.prototype.slice.call(n.arrayify(e))).length&&e[0]<=127?e:e.length<=55?(e.unshift(128+e.length),e):((o=i(e.length)).unshift(183+o.length),o.concat(e))}(t))},r.decode=function(t){var e=n.arrayify(t);if((t=s(e,0)).consumed!==e.length)throw new Error("invalid rlp data");return t.result}},{"./bytes":64}],77:[function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var i=t("elliptic"),o=t("./address"),a=t("./bytes"),s=t("./hash"),u=t("./keccak256"),c=t("./properties"),l=n(t("../errors")),h=null;function f(){return h=h||new i.ec("secp256k1")}var d=(p.prototype.sign=function(t){return{recoveryParam:(t=f().keyFromPrivate(a.arrayify(this.privateKey)).sign(a.arrayify(t),{canonical:!0})).recoveryParam,r:a.hexZeroPad("0x"+t.r.toString(16),32),s:a.hexZeroPad("0x"+t.s.toString(16),32),v:27+t.recoveryParam}},p.prototype.computeSharedSecret=function(t){var e=f().keyFromPrivate(a.arrayify(this.privateKey));return t=f().keyFromPublic(a.arrayify(y(t))),a.hexZeroPad("0x"+e.derive(t.getPublic()).toString(16),32)},p.prototype._addPoint=function(t){var e=f().keyFromPublic(a.arrayify(this.publicKey));return t=f().keyFromPublic(a.arrayify(t)),"0x"+e.pub.add(t.pub).encodeCompressed("hex")},p);function p(t){t=f().keyFromPrivate(a.arrayify(t)),c.defineReadOnly(this,"privateKey",a.hexlify(t.priv.toArray("be",32))),c.defineReadOnly(this,"publicKey","0x"+t.getPublic(!1,"hex")),c.defineReadOnly(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),c.defineReadOnly(this,"publicKeyBytes",t.getPublic().encode(null,!0))}function y(t,e){return 32!==(t=a.arrayify(t)).length?33===t.length?e?a.hexlify(t):"0x"+f().keyFromPublic(t).getPublic(!1,"hex"):65===t.length?e?"0x"+f().keyFromPublic(t).getPublic(!0,"hex"):a.hexlify(t):(l.throwError("invalid public or private key",l.INVALID_ARGUMENT,{arg:"key",value:"[REDACTED]"}),null):(t=new d(t),e?t.compressedPublicKey:t.publicKey)}function m(t){return t="0x"+y(t).slice(4),o.getAddress("0x"+u.keccak256(t).substring(26))}function v(t,e){var r=a.splitSignature(e);return e={r:a.arrayify(r.r),s:a.arrayify(r.s)},"0x"+f().recoverPubKey(a.arrayify(t),e,r.recoveryParam).encode("hex",!1)}function g(t,e){return m(v(a.arrayify(t),e))}r.KeyPair=d,r.computePublicKey=y,r.computeAddress=m,r.recoverPublicKey=v,r.recoverAddress=g,r.verifyMessage=function(t,e){return g(s.hashMessage(t),e)}},{"../errors":5,"./address":60,"./bytes":64,"./hash":65,"./keccak256":71,"./properties":74,elliptic:12}],78:[function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var o=n(t("aes-js")),a=n(t("scrypt-js")),s=n(t("uuid")),u=t("./signing-key"),c=i(t("./hdnode")),l=t("./address"),h=t("./bytes"),f=t("./pbkdf2"),d=t("./keccak256"),p=t("./utf8"),y=t("./random-bytes");function m(t){return"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),h.arrayify(t)}function v(t,e){for(t=String(t);t.length<e;)t="0"+t;return t}function g(t){return"string"==typeof t?p.toUtf8Bytes(t,p.UnicodeNormalizationForm.NFKC):h.arrayify(t)}function b(t,e){for(var r=t,n=e.toLowerCase().split("/"),i=0;i<n.length;i++){var o,a=null;for(o in r)if(o.toLowerCase()===n[i]){a=r[o];break}if(null===a)return null;r=a}return r}r.decryptCrowdsale=function(t,e){var r=JSON.parse(t);e=g(e);var n=l.getAddress(b(r,"ethaddr"));if(!(t=m(b(r,"encseed")))||t.length%16!=0)throw new Error("invalid encseed");r=f.pbkdf2(e,e,2e3,32,"sha256").slice(0,16),e=t.slice(0,16),t=t.slice(16),e=new o.default.ModeOfOperation.cbc(r,e);for(var i=h.arrayify(e.decrypt(t)),a=(i=o.default.padding.pkcs7.strip(i),""),s=0;s<i.length;s++)a+=String.fromCharCode(i[s]);if(t=p.toUtf8Bytes(a),(t=new u.SigningKey(d.keccak256(t))).address!==n)throw new Error("corrupt crowdsale wallet");return t},r.decrypt=function(t,e,r){function n(t,e){var r=m(b(i,"crypto/ciphertext"));if(h.hexlify((s=t.slice(16,32),d.keccak256(h.concat([s,r])))).substring(2)!==b(i,"crypto/mac").toLowerCase())return e(new Error("invalid password")),null;var n=function(t,e){if("aes-128-ctr"!==b(i,"crypto/cipher"))return null;var r=m(b(i,"crypto/cipherparams/iv"));return r=new o.default.Counter(r),r=new o.default.ModeOfOperation.ctr(t,r),h.arrayify(r.decrypt(e))}(t.slice(0,16),r),a=t.slice(32,64);if(!n)return e(new Error("unsupported cipher")),null;var s=new u.SigningKey(n);if(i.address&&s.address!==l.getAddress(i.address))return e(new Error("address mismatch")),null;if(r=b(i,"x-ethers/locale"),"0.1"===b(i,"x-ethers/version")&&(null==r||"en"===r)){if(t=m(b(i,"x-ethers/mnemonicCiphertext")),r=m(b(i,"x-ethers/mnemonicCounter")),r=new o.default.Counter(r),a=new o.default.ModeOfOperation.ctr(a,r),r=b(i,"x-ethers/path")||c.defaultPath,t=h.arrayify(a.decrypt(t)),t=c.entropyToMnemonic(t),(r=c.fromMnemonic(t).derivePath(r)).privateKey!=h.hexlify(n))return e(new Error("mnemonic mismatch")),null;s=new u.SigningKey(r)}return s}var i=JSON.parse(t),s=g(e);return new Promise((function(t,e){if((p=b(i,"crypto/kdf"))&&"string"==typeof p)if("scrypt"===p.toLowerCase()){var o=m(b(i,"crypto/kdfparams/salt")),u=parseInt(b(i,"crypto/kdfparams/n")),c=parseInt(b(i,"crypto/kdfparams/r")),l=parseInt(b(i,"crypto/kdfparams/p"));u&&c&&l?0==(u&u-1)?32===(d=parseInt(b(i,"crypto/kdfparams/dklen")))?(r&&r(0),a.default(s,o,u,c,l,64,(function(i,o,a){if(i)i.progress=o,e(i);else if(a)(a=n(a=h.arrayify(a),e))&&(r&&r(1),t(a));else if(r)return r(o)}))):e(new Error("unsupported key-derivation derived-key length")):e(new Error("unsupported key-derivation function parameter value for N")):e(new Error("unsupported key-derivation function parameters"))}else if("pbkdf2"===p.toLowerCase()){if(o=m(b(i,"crypto/kdfparams/salt")),l=null,"hmac-sha256"===(p=b(i,"crypto/kdfparams/prf")))l="sha256";else{if("hmac-sha512"!==p)return void e(new Error("unsupported prf"));l="sha512"}var d,p=parseInt(b(i,"crypto/kdfparams/c"));32===(d=parseInt(b(i,"crypto/kdfparams/dklen")))?(l=n(l=f.pbkdf2(s,o,p,d,l),e))&&t(l):e(new Error("unsupported key-derivation derived-key length"))}else e(new Error("unsupported key-derivation function"));else e(new Error("unsupported key-derivation function"))}))},r.encrypt=function(t,e,r,n){var i;if("function"!=typeof r||n||(n=r,r={}),r=r||{},32!==(i=u.SigningKey.isSigningKey(t)?h.arrayify(t.privateKey):h.arrayify(t)).length)throw new Error("invalid private key");var l=g(e),f=null;if(r.entropy&&(f=h.arrayify(r.entropy)),r.mnemonic)if(f){if(c.entropyToMnemonic(f)!==r.mnemonic)throw new Error("entropy and mnemonic mismatch")}else f=h.arrayify(c.mnemonicToEntropy(r.mnemonic,r.wordlist));var p=r.path;f&&!p&&(p=c.defaultPath);var m=(m=r.client)||"ethers.js",b=r.salt?h.arrayify(r.salt):y.randomBytes(32),w=null;if(r.iv){if(16!==(w=h.arrayify(r.iv)).length)throw new Error("invalid iv")}else w=y.randomBytes(16);var _=null;if(r.uuid){if(16!==(_=h.arrayify(r.uuid)).length)throw new Error("invalid uuid")}else _=y.randomBytes(16);var k=1<<17,x=8,A=1;return r.scrypt&&(r.scrypt.N&&(k=r.scrypt.N),r.scrypt.r&&(x=r.scrypt.r),r.scrypt.p&&(A=r.scrypt.p)),new Promise((function(t,e){n&&n(0),a.default(l,b,k,x,A,64,(function(a,c,l){if(a)a.progress=c,e(a);else if(l){var g=(l=h.arrayify(l)).slice(0,16),I=l.slice(16,32),E=l.slice(32,64);a=new u.SigningKey(i).address,l=new o.default.Counter(w),l=new o.default.ModeOfOperation.ctr(g,l),l=h.arrayify(l.encrypt(i)),I=d.keccak256(h.concat([I,l])),a={address:a.substring(2).toLowerCase(),id:s.default.v4({random:_}),version:3,Crypto:{cipher:"aes-128-ctr",cipherparams:{iv:h.hexlify(w).substring(2)},ciphertext:h.hexlify(l).substring(2),kdf:"scrypt",kdfparams:{salt:h.hexlify(b).substring(2),n:k,dklen:32,p:A,r:x},mac:I.substring(2)}},f&&(l=y.randomBytes(16),I=new o.default.Counter(l),E=new o.default.ModeOfOperation.ctr(E,I),I=h.arrayify(E.encrypt(f)),E=(E=new Date).getUTCFullYear()+"-"+v(E.getUTCMonth()+1,2)+"-"+v(E.getUTCDate(),2)+"T"+v(E.getUTCHours(),2)+"-"+v(E.getUTCMinutes(),2)+"-"+v(E.getUTCSeconds(),2)+".0Z",a["x-ethers"]={client:m,gethFilename:"UTC--"+E+"--"+a.address,mnemonicCounter:h.hexlify(l).substring(2),mnemonicCiphertext:h.hexlify(I).substring(2),path:p,version:"0.1"},r.wordlist&&"string"==typeof r.wordlist.locale&&(a["x-ethers"].locale=r.wordlist.locale)),n&&n(1),t(JSON.stringify(a))}else if(n)return n(c)}))}))}},{"./address":60,"./bytes":64,"./hdnode":66,"./keccak256":71,"./pbkdf2":73,"./random-bytes":75,"./signing-key":81,"./utf8":85,"aes-js":8,"scrypt-js":44,uuid:48}],79:[function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:!0});var i=n(t("hash.js")),o=t("./bytes");r.ripemd160=function(t){return"0x"+i.default.ripemd160().update(o.arrayify(t)).digest("hex")},r.sha256=function(t){return"0x"+i.default.sha256().update(o.arrayify(t)).digest("hex")},r.sha512=function(t){return"0x"+i.default.sha512().update(o.arrayify(t)).digest("hex")}},{"./bytes":64,"hash.js":26}],80:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),t("setimmediate"),r.platform="browser"},{setimmediate:45}],81:[function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var i=t("./hdnode"),o=t("./bytes"),a=t("./properties"),u=t("./secp256k1"),c=n(t("../errors"));function l(t){c.checkNew(this,l);var e=i.HDNode.isHDNode(t)?(a.defineReadOnly(this,"mnemonic",t.mnemonic),a.defineReadOnly(this,"path",t.path),o.arrayify(t.privateKey)):("string"==typeof t&&t.match(/^[0-9a-f]*$/i)&&64===t.length&&(t="0x"+t),o.arrayify(t));try{32!==e.length&&c.throwError("exactly 32 bytes required",c.INVALID_ARGUMENT,{arg:"privateKey",value:"[REDACTED]"})}catch(e){t={arg:"privateKey",reason:e.reason,value:"[REDACTED]"},e.value&&("number"==typeof e.value.length&&(t.length=e.value.length),t.type=s(e.value)),c.throwError("invalid private key",e.code,t)}a.defineReadOnly(this,"privateKey",o.hexlify(e)),a.defineReadOnly(this,"keyPair",new u.KeyPair(e)),a.defineReadOnly(this,"publicKey",this.keyPair.publicKey),a.defineReadOnly(this,"address",u.computeAddress(this.keyPair.publicKey)),a.setType(this,"SigningKey")}l.prototype.signDigest=function(t){return this.keyPair.sign(t)},l.prototype.computeSharedSecret=function(t){return this.keyPair.computeSharedSecret(o.arrayify(t))},l.isSigningKey=function(t){return a.isType(t,"SigningKey")},t=l,r.SigningKey=t},{"../errors":5,"./bytes":64,"./hdnode":66,"./properties":74,"./secp256k1":77}],82:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./bignumber"),i=t("./bytes"),o=t("./utf8"),a=t("./keccak256"),s=t("./sha2"),u=new RegExp("^bytes([0-9]+)$"),c=new RegExp("^(u?int)([0-9]*)$"),l=new RegExp("^(.*)\\[([0-9]*)\\]$");function h(t,e){if(t.length!=e.length)throw new Error("type/value count mismatch");var r=[];return t.forEach((function(t,a){r.push(function t(e,r,a){switch(e){case"address":return a?i.padZeros(r,32):i.arrayify(r);case"string":return o.toUtf8Bytes(r);case"bytes":return i.arrayify(r);case"bool":return r=r?"0x01":"0x00",a?i.padZeros(r,32):i.arrayify(r)}var s=e.match(c);if(s){if((h=parseInt(s[2]||"256"))%8!=0||0===h||256<h)throw new Error("invalid number type - "+e);return a&&(h=256),r=n.bigNumberify(r).toTwos(h),i.padZeros(r,h/8)}if(s=e.match(u)){var h=parseInt(s[1]);if(String(h)!=s[1]||0===h||32<h)throw new Error("invalid number type - "+e);if(i.arrayify(r).byteLength!==h)throw new Error("invalid value for "+e);return a?i.arrayify((r+"0000000000000000000000000000000000000000000000000000000000000000").substring(0,66)):r}if((s=e.match(l))&&Array.isArray(r)){var f=s[1];if(parseInt(s[2]||String(r.length))!=r.length)throw new Error("invalid value for "+e);var d=[];return r.forEach((function(e){d.push(t(f,e,!0))})),i.concat(d)}throw new Error("unknown type - "+e)}(t,e[a]))})),i.hexlify(i.concat(r))}r.pack=h,r.keccak256=function(t,e){return a.keccak256(h(t,e))},r.sha256=function(t,e){return s.sha256(h(t,e))}},{"./bignumber":63,"./bytes":64,"./keccak256":71,"./sha2":79,"./utf8":85}],83:[function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var i=t("../constants"),o=n(t("../errors")),a=t("./secp256k1"),s=t("./address"),u=t("./bignumber"),c=t("./bytes"),l=t("./keccak256"),h=t("./properties"),f=n(t("./rlp")),d=t("../providers/abstract-provider");function p(t){return"0x"===t?i.Zero:u.bigNumberify(t)}var y=[{name:"nonce",maxLength:32},{name:"gasPrice",maxLength:32},{name:"gasLimit",maxLength:32},{name:"to",length:20},{name:"value",maxLength:32},{name:"data"}],m={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0};r.serialize=function(t,e){h.checkProperties(t,m);var r=[];y.forEach((function(e){var n=t[e.name]||[];n=c.arrayify(c.hexlify(n)),e.length&&n.length!==e.length&&0<n.length&&o.throwError("invalid length for "+e.name,o.INVALID_ARGUMENT,{arg:"transaction"+e.name,value:n}),e.maxLength&&(n=c.stripZeros(n)).length>e.maxLength&&o.throwError("invalid length for "+e.name,o.INVALID_ARGUMENT,{arg:"transaction"+e.name,value:n}),r.push(c.hexlify(n))})),null!=t.chainId&&0!==t.chainId&&(r.push(c.hexlify(t.chainId)),r.push("0x"),r.push("0x"));var n=f.encode(r);return e?(e=27+(n=c.splitSignature(e)).recoveryParam,9===r.length&&(r.pop(),r.pop(),r.pop(),e+=2*t.chainId+8),r.push(c.hexlify(e)),r.push(c.stripZeros(c.arrayify(n.r))),r.push(c.stripZeros(c.arrayify(n.s))),f.encode(r)):n},r.parse=function(t){9!==(n=f.decode(t)).length&&6!==n.length&&o.throwError("invalid raw transaction",o.INVALID_ARGUMENT,{arg:"rawTransactin",value:t});var e={nonce:p(n[0]).toNumber(),gasPrice:p(n[1]),gasLimit:p(n[2]),to:"0x"===(r=n[3])?null:s.getAddress(r),value:p(n[4]),data:n[5],chainId:0};if(6===n.length)return e;try{e.v=u.bigNumberify(n[6]).toNumber()}catch(t){return o.info(t),e}if(e.r=c.hexZeroPad(n[7],32),e.s=c.hexZeroPad(n[8],32),u.bigNumberify(e.r).isZero()&&u.bigNumberify(e.s).isZero())e.chainId=e.v,e.v=0;else{e.chainId=Math.floor((e.v-35)/2),e.chainId<0&&(e.chainId=0);var r=e.v-27,n=n.slice(0,6);0!==e.chainId&&(n.push(c.hexlify(e.chainId)),n.push("0x"),n.push("0x"),r-=2*e.chainId+8),n=l.keccak256(f.encode(n));try{e.from=a.recoverAddress(n,{r:c.hexlify(e.r),s:c.hexlify(e.s),recoveryParam:r})}catch(t){o.info(t)}e.hash=l.keccak256(t)}return e},r.populateTransaction=function(t,e,r){d.Provider.isProvider(e)||o.throwError("missing provider",o.INVALID_ARGUMENT,{argument:"provider",value:e}),h.checkProperties(t,m);var n=h.shallowCopy(t);return null!=n.to&&(n.to=e.resolveName(n.to)),null==n.gasPrice&&(n.gasPrice=e.getGasPrice()),null==n.nonce&&(n.nonce=e.getTransactionCount(r)),null==n.gasLimit&&((t=h.shallowCopy(n)).from=r,n.gasLimit=e.estimateGas(t)),null==n.chainId&&(n.chainId=e.getNetwork().then((function(t){return t.chainId}))),h.resolveProperties(n)}},{"../constants":3,"../errors":5,"../providers/abstract-provider":50,"./address":60,"./bignumber":63,"./bytes":64,"./keccak256":71,"./properties":74,"./rlp":76,"./secp256k1":77}],84:[function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var i,o=t("../constants"),a=n(t("../errors")),s=t("./bignumber"),u={};function c(t){return{decimals:t.length-1,tenPower:s.bigNumberify(t)}}function l(t){var e=u[String(t).toLowerCase()];if(!e&&"number"==typeof t&&parseInt(String(t))==t&&0<=t&&t<=256){for(var r="1",n=0;n<t;n++)r+="0";e=c(r)}return e||a.throwError("invalid unitType",a.INVALID_ARGUMENT,{argument:"name",value:t}),e}function h(t,e){for(var r=l(e),n=(e=(t=s.bigNumberify(t)).lt(o.Zero),(t=e?t.mul(o.NegativeOne):t).mod(r.tenPower).toString());n.length<r.decimals;)n="0"+n;return n=n.match(/^([0-9]*[1-9]|0)(0*)/)[1],t=t.div(r.tenPower).toString()+"."+n,e?"-"+t:t}function f(t,e){var r=l(e=null==e?18:e);if("string"==typeof t&&t.match(/^-?[0-9.,]+$/)||a.throwError("invalid decimal value",a.INVALID_ARGUMENT,{arg:"value",value:t}),0===r.decimals)return s.bigNumberify(t);var n="-"===t.substring(0,1);"."===(t=n?t.substring(1):t)&&a.throwError("missing value",a.INVALID_ARGUMENT,{arg:"value",value:t}),2<(e=t.split(".")).length&&a.throwError("too many decimal points",a.INVALID_ARGUMENT,{arg:"value",value:t}),t=e[0];var i=e[1];for(t=t||"0",(i=i||"0").length>r.decimals&&a.throwError("underflow occurred",a.NUMERIC_FAULT,{operation:"division",fault:"underflow"});i.length<r.decimals;)i+="0";return e=s.bigNumberify(t),t=s.bigNumberify(i),t=e.mul(r.tenPower).add(t),n?t.mul(o.NegativeOne):t}i="1",["wei","kwei","Mwei","Gwei","szabo","finney","ether"].forEach((function(t){var e=c(i);u[t.toLowerCase()]=e,u[String(e.decimals)]=e,i+="000"})),r.commify=function(t){var e=String(t).split(".");(2<e.length||!e[0].match(/^-?[0-9]*$/)||e[1]&&!e[1].match(/^[0-9]*$/)||"."===t||"-."===t)&&a.throwError("invalid value",a.INVALID_ARGUMENT,{argument:"value",value:t});var r=e[0],n="";for("-"===r.substring(0,1)&&(n="-",r=r.substring(1));"0"===r.substring(0,1);)r=r.substring(1);""===r&&(r="0"),t="",2===e.length&&(t="."+(e[1]||"0"));for(var i=[];r.length;){if(r.length<=3){i.unshift(r);break}var o=r.length-3;i.unshift(r.substring(o)),r=r.substring(0,o)}return n+i.join(",")+t},r.formatUnits=h,r.parseUnits=f,r.formatEther=function(t){return h(t,18)},r.parseEther=function(t){return f(t,18)}},{"../constants":3,"../errors":5,"./bignumber":63}],85:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n,i=t("../constants"),o=t("../errors"),a=t("./bytes");function s(t,e){(e=void 0===e?n.current:e)!=n.current&&(o.checkNormalize(),t=t.normalize(e));for(var r=[],i=0;i<t.length;i++){var s=t.charCodeAt(i);if(s<128)r.push(s);else if(s<2048)r.push(s>>6|192),r.push(63&s|128);else if(55296==(64512&s)){i++;var u=t.charCodeAt(i);if(i>=t.length||56320!=(64512&u))throw new Error("invalid utf-8 string");r.push((s=65536+((1023&s)<<10)+(1023&u))>>18|240),r.push(s>>12&63|128),r.push(s>>6&63|128),r.push(63&s|128)}else r.push(s>>12|224),r.push(s>>6&63|128),r.push(63&s|128)}return a.arrayify(r)}function u(t,e){t=a.arrayify(t);for(var r="",n=0;n<t.length;){var i=t[n++];if(i>>7!=0){var o=null,s=null;if(192==(224&i))o=1,s=127;else if(224==(240&i))o=2,s=2047;else{if(240!=(248&i)){if(e)continue;if(128==(192&i))throw new Error("invalid utf8 byte sequence; unexpected continuation byte");throw new Error("invalid utf8 byte sequence; invalid prefix")}o=3,s=65535}if(n+o>t.length){if(!e)throw new Error("invalid utf8 byte sequence; too short");for(;n<t.length&&t[n]>>6==2;n++);}else{for(var u=i&(1<<8-o-1)-1,c=0;c<o;c++){var l=t[n];if(128!=(192&l)){u=null;break}u=u<<6|63&l,n++}if(null!==u)if(u<=s){if(!e)throw new Error("invalid utf8 byte sequence; overlong")}else if(1114111<u){if(!e)throw new Error("invalid utf8 byte sequence; out-of-range")}else if(55296<=u&&u<=57343){if(!e)throw new Error("invalid utf8 byte sequence; utf-16 surrogate")}else u<=65535?r+=String.fromCharCode(u):(u-=65536,r+=String.fromCharCode(55296+(u>>10&1023),56320+(1023&u)));else if(!e)throw new Error("invalid utf8 byte sequence; invalid continuation byte")}}else r+=String.fromCharCode(i)}return r}(t=n=r.UnicodeNormalizationForm||(r.UnicodeNormalizationForm={})).current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD",r.toUtf8Bytes=s,r.toUtf8String=u,r.formatBytes32String=function(t){if(31<(t=s(t)).length)throw new Error("bytes32 string must be less than 32 bytes");return a.hexlify(a.concat([t,i.HashZero]).slice(0,32))},r.parseBytes32String=function(t){var e=a.arrayify(t);if(32!==e.length)throw new Error("invalid bytes32 - not 32 bytes long");if(0!==e[31])throw new Error("invalid bytes32 string - no null terminator");for(var r=31;0===e[r-1];)r--;return u(e.slice(0,r))}},{"../constants":3,"../errors":5,"./bytes":64}],86:[function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var i=t("xmlhttprequest"),o=t("./base64"),a=t("./properties"),u=t("./utf8"),c=n(t("../errors"));r.fetchJson=function(t,e,r){var n,a={},l=null,h=12e4;if("string"==typeof t)l=t;else if("object"==s(t)){if(null==t.url&&c.throwError("missing URL",c.MISSING_ARGUMENT,{arg:"url"}),l=t.url,"number"==typeof t.timeout&&0<t.timeout&&(h=t.timeout),t.headers)for(var f in t.headers)a[f.toLowerCase()]={key:f,value:String(t.headers[f])};null!=t.user&&null!=t.password&&("https:"!==l.substring(0,6)&&!0!==t.allowInsecure&&c.throwError("basic authentication requires a secure https url",c.INVALID_ARGUMENT,{arg:"url",url:l,user:t.user,password:"[REDACTED]"}),n=t.user+":"+t.password,a.authorization={key:"Authorization",value:"Basic "+o.encode(u.toUtf8Bytes(n))})}return new Promise((function(t,n){function o(){null!=u&&(clearTimeout(u),u=null)}var s=new i.XMLHttpRequest,u=null;u=setTimeout((function(){null!=u&&(u=null,n(new Error("timeout")),setTimeout((function(){s.abort()}),0))}),h),e?(s.open("POST",l,!0),a["content-type"]={key:"Content-Type",value:"application/json"}):s.open("GET",l,!0),Object.keys(a).forEach((function(t){t=a[t],s.setRequestHeader(t.key,t.value)})),s.onreadystatechange=function(){if(4===s.readyState){if(200!=s.status){o();var i=new Error("invalid response - "+s.status);return i.statusCode=s.status,s.responseText&&(i.responseText=s.responseText),void n(i)}var a=null;try{a=JSON.parse(s.responseText)}catch(i){o();var u=new Error("invalid json response");return u.orginialError=i,u.responseText=s.responseText,null!=e&&(u.requestBody=e),u.url=l,void n(u)}if(r)try{a=r(a)}catch(i){return o(),i.url=l,i.body=e,i.responseText=s.responseText,void n(i)}o(),t(a)}},s.onerror=function(t){o(),n(t)};try{null!=e?s.send(e):s.send()}catch(u){o();var c=new Error("connection error");c.error=u,n(c)}}))},r.poll=function(t,e){return e=e||{},null==(e=a.shallowCopy(e)).floor&&(e.floor=0),null==e.ceiling&&(e.ceiling=1e4),null==e.interval&&(e.interval=250),new Promise((function(r,n){var i=null,o=!1,a=function(){return!o&&(o=!0,i&&clearTimeout(i),!0)};e.timeout&&(i=setTimeout((function(){a()&&n(new Error("timeout"))}),e.timeout));var s=e.fastRetry||null,u=0;!function i(){return t().then((function(t){return void 0!==t?a()&&r(t):e.onceBlock?e.onceBlock.once("block",i):o||(u++,(t=(t=e.interval*parseInt(String(Math.random()*Math.pow(2,u))))<e.floor?e.floor:t)>e.ceiling&&(t=e.ceiling),s&&(u--,t=s,s=null),setTimeout(i,t)),null}),(function(t){a()&&n(t)}))}()}))}},{"../errors":5,"./base64":61,"./properties":74,"./utf8":85,xmlhttprequest:49}],87:[function(t,e,n){(function(e){(function(){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var e=t("../utils/hash"),r=t("../utils/properties");n.check=function(t){for(var r=[],n=0;n<2048;n++){var i=t.getWord(n);if(n!==t.getWordIndex(i))return"0x";r.push(i)}return e.id(r.join("\n")+"\n")};var i=(o.prototype.split=function(t){return t.toLowerCase().split(/ +/g)},o.prototype.join=function(t){return t.join(" ")},o);function o(t){r.defineReadOnly(this,"locale",t)}n.Wordlist=i,n.register=function(t,e){e=e||t.locale}}).call(this)}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utils/hash":65,"../utils/properties":74}],88:[function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var a,s=t("./utils/bytes"),u=t("./utils/hash"),c=t("./utils/hdnode"),l=t("./utils/json-wallet"),h=t("./utils/keccak256"),f=t("./utils/properties"),d=t("./utils/random-bytes"),p=o(t("./utils/secret-storage")),y=t("./utils/signing-key"),m=t("./utils/transaction"),v=t("./abstract-signer"),g=t("./providers/abstract-provider"),b=o(t("./errors"));function w(t,e){var r=a.call(this)||this;return b.checkNew(r,w),y.SigningKey.isSigningKey(t)?f.defineReadOnly(r,"signingKey",t):f.defineReadOnly(r,"signingKey",new y.SigningKey(t)),f.defineReadOnly(r,"provider",e),r}i(w,a=v.Signer),Object.defineProperty(w.prototype,"address",{get:function(){return this.signingKey.address},enumerable:!0,configurable:!0}),Object.defineProperty(w.prototype,"mnemonic",{get:function(){return this.signingKey.mnemonic},enumerable:!0,configurable:!0}),Object.defineProperty(w.prototype,"path",{get:function(){return this.signingKey.path},enumerable:!0,configurable:!0}),Object.defineProperty(w.prototype,"privateKey",{get:function(){return this.signingKey.privateKey},enumerable:!0,configurable:!0}),w.prototype.connect=function(t){return g.Provider.isProvider(t)||b.throwError("invalid provider",b.INVALID_ARGUMENT,{argument:"provider",value:t}),new w(this.signingKey,t)},w.prototype.getAddress=function(){return Promise.resolve(this.address)},w.prototype.sign=function(t){var e=this;return f.resolveProperties(t).then((function(t){var r=m.serialize(t);return r=e.signingKey.signDigest(h.keccak256(r)),m.serialize(t,r)}))},w.prototype.signMessage=function(t){return Promise.resolve(s.joinSignature(this.signingKey.signDigest(u.hashMessage(t))))},w.prototype.getBalance=function(t){if(!this.provider)throw new Error("missing provider");return this.provider.getBalance(this.address,t)},w.prototype.getTransactionCount=function(t){if(!this.provider)throw new Error("missing provider");return this.provider.getTransactionCount(this.address,t)},w.prototype.sendTransaction=function(t){var e=this;if(!this.provider)throw new Error("missing provider");return null==t.nonce&&((t=f.shallowCopy(t)).nonce=this.getTransactionCount("pending")),m.populateTransaction(t,this.provider,this.address).then((function(t){return e.sign(t).then((function(t){return e.provider.sendTransaction(t)}))}))},w.prototype.encrypt=function(t,e,r){if("function"!=typeof e||r||(r=e,e={}),r&&"function"!=typeof r)throw new Error("invalid callback");return e=e||{},this.mnemonic&&((e=f.shallowCopy(e)).mnemonic=this.mnemonic,e.path=this.path),p.encrypt(this.privateKey,t,e,r)},w.createRandom=function(t){var e=d.randomBytes(16);return(t=t||{}).extraEntropy&&(e=s.arrayify(h.keccak256(s.concat([e,t.extraEntropy])).substring(0,34))),e=c.entropyToMnemonic(e,t.locale),w.fromMnemonic(e,t.path,t.locale)},w.fromEncryptedJson=function(t,e,r){if(l.isCrowdsaleWallet(t))try{r&&r(0);var n=p.decryptCrowdsale(t,e);return r&&r(1),Promise.resolve(new w(n))}catch(t){return Promise.reject(t)}else if(l.isSecretStorageWallet(t))return p.decrypt(t,e,r).then((function(t){return new w(t)}));return Promise.reject("invalid wallet JSON")},w.fromMnemonic=function(t,e,r){return e=e||c.defaultPath,new w(c.fromMnemonic(t,r).derivePath(e))},i=w,r.Wallet=i},{"./abstract-signer":2,"./errors":5,"./providers/abstract-provider":50,"./utils/bytes":64,"./utils/hash":65,"./utils/hdnode":66,"./utils/json-wallet":70,"./utils/keccak256":71,"./utils/properties":74,"./utils/random-bytes":75,"./utils/secret-storage":78,"./utils/signing-key":81,"./utils/transaction":83}],89:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),t=t("../wordlists/lang-en").langEn,r.en=t},{"../wordlists/lang-en":90}],90:[function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o,a=t("../utils/wordlist"),s=null;function u(t){if(null==s&&(s="AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo".replace(/([A-Z])/g," $1").toLowerCase().substring(1).split(" "),"0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"!==a.check(t)))throw s=null,new Error("BIP39 Wordlist for en (English) FAILED")}function c(){return o.call(this,"en")||this}i=new(i(c,o=a.Wordlist),c.prototype.getWord=function(t){return u(this),s[t]},c.prototype.getWordIndex=function(t){return u(this),s.indexOf(t)},c),r.langEn=i,a.register(i)},{"../utils/wordlist":87}]},{},[7])(7)},"object"==s(e)&&void 0!==t?t.exports=a():(i=[],void 0===(o="function"==typeof(n=a)?n.apply(e,i):n)||(t.exports=o))}).call(this,r(5))},function(t,e,r){var n=r(22),i=r(30),o=r(7),a=r(3),s=r(4);function u(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function c(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?u(Object(r),!0).forEach((function(e){o(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var l=r(31),h=r(76),f=r(34),d=f.ValidateLibrary,p=f.ValidateObject,y=f.ValidateVersion,m=f.ValidatePartHash,v=f.ValidateWriteToken,g=f.ValidateParameters,b=r(77);e.permissionLevels={owner:{short:"Owner Only",description:"Only the owner has access to the object and ability to change permissions",settings:{visibility:0,statusCode:-1,kmsConk:!1}},editable:{short:"Editable",description:"Members of the editors group have full access to the object and the ability to change permissions",settings:{visibility:0,statusCode:-1,kmsConk:!0}},viewable:{short:"Viewable",description:"In addition to editors, members of the 'accessor' group can have read-only access to the object including playing video and retrieving metadata, images and documents",settings:{visibility:0,statusCode:0,kmsConk:!0}},listable:{short:"Publicly Listable",description:"Anyone can list the public portion of this object but only accounts with specific rights can access",settings:{visibility:1,statusCode:0,kmsConk:!0}},public:{short:"Public",description:"Anyone can access this object",settings:{visibility:10,statusCode:0,kmsConk:!0}}},e.Visibility=function(){var t=s(a.mark((function t(e){var r,n,i=this;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.id,t.prev=1,n=this.utils.HashToAddress(r),this.visibilityInfo[n]||(this.visibilityInfo[n]=new Promise(function(){var t=s(a.mark((function t(e,o){return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,i.authClient.ContractHasMethod({contractAddress:n,methodName:"visibility"});case 3:if(t.sent){t.next=7;break}return e(0),t.abrupt("return");case 7:return t.t0=e,t.next=10,i.CallContractMethod({contractAddress:i.utils.HashToAddress(r),methodName:"visibility"});case 10:t.t1=t.sent,(0,t.t0)(t.t1),t.next=17;break;case 14:t.prev=14,t.t2=t.catch(0),o(t.t2);case 17:case"end":return t.stop()}}),t,null,[[0,14]])})));return function(e,r){return t.apply(this,arguments)}}())),t.prev=4,t.next=7,this.visibilityInfo[n];case 7:return t.abrupt("return",t.sent);case 10:throw t.prev=10,t.t0=t.catch(4),delete this.visibilityInfo[n],t.t0;case 14:t.next=21;break;case 16:if(t.prev=16,t.t1=t.catch(1),"CALL_EXCEPTION"!==t.t1.code){t.next=20;break}return t.abrupt("return",0);case 20:throw t.t1;case 21:case"end":return t.stop()}}),t,this,[[1,16],[4,10]])})));return function(e){return t.apply(this,arguments)}}(),e.Permission=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u,c,l=this;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.objectId,p(r),t.next=4,this.AccessType({id:r});case 4:if(t.t0=t.sent,t.t1=this.authClient.ACCESS_TYPES.OBJECT,t.t0===t.t1){t.next=8;break}throw Error("Permission only valid for normal content objects: "+r);case 8:return t.next=10,this.Visibility({id:r});case 10:return n=t.sent,t.next=13,this.CallContractMethod({contractAddress:this.utils.HashToAddress(r),methodName:"addressKMS"});case 13:if(i=t.sent,o=i&&"ikms".concat(this.utils.AddressToHash(i)),s=!1,!o){t.next=27;break}return t.t2=this,t.next=20,this.ContentObjectLibraryId({objectId:r});case 20:return t.t3=t.sent,t.t4=r,t.t5="eluv.caps.".concat(o),t.t6={libraryId:t.t3,objectId:t.t4,metadataSubtree:t.t5},t.next=26,t.t2.ContentObjectMetadata.call(t.t2,t.t6);case 26:s=!!t.sent;case 27:return t.next=29,this.CallContractMethod({contractAddress:this.utils.HashToAddress(r),methodName:"statusCode"});case 29:return u=t.sent,u=parseInt(u._hex,16),(c=Object.keys(this.permissionLevels).filter((function(t){var e=l.permissionLevels[t].settings;return n>=e.visibility&&u>=e.statusCode&&s===e.kmsConk})))||(c=s?["editable"]:["owner"]),t.abrupt("return",c.slice(-1)[0]);case 34:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.DefaultKMSAddress=s(a.mark((function t(){var e,r,n,i=arguments;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=i.length>0&&void 0!==i[0]?i[0]:{},r=e.tenantId,t.t0=r,!t.t0){t.next=8;break}return t.next=5,this.AccessType({id:r});case 5:t.t1=t.sent,t.t2=this.authClient.ACCESS_TYPES.TENANT,t.t0=t.t1===t.t2;case 8:if(!t.t0){t.next=14;break}return t.next=11,this.CallContractMethod({contractAddress:this.utils.HashToAddress(r),methodName:"addressKMS"});case 11:if(!(n=t.sent)){t.next=14;break}return t.abrupt("return",n);case 14:return t.next=16,this.CallContractMethod({contractAddress:this.contentSpaceAddress,methodName:"addressKMS"});case 16:return t.abrupt("return",t.sent);case 17:case"end":return t.stop()}}),t,this)}))),e.ContentSpaceId=function(){return this.contentSpaceId},e.ContentTypeOwner=function(){var t=s(a.mark((function t(e){var r,n,i,o;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.name,n=e.typeId,i=e.versionHash,t.next=3,this.ContentType({name:r,typeId:n,versionHash:i});case 3:return o=t.sent,t.t0=this.utils,t.next=7,this.ethClient.CallContractMethod({contractAddress:this.utils.HashToAddress(o.id),methodName:"owner",methodArgs:[]});case 7:return t.t1=t.sent,t.abrupt("return",t.t0.FormatAddress.call(t.t0,t.t1));case 9:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.ContentType=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.name,n=e.typeId,i=e.versionHash,o=e.publicOnly,s=void 0!==o&&o,this.Log("Retrieving content type: ".concat(r||n||i)),i&&(n=this.utils.DecodeVersionHash(i).objectId),!r){t.next=13;break}return this.Log("Looking up type by name in content space metadata..."),t.prev=5,t.next=8,this.ContentObjectMetadata({libraryId:this.contentSpaceLibraryId,objectId:this.contentSpaceObjectId,metadataSubtree:l("public","contentTypes",r)});case 8:n=t.sent,t.next=13;break;case 11:t.prev=11,t.t0=t.catch(5);case 13:if(n){t.next=23;break}return this.Log("Looking up type by name in available types..."),t.next=17,this.ContentTypes();case 17:if(u=t.sent,!r){t.next=22;break}return t.abrupt("return",Object.values(u).find((function(t){return(t.name||"").toLowerCase()===r.toLowerCase()})));case 22:return t.abrupt("return",Object.values(u).find((function(t){return t.hash===i})));case 23:if(i){t.next=27;break}return t.next=26,this.LatestVersionHash({objectId:n});case 26:i=t.sent;case 27:if(t.prev=27,this.Log("Looking up type by ID..."),!s){t.next=39;break}return t.next=32,this.ContentObjectMetadata({libraryId:this.contentSpaceLibraryId,objectId:n,versionHash:i,metadataSubtree:"public"});case 32:if(t.t1=t.sent,t.t1){t.next=35;break}t.t1={};case 35:t.t2=t.t1,c={public:t.t2},t.next=45;break;case 39:return t.next=41,this.ContentObjectMetadata({libraryId:this.contentSpaceLibraryId,objectId:n,versionHash:i});case 41:if(t.t3=t.sent,t.t3){t.next=44;break}t.t3={};case 44:c=t.t3;case 45:return t.abrupt("return",{id:n,hash:i,name:c.public&&c.public.name||c.name||n,meta:c});case 48:throw t.prev=48,t.t4=t.catch(27),this.Log("Error looking up content type:"),this.Log(t.t4),new Error("Content Type ".concat(r||n," is invalid"));case 53:case"end":return t.stop()}}),t,this,[[5,11],[27,48]])})));return function(e){return t.apply(this,arguments)}}(),e.ContentTypes=s(a.mark((function t(){var e,r,n,i=this;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.contentTypes=this.contentTypes||{},this.Log("Looking up all available content types"),t.next=4,this.Collection({collectionType:"contentTypes"});case 4:return e=t.sent,this.Log("Personally available types:"),this.Log(e),r={},t.prev=8,t.next=11,this.ContentObjectMetadata({libraryId:this.contentSpaceLibraryId,objectId:this.contentSpaceObjectId,metadataSubtree:"public/contentTypes"});case 11:if(t.t0=t.sent,t.t0){t.next=14;break}t.t0={};case 14:r=t.t0,t.next=19;break;case 17:t.prev=17,t.t1=t.catch(8);case 19:return n=Object.values(r).map((function(t){return i.utils.HashToAddress(t)})),this.Log("Content space types:"),this.Log(n),e=e.concat(n).filter((function(t){return t})).map((function(t){return i.utils.FormatAddress(t)})).filter((function(t,e,r){return r.indexOf(t)===e})),t.next=25,Promise.all(e.map(function(){var t=s(a.mark((function t(e){var r;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=i.utils.AddressToObjectId(e),i.contentTypes[r]){t.next=11;break}return t.prev=2,t.next=5,i.ContentType({typeId:r,publicOnly:!0});case 5:i.contentTypes[r]=t.sent,t.next=11;break;case 8:t.prev=8,t.t0=t.catch(2),console.error(t.t0);case 11:case"end":return t.stop()}}),t,null,[[2,8]])})));return function(e){return t.apply(this,arguments)}}()));case 25:return t.abrupt("return",this.contentTypes);case 26:case"end":return t.stop()}}),t,this,[[8,17]])}))),e.ContentLibraries=s(a.mark((function t(){var e,r=this;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.Collection({collectionType:"libraries"});case 2:return e=t.sent,t.abrupt("return",e.map((function(t){return r.utils.AddressToLibraryId(t)})));case 4:case"end":return t.stop()}}),t,this)}))),e.ContentLibrary=function(){var t=s(a.mark((function t(e){var r,n,i;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,d(r),n=l("qlibs",r),t.t0=this.utils,t.t1=this.HttpClient,t.next=7,this.authClient.AuthorizationHeader({libraryId:r});case 7:return t.t2=t.sent,t.t3=n,t.t4={headers:t.t2,method:"GET",path:t.t3},t.t5=t.t1.Request.call(t.t1,t.t4),t.next=13,t.t0.ResponseToJson.call(t.t0,t.t5);case 13:return i=t.sent,t.abrupt("return",c(c({},i),{},{meta:i.meta||{}}));case 15:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.ContentLibraryOwner=function(){var t=s(a.mark((function t(e){var r;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,d(r),t.t0=this.utils,t.next=5,this.ethClient.CallContractMethod({contractAddress:this.utils.HashToAddress(r),methodName:"owner",methodArgs:[]});case 5:return t.t1=t.sent,t.abrupt("return",t.t0.FormatAddress.call(t.t0,t.t1));case 7:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.LibraryContentTypes=function(){var t=s(a.mark((function t(e){var r,n,i,o=this;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,d(r),this.Log("Retrieving library content types for ".concat(r)),t.next=5,this.ethClient.CallContractMethod({contractAddress:this.utils.HashToAddress(r),methodName:"contentTypesLength",methodArgs:[]});case 5:if(n=t.sent.toNumber(),this.Log("".concat(n," types")),0!==n){t.next=9;break}return t.abrupt("return",{});case 9:return i={},t.next=12,Promise.all(Array.from(new Array(n),function(){var t=s(a.mark((function t(e,n){var s,u;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,o.ethClient.CallContractMethod({contractAddress:o.utils.HashToAddress(r),methodName:"contentTypes",methodArgs:[n]});case 2:return s=t.sent,u=o.utils.AddressToObjectId(s),t.next=6,o.ContentType({typeId:u});case 6:i[u]=t.sent;case 7:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}()));case 12:return this.Log(i),t.abrupt("return",i);case 14:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.ContentObjects=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,n=e.filterOptions,i=void 0===n?{}:n,d(r),this.Log("Retrieving content objects from ".concat(r)),o=l("qlibs",r,"q"),s={filter:[]},i.cacheId&&(s.cache_id=i.cacheId),i.start&&(s.start=i.start),i.limit&&(s.limit=i.limit),i.select&&(s.select=i.select),i.sort&&(s.sort_by=i.sort,i.sortDesc&&(s.sort_descending=!0)),u={eq:":eq:",neq:":ne:",lt:":lt:",lte:":le:",gt:":gt:",gte:":ge:",cnt:":co:",ncnt:":nc:"},c=function(t){var e=t.key,r=t.type,n=t.filter;s.filter.push("".concat(e).concat(u[r]).concat(n))},i.filter&&(Array.isArray(i.filter)?i.filter.forEach((function(t){return c(t)})):c(i.filter)),this.Log("Filter options:"),this.Log(i),t.t0=this.utils,t.t1=this.HttpClient,t.next=19,this.authClient.AuthorizationHeader({libraryId:r});case 19:return t.t2=t.sent,t.t3=o,t.t4=s,t.t5={headers:t.t2,method:"GET",path:t.t3,queryParams:t.t4},t.t6=t.t1.Request.call(t.t1,t.t5),t.next=26,t.t0.ResponseToJson.call(t.t0,t.t6);case 26:return t.abrupt("return",t.sent);case 27:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.ContentObject=function(){var t=s(a.mark((function t(e){var r,n,i,o;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,n=e.objectId,i=e.versionHash,g({libraryId:r,objectId:n,versionHash:i}),this.Log("Retrieving content object: ".concat(r||""," ").concat(n||i)),i&&(n=this.utils.DecodeVersionHash(i).objectId),o=l("q",i||n),t.t0=this.utils,t.t1=this.HttpClient,t.next=9,this.authClient.AuthorizationHeader({libraryId:r,objectId:n,versionHash:i});case 9:return t.t2=t.sent,t.t3=o,t.t4={headers:t.t2,method:"GET",path:t.t3},t.t5=t.t1.Request.call(t.t1,t.t4),t.next=15,t.t0.ResponseToJson.call(t.t0,t.t5);case 15:return t.abrupt("return",t.sent);case 16:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.ContentObjectOwner=function(){var t=s(a.mark((function t(e){var r;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.objectId,p(r),this.Log("Retrieving content object owner: ".concat(r)),t.t0=this.utils,t.next=6,this.ethClient.CallContractMethod({contractAddress:this.utils.HashToAddress(r),methodName:"owner",methodArgs:[]});case 6:return t.t1=t.sent,t.abrupt("return",t.t0.FormatAddress.call(t.t0,t.t1));case 8:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.ContentObjectTenantId=function(){var t=s(a.mark((function t(e){var r,n;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.objectId,(n=e.versionHash)?y(n):p(r),n&&(r=this.utils.DecodeVersionHash(n).objectId),this.objectTenantIds[r]){t.next=7;break}return t.next=6,this.authClient.MakeElvMasterCall({methodName:"elv_getTenantById",params:[this.contentSpaceId,r]});case 6:this.objectTenantIds[r]=t.sent;case 7:return t.abrupt("return",this.objectTenantIds[r]);case 8:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.ContentObjectLibraryId=function(){var t=s(a.mark((function t(e){var r,n,i=this;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.objectId,(n=e.versionHash)?y(n):p(r),n&&(r=this.utils.DecodeVersionHash(n).objectId),t.next=5,this.authClient.AccessType(r);case 5:t.t0=t.sent,t.next=t.t0===this.authClient.ACCESS_TYPES.LIBRARY?8:t.t0===this.authClient.ACCESS_TYPES.OBJECT?9:t.t0===this.authClient.ACCESS_TYPES.OTHER?20:21;break;case 8:return t.abrupt("return",this.utils.AddressToLibraryId(this.utils.HashToAddress(r)));case 9:return this.objectLibraryIds[r]||(this.Log("Retrieving content object library ID: ".concat(r||n)),this.objectLibraryIds[r]=new Promise(function(){var t=s(a.mark((function t(e,n){return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.t0=e,t.t1=i.utils,t.next=5,i.CallContractMethod({contractAddress:i.utils.HashToAddress(r),methodName:"libraryAddress"});case 5:t.t2=t.sent,t.t3=t.t1.AddressToLibraryId.call(t.t1,t.t2),(0,t.t0)(t.t3),t.next=13;break;case 10:t.prev=10,t.t4=t.catch(0),n(t.t4);case 13:case"end":return t.stop()}}),t,null,[[0,10]])})));return function(e,r){return t.apply(this,arguments)}}())),t.prev=10,t.next=13,this.objectLibraryIds[r];case 13:return t.abrupt("return",t.sent);case 16:throw t.prev=16,t.t1=t.catch(10),delete this.objectLibraryIds[r],t.t1;case 20:throw Error("Unable to retrieve library ID for ".concat(n||r,": Unknown type. (wrong network or deleted object?)"));case 21:return t.abrupt("return",this.contentSpaceLibraryId);case 22:case"end":return t.stop()}}),t,this,[[10,16]])})));return function(e){return t.apply(this,arguments)}}(),e.ProduceMetadataLinks=function(){var t=s(a.mark((function t(e){var r,n,o,u,h,f,d,p,y,m=this;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.libraryId,n=e.objectId,o=e.versionHash,u=e.path,h=void 0===u?"/":u,f=e.metadata,d=e.authorizationToken,p=e.noAuth,f&&"object"===i(f)){t.next=3;break}return t.abrupt("return",f);case 3:if(!Array.isArray(f)){t.next=7;break}return t.next=6,this.utils.LimitedMap(5,f,function(){var t=s(a.mark((function t(e,i){return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,m.ProduceMetadataLinks({libraryId:r,objectId:n,versionHash:o,path:l(h,i.toString()),metadata:e,authorizationToken:d,noAuth:p});case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}());case 6:return t.abrupt("return",t.sent);case 7:if(!f["/"]||!f["/"].match(/\.\/(rep|files)\/.+/)&&!f["/"].match(/^\/?qfab\/([\w]+)\/?(rep|files)\/.+/)){t.next=16;break}return t.t0=c,t.t1=c({},f),t.t2={},t.next=13,this.LinkUrl({libraryId:r,objectId:n,versionHash:o,linkPath:h,authorizationToken:d});case 13:return t.t3=t.sent,t.t4={url:t.t3},t.abrupt("return",(0,t.t0)(t.t1,t.t2,t.t4));case 16:return y={},t.next=19,this.utils.LimitedMap(5,Object.keys(f),function(){var t=s(a.mark((function t(e){return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,m.ProduceMetadataLinks({libraryId:r,objectId:n,versionHash:o,path:l(h,e),metadata:f[e],authorizationToken:d,noAuth:p});case 2:y[e]=t.sent;case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}());case 19:return t.abrupt("return",y);case 20:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.MetadataAuth=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u,c,l,h,f,d,p,y;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.libraryId,n=e.objectId,i=e.versionHash,o=e.path,s=void 0===o?"/":o,u=e.channelAuth,c=void 0!==u&&u,l=e.noAuth,h=void 0!==l&&l,g({libraryId:r,objectId:n,versionHash:i}),i&&(n=this.utils.DecodeVersionHash(i).objectId),h=this.noAuth||h,f=h,h){t.next=14;break}return t.next=8,this.Visibility({id:n});case 8:return p=t.sent,t.next=11,this.AccessType({id:n});case 11:d=t.sent,f=(s||"").replace(/^\/+/,"").startsWith("public"),h=p>=10||f&&p>=1;case 14:if(!this.oauthToken){t.next=22;break}return t.next=17,this.authClient.KMSAddress({objectId:n,versionHash:i});case 17:if(!(y=t.sent)||this.utils.EqualAddress(y,this.utils.nullAddress)){t.next=22;break}return t.next=21,this.authClient.AuthorizationToken({libraryId:r,objectId:n,versionHash:i,channelAuth:!0,oauthToken:this.oauthToken});case 21:return t.abrupt("return",t.sent);case 22:if(this.inaccessibleLibraries[r]||!f||d!==this.authClient.ACCESS_TYPES.OBJECT||c){t.next=48;break}if(t.prev=23,t.t0=this.authClient,t.t1=r,t.t1){t.next=30;break}return t.next=29,this.ContentObjectLibraryId({objectId:n,versionHash:i});case 29:t.t1=t.sent;case 30:return t.t2=t.t1,t.t3=h,t.t4={libraryId:t.t2,noAuth:t.t3},t.next=35,t.t0.AuthorizationToken.call(t.t0,t.t4);case 35:return t.abrupt("return",t.sent);case 38:if(t.prev=38,t.t5=t.catch(23),!t.t5.message||!t.t5.message.toLowerCase().startsWith("access denied")){t.next=45;break}return this.inaccessibleLibraries[r]=!0,t.next=44,this.authClient.AuthorizationToken({libraryId:r,objectId:n,versionHash:i,noAuth:h,channelAuth:c});case 44:return t.abrupt("return",t.sent);case 45:throw t.t5;case 46:t.next=51;break;case 48:return t.next=50,this.authClient.AuthorizationToken({libraryId:r,objectId:n,versionHash:i,noAuth:h,channelAuth:c});case 50:return t.abrupt("return",t.sent);case 51:case"end":return t.stop()}}),t,this,[[23,38]])})));return function(e){return t.apply(this,arguments)}}(),e.ContentObjectMetadata=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u,h,f,d,p,y,m,v,b,w,_,k,x,A,I,E,S,M,T,P,C,O,R,j;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,n=e.objectId,i=e.versionHash,o=e.writeToken,s=e.metadataSubtree,u=void 0===s?"/":s,h=e.queryParams,f=void 0===h?{}:h,d=e.select,p=void 0===d?[]:d,y=e.remove,m=void 0===y?[]:y,v=e.authorizationToken,b=e.noAuth,w=void 0!==b&&b,_=e.resolveLinks,k=void 0!==_&&_,x=e.resolveIncludeSource,A=void 0!==x&&x,I=e.resolveIgnoreErrors,E=void 0!==I&&I,S=e.linkDepthLimit,M=void 0===S?1:S,T=e.produceLinkUrls,P=void 0!==T&&T,g({libraryId:r,objectId:n,versionHash:i}),this.Log("Retrieving content object metadata: ".concat(r||""," ").concat(n||i," ").concat(o||"","\n Subtree: ").concat(u)),f=c({},f||{}),i&&(n=this.utils.DecodeVersionHash(i).objectId),C=l("q",o||i||n,"meta",u),t.next=8,this.MetadataAuth({libraryId:r,objectId:n,versionHash:i,path:u,noAuth:w});case 8:return O=t.sent,R=[v,f.authorization,O].flat().filter((function(t){return t})),delete f.authorization,t.prev=11,t.next=14,this.utils.ResponseToJson(this.HttpClient.Request({headers:{Authorization:R.map((function(t){return"Bearer ".concat(t)}))},queryParams:c(c({},f),{},{select:p,remove:m,link_depth:M,resolve:k,resolve_include_source:A,resolve_ignore_errors:E}),method:"GET",path:C}));case 14:j=t.sent,t.next=22;break;case 17:if(t.prev=17,t.t0=t.catch(11),404===t.t0.status){t.next=21;break}throw t.t0;case 21:j="/"===u?{}:void 0;case 22:if(P){t.next=24;break}return t.abrupt("return",j);case 24:return t.next=26,this.ProduceMetadataLinks({libraryId:r,objectId:n,versionHash:i,path:u,metadata:j,authorizationToken:v,noAuth:w});case 26:return t.abrupt("return",t.sent);case 27:case"end":return t.stop()}}),t,this,[[11,17]])})));return function(e){return t.apply(this,arguments)}}(),e.AssetMetadata=function(){var t=s(a.mark((function t(e){var r,i,o,s,u,h,f,d,p,y=this;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.libraryId,i=e.objectId,o=e.versionHash,s=e.metadata,u=e.localization,h=e.noAuth,f=e.produceLinkUrls,d=void 0!==f&&f,g({libraryId:r,objectId:i,versionHash:o}),i||(i=this.utils.DecodeVersionHash(o).objectId),s){t.next=12;break}return t.next=6,this.ContentObjectMetadata({libraryId:r,objectId:i,versionHash:o,metadataSubtree:"public/asset_metadata",resolveLinks:!0,linkDepthLimit:2,resolveIgnoreErrors:!0,produceLinkUrls:d,noAuth:h});case 6:if(t.t0=t.sent,t.t0){t.next=9;break}t.t0={};case 9:s=t.t0,t.next=16;break;case 12:if(!d){t.next=16;break}return t.next=15,this.ProduceMetadataLinks({libraryId:r,objectId:i,versionHash:o,path:l("public","asset_metadata"),metadata:s,noAuth:h});case 15:s=t.sent;case 16:return s.info||(s.info={}),p=c({},s),u&&u.reverse().forEach((function(t){var e,r=(e=y.utils).SafeTraverse.apply(e,[s].concat(n(t)))||{};p=b({},p,r,(function(t,e){return null===e||""===e?t:void 0}))})),t.abrupt("return",p);case 20:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.ContentObjectVersions=function(){var t=s(a.mark((function t(e){var r,n,i;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,n=e.objectId,g({libraryId:r,objectId:n}),this.Log("Retrieving content object versions: ".concat(r||""," ").concat(n)),i=l("qid",n),t.t0=this.utils,t.t1=this.HttpClient,t.next=8,this.authClient.AuthorizationHeader({libraryId:r,objectId:n});case 8:return t.t2=t.sent,t.t3=i,t.t4={headers:t.t2,method:"GET",path:t.t3},t.t5=t.t1.Request.call(t.t1,t.t4),t.abrupt("return",t.t0.ResponseToJson.call(t.t0,t.t5));case 13:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.LatestVersionHash=function(){var t=s(a.mark((function t(e){var r,n,i,o;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.objectId,(n=e.versionHash)&&(r=this.utils.DecodeVersionHash(n).objectId),p(r),t.prev=3,t.next=6,this.CallContractMethod({contractAddress:this.utils.HashToAddress(r),methodName:"objectHash"});case 6:i=t.sent,t.next=11;break;case 9:t.prev=9,t.t0=t.catch(3);case 11:if(i){t.next=20;break}return t.next=14,this.CallContractMethod({contractAddress:this.utils.HashToAddress(r),methodName:"countVersionHashes"});case 14:if((o=t.sent).toNumber()){t.next=17;break}throw Error("Unable to determine latest version hash for ".concat(n||r," - Item deleted?"));case 17:return t.next=19,this.CallContractMethod({contractAddress:this.utils.HashToAddress(r),methodName:"versionHashes",methodArgs:[o-1]});case 19:i=t.sent;case 20:return t.abrupt("return",i);case 21:case"end":return t.stop()}}),t,this,[[3,9]])})));return function(e){return t.apply(this,arguments)}}(),e.AvailableDRMs=s(a.mark((function t(){var e,r,n,i,o,s,u,c,l;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=["clear","aes-128"],"undefined"!=typeof window){t.next=3;break}return t.abrupt("return",e);case 3:if(window.navigator&&window.navigator.userAgent&&((r=window.navigator.userAgent.match(/(iPad|iPhone|iphone|iPod).*?(OS |os |OS_)(\d+((_|\.)\d)?((_|\.)\d)?)/))&&r[3]&&(n=r[3].split("_"),i=parseInt(n[0]),o=parseInt(n[1]),(i>13||13===i&&o>=1)&&(e[1]="sample-aes",e[2]="fairplay")),/^((?!chrome|android).)*safari/i.test(window.navigator.userAgent)&&(s=window.navigator.userAgent.match(/.+Version\/(\d+)\.(\d+)/))&&s[2]&&(u=parseInt(s[1]),c=parseInt(s[2]),(u>13||13===u&&c>=1)&&(e[1]="sample-aes",e[2]="fairplay"))),"undefined"==typeof window||"function"==typeof window.navigator.requestMediaKeySystemAccess){t.next=6;break}return t.abrupt("return",e);case 6:return t.prev=6,l=[{initDataTypes:["cenc"],audioCapabilities:[{contentType:'audio/mp4;codecs="mp4a.40.2"'}],videoCapabilities:[{contentType:'video/mp4;codecs="avc1.42E01E"'}]}],t.next=10,navigator.requestMediaKeySystemAccess("com.widevine.alpha",l);case 10:e.push("widevine"),t.next=15;break;case 13:t.prev=13,t.t0=t.catch(6);case 15:return t.abrupt("return",e);case 16:case"end":return t.stop()}}),t,null,[[6,13]])}))),e.PlayoutPathResolution=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u,c,h,f,d,p,y,m,v,g,b,w;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.libraryId,n=e.objectId,i=e.versionHash,o=e.writeToken,s=e.linkPath,u=e.handler,c=e.offering,h=void 0===c?"":c,f=e.signedLink,d=void 0!==f&&f,p=e.authorizationToken,r){t.next=5;break}return t.next=4,this.ContentObjectLibraryId({objectId:n});case 4:r=t.sent;case 5:if(i){t.next=9;break}return t.next=8,this.LatestVersionHash({objectId:n});case 8:i=t.sent;case 9:if(y=l("qlibs",r,"q",o||i,"rep",u,h,"options.json"),!s){t.next=26;break}return t.next=13,this.ContentObjectMetadata({libraryId:r,objectId:n,versionHash:i,writeToken:o,metadataSubtree:s,resolveLinks:!1,resolveIgnoreErrors:!0,resolveIncludeSource:!0,authorizationToken:p});case 13:if(w=t.sent,b=!!w&&!!w["/"]&&!w["/"].endsWith("options.json"),y=l("qlibs",r,"q",o||i,"meta",s),d){t.next=25;break}return t.next=19,this.LinkTarget({libraryId:r,objectId:n,versionHash:i,writeToken:o,linkPath:s,linkInfo:w,authorizationToken:p});case 19:return g=t.sent,v=this.utils.DecodeVersionHash(g).objectId,t.next=23,this.ContentObjectLibraryId({objectId:v});case 23:m=t.sent,b||h||(y=l("q",g,"rep",u,"options.json"));case 25:b&&(y=l(y,h,"options.json"));case 26:return t.abrupt("return",{path:y,multiOfferingLink:b,linkTarget:{libraryId:m,objectId:v,versionHash:g}});case 27:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.AvailableOfferings=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u,c,l,h,f,d,p;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.objectId,n=e.versionHash,i=e.writeToken,o=e.linkPath,s=e.signedLink,u=e.directLink,c=e.handler,l=void 0===c?"playout":c,h=e.authorizationToken,r||(r=this.utils.DecodeVersionHash(n).objectId),!u){t.next=15;break}return t.t0=this,t.next=6,this.ContentObjectLibraryId({objectId:r});case 6:return t.t1=t.sent,t.t2=r,t.t3=n,t.t4=o,t.t5=h,t.t6={libraryId:t.t1,objectId:t.t2,versionHash:t.t3,metadataSubtree:t.t4,resolveLinks:!0,authorizationToken:t.t5},t.next=14,t.t0.ContentObjectMetadata.call(t.t0,t.t6);case 14:return t.abrupt("return",t.sent);case 15:return t.next=17,this.PlayoutPathResolution({objectId:r,versionHash:n,writeToken:i,linkPath:o,signedLink:s,handler:l,authorizationToken:h});case 17:return f=t.sent,d=f.path,t.prev=19,t.t7=h,t.next=23,this.authClient.AuthorizationToken({objectId:r,channelAuth:!0,oauthToken:this.oauthToken});case 23:return t.t8=t.sent,p=[t.t7,t.t8].flat().filter((function(t){return t})),t.next=27,this.utils.ResponseToJson(this.HttpClient.Request({path:d,method:"GET",headers:{Authorization:"Bearer ".concat(p.join(","))}}));case 27:return t.abrupt("return",t.sent);case 30:if(t.prev=30,t.t9=t.catch(19),!t.t9.status||500!==parseInt(t.t9.status)){t.next=34;break}return t.abrupt("return",{});case 34:throw t.t9;case 35:case"end":return t.stop()}}),t,this,[[19,30]])})));return function(e){return t.apply(this,arguments)}}(),e.PlayoutOptions=function(){var t=s(a.mark((function t(e){var r,n,i,u,h,f,d,m,v,g,b,w,_,k,x,A,I,E,S,M,T,P,C,O,R,j,N,L,U,D,B,z,H,F,q,G,V,K,Z,W,J,Q,Y,$,X,tt,et=this;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.offeringURI,n=e.objectId,i=e.versionHash,u=e.writeToken,h=e.linkPath,f=e.signedLink,d=void 0!==f&&f,m=e.protocols,v=void 0===m?["dash","hls"]:m,g=e.handler,b=void 0===g?"playout":g,w=e.offering,_=void 0===w?"default":w,k=e.playoutType,x=e.drms,A=void 0===x?[]:x,I=e.context,E=e.hlsjsProfile,S=void 0===E||E,M=e.authorizationToken,T=e.options,P=void 0===T?{}:T,!r){t.next=8;break}if(C=r.match(/(hq__[^/]+)\/rep\/([^/]+)\/([^/]+)\/options.json/),i=C[1],b=C[2],_=C[3],i&&b&&_){t.next=8;break}throw Error("Invalid offering URI: ".concat(r));case 8:if(i?y(i):p(n),v=v.map((function(t){return t.toLowerCase()})),A=A.map((function(t){return t.toLowerCase()})),n){t.next=15;break}n=this.utils.DecodeVersionHash(i).objectId,t.next=19;break;case 15:if(i){t.next=19;break}return t.next=18,this.LatestVersionHash({objectId:n});case 18:i=t.sent;case 19:return t.next=21,this.ContentObjectLibraryId({objectId:n});case 21:if(O=t.sent,t.prev=22,h){t.next=29;break}return R=l("public","asset_metadata","sources",_),t.next=27,this.ContentObjectMetadata({libraryId:O,objectId:n,versionHash:i,metadataSubtree:R,authorizationToken:M});case 27:t.sent&&(h=R);case 29:t.next=33;break;case 31:t.prev=31,t.t0=t.catch(22);case 33:return t.next=35,this.PlayoutPathResolution({libraryId:O,objectId:n,versionHash:i,writeToken:u,linkPath:h,signedLink:d,handler:b,offering:_,authorizationToken:M});case 35:if(j=t.sent,N=j.path,L=j.linkTarget,t.t1=this.authClient,t.t2=L.objectId||n,t.t3=L.versionHash||i,t.t3){t.next=45;break}return t.next=44,this.LatestVersionHash({objectId:n});case 44:t.t3=t.sent;case 45:return t.t4=t.t3,t.t5=v,t.t6=A,t.t7=I,t.t8={objectId:t.t2,versionHash:t.t4,protocols:t.t5,drms:t.t6,context:t.t7},U=t.t1.AudienceData.call(t.t1,t.t8),t.t9=M,t.next=54,this.authClient.AuthorizationToken({libraryId:O,objectId:n,channelAuth:!0,oauthToken:this.oauthToken,audienceData:U});case 54:return t.t10=t.sent,D=[t.t9,t.t10].flat().filter((function(t){return t})),B=c({authorization:D,resolve:!!h},P),t.t11=Object,t.next=60,this.utils.ResponseToJson(this.HttpClient.Request({path:N,method:"GET",queryParams:B}));case 60:if(t.t12=t.sent,z=t.t11.values.call(t.t11,t.t12),d||!L.versionHash){t.next=68;break}return t.t13=M,t.next=66,this.authClient.AuthorizationToken({libraryId:L.libraryId,objectId:L.objectId,channelAuth:!0,oauthToken:this.oauthToken,audienceData:U});case 66:t.t14=t.sent,B.authorization=[t.t13,t.t14].flat().filter((function(t){return t}));case 68:H={},G=0;case 70:if(!(G<z.length)){t.next=116;break}if(V=z[G],K=V.properties.protocol,Z=V.properties.drm,F=F||V.sid,q=q||!!V.properties.multiview,F&&(B.sid=F),W=V.uri.split("?")[0],k&&(W=W.replace("playlist","playlist-".concat(k))),J=V.properties.license_servers,Q=V.properties.cert,S&&"hls"===K&&"aes-128"===Z&&(B.player_profile="hls-js"),t.t15=c,t.t16=c({},H[K]||{}),t.t17={},t.t18=c,t.t19=c({},(H[K]||{}).playoutMethods||{}),t.t20={},t.t21=o,t.t22={},t.t23=Z||"clear",!d){t.next=97;break}return t.next=94,this.LinkUrl({versionHash:i,linkPath:l(h,_,W),queryParams:B,noAuth:!0});case 94:t.t24=t.sent,t.next=100;break;case 97:return t.next=99,this.Rep({libraryId:L.libraryId||O,objectId:L.objectId||n,versionHash:L.versionHash||i,rep:l(b,_,W),noAuth:!0,queryParams:B});case 99:t.t24=t.sent;case 100:for(Y in t.t25=t.t24,t.t26=Z?o({},Z,{licenseServers:J,cert:Q}):void 0,t.t27={playoutUrl:t.t25,drms:t.t26},t.t28=(0,t.t21)(t.t22,t.t23,t.t27),t.t29=(0,t.t18)(t.t19,t.t20,t.t28),t.t30={playoutMethods:t.t29},H[K]=(0,t.t15)(t.t16,t.t17,t.t30),H[K].playoutMethods)H[K].playoutMethods[Y].drms&&H[K].playoutMethods[Y].drms[Z]&&H[K].playoutMethods[Y].drms[Z].cert&&(($=new URL(H[K].playoutMethods[Y].playoutUrl)).pathname=$.pathname.split("/").slice(0,-1).concat(["drm.cert"]).join("/"),H[K].playoutMethods[Y].drms[Z].cert_url=$.toString());if(X=v.includes(K),tt=A.includes(Z||"clear")||0===A.length&&!Z,X&&tt){t.next=112;break}return t.abrupt("continue",113);case 112:(!H[K].playoutUrl||Z&&"clear"!==Z)&&(H[K].playoutUrl=H[K].playoutMethods[Z||"clear"].playoutUrl,H[K].drms=H[K].playoutMethods[Z||"clear"].drms);case 113:G++,t.next=70;break;case 116:return q&&F&&(H.sessionId=F,H.multiview=!0,H.AvailableViews=s(a.mark((function t(){return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=et.utils,t.next=3,et.HttpClient.Request({path:l("q",L.versionHash||i,"rep",b,_,"views.json"),method:"GET",queryParams:{sid:F,authorization:D}});case 3:return t.t1=t.sent,t.next=6,t.t0.ResponseToFormat.call(t.t0,"json",t.t1);case 6:return t.abrupt("return",t.sent);case 7:case"end":return t.stop()}}),t)}))),H.SwitchView=function(){var t=s(a.mark((function t(e){return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,et.HttpClient.Request({path:l("q",L.versionHash||i,"rep",b,_,"select_view"),method:"POST",queryParams:{sid:F,authorization:D},body:{view:e}});case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),this.Log(H),t.abrupt("return",H);case 119:case"end":return t.stop()}}),t,this,[[22,31]])})));return function(e){return t.apply(this,arguments)}}(),e.BitmovinPlayoutOptions=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u,c,l,h,f,d,m,v,g,b,w,_,k,x,A,I,E,S,M;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.objectId,n=e.versionHash,i=e.writeToken,o=e.linkPath,s=e.signedLink,u=void 0!==s&&s,c=e.protocols,l=void 0===c?["dash","hls"]:c,h=e.drms,f=void 0===h?[]:h,d=e.handler,m=void 0===d?"playout":d,v=e.offering,g=void 0===v?"default":v,b=e.playoutType,w=e.context,_=e.authorizationToken,k=e.options,x=void 0===k?{}:k,n?y(n):p(r),r||(r=this.utils.DecodeVersionHash(n).objectId),t.next=5,this.PlayoutOptions({objectId:r,versionHash:n,writeToken:i,linkPath:o,signedLink:u,protocols:l,drms:f,handler:m,offering:g,playoutType:b,hlsjsProfile:!1,context:w,authorizationToken:_,options:x});case 5:return delete(A=t.sent).playoutMethods,t.next=9,this.PlayoutPathResolution({objectId:r,versionHash:n,writeToken:i,linkPath:o,signedLink:u,handler:m,offering:g,authorizationToken:_});case 9:if(I=t.sent,E=I.linkTarget,S=[],_&&S.push(_),!u&&E.versionHash){t.next=21;break}return t.t0=S,t.next=17,this.authClient.AuthorizationToken({objectId:r,channelAuth:!0,oauthToken:this.oauthToken});case 17:t.t1=t.sent,t.t0.push.call(t.t0,t.t1),t.next=26;break;case 21:return t.t2=S,t.next=24,this.authClient.AuthorizationToken({libraryId:E.libraryId,objectId:E.objectId,channelAuth:!0,oauthToken:this.oauthToken});case 24:t.t3=t.sent,t.t2.push.call(t.t2,t.t3);case 26:return M={drm:{}},Object.keys(A).forEach((function(t){var e=A[t];M[t]=e.playoutUrl,e.drms&&Object.keys(e.drms).forEach((function(t){if(e.drms[t].licenseServers&&0!==e.drms[t].licenseServers.length){var r=function(t){return t.toLowerCase().startsWith("https")},n=e.drms[t].licenseServers;n.find(r)&&(n=n.filter(r));var i=n.sort((function(){return.5-Math.random()}))[0];M.drm[t]||(M.drm[t]={LA_URL:i,headers:{Authorization:"Bearer ".concat(S.flat().filter((function(t){return t})).join(","))}})}}))})),t.abrupt("return",M);case 29:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.CallBitcodeMethod=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u,c,h,f,d,p,y,m,v,b,w;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.libraryId,n=e.objectId,i=e.versionHash,o=e.writeToken,s=e.method,u=e.queryParams,c=void 0===u?{}:u,h=e.body,f=void 0===h?{}:h,d=e.headers,p=void 0===d?{}:d,y=e.constant,m=void 0===y||y,v=e.format,b=void 0===v?"json":v,g({libraryId:r,objectId:n,versionHash:i}),s){t.next=4;break}throw"Bitcode method not specified";case 4:if(i&&(n=this.utils.DecodeVersionHash(i).objectId),w=l("q",o||i||n,"call",s),r&&(w=l("qlibs",r,w)),p.authorization||p.Authorization){t.next=12;break}return t.next=11,this.authClient.AuthorizationHeader({libraryId:r,objectId:n,update:!m});case 11:p.Authorization=t.sent.Authorization;case 12:return this.Log("Calling bitcode method: ".concat(r||""," ").concat(n||i," ").concat(o||"","\n ").concat(m?"GET":"POST"," ").concat(w,"\n Query Params:\n ").concat(JSON.stringify(c||""),"\n Body:\n ").concat(JSON.stringify(f||""),"\n Headers\n ").concat(JSON.stringify(p||""))),t.t0=this.utils,t.t1=b,t.next=17,this.HttpClient.Request({body:f,headers:p,method:m?"GET":"POST",path:w,queryParams:c,failover:!1});case 17:return t.t2=t.sent,t.abrupt("return",t.t0.ResponseToFormat.call(t.t0,t.t1,t.t2));case 19:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.Rep=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u,c,l,h,f,d,p;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.libraryId,n=e.objectId,i=e.versionHash,o=e.rep,s=e.queryParams,u=void 0===s?{}:s,c=e.channelAuth,l=void 0!==c&&c,h=e.noAuth,f=void 0!==h&&h,d=e.noCache,p=void 0!==d&&d,g({libraryId:r,objectId:n,versionHash:i}),o){t.next=4;break}throw"Rep not specified";case 4:return t.abrupt("return",this.FabricUrl({libraryId:r,objectId:n,versionHash:i,rep:o,queryParams:u,channelAuth:l,noAuth:f,noCache:p}));case 5:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.PublicRep=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.libraryId,n=e.objectId,i=e.versionHash,o=e.rep,s=e.queryParams,u=void 0===s?{}:s,g({libraryId:r,objectId:n,versionHash:i}),o){t.next=4;break}throw"Rep not specified";case 4:return t.abrupt("return",this.FabricUrl({libraryId:r,objectId:n,versionHash:i,publicRep:o,queryParams:u,noAuth:!0}));case 5:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.FabricUrl=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u,h,f,d,p,y,m,v,b,w,_,k,x;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.libraryId,n=e.objectId,i=e.versionHash,o=e.writeToken,s=e.partHash,u=e.rep,h=e.publicRep,f=e.call,d=e.queryParams,p=void 0===d?{}:d,y=e.channelAuth,m=void 0!==y&&y,v=e.noAuth,b=void 0!==v&&v,w=e.noCache,_=void 0!==w&&w,(n||i)&&g({libraryId:r,objectId:n,versionHash:i}),i&&(n=this.utils.DecodeVersionHash(i).objectId),this.Log("Building Fabric URL:\n libraryId: ".concat(r,"\n objectId: ").concat(n,"\n versionHash: ").concat(i,"\n writeToken: ").concat(o,"\n partHash: ").concat(s,"\n rep: ").concat(u,"\n publicRep: ").concat(h,"\n call: ").concat(f,"\n channelAuth: ").concat(m,"\n noAuth: ").concat(b,"\n noCache: ").concat(_,"\n queryParams: ").concat(JSON.stringify(p||{},null,2))),k=[],p.authorization&&k.push(p.authorization),b&&p.authorization){t.next=12;break}return t.t0=k,t.next=10,this.authClient.AuthorizationToken({libraryId:r,objectId:n,versionHash:i,channelAuth:m,noAuth:b,noCache:_});case 10:t.t1=t.sent,t.t0.push.call(t.t0,t.t1);case 12:if(p=c(c({},p),{},{authorization:k.flat()}),!u&&!h||!n||i){t.next=17;break}return t.next=16,this.LatestVersionHash({objectId:n});case 16:i=t.sent;case 17:return x="",r?(x=l(x,"qlibs",r),(n||i)&&(x=l(x,"q",o||i||n))):i&&(x=l("q",i)),s?x=l(x,"data",s):u?x=l(x,"rep",u):h?x=l(x,"public",h):f&&(x=l(x,"call",f)),t.abrupt("return",this.HttpClient.URL({path:x,queryParams:p}));case 21:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.FileUrl=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u,h,f,d,p,y,m;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.libraryId,n=e.objectId,i=e.versionHash,o=e.writeToken,s=e.filePath,u=e.queryParams,h=void 0===u?{}:u,f=e.noCache,d=void 0!==f&&f,g({libraryId:r,objectId:n,versionHash:i}),s){t.next=4;break}throw"File path not specified";case 4:return i&&(n=this.utils.DecodeVersionHash(i).objectId),p=r?l("qlibs",r,"q",o||i||n):l("q",i),t.next=8,this.authClient.AuthorizationToken({libraryId:r,objectId:n,noCache:d});case 8:return y=t.sent,h=c(c({},h),{},{authorization:y}),t.next=12,this.ContentObjectMetadata({libraryId:r,objectId:n,versionHash:i,writeToken:o,metadataSubtree:l("files",s)});case 12:return m=t.sent,m&&m["."].encryption&&"cgck"===m["."].encryption.scheme?(p=l(p,"rep","files_download",s),h["header-x_decryption_mode"]="decrypt"):p=l(p,"files",s),t.abrupt("return",this.HttpClient.URL({path:p,queryParams:h}));case 16:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.ContentObjectImageUrl=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.libraryId,n=e.objectId,i=e.versionHash,o=e.height,s=e.imagePath,u=void 0===s?"public/display_image":s,g({libraryId:r,objectId:n,versionHash:i}),i){t.next=6;break}return t.next=5,this.LatestVersionHash({objectId:n});case 5:i=t.sent;case 6:if(this.Log("Retrieving content object image url: ".concat(r," ").concat(n," ").concat(i)),this.objectImageUrls[i]){t.next=26;break}return t.prev=8,t.next=11,this.ContentObjectMetadata({versionHash:i,metadataSubtree:u});case 11:if(t.sent){t.next=15;break}return this.Log("No image url set: ".concat(r," ").concat(n," ").concat(i)),t.abrupt("return");case 15:t.next=21;break;case 17:t.prev=17,t.t0=t.catch(8),this.Log("Unable to query for image metadata: ".concat(r," ").concat(n," ").concat(i),!0),this.Log(t.t0,!0);case 21:return c={},o&&!isNaN(parseInt(o))&&(c.height=parseInt(o)),t.next=25,this.LinkUrl({versionHash:i,linkPath:u,queryParams:c});case 25:this.objectImageUrls[i]=t.sent;case 26:return t.abrupt("return",this.objectImageUrls[i]);case 27:case"end":return t.stop()}}),t,this,[[8,17]])})));return function(e){return t.apply(this,arguments)}}(),e.ContentObjectGraph=function(){var t=s(a.mark((function t(e){var r,n,i,o,u,c,h,f,d,p,y=this;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,n=e.objectId,i=e.versionHash,o=e.autoUpdate,u=void 0!==o&&o,c=e.select,g({libraryId:r,objectId:n,versionHash:i}),this.Log("Retrieving content object graph: ".concat(r||""," ").concat(n||i)),i&&(n=this.utils.DecodeVersionHash(i).objectId),h=l("q",i||n,"links"),t.prev=5,t.t0=this.utils,t.t1=this.HttpClient,t.next=10,this.authClient.AuthorizationHeader({libraryId:r,objectId:n,versionHash:i});case 10:return t.t2=t.sent,t.t3={auto_update:u,select:c},t.t4=h,t.t5={headers:t.t2,queryParams:t.t3,method:"GET",path:t.t4},t.t6=t.t1.Request.call(t.t1,t.t5),t.next=17,t.t0.ResponseToJson.call(t.t0,t.t6);case 17:return t.abrupt("return",t.sent);case 20:if(t.prev=20,t.t7=t.catch(5),t.prev=22,(d=t.t7.body.errors[0].cause.cause.cause.cycle)&&0!==d.length){t.next=26;break}throw t.t7;case 26:return p={},t.next=29,Promise.all(d.map(function(){var t=s(a.mark((function t(e){var r,n;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!p[e]){t.next=2;break}return t.abrupt("return");case 2:return r=y.utils.DecodeVersionHash(e).objectId,t.next=5,y.ContentObjectMetadata({versionHash:e,metadataSubtree:"public/asset_metadata/display_title"});case 5:if(t.t2=t.sent,t.t2){t.next=10;break}return t.next=9,y.ContentObjectMetadata({versionHash:e,metadataSubtree:"public/name"});case 9:t.t2=t.sent;case 10:if(t.t1=t.t2,t.t1){t.next=15;break}return t.next=14,y.ContentObjectMetadata({versionHash:e,metadataSubtree:"name"});case 14:t.t1=t.sent;case 15:if(t.t0=t.t1,t.t0){t.next=18;break}t.t0=r;case 18:n=t.t0,p[e]={name:n,objectId:r};case 20:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 29:f=d.map((function(t){return"".concat(p[t].name," (").concat(p[t].objectId,")")})),t.next=35;break;case 32:throw t.prev=32,t.t8=t.catch(22),t.t7;case 35:throw new Error("Cycle found in links: ".concat(f.join(" -> ")));case 36:case"end":return t.stop()}}),t,this,[[5,20],[22,32]])})));return function(e){return t.apply(this,arguments)}}(),e.LinkTarget=function(){var t=s(a.mark((function t(e){var r,n,o,s,u,c,l,h,f;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.libraryId,n=e.objectId,o=e.versionHash,s=e.writeToken,u=e.linkPath,c=e.authorizationToken,l=e.linkInfo,g({libraryId:r,objectId:n,versionHash:o}),s&&v(s),o&&(n=this.utils.DecodeVersionHash(o).objectId),!s||r){t.next=8;break}return t.next=7,this.ContentObjectLibraryId({objectId:n});case 7:r=t.sent;case 8:if(l){t.next=12;break}return t.next=11,this.ContentObjectMetadata({libraryId:r,objectId:n,versionHash:o,writeToken:s,metadataSubtree:u,resolveLinks:!1,resolveIgnoreErrors:!0,resolveIncludeSource:!0,authorizationToken:c});case 11:l=t.sent;case 12:if(!l||!l["/"]){t.next=27;break}if((h=((l["/"]||"").match(/^\/?qfab\/([\w]+)\/?.+/)||[])[1])||(h=l["."].container),!h){t.next=19;break}return t.abrupt("return",h);case 19:if(!o){t.next=21;break}return t.abrupt("return",o);case 21:if(t.t0=o,t.t0){t.next=26;break}return t.next=25,this.LatestVersionHash({objectId:n});case 25:t.t0=t.sent;case 26:return t.abrupt("return",t.t0);case 27:return t.next=29,this.ContentObjectMetadata({libraryId:r,objectId:n,versionHash:o,writeToken:s,metadataSubtree:u,resolveIncludeSource:!0,authorizationToken:c});case 29:if((l=t.sent)&&l["."]){t.next=49;break}if("object"!==i(l)){t.next=38;break}if(t.t1=o,t.t1){t.next=37;break}return t.next=36,this.LatestVersionHash({objectId:n});case 36:t.t1=t.sent;case 37:return t.abrupt("return",t.t1);case 38:if(f=u.split("/").slice(0,-1).join("/")){t.next=46;break}if(t.t2=o,t.t2){t.next=45;break}return t.next=44,this.LatestVersionHash({objectId:n});case 44:t.t2=t.sent;case 45:return t.abrupt("return",t.t2);case 46:return t.next=48,this.ContentObjectMetadata({libraryId:r,objectId:n,versionHash:o,writeToken:s,metadataSubtree:f,resolveIncludeSource:!0,authorizationToken:c});case 48:l=t.sent;case 49:return t.abrupt("return",l["."].source);case 50:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.LinkUrl=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u,h,f,d,p,y,m,b,w,_;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.libraryId,n=e.objectId,i=e.versionHash,o=e.writeToken,s=e.linkPath,u=e.mimeType,h=e.authorizationToken,f=e.queryParams,d=void 0===f?{}:f,p=e.channelAuth,y=void 0!==p&&p,m=e.noAuth,b=void 0!==m&&m,g({libraryId:r,objectId:n,versionHash:i}),o&&v(o),s){t.next=5;break}throw Error("Link path not specified");case 5:return i&&(n=this.utils.DecodeVersionHash(i).objectId),w=r?l("qlibs",r,"q",o||i||n,"meta",s):l("q",i,"meta",s),_=[h],t.t0=_,t.next=11,this.MetadataAuth({libraryId:r,objectId:n,versionHash:i,path:s,channelAuth:y,noAuth:b});case 11:return t.t1=t.sent,t.t0.push.call(t.t0,t.t1),d.authorization&&_.push(d.authorization),d=c(c({},d),{},{authorization:_.flat().filter((function(t){return t})),resolve:!0}),u&&(d["header-accept"]=u),t.abrupt("return",this.HttpClient.URL({path:w,queryParams:d}));case 17:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.LinkData=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u,c,l,f,d,p;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,n=e.objectId,i=e.versionHash,o=e.writeToken,s=e.linkPath,u=e.queryParams,c=void 0===u?{}:u,l=e.format,f=void 0===l?"json":l,d=e.channelAuth,t.next=3,this.LinkUrl({libraryId:r,objectId:n,versionHash:i,writeToken:o,linkPath:s,queryParams:c,channelAuth:d});case 3:return p=t.sent,t.t0=this.utils,t.t1=f,t.next=8,h.Fetch(p);case 8:return t.t2=t.sent,t.abrupt("return",t.t0.ResponseToFormat.call(t.t0,t.t1,t.t2));case 10:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.CreateEncryptionConk=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u,c,l,h,f,d;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.libraryId,n=e.objectId,i=e.versionHash,o=e.writeToken,s=e.createKMSConk,u=void 0===s||s,!this.signer.remoteSigner){t.next=3;break}return t.abrupt("return");case 3:if(g({libraryId:r,objectId:n,versionHash:i}),v(o),n||(n=client.DecodeVersionHash(i).objectId),r){t.next=10;break}return t.next=9,this.ContentObjectLibraryId({objectId:n});case 9:r=t.sent;case 10:return c="eluv.caps.iusr".concat(this.utils.AddressToHash(this.signer.address)),t.next=13,this.ContentObjectMetadata({libraryId:r,objectId:n,writeToken:o,metadataSubtree:c});case 13:if(!(l=t.sent)){t.next=20;break}return t.next=17,this.Crypto.DecryptCap(l,this.signer.signingKey.privateKey);case 17:this.encryptionConks[n]=t.sent,t.next=34;break;case 20:return t.next=22,this.Crypto.GeneratePrimaryConk({spaceId:this.contentSpaceId,objectId:n});case 22:return this.encryptionConks[n]=t.sent,t.t0=this,t.t1=r,t.t2=n,t.t3=o,t.t4=c,t.next=30,this.Crypto.EncryptConk(this.encryptionConks[n],this.signer.signingKey.publicKey);case 30:return t.t5=t.sent,t.t6={libraryId:t.t1,objectId:t.t2,writeToken:t.t3,metadataSubtree:t.t4,metadata:t.t5},t.next=34,t.t0.ReplaceMetadata.call(t.t0,t.t6);case 34:if(!u){t.next=64;break}return t.prev=35,t.next=38,this.authClient.KMSAddress({objectId:n});case 38:return h=t.sent,t.next=41,this.authClient.KMSInfo({objectId:n});case 41:return f=t.sent.publicKey,d="eluv.caps.ikms".concat(this.utils.AddressToHash(h)),t.next=45,this.ContentObjectMetadata({libraryId:r,objectId:n,writeToken:o,metadataSubtree:d});case 45:if(t.sent){t.next=58;break}return t.t7=this,t.t8=r,t.t9=n,t.t10=o,t.t11=d,t.next=54,this.Crypto.EncryptConk(this.encryptionConks[n],f);case 54:return t.t12=t.sent,t.t13={libraryId:t.t8,objectId:t.t9,writeToken:t.t10,metadataSubtree:t.t11,metadata:t.t12},t.next=58,t.t7.ReplaceMetadata.call(t.t7,t.t13);case 58:t.next=64;break;case 60:t.prev=60,t.t14=t.catch(35),console.error("Failed to create encryption cap for KMS:"),console.error(t.t14);case 64:return t.abrupt("return",this.encryptionConks[n]);case 65:case"end":return t.stop()}}),t,this,[[35,60]])})));return function(e){return t.apply(this,arguments)}}(),e.EncryptionConk=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u,c,l,h,f,d;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,n=e.objectId,i=e.versionHash,o=e.writeToken,s=e.download,u=void 0!==s&&s,g({libraryId:r,objectId:n,versionHash:i}),o&&v(o),n||(n=client.DecodeVersionHash(i).objectId),t.next=6,this.authClient.Owner({id:n});case 6:return c=t.sent,l="eluv.caps.iusr".concat(this.utils.AddressToHash(this.signer.address)),t.next=10,this.ContentObjectMetadata({libraryId:r,objectId:n,metadataSubtree:l});case 10:if(h=t.sent,this.utils.EqualAddress(c,this.signer.address)||h){t.next=21;break}if(!u){t.next=18;break}return t.next=15,this.authClient.ReEncryptionConk({libraryId:r,objectId:n,versionHash:i});case 15:return t.abrupt("return",t.sent);case 18:return t.next=20,this.authClient.EncryptionConk({libraryId:r,objectId:n,versionHash:i});case 20:return t.abrupt("return",t.sent);case 21:if(this.encryptionConks[n]){t.next=38;break}return f="eluv.caps.iusr".concat(this.utils.AddressToHash(this.signer.address)),t.next=25,this.ContentObjectMetadata({libraryId:r,objectId:n,versionHash:i,writeToken:o,metadataSubtree:f});case 25:if(!(d=t.sent)){t.next=32;break}return t.next=29,this.Crypto.DecryptCap(d,this.signer.signingKey.privateKey);case 29:this.encryptionConks[n]=t.sent,t.next=38;break;case 32:if(!o){t.next=37;break}return t.next=35,this.CreateEncryptionConk({libraryId:r,objectId:n,versionHash:i,writeToken:o,createKMSConk:!1});case 35:t.next=38;break;case 37:throw"No encryption conk present for "+n;case 38:return t.abrupt("return",this.encryptionConks[n]);case 39:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.Encrypt=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,n=e.objectId,i=e.writeToken,o=e.chunk,g({libraryId:r,objectId:n}),t.next=4,this.EncryptionConk({libraryId:r,objectId:n,writeToken:i});case 4:return s=t.sent,t.next=7,this.Crypto.Encrypt(s,o);case 7:return u=t.sent,t.abrupt("return",u.buffer.slice(u.byteOffset,u.byteOffset+u.byteLength));case 9:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.Decrypt=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,n=e.objectId,i=e.writeToken,o=e.chunk,g({libraryId:r,objectId:n}),t.next=4,this.EncryptionConk({libraryId:r,objectId:n,writeToken:i,download:!0});case 4:return s=t.sent,t.next=7,this.Crypto.Decrypt(s,o);case 7:return u=t.sent,t.abrupt("return",u.buffer.slice(u.byteOffset,u.byteOffset+u.byteLength));case 9:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.AccessType=function(){var t=s(a.mark((function t(e){var r;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.id,t.next=3,this.authClient.AccessType(r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.AccessInfo=function(){var t=s(a.mark((function t(e){var r,n,i;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.objectId,n=e.args,p(r),n||(n=[0,[],[]]),this.Log("Retrieving access info: ".concat(r)),t.next=6,this.ethClient.CallContractMethod({contractAddress:this.utils.HashToAddress(r),methodName:"getAccessInfo",methodArgs:n});case 6:return i=t.sent,this.Log(i),t.abrupt("return",{visibilityCode:i[0],visible:i[0]>=1,accessible:i[0]>=10,editable:i[0]>=100,hasAccess:0===i[1],accessCode:i[1],accessCharge:this.utils.WeiToEther(i[2]).toString()});case 9:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.AccessRequest=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u,c,l,h;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,n=e.objectId,i=e.versionHash,o=e.args,s=void 0===o?[]:o,u=e.update,c=void 0!==u&&u,l=e.noCache,h=void 0!==l&&l,g({libraryId:r,objectId:n,versionHash:i}),i&&(n=this.utils.DecodeVersionHash(i).objectId),t.next=5,this.authClient.MakeAccessRequest({libraryId:r,objectId:n,versionHash:i,args:s,update:c,skipCache:!0,noCache:h});case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.SetAuthContext=function(t){var e=t.context;if(e&&Object.values(e).find((function(t){return"string"!=typeof t})))throw Error("Context must be a map of string->string");this.authContext=e},e.GenerateStateChannelToken=function(){var t=s(a.mark((function t(e){var r,n,i,o,s;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.objectId,n=e.versionHash,i=e.context,o=e.noCache,s=void 0!==o&&o,n?y(n):p(r),!n){t.next=6;break}r=this.utils.DecodeVersionHash(n).objectId,t.next=10;break;case 6:if(this.stateChannelAccess[r]){t.next=10;break}return t.next=9,this.LatestVersionHash({objectId:r});case 9:n=t.sent;case 10:return this.stateChannelAccess[r]=n,t.next=13,this.authClient.AuthorizationToken({objectId:r,channelAuth:!0,oauthToken:this.oauthToken,context:i,noCache:s});case 13:return t.abrupt("return",t.sent);case 14:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.FinalizeStateChannelAccess=function(){var t=s(a.mark((function t(e){var r,n,i;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.objectId,n=e.versionHash,i=e.percentComplete,n?y(n):p(r),!n){t.next=6;break}r=this.utils.DecodeVersionHash(n).objectId,t.next=13;break;case 6:if(!this.stateChannelAccess[r]){t.next=10;break}n=this.stateChannelAccess[r],t.next=13;break;case 10:return t.next=12,this.LatestVersionHash({objectId:r});case 12:n=t.sent;case 13:return this.stateChannelAccess[r]=void 0,t.next=16,this.authClient.ChannelContentFinalize({objectId:r,versionHash:n,percent:i});case 16:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.ContentObjectAccessComplete=function(){var t=s(a.mark((function t(e){var r,n,i;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.objectId,n=e.score,i=void 0===n?100:n,p(r),!(i<0||i>100)){t.next=4;break}throw Error("Invalid AccessComplete score: "+i);case 4:return t.next=6,this.authClient.AccessComplete({id:r,score:i});case 6:return t.abrupt("return",t.sent);case 7:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.Collection=function(){var t=s(a.mark((function t(e){var r;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.collectionType,["accessGroups","contentObjects","contentTypes","contracts","libraries"].includes(r)){t.next=4;break}throw new Error("Invalid collection type: "+r);case 4:if(!this.signer){t.next=10;break}return t.next=7,this.userProfileClient.WalletAddress();case 7:t.t0=t.sent,t.next=11;break;case 10:t.t0=void 0;case 11:if(t.t0){t.next=14;break}throw new Error("Unable to get collection: User wallet doesn't exist");case 14:return this.Log("Retrieving ".concat(r," contract collection for user ").concat(this.signer.address)),t.next=17,this.ethClient.MakeProviderCall({methodName:"send",args:["elv_getWalletCollection",[this.contentSpaceId,"iusr".concat(this.utils.AddressToHash(this.signer.address)),r]]});case 17:if(t.t1=t.sent,t.t1){t.next=20;break}t.t1=[];case 20:return t.abrupt("return",t.t1);case 21:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.VerifyContentObject=function(){var t=s(a.mark((function t(e){var r,n,i;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,n=e.objectId,i=e.versionHash,g({libraryId:r,objectId:n,versionHash:i}),t.next=4,ContentObjectVerification.VerifyContentObject({client:this,libraryId:r,objectId:n,versionHash:i});case 4:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.Proofs=function(){var t=s(a.mark((function t(e){var r,n,i,o,s;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,n=e.objectId,i=e.versionHash,o=e.partHash,g({libraryId:r,objectId:n,versionHash:i}),m(o),i&&(n=this.utils.DecodeVersionHash(i).objectId),s=l("q",i||n,"data",o,"proofs"),t.t0=this.utils,t.t1=this.HttpClient,t.next=9,this.authClient.AuthorizationHeader({libraryId:r,objectId:n,versionHash:i});case 9:return t.t2=t.sent,t.t3=s,t.t4={headers:t.t2,method:"GET",path:t.t3},t.t5=t.t1.Request.call(t.t1,t.t4),t.abrupt("return",t.t0.ResponseToJson.call(t.t0,t.t5));case 14:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.QParts=function(){var t=s(a.mark((function t(e){var r,n,i,o,s,u;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,n=e.objectId,i=e.partHash,o=e.format,s=void 0===o?"blob":o,g({libraryId:r,objectId:n,versionHash:versionHash}),m(i),u=l("qparts",i),t.t0=this.utils,t.t1=s,t.t2=this.HttpClient,t.next=9,this.authClient.AuthorizationHeader({libraryId:r,objectId:n,partHash:i});case 9:return t.t3=t.sent,t.t4=u,t.t5={headers:t.t3,method:"GET",path:t.t4},t.t6=t.t2.Request.call(t.t2,t.t5),t.abrupt("return",t.t0.ResponseToFormat.call(t.t0,t.t1,t.t6));case 14:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()},function(t,e,r){var n=r(3),i=r(4),o=r(15),a=r(16),s=r(25),u="undefined"!=typeof fetch?fetch:r(32).default,c=r(33).LogMessage,l=function(){"use strict";function t(e){var r=e.uris,n=e.debug;o(this,t),this.uris=r,this.uriIndex=0,this.debug=n,this.draftURIs={}}var e;return a(t,[{key:"Log",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];c(this,t,e)}},{key:"BaseURI",value:function(){return new s(this.uris[this.uriIndex])}},{key:"RecordWriteToken",value:function(t){this.draftURIs[t]=this.BaseURI()}},{key:"RequestHeaders",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.Accept||(e.Accept="application/json"),"JSON"===t?e["Content-type"]="application/json":"BINARY"===t&&(e["Content-type"]="application/octet-stream"),e}},{key:"Request",value:(e=i(n.mark((function e(r){var i,o,a,s,u,c,l,h,f,d,p,y,m,v,g,b,w,_,k,x,A,I,E,S;return n.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=r.method,o=r.path,a=r.queryParams,s=void 0===a?{}:a,u=r.body,c=r.bodyType,l=void 0===c?"JSON":c,h=r.headers,f=void 0===h?{}:h,d=r.attempts,p=void 0===d?0:d,y=r.failover,m=void 0===y||y,v=r.forceFailover,g=void 0!==v&&v,b=this.BaseURI(),w=o.replace(/^\//,"").match(/(qlibs\/ilib[a-zA-Z0-9]+|q|qid)\/(tqw_[a-zA-Z0-9]+)/),(_=w?w[2]:void 0)&&(this.draftURIs[_]?b=this.draftURIs[_]:this.draftURIs[_]=b),k=b.path(o).query(s).hash(""),x={method:i,headers:this.RequestHeaders(l,f)},"POST"!==i&&"PUT"!==i&&"DELETE"!==i||(u&&"JSON"===l?x.body=JSON.stringify(u):u&&(x.body=u)),e.prev=8,e.next=11,t.Fetch(k.toString(),x);case 11:A=e.sent,e.next=17;break;case 14:e.prev=14,e.t0=e.catch(8),A={ok:!1,status:500,statusText:"ElvClient Error: "+e.t0.message,url:k.toString(),stack:e.t0.stack};case 17:if(A.ok){e.next=40;break}if(!(!_&&(m&&parseInt(A.status)>=500||g)&&p<this.uris.length)){e.next=24;break}return this.Log("HttpClient failing over from ".concat(this.BaseURI(),": ").concat(p+1," attempts"),!0),this.uriIndex=(this.uriIndex+1)%this.uris.length,e.next=23,this.Request({method:i,path:o,queryParams:s,body:u,bodyType:l,headers:f,attempts:p+1,forceFailover:g});case 23:return e.abrupt("return",e.sent);case 24:if(I=A.headers&&A.headers.get("content-type")||"",E="",!A.text||!A.json){e.next=37;break}if(!I.includes("application/json")){e.next=33;break}return e.next=30,A.json();case 30:e.t1=e.sent,e.next=36;break;case 33:return e.next=35,A.text();case 35:e.t1=e.sent;case 36:E=e.t1;case 37:throw S={name:"ElvHttpClientError",status:A.status,statusText:A.statusText,message:A.statusText,url:k.toString(),body:E,requestParams:x},this.Log(JSON.stringify(S,null,2),!0),S;case 40:return this.Log("".concat(A.status," - ").concat(i," ").concat(k.toString())),e.abrupt("return",A);case 42:case"end":return e.stop()}}),e,this,[[8,14]])}))),function(t){return e.apply(this,arguments)})},{key:"URL",value:function(t){var e=t.path,r=t.queryParams,n=void 0===r?{}:r;return this.BaseURI().path(e).query(n).hash("").toString()}}],[{key:"Fetch",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return u(t,e)}}]),t}();t.exports=l},function(t,e,r){var n=r(78),i=r(135)((function(t,e,r,i){n(t,e,r,i)}));t.exports=i},function(t,e,r){var n=r(79),i=r(38),o=r(110),a=r(112),s=r(1),u=r(48),c=r(47);t.exports=function t(e,r,l,h,f){e!==r&&o(r,(function(o,u){if(f||(f=new n),s(o))a(e,r,u,l,t,h,f);else{var d=h?h(c(e,u),o,u+"",e,r,f):void 0;void 0===d&&(d=o),i(e,u,d)}}),u)}},function(t,e,r){var n=r(9),i=r(85),o=r(86),a=r(87),s=r(88),u=r(89);function c(t){var e=this.__data__=new n(t);this.size=e.size}c.prototype.clear=i,c.prototype.delete=o,c.prototype.get=a,c.prototype.has=s,c.prototype.set=u,t.exports=c},function(t,e){t.exports=function(){this.__data__=[],this.size=0}},function(t,e,r){var n=r(10),i=Array.prototype.splice;t.exports=function(t){var e=this.__data__,r=n(e,t);return!(r<0)&&(r==e.length-1?e.pop():i.call(e,r,1),--this.size,!0)}},function(t,e,r){var n=r(10);t.exports=function(t){var e=this.__data__,r=n(e,t);return r<0?void 0:e[r][1]}},function(t,e,r){var n=r(10);t.exports=function(t){return n(this.__data__,t)>-1}},function(t,e,r){var n=r(10);t.exports=function(t,e){var r=this.__data__,i=n(r,t);return i<0?(++this.size,r.push([t,e])):r[i][1]=e,this}},function(t,e,r){var n=r(9);t.exports=function(){this.__data__=new n,this.size=0}},function(t,e){t.exports=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}},function(t,e){t.exports=function(t){return this.__data__.get(t)}},function(t,e){t.exports=function(t){return this.__data__.has(t)}},function(t,e,r){var n=r(9),i=r(35),o=r(97);t.exports=function(t,e){var r=this.__data__;if(r instanceof n){var a=r.__data__;if(!i||a.length<199)return a.push([t,e]),this.size=++r.size,this;r=this.__data__=new o(a)}return r.set(t,e),this.size=r.size,this}},function(t,e,r){var n=r(19),i=r(93),o=r(1),a=r(95),s=/^\[object .+?Constructor\]$/,u=Function.prototype,c=Object.prototype,l=u.toString,h=c.hasOwnProperty,f=RegExp("^"+l.call(h).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!o(t)||i(t))&&(n(t)?f:s).test(a(t))}},function(t,e,r){var n=r(36),i=Object.prototype,o=i.hasOwnProperty,a=i.toString,s=n?n.toStringTag:void 0;t.exports=function(t){var e=o.call(t,s),r=t[s];try{t[s]=void 0;var n=!0}catch(t){}var i=a.call(t);return n&&(e?t[s]=r:delete t[s]),i}},function(t,e){var r=Object.prototype.toString;t.exports=function(t){return r.call(t)}},function(t,e,r){var n,i=r(94),o=(n=/[^.]+$/.exec(i&&i.keys&&i.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";t.exports=function(t){return!!o&&o in t}},function(t,e,r){var n=r(2)["__core-js_shared__"];t.exports=n},function(t,e){var r=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return r.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},function(t,e){t.exports=function(t,e){return null==t?void 0:t[e]}},function(t,e,r){var n=r(98),i=r(105),o=r(107),a=r(108),s=r(109);function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=i,u.prototype.get=o,u.prototype.has=a,u.prototype.set=s,t.exports=u},function(t,e,r){var n=r(99),i=r(9),o=r(35);t.exports=function(){this.size=0,this.__data__={hash:new n,map:new(o||i),string:new n}}},function(t,e,r){var n=r(100),i=r(101),o=r(102),a=r(103),s=r(104);function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=i,u.prototype.get=o,u.prototype.has=a,u.prototype.set=s,t.exports=u},function(t,e,r){var n=r(13);t.exports=function(){this.__data__=n?n(null):{},this.size=0}},function(t,e){t.exports=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}},function(t,e,r){var n=r(13),i=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;if(n){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return i.call(e,t)?e[t]:void 0}},function(t,e,r){var n=r(13),i=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;return n?void 0!==e[t]:i.call(e,t)}},function(t,e,r){var n=r(13);t.exports=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=n&&void 0===e?"__lodash_hash_undefined__":e,this}},function(t,e,r){var n=r(14);t.exports=function(t){var e=n(this,t).delete(t);return this.size-=e?1:0,e}},function(t,e){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}t.exports=function(t){var e=r(t);return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}},function(t,e,r){var n=r(14);t.exports=function(t){return n(this,t).get(t)}},function(t,e,r){var n=r(14);t.exports=function(t){return n(this,t).has(t)}},function(t,e,r){var n=r(14);t.exports=function(t,e){var r=n(this,t),i=r.size;return r.set(t,e),this.size+=r.size==i?0:1,this}},function(t,e,r){var n=r(111)();t.exports=n},function(t,e){t.exports=function(t){return function(e,r,n){for(var i=-1,o=Object(e),a=n(e),s=a.length;s--;){var u=a[t?s:++i];if(!1===r(o[u],u,o))break}return e}}},function(t,e,r){var n=r(38),i=r(113),o=r(114),a=r(117),s=r(118),u=r(42),c=r(43),l=r(122),h=r(45),f=r(19),d=r(1),p=r(124),y=r(46),m=r(47),v=r(128);t.exports=function(t,e,r,g,b,w,_){var k=m(t,r),x=m(e,r),A=_.get(x);if(A)n(t,r,A);else{var I=w?w(k,x,r+"",t,e,_):void 0,E=void 0===I;if(E){var S=c(x),M=!S&&h(x),T=!S&&!M&&y(x);I=x,S||M||T?c(k)?I=k:l(k)?I=a(k):M?(E=!1,I=i(x,!0)):T?(E=!1,I=o(x,!0)):I=[]:p(x)||u(x)?(I=k,u(k)?I=v(k):d(k)&&!f(k)||(I=s(x))):E=!1}E&&(_.set(x,I),b(I,x,g,w,_),_.delete(x)),n(t,r,I)}}},function(t,e,r){(function(t){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=r(2),o="object"==n(e)&&e&&!e.nodeType&&e,a=o&&"object"==n(t)&&t&&!t.nodeType&&t,s=a&&a.exports===o?i.Buffer:void 0,u=s?s.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var r=t.length,n=u?u(r):new t.constructor(r);return t.copy(n),n}}).call(this,r(0)(t))},function(t,e,r){var n=r(115);t.exports=function(t,e){var r=e?n(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}},function(t,e,r){var n=r(116);t.exports=function(t){var e=new t.constructor(t.byteLength);return new n(e).set(new n(t)),e}},function(t,e,r){var n=r(2).Uint8Array;t.exports=n},function(t,e){t.exports=function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}},function(t,e,r){var n=r(119),i=r(40),o=r(41);t.exports=function(t){return"function"!=typeof t.constructor||o(t)?{}:n(i(t))}},function(t,e,r){var n=r(1),i=Object.create,o=function(){function t(){}return function(e){if(!n(e))return{};if(i)return i(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();t.exports=o},function(t,e){t.exports=function(t,e){return function(r){return t(e(r))}}},function(t,e,r){var n=r(12),i=r(6);t.exports=function(t){return i(t)&&"[object Arguments]"==n(t)}},function(t,e,r){var n=r(21),i=r(6);t.exports=function(t){return i(t)&&n(t)}},function(t,e){t.exports=function(){return!1}},function(t,e,r){var n=r(12),i=r(40),o=r(6),a=Function.prototype,s=Object.prototype,u=a.toString,c=s.hasOwnProperty,l=u.call(Object);t.exports=function(t){if(!o(t)||"[object Object]"!=n(t))return!1;var e=i(t);if(null===e)return!0;var r=c.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&u.call(r)==l}},function(t,e,r){var n=r(12),i=r(44),o=r(6),a={};a["[object Float32Array]"]=a["[object Float64Array]"]=a["[object Int8Array]"]=a["[object Int16Array]"]=a["[object Int32Array]"]=a["[object Uint8Array]"]=a["[object Uint8ClampedArray]"]=a["[object Uint16Array]"]=a["[object Uint32Array]"]=!0,a["[object Arguments]"]=a["[object Array]"]=a["[object ArrayBuffer]"]=a["[object Boolean]"]=a["[object DataView]"]=a["[object Date]"]=a["[object Error]"]=a["[object Function]"]=a["[object Map]"]=a["[object Number]"]=a["[object Object]"]=a["[object RegExp]"]=a["[object Set]"]=a["[object String]"]=a["[object WeakMap]"]=!1,t.exports=function(t){return o(t)&&i(t.length)&&!!a[n(t)]}},function(t,e){t.exports=function(t){return function(e){return t(e)}}},function(t,e,r){(function(t){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=r(37),o="object"==n(e)&&e&&!e.nodeType&&e,a=o&&"object"==n(t)&&t&&!t.nodeType&&t,s=a&&a.exports===o&&i.process,u=function(){try{var t=a&&a.require&&a.require("util").types;return t||s&&s.binding&&s.binding("util")}catch(t){}}();t.exports=u}).call(this,r(0)(t))},function(t,e,r){var n=r(129),i=r(48);t.exports=function(t){return n(t,i(t))}},function(t,e,r){var n=r(130),i=r(20);t.exports=function(t,e,r,o){var a=!r;r||(r={});for(var s=-1,u=e.length;++s<u;){var c=e[s],l=o?o(r[c],t[c],c,r,t):void 0;void 0===l&&(l=t[c]),a?i(r,c,l):n(r,c,l)}return r}},function(t,e,r){var n=r(20),i=r(11),o=Object.prototype.hasOwnProperty;t.exports=function(t,e,r){var a=t[e];o.call(t,e)&&i(a,r)&&(void 0!==r||e in t)||n(t,e,r)}},function(t,e,r){var n=r(132),i=r(42),o=r(43),a=r(45),s=r(49),u=r(46),c=Object.prototype.hasOwnProperty;t.exports=function(t,e){var r=o(t),l=!r&&i(t),h=!r&&!l&&a(t),f=!r&&!l&&!h&&u(t),d=r||l||h||f,p=d?n(t.length,String):[],y=p.length;for(var m in t)!e&&!c.call(t,m)||d&&("length"==m||h&&("offset"==m||"parent"==m)||f&&("buffer"==m||"byteLength"==m||"byteOffset"==m)||s(m,y))||p.push(m);return p}},function(t,e){t.exports=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}},function(t,e,r){var n=r(1),i=r(41),o=r(134),a=Object.prototype.hasOwnProperty;t.exports=function(t){if(!n(t))return o(t);var e=i(t),r=[];for(var s in t)("constructor"!=s||!e&&a.call(t,s))&&r.push(s);return r}},function(t,e){t.exports=function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e}},function(t,e,r){var n=r(136),i=r(143);t.exports=function(t){return n((function(e,r){var n=-1,o=r.length,a=o>1?r[o-1]:void 0,s=o>2?r[2]:void 0;for(a=t.length>3&&"function"==typeof a?(o--,a):void 0,s&&i(r[0],r[1],s)&&(a=o<3?void 0:a,o=1),e=Object(e);++n<o;){var u=r[n];u&&t(e,u,n,a)}return e}))}},function(t,e,r){var n=r(50),i=r(137),o=r(139);t.exports=function(t,e){return o(i(t,e,n),t+"")}},function(t,e,r){var n=r(138),i=Math.max;t.exports=function(t,e,r){return e=i(void 0===e?t.length-1:e,0),function(){for(var o=arguments,a=-1,s=i(o.length-e,0),u=Array(s);++a<s;)u[a]=o[e+a];a=-1;for(var c=Array(e+1);++a<e;)c[a]=o[a];return c[e]=r(u),n(t,this,c)}}},function(t,e){t.exports=function(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}},function(t,e,r){var n=r(140),i=r(142)(n);t.exports=i},function(t,e,r){var n=r(141),i=r(39),o=r(50),a=i?function(t,e){return i(t,"toString",{configurable:!0,enumerable:!1,value:n(e),writable:!0})}:o;t.exports=a},function(t,e){t.exports=function(t){return function(){return t}}},function(t,e){var r=Date.now;t.exports=function(t){var e=0,n=0;return function(){var i=r(),o=16-(i-n);if(n=i,o>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}},function(t,e,r){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=r(11),o=r(21),a=r(49),s=r(1);t.exports=function(t,e,r){if(!s(r))return!1;var u=n(e);return!!("number"==u?o(r)&&a(e,r.length):"string"==u&&e in r)&&i(r[e],t)}},function(t,e,r){(function(t,n){var i=r(7),o=r(3),a=r(4);function s(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function u(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?s(Object(r),!0).forEach((function(e){i(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var c,l=r(17);l.Platform()===l.PLATFORM_NODE&&(t.Response=r(32).Response,c=r(145));var h=r(31),f=r(34),d=f.ValidatePresence,p=f.ValidateWriteToken,y=f.ValidatePartHash,m=f.ValidateParameters;e.ListFiles=function(){var t=a(o.mark((function t(e){var r,n,i,a;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,n=e.objectId,i=e.versionHash,m({libraryId:r,objectId:n,versionHash:i}),i&&(n=this.utils.DecodeVersionHash(i).objectId),a=h("q",i||n,"meta","files"),t.t0=this.utils,t.t1=this.HttpClient,t.next=8,this.authClient.AuthorizationHeader({libraryId:r,objectId:n,versionHash:i});case 8:return t.t2=t.sent,t.t3=a,t.t4={headers:t.t2,method:"GET",path:t.t3},t.t5=t.t1.Request.call(t.t1,t.t4),t.abrupt("return",t.t0.ResponseToJson.call(t.t0,t.t5));case 13:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.UploadFilesFromS3=function(){var t=a(o.mark((function t(e){var r,i,a,s,c,l,h,f,d,y,v,g,b,w,_,k,x,A,I,E,S,M,T,P,C,O,R,j,N;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=e.libraryId,i=e.objectId,a=e.writeToken,s=e.region,c=e.bucket,l=e.fileInfo,h=e.accessKey,f=e.secret,d=e.signedUrl,y=e.encryption,v=void 0===y?"none":y,g=e.copy,b=void 0!==g&&g,w=e.callback,m({libraryId:r,objectId:i}),p(a),_=/^s3:\/\/([^/]+)\//i,k=0;case 5:if(!(k<l.length)){t.next=18;break}if(x=l[k].source,!(A=_.exec(x))){t.next=15;break}if(A[1]===c){t.next=14;break}throw Error('Full S3 file path "'+x+"\" specified, but does not match provided bucket name '"+c+"'");case 14:l[k].source=x.replace(_,"");case 15:k++,t.next=5;break;case 18:if(this.Log("Uploading files from S3: ".concat(r," ").concat(i," ").concat(a)),"cgck"!==v){t.next=25;break}return t.next=22,this.EncryptionConk({libraryId:r,objectId:i,writeToken:a});case 22:E=u(u({},E=t.sent),{},{secret_key:""}),I="kp__".concat(this.utils.B58(n.from(JSON.stringify(E))));case 25:return S={access_key_id:h,secret_access_key:f},d&&(S={signed_url:d}),M={encryption_key:I,access:{protocol:"s3",platform:"aws",path:c,storage_endpoint:{region:s},cloud_credentials:S}},T=l.map((function(t){return b?{op:"ingest-copy",path:t.path,encryption:{scheme:"cgck"===v?"cgck":"none"},ingest:{type:"key",path:t.source}}:{op:"add-reference",path:t.path,reference:{type:"key",path:t.source}}})),t.next=31,this.CreateFileUploadJob({libraryId:r,objectId:i,writeToken:a,ops:T,defaults:M});case 31:P=t.sent,C=P.id;case 33:return t.next=36,new Promise((function(t){return setTimeout(t,1e3)}));case 36:return t.next=38,this.UploadStatus({libraryId:r,objectId:i,writeToken:a,uploadId:C});case 38:if(!((O=t.sent).errors&&O.errors.length>1)){t.next=43;break}throw O.errors.join("\n");case 43:if(!O.error){t.next=48;break}throw this.Log("S3 file upload failed:\n".concat(JSON.stringify(O,null,2))),O.error;case 48:if("failed"!==O.status.toLowerCase()){t.next=50;break}throw"File upload failed";case 50:if(R=!1,b?(R=O.ingest_copy.done,w&&(j=O.ingest_copy.progress,w({done:R,uploaded:j.bytes.completed,total:j.bytes.total,uploadedFiles:j.files.completed,totalFiles:j.files.total,fileStatus:j.files.details}))):(R=O.add_reference.done,w&&(N=O.add_reference.progress,w({done:R,uploadedFiles:N.completed,totalFiles:N.total}))),!R){t.next=54;break}return t.abrupt("break",56);case 54:t.next=33;break;case 56:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.UploadFiles=function(){var t=a(o.mark((function t(e){var r,i,s,l,h,f,d,y,v,g,b,w,_,k,x,A,I,E,S,M,T,P,C,O,R,j,N,L,U=this;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.libraryId,i=e.objectId,s=e.writeToken,l=e.fileInfo,h=e.encryption,f=void 0===h?"none":h,d=e.callback,m({libraryId:r,objectId:i}),p(s),this.Log("Uploading files: ".concat(r," ").concat(i," ").concat(s)),"cgck"!==f){t.next=8;break}return t.next=7,this.EncryptionConk({libraryId:r,objectId:i,writeToken:s});case 7:y=t.sent;case 8:for(v={},g={},b=0;b<l.length;b++)(w=u(u({},l[b]),{},{data:void 0})).path=w.path.replace(/^\/+/,""),"cgck"===f&&(w.encryption={scheme:"cgck"}),g[w.path]=l[b].data,delete w.data,w.type="file",v[w.path]={uploaded:0,total:w.size},l[b]=w;return this.Log(l),d&&d(v),t.next=15,this.CreateFileUploadJob({libraryId:r,objectId:i,writeToken:s,ops:l,encryption:f});case 15:_=t.sent,k=_.id,x=_.jobs,this.Log("Upload ID: ".concat(k)),this.Log(x),104857600,A=[],I=0,E=0,S=function(){var t=a(o.mark((function t(){var e,a,u,l,h,d;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=0;case 1:if(!(e<x.length)){t.next=31;break}case 2:if(!(I-E>104857600)){t.next=7;break}return t.next=5,new Promise((function(t){return setTimeout(t,500)}));case 5:t.next=2;break;case 7:return a=x[e],t.next=10,U.UploadJobStatus({libraryId:r,objectId:i,writeToken:s,uploadId:k,jobId:a});case 10:u=t.sent,l=0;case 12:if(!(l<u.files.length)){t.next=25;break}if(h=u.files[l],d=void 0,"number"==typeof g[h.path]?(d=n.alloc(h.len),c.readSync(g[h.path],d,0,h.len,h.off)):d=g[h.path].slice(h.off,h.off+h.len),"cgck"!==f){t.next=20;break}return t.next=19,U.Crypto.Encrypt(y,d);case 19:d=t.sent;case 20:u.files[l].data=d,I+=h.len;case 22:l++,t.next=12;break;case 25:return A[e]=u,t.next=28,new Promise((function(t){return setTimeout(t,50)}));case 28:e++,t.next=1;break;case 31:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),M=function(){var t=a(o.mark((function t(e,n){var a,c,l,h;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(A[n]){t.next=5;break}return t.next=3,new Promise((function(t){return setTimeout(t,500)}));case 3:t.next=0;break;case 5:a=A[n],c=a.files,l=0;case 8:if(!(l<c.length)){t.next=18;break}return h=c[l],t.next=12,U.UploadFileData({libraryId:r,objectId:i,writeToken:s,uploadId:k,jobId:e,fileData:h.data});case 12:delete A[n].files[l].data,E+=h.len,d&&(v[h.path]=u(u({},v[h.path]),{},{uploaded:v[h.path].uploaded+h.len}),d(v));case 15:l++,t.next=8;break;case 18:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),S(),T=Math.min(3,x.length),P=[],C=0;case 30:if(!(C<T)){t.next=40;break}return O=(new Date).getTime(),t.next=34,M(x[C],C);case 34:R=((new Date).getTime()-O)/1e3,j=A[C].files.map((function(t){return t.len})).reduce((function(t,e){return t+e}),0),P.push(j/R/1048576);case 37:C++,t.next=30;break;case 40:return N=P.reduce((function(t,e){return t+e}),0)/T,L=Math.min(5,Math.ceil(N/2)),t.next=44,this.utils.LimitedMap(L,x,function(){var t=a(o.mark((function t(e,r){return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(r<T)){t.next=2;break}return t.abrupt("return");case 2:return t.next=4,M(e,r);case 4:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}());case 44:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.CreateFileUploadJob=function(){var t=a(o.mark((function t(e){var r,n,i,a,s,u,c,l,f,d;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,n=e.objectId,i=e.writeToken,a=e.ops,s=e.defaults,u=void 0===s?{}:s,c=e.encryption,l=void 0===c?"none":c,m({libraryId:r,objectId:n}),p(i),this.Log("Creating file upload job: ".concat(r," ").concat(n," ").concat(i)),this.Log(a),"cgck"===l&&(u.encryption={scheme:"cgck"}),f={seq:0,seq_complete:!0,defaults:u,ops:a},d=h("q",i,"file_jobs"),t.t0=this.utils,t.t1=this.HttpClient,t.next=12,this.authClient.AuthorizationHeader({libraryId:r,objectId:n,update:!0,encryption:l});case 12:return t.t2=t.sent,t.t3=d,t.t4=f,t.t5={headers:t.t2,method:"POST",path:t.t3,body:t.t4,failover:!1},t.t6=t.t1.Request.call(t.t1,t.t5),t.abrupt("return",t.t0.ResponseToJson.call(t.t0,t.t6));case 18:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.UploadStatus=function(){var t=a(o.mark((function t(e){var r,n,i,a,s;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,n=e.objectId,i=e.writeToken,a=e.uploadId,m({libraryId:r,objectId:n}),p(i),s=h("q",i,"file_jobs",a),t.t0=this.utils,t.t1=this.HttpClient,t.next=8,this.authClient.AuthorizationHeader({libraryId:r,objectId:n,update:!0});case 8:return t.t2=t.sent,t.t3=s,t.t4={headers:t.t2,method:"GET",path:t.t3,failover:!1},t.t5=t.t1.Request.call(t.t1,t.t4),t.abrupt("return",t.t0.ResponseToJson.call(t.t0,t.t5));case 13:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.UploadJobStatus=function(){var t=a(o.mark((function t(e){var r,n,i,a,s,u;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,n=e.objectId,i=e.writeToken,a=e.uploadId,s=e.jobId,m({libraryId:r,objectId:n}),p(i),u=h("q",i,"file_jobs",a,"uploads",s),t.t0=this.utils,t.t1=this.HttpClient,t.next=8,this.authClient.AuthorizationHeader({libraryId:r,objectId:n,update:!0});case 8:return t.t2=t.sent,t.t3=u,t.t4={headers:t.t2,method:"GET",path:t.t3,failover:!1},t.t5=t.t1.Request.call(t.t1,t.t4),t.abrupt("return",t.t0.ResponseToJson.call(t.t0,t.t5));case 13:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.UploadFileData=function(){var t=a(o.mark((function t(e){var r,n,i,a,s,c,l;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,n=e.objectId,i=e.writeToken,a=e.uploadId,s=e.jobId,c=e.fileData,m({libraryId:r,objectId:n}),p(i),l=h("q",i,"file_jobs",a,s),t.t0=this.utils,t.t1=this.HttpClient,t.t2=l,t.t3=c,t.t4=u,t.t5={"Content-type":"application/octet-stream"},t.next=12,this.authClient.AuthorizationHeader({libraryId:r,objectId:n,update:!0});case 12:return t.t6=t.sent,t.t7=(0,t.t4)(t.t5,t.t6),t.t8={method:"POST",path:t.t2,body:t.t3,bodyType:"BINARY",headers:t.t7,failover:!1},t.t9=t.t1.Request.call(t.t1,t.t8),t.next=18,t.t0.ResponseToJson.call(t.t0,t.t9);case 18:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.FinalizeUploadJob=function(){var t=a(o.mark((function t(e){var r,n,i,a;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,n=e.objectId,i=e.writeToken,m({libraryId:r,objectId:n}),p(i),this.Log("Finalizing upload job: ".concat(r," ").concat(n," ").concat(i)),a=h("q",i,"files"),t.t0=this.HttpClient,t.t1=a,t.next=9,this.authClient.AuthorizationHeader({libraryId:r,objectId:n,update:!0});case 9:return t.t2=t.sent,t.t3={method:"POST",path:t.t1,bodyType:"BINARY",headers:t.t2,failover:!1},t.next=13,t.t0.Request.call(t.t0,t.t3);case 13:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.CreateFileDirectories=function(){var t=a(o.mark((function t(e){var r,n,i,a,s;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,n=e.objectId,i=e.writeToken,a=e.filePaths,m({libraryId:r,objectId:n}),p(i),this.Log("Creating Directories: ".concat(r," ").concat(n," ").concat(i)),this.Log(a),s=a.map((function(t){return{op:"add",type:"directory",path:t}})),t.next=8,this.CreateFileUploadJob({libraryId:r,objectId:n,writeToken:i,ops:s});case 8:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.DeleteFiles=function(){var t=a(o.mark((function t(e){var r,n,i,a,s;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,n=e.objectId,i=e.writeToken,a=e.filePaths,m({libraryId:r,objectId:n}),p(i),this.Log("Deleting Files: ".concat(r," ").concat(n," ").concat(i)),this.Log(a),s=a.map((function(t){return{op:"del",path:t}})),t.next=8,this.CreateFileUploadJob({libraryId:r,objectId:n,writeToken:i,ops:s});case 8:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.DownloadFile=function(){var t=a(o.mark((function t(e){var r,n,i,a,s,c,l,f,p,y,v,g,b,w,_,k,x,A,I,E,S,M=arguments;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,n=e.objectId,i=e.versionHash,a=e.writeToken,s=e.filePath,c=e.format,l=void 0===c?"arrayBuffer":c,f=e.chunked,p=void 0!==f&&f,y=e.chunkSize,v=e.clientSideDecryption,g=void 0!==v&&v,b=e.callback,m({libraryId:r,objectId:n,versionHash:i}),d("filePath",s),i&&(n=this.utils.DecodeVersionHash(i).objectId),t.next=6,this.ContentObjectMetadata({libraryId:r,objectId:n,versionHash:i,writeToken:a,metadataSubtree:h("files",s)});case 6:return w=t.sent,_=w&&w["."].encryption&&"cgck"===w["."].encryption.scheme,k=_?"cgck":void 0,x=_&&!g?h("q",a||i||n,"rep","files_download",s):h("q",a||i||n,"files",s),t.next=12,this.authClient.AuthorizationHeader({libraryId:r,objectId:n,versionHash:i,encryption:k});case 12:return(A=t.sent).Accept="*/*",I="eluv.caps.iusr".concat(this.utils.AddressToHash(this.signer.address)),t.next=17,this.ContentObjectMetadata({libraryId:r,objectId:n,metadataSubtree:I});case 17:if(E=t.sent,t.t1=_,!t.t1){t.next=26;break}return t.t2=this.utils,t.t3=this.signer.address,t.next=24,this.ContentObjectOwner({objectId:n});case 24:t.t4=t.sent,t.t1=!t.t2.EqualAddress.call(t.t2,t.t3,t.t4);case 26:if(t.t0=t.t1,!t.t0){t.next=29;break}t.t0=!E;case 29:if(!t.t0){t.next=31;break}A["X-Content-Fabric-Decryption-Mode"]="reencrypt";case 31:if(_&&!g&&(A["X-Content-Fabric-Decryption-Mode"]="decrypt",y=Number.MAX_SAFE_INTEGER),S=w["."].size,!_||!g){t.next=51;break}return t.t5=this,t.next=37,this.EncryptionConk({libraryId:r,objectId:n,versionHash:i,download:!0});case 37:return t.t6=t.sent,t.t7=x,t.t8=S,t.t9=A,t.t10=b,t.t11=l,t.t12=g,t.t13=p,t.t14={conk:t.t6,downloadPath:t.t7,bytesTotal:t.t8,headers:t.t9,callback:t.t10,format:t.t11,clientSideDecryption:t.t12,chunked:t.t13},t.next=48,t.t5.DownloadEncrypted.call(t.t5,t.t14);case 48:return t.abrupt("return",t.sent);case 51:return y||(y=1e7),t.prev=52,t.next=55,this.Download({downloadPath:x,bytesTotal:S,headers:A,callback:b,format:l,chunked:p,chunkSize:y});case 55:return t.abrupt("return",t.sent);case 58:if(t.prev=58,t.t15=t.catch(52),!_||g){t.next=62;break}return t.abrupt("return",this.DownloadFile(u(u({},M[0]),{},{clientSideDecryption:!0})));case 62:throw t.t15;case 63:case"end":return t.stop()}}),t,this,[[52,58]])})));return function(e){return t.apply(this,arguments)}}(),e.ContentParts=function(){var t=a(o.mark((function t(e){var r,n,i,a,s;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,n=e.objectId,i=e.versionHash,m({libraryId:r,objectId:n,versionHash:i}),this.Log("Retrieving parts: ".concat(r," ").concat(n||i)),i&&(n=this.utils.DecodeVersionHash(i).objectId),a=h("q",i||n,"parts"),t.t0=this.utils,t.t1=this.HttpClient,t.next=9,this.authClient.AuthorizationHeader({libraryId:r,objectId:n,versionHash:i});case 9:return t.t2=t.sent,t.t3=a,t.t4={headers:t.t2,method:"GET",path:t.t3},t.t5=t.t1.Request.call(t.t1,t.t4),t.next=15,t.t0.ResponseToJson.call(t.t0,t.t5);case 15:return s=t.sent,t.abrupt("return",s.parts);case 17:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.ContentPart=function(){var t=a(o.mark((function t(e){var r,n,i,a,s;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,n=e.objectId,i=e.versionHash,a=e.partHash,m({libraryId:r,objectId:n,versionHash:i}),y(a),this.Log("Retrieving part: ".concat(r," ").concat(n||i," ").concat(a)),i&&(n=this.utils.DecodeVersionHash(i).objectId),s=h("q",i||n,"parts",a),t.t0=this.utils,t.t1=this.HttpClient,t.next=10,this.authClient.AuthorizationHeader({libraryId:r,objectId:n,versionHash:i});case 10:return t.t2=t.sent,t.t3=s,t.t4={headers:t.t2,method:"GET",path:t.t3},t.t5=t.t1.Request.call(t.t1,t.t4),t.next=16,t.t0.ResponseToJson.call(t.t0,t.t5);case 16:return t.abrupt("return",t.sent);case 17:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.DownloadPart=function(){var t=a(o.mark((function t(e){var r,n,i,a,s,u,c,l,f,d,p,v,g,b,w,_,k;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,n=e.objectId,i=e.versionHash,a=e.writeToken,s=e.partHash,u=e.format,c=void 0===u?"arrayBuffer":u,l=e.chunked,f=void 0!==l&&l,d=e.chunkSize,p=void 0===d?1e7:d,v=e.callback,m({libraryId:r,objectId:n,versionHash:i}),y(s),i&&(n=this.utils.DecodeVersionHash(i).objectId),g=s.startsWith("hqpe"),b=g?"cgck":void 0,w=h("q",a||i||n,"data",s),t.next=9,this.authClient.AuthorizationHeader({libraryId:r,objectId:n,versionHash:i,encryption:b});case 9:return _=t.sent,t.next=12,this.ContentPart({libraryId:r,objectId:n,versionHash:i,partHash:s});case 12:if(k=t.sent.part.size,!g){t.next=37;break}return t.t0=this.utils,t.t1=this.signer.address,t.next=18,this.ContentObjectOwner({objectId:n});case 18:if(t.t2=t.sent,t.t0.EqualAddress.call(t.t0,t.t1,t.t2)){t.next=21;break}_["X-Content-Fabric-Decryption-Mode"]="reencrypt";case 21:return t.t3=this,t.next=24,this.EncryptionConk({libraryId:r,objectId:n,download:!0});case 24:return t.t4=t.sent,t.t5=w,t.t6=k,t.t7=_,t.t8=v,t.t9=c,t.t10=f,t.t11={conk:t.t4,downloadPath:t.t5,bytesTotal:t.t6,headers:t.t7,callback:t.t8,format:t.t9,chunked:t.t10},t.next=34,t.t3.DownloadEncrypted.call(t.t3,t.t11);case 34:return t.abrupt("return",t.sent);case 37:return t.next=39,this.Download({downloadPath:w,bytesTotal:k,headers:_,callback:v,format:c,chunked:f,chunkSize:p});case 39:return t.abrupt("return",t.sent);case 40:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.Download=function(){var t=a(o.mark((function t(e){var r,i,a,s,u,c,l,h,f,d,p,y,m,v,g;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.downloadPath,i=e.headers,a=e.bytesTotal,s=e.chunked,u=void 0!==s&&s,c=e.chunkSize,l=void 0===c?2e6:c,h=e.callback,f=e.format,d=void 0===f?"arrayBuffer":f,!u||h){t.next=3;break}throw Error("No callback specified for chunked download");case 3:u||(p=[]),y=0,m=Math.ceil(a/l),v=0;case 7:if(!(v<m)){t.next=35;break}return i.Range="bytes=".concat(y,"-").concat(y+l-1),t.next=11,this.HttpClient.Request({path:r,headers:i,method:"GET"});case 11:if(g=t.sent,y=Math.min(y+l,a),!u){t.next=24;break}return t.t0=h,t.t1=y,t.t2=a,t.next=19,this.utils.ResponseToFormat(d,g);case 19:t.t3=t.sent,t.t4={bytesFinished:t.t1,bytesTotal:t.t2,chunk:t.t3},(0,t.t0)(t.t4),t.next=32;break;case 24:return t.t5=p,t.t6=n,t.next=28,g.arrayBuffer();case 28:t.t7=t.sent,t.t8=t.t6.from.call(t.t6,t.t7),t.t5.push.call(t.t5,t.t8),h&&h({bytesFinished:y,bytesTotal:a});case 32:v++,t.next=7;break;case 35:if(u){t.next=39;break}return t.next=38,this.utils.ResponseToFormat(d,new Response(n.concat(p)));case 38:return t.abrupt("return",t.sent);case 39:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.DownloadEncrypted=function(){var t=a(o.mark((function t(e){var r,i,s,u,c,l,h,f,d,p,y,m,v,g,b,w,_,k=this;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.conk,i=e.downloadPath,s=e.bytesTotal,u=e.headers,c=e.callback,l=e.format,h=void 0===l?"arrayBuffer":l,f=e.chunked,!(d=void 0!==f&&f)||c){t.next=3;break}throw Error("No callback specified for chunked download");case 3:return p=r.public_key.startsWith("ktpk"),y=this.Crypto.EncryptedBlockSize(1e6,p),m=0,h=h.toLowerCase(),v=[],t.next=10,this.Crypto.OpenDecryptionStream(r);case 10:(g=t.sent).on("data",function(){var t=a(o.mark((function t(e){var r;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!d){t.next=13;break}if("buffer"===h){t.next=10;break}if(r=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),"arraybuffer"!==h){t.next=7;break}e=r,t.next=10;break;case 7:return t.next=9,k.utils.ResponseToFormat(h,new Response(r));case 9:e=t.sent;case 10:c({bytesFinished:m,bytesTotal:s,chunk:e}),t.next=15;break;case 13:c&&c({bytesFinished:m,bytesTotal:s}),v.push(e);case 15:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),b=Math.ceil(s/y),w=0;case 14:if(!(w<b)){t.next=30;break}return u.Range="bytes=".concat(m,"-").concat(m+y-1),t.next=18,this.HttpClient.Request({headers:u,method:"GET",path:i});case 18:return _=t.sent,m=Math.min(m+y,s),t.t0=g,t.t1=Uint8Array,t.next=24,_.arrayBuffer();case 24:t.t2=t.sent,t.t3=new t.t1(t.t2),t.t0.write.call(t.t0,t.t3);case 27:w++,t.next=14;break;case 30:return g.end(),t.next=33,new Promise((function(t){return g.on("finish",(function(){t()}))}));case 33:if(d){t.next=37;break}return t.next=36,this.utils.ResponseToFormat(h,new Response(n.concat(v)));case 36:return t.abrupt("return",t.sent);case 37:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.CreatePart=function(){var t=a(o.mark((function t(e){var r,n,i,a,s,u;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,n=e.objectId,i=e.writeToken,a=e.encryption,m({libraryId:r,objectId:n}),p(i),s=h("q",i,"parts"),t.t0=this.utils,t.t1=this.HttpClient,t.next=8,this.authClient.AuthorizationHeader({libraryId:r,objectId:n,update:!0,encryption:a});case 8:return t.t2=t.sent,t.t3=s,t.t4={headers:t.t2,method:"POST",path:t.t3,bodyType:"BINARY",body:"",failover:!1},t.t5=t.t1.Request.call(t.t1,t.t4),t.next=14,t.t0.ResponseToJson.call(t.t0,t.t5);case 14:return u=t.sent,t.abrupt("return",u.part.write_token);case 16:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.UploadPartChunk=function(){var t=a(o.mark((function t(e){var r,n,i,a,s,u,c,l;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.libraryId,n=e.objectId,i=e.writeToken,a=e.partWriteToken,s=e.chunk,u=e.encryption,m({libraryId:r,objectId:n}),p(i),!u||"none"===u){t.next=10;break}return t.next=6,this.EncryptionConk({libraryId:r,objectId:n,writeToken:i});case 6:return c=t.sent,t.next=9,this.Crypto.Encrypt(c,s);case 9:s=t.sent;case 10:return l=h("q",i,"parts"),t.t0=this.utils,t.t1=this.HttpClient,t.next=15,this.authClient.AuthorizationHeader({libraryId:r,objectId:n,update:!0,encryption:u});case 15:return t.t2=t.sent,t.t3=h(l,a),t.t4=s,t.t5={headers:t.t2,method:"POST",path:t.t3,body:t.t4,bodyType:"BINARY",failover:!1},t.t6=t.t1.Request.call(t.t1,t.t5),t.next=22,t.t0.ResponseToJson.call(t.t0,t.t6);case 22:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.FinalizePart=function(){var t=a(o.mark((function t(e){var r,n,i,a,s,u;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,n=e.objectId,i=e.writeToken,a=e.partWriteToken,s=e.encryption,m({libraryId:r,objectId:n}),p(i),u=h("q",i,"parts"),t.t0=this.utils,t.t1=this.HttpClient,t.next=8,this.authClient.AuthorizationHeader({libraryId:r,objectId:n,update:!0,encryption:s});case 8:return t.t2=t.sent,t.t3=h(u,a),t.t4={headers:t.t2,method:"POST",path:t.t3,bodyType:"BINARY",body:"",failover:!1},t.next=13,t.t1.Request.call(t.t1,t.t4);case 13:return t.t5=t.sent,t.next=16,t.t0.ResponseToJson.call(t.t0,t.t5);case 16:return t.abrupt("return",t.sent);case 17:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.UploadPart=function(){var t=a(o.mark((function t(e){var r,n,i,a,s,u,c,l,h,f,d,y,v;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,n=e.objectId,i=e.writeToken,a=e.data,s=e.encryption,u=void 0===s?"none":s,c=e.chunkSize,l=void 0===c?1e7:c,h=e.callback,m({libraryId:r,objectId:n}),p(i),t.next=5,this.CreatePart({libraryId:r,objectId:n,writeToken:i,encryption:u});case 5:f=t.sent,d=a.length||a.byteLength||a.size,h&&h({bytesFinished:0,bytesTotal:d}),y=0;case 9:if(!(y<d)){t.next=17;break}return v=a.slice(y,y+l),t.next=13,this.UploadPartChunk({libraryId:r,objectId:n,writeToken:i,partWriteToken:f,chunk:v,encryption:u});case 13:h&&h({bytesFinished:Math.min(y+l,d),bytesTotal:d});case 14:y+=l,t.next=9;break;case 17:return t.next=19,this.FinalizePart({libraryId:r,objectId:n,writeToken:i,partWriteToken:f,encryption:u});case 19:return t.abrupt("return",t.sent);case 20:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.DeletePart=function(){var t=a(o.mark((function t(e){var r,n,i,a,s;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.libraryId,n=e.objectId,i=e.writeToken,a=e.partHash,m({libraryId:r,objectId:n}),p(i),y(a),s=h("q",i,"parts",a),t.t0=this.HttpClient,t.next=8,this.authClient.AuthorizationHeader({libraryId:r,objectId:n,update:!0});case 8:return t.t1=t.sent,t.t2=s,t.t3={headers:t.t1,method:"DELETE",path:t.t2,failover:!1},t.next=13,t.t0.Request.call(t.t0,t.t3);case 13:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()}).call(this,r(5),r(8).Buffer)},function(t,e){}])}));