Socket
Socket
Sign inDemoInstall

wargamer

Package Overview
Dependencies
40
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.3.1 to 0.4.0

lib/modules/mixins/encyclopediaSearch.js

15

CHANGELOG.md

@@ -8,2 +8,14 @@ # Change Log

## [Unreleased]
## [0.4.0] - 2017-01-29
### Added
- Encyclopedia modules for World of Tanks Blitz, World of Tanks Console, World of Warplanes and World of Warships.
- `findVehicleProfile()` method for World of Tanks module.
### Changed
- Removed `options` parameter from module convenience methods.
### Fixed
- Issue with request rejection handler not handling certain types of errors.
## [0.3.1] - 2017-01-22

@@ -68,3 +80,4 @@ No changes from previous release. Just a patch for npm.

[Unreleased]: https://github.com/hkwu/wargamer/compare/v0.3.1...HEAD
[Unreleased]: https://github.com/hkwu/wargamer/compare/v0.4.0...HEAD
[0.4.0]: https://github.com/hkwu/wargamer/compare/v0.3.1...v0.4.0
[0.3.1]: https://github.com/hkwu/wargamer/compare/v0.3.0...v0.3.1

@@ -71,0 +84,0 @@ [0.3.0]: https://github.com/hkwu/wargamer/compare/v0.2.1...v0.3.0

4

dist/wargamer.min.js

@@ -24,4 +24,4 @@ /*!

*/
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("Wargamer",[],e):"object"==typeof exports?exports.Wargamer=e():t.Wargamer=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=31)}([function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},a=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),u=n(26),c=r(u),l=n(14),f=r(l),h=n(19),p=r(h),d=n(17),y=r(d),b=n(11),v=r(b),_=n(9),m=r(_),w=n(20),g=r(w),O=n(21),k=r(O),j=n(22),T=r(j),P={ru:"ru",eu:"eu",na:"com",kr:"kr",asia:"asia",xbox:"xbox",ps4:"ps4"},x={wot:function(t){return"https://api.worldoftanks."+P[t]+"/wot"},wotb:function(t){return"https://api.wotblitz."+P[t]+"/wotb"},wotx:function(t){return"https://api-"+P[t]+"-console.worldoftanks.com/wotx"},wows:function(t){return"https://api.worldofwarships."+P[t]+"/wows"},wowp:function(t){return"https://api.worldofwarplanes."+P[t]+"/wowp"},wgn:function(t){return"https://api.worldoftanks."+P[t]+"/wgn"}},E=function(t,e){if(!P[t]||!x[e])throw new Error("Unknown realm or type given.");return x[e](t)},M=function(){function t(e){i(this,t);var n=e.type,r=e.realm,o=e.applicationId,s=e.accessToken,a=void 0===s?null:s,u=e.language,c=void 0===u?null:u,l=e.cacheTimeToLive,f=void 0===l?6e5:l;if("string"!=typeof r||!P[r.toLowerCase()])throw new TypeError("Must specify a valid realm for the client.");if("string"!=typeof o)throw new TypeError("Must specify an application ID for the client.");var h=r.toLowerCase();this.type=n,this.realm=h,this.applicationId=o,this.accessToken=a,this.language=c,this.authentication=new y.default(this),this.baseUri=E(h,n),this.cache=new v.default({timeToLive:f})}return a(t,[{key:"get",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.request(t,e,s({},n,{method:"GET"}))}},{key:"post",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.request(t,e,s({},n,{method:"POST"}))}},{key:"request",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(function(i){var a=r.type,u=void 0===a?e.type:a,l=r.realm,h=void 0===l?e.realm:l,d=r.method,y=void 0===d?"GET":d;if("string"!=typeof t)throw new TypeError("Expected API method to be a string.");var b=t.toLowerCase(),v=h.toLowerCase(),_=v===e.realm?e.baseUri:E(v,u),w=_+"/"+b.replace(/^\/*(.+?)\/*$/,"$1")+"/",O=s({application_id:e.applicationId,access_token:e.accessToken,language:e.language},n),j=(0,k.default)(O,e.constructor.normalizeParameterValue),P=(j.application_id,o(j,["application_id"])),x=(0,g.default)(""+w+JSON.stringify((0,T.default)(P))),M=function(t){var n=t.body.error,r=void 0===n?null:n;if(r)throw new f.default({client:e,statusCode:t.status,method:b,error:r});return new p.default({client:e,requestRealm:v,method:b,body:t.body})},S=function(t){if(t instanceof f.default)throw t;var n=t.response,r=n.error,o=n.req;throw new m.default({message:t.body.error.message,client:e,statusCode:r.status,url:o.url})};if("GET"===y){var A=e.cache.get(x);if(A){var C=new p.default({client:e,requestRealm:v,method:b,body:A});i(C)}var L=c.default.get(w).query(j).then(M).then(function(t){return e.cache.set(x,t.body),t}).catch(S);i(L)}else if("POST"===y){var R=c.default.post(w).type("form").send(j).then(M).catch(S);i(R)}throw new Error("Received invalid request method.")})}}],[{key:"normalizeParameterValue",value:function(t){return Array.isArray(t)?t.join(","):t instanceof Date?t.toISOString():t}}]),t}();e.default=M},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=function t(e,n){r(this,t),this.client=e,this.name=n};e.default=o},function(t,e){function n(t){return null!==t&&"object"==typeof t}t.exports=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},u=n(0),c=r(u),l=function(t){function e(t){return o(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,a({},t,{type:"wgn"})))}return s(e,t),e}(c.default);e.default=l},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},u=n(15),c=r(u),l=n(0),f=r(l),h=n(16),p=r(h),d=function(t){function e(t){o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,a({},t,{type:"wot"})));return n.accounts=new c.default(n),n.tankopedia=new p.default(n),n}return s(e,t),e}(f.default);e.default=d},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},u=n(0),c=r(u),l=function(t){function e(t){return o(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,a({},t,{type:"wotb"})))}return s(e,t),e}(c.default);e.default=l},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},u=n(0),c=r(u),l=function(t){function e(t){return o(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,a({},t,{type:"wotx"})))}return s(e,t),e}(c.default);e.default=l},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},u=n(0),c=r(u),l=function(t){function e(t){return o(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,a({},t,{type:"wowp"})))}return s(e,t),e}(c.default);e.default=l},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},u=n(0),c=r(u),l=function(t){function e(t){return o(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,a({},t,{type:"wows"})))}return s(e,t),e}(c.default);e.default=l},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var a=n(24),u=r(a),c=function(t){function e(t){var n=t.message,r=t.client,s=t.statusCode,a=t.url;o(this,e);var u=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,n));return u.client=r,u.statusCode=s,u.url=a,u}return s(e,t),e}(u.default);e.default=c},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),s=n(4),a=r(s),u=n(5),c=r(u),l=n(6),f=r(l),h=n(8),p=r(h),d=n(7),y=r(d),b=n(3),v=r(b),_=function(){function t(){o(this,t)}return i(t,null,[{key:"WoT",value:function(t){return new a.default(t)}},{key:"WoTB",value:function(t){return new c.default(t)}},{key:"WoTX",value:function(t){return new f.default(t)}},{key:"WoWS",value:function(t){return new p.default(t)}},{key:"WoWP",value:function(t){return new y.default(t)}},{key:"WGN",value:function(t){return new v.default(t)}}]),t}();e.default=_},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},a=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),u=n(12),c=r(u),l=n(13),f=r(l),h=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,t);var n=e.timeToLive,r=void 0===n?null:n;this.entryTimeToLive=r,this.meta=new f.default,this.store=new Map}return a(t,[{key:"get",value:function(t){var e=this.store.get(t);return e?e.expired?void this.meta.expire():(this.meta.hit(),e.touch(),e.value):void this.meta.miss()}},{key:"set",value:function(t,e){var n=new c.default({value:e,timeToLive:this.entryTimeToLive});return this.store.set(t,n),this}},{key:"delete",value:function(t){return this.store.delete(t),this}},{key:"clear",value:function(){return this.store.clear(),this.meta.clear(),this}},{key:"size",get:function(){return this.store.size}},{key:"keys",get:function(){return[].concat(o(this.store.keys()))}},{key:"empty",get:function(){return 0===this.size}},{key:"statistics",get:function(){return s({},this.meta.serialize(),{size:this.size})}}]),t}();e.default=h},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),i=function(){function t(e){r(this,t);var n=e.value,o=e.timeToLive,i=void 0===o?null:o;this.value=n,this.entryTimeToLive=i,this.createdAt=new Date,this.accessedAt=null}return o(t,[{key:"touch",value:function(){this.accessedAt=new Date}},{key:"expired",get:function(){if(!this.entryTimeToLive)return!1;var t=new Date,e=this.createdAt;return t.getTime()-e.getTime()>=this.entryTimeToLive}}]),t}();e.default=i},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),i=function(){function t(){r(this,t),this.createdAt=new Date,this.accessedAt=null,this.updatedAt=null,this.clearedAt=null,this.hits=0,this.misses=0,this.expired=0}return o(t,[{key:"hit",value:function(){return this.accessedAt=new Date,this.hits+=1,this}},{key:"miss",value:function(){return this.accessedAt=new Date,this.misses+=1,this}},{key:"expire",value:function(){return this.expired+=1,this}},{key:"clear",value:function(){var t=new Date;return this.updatedAt=t,this.clearedAt=t,this.hits=0,this.misses=0,this.expired=0,this}},{key:"serialize",value:function(){return{createdAt:this.createdAt,accessedAt:this.accessedAt,updatedAt:this.updatedAt,clearedAt:this.clearedAt,hits:this.hits,misses:this.misses,expired:this.expired}}}]),t}();e.default=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},c=n(9),l=r(c),f=function(t){function e(t){var n=t.requestRealm,r=t.method,a=t.error,c=o(t,["requestRealm","method","error"]);i(this,e);var l=a.code,f=a.message,h=a.field,p=a.value,d=s(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,u({},c,{message:l+": "+f+". Error field: "+h+" => "+p+"."})));return d.requestRealm=n,d.method=r,d.code=l,d.apiMessage=f,d.field=h,d.value=p,d}return a(e,t),e}(l.default);e.default=f},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),u=n(1),c=r(u),l=function(t){function e(t){return o(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,"accounts"))}return s(e,t),a(e,[{key:"findPlayerId",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"exact",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(function(o){switch(n.toLowerCase()){case"startswith":return o(e.client.get("account/list",{search:t},r).then(function(t){return t.data}));case"exact":return o(e.client.get("account/list",{search:t},r).then(function(t){return t.data[0]?t.data[0].account_id:null}));default:throw new Error("Invalid search type specified for player search.")}})}}]),e}(c.default);e.default=l},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var u=function(){function t(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var s,a=t[Symbol.iterator]();!(r=(s=a.next()).done)&&(n.push(s.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{!r&&a.return&&a.return()}finally{if(o)throw i}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),c=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=n(25),f=r(l),h=n(1),p=r(h),d=n(18),y=r(d),b=function(t){function e(t){i(this,e);var n=s(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,"tankopedia"));return n.fuse=new f.default([],{keys:["name","short_name"]}),n}return a(e,t),c(e,[{key:"findVehicle",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(r){throw"number"==typeof t?r(e.client.get("encyclopedia/vehicles",{tank_id:t},n).then(function(e){return e.data[t]})):"string"==typeof t&&r(e.client.get("encyclopedia/vehicles",{fields:["name","short_name","tank_id"]},n).then(function(r){var i=r.data;e.fuse.set(Object.keys(i).reduce(function(t,e){return[].concat(o(t),[i[e]])},[]));var s=e.fuse.search(t);if(!s.length)return null;var a=u(s,1),c=a[0].tank_id;return e.client.get("encyclopedia/vehicles",{tank_id:c},n).then(function(t){return t.data[c]})})),new TypeError("Expected a string or number as the vehicle identifier.")})}},{key:"localizeCrewRole",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return y.default.call(this,{method:"encyclopedia/info",type:"vehicle_crew_roles",slug:t,options:e})}},{key:"localizeLanguage",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return y.default.call(this,{method:"encyclopedia/info",type:"languages",slug:t,options:e})}},{key:"localizeAchievementSection",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return y.default.call(this,{method:"encyclopedia/info",type:"achievement_sections",slug:t,options:e}).then(function(t){return t&&t.name})}},{key:"localizeVehicleType",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return y.default.call(this,{method:"encyclopedia/info",type:"vehicle_types",slug:t,options:e})}},{key:"localizeVehicleNation",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return y.default.call(this,{method:"encyclopedia/info",type:"vehicle_nations",slug:t,options:e})}}]),e}(p.default);e.default=b},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},u=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),c=n(1),l=r(c),f=function(t){function e(t){return o(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,"authentication"))}return s(e,t),u(e,[{key:"renewAccessToken",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Promise(function(n){if(!t.client.accessToken)throw new Error("Failed to renew access token: client's access token is not set.");n(t.client.post("auth/prolongate",{},a({},e,{type:"wotx"===t.client.type?"wotx":"wot"})).then(function(e){return t.client.accessToken=e.data.access_token,e}))})}},{key:"destroyAccessToken",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Promise(function(n){if(!t.client.accessToken)throw new Error("Failed to invalidate access token: client's access token is not set.");n(t.client.post("auth/logout",{},a({},e,{type:"wotx"===t.client.type?"wotx":"wot"})).then(function(e){return t.client.accessToken=null,e}))})}}]),e}(l.default);e.default=f},function(t,e,n){"use strict";function r(t){var e=t.method,n=t.type,r=t.slug,i=t.options,s=void 0===i?{}:i;return this.client.get(e,{},s).then(function(t){var e=t.data[n];if(!e||"object"!==("undefined"==typeof e?"undefined":o(e)))throw new Error("Invalid translation type: "+n+".");return e[r]})}Object.defineProperty(e,"__esModule",{value:!0});var 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};e.default=r},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),i=function(){function t(e){var n=e.client,o=e.requestRealm,i=e.method,s=e.body;r(this,t),this.client=n,this.requestRealm=o,this.method=i,this.body=s}return o(t,[{key:"meta",get:function(){return this.body.meta}},{key:"data",get:function(){return this.body.data}}]),t}();e.default=i},function(t,e,n){"use strict";function r(t){var e=0;if(!t.length)return e.toString();for(var n=0;n<t.length;++n){var r=t.charCodeAt(n);e=(e<<5)-e+r,e&=e}return e.toString()}Object.defineProperty(e,"__esModule",{value:!0}),e.default=r},function(t,e,n){"use strict";function r(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(t){return t},n=Object.keys(t);return n.reduce(function(n,r){return n[r]=e(t[r],r,t),n},{})}Object.defineProperty(e,"__esModule",{value:!0}),e.default=r},function(t,e,n){"use strict";function r(t){return Object.keys(t).sort().reduce(function(e,n){return e[n]=t[n],e},{})}Object.defineProperty(e,"__esModule",{value:!0}),e.default=r},function(t,e,n){function r(t){if(t)return o(t)}function o(t){for(var e in r.prototype)t[e]=r.prototype[e];return t}t.exports=r,r.prototype.on=r.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},r.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var r,o=0;o<n.length;o++)if(r=n[o],r===e||r.fn===e){n.splice(o,1);break}return this},r.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),n=this._callbacks["$"+t];if(n){n=n.slice(0);for(var r=0,o=n.length;r<o;++r)n[r].apply(this,e)}return this},r.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},r.prototype.hasListeners=function(t){return!!this.listeners(t).length}},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function s(t){function e(){t.apply(this,arguments)}return e.prototype=Object.create(t.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t,e}Object.defineProperty(e,"__esModule",{value:!0});var a=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";r(this,e);var n=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return Object.defineProperty(n,"message",{configurable:!0,enumerable:!1,value:t,writable:!0}),Object.defineProperty(n,"name",{configurable:!0,enumerable:!1,value:n.constructor.name,writable:!0}),Error.hasOwnProperty("captureStackTrace")?(Error.captureStackTrace(n,n.constructor),o(n)):(Object.defineProperty(n,"stack",{configurable:!0,enumerable:!1,value:new Error(t).stack,writable:!0}),n)}return i(e,t),e}(s(Error));e.default=a,t.exports=e.default},function(t,e,n){!function(e){"use strict";function n(){console.log.apply(console,arguments)}function r(t,e){var n;this.list=t,this.options=e=e||{};for(n in a)a.hasOwnProperty(n)&&("boolean"==typeof a[n]?this.options[n]=n in e?e[n]:a[n]:this.options[n]=e[n]||a[n])}function o(t,e,n){var r,s,a,u,c,l;if(e){if(a=e.indexOf("."),a!==-1?(r=e.slice(0,a),s=e.slice(a+1)):r=e,u=t[r],null!==u&&void 0!==u)if(s||"string"!=typeof u&&"number"!=typeof u)if(i(u))for(c=0,l=u.length;c<l;c++)o(u[c],s,n);else s&&o(u,s,n);else n.push(u)}else n.push(t);return n}function i(t){return"[object Array]"===Object.prototype.toString.call(t)}function s(t,e){e=e||{},this.options=e,this.options.location=e.location||s.defaultOptions.location,this.options.distance="distance"in e?e.distance:s.defaultOptions.distance,this.options.threshold="threshold"in e?e.threshold:s.defaultOptions.threshold,this.options.maxPatternLength=e.maxPatternLength||s.defaultOptions.maxPatternLength,this.pattern=e.caseSensitive?t:t.toLowerCase(),this.patternLen=t.length,this.patternLen<=this.options.maxPatternLength&&(this.matchmask=1<<this.patternLen-1,this.patternAlphabet=this._calculatePatternAlphabet())}var a={id:null,caseSensitive:!1,include:[],shouldSort:!0,searchFn:s,sortFn:function(t,e){return t.score-e.score},getFn:o,keys:[],verbose:!1,tokenize:!1,matchAllTokens:!1,tokenSeparator:/ +/g,minMatchCharLength:1,findAllMatches:!1};r.VERSION="2.6.0",r.prototype.set=function(t){
return this.list=t,t},r.prototype.search=function(t){this.options.verbose&&n("\nSearch term:",t,"\n"),this.pattern=t,this.results=[],this.resultMap={},this._keyMap=null,this._prepareSearchers(),this._startSearch(),this._computeScore(),this._sort();var e=this._format();return e},r.prototype._prepareSearchers=function(){var t=this.options,e=this.pattern,n=t.searchFn,r=e.split(t.tokenSeparator),o=0,i=r.length;if(this.options.tokenize)for(this.tokenSearchers=[];o<i;o++)this.tokenSearchers.push(new n(r[o],t));this.fullSeacher=new n(e,t)},r.prototype._startSearch=function(){var t,e,n,r,o=this.options,i=o.getFn,s=this.list,a=s.length,u=this.options.keys,c=u.length,l=null;if("string"==typeof s[0])for(n=0;n<a;n++)this._analyze("",s[n],n,n);else for(this._keyMap={},n=0;n<a;n++)for(l=s[n],r=0;r<c;r++){if(t=u[r],"string"!=typeof t){if(e=1-t.weight||1,this._keyMap[t.name]={weight:e},t.weight<=0||t.weight>1)throw new Error("Key weight has to be > 0 and <= 1");t=t.name}else this._keyMap[t]={weight:1};this._analyze(t,i(l,t,[]),l,n)}},r.prototype._analyze=function(t,e,r,o){var s,a,u,c,l,f,h,p,d,y,b,v,_,m,w,g=this.options,O=!1;if(void 0!==e&&null!==e){a=[];var k=0;if("string"==typeof e){if(s=e.split(g.tokenSeparator),g.verbose&&n("---------\nKey:",t),this.options.tokenize){for(m=0;m<this.tokenSearchers.length;m++){for(p=this.tokenSearchers[m],g.verbose&&n("Pattern:",p.pattern),d=[],v=!1,w=0;w<s.length;w++){y=s[w],b=p.search(y);var j={};b.isMatch?(j[y]=b.score,O=!0,v=!0,a.push(b.score)):(j[y]=1,this.options.matchAllTokens||a.push(1)),d.push(j)}v&&k++,g.verbose&&n("Token scores:",d)}for(c=a[0],f=a.length,m=1;m<f;m++)c+=a[m];c/=f,g.verbose&&n("Token score average:",c)}h=this.fullSeacher.search(e),g.verbose&&n("Full text score:",h.score),l=h.score,void 0!==c&&(l=(l+c)/2),g.verbose&&n("Score average:",l),_=!this.options.tokenize||!this.options.matchAllTokens||k>=this.tokenSearchers.length,g.verbose&&n("Check Matches",_),(O||h.isMatch)&&_&&(u=this.resultMap[o],u?u.output.push({key:t,score:l,matchedIndices:h.matchedIndices}):(this.resultMap[o]={item:r,output:[{key:t,score:l,matchedIndices:h.matchedIndices}]},this.results.push(this.resultMap[o])))}else if(i(e))for(m=0;m<e.length;m++)this._analyze(t,e[m],r,o)}},r.prototype._computeScore=function(){var t,e,r,o,i,s,a,u,c,l=this._keyMap,f=this.results;for(this.options.verbose&&n("\n\nComputing score:\n"),t=0;t<f.length;t++){for(r=0,o=f[t].output,i=o.length,u=1,e=0;e<i;e++)s=o[e].score,a=l?l[o[e].key].weight:1,c=s*a,1!==a?u=Math.min(u,c):(r+=c,o[e].nScore=c);1===u?f[t].score=r/i:f[t].score=u,this.options.verbose&&n(f[t])}},r.prototype._sort=function(){var t=this.options;t.shouldSort&&(t.verbose&&n("\n\nSorting...."),this.results.sort(t.sortFn))},r.prototype._format=function(){var t,e,r,o,i,s=this.options,a=s.getFn,u=[],c=this.results,l=s.include;for(s.verbose&&n("\n\nOutput:\n\n",c),o=s.id?function(t){c[t].item=a(c[t].item,s.id,[])[0]}:function(){},i=function(t){var e,n,r,o,i,s=c[t];if(l.length>0){if(e={item:s.item},l.indexOf("matches")!==-1)for(r=s.output,e.matches=[],n=0;n<r.length;n++)o=r[n],i={indices:o.matchedIndices},o.key&&(i.key=o.key),e.matches.push(i);l.indexOf("score")!==-1&&(e.score=c[t].score)}else e=s.item;return e},e=0,r=c.length;e<r;e++)o(e),t=i(e),u.push(t);return u},s.defaultOptions={location:0,distance:100,threshold:.6,maxPatternLength:32},s.prototype._calculatePatternAlphabet=function(){var t={},e=0;for(e=0;e<this.patternLen;e++)t[this.pattern.charAt(e)]=0;for(e=0;e<this.patternLen;e++)t[this.pattern.charAt(e)]|=1<<this.pattern.length-e-1;return t},s.prototype._bitapScore=function(t,e){var n=t/this.patternLen,r=Math.abs(this.options.location-e);return this.options.distance?n+r/this.options.distance:r?1:n},s.prototype.search=function(t){var e,n,r,o,i,s,a,u,c,l,f,h,p,d,y,b,v,_,m,w,g,O,k,j=this.options;if(t=j.caseSensitive?t:t.toLowerCase(),this.pattern===t)return{isMatch:!0,score:0,matchedIndices:[[0,t.length-1]]};if(this.patternLen>j.maxPatternLength){if(_=t.match(new RegExp(this.pattern.replace(j.tokenSeparator,"|"))),m=!!_)for(g=[],e=0,O=_.length;e<O;e++)k=_[e],g.push([t.indexOf(k),k.length-1]);return{isMatch:m,score:m?.5:1,matchedIndices:g}}for(o=j.findAllMatches,i=j.location,r=t.length,s=j.threshold,a=t.indexOf(this.pattern,i),w=[],e=0;e<r;e++)w[e]=0;for(a!=-1&&(s=Math.min(this._bitapScore(0,a),s),a=t.lastIndexOf(this.pattern,i+this.patternLen),a!=-1&&(s=Math.min(this._bitapScore(0,a),s))),a=-1,b=1,v=[],l=this.patternLen+r,e=0;e<this.patternLen;e++){for(u=0,c=l;u<c;)this._bitapScore(e,i+c)<=s?u=c:l=c,c=Math.floor((l-u)/2+u);for(l=c,f=Math.max(1,i-c+1),h=o?r:Math.min(i+c,r)+this.patternLen,p=Array(h+2),p[h+1]=(1<<e)-1,n=h;n>=f;n--)if(y=this.patternAlphabet[t.charAt(n-1)],y&&(w[n-1]=1),0===e?p[n]=(p[n+1]<<1|1)&y:p[n]=(p[n+1]<<1|1)&y|((d[n+1]|d[n])<<1|1)|d[n+1],p[n]&this.matchmask&&(b=this._bitapScore(e,n-1),b<=s)){if(s=b,a=n-1,v.push(a),!(a>i))break;f=Math.max(1,2*i-a)}if(this._bitapScore(e+1,i)>s)break;d=p}return g=this._getMatchedIndices(w),{isMatch:a>=0,score:0===b?.001:b,matchedIndices:g}},s.prototype._getMatchedIndices=function(t){for(var e,n=[],r=-1,o=-1,i=0,s=t.length;i<s;i++)e=t[i],e&&r===-1?r=i:e||r===-1||(o=i-1,o-r+1>=this.options.minMatchCharLength&&n.push([r,o]),r=-1);return t[i-1]&&i-1-r+1>=this.options.minMatchCharLength&&n.push([r,i-1]),n},t.exports=r}(this)},function(t,e,n){function r(){}function o(t){if(!y(t))return t;var e=[];for(var n in t)i(e,n,t[n]);return e.join("&")}function i(t,e,n){if(null!=n)if(Array.isArray(n))n.forEach(function(n){i(t,e,n)});else if(y(n))for(var r in n)i(t,e+"["+r+"]",n[r]);else t.push(encodeURIComponent(e)+"="+encodeURIComponent(n));else null===n&&t.push(encodeURIComponent(e))}function s(t){for(var e,n,r={},o=t.split("&"),i=0,s=o.length;i<s;++i)e=o[i],n=e.indexOf("="),n==-1?r[decodeURIComponent(e)]="":r[decodeURIComponent(e.slice(0,n))]=decodeURIComponent(e.slice(n+1));return r}function a(t){var e,n,r,o,i=t.split(/\r?\n/),s={};i.pop();for(var a=0,u=i.length;a<u;++a)n=i[a],e=n.indexOf(":"),r=n.slice(0,e).toLowerCase(),o=m(n.slice(e+1)),s[r]=o;return s}function u(t){return/[\/+]json\b/.test(t)}function c(t,e){e=e||{},this.req=t,this.xhr=this.req.xhr,this.text="HEAD"!=this.req.method&&(""===this.xhr.responseType||"text"===this.xhr.responseType)||"undefined"==typeof this.xhr.responseType?this.xhr.responseText:null,this.statusText=this.req.xhr.statusText;var n=this.xhr.status;1223===n&&(n=204),this._setStatusProperties(n),this.header=this.headers=a(this.xhr.getAllResponseHeaders()),this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this._setHeaderProperties(this.header),null===this.text&&t._responseType?this.body=this.xhr.response:this.body="HEAD"!=this.req.method?this._parseBody(this.text?this.text:this.xhr.response):null}function l(t,e){var n=this;this._query=this._query||[],this.method=t,this.url=e,this.header={},this._header={},this.on("end",function(){var t=null,e=null;try{e=new c(n)}catch(e){return t=new Error("Parser is unable to parse the response"),t.parse=!0,t.original=e,n.xhr?(t.rawResponse="undefined"==typeof n.xhr.responseType?n.xhr.responseText:n.xhr.response,t.status=n.xhr.status?n.xhr.status:null,t.statusCode=t.status):(t.rawResponse=null,t.status=null),n.callback(t)}n.emit("response",e);var r;try{n._isResponseOK(e)||(r=new Error(e.statusText||"Unsuccessful HTTP response"),r.original=t,r.response=e,r.status=e.status)}catch(t){r=t}r?n.callback(r,e):n.callback(null,e)})}function f(t,e){var n=_("DELETE",t);return e&&n.end(e),n}var h;"undefined"!=typeof window?h=window:"undefined"!=typeof self?h=self:(console.warn("Using browser-only version of superagent in non-browser environment"),h=this);var p=n(23),d=n(28),y=n(2),b=n(27),v=n(29),_=e=t.exports=function(t,n){return"function"==typeof n?new e.Request("GET",t).end(n):1==arguments.length?new e.Request("GET",t):new e.Request(t,n)};e.Request=l,_.getXHR=function(){if(!(!h.XMLHttpRequest||h.location&&"file:"==h.location.protocol&&h.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(t){}throw Error("Browser-only verison of superagent could not find XHR")};var m="".trim?function(t){return t.trim()}:function(t){return t.replace(/(^\s*|\s*$)/g,"")};_.serializeObject=o,_.parseString=s,_.types={html:"text/html",json:"application/json",xml:"application/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},_.serialize={"application/x-www-form-urlencoded":o,"application/json":JSON.stringify},_.parse={"application/x-www-form-urlencoded":s,"application/json":JSON.parse},v(c.prototype),c.prototype._parseBody=function(t){var e=_.parse[this.type];return this.req._parser?this.req._parser(this,t):(!e&&u(this.type)&&(e=_.parse["application/json"]),e&&t&&(t.length||t instanceof Object)?e(t):null)},c.prototype.toError=function(){var t=this.req,e=t.method,n=t.url,r="cannot "+e+" "+n+" ("+this.status+")",o=new Error(r);return o.status=this.status,o.method=e,o.url=n,o},_.Response=c,p(l.prototype),d(l.prototype),l.prototype.type=function(t){return this.set("Content-Type",_.types[t]||t),this},l.prototype.accept=function(t){return this.set("Accept",_.types[t]||t),this},l.prototype.auth=function(t,e,n){switch(n||(n={type:"function"==typeof btoa?"basic":"auto"}),n.type){case"basic":this.set("Authorization","Basic "+btoa(t+":"+e));break;case"auto":this.username=t,this.password=e}return this},l.prototype.query=function(t){return"string"!=typeof t&&(t=o(t)),t&&this._query.push(t),this},l.prototype.attach=function(t,e,n){if(this._data)throw Error("superagent can't mix .send() and .attach()");return this._getFormData().append(t,e,n||e.name),this},l.prototype._getFormData=function(){return this._formData||(this._formData=new h.FormData),this._formData},l.prototype.callback=function(t,e){var n=this._callback;this.clearTimeout(),t&&this.emit("error",t),n(t,e)},l.prototype.crossDomainError=function(){var t=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");t.crossDomain=!0,t.status=this.status,t.method=this.method,t.url=this.url,this.callback(t)},l.prototype.buffer=l.prototype.ca=l.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},l.prototype.pipe=l.prototype.write=function(){throw Error("Streaming is not supported in browser version of superagent")},l.prototype._appendQueryString=function(){var t=this._query.join("&");if(t&&(this.url+=(this.url.indexOf("?")>=0?"&":"?")+t),this._sort){var e=this.url.indexOf("?");if(e>=0){var n=this.url.substring(e+1).split("&");b(this._sort)?n.sort(this._sort):n.sort(),this.url=this.url.substring(0,e)+"?"+n.join("&")}}},l.prototype._isHost=function(t){return t&&"object"==typeof t&&!Array.isArray(t)&&"[object Object]"!==Object.prototype.toString.call(t)},l.prototype.end=function(t){var e=this,n=this.xhr=_.getXHR(),o=this._formData||this._data;this._endCalled&&console.warn("Warning: .end() was called twice. This is not supported in superagent"),this._endCalled=!0,this._callback=t||r,n.onreadystatechange=function(){var t=n.readyState;if(t>=2&&e._responseTimeoutTimer&&clearTimeout(e._responseTimeoutTimer),4==t){var r;try{r=n.status}catch(t){r=0}if(!r){if(e.timedout||e._aborted)return;return e.crossDomainError()}e.emit("end")}};var i=function(t,n){n.total>0&&(n.percent=n.loaded/n.total*100),n.direction=t,e.emit("progress",n)};if(this.hasListeners("progress"))try{n.onprogress=i.bind(null,"download"),n.upload&&(n.upload.onprogress=i.bind(null,"upload"))}catch(t){}this._appendQueryString(),this._setTimeouts();try{this.username&&this.password?n.open(this.method,this.url,!0,this.username,this.password):n.open(this.method,this.url,!0)}catch(t){return this.callback(t)}if(this._withCredentials&&(n.withCredentials=!0),!this._formData&&"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof o&&!this._isHost(o)){var s=this._header["content-type"],a=this._serializer||_.serialize[s?s.split(";")[0]:""];!a&&u(s)&&(a=_.serialize["application/json"]),a&&(o=a(o))}for(var c in this.header)null!=this.header[c]&&n.setRequestHeader(c,this.header[c]);return this._responseType&&(n.responseType=this._responseType),this.emit("request",this),n.send("undefined"!=typeof o?o:null),this},_.get=function(t,e,n){var r=_("GET",t);return"function"==typeof e&&(n=e,e=null),e&&r.query(e),n&&r.end(n),r},_.head=function(t,e,n){var r=_("HEAD",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},_.options=function(t,e,n){var r=_("OPTIONS",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},_.del=f,_.delete=f,_.patch=function(t,e,n){var r=_("PATCH",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},_.post=function(t,e,n){var r=_("POST",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},_.put=function(t,e,n){var r=_("PUT",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r}},function(t,e,n){function r(t){var e=o(t)?Object.prototype.toString.call(t):"";return"[object Function]"===e}var o=n(2);t.exports=r},function(t,e,n){function r(t){if(t)return o(t)}function o(t){for(var e in r.prototype)t[e]=r.prototype[e];return t}var i=n(2);t.exports=r,r.prototype.clearTimeout=function(){return this._timeout=0,this._responseTimeout=0,clearTimeout(this._timer),clearTimeout(this._responseTimeoutTimer),this},r.prototype.parse=function(t){return this._parser=t,this},r.prototype.responseType=function(t){return this._responseType=t,this},r.prototype.serialize=function(t){return this._serializer=t,this},r.prototype.timeout=function(t){return t&&"object"==typeof t?("undefined"!=typeof t.deadline&&(this._timeout=t.deadline),"undefined"!=typeof t.response&&(this._responseTimeout=t.response),this):(this._timeout=t,this._responseTimeout=0,this)},r.prototype.then=function(t,e){if(!this._fullfilledPromise){var n=this;this._endCalled&&console.warn("Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises"),this._fullfilledPromise=new Promise(function(t,e){n.end(function(n,r){n?e(n):t(r)})})}return this._fullfilledPromise.then(t,e)},r.prototype.catch=function(t){return this.then(void 0,t)},r.prototype.use=function(t){return t(this),this},r.prototype.ok=function(t){if("function"!=typeof t)throw Error("Callback required");return this._okCallback=t,this},r.prototype._isResponseOK=function(t){return!!t&&(this._okCallback?this._okCallback(t):t.status>=200&&t.status<300)},r.prototype.get=function(t){return this._header[t.toLowerCase()]},r.prototype.getHeader=r.prototype.get,r.prototype.set=function(t,e){if(i(t)){for(var n in t)this.set(n,t[n]);return this}return this._header[t.toLowerCase()]=e,this.header[t]=e,this},r.prototype.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},r.prototype.field=function(t,e){if(null===t||void 0===t)throw new Error(".field(name, val) name can not be empty");if(this._data&&console.error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()"),i(t)){for(var n in t)this.field(n,t[n]);return this}if(Array.isArray(e)){for(var r in e)this.field(t,e[r]);return this}if(null===e||void 0===e)throw new Error(".field(name, val) val can not be empty");return"boolean"==typeof e&&(e=""+e),this._getFormData().append(t,e),this},r.prototype.abort=function(){return this._aborted?this:(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort"),this)},r.prototype.withCredentials=function(){return this._withCredentials=!0,this},r.prototype.redirects=function(t){return this._maxRedirects=t,this},r.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},r.prototype.send=function(t){var e=i(t),n=this._header["content-type"];if(this._formData&&console.error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()"),e&&!this._data)Array.isArray(t)?this._data=[]:this._isHost(t)||(this._data={});else if(t&&this._data&&this._isHost(this._data))throw Error("Can't merge these send calls");if(e&&i(this._data))for(var r in t)this._data[r]=t[r];else"string"==typeof t?(n||this.type("form"),n=this._header["content-type"],"application/x-www-form-urlencoded"==n?this._data=this._data?this._data+"&"+t:t:this._data=(this._data||"")+t):this._data=t;return!e||this._isHost(t)?this:(n||this.type("json"),this)},r.prototype.sortQuery=function(t){return this._sort="undefined"==typeof t||t,this},r.prototype._timeoutError=function(t,e){if(!this._aborted){var n=new Error(t+e+"ms exceeded");n.timeout=e,n.code="ECONNABORTED",this.timedout=!0,this.abort(),this.callback(n)}},r.prototype._setTimeouts=function(){var t=this;this._timeout&&!this._timer&&(this._timer=setTimeout(function(){t._timeoutError("Timeout of ",t._timeout)},this._timeout)),this._responseTimeout&&!this._responseTimeoutTimer&&(this._responseTimeoutTimer=setTimeout(function(){t._timeoutError("Response timeout of ",t._responseTimeout)},this._responseTimeout))}},function(t,e,n){function r(t){if(t)return o(t)}function o(t){for(var e in r.prototype)t[e]=r.prototype[e];return t}var i=n(30);t.exports=r,r.prototype.get=function(t){return this.header[t.toLowerCase()]},r.prototype._setHeaderProperties=function(t){var e=t["content-type"]||"";this.type=i.type(e);var n=i.params(e);for(var r in n)this[r]=n[r];this.links={};try{t.link&&(this.links=i.parseLinks(t.link))}catch(t){}},r.prototype._setStatusProperties=function(t){var e=t/100|0;this.status=this.statusCode=t,this.statusType=e,this.info=1==e,this.ok=2==e,this.redirect=3==e,this.clientError=4==e,this.serverError=5==e,this.error=(4==e||5==e)&&this.toError(),this.accepted=202==t,this.noContent=204==t,this.badRequest=400==t,this.unauthorized=401==t,this.notAcceptable=406==t,this.forbidden=403==t,this.notFound=404==t}},function(t,e){e.type=function(t){return t.split(/ *; */).shift()},e.params=function(t){return t.split(/ *; */).reduce(function(t,e){var n=e.split(/ *= */),r=n.shift(),o=n.shift();return r&&o&&(t[r]=o),t},{})},e.parseLinks=function(t){return t.split(/ *, */).reduce(function(t,e){var n=e.split(/ *; */),r=n[0].slice(1,-1),o=n[1].split(/ *= */)[1].slice(1,-1);return t[o]=r,t},{})},e.cleanHeader=function(t,e){return delete t["content-type"],delete t["content-length"],delete t["transfer-encoding"],delete t.host,e&&delete t.cookie,t}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.Wargaming=e.WorldOfWarplanes=e.WorldOfWarships=e.WorldOfTanksConsole=e.WorldOfTanksBlitz=e.WorldOfTanks=void 0;var o=n(10),i=r(o),s=n(4),a=r(s),u=n(5),c=r(u),l=n(6),f=r(l),h=n(8),p=r(h),d=n(7),y=r(d),b=n(3),v=r(b);e.WorldOfTanks=a.default,e.WorldOfTanksBlitz=c.default,e.WorldOfTanksConsole=f.default,e.WorldOfWarships=p.default,e.WorldOfWarplanes=y.default,e.Wargaming=v.default,e.default=i.default}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("Wargamer",[],t):"object"==typeof exports?exports.Wargamer=t():e.Wargamer=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=38)}([function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function e(t,n){r(this,e),this.client=t,this.name=n};t.default=o},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(32),c=r(u),l=n(17),f=r(l),p=n(26),h=r(p),d=n(24),y=r(d),b=n(14),v=r(b),_=n(12),m=r(_),w=n(27),g=r(w),O=n(28),k=r(O),j=n(29),T=r(j),P={ru:"ru",eu:"eu",na:"com",kr:"kr",asia:"asia",xbox:"xbox",ps4:"ps4"},E={wot:function(e){return"https://api.worldoftanks."+P[e]+"/wot"},wotb:function(e){return"https://api.wotblitz."+P[e]+"/wotb"},wotx:function(e){return"https://api-"+P[e]+"-console.worldoftanks.com/wotx"},wows:function(e){return"https://api.worldofwarships."+P[e]+"/wows"},wowp:function(e){return"https://api.worldofwarplanes."+P[e]+"/wowp"},wgn:function(e){return"https://api.worldoftanks."+P[e]+"/wgn"}},x=function(e,t){if(!P[e]||!E[t])throw new Error("Unknown realm or type given.");return E[t](e)},M=function(){function e(t){i(this,e);var n=t.type,r=t.realm,o=t.applicationId,s=t.accessToken,a=void 0===s?null:s,u=t.language,c=void 0===u?null:u,l=t.cacheTimeToLive,f=void 0===l?6e5:l;if("string"!=typeof r||!P[r.toLowerCase()])throw new TypeError("Must specify a valid realm for the client.");if("string"!=typeof o)throw new TypeError("Must specify an application ID for the client.");var p=r.toLowerCase();this.type=n,this.realm=p,this.applicationId=o,this.accessToken=a,this.language=c,this.authentication=new y.default(this),this.baseUri=x(p,n),this.cache=new v.default({timeToLive:f})}return a(e,[{key:"get",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.request(e,t,s({},n,{method:"GET"}))}},{key:"post",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.request(e,t,s({},n,{method:"POST"}))}},{key:"request",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(function(i){var a=r.type,u=void 0===a?t.type:a,l=r.realm,p=void 0===l?t.realm:l,d=r.method,y=void 0===d?"GET":d;if("string"!=typeof e)throw new TypeError("Expected API method to be a string.");var b=e.toLowerCase(),v=p.toLowerCase(),_=v===t.realm?t.baseUri:x(v,u),w=_+"/"+b.replace(/^\/*(.+?)\/*$/,"$1")+"/",O=s({application_id:t.applicationId,access_token:t.accessToken,language:t.language},n),j=(0,k.default)(O,t.constructor.normalizeParameterValue),P=(j.application_id,o(j,["application_id"])),E=(0,g.default)(""+w+JSON.stringify((0,T.default)(P))),M=function(e){var n=e.body.error,r=void 0===n?null:n;if(r)throw new f.default({client:t,statusCode:e.status,method:b,error:r});return new h.default({client:t,requestRealm:v,method:b,body:e.body})},S=function(e){if(e instanceof Error)throw e;var n=e.response.error;throw new m.default({message:e.body.error.message,client:t,statusCode:n.status})};if("GET"===y){var A=t.cache.get(E);if(A){var C=new h.default({client:t,requestRealm:v,method:b,body:A});i(C)}var L=c.default.get(w).query(j).then(M).then(function(e){return t.cache.set(E,e.body),e}).catch(S);i(L)}else if("POST"===y){var R=c.default.post(w).type("form").send(j).then(M).catch(S);i(R)}throw new Error("Received invalid request method.")})}}],[{key:"normalizeParameterValue",value:function(e){return Array.isArray(e)?e.join(","):e instanceof Date?e.toISOString():e}}]),e}();t.default=M},function(e,t,n){"use strict";function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e){var t=this,n=e.identifier,i=e.indexEndpoint,a=e.dataEndpoint,u=e.identifierKey,c=e.fuse,l=e.searchFields;return"number"==typeof n?this.client.get(a,o({},u,n)).then(function(e){return e.data[n]}):"string"==typeof n?this.client.get(i,{fields:[].concat(r(l),[u])}).then(function(e){var i=e.data;c.set(Object.keys(i).reduce(function(e,t){return[].concat(r(e),[i[t]])},[]));var l=c.search(n);if(!l.length)return null;var f=s(l,1),p=f[0][u];return t.client.get(a,o({},u,p)).then(function(e){return e.data[p]})}):Promise.reject(new TypeError("Expected a string or number as the entry identifier."))}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var s,a=e[Symbol.iterator]();!(r=(s=a.next()).done)&&(n.push(s.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&a.return&&a.return()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.default=i},function(e,t,n){!function(t){"use strict";function n(){console.log.apply(console,arguments)}function r(e,t){var n;this.list=e,this.options=t=t||{};for(n in a)a.hasOwnProperty(n)&&("boolean"==typeof a[n]?this.options[n]=n in t?t[n]:a[n]:this.options[n]=t[n]||a[n])}function o(e,t,n){var r,s,a,u,c,l;if(t){if(a=t.indexOf("."),a!==-1?(r=t.slice(0,a),s=t.slice(a+1)):r=t,u=e[r],null!==u&&void 0!==u)if(s||"string"!=typeof u&&"number"!=typeof u)if(i(u))for(c=0,l=u.length;c<l;c++)o(u[c],s,n);else s&&o(u,s,n);else n.push(u)}else n.push(e);return n}function i(e){return"[object Array]"===Object.prototype.toString.call(e)}function s(e,t){t=t||{},this.options=t,this.options.location=t.location||s.defaultOptions.location,this.options.distance="distance"in t?t.distance:s.defaultOptions.distance,this.options.threshold="threshold"in t?t.threshold:s.defaultOptions.threshold,this.options.maxPatternLength=t.maxPatternLength||s.defaultOptions.maxPatternLength,this.pattern=t.caseSensitive?e:e.toLowerCase(),this.patternLen=e.length,this.patternLen<=this.options.maxPatternLength&&(this.matchmask=1<<this.patternLen-1,this.patternAlphabet=this._calculatePatternAlphabet())}var a={id:null,caseSensitive:!1,include:[],shouldSort:!0,searchFn:s,sortFn:function(e,t){return e.score-t.score},getFn:o,keys:[],verbose:!1,tokenize:!1,matchAllTokens:!1,tokenSeparator:/ +/g,minMatchCharLength:1,findAllMatches:!1};r.VERSION="2.6.0",r.prototype.set=function(e){return this.list=e,e},r.prototype.search=function(e){this.options.verbose&&n("\nSearch term:",e,"\n"),this.pattern=e,this.results=[],this.resultMap={},this._keyMap=null,this._prepareSearchers(),this._startSearch(),this._computeScore(),this._sort();var t=this._format();return t},r.prototype._prepareSearchers=function(){var e=this.options,t=this.pattern,n=e.searchFn,r=t.split(e.tokenSeparator),o=0,i=r.length;if(this.options.tokenize)for(this.tokenSearchers=[];o<i;o++)this.tokenSearchers.push(new n(r[o],e));this.fullSeacher=new n(t,e)},r.prototype._startSearch=function(){var e,t,n,r,o=this.options,i=o.getFn,s=this.list,a=s.length,u=this.options.keys,c=u.length,l=null;if("string"==typeof s[0])for(n=0;n<a;n++)this._analyze("",s[n],n,n);else for(this._keyMap={},n=0;n<a;n++)for(l=s[n],r=0;r<c;r++){if(e=u[r],"string"!=typeof e){if(t=1-e.weight||1,this._keyMap[e.name]={weight:t},e.weight<=0||e.weight>1)throw new Error("Key weight has to be > 0 and <= 1");e=e.name}else this._keyMap[e]={weight:1};this._analyze(e,i(l,e,[]),l,n)}},r.prototype._analyze=function(e,t,r,o){var s,a,u,c,l,f,p,h,d,y,b,v,_,m,w,g=this.options,O=!1;if(void 0!==t&&null!==t){a=[];var k=0;if("string"==typeof t){if(s=t.split(g.tokenSeparator),g.verbose&&n("---------\nKey:",e),this.options.tokenize){for(m=0;m<this.tokenSearchers.length;m++){for(h=this.tokenSearchers[m],g.verbose&&n("Pattern:",h.pattern),d=[],v=!1,w=0;w<s.length;w++){y=s[w],b=h.search(y);var j={};b.isMatch?(j[y]=b.score,O=!0,v=!0,a.push(b.score)):(j[y]=1,this.options.matchAllTokens||a.push(1)),d.push(j)}v&&k++,g.verbose&&n("Token scores:",d)}for(c=a[0],f=a.length,m=1;m<f;m++)c+=a[m];c/=f,g.verbose&&n("Token score average:",c)}p=this.fullSeacher.search(t),g.verbose&&n("Full text score:",p.score),l=p.score,void 0!==c&&(l=(l+c)/2),g.verbose&&n("Score average:",l),_=!this.options.tokenize||!this.options.matchAllTokens||k>=this.tokenSearchers.length,g.verbose&&n("Check Matches",_),(O||p.isMatch)&&_&&(u=this.resultMap[o],u?u.output.push({key:e,score:l,matchedIndices:p.matchedIndices}):(this.resultMap[o]={item:r,output:[{key:e,score:l,matchedIndices:p.matchedIndices}]},this.results.push(this.resultMap[o])))}else if(i(t))for(m=0;m<t.length;m++)this._analyze(e,t[m],r,o)}},r.prototype._computeScore=function(){var e,t,r,o,i,s,a,u,c,l=this._keyMap,f=this.results;for(this.options.verbose&&n("\n\nComputing score:\n"),e=0;e<f.length;e++){for(r=0,o=f[e].output,i=o.length,u=1,t=0;t<i;t++)s=o[t].score,a=l?l[o[t].key].weight:1,c=s*a,1!==a?u=Math.min(u,c):(r+=c,o[t].nScore=c);1===u?f[e].score=r/i:f[e].score=u,this.options.verbose&&n(f[e])}},r.prototype._sort=function(){var e=this.options;e.shouldSort&&(e.verbose&&n("\n\nSorting...."),this.results.sort(e.sortFn))},r.prototype._format=function(){var e,t,r,o,i,s=this.options,a=s.getFn,u=[],c=this.results,l=s.include;for(s.verbose&&n("\n\nOutput:\n\n",c),o=s.id?function(e){c[e].item=a(c[e].item,s.id,[])[0]}:function(){},i=function(e){var t,n,r,o,i,s=c[e];if(l.length>0){if(t={item:s.item},l.indexOf("matches")!==-1)for(r=s.output,t.matches=[],n=0;n<r.length;n++)o=r[n],i={indices:o.matchedIndices},o.key&&(i.key=o.key),t.matches.push(i);l.indexOf("score")!==-1&&(t.score=c[e].score)}else t=s.item;return t},t=0,r=c.length;t<r;t++)o(t),e=i(t),u.push(e);return u},s.defaultOptions={location:0,distance:100,threshold:.6,maxPatternLength:32},s.prototype._calculatePatternAlphabet=function(){var e={},t=0;for(t=0;t<this.patternLen;t++)e[this.pattern.charAt(t)]=0;for(t=0;t<this.patternLen;t++)e[this.pattern.charAt(t)]|=1<<this.pattern.length-t-1;return e},s.prototype._bitapScore=function(e,t){var n=e/this.patternLen,r=Math.abs(this.options.location-t);return this.options.distance?n+r/this.options.distance:r?1:n},s.prototype.search=function(e){var t,n,r,o,i,s,a,u,c,l,f,p,h,d,y,b,v,_,m,w,g,O,k,j=this.options;if(e=j.caseSensitive?e:e.toLowerCase(),this.pattern===e)return{isMatch:!0,score:0,matchedIndices:[[0,e.length-1]]};if(this.patternLen>j.maxPatternLength){if(_=e.match(new RegExp(this.pattern.replace(j.tokenSeparator,"|"))),m=!!_)for(g=[],t=0,O=_.length;t<O;t++)k=_[t],g.push([e.indexOf(k),k.length-1]);return{isMatch:m,score:m?.5:1,matchedIndices:g}}for(o=j.findAllMatches,i=j.location,r=e.length,s=j.threshold,a=e.indexOf(this.pattern,i),w=[],t=0;t<r;t++)w[t]=0;for(a!=-1&&(s=Math.min(this._bitapScore(0,a),s),a=e.lastIndexOf(this.pattern,i+this.patternLen),a!=-1&&(s=Math.min(this._bitapScore(0,a),s))),a=-1,b=1,v=[],l=this.patternLen+r,t=0;t<this.patternLen;t++){for(u=0,c=l;u<c;)this._bitapScore(t,i+c)<=s?u=c:l=c,c=Math.floor((l-u)/2+u);for(l=c,f=Math.max(1,i-c+1),p=o?r:Math.min(i+c,r)+this.patternLen,h=Array(p+2),h[p+1]=(1<<t)-1,n=p;n>=f;n--)if(y=this.patternAlphabet[e.charAt(n-1)],y&&(w[n-1]=1),0===t?h[n]=(h[n+1]<<1|1)&y:h[n]=(h[n+1]<<1|1)&y|((d[n+1]|d[n])<<1|1)|d[n+1],h[n]&this.matchmask&&(b=this._bitapScore(t,n-1),b<=s)){if(s=b,a=n-1,v.push(a),!(a>i))break;f=Math.max(1,2*i-a)}if(this._bitapScore(t+1,i)>s)break;d=h}return g=this._getMatchedIndices(w),{isMatch:a>=0,score:0===b?.001:b,matchedIndices:g}},s.prototype._getMatchedIndices=function(e){for(var t,n=[],r=-1,o=-1,i=0,s=e.length;i<s;i++)t=e[i],t&&r===-1?r=i:t||r===-1||(o=i-1,o-r+1>=this.options.minMatchCharLength&&n.push([r,o]),r=-1);return e[i-1]&&i-1-r+1>=this.options.minMatchCharLength&&n.push([r,i-1]),n},e.exports=r}(this)},function(e,t,n){"use strict";function r(e){var t=e.method,n=e.type,r=e.slug;return this.client.get(t,{}).then(function(e){var t=e.data[n];if(!t||"object"!==("undefined"==typeof t?"undefined":o(t)))throw new Error("Invalid translation type: "+n+".");return t[r]})}Object.defineProperty(t,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.default=r},function(e,t){function n(e){return null!==e&&"object"==typeof e}e.exports=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=n(1),c=r(u),l=function(e){function t(e){return o(this,t),i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,a({},e,{type:"wgn"})))}return s(t,e),t}(c.default);t.default=l},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=n(18),c=r(u),l=n(1),f=r(l),p=n(19),h=r(p),d=function(e){function t(e){o(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,a({},e,{type:"wot"})));return n.accounts=new c.default(n),n.tankopedia=new h.default(n),n}return s(t,e),t}(f.default);t.default=d},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=n(1),c=r(u),l=n(20),f=r(l),p=function(e){function t(e){o(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,a({},e,{type:"wotb"})));return n.tankopedia=new f.default(n),n}return s(t,e),t}(c.default);t.default=p},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=n(1),c=r(u),l=n(21),f=r(l),p=function(e){function t(e){o(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,a({},e,{type:"wotx"})));return n.tankopedia=new f.default(n),n}return s(t,e),t}(c.default);t.default=p},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=n(1),c=r(u),l=n(22),f=r(l),p=function(e){function t(e){o(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,a({},e,{type:"wowp"})));return n.encyclopedia=new f.default(n),n}return s(t,e),t}(c.default);t.default=p},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=n(1),c=r(u),l=n(23),f=r(l),p=function(e){function t(e){o(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,a({},e,{type:"wows"})));return n.encyclopedia=new f.default(n),n}return s(t,e),t}(c.default);t.default=p},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=n(31),u=r(a),c=function(e){function t(e){var n=e.message,r=e.client,s=e.statusCode;o(this,t);var a=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,n));return a.client=r,a.statusCode=s,a}return s(t,e),t}(u.default);t.default=c},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(7),a=r(s),u=n(8),c=r(u),l=n(9),f=r(l),p=n(11),h=r(p),d=n(10),y=r(d),b=n(6),v=r(b),_=function(){function e(){o(this,e)}return i(e,null,[{key:"WoT",value:function(e){return new a.default(e)}},{key:"WoTB",value:function(e){return new c.default(e)}},{key:"WoTX",value:function(e){return new f.default(e)}},{key:"WoWS",value:function(e){return new h.default(e)}},{key:"WoWP",value:function(e){return new y.default(e)}},{key:"WGN",value:function(e){return new v.default(e)}}]),e}();t.default=_},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(15),c=r(u),l=n(16),f=r(l),p=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,e);var n=t.timeToLive,r=void 0===n?null:n;this.entryTimeToLive=r,this.meta=new f.default,this.store=new Map}return a(e,[{key:"get",value:function(e){var t=this.store.get(e);return t?t.expired?void this.meta.expire():(this.meta.hit(),t.touch(),t.value):void this.meta.miss()}},{key:"set",value:function(e,t){var n=new c.default({value:t,timeToLive:this.entryTimeToLive});return this.store.set(e,n),this}},{key:"delete",value:function(e){return this.store.delete(e),this}},{key:"clear",value:function(){return this.store.clear(),this.meta.clear(),this}},{key:"size",get:function(){return this.store.size}},{key:"keys",get:function(){return[].concat(o(this.store.keys()))}},{key:"empty",get:function(){return 0===this.size}},{key:"statistics",get:function(){return s({},this.meta.serialize(),{size:this.size})}}]),e}();t.default=p},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(t){r(this,e);var n=t.value,o=t.timeToLive,i=void 0===o?null:o;this.value=n,this.entryTimeToLive=i,this.createdAt=new Date,this.accessedAt=null}return o(e,[{key:"touch",value:function(){this.accessedAt=new Date}},{key:"expired",get:function(){if(!this.entryTimeToLive)return!1;var e=new Date,t=this.createdAt;return e.getTime()-t.getTime()>=this.entryTimeToLive}}]),e}();t.default=i},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(){r(this,e),this.createdAt=new Date,this.accessedAt=null,this.updatedAt=null,this.clearedAt=null,this.hits=0,this.misses=0,this.expired=0}return o(e,[{key:"hit",value:function(){return this.accessedAt=new Date,this.hits+=1,this}},{key:"miss",value:function(){return this.accessedAt=new Date,this.misses+=1,this}},{key:"expire",value:function(){return this.expired+=1,this}},{key:"clear",value:function(){var e=new Date;return this.updatedAt=e,this.clearedAt=e,this.hits=0,this.misses=0,this.expired=0,this}},{key:"serialize",value:function(){return{createdAt:this.createdAt,accessedAt:this.accessedAt,updatedAt:this.updatedAt,clearedAt:this.clearedAt,hits:this.hits,misses:this.misses,expired:this.expired}}}]),e}();t.default=i},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c=n(12),l=r(c),f=function(e){function t(e){var n=e.requestRealm,r=e.method,a=e.error,c=o(e,["requestRealm","method","error"]);i(this,t);var l=a.code,f=a.message,p=a.field,h=a.value,d=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,u({},c,{message:l+": "+f+". Error field: "+p+" => "+h+"."})));return d.requestRealm=n,d.method=r,d.code=l,d.apiMessage=f,d.field=p,d.value=h,d}return a(t,e),t}(l.default);t.default=f},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(0),c=r(u),l=function(e){function t(e){return o(this,t),i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,"accounts"))}return s(t,e),a(t,[{key:"findPlayerId",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"exact";switch(t.toLowerCase()){case"startswith":return this.client.get("account/list",{search:e}).then(function(e){return e.data});case"exact":return this.client.get("account/list",{search:e}).then(function(e){return e.data[0]?e.data[0].account_id:null});default:return Promise.reject(new Error("Invalid search type specified for player search."))}}}]),t}(c.default);t.default=l},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(3),l=r(c),f=n(0),p=r(f),h=n(2),d=r(h),y=n(25),b=r(y),v=n(4),_=r(v),m=function(e){function t(e){o(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,"tankopedia"));return n.MODULE_ID_FIELDS={vehicleChassis:"suspension_id",vehicleEngine:"engine_id",vehicleGun:"gun_id",vehicleRadio:"radio_id",vehicleTurret:"turret_id"},n.fuse=new l.default([],{keys:["name","short_name"]}),n}return s(t,e),u(t,[{key:"findVehicle",value:function(e){return d.default.call(this,{identifier:e,indexEndpoint:"encyclopedia/vehicles",dataEndpoint:"encyclopedia/vehicles",identifierKey:"tank_id",fuse:this.fuse,searchFields:["name","short_name"]})}},{key:"findVehicleProfile",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"stock";return"stock"===n?this.client.get("encyclopedia/vehicleprofile",{tank_id:e}).then(function(t){return t.data[e]}):"top"===n?this.findVehicle(e).then(function(n){if(!n)return null;var r=(0,b.default)(n.modules_tree),o=Object.keys(r).reduce(function(e,n){var o=t.MODULE_ID_FIELDS[n];return e[o]=r[n].module_id,e},{});return t.client.get("encyclopedia/vehicleprofile",a({},o,{tank_id:e})).then(function(t){return t.data[e]})}):this.client.get("encyclopedia/vehicleprofile",{tank_id:e,profile_id:n}).then(function(t){return t.data[e]})}},{key:"localizeCrewRole",value:function(e){return _.default.call(this,{method:"encyclopedia/info",type:"vehicle_crew_roles",slug:e})}},{key:"localizeLanguage",value:function(e){return _.default.call(this,{method:"encyclopedia/info",type:"languages",slug:e})}},{key:"localizeAchievementSection",value:function(e){return _.default.call(this,{method:"encyclopedia/info",type:"achievement_sections",slug:e}).then(function(e){return e&&e.name})}},{key:"localizeVehicleType",value:function(e){return _.default.call(this,{method:"encyclopedia/info",type:"vehicle_types",slug:e})}},{key:"localizeVehicleNation",value:function(e){
return _.default.call(this,{method:"encyclopedia/info",type:"vehicle_nations",slug:e})}}]),t}(p.default);t.default=m},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(3),c=r(u),l=n(0),f=r(l),p=n(2),h=r(p),d=n(4),y=r(d),b=function(e){function t(e){o(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,"tankopedia"));return n.fuse=new c.default([],{keys:["name"]}),n}return s(t,e),a(t,[{key:"findVehicle",value:function(e){return h.default.call(this,{identifier:e,indexEndpoint:"encyclopedia/vehicles",dataEndpoint:"encyclopedia/vehicles",identifierKey:"tank_id",fuse:this.fuse,searchFields:["name"]})}},{key:"localizeLanguage",value:function(e){return y.default.call(this,{method:"encyclopedia/info",type:"languages",slug:e})}},{key:"localizeAchievementSection",value:function(e){return y.default.call(this,{method:"encyclopedia/info",type:"achievement_sections",slug:e}).then(function(e){return e&&e.name})}},{key:"localizeVehicleType",value:function(e){return y.default.call(this,{method:"encyclopedia/info",type:"vehicle_types",slug:e})}},{key:"localizeVehicleNation",value:function(e){return y.default.call(this,{method:"encyclopedia/info",type:"vehicle_nations",slug:e})}}]),t}(f.default);t.default=b},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(3),c=r(u),l=n(0),f=r(l),p=n(2),h=r(p),d=n(4),y=r(d),b=function(e){function t(e){o(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,"tankopedia"));return n.fuse=new c.default([],{keys:["name","short_name"]}),n}return s(t,e),a(t,[{key:"findVehicle",value:function(e){return h.default.call(this,{identifier:e,indexEndpoint:"encyclopedia/vehicles",dataEndpoint:"encyclopedia/vehicles",identifierKey:"tank_id",fuse:this.fuse,searchFields:["name","short_name"]})}},{key:"localizeAchievementSection",value:function(e){return y.default.call(this,{method:"encyclopedia/info",type:"achievement_sections",slug:e}).then(function(e){return e&&e.name})}},{key:"localizeVehicleType",value:function(e){return y.default.call(this,{method:"encyclopedia/info",type:"vehicle_types",slug:e})}},{key:"localizeVehicleNation",value:function(e){return y.default.call(this,{method:"encyclopedia/info",type:"vehicle_nations",slug:e})}}]),t}(f.default);t.default=b},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(3),c=r(u),l=n(0),f=r(l),p=n(2),h=r(p),d=function(e){function t(e){o(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,"encyclopedia"));return n.fuse=new c.default([],{keys:["name_i18n"]}),n}return s(t,e),a(t,[{key:"findPlane",value:function(e){return h.default.call(this,{identifier:e,indexEndpoint:"encyclopedia/planes",dataEndpoint:"encyclopedia/planeinfo",identifierKey:"plane_id",fuse:this.fuse,searchFields:["name_i18n"]})}}]),t}(f.default);t.default=d},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(3),c=r(u),l=n(0),f=r(l),p=n(2),h=r(p),d=n(4),y=r(d),b=function(e){function t(e){o(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,"encyclopedia"));return n.fuse=new c.default([],{keys:["name"]}),n}return s(t,e),a(t,[{key:"findShip",value:function(e){return h.default.call(this,{identifier:e,indexEndpoint:"encyclopedia/ships",dataEndpoint:"encyclopedia/ships",identifierKey:"ship_id",fuse:this.fuse,searchFields:["name"]})}},{key:"localizeShipType",value:function(e){return y.default.call(this,{method:"encyclopedia/info",type:"ship_types",slug:e})}},{key:"localizeLanguage",value:function(e){return y.default.call(this,{method:"encyclopedia/info",type:"languages",slug:e})}},{key:"localizeShipModification",value:function(e){return y.default.call(this,{method:"encyclopedia/info",type:"ship_modifications",slug:e})}},{key:"localizeShipModule",value:function(e){return y.default.call(this,{method:"encyclopedia/info",type:"ship_modules",slug:e})}},{key:"localizeShipNation",value:function(e){return y.default.call(this,{method:"encyclopedia/info",type:"ship_nations",slug:e})}}]),t}(f.default);t.default=b},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(0),c=r(u),l=function(e){function t(e){return o(this,t),i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,"authentication"))}return s(t,e),a(t,[{key:"renewAccessToken",value:function(){var e=this;return this.client.accessToken?this.client.post("auth/prolongate",{},{type:"wotx"===this.client.type?"wotx":"wot"}).then(function(t){return e.client.accessToken=t.data.access_token,t}):Promise.reject(new Error("Failed to renew access token: client's access token is not set."))}},{key:"destroyAccessToken",value:function(){var e=this;return this.client.accessToken?this.client.post("auth/logout",{},{type:"wotx"===this.client.type?"wotx":"wot"}).then(function(t){return e.client.accessToken=null,t}):Promise.reject(new Error("Failed to invalidate access token: client's access token is not set."))}}]),t}(c.default);t.default=l},function(e,t,n){"use strict";function r(e){return Object.keys(e).reduce(function(t,n){var r=e[n],o=r.price_xp,i=r.type;return t[i]?o>t[i].price_xp&&(t[i]=r):t[i]=r,t},{})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(t){var n=t.client,o=t.requestRealm,i=t.method,s=t.body;r(this,e),this.client=n,this.requestRealm=o,this.method=i,this.body=s}return o(e,[{key:"meta",get:function(){return this.body.meta}},{key:"data",get:function(){return this.body.data}}]),e}();t.default=i},function(e,t,n){"use strict";function r(e){var t=0;if(!e.length)return t.toString();for(var n=0;n<e.length;++n){var r=e.charCodeAt(n);t=(t<<5)-t+r,t&=t}return t.toString()}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r},function(e,t,n){"use strict";function r(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(e){return e},n=Object.keys(e);return n.reduce(function(n,r){return n[r]=t(e[r],r,e),n},{})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r},function(e,t,n){"use strict";function r(e){return Object.keys(e).sort().reduce(function(t,n){return t[n]=e[n],t},{})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r},function(e,t,n){function r(e){if(e)return o(e)}function o(e){for(var t in r.prototype)e[t]=r.prototype[t];return e}e.exports=r,r.prototype.on=r.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},r.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var r,o=0;o<n.length;o++)if(r=n[o],r===t||r.fn===t){n.splice(o,1);break}return this},r.prototype.emit=function(e){this._callbacks=this._callbacks||{};var t=[].slice.call(arguments,1),n=this._callbacks["$"+e];if(n){n=n.slice(0);for(var r=0,o=n.length;r<o;++r)n[r].apply(this,t)}return this},r.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},r.prototype.hasListeners=function(e){return!!this.listeners(e).length}},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){function t(){e.apply(this,arguments)}return t.prototype=Object.create(e.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e,t}Object.defineProperty(t,"__esModule",{value:!0});var a=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";r(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return Object.defineProperty(n,"message",{configurable:!0,enumerable:!1,value:e,writable:!0}),Object.defineProperty(n,"name",{configurable:!0,enumerable:!1,value:n.constructor.name,writable:!0}),Error.hasOwnProperty("captureStackTrace")?(Error.captureStackTrace(n,n.constructor),o(n)):(Object.defineProperty(n,"stack",{configurable:!0,enumerable:!1,value:new Error(e).stack,writable:!0}),n)}return i(t,e),t}(s(Error));t.default=a,e.exports=t.default},function(e,t,n){function r(){}function o(e){if(!y(e))return e;var t=[];for(var n in e)i(t,n,e[n]);return t.join("&")}function i(e,t,n){if(null!=n)if(Array.isArray(n))n.forEach(function(n){i(e,t,n)});else if(y(n))for(var r in n)i(e,t+"["+r+"]",n[r]);else e.push(encodeURIComponent(t)+"="+encodeURIComponent(n));else null===n&&e.push(encodeURIComponent(t))}function s(e){for(var t,n,r={},o=e.split("&"),i=0,s=o.length;i<s;++i)t=o[i],n=t.indexOf("="),n==-1?r[decodeURIComponent(t)]="":r[decodeURIComponent(t.slice(0,n))]=decodeURIComponent(t.slice(n+1));return r}function a(e){var t,n,r,o,i=e.split(/\r?\n/),s={};i.pop();for(var a=0,u=i.length;a<u;++a)n=i[a],t=n.indexOf(":"),r=n.slice(0,t).toLowerCase(),o=w(n.slice(t+1)),s[r]=o;return s}function u(e){return/[\/+]json\b/.test(e)}function c(e){this.req=e,this.xhr=this.req.xhr,this.text="HEAD"!=this.req.method&&(""===this.xhr.responseType||"text"===this.xhr.responseType)||"undefined"==typeof this.xhr.responseType?this.xhr.responseText:null,this.statusText=this.req.xhr.statusText;var t=this.xhr.status;1223===t&&(t=204),this._setStatusProperties(t),this.header=this.headers=a(this.xhr.getAllResponseHeaders()),this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this._setHeaderProperties(this.header),null===this.text&&e._responseType?this.body=this.xhr.response:this.body="HEAD"!=this.req.method?this._parseBody(this.text?this.text:this.xhr.response):null}function l(e,t){var n=this;this._query=this._query||[],this.method=e,this.url=t,this.header={},this._header={},this.on("end",function(){var e=null,t=null;try{t=new c(n)}catch(t){return e=new Error("Parser is unable to parse the response"),e.parse=!0,e.original=t,n.xhr?(e.rawResponse="undefined"==typeof n.xhr.responseType?n.xhr.responseText:n.xhr.response,e.status=n.xhr.status?n.xhr.status:null,e.statusCode=e.status):(e.rawResponse=null,e.status=null),n.callback(e)}n.emit("response",t);var r;try{n._isResponseOK(t)||(r=new Error(t.statusText||"Unsuccessful HTTP response"),r.original=e,r.response=t,r.status=t.status)}catch(e){r=e}r?n.callback(r,t):n.callback(null,t)})}function f(e,t,n){var r=m("DELETE",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r}var p;"undefined"!=typeof window?p=window:"undefined"!=typeof self?p=self:(console.warn("Using browser-only version of superagent in non-browser environment"),p=this);var h=n(30),d=n(34),y=n(5),b=n(33),v=n(35),_=n(36),m=t=e.exports=function(e,n){return"function"==typeof n?new t.Request("GET",e).end(n):1==arguments.length?new t.Request("GET",e):new t.Request(e,n)};t.Request=l,m.getXHR=function(){if(!(!p.XMLHttpRequest||p.location&&"file:"==p.location.protocol&&p.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(e){}throw Error("Browser-only verison of superagent could not find XHR")};var w="".trim?function(e){return e.trim()}:function(e){return e.replace(/(^\s*|\s*$)/g,"")};m.serializeObject=o,m.parseString=s,m.types={html:"text/html",json:"application/json",xml:"application/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},m.serialize={"application/x-www-form-urlencoded":o,"application/json":JSON.stringify},m.parse={"application/x-www-form-urlencoded":s,"application/json":JSON.parse},v(c.prototype),c.prototype._parseBody=function(e){var t=m.parse[this.type];return this.req._parser?this.req._parser(this,e):(!t&&u(this.type)&&(t=m.parse["application/json"]),t&&e&&(e.length||e instanceof Object)?t(e):null)},c.prototype.toError=function(){var e=this.req,t=e.method,n=e.url,r="cannot "+t+" "+n+" ("+this.status+")",o=new Error(r);return o.status=this.status,o.method=t,o.url=n,o},m.Response=c,h(l.prototype),d(l.prototype),l.prototype.type=function(e){return this.set("Content-Type",m.types[e]||e),this},l.prototype.accept=function(e){return this.set("Accept",m.types[e]||e),this},l.prototype.auth=function(e,t,n){switch(n||(n={type:"function"==typeof btoa?"basic":"auto"}),n.type){case"basic":this.set("Authorization","Basic "+btoa(e+":"+t));break;case"auto":this.username=e,this.password=t}return this},l.prototype.query=function(e){return"string"!=typeof e&&(e=o(e)),e&&this._query.push(e),this},l.prototype.attach=function(e,t,n){if(this._data)throw Error("superagent can't mix .send() and .attach()");return this._getFormData().append(e,t,n||t.name),this},l.prototype._getFormData=function(){return this._formData||(this._formData=new p.FormData),this._formData},l.prototype.callback=function(e,t){if(this._maxRetries&&this._retries++<this._maxRetries&&_(e,t))return this._retry();var n=this._callback;this.clearTimeout(),e&&(this._maxRetries&&(e.retries=this._retries-1),this.emit("error",e)),n(e,t)},l.prototype.crossDomainError=function(){var e=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");e.crossDomain=!0,e.status=this.status,e.method=this.method,e.url=this.url,this.callback(e)},l.prototype.buffer=l.prototype.ca=l.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},l.prototype.pipe=l.prototype.write=function(){throw Error("Streaming is not supported in browser version of superagent")},l.prototype._appendQueryString=function(){var e=this._query.join("&");if(e&&(this.url+=(this.url.indexOf("?")>=0?"&":"?")+e),this._sort){var t=this.url.indexOf("?");if(t>=0){var n=this.url.substring(t+1).split("&");b(this._sort)?n.sort(this._sort):n.sort(),this.url=this.url.substring(0,t)+"?"+n.join("&")}}},l.prototype._isHost=function(e){return e&&"object"==typeof e&&!Array.isArray(e)&&"[object Object]"!==Object.prototype.toString.call(e)},l.prototype.end=function(e){return this._endCalled&&console.warn("Warning: .end() was called twice. This is not supported in superagent"),this._endCalled=!0,this._callback=e||r,this._appendQueryString(),this._end()},l.prototype._end=function(){var e=this,t=this.xhr=m.getXHR(),n=this._formData||this._data;this._setTimeouts(),t.onreadystatechange=function(){var n=t.readyState;if(n>=2&&e._responseTimeoutTimer&&clearTimeout(e._responseTimeoutTimer),4==n){var r;try{r=t.status}catch(e){r=0}if(!r){if(e.timedout||e._aborted)return;return e.crossDomainError()}e.emit("end")}};var r=function(t,n){n.total>0&&(n.percent=n.loaded/n.total*100),n.direction=t,e.emit("progress",n)};if(this.hasListeners("progress"))try{t.onprogress=r.bind(null,"download"),t.upload&&(t.upload.onprogress=r.bind(null,"upload"))}catch(e){}try{this.username&&this.password?t.open(this.method,this.url,!0,this.username,this.password):t.open(this.method,this.url,!0)}catch(e){return this.callback(e)}if(this._withCredentials&&(t.withCredentials=!0),!this._formData&&"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof n&&!this._isHost(n)){var o=this._header["content-type"],i=this._serializer||m.serialize[o?o.split(";")[0]:""];!i&&u(o)&&(i=m.serialize["application/json"]),i&&(n=i(n))}for(var s in this.header)null!=this.header[s]&&t.setRequestHeader(s,this.header[s]);return this._responseType&&(t.responseType=this._responseType),this.emit("request",this),t.send("undefined"!=typeof n?n:null),this},m.get=function(e,t,n){var r=m("GET",e);return"function"==typeof t&&(n=t,t=null),t&&r.query(t),n&&r.end(n),r},m.head=function(e,t,n){var r=m("HEAD",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},m.options=function(e,t,n){var r=m("OPTIONS",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},m.del=f,m.delete=f,m.patch=function(e,t,n){var r=m("PATCH",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},m.post=function(e,t,n){var r=m("POST",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},m.put=function(e,t,n){var r=m("PUT",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r}},function(e,t,n){function r(e){var t=o(e)?Object.prototype.toString.call(e):"";return"[object Function]"===t}var o=n(5);e.exports=r},function(e,t,n){function r(e){if(e)return o(e)}function o(e){for(var t in r.prototype)e[t]=r.prototype[t];return e}var i=n(5);e.exports=r,r.prototype.clearTimeout=function(){return clearTimeout(this._timer),clearTimeout(this._responseTimeoutTimer),delete this._timer,delete this._responseTimeoutTimer,this},r.prototype.parse=function(e){return this._parser=e,this},r.prototype.responseType=function(e){return this._responseType=e,this},r.prototype.serialize=function(e){return this._serializer=e,this},r.prototype.timeout=function(e){return e&&"object"==typeof e?("undefined"!=typeof e.deadline&&(this._timeout=e.deadline),"undefined"!=typeof e.response&&(this._responseTimeout=e.response),this):(this._timeout=e,this._responseTimeout=0,this)},r.prototype.retry=function(e){return 0!==arguments.length&&e!==!0||(e=1),e<=0&&(e=0),this._maxRetries=e,this._retries=0,this},r.prototype._retry=function(){return this.clearTimeout(),this.req&&(this.req=null,this.req=this.request()),this._aborted=!1,this.timedout=!1,this._end()},r.prototype.then=function(e,t){if(!this._fullfilledPromise){var n=this;this._endCalled&&console.warn("Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises"),this._fullfilledPromise=new Promise(function(e,t){n.end(function(n,r){n?t(n):e(r)})})}return this._fullfilledPromise.then(e,t)},r.prototype.catch=function(e){return this.then(void 0,e)},r.prototype.use=function(e){return e(this),this},r.prototype.ok=function(e){if("function"!=typeof e)throw Error("Callback required");return this._okCallback=e,this},r.prototype._isResponseOK=function(e){return!!e&&(this._okCallback?this._okCallback(e):e.status>=200&&e.status<300)},r.prototype.get=function(e){return this._header[e.toLowerCase()]},r.prototype.getHeader=r.prototype.get,r.prototype.set=function(e,t){if(i(e)){for(var n in e)this.set(n,e[n]);return this}return this._header[e.toLowerCase()]=t,this.header[e]=t,this},r.prototype.unset=function(e){return delete this._header[e.toLowerCase()],delete this.header[e],this},r.prototype.field=function(e,t){if(null===e||void 0===e)throw new Error(".field(name, val) name can not be empty");if(this._data&&console.error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()"),i(e)){for(var n in e)this.field(n,e[n]);return this}if(Array.isArray(t)){for(var r in t)this.field(e,t[r]);return this}if(null===t||void 0===t)throw new Error(".field(name, val) val can not be empty");return"boolean"==typeof t&&(t=""+t),this._getFormData().append(e,t),this},r.prototype.abort=function(){return this._aborted?this:(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort"),this)},r.prototype.withCredentials=function(){return this._withCredentials=!0,this},r.prototype.redirects=function(e){return this._maxRedirects=e,this},r.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},r.prototype.send=function(e){var t=i(e),n=this._header["content-type"];if(this._formData&&console.error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()"),t&&!this._data)Array.isArray(e)?this._data=[]:this._isHost(e)||(this._data={});else if(e&&this._data&&this._isHost(this._data))throw Error("Can't merge these send calls");if(t&&i(this._data))for(var r in e)this._data[r]=e[r];else"string"==typeof e?(n||this.type("form"),n=this._header["content-type"],"application/x-www-form-urlencoded"==n?this._data=this._data?this._data+"&"+e:e:this._data=(this._data||"")+e):this._data=e;return!t||this._isHost(e)?this:(n||this.type("json"),this)},r.prototype.sortQuery=function(e){return this._sort="undefined"==typeof e||e,this},r.prototype._timeoutError=function(e,t){if(!this._aborted){var n=new Error(e+t+"ms exceeded");n.timeout=t,n.code="ECONNABORTED",this.timedout=!0,this.abort(),this.callback(n)}},r.prototype._setTimeouts=function(){var e=this;this._timeout&&!this._timer&&(this._timer=setTimeout(function(){e._timeoutError("Timeout of ",e._timeout)},this._timeout)),this._responseTimeout&&!this._responseTimeoutTimer&&(this._responseTimeoutTimer=setTimeout(function(){e._timeoutError("Response timeout of ",e._responseTimeout)},this._responseTimeout))}},function(e,t,n){function r(e){if(e)return o(e)}function o(e){for(var t in r.prototype)e[t]=r.prototype[t];return e}var i=n(37);e.exports=r,r.prototype.get=function(e){return this.header[e.toLowerCase()]},r.prototype._setHeaderProperties=function(e){var t=e["content-type"]||"";this.type=i.type(t);var n=i.params(t);for(var r in n)this[r]=n[r];this.links={};try{e.link&&(this.links=i.parseLinks(e.link))}catch(e){}},r.prototype._setStatusProperties=function(e){var t=e/100|0;this.status=this.statusCode=e,this.statusType=t,this.info=1==t,this.ok=2==t,this.redirect=3==t,this.clientError=4==t,this.serverError=5==t,this.error=(4==t||5==t)&&this.toError(),this.accepted=202==e,this.noContent=204==e,this.badRequest=400==e,this.unauthorized=401==e,this.notAcceptable=406==e,this.forbidden=403==e,this.notFound=404==e}},function(e,t){var n=["ECONNRESET","ETIMEDOUT","EADDRINFO","ESOCKETTIMEDOUT"];e.exports=function(e,t){return!!(e&&e.code&&~n.indexOf(e.code))||(!!(t&&t.status&&t.status>=500)||!!(e&&"timeout"in e&&"ECONNABORTED"==e.code))}},function(e,t){t.type=function(e){return e.split(/ *; */).shift()},t.params=function(e){return e.split(/ *; */).reduce(function(e,t){var n=t.split(/ *= */),r=n.shift(),o=n.shift();return r&&o&&(e[r]=o),e},{})},t.parseLinks=function(e){return e.split(/ *, */).reduce(function(e,t){var n=t.split(/ *; */),r=n[0].slice(1,-1),o=n[1].split(/ *= */)[1].slice(1,-1);return e[o]=r,e},{})},t.cleanHeader=function(e,t){return delete e["content-type"],delete e["content-length"],delete e["transfer-encoding"],delete e.host,t&&delete e.cookie,e}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Wargaming=t.WorldOfWarplanes=t.WorldOfWarships=t.WorldOfTanksConsole=t.WorldOfTanksBlitz=t.WorldOfTanks=void 0;var o=n(13),i=r(o),s=n(7),a=r(s),u=n(8),c=r(u),l=n(9),f=r(l),p=n(11),h=r(p),d=n(10),y=r(d),b=n(6),v=r(b);t.WorldOfTanks=a.default,t.WorldOfTanksBlitz=c.default,t.WorldOfTanksConsole=f.default,t.WorldOfWarships=h.default,t.WorldOfWarplanes=y.default,t.Wargaming=v.default,t.default=i.default}])});
//# sourceMappingURL=wargamer.min.js.map

@@ -354,9 +354,7 @@ 'use strict';

// check if this is a HTTP error or a Wargaming error
if (value instanceof _APIError2.default) {
if (value instanceof Error) {
throw value;
}
var _value$response = value.response,
error = _value$response.error,
req = _value$response.req;
var error = value.response.error;

@@ -367,4 +365,3 @@

client: _this,
statusCode: error.status,
url: req.url
statusCode: error.status
});

@@ -371,0 +368,0 @@ };

@@ -13,2 +13,6 @@ 'use strict';

var _Tankopedia = require('../modules/WorldOfTanksBlitz/Tankopedia');
var _Tankopedia2 = _interopRequireDefault(_Tankopedia);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -36,3 +40,10 @@

return _possibleConstructorReturn(this, (WorldOfTanksBlitz.__proto__ || Object.getPrototypeOf(WorldOfTanksBlitz)).call(this, _extends({}, options, { type: 'wotb' })));
/**
* The client's Tankopedia module.
* @type {Tankopedia}
*/
var _this = _possibleConstructorReturn(this, (WorldOfTanksBlitz.__proto__ || Object.getPrototypeOf(WorldOfTanksBlitz)).call(this, _extends({}, options, { type: 'wotb' })));
_this.tankopedia = new _Tankopedia2.default(_this);
return _this;
}

@@ -39,0 +50,0 @@

@@ -13,2 +13,6 @@ 'use strict';

var _Tankopedia = require('../modules/WorldOfTanksConsole/Tankopedia');
var _Tankopedia2 = _interopRequireDefault(_Tankopedia);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -36,3 +40,10 @@

return _possibleConstructorReturn(this, (WorldOfTanksConsole.__proto__ || Object.getPrototypeOf(WorldOfTanksConsole)).call(this, _extends({}, options, { type: 'wotx' })));
/**
* The client's Tankopedia module.
* @type {Tankopedia}
*/
var _this = _possibleConstructorReturn(this, (WorldOfTanksConsole.__proto__ || Object.getPrototypeOf(WorldOfTanksConsole)).call(this, _extends({}, options, { type: 'wotx' })));
_this.tankopedia = new _Tankopedia2.default(_this);
return _this;
}

@@ -39,0 +50,0 @@

@@ -13,2 +13,6 @@ 'use strict';

var _Encyclopedia = require('../modules/WorldOfWarplanes/Encyclopedia');
var _Encyclopedia2 = _interopRequireDefault(_Encyclopedia);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -36,3 +40,10 @@

return _possibleConstructorReturn(this, (WorldOfWarplanes.__proto__ || Object.getPrototypeOf(WorldOfWarplanes)).call(this, _extends({}, options, { type: 'wowp' })));
/**
* The client's Encyclopedia module.
* @type {Encyclopedia}
*/
var _this = _possibleConstructorReturn(this, (WorldOfWarplanes.__proto__ || Object.getPrototypeOf(WorldOfWarplanes)).call(this, _extends({}, options, { type: 'wowp' })));
_this.encyclopedia = new _Encyclopedia2.default(_this);
return _this;
}

@@ -39,0 +50,0 @@

@@ -13,2 +13,6 @@ 'use strict';

var _Encyclopedia = require('../modules/WorldOfWarships/Encyclopedia');
var _Encyclopedia2 = _interopRequireDefault(_Encyclopedia);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -36,3 +40,10 @@

return _possibleConstructorReturn(this, (WorldOfWarships.__proto__ || Object.getPrototypeOf(WorldOfWarships)).call(this, _extends({}, options, { type: 'wows' })));
/**
* The client's Encyclopedia module.
* @type {Encyclopedia}
*/
var _this = _possibleConstructorReturn(this, (WorldOfWarships.__proto__ || Object.getPrototypeOf(WorldOfWarships)).call(this, _extends({}, options, { type: 'wows' })));
_this.encyclopedia = new _Encyclopedia2.default(_this);
return _this;
}

@@ -39,0 +50,0 @@

@@ -33,3 +33,2 @@ 'use strict';

* @param {number} options.statusCode - The HTTP status code of the request.
* @param {string} options.url - The URL that the request was for.
*/

@@ -39,4 +38,3 @@ function RequestError(_ref) {

client = _ref.client,
statusCode = _ref.statusCode,
url = _ref.url;
statusCode = _ref.statusCode;

@@ -58,8 +56,2 @@ _classCallCheck(this, RequestError);

_this.statusCode = statusCode;
/**
* The URL of the request.
* @type {string}
*/
_this.url = url;
return _this;

@@ -66,0 +58,0 @@ }

@@ -7,4 +7,2 @@ 'use strict';

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

@@ -45,3 +43,2 @@

* returned token.
* @param {RequestOptions} [options={}] - The options for the request.
* @returns {Promise.<APIResponse, Error>} Returns the same value as a normal

@@ -58,16 +55,10 @@ * request if the client's access token is defined, else rejects with a

var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
if (!this.client.accessToken) {
return Promise.reject(new Error('Failed to renew access token: client\'s access token is not set.'));
}
return new Promise(function (resolve) {
if (!_this2.client.accessToken) {
throw new Error('Failed to renew access token: client\'s access token is not set.');
}
return this.client.post('auth/prolongate', {}, { type: this.client.type === 'wotx' ? 'wotx' : 'wot' }).then(function (response) {
_this2.client.accessToken = response.data.access_token;
resolve(_this2.client.post('auth/prolongate', {}, _extends({}, options, {
type: _this2.client.type === 'wotx' ? 'wotx' : 'wot'
})).then(function (response) {
_this2.client.accessToken = response.data.access_token;
return response;
}));
return response;
});

@@ -79,3 +70,2 @@ }

* request, the client's current access token will be set to `null`.
* @param {RequestOptions} [options={}] - The options for the request.
* @returns {Promise.<APIResponse, Error>} Returns the same value as a normal

@@ -91,16 +81,10 @@ * request if the client's access token is defined, else rejects with a

var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
if (!this.client.accessToken) {
return Promise.reject(new Error('Failed to invalidate access token: client\'s access token is not set.'));
}
return new Promise(function (resolve) {
if (!_this3.client.accessToken) {
throw new Error('Failed to invalidate access token: client\'s access token is not set.');
}
return this.client.post('auth/logout', {}, { type: this.client.type === 'wotx' ? 'wotx' : 'wot' }).then(function (response) {
_this3.client.accessToken = null;
resolve(_this3.client.post('auth/logout', {}, _extends({}, options, {
type: _this3.client.type === 'wotx' ? 'wotx' : 'wot'
})).then(function (response) {
_this3.client.accessToken = null;
return response;
}));
return response;
});

@@ -107,0 +91,0 @@ }

@@ -13,3 +13,2 @@ 'use strict';

* @param {string} params.slug - The slug being localized.
* @param {RequestOptions} [params.options={}] - The options for the request.
* @returns {Promise.<(string|undefined), Error>} Promise resolving to the

@@ -23,7 +22,5 @@ * translated slug, or `undefined` if it couldn't be translated.

type = _ref.type,
slug = _ref.slug,
_ref$options = _ref.options,
options = _ref$options === undefined ? {} : _ref$options;
slug = _ref.slug;
return this.client.get(method, {}, options).then(function (response) {
return this.client.get(method, {}).then(function (response) {
var translations = response.data[type];

@@ -30,0 +27,0 @@

@@ -43,3 +43,2 @@ 'use strict';

* @param {string} [searchType='exact'] - The search type to use.
* @param {RequestOptions} [options={}] - The options for the request.
* @returns {Promise.<(Array.<Object>|number|null), Error>} A promise resolving

@@ -57,21 +56,16 @@ * to the returned search results.

value: function findPlayerId(name) {
var _this2 = this;
var searchType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'exact';
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
return new Promise(function (resolve) {
switch (searchType.toLowerCase()) {
case 'startswith':
return resolve(_this2.client.get('account/list', { search: name }, options).then(function (response) {
return response.data;
}));
case 'exact':
return resolve(_this2.client.get('account/list', { search: name }, options).then(function (response) {
return response.data[0] ? response.data[0].account_id : null;
}));
default:
throw new Error('Invalid search type specified for player search.');
}
});
switch (searchType.toLowerCase()) {
case 'startswith':
return this.client.get('account/list', { search: name }).then(function (response) {
return response.data;
});
case 'exact':
return this.client.get('account/list', { search: name }).then(function (response) {
return response.data[0] ? response.data[0].account_id : null;
});
default:
return Promise.reject(new Error('Invalid search type specified for player search.'));
}
}

@@ -78,0 +72,0 @@ }]);

@@ -7,3 +7,3 @@ 'use strict';

var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

@@ -20,2 +20,10 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _encyclopediaSearch = require('../mixins/encyclopediaSearch');
var _encyclopediaSearch2 = _interopRequireDefault(_encyclopediaSearch);
var _extractTopModules = require('../mixins/extractTopModules');
var _extractTopModules2 = _interopRequireDefault(_extractTopModules);
var _localize = require('../mixins/localize');

@@ -27,4 +35,2 @@

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -57,2 +63,9 @@

_this.MODULE_ID_FIELDS = {
vehicleChassis: 'suspension_id',
vehicleEngine: 'engine_id',
vehicleGun: 'gun_id',
vehicleRadio: 'radio_id',
vehicleTurret: 'turret_id'
};
_this.fuse = new _fuse2.default([], {

@@ -68,6 +81,6 @@ keys: ['name', 'short_name']

* @param {(number|string)} identifier - The vehicle identifier to use for
* lookup. If a number is supplied, it is treated as the vehicle's ID.
* If a string is supplied, the identifier is matched against vehicle names
* lookup.
* If a number is supplied, it is treated as the vehicle's ID.
* If a string is supplied, the identifier is matched against vehicle names
* with the closest match being selected.
* @param {RequestOptions} [options={}] - The options for the request.
* @returns {Promise.<?Object, Error>} A promise resolving to the data for the

@@ -77,41 +90,68 @@ * matched vehicle, or `null` if no vehicles were matched.

/**
* Mapping between module types and their ID field names.
* @type {Object}
* @const
* @private
*/
_createClass(Tankopedia, [{
key: 'findVehicle',
value: function findVehicle(identifier) {
return _encyclopediaSearch2.default.call(this, {
identifier,
indexEndpoint: 'encyclopedia/vehicles',
dataEndpoint: 'encyclopedia/vehicles',
identifierKey: 'tank_id',
fuse: this.fuse,
searchFields: ['name', 'short_name']
});
}
/**
* Returns the vehicle profile for a given vehicle.
* @param {number} vehicleId - The vehicle ID to use for lookup.
* @param {string} [profile='stock'] - The vehicle profile to lookup. Can be
* a profile ID, or one of `'stock'` or `'top'`. The top configuration is
* determined by picking the most expensive modules to research in the
* vehicle's research tree.
* @returns {Promise.<Object, Error>} A promise resolving to the data for the
* matched vehicle profile.
*/
}, {
key: 'findVehicleProfile',
value: function findVehicleProfile(vehicleId) {
var _this2 = this;
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var profile = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'stock';
return new Promise(function (resolve) {
if (typeof identifier === 'number') {
resolve(_this2.client.get('encyclopedia/vehicles', { tank_id: identifier }, options).then(function (response) {
return response.data[identifier];
}));
} else if (typeof identifier === 'string') {
resolve(_this2.client.get('encyclopedia/vehicles', {
fields: ['name', 'short_name', 'tank_id']
}, options).then(function (response) {
var vehicles = response.data;
if (profile === 'stock') {
return this.client.get('encyclopedia/vehicleprofile', { tank_id: vehicleId }).then(function (response) {
return response.data[vehicleId];
});
} else if (profile === 'top') {
return this.findVehicle(vehicleId).then(function (vehicleData) {
if (!vehicleData) {
return null;
}
_this2.fuse.set(Object.keys(vehicles).reduce(function (accumulated, next) {
return [].concat(_toConsumableArray(accumulated), [vehicles[next]]);
}, []));
var topModules = (0, _extractTopModules2.default)(vehicleData.modules_tree);
var queryFields = Object.keys(topModules).reduce(function (accumulated, next) {
var fieldName = _this2.MODULE_ID_FIELDS[next];
var results = _this2.fuse.search(identifier);
accumulated[fieldName] = topModules[next].module_id; // eslint-disable-line no-param-reassign, max-len
if (!results.length) {
return null;
}
return accumulated;
}, {});
var _results = _slicedToArray(results, 1),
tank_id = _results[0].tank_id;
return _this2.client.get('encyclopedia/vehicleprofile', _extends({}, queryFields, { tank_id: vehicleId })).then(function (response) {
return response.data[vehicleId];
});
});
}
return _this2.client.get('encyclopedia/vehicles', { tank_id }, options).then(function (detailedResponse) {
return detailedResponse.data[tank_id];
});
}));
}
throw new TypeError('Expected a string or number as the vehicle identifier.');
return this.client.get('encyclopedia/vehicleprofile', { tank_id: vehicleId, profile_id: profile }).then(function (response) {
return response.data[vehicleId];
});

@@ -123,3 +163,2 @@ }

* @param {string} slug - The slug.
* @param {RequestOptions} [options={}] - The options for the request.
* @returns {Promise.<(string|undefined), Error>} Promise resolving to the

@@ -132,9 +171,6 @@ * translated slug, or `undefined` if it couldn't be translated.

value: function localizeCrewRole(slug) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return _localize2.default.call(this, {
method: 'encyclopedia/info',
type: 'vehicle_crew_roles',
slug,
options
slug
});

@@ -146,3 +182,2 @@ }

* @param {string} slug - The slug.
* @param {RequestOptions} [options={}] - The options for the request.
* @returns {Promise.<(string|undefined), Error>} Promise resolving to the

@@ -155,9 +190,6 @@ * translated slug, or `undefined` if it couldn't be translated.

value: function localizeLanguage(slug) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return _localize2.default.call(this, {
method: 'encyclopedia/info',
type: 'languages',
slug,
options
slug
});

@@ -170,3 +202,2 @@ }

* @param {string} slug - The slug.
* @param {RequestOptions} [options={}] - The options for the request.
* @returns {Promise.<(string|undefined), Error>} Promise resolving to the

@@ -179,9 +210,6 @@ * translated slug, or `undefined` if it couldn't be translated.

value: function localizeAchievementSection(slug) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return _localize2.default.call(this, {
method: 'encyclopedia/info',
type: 'achievement_sections',
slug,
options
slug
}).then(function (section) {

@@ -195,3 +223,2 @@ return section && section.name;

* @param {string} slug - The slug.
* @param {RequestOptions} [options={}] - The options for the request.
* @returns {Promise.<(string|undefined), Error>} Promise resolving to the

@@ -204,9 +231,6 @@ * translated slug, or `undefined` if it couldn't be translated.

value: function localizeVehicleType(slug) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return _localize2.default.call(this, {
method: 'encyclopedia/info',
type: 'vehicle_types',
slug,
options
slug
});

@@ -218,3 +242,2 @@ }

* @param {string} slug - The slug.
* @param {RequestOptions} [options={}] - The options for the request.
* @returns {Promise.<(string|undefined), Error>} Promise resolving to the

@@ -227,9 +250,6 @@ * translated slug, or `undefined` if it couldn't be translated.

value: function localizeVehicleNation(slug) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return _localize2.default.call(this, {
method: 'encyclopedia/info',
type: 'vehicle_nations',
slug,
options
slug
});

@@ -236,0 +256,0 @@ }

@@ -23,3 +23,3 @@ "use strict";

return keys.reduce(function (mapped, nextKey) {
mapped[nextKey] = callback(object[nextKey], nextKey, object); // eslint-disable-line
mapped[nextKey] = callback(object[nextKey], nextKey, object); // eslint-disable-line no-param-reassign, max-len

@@ -26,0 +26,0 @@ return mapped;

{
"name": "wargamer",
"version": "0.3.1",
"version": "0.4.0",
"description": "Node.js client library for the Wargaming.net API.",

@@ -58,2 +58,3 @@ "keywords": [

"babel-loader": "^6.2.10",
"babel-plugin-transform-class-properties": "^6.22.0",
"babel-plugin-transform-object-rest-spread": "^6.20.2",

@@ -60,0 +61,0 @@ "babel-preset-env": "^1.1.4",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc