diff --git a/Guide.md b/Guide.md new file mode 100644 index 00000000..a3a22a4a --- /dev/null +++ b/Guide.md @@ -0,0 +1,83 @@ +# Guide + +Please read guide at [docs](https://azurapi.github.io/v2/). + +This document is provided for convenience only, and may not be up to date. + +> Latest: 1.1.0 +> Guide: 0.1.0 + +## General + +### Create a new AzurAPI class +```js +const client = new AzurAPI(/* options [optional]: { source (data source) [default = "local"]: "uncached" | "local", autoupdate (fetch new data or not) [default = true]: boolean, rate (rate of fetching new data) [default = 3600000]: number } */); +``` + +### Update the data +```js +.updater.update(); +``` + +## Data accessor classes +```js +.ships +.equipments +.chapters +.voicelines +.barrages +``` + +> Note: All functions in accessor classes return arrays. + +## Base API + +### Search fuse +```js +..fuze(/* name: string */); +``` + +### Get by id +```js +..id(/* id: string */); +``` + +### Get by search query +```js +..get(/* query: string */); +``` + +### Perform a filter operation +```js +..filter(/* predicate: function */); +``` + +### Perform a map operation +```js +..map(/* callbackfn: function */); +``` + +### Perform a forEach operation +```js +..forEach(/* callbackfn: function */); +``` + +### Perform an every operation +```js +..every(/* predicate: function */); +``` + +### Perform a some operation +```js +..some(/* predicate: function */); +``` + +## Extentions - Ships + +### Get ship by name/language +.ships.name(/* name: string, language: 'en' | 'cn' | 'jp' | 'kr' */); + +.ships.hull(/* name: string */); +``` + +> TODO: Rattley will write the rest later \ No newline at end of file diff --git a/README.md b/README.md index 79b91028..e4e2a287 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,13 @@ To use the Library, Please refer to the [Docs](https://azurapi.github.io/v2/). For advanced users or package developers, please refer to [TSDoc](https://azurapi.github.io/azurapi-js/). -## Support Server +## Breaking Changes + +### 1.1.0 + - All functions from accessors after verion 1.1.0 return arrays. + - Bundles are now built with typescript version 4.5.5 + +## Discord Support Server [![](https://discordapp.com/api/guilds/648206344729526272/widget.png?style=banner2)](https://discord.gg/aAEdys8) diff --git a/bundles/azurapi.js b/bundles/azurapi.js index c791faa3..c6b481fb 100644 --- a/bundles/azurapi.js +++ b/bundles/azurapi.js @@ -9482,9 +9482,10 @@ class API { /** * Get by any * @param query Any + * @returns Array */ get(query) { - return this.id(query) || this.fuze(query)?.map(s => s.item)[0]; + return this.id(query) || this.fuze(query)?.map(s => s.item); } /** * Returns the elements of an array that meet the condition specified in a callback function. @@ -9573,10 +9574,7 @@ class Barrages extends api_1.default { * @param name Barrage name */ name(name) { - for (let barrage of this.raw) - if ((0, api_1.normalize)(barrage.name.toUpperCase()) === (0, api_1.normalize)(name.toUpperCase())) - return barrage; - return undefined; + return this.raw.filter(barrage => (0, api_1.normalize)(barrage.name.toUpperCase()) === (0, api_1.normalize)(name.toUpperCase())); } /** * Get barrage by type @@ -9643,13 +9641,18 @@ class Chapters extends api_1.default { * @param languages Language to search */ name(name, languages = ['en', 'cn', 'jp']) { - for (let chapter of this.raw) + let result = []; + for (let chapter of this.raw) { if (languages.some(lang => chapter.names[lang] && (0, api_1.normalize)(chapter.names[lang].toUpperCase()) === (0, api_1.normalize)(name.toUpperCase()))) - return chapter; - /*for (let chapter of this.raw) { - for (let sub of chapter) if (languages.some(lang => sub.names[lang] && normalize(sub.names[lang].toUpperCase()) === normalize(name.toUpperCase()))) return sub; - }*/ - return undefined; + result.push(chapter); + for (let sub of Object.values(chapter)) { + if (sub.names !== undefined) { + if (languages.some(lang => sub.names[lang] && (0, api_1.normalize)(sub.names[lang].toUpperCase()) === (0, api_1.normalize)(name.toUpperCase()))) + result.push(sub); + } + } + } + return result; } } exports.Chapters = Chapters; @@ -9695,57 +9698,30 @@ class Equipments extends api_1.default { * @param languages Language to search */ name(name, languages = ['en', 'cn', 'jp', 'kr']) { - for (let equipment of this.raw) - if (languages.some(lang => equipment.names[lang] && (0, api_1.normalize)(equipment.names[lang].toUpperCase()) === (0, api_1.normalize)(name.toUpperCase()))) - return equipment; - return undefined; + return this.raw.filter(equipment => languages.some(lang => equipment.names[lang] && (0, api_1.normalize)(equipment.names[lang].toUpperCase()) === (0, api_1.normalize)(name.toUpperCase()))); } /** * Lists the equipments by category * @param category name of the category you want to search for */ category(category) { - let results = []; - for (let equipment of this.raw) - if ((0, api_1.normalize)(equipment.category.toUpperCase() === (0, api_1.normalize)(category.toUpperCase()))) - results.push(equipment); - return results; + return this.raw.filter(equipment => (0, api_1.normalize)(equipment.category.toUpperCase() === (0, api_1.normalize)(category.toUpperCase()))); } /** * Lists the equipments by nationality * @param nationality naitionality name of the equipments you want to search for */ nationality(nationality) { - let results = []; nationality = Object.keys(api_1.NATIONS).find(key => api_1.NATIONS[key].includes(nationality.toLowerCase())) || nationality; - for (let equipment of this.raw) - if ((0, api_1.normalize)(equipment.nationality.toUpperCase()) === (0, api_1.normalize)(nationality.toUpperCase())) - results.push(equipment); - return results; - } - _nameAll(name, languages = ['en', 'cn', 'jp', 'kr']) { - return this.raw.filter(equipment => languages.some(lang => equipment.names[lang] && (0, api_1.normalize)(equipment.names[lang].toUpperCase()) === (0, api_1.normalize)(name.toUpperCase()))); + return this.raw.filter(equipment => (0, api_1.normalize)(equipment.nationality.toUpperCase()) === (0, api_1.normalize)(nationality.toUpperCase())); } /** * Get equipment using name in any language or id * @param query Equipment name in any language or equipment id */ - get(query, adv) { - if (adv) { - if (adv.idOnly) { - return this.id(query); - } - else if (adv.nameOnly || adv.nameOnly && !adv.language) { - return this.name(query); - } - else if (adv.nameOnly && adv.language) { - return this.name(query, [adv.language]); - } - } - else { - let fuzeResult = this.fuze(query).sort((a, b) => (b.score || 0) - (a.score || 0))[0]; - return this.id(query) || this.name(query) || (fuzeResult ? fuzeResult.item : undefined); - } + get(query) { + let fuzeResult = this.fuze(query).sort((a, b) => (b.score || 0) - (a.score || 0))[0]; + return this.id(query) || this.name(query) || (fuzeResult ? fuzeResult.item : undefined); } /** * Get equipment using everything @@ -9754,7 +9730,7 @@ class Equipments extends api_1.default { all(query) { let results = []; results.push(this.id(query)); - results.push(...this._nameAll(query).filter(i => i)); + results.push(...this.name(query).filter(i => i)); results.push(...this.fuze(query).map(i => i.item)); return results .filter((value) => value !== null && value !== undefined) @@ -9804,10 +9780,7 @@ class Ships extends api_1.default { * @param languages Language to search */ name(name, languages = ['en', 'cn', 'jp', 'kr']) { - for (let ship of this.raw) - if (languages.some(lang => ship.names[lang] && (0, api_1.normalize)(ship.names[lang].toUpperCase()) === (0, api_1.normalize)(name.toUpperCase()))) - return ship; - return undefined; + return this.raw.filter(ship => languages.some(lang => ship.names[lang] && (0, api_1.normalize)(ship.names[lang].toUpperCase()) === (0, api_1.normalize)(name.toUpperCase()))); } /** * Get ship by hull @@ -9829,29 +9802,13 @@ class Ships extends api_1.default { results.push(ship); return results; } - _nameAll(name, languages = ['en', 'cn', 'jp', 'kr']) { - return this.raw.filter(ship => languages.some(lang => ship.names[lang] && (0, api_1.normalize)(ship.names[lang].toUpperCase()) === (0, api_1.normalize)(name.toUpperCase()))); - } /** * Get ship using name in any language or id * @param query Ship name in any language or ship id */ - get(query, adv) { - if (adv) { - if (adv.idOnly) { - return this.id(query); - } - else if (adv.nameOnly || adv.nameOnly && !adv.language) { - return this.name(query); - } - else if (adv.nameOnly && adv.language) { - return this.name(query, [adv.language]); - } - } - else { - let fuzeResult = this.fuze(query).sort((a, b) => (b.score || 0) - (a.score || 0))[0]; - return this.id(query) || this.name(query) || (fuzeResult ? fuzeResult.item : undefined); - } + get(query) { + let fuzeResult = this.fuze(query).sort((a, b) => (b.score || 0) - (a.score || 0))[0]; + return this.id(query) || this.name(query)[0] || (fuzeResult ? fuzeResult.item : undefined); } /** * Get ship using everything @@ -9860,7 +9817,7 @@ class Ships extends api_1.default { all(query) { let results = []; results.push(this.id(query)); - results.push(...this._nameAll(query).filter(i => i)); + results.push(...this.name(query).filter(i => i)); results.push(...this.fuze(query).map(i => i.item)); return results .filter((value) => value !== null && value !== undefined) @@ -12163,4 +12120,4 @@ Fuse.config = Config; module.exports = Fuse; },{}]},{},[51]) -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL0FwcERh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FNsYXNoSW5kZXggPT09IC0xKSB7XG4gICAgICAgICAgICAgICAgcmVzID0gJyc7XG4gICAgICAgICAgICAgICAgbGFzdFNlZ21lbnRMZW5ndGggPSAwO1xuICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHJlcyA9IHJlcy5zbGljZSgwLCBsYXN0U2xhc2hJbmRleCk7XG4gICAgICAgICAgICAgICAgbGFzdFNlZ21lbnRMZW5ndGggPSByZXMubGVuZ3RoIC0gMSAtIHJlcy5sYXN0SW5kZXhPZignLycpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIGxhc3RTbGFzaCA9IGk7XG4gICAgICAgICAgICAgIGRvdHMgPSAwO1xuICAgICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9IGVsc2UgaWYgKHJlcy5sZW5ndGggPT09IDIgfHwgcmVzLmxlbmd0aCA9PT0gMSkge1xuICAgICAgICAgICAgcmVzID0gJyc7XG4gICAgICAgICAgICBsYXN0U2VnbWVudExlbmd0aCA9IDA7XG4gICAgICAgICAgICBsYXN0U2xhc2ggPSBpO1xuICAgICAgICAgICAgZG90cyA9IDA7XG4gICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGFsbG93QWJvdmVSb290KSB7XG4gICAgICAgICAgaWYgKHJlcy5sZW5ndGggPiAwKVxuICAgICAgICAgICAgcmVzICs9ICcvLi4nO1xuICAgICAgICAgIGVsc2VcbiAgICAgICAgICAgIHJlcyA9ICcuLic7XG4gICAgICAgICAgbGFzdFNlZ21lbnRMZW5ndGggPSAyO1xuICAgICAgICB9XG4gICAgICB9IGVsc2Uge1xuICAgICAgICBpZiAocmVzLmxlbmd0aCA+IDApXG4gICAgICAgICAgcmVzICs9ICcvJyArIHBhdGguc2xpY2UobGFzdFNsYXNoICsgMSwgaSk7XG4gICAgICAgIGVsc2VcbiAgICAgICAgICByZXMgPS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gICAgICAgICAgLy8gRm9yIGV4YW1wbGU6IGZyb209Jy8nOyB0bz0nL2ZvbydcbiAgICAgICAgICAgIHJldHVybiB0by5zbGljZSh0b1N0YXJ0ICsgaSk7XG4gICAgICAgICAgfVxuICAgICAgICB9IGVsc2UgaWYgKGZyb21MZW4gPiBsZW5ndGgpIHtcbiAgICAgICAgICBpZiAoZnJvbS5jaGFyQ29kZUF0KGZyb21TdGFydCArIGkpID09PSA0NyAvKi8qLykge1xuICAgICAgICAgICAgLy8gV2UgZ2V0IGhlcmUgaWYgYHRvYCBpcyB0aGUgZXhhY3QgYmFzZSBwYXRoIGZvciBgZnJvbWAuXG4gICAgICAgICAgICAvLyBGb3IgZXhhbXBsZTogZnJvbT0nL2Zvby9iYXIvYmF6JzsgdG89Jy9mb28vYmFyJ1xuICAgICAgICAgICAgbGFzdENvbW1vblNlcCA9IGk7XG4gICAgICAgICAgfSBlbHNlIGlmIChpID09PSAwKSB7XG4gICAgICAgICAgICAvLyBXZSBnZXQgaGVyZSBpZiBgdG9gIGlzIHRoZSByb290LlxuICAgICAgICAgICAgLy8gRm9yIGV4YW1wbGU6IGZyb209Jy9mb28nOyB0bz0nLydcbiAgICAgICAgICAgIGxhc3RDb21tb25TZXAgPSAwO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBicmVhaztcbiAgICAgIH1cbiAgICAgIHZhciBmcm9tQ29kZSA9IGZyb20uY2hhckNvZGVBdChmcm9tU3RhcnQgKyBpKTtcbiAgICAgIHZhciB0b0NvZGUgPSB0by5jaGFyQ29kZUF0KHRvU3RhcnQgKyBpKTtcbiAgICAgIGlmIChmcm9tQ29kZSAhPT0gdG9Db2RlKVxuICAgICAgICBicmVhaztcbiAgICAgIGVsc2UgaWYgKGZyb21Db2RlID09PSA0NyAvKi8qLylcbiAgICAgICAgbGFzdENvbW1vblNlcCA9IGk7XG4gICAgfVxuXG4gICAgdmFyIG91dCA9ICcnO1xuICAgIC8vIEdlbmVyYXRlIHRoZ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fSwge1xuICAgIGtleTogXCJfZ2V0U3RyaW5nXCIsXG4gICAgdmFsdWU6IGZ1bmN0aW9uIF9nZXRTdHJpbmcobikge1xuICAgICAgdmFyIHAgPSB0aGlzLmhlYWQ7XG4gICAgICB2YXIgYyA9IDE7XG4gICAgICB2YXIgcmV0ID0gcC5kYXRhO1xuICAgICAgbiAtPSByZXQubGVuZ3RoO1xuXG4gICAgICB3aGlsZSAocCA9IHAubmV4dCkge1xuICAgICAgICB2YXIgc3RyID0gcC5kYXRhO1xuICAgICAgICB2YXIgbmIgPSBuID4gc3RyLmxlbmd0aCA/IHN0ci5sZW5ndGggOiBuO1xuICAgICAgICBpZiAobmIgPT09IHN0ci5sZW5ndGgpIHJldCArPSBzdHI7ZWxzZSByZXQgKz0gc3RyLnNsaWNlKDAsIG4pO1xuICAgICAgICBuIC09IG5iO1xuXG4gICAgICAgIGlmIChuID09PSAwKSB7XG4gICAgICAgICAgaWYgKG5iID09PSBzdHIubGVuZ3RoKSB7XG4gICAgICAgICAgICArK2M7XG4gICAgICAgICAgICBpZiAocC5uZXh0KSB0aGlzLmhlYWQgPSBwLm5leHQ7ZWxzZSB0aGlzLmhlYWQgPSB0aGlzLnRhaWwgPSBudWxsO1xuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICB0aGlzLmhlYWQgPSBwO1xuICAgICAgICAgICAgcC5kYXRhID0gc3RyLnNsaWNlKG5iKTtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBicmVhaztcbiAgICAgICAgfVxuXG4gICAgICAgICsrYztcbiAgICAgIH1cblxuICAgICAgdGhpcy5sZW5ndGggLT0gYztcbiAgICAgIHJldHVybiByZXQ7XG4gICAgfSAvLyBDb25zdW1lcyBhIHNwZWNpZmllZCBhbW91bnQgb2YgYnl0ZXMgZnJvbSB0aGUgYnVmZmVyZWQgZGF0YS5cblxuICB9LCB7XG4gICAga2V5OiBcIl9nZXRCdWZmZXJcIixcbiAgICB2YWx1ZTogZnVuY3Rpb24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xuICAgIH1cclxuICAgIC8qKlxyXG4gICAgICogU3RvcCBjcm9uIGpvYlxyXG4gICAgICovXHJcbiAgICBzdG9wKCkge1xyXG4gICAgICAgIGlmICh0aGlzLmNyb24pXHJcbiAgICAgICAgICAgIGNsZWFySW50ZXJ2YWwodGhpcy5jcm9uKTtcclxuICAgICAgICB0aGlzLmNyb24gPSB1bmRlZmluZWQ7XHJcbiAgICB9XHJcbiAgICAvKipcclxuICAgICAqIENoZWNrIGlmIGZvbGRlciBhbmQgSlNPTiBmaWxlcyBleGlzdCB0aGVuIGxvYWQgY2FjaGVcclxuICAgICAqL1xyXG4gICAgYXN5bmMgaW5pdCgpIHtcclxuICAgICAgICBpZiAoIWZzXzEuZGVmYXVsdC5leGlzdHNTeW5jKERhdGFfMS5iYXNlRm9sZGVyKSlcclxuICAgICAgICAgICAgZnNfMS5kZWZhdWx0Lm1rZGlyU3luYyhEYXRhXzEuYmFzZUZvbGRlcik7XHJcbiAgICAgICAgYXdhaXQgdGhpcy5sb2FkKCk7XHJcbiAgICAgICAgdGhpcy5jbGllbnQuZW1pdCgncmVhZHknKTtcclxuICAgIH1cclxuICAgIC8qKlxyXG4gICAgICogTG9hZCB0aGUgY2FjaGVcclxuICAgICAqL1xyXG4gICAgbG9hZCgpIHtcclxuICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IE9iamVjdC5rZXlzKERhdGFfMS5sb2NhbCkubGVuZ3RoOyBpKyspIHtcclxuICAgICAgICAgICAgbGV0IGtleSA9IE9iamVjdC5rZXlzKERhdGFfMS5sb2NhbClbaV07XHJcbiAgICAgICAgICAgIGlmICghZnNfMS5kZWZhdWx0LmV4aXN0c1N5bmMoRGF0YV8xLmxvY2FsW2tleV0pKVxyXG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMudXBkYXRlKCk7XHJcbiAgICAgICAgICAgIHRoaXMuY2xpZW50LnNldChrZXksIE9iamVjdC52YWx1ZXMoSlNPTi5wYXJzZShmc18xLmRlZmF1bH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lLmxvZyhrZXkpXG4gICAgICAgIHZhciB2YWx1ZSA9IF90aGlzMy5nZXRGbihkb2MsIGtleS5wYXRoKTtcblxuICAgICAgICBpZiAoIWlzRGVmaW5lZCh2YWx1ZSkpIHtcbiAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoaXNBcnJheSh2YWx1ZSkpIHtcbiAgICAgICAgICAoZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgdmFyIHN1YlJlY29yZHMgPSBbXTtcbiAgICAgICAgICAgIHZhciBzdGFjayA9IFt7XG4gICAgICAgICAgICAgIG5lc3RlZEFyckluZGV4OiAtMSxcbiAgICAgICAgICAgICAgdmFsdWU6IHZhbHVlXG4gICAgICAgICAgICB9XTtcblxuICAgICAgICAgICAgd2hpbGUgKHN0YWNrLmxlbmd0aCkge1xuICAgICAgICAgICAgICB2YXIgX3N0YWNrJHBvcCA9IHN0YWNrLnBvcCgpLFxuICAgICAgICAgICAgICAgICAgbmVzdGVkQXJySW5kZXggPSBfc3RhY2skcG9wLm5lc3RlZEFyckluZGV4LFxuICAgICAgICAgICAgICAgICAgX3ZhbHVlID0gX3N0YWNrJHBvcC52YWx1ZTtcblxuICAgICAgICAgICAgICBpZiAoIWlzRGVmaW5lZChfdmFsdWUpKSB7XG4gICAgICAgICAgICAgICAgY29udGludWU7XG4gICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICBpZiAoaXNTdHJpbmcoX3ZhbHVlKSAmJiAhaXNCbGFuayhfdmFsdWUpKSB7XG4gICAgICAgICAgICAgICAgdmFyIHN1YlJlY29yZCA9IHtcbiAgICAgICAgICAgICAgICAgIHY6IF92YWx1ZSxcbiAgICAgICAgICAgICAgICAgIGk6IG5lc3RlZEFyckluZGV4LFxuICAgICAgICAgICAgICAgICAgbjogX3RoaXMzLm5vcm0uZ2V0KF92YWx1ZSlcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIHN1YlJlY29yZHMucHVzaChzdWJSZWNvcmQpO1xuICAgICAgICAgICAgICB9IGVsc2UgaWYgKGlzQXJyYXkoX3ZhbHVlKSkge1xuICAgICAgICAgICAgICAgIF92YWx1ZS5mb3JFYWNoKGZ1bmN0aW9uIChpdGVtLCBrKSB7XG4gICAgICAgICAgICAgICAgICBzdGFjay5wdXNoKHtcbiAgICAgICAgICAgICAgICAgICAgbmVzdGVkQXJySW5kZXg6IGssXG4gICAgICAgICAgICAgICAgICAgIHZhbHVlOiBpdGVtXG4gICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZWNvcmQuJFtrZXlJbmRleF0gPSBzdWJSZWNvcmRzO1xuICAgICAgICAgIH0pKCk7XG4gICAgICAgIH0gZWxzZSBpZiAoIWlzQmxhbmsodmFsdWUpKSB7XG4gICAgICAgICAgdmFyIHN1YlJlY29yZCA9IHtcbiAgICAgICAgICAgIHY6IHZhbHVlLFxuICAgICAgICAgICAgbjogX3RoaXMzLm5vcm0uZ2V0KHZhbHVlKVxuICAgICAgICAgIH07XG4gICAgICAgICAgcmVjb3JkLiRba2V5SW5kZXhdID0gc3ViUmVjb3JkO1xuICAgICAgICB9XG4gICAgICB9KTtcbiAgICAgIHRoaXMucmVjb3Jkcy5wdXNoKHJlY29yZCk7XG4gICAgfVxuICB9LCB7XG4gICAga2V5OiBcInRvSlNPTlwiLFxuICAgIHZhbHVlOiBmdW5jdGlvbiB0b0pTT04oKSB7XG4gICAgICByZXR1cm4ge1xuICAgICAgICBrZXlzOiB0aGlzLmtleXMsXG4gICAgICAgIHJlY29yZHM6IHRoaXMucmVjb3Jkc1xuICAgICAgfTtcbiAgICB9XG4gIH1dKTtcblxuICByZXR1cm4gRnVzZUluZGV4O1xufSgpO1xuZnVuY3Rpb24gY3JlYXRlSW5kZXgoa2V5cywgZG9jcykge1xuICB2YXIgX3JlZjIgPSBhcmd1bWVudHMubGVuZ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SBbXS5jb25jYXQoX3RvQ29uc3VtYWJsZUFycmF5KGFsbEluZGljZXMpLCBfdG9Db25zdW1hYmxlQXJyYXkoaW5kaWNlcykpO1xuICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGFsbEluZGljZXMucHVzaChpbmRpY2VzKTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICB0b3RhbFNjb3JlID0gMDtcbiAgICAgICAgICAgIG51bU1hdGNoZXMgPSAwO1xuICAgICAgICAgICAgYWxsSW5kaWNlcy5sZW5ndGggPSAwO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuICAgICAgICB9IC8vIE9SIGNvbmRpdGlvbiwgc28gaWYgVFJVRSwgcmV0dXJuXG5cblxuICAgICAgICBpZiAobnVtTWF0Y2hlcykge1xuICAgICAgICAgIHZhciByZXN1bHQgPSB7XG4gICAgICAgICAgICBpc01hdGNoOiB0cnVlLFxuICAgICAgICAgICAgc2NvcmU6IHRvdGFsU2NvcmUgLyBudW1NYXRjaGVzXG4gICAgICAgICAgfTtcblxuICAgICAgICAgIGlmIChpbmNsdWRlTWF0Y2hlcykge1xuICAgICAgICAgICAgcmVzdWx0LmluZGljZXMgPSBhbGxJbmRpY2VzO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgICAgIH1cbiAgICAgIH0gLy8gTm90aGluZyB3YXMgbWF0Y2hlZFxuXG5cbiAgICAgIHJldHVybiB7XG4gICAgICAgIGlzTWF0Y2g6IGZhbHNlLFxuICAgICAgICBzY29yZTogMVxuICAgICAgfTtcbiAgICB9XG4gIH1dLCBbe1xuICAgIGtleTogXCJjb25kaXRpb25cIixcbiAgICB2YWx1ZTogZnVuY3Rpb24gY29uZGl0aW9uKF8sIG9wdGlvbnMpIHtcbiAgICAgIHJldHVybiBvcHRpb25zLnVzZUV4dGVuZGVkU2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gaWR4ID0gX3JlZjIuaSxcbiAgICAgICAgICAgIG5vcm0gPSBfcmVmMi5uO1xuXG4gICAgICAgIGlmICghaXNEZWZpbmVkKHRleHQpKSB7XG4gICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG5cbiAgICAgICAgdmFyIF9zZWFyY2hlciRzZWFyY2hJbiA9IHNlYXJjaGVyLnNlYXJjaEluKHRleHQpLFxuICAgICAgICAgICAgaXNNYXRjaCA9IF9zZWFyY2hlciRzZWFyY2hJbi5pc01hdGNoLFxuICAgICAgICAgICAgc2NvcmUgPSBfc2VhcmNoZXIkc2VhcmNoSW4uc2NvcmUsXG4gICAgICAgICAgICBpbmRpY2VzID0gX3NlYXJjaGVyJHNlYXJjaEluLmluZGljZXM7XG5cbiAgICAgICAgaWYgKGlzTWF0Y2gpIHtcbiAgICAgICAgICByZXN1bHRzLnB1c2goe1xuICAgICAgICAgICAgaXRlbTogdGV4dCxcbiAgICAgICAgICAgIGlkeDogaWR4LFxuICAgICAgICAgICAgbWF0Y2hlczogW3tcbiAgICAgICAgICAgICAgc2NvcmU6IHNjb3JlLFxuICAgICAgICAgICAgICB2YWx1ZTogdGV4dCxcbiAgICAgICAgICAgICAgbm9ybTogbm9ybSxcbiAgICAgICAgICAgICAgaW5kaWNlczogaW5kaWNlc1xuICAgICAgICAgICAgfV1cbiAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgfSk7XG4gICAgICByZXR1cm4gcmVzdWx0cztcbiAgICB9XG4gIH0sIHtcbiAgICBrZXk6IFwiX3NlYXJjaExvZ2ljYWxcIixcbiAgICB2YWx1ZTogZnVuY3Rpb24gX3NlYXJjaExvZ2ljYWwocXVlcnkpIHtcbiAgICAgIHZhciBfdGhpcyA9IHRoaXM7XG5cbiAgICAgIHZhciBleHByZXNzaW9uID0gcGFyc2UocXVlcnksIHRoaXMub3B0aW9ucyk7XG5cbiAgICAgIHZhciBldmFsdWF0ZSA9IGZ1bmN0aW9uIGV2YWx1YXRlKG5vZGUsIGl0ZW0sIGlkeCkge1xuICAgICAgICBpZiAoIW5vZGUuY2hpbGRyZW4pIHtcbiAgICAgICAgICB2YXIga2V5SWQgPSBub2RlLmtleUlkLFxuICAgICAgICAgICAgICBzZWFyY2hlciA9IG5vZGUuc2VhcmNoZXI7XG5cbiAgICAgICAgICB2YXIgbWF0Y2hlcyA9IF90aGlzLl9maW5kTWF0Y2hlcyh7XG4gICAgICAgICAgICBrZXk6IF90aGlzLl9rZXlTdG9yZS5nZXQoa2V5SWQpLFxuICAgICAgICAgICAgdmFsdWU6IF90aGlzLl9teUluZGV4LmdldFZhbHVlRm9ySXRlbUF0S2V5SWQoaXRlbSwga2V5SWQpLFxuICAgICAgICAgICAgc2VhcmNoZXI6IHNlYXJjaGVyXG4gICAgICAgICAgfSk7XG5cbiAgICAgICAgICBpZiAobWF0Y2hlcyAmJiBtYXRjaGVzLmxlbmd0aCkge1xuICAgICAgICAgICAgcmV0dXJuIFt7XG4gICAgICAgICAgICAgIGlkeDogaWR4LFxuICAgICAgICAgICAgICBpdGVtOiBpdGVtLFxuICAgICAgICAgICAgICBtYXRjaGVzOiBtYXRjaGVzXG4gICAgICAgICAgICB9XTtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICByZXR1cm4gW107XG4gICAgICAgIH1cbiAgICAgICAgLyplc2xpbnQgaW5kZW50OiBbMiwgMiwge1wiU3dpdGNoQ2FzZVwiOiAxfV0qL1xuXG5cbiAgICAgICAgc3dpdGNoIChub2RlLm9wZXJhdG9yKSB7XG4gICAgICAgICAgY2FzZSBMb2dpY2FsT3BlcmF0b3IuQU5EOlxuICAgICAgICAgICAge1xuICAgICAgICAgICAgICB2YXIgcmVzID0gW107XG5cbiAgICAgICAgICAgICAgZm9yICh2YXIgaSA9IDAsIGxlbiA9IG5vZGUuY2hpbGRyZW4ubGVuZ3RoOyBpIDwgbGVuOyBpICs9IDEpIHtcbiAgICAgICAgICAgICAgICB2YXIgY2hpbGQgPSBub2RlLmNoaWxkcmVuW2ldO1xuICAgICAgICAgICAgICAgIHZhciByZXN1bHQgPSBldmFsdWF0ZShjaGlsZCwgaXRlbSwgaWR4KTtcblxuICAgICAgICAgICAgICAgIGlmIChyZXN1bHQubGVuZ3RoKSB7XG4gICAgICAgICAgICAgICAgICByZXMucHVzaC5hcHBseShyZXMsIF90b0NvbnN1bWFibGVBcnJheShyZXN1bHQpKTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgcmV0dXJuIFtdO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgIHJldHVybiByZXM7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICBjYXNlIExvZ2ljYWxPcGVyYXRvci5PUjpcbiAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgdmFyIF9yZXMgPSBbXTtcblxuICAgICAgICAgICAgICBmb3IgKHZhciBfaSA9IDAsIF9sZW4gPSBub2RlLmNoaWxkcmVuLmxlbmd0aDsgX2kgPCBfbGVuOyBfaSArPSAxKSB7XG4gICAgICAgICAgICAgICAgdmFyIF9jaGlsZCA9IG5vZGUuY2hpbGRyZW5bX2ldO1xuXG4gICAgICAgICAgICAgICAgdmFyIF9yZXN1bHQgPSBldmFsdWF0ZShfY2hpbGQsIGl0ZW0sIGlkeCk7XG5cbiAgICAgICAgICAgICAgICBpZiAoX3Jlc3VsdC5sZW5ndGgpIHtcbiAgICAgICAgICAgICAgICAgIF9yZXMucHVzaC5hcHBseShfcmVzLCBfdG9Db25zdW1hYmxlQXJyYXkoX3Jlc3VsdCkpO1xuXG4gICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICByZXR1cm4gX3JlcztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfTtcblxuICAgICAgdmFyIHJlY29yZHMgPSB0aGlzLl9teUluZGV4LnJlY29yZHM7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xuICAgICAgICAgICAgdmFsdWU6IGl0ZW1ba2V5SW5kZXhdLFxuICAgICAgICAgICAgc2VhcmNoZXI6IHNlYXJjaGVyXG4gICAgICAgICAgfSkpKTtcbiAgICAgICAgfSk7XG5cbiAgICAgICAgaWYgKG1hdGNoZXMubGVuZ3RoKSB7XG4gICAgICAgICAgcmVzdWx0cy5wdXNoKHtcbiAgICAgICAgICAgIGlkeDogaWR4LFxuICAgICAgICAgICAgaXRlbTogaXRlbSxcbiAgICAgICAgICAgIG1hdGNoZXM6IG1hdGNoZXNcbiAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgfSk7XG4gICAgICByZXR1cm4gcmVzdWx0cztcbiAgICB9XG4gIH0sIHtcbiAgICBrZXk6IFwiX2ZpbmRNYXRjaGVzXCIsXG4gICAgdmFsdWU6IGZ1bmN0aW9uIF9maW5kTWF0Y2hlcyhfcmVmNikge1xuICAgICAgdmFyIGtleSA9IF9yZWY2LmtleSxcbiAgICAgICAgICB2YWx1ZSA9IF9yZWY2LnZhbHVlLFxuICAgICAgICAgIHNlYXJjaGVyID0gX3JlZjYuc2VhcmNoZXI7XG5cbiAgICAgIGlmICghaXNEZWZpbmVkKHZhbHVlKSkge1xuICAgICAgICByZXR1cm4gW107XG4gICAgICB9XG5cbiAgICAgIHZhciBtYXRjaGVzID0gW107XG5cbiAgICAgIGlmIChpc0FycmF5KHZhbHVlKSkge1xuICAgICAgICB2YWx1ZS5mb3JFYWNoKGZ1bmN0aW9uIChfcmVmNykge1xuICAgICAgICAgIHZhciB0ZXh0ID0gX3JlZjcudixcbiAgICAgICAgICAgICAgaWR4ID0gX3JlZjcuaSxcbiAgICAgICAgICAgICAgbm9ybSA9IF9yZWY3Lm47XG5cbiAgICAgICAgICBpZiAoIWlzRGVmaW5lZCh0ZXh0KSkge1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIHZhciBfc2VhcmNoZXIkc2VhcmNoSW4yID0gc2VhcmNoZXIuc2VhcmNoSW4odGV4dCksXG4gICAgICAgICAgICAgIGlzTWF0Y2ggPSBfc2VhcmNoZXIkc2VhcmNoSW4yLmlzTWF0Y2gsXG4gICAgICAgICAgICAgIHNjb3JlID0gX3NlYXJjaGVyJHNlYXJjaEluMi5zY29yZSxcbiAgICAgICAgICAgICAgaW5kaWNlcyA9IF9zZWFyY2hlciRzZWFyY2hJbjIuaW5kaWNlcztcblxuICAgICAgICAgIGlmIChpc01hdGNoKSB7XG4gICAgICAgICAgICBtYXRjaGVzLnB1c2goe1xuICAgICAgICAgICAgICBzY29yZTogc2NvcmUsXG4gICAgICAgICAgICAgIGtleToga2V5LFxuICAgICAgICAgICAgICB2YWx1ZTogdGV4dCxcbiAgICAgICAgICAgICAgaWR4OiBpZHgsXG4gICAgICAgICAgICAgIG5vcm06IG5vcm0sXG4gICAgICAgICAgICAgIGluZGljZXM6IGluZGljZXNcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgIH1cbiAgICAgICAgfSk7XG4gICAgICB9IGVsc2Uge1xuICAgICAgICB2YXIgdGV4dCA9IHZhbHVlLnYsXG4gICAgICAgICAgICBub3JtID0gdmFsdWUubjtcblxuICAgICAgICB2YXIgX3NlYXJjaGVyJHNlYXJjaEluMyA9IHNlYXJjaGVyLnNlYXJjaEluKHRleHQpLFxuICAgICAgICAgICAgaXNNYXRjaCA9IF9zZWFyY2hlciRzZWFyY2hJbjMuaXNNYXRjaCxcbiAgICAgICAgICAgIHNjb3JlID0gX3NlYXJjaGVyJHNlYXJjaEluMy5zY29yZSxcbiAgICAgICAgICAgIGluZGljZXMgPSBfc2VhcmNoZXIkc2VhcmNoSW4zLmluZGljZXM7XG5cbiAgICAgICAgaWYgKGlzTWF0Y2gpIHtcbiAgICAgICAgICBtYXRjaGVzLnB1c2goe1xuICAgICAgICAgICAgc2NvcmU6IHNjb3JlLFxuICAgICAgICAgICAga2V5OiBrZXksXG4gICAgICAgICAgICB2YWx1ZTogdGV4dCxcbiAgIC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LmNoYXJDb2RlQXQocmVzLmxlbmd0aCAtIDEpICE9PSA0NiAvKi4qLyB8fCByZXMuY2hhckNvZGVBdChyZXMubGVuZ3RoIC0gMikgIT09IDQ2IC8qLiovKSB7XG4gICAgICAgICAgaWYgKHJlcy5sZW5ndGggPiAyKSB7XG4gICAgICAgICAgICB2YXIgbGFzdFNsYXNoSW5kZXggPSByZXMubGFzdEluZGV4T2YoJy8nKTtcbiAgICAgICAgICAgIGlmIChsYXN0U2xhc2hJbmRleCAhPT0gcmVzLmxlbmd0aCAtIDEpIHtcbiAgICAgICAgICAgICAgaWYgKGxhc3RTbGFzaEluZGV4ID09PSAtMSkge1xuICAgICAgICAgICAgICAgIHJlcyA9ICcnO1xuICAgICAgICAgICAgICAgIGxhc3RTZWdtZW50TGVuZ3RoID0gMDtcbiAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICByZXMgPSByZXMuc2xpY2UoMCwgbGFzdFNsYXNoSW5kZXgpO1xuICAgICAgICAgICAgICAgIGxhc3RTZWdtZW50TGVuZ3RoID0gcmVzLmxlbmd0aCAtIDEgLSByZXMubGFzdEluZGV4T2YoJy8nKTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBsYXN0U2xhc2ggPSBpO1xuICAgICAgICAgICAgICBkb3RzID0gMDtcbiAgICAgICAgICAgICAgY29udGludWU7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfSBlbHNlIGlmIChyZXMubGVuZ3RoID09PSAyIHx8IHJlcy5sZW5ndGggPT09IDEpIHtcbiAgICAgICAgICAgIHJlcyA9ICcnO1xuICAgICAgICAgICAgbGFzdFNlZ21lbnRMZW5ndGggPSAwO1xuICAgICAgICAgICAgbGFzdFNsYXNoID0gaTtcbiAgICAgICAgICAgIGRvdHMgPSAwO1xuICAgICAgICAgICAgY29udGludWU7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGlmIChhbGxvd0Fib3ZlUm9vdCkge1xuICAgICAg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AgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIGlmIChmaXJzdE5vblNsYXNoRW5kID09PSAtMSkge1xuICAgICAgICAgICAgLy8gV2Ugc2F3IHRoZSBmaXJzdCBub24tcGF0aCBzZXBhcmF0b3IsIHJlbWVtYmVyIHRoaXMgaW5kZXggaW4gY2FzZVxuICAgICAgICAgICAgLy8gd2UgbmVlZCBpdCBpZiB0aGUgZXh0ZW5zaW9uIGVuZHMgdXAgbm90IG1hdGNoaW5nXG4gICAgICAgICAgICBtYXRjaGVkU2xhc2ggPSBmYWxzZTtcbiAgICAgICAgICAgIGZpcnN0Tm9uU2xhc2hFbmQgPSBpICsgMTtcbiAgICAgICAgICB9XG4gICAgICAgICAgaWYgKGV4dElkeCA+PSAwKSB7XG4gICAgICAgICAgICAvLyBUcnkgdG8gbWF0Y2ggdGhlIGV4cGxpY2l0IGV4dGVuc2lvblxuICAgICAgICAgICAgaWYgKGNvZGUgPT09IGV4dC5jaGFyQ29kZUF0KGV4dElkeCkpIHtcbiAgICAgICAgICAgICAgaWYgKC0tZXh0SWR4ID09PSAtMSkge1xuICAgICAgICAgICAgICAgIC8vIFdlIG1hdGNoZWQgdGhlIGV4dGVuc2lvbiwgc28gbWFyayB0aGlzIGFzIHRoZSBlbmQgb2Ygb3VyIHBhdGhcbiAgICAgICAgICAgICAgICAvLyBjb21wb25lbnRcbiAgICAgICAgICAgICAgICBlbmQgPSBpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAvLyBFeHRlbnNpb24gZG9lcyBub3QgbWF0Y2gsIHNvIG91ciByZXN1bHQgaXMgdGhlIGVudGlyZSBwYXRoXG4gICAgICAgICAgICAgIC8vIGNvbXBvbmVudFxuICAgICAgICAgICAgICBleHRJZHggPSAtMTtcbiAgICAgICAgICAgICAgZW5kID0gZmlyc3ROb25TbGFzaEVuZDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH1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ialtrXSwgZnVuY3Rpb24odikge1xuICAgICAgICAgIHJldHVybiBrcyArIGVuY29kZVVSSUNvbXBvbmVudChzdHJpbmdpZnlQcmltaXRpdmUodikpO1xuICAgICAgICB9KS5qb2luKHNlcCk7XG4gICAgICB9IGVsc2Uge1xuICAgICAgICByZXR1cm4ga3MgKyBlbmNvZGVVUklDb21wb25lbnQoc3RyaW5naWZ5UHJpbWl0aXZlKG9ialtrXSkpO1xuICAgICAgfVxuICAgIH0pLmpvaW4oc2VwKTtcblxuICB9XG5cbiAgaWYgKCFuYW1lKSByZXR1cm4gJyc7XG4gIHJldHVybiBlbmNvZGVVUklDb21wb25lbnQoc3RyaW5naWZ5UHJpbWl0aXZlKG5hbWUpKSArIGVxICtcbiAgICAgICAgIGVuY29kZVVSSUNvbXBvbmVudChzdHJpbmdpZnlQcmltaXRpdmUob2JqKSk7XG59O1xuXG52YXIgaXNBcnJheSA9IEFycmF5LmlzQXJyYXkgfHwgZnVuY3Rpb24gKHhzKSB7XG4gIHJldHVybiBPYmplY3QucHJvdG90eXBlLnRvU3RyaW5nLmNhbGwoeHMpID09PSAnW29iamVjdCBBcnJheV0nO1xufTtcblxuZnVuY3Rpb24gbWFwICh4cywgZikge1xuICBpZiAoeHMubWFwKSByZXR1cm4geHMubWFwKGYpO1xuICB2YXIgcmVzID0gW107XG4gIGZvciAodmFyIGkgPSAwOyBpIDwgeHMubGVuZ3RoOyBpKyspIHtcbiAgICByZXMucHVzaChmKHhzW2ldLCBpKSk7XG4gIH1cbiAgcmV0dXJuIHJlcztcbn1cblxudmFyIG9iamVjdEtleXMgPSBPYmplY3Qua2V5cyB8fCBmdW5jdGlvbiAob2JqKSB7XG4gIHZhciByZXMgPSBbXTtcbiAgZm9yICh2YXIga2V5IGluIG9iaikge1xuICAgIGlmIChPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwob2JqLCBrZXkpKSByZXMucHVzaChrZXkpO1xuICB9XG4gIHJldHVybiByZXM7XG59O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BwYXRoKSwgYW5kIGZldGNoIHRoZSB2YWx1ZSBhdCB0aGF0IGtleVxuXG4gICAgICB0aGlzLmtleXMuZm9yRWFjaChmdW5jdGlvbiAoa2V5LCBrZXlJbmRleCkge1xuICAgICAgICAvLyBjb25zb2xlLmxvZyhrZXkpXG4gICAgICAgIHZhciB2YWx1ZSA9IF90aGlzMy5nZXRGbihkb2MsIGtleS5wYXRoKTtcblxuICAgICAgICBpZiAoIWlzRGVmaW5lZCh2YWx1ZSkpIHtcbiAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoaXNBcnJheSh2YWx1ZSkpIHtcbiAgICAgICAgICAoZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgdmFyIHN1YlJlY29yZHMgPSBbXTtcbiAgICAgICAgICAgIHZhciBzdGFjayA9IFt7XG4gICAgICAgICAgICAgIG5lc3RlZEFyckluZGV4OiAtMSxcbiAgICAgICAgICAgICAgdmFsdWU6IHZhbHVlXG4gICAgICAgICAgICB9XTtcblxuICAgICAgICAgICAgd2hpbGUgKHN0YWNrLmxlbmd0aCkge1xuICAgICAgICAgICAgICB2YXIgX3N0YWNrJHBvcCA9IHN0YWNrLnBvcCgpLFxuICAgICAgICAgICAgICAgICAgbmVzdGVkQXJySW5kZXggPSBfc3RhY2skcG9wLm5lc3RlZEFyckluZGV4LFxuICAgICAgICAgICAgICAgICAgX3ZhbHVlID0gX3N0YWNrJHBvcC52YWx1ZTtcblxuICAgICAgICAgICAgICBpZiAoIWlzRGVmaW5lZChfdmFsdWUpKSB7XG4gICAgICAgICAgICAgICAgY29udGludWU7XG4gICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICBpZiAoaXNTdHJpbmcoX3ZhbHVlKSAmJiAhaXNCbGFuayhfdmFsdWUpKSB7XG4gICAgICAgICAgICAgICAgdmFyIHN1YlJlY29yZCA9IHtcbiAgICAgICAgICAgICAgICAgIHY6IF92YWx1ZSxcbiAgICAgICAgICAgICAgICAgIGk6IG5lc3RlZEFyckluZGV4LFxuICAgICAgICAgICAgICAgICAgbjogX3RoaXMzLm5vcm0uZ2V0KF92YWx1ZSlcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIHN1YlJlY29yZHMucHVzaChzdWJSZWNvcmQpO1xuICAgICAgICAgICAgICB9IGVsc2UgaWYgKGlzQXJyYXkoX3ZhbHVlKSkge1xuICAgICAgICAgICAgICAgIF92YWx1ZS5mb3JFYWNoKGZ1bmN0aW9uIChpdGVtLCBrKSB7XG4gICAgICAgICAgICAgICAgICBzdGFjay5wdXNoKHtcbiAgICAgICAgICAgICAgICAgICAgbmVzdGVkQXJySW5kZXg6IGssXG4gICAgICAgICAgICAgICAgICAgIHZhbHVlOiBpdGVtXG4gICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZWNvcmQuJFtrZXlJbmRleF0gPSBzdWJSZWNvcmRzO1xuICAgICAgICAgIH0pKCk7XG4gICAgICAgIH0gZWxzZSBpZiAoIWlzQmxhbmsodmFsdWUpKSB7XG4gICAgICAgICAgdmFyIHN1YlJlY29yZCA9IHtcbiAgICAgICAgICAgIHY6IHZhbHVlLFxuICAgICAgICAgICAgbjogX3RoaXMzLm5vcm0uZ2V0KHZhbHVlKVxuICAgICAgICAgIH07XG4gICAgICAgICAgcmVjb3JkLiRba2V5SW5kZXhdID0gc3ViUmVjb3JkO1xuICAgICAgICB9XG4gICAgICB9KTtcbiAgICAgIHRoaXMucmVjb3Jkcy5wdXNoKHJlY29yZCk7XG4gICAgfVxuICB9LCB7XG4gICAga2V5OiBcInRvSlNPTlwiLFxuICAgIHZhbHVlOiBmdW5jdGlvbiB0b0pTT04oKSB7XG4gICAgICByZXR1cm4ge1xuICAgICAgICBrZXlzOiB0aGlzLmtleXMsXG4gICAgICAgIHJlY29yZHM6IHRoaXMucmVjb3Jkc1xuICAgICA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FyIHR5cGUgPSBzZWFyY2hlci5jb25zdHJ1Y3Rvci50eXBlO1xuXG4gICAgICAgICAgICAgIGlmIChNdWx0aU1hdGNoU2V0Lmhhcyh0eXBlKSkge1xuICAgICAgICAgICAgICAgIGFsbEluZGljZXMgPSBbXS5jb25jYXQoX3RvQ29uc3VtYWJsZUFycmF5KGFsbEluZGljZXMpLCBfdG9Db25zdW1hYmxlQXJyYXkoaW5kaWNlcykpO1xuICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGFsbEluZGljZXMucHVzaChpbmRpY2VzKTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICB0b3RhbFNjb3JlID0gMDtcbiAgICAgICAgICAgIG51bU1hdGNoZXMgPSAwO1xuICAgICAgICAgICAgYWxsSW5kaWNlcy5sZW5ndGggPSAwO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuICAgICAgICB9IC8vIE9SIGNvbmRpdGlvbiwgc28gaWYgVFJVRSwgcmV0dXJuXG5cblxuICAgICAgICBpZiAobnVtTWF0Y2hlcykge1xuICAgICAgICAgIHZhciByZXN1bHQgPSB7XG4gICAgICAgICAgICBpc01hdGNoOiB0cnVlLFxuICAgICAgICAgICAgc2NvcmU6IHRvdGFsU2NvcmUgLyBudW1NYXRjaGVzXG4gICAgICAgICAgfTtcblxuICAgICAgICAgIGlmIChpbmNsdWRlTWF0Y2hlcykge1xuICAgICAgICAgICAgcmVzdWx0LmluZGljZXMgPSBhbGxJbmRpY2VzO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgICAgIH1cbiAgICAgIH0gLy8gTm90aGluZyB3YXMgbWF0Y2hlZFxuXG5cbiAgICAgIHJldHVybiB7XG4gICAgICAgIGlzTWF0Y2g6IGZhbHNlLFxuICAgICAgICBzY29yZTogMVxuICAgICAgfTtcbiAgICB9XG4g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lciBldmVyeSBzdHJpbmcgaW4gdGhlIGluZGV4XG5cbiAgICAgIHJlY29yZHMuZm9yRWFjaChmdW5jdGlvbiAoX3JlZjIpIHtcbiAgICAgICAgdmFyIHRleHQgPSBfcmVmMi52LFxuICAgICAgICAgICAgaWR4ID0gX3JlZjIuaSxcbiAgICAgICAgICAgIG5vcm0gPSBfcmVmMi5uO1xuXG4gICAgICAgIGlmICghaXNEZWZpbmVkKHRleHQpKSB7XG4gICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG5cbiAgICAgICAgdmFyIF9zZWFyY2hlciRzZWFyY2hJbiA9IHNlYXJjaGVyLnNlYXJjaEluKHRleHQpLFxuICAgICAgICAgICAgaXNNYXRjaCA9IF9zZWFyY2hlciRzZWFyY2hJbi5pc01hdGNoLFxuICAgICAgICAgICAgc2NvcmUgPSBfc2VhcmNoZXIkc2VhcmNoSW4uc2NvcmUsXG4gICAgICAgICAgICBpbmRpY2VzID0gX3NlYXJjaGVyJHNlYXJjaEluLmluZGljZXM7XG5cbiAgICAgICAgaWYgKGlzTWF0Y2gpIHtcbiAgICAgICAgICByZXN1bHRzLnB1c2goe1xuICAgICAgICAgICAgaXRlbTogdGV4dCxcbiAgICAgICAgICAgIGlkeDogaWR4LFxuICAgICAgICAgICAgbWF0Y2hlczogW3tcbiAgICAgICAgICAgICAgc2NvcmU6IHNjb3JlLFxuICAgICAgICAgICAgICB2YWx1ZTogdGV4dCxcbiAgICAgICAgICAgICAgbm9ybTogbm9ybSxcbiAgICAgICAgICAgICAgaW5kaWNlczogaW5kaWNlc1xuICAgICAgICAgICAgfV1cbiAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgfSk7XG4gICAgICByZXR1cm4gcmVzdWx0cztcbiAgICB9XG4gIH0sIHtcbiAgICBrZXk6IFwiX3NlYXJjaExvZ2ljYWxcIixcbiAgICB2YWx1ZTogZnVuY3Rpb24gX3NlYXJjaExvZ2ljYWwocXVlcnkpIHtcbiAgICAgIHZhciBfdGhpcyA9IHRoaXM7XG5cbiAgICAgIHZhciBleHByZXNzaW9uID0gcGFyc2UocXVlcnksIHRoaXMub3B0aW9ucyk7XG5cbiAgICAgIHZhciBldmFsdWF0ZSA9IGZ1bmN0aW9uIGV2YWx1YXRlKG5vZGUsIGl0ZW0sIGlkeCkge1xuICAgICAgICBpZiAoIW5vZGUuY2hpbGRyZW4pIHtcbiAgICAgICAgICB2YXIga2V5SWQgPSBub2RlLmtleUlkLFxuICAgICAgICAgICAgICBzZWFyY2hlciA9IG5vZGUuc2VhcmNoZXI7XG5cbiAgICAgICAgICB2YXIgbWF0Y2hlcyA9IF90aGlzLl9maW5kTWF0Y2hlcyh7XG4gICAgICAgICAgICBrZXk6IF90aGlzLl9rZXlTdG9yZS5nZXQoa2V5SWQpLFxuICAgICAgICAgICAgdmFsdWU6IF90aGlzLl9teUluZGV4LmdldFZhbHVlRm9ySXRlbUF0S2V5SWQoaXRlbSwga2V5SWQpLFxuICAgICAgICAgICAgc2VhcmNoZXI6IHNlYXJjaGVyXG4gICAgICAgICAgfSk7XG5cbiAgICAgICAgICBpZiAobWF0Y2hlcyAmJiBtYXRjaGVzLmxlbmd0aCkge1xuICAgICAgICAgICAgcmV0dXJuIFt7XG4gICAgICAgICAgICAgIGlkeDogaWR4LFxuICAgICAgICAgICAgICBpdGVtOiBpdGVtLFxuICAgICAgICAgICAgICBtYXRjaGVzOiBtYXRjaGVzXG4gICAgICAgICAgICB9XTtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICByZXR1cm4gW107XG4gICAgICAgIH1cbiAgICAgICAgLyplc2xpbnQgaW5kZW50OiBbMiwgMiwge1wiU3dpdGNoQ2FzZVwiOiAxfV0qL1xuXG5cbiAgICAgICAgc3dpdGNoIChub2RlLm9wZXJhdG9yKSB7XG4gICAgICAgICAgY2FzZSBMb2dpY2FsT3BlcmF0b3IuQU5EOlxuICAgICAgICAgICAge1xuICAgICAgICAgICAgICB2YXIgcmVzID0gW107XG5cbiAgICAgICAgICAgICAgZm9yICh2YXIgaSA9IDAsIGxlbiA9IG5vZGUuY2hpbGRyZW4ubGVuZ3RoOyBpIDwgbGVuOyBpICs9IDEpIHtcbiAgICAgICAgICAgICAgICB2YXIgY2hpbGQgPSBub2RlLmNoaWxkcmVuW2ldO1xuICAgICAgICAgICAgICAgIHZhciByZXN1bHQgPSBldmFsdWF0ZShjaGlsZCwgaXRlbSwgaWR4KTtcblxuICAgICAgICAgICAgICAgIGlmIChyZXN1bHQubGVuZ3RoKSB7XG4gICAgICAgICAgICAgICAgICByZXMucHVzaC5hcHBseShyZXMsIF90b0NvbnN1bWFibGVBcnJheShyZXN1bHQpKTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgcmV0dXJuIFtdO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgIHJldHVybiByZXM7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICBjYXNlIExvZ2ljYWxPcGVyYXRvci5PUjpcbiAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgdmFyIF9yZXMgPSBbXTtcblxuICAgICAgICAgICAgICBmb3IgKHZhciBfaSA9IDAsIF9sZW4gPSBub2RlLmNoaWxkcmVuLmxlbmd0aDsgX2kgPCBfbGVuOyBfaSArPSAxKSB7XG4gICAgICAgICAgICAgICAgdmFyIF9jaGlsZCA9IG5vZGUuY2hpbGRyZW5bX2ldO1xuXG4gICAgICAgICAgICAgICAgdmFyIF9yZXN1bHQgPSBldmFsdWF0ZShfY2hpbGQsIGl0ZW0sIGlkeCk7XG5cbiAgICAgICAgICAgICAgICBpZiAoX3Jlc3VsdC5sZW5ndGgpIHtcbiAgICAgICAgICAgICAgICAgIF9yZXMucHVzaC5hcHBseShfcmVzLCBfdG9Db25zdW1hYmxlQXJyYXkoX3Jlc3VsdCkpO1xuXG4gICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICByZXR1cm4gX3JlcztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfTtcblxuICAgICAgdmFyIHJlY29yZHMgPSB0aGlzLl9teUluZGV4LnJlY29yZHM7XG4gICAgICB2YXIgcmVzdWx0TWFwID0ge307XG4gICAgICB2YXIgcmVzdWx0cyA9IFtdO1xuICAgICAgcmVjb3Jkcy5mb3JFYWNoKGZ1bmN0aW9uIChfcmVmMykge1xuICAgICAgICB2YXIgaXRlbSA9IF9yZWYzLiQsXG4gICAgICAgICAgICBpZHggPSBfcmVmMy5pO1xuXG4gICAgICAgIGlmIChpc0RlZmluZWQoaXRlbSkpIHtcbiAgICAgICAgICB2YXIgZXhwUmVzdWx0cyA9IGV2YWx1YXRlKGV4cHJlc3Npb24sIGl0ZW0sIGlkeCk7XG5cbiAgICAgICAgICBpZiAoZXhwUmVzdWx0cy5sZW5ndGgpIHtcbiAgICAgICAgICAgIC8vIERlZHVwZSB3aGVuIGFkZGluZ1xuICAgICAgICAgICAgaWYgKCFyZXN1bHRNYXBbaWR4XSkge1xuICAgICAgICAgICAgICByZXN1bHRNYXBbaWR4XSA9IHtcbiAgICAgICAgICAgICAgICBpZHg6IGlkeCxcbiAgICAgICAgICAgICAgICBpdGVtOiBpdGVtLFxuICAgICAgICAgICAgICAgIG1hdGNoZXM6IFtdXG4gICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgIHJlc3VsdHMucHVzaChyZXN1bHRNYXBbaWR4XSk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGV4cFJlc3VsdHMuZm9yRWFjaChmdW5jdGlvbiAoX3JlZjQpIHtcbiAgICAgICAgICAgICAgdmFyIF9yZXN1bHRNYXAkaWR4JG1hdGNoZTtcblxuICAgICAgICAgICAgICB2YXIgbWF0Y2hlcyA9IF9yZWY0Lm1hdGNoZXM7XG5cbiAgICAgICAgICAgICAgKF9yZXN1bHRNYXAkaWR4JG1hdGN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tleUluZGV4KSB7XG4gICAgICAgICAgbWF0Y2hlcy5wdXNoLmFwcGx5KG1hdGNoZXMsIF90b0NvbnN1bWFibGVBcnJheShfdGhpczIuX2ZpbmRNYXRjaGVzKHtcbiAgICAgICAgICAgIGtleToga2V5LFxuICAgICAgICAgICAgdmFsdWU6IGl0ZW1ba2V5SW5kZXhdLFxuICAgICAgICAgICAgc2VhcmNoZXI6IHNlYXJjaGVyXG4gICAgICAgICAgfSkpKTtcbiAgICAgICAgfSk7XG5cbiAgICAgICAgaWYgKG1hdGNoZXMubGVuZ3RoKSB7XG4gICAgICAgICAgcmVzdWx0cy5wdXNoKHtcbiAgICAgICAgICAgIGlkeDogaWR4LFxuICAgICAgICAgICAgaXRlbTogaXRlbSxcbiAgICAgICAgICAgIG1hdGNoZXM6IG1hdGNoZXNcbiAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgfSk7XG4gICAgICByZXR1cm4gcmVzdWx0cztcbiAgICB9XG4gIH0sIHtcbiAgICBrZXk6IFwiX2ZpbmRNYXRjaGVzXCIsXG4gICAgdmFsdWU6IGZ1bmN0aW9uIF9maW5kTWF0Y2hlcyhfcmVmNikge1xuICAgICAgdmFyIGtleSA9IF9yZWY2LmtleSxcbiAgICAgICAgICB2YWx1ZSA9IF9yZWY2LnZhbHVlLFxuICAgICAgICAgIHNlYXJjaGVyID0gX3JlZjYuc2VhcmNoZXI7XG5cbiAgICAgIGlmICghaXNEZWZpbmVkKHZhbHVlKSkge1xuICAgICAgICByZXR1cm4gW107XG4gICAgICB9XG5cbiAgICAgIHZhciBtYXRjaGVzID0gW107XG5cbiAgICAgIGlmIChpc0FycmF5KHZhbHVlKSkge1xuICAgICAgICB2YWx1ZS5mb3JFYWNoKGZ1bmN0aW9uIChfcmVmNykge1xuICAgICAgICAgIHZhciB0ZXh0ID0gX3JlZjcudixcbiAgICAgICAgICAgICAgaWR4ID0gX3JlZjcuaSxcbiAgICAgICAgICAgICAgbm9ybSA9IF9yZWY3Lm47XG5cbiAgICAgICAgICBpZiAoIWlzRGVmaW5lZCh0ZXh0KSkge1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIHZhciBfc2VhcmNoZXIkc2VhcmNoSW4yID0gc2VhcmNoZXIuc2VhcmNoSW4odGV4dCksXG4gICAgICAgICAgICAgIGlzTWF0Y2ggPSBfc2VhcmNoZXIkc2VhcmNoSW4yLmlzTWF0Y2gsXG4gICAgICAgICAgICAgIHNjb3JlID0gX3NlYXJjaGVyJHNlYXJjaEluMi5zY29yZSxcbiAgICAgICAgICAgICAgaW5kaWNlcyA9IF9zZWFyY2hlciRzZWFyY2hJbjIuaW5kaWNlcztcblxuICAgICAgICAgIGlmIChpc01hdGNoKSB7XG4gICAgICAgICAgICBtYXRjaGVzLnB1c2goe1xuICAgICAgICAgICAgICBzY29yZTogc2NvcmUsXG4gICAgICAgICAgICAgIGtleToga2V5LFxuICAgICAgICAgICAgICB2YWx1ZTogdGV4dCxcbiAgICAgICAgICAgICAgaWR4OiBpZHgsXG4gICAgICAgICAgICAgIG5vcm06IG5vcm0sXG4gICAgICAgICAgICAgIGluZGljZXM6IGluZGljZXNcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgIH1cbiAgICAgICAgfSk7XG4gICAgICB9IGVsc2Uge1xuICAgICAgICB2YXIgdGV4dCA9IHZhbHVlLnYsXG4gICAgICAgICAgICBub3JtID0gdmFsdWUubjtcblxuICAgICAgICB2YXIgX3NlYXJjaGVyJHNlYXJjaEluMyA9IHNlYXJjaGVyLnNlYXJjaEluKHRleHQpLFxuICAgICAgICAgICAgaXNNYXRjaCA9IF9zZWFyY2hlciRzZWFyY2hJbjMuaXNNYXRjaCxcbiAgICAgICAgICAgIHNjb3JlID0gX3NlYXJjaGVyJHNlYXJjaEluMy5zY29yZSxcbiAgICAgICAgICAgIGluZGljZXMgPSBfc2VhcmNoZXIkc2VhcmNoSW4zLmluZGljZXM7XG5cbiAgICAgICAgaWYgKGlzTWF0Y2gpIHtcbiAgICAgICAgICBtYXRjaGVzLnB1c2goe1xuICAgICAgICAgICAgc2NvcmU6IHNjb3JlLFxuICAgICAgICAgICAga2V5OiBrZXksXG4gICAgICAgICAgICB2YWx1ZTogdGV4dCxcbiAgICAgICAgICAgIG5vcm06IG5vcm0sXG4gICAgICAgICAgICBpbmRpY2VzOiBpbmRpY2VzXG4gICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgIH1cblxuICAgICAgcmV0dXJuIG1hdGNoZXM7XG4gICAgfVxuICB9XSk7XG5cbiAgcmV0dXJuIEZ1c2U7XG59KCk7XG5cbkZ1c2UudmVyc2lvbiA9ICc2LjQuNic7XG5GdXNlLmNyZWF0ZUluZGV4ID0gY3JlYXRlSW5kZXg7XG5GdXNlLnBhcnNlSW5kZXggPSBwYXJzZUluZGV4O1xuRnVzZS5jb25maWcgPSBDb25maWc7XG5cbntcbiAgRnVzZS5wYXJzZVF1ZXJ5ID0gcGFyc2U7XG59XG5cbntcbiAgcmVnaXN0ZXIoRXh0ZW5kZWRTZWFyY2gpO1xufVxuXG5tb2R1bGUuZXhwb3J0cyA9IEZ1c2U7XG4iXX0= diff --git a/bundles/azurapi.min.js b/bundles/azurapi.min.js index 6a786802..1a14bc70 100644 --- a/bundles/azurapi.min.js +++ b/bundles/azurapi.min.js @@ -1,12 +1,12 @@ -!function e(t,r,n){function i(a,s){if(!r[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var l=r[a]={exports:{}};t[a][0].call(l.exports,(function(e){return i(t[a][1][e]||e)}),l,l.exports,e,t,r,n)}return r[a].exports}for(var o="function"==typeof require&&require,a=0;a0?a-4:a;for(r=0;r>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===s&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,u[l++]=255&t);1===s&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},r.fromByteArray=function(e){for(var t,r=e.length,i=r%3,o=[],a=16383,s=0,u=r-i;su?u:s+a));1===i?(t=e[r-1],o.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],o.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=a.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function l(e,t,r){for(var i,o,a=[],s=t;s>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],2:[function(e,t,r){},{}],3:[function(e,t,r){arguments[4][2][0].apply(r,arguments)},{dup:2}],4:[function(e,t,r){(function(t){(function(){ +!function e(t,r,n){function i(s,a){if(!r[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(o)return o(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=r[s]={exports:{}};t[s][0].call(l.exports,(function(e){return i(t[s][1][e]||e)}),l,l.exports,e,t,r,n)}return r[s].exports}for(var o="function"==typeof require&&require,s=0;s0?s-4:s;for(r=0;r>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===a&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,u[l++]=255&t);1===a&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},r.fromByteArray=function(e){for(var t,r=e.length,i=r%3,o=[],s=16383,a=0,u=r-i;au?u:a+s));1===i?(t=e[r-1],o.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],o.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function l(e,t,r){for(var i,o,s=[],a=t;a>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],2:[function(e,t,r){},{}],3:[function(e,t,r){arguments[4][2][0].apply(r,arguments)},{dup:2}],4:[function(e,t,r){(function(t){(function(){ /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ -"use strict";var t=e("base64-js"),n=e("ieee754");r.Buffer=a,r.SlowBuffer=function(e){+e!=e&&(e=0);return a.alloc(+e)},r.INSPECT_MAX_BYTES=50;var i=2147483647;function o(e){if(e>i)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return t.__proto__=a.prototype,t}function a(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return c(e)}return s(e,t,r)}function s(e,t,r){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!a.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|f(e,t),n=o(r),i=n.write(e,t);i!==r&&(n=n.slice(0,i));return n}(e,t);if(ArrayBuffer.isView(e))return l(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(q(e,ArrayBuffer)||e&&q(e.buffer,ArrayBuffer))return function(e,t,r){if(t<0||e.byteLength=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|e}function f(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||q(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return U(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return B(e).length;default:if(i)return n?-1:U(e).length;t=(""+t).toLowerCase(),i=!0}}function d(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return R(this,t,r);case"utf8":case"utf-8":return k(this,t,r);case"ascii":return O(this,t,r);case"latin1":case"binary":return x(this,t,r);case"base64":return E(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function p(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function y(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),z(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=a.from(t,n)),a.isBuffer(t))return 0===t.length?-1:g(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):g(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function g(e,t,r,n,i){var o,a=1,s=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,r/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var l=-1;for(o=r;os&&(r=s-u),o=r;o>=0;o--){for(var h=!0,f=0;fi&&(n=i):n=i;var o=t.length;n>o/2&&(n=o/2);for(var a=0;a>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function E(e,r,n){return 0===r&&n===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(r,n))}function k(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i239?4:c>223?3:c>191?2:1;if(i+h<=r)switch(h){case 1:c<128&&(l=c);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&c)<<6|63&o)>127&&(l=u);break;case 3:o=e[i+1],a=e[i+2],128==(192&o)&&128==(192&a)&&(u=(15&c)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&c)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(l=u)}null===l?(l=65533,h=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=h}return function(e){var t=e.length;if(t<=A)return String.fromCharCode.apply(String,e);var r="",n=0;for(;nt&&(e+=" ... "),""},a.prototype.compare=function(e,t,r,n,i){if(q(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),u=Math.min(o,s),c=this.slice(n,i),l=e.slice(t,r),h=0;h>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return v(this,e,t,r);case"utf8":case"utf-8":return m(this,e,t,r);case"ascii":return b(this,e,t,r);case"latin1":case"binary":return w(this,e,t,r);case"base64":return _(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var A=4096;function O(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;in)&&(r=n);for(var i="",o=t;or)throw new RangeError("Trying to access beyond buffer length")}function T(e,t,r,n,i,o){if(!a.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function j(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function L(e,t,r,i,o){return t=+t,r>>>=0,o||j(e,0,r,4),n.write(e,t,r,i,23,4),r+4}function I(e,t,r,i,o){return t=+t,r>>>=0,o||j(e,0,r,8),n.write(e,t,r,i,52,8),r+8}a.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||M(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||M(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},a.prototype.readUInt8=function(e,t){return e>>>=0,t||M(e,1,this.length),this[e]},a.prototype.readUInt16LE=function(e,t){return e>>>=0,t||M(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUInt16BE=function(e,t){return e>>>=0,t||M(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUInt32LE=function(e,t){return e>>>=0,t||M(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},a.prototype.readUInt32BE=function(e,t){return e>>>=0,t||M(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||M(e,t,this.length);for(var n=this[e],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*t)),n},a.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||M(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},a.prototype.readInt8=function(e,t){return e>>>=0,t||M(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},a.prototype.readInt16LE=function(e,t){e>>>=0,t||M(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(e,t){e>>>=0,t||M(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(e,t){return e>>>=0,t||M(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e>>>=0,t||M(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,t){return e>>>=0,t||M(e,4,this.length),n.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e>>>=0,t||M(e,4,this.length),n.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e>>>=0,t||M(e,8,this.length),n.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e>>>=0,t||M(e,8,this.length),n.read(this,e,!1,52,8)},a.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t>>>=0,r>>>=0,n)||T(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n)||T(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},a.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,1,255,0),this[t]=255&e,t+1},a.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},a.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);T(this,e,t,r,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+r},a.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);T(this,e,t,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+r},a.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeFloatLE=function(e,t,r){return L(this,e,t,!0,r)},a.prototype.writeFloatBE=function(e,t,r){return L(this,e,t,!1,r)},a.prototype.writeDoubleLE=function(e,t,r){return I(this,e,t,!0,r)},a.prototype.writeDoubleBE=function(e,t,r){return I(this,e,t,!1,r)},a.prototype.copy=function(e,t,r,n){if(!a.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--o)e[o+t]=this[o+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return i},a.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!a.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){var i=e.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(e=i)}}else"number"==typeof e&&(e&=255);if(t<0||this.length>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function B(e){return t.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(P,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function D(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function q(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function z(e){return e!=e}}).call(this)}).call(this,e("buffer").Buffer)},{"base64-js":1,buffer:4,ieee754:8}],5:[function(e,t,r){t.exports={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}},{}],6:[function(e,t,r){"use strict";var n,i="object"==typeof Reflect?Reflect:null,o=i&&"function"==typeof i.apply?i.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};n=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var a=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}t.exports=s,t.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,o),n(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}v(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&v(e,"error",t,r)}(e,i,{once:!0})}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var u=10;function c(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function h(e,t,r,n){var i,o,a,s;if(c(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),a=o[t]),void 0===a)a=o[t]=r,++e._eventsCount;else if("function"==typeof a?a=o[t]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),(i=l(e))>0&&a.length>i&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=a.length,s=u,console&&console.warn&&console.warn(s)}return e}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=f.bind(n);return i.listener=r,n.wrapFn=i,i}function p(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var u=i[e];if(void 0===u)return!1;if("function"==typeof u)o(u,this,t);else{var c=u.length,l=g(u,c);for(r=0;r=0;o--)if(r[o]===t||r[o].listener===t){a=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1=0;n--)this.removeListener(e,t[n]);return this},s.prototype.listeners=function(e){return p(this,e,!0)},s.prototype.rawListeners=function(e){return p(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):y.call(e,t)},s.prototype.listenerCount=y,s.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},{}],7:[function(e,t,r){var n=e("http"),i=e("url"),o=t.exports;for(var a in n)n.hasOwnProperty(a)&&(o[a]=n[a]);function s(e){if("string"==typeof e&&(e=i.parse(e)),e.protocol||(e.protocol="https:"),"https:"!==e.protocol)throw new Error('Protocol "'+e.protocol+'" not supported. Expected "https:"');return e}o.request=function(e,t){return e=s(e),n.request.call(this,e,t)},o.get=function(e,t){return e=s(e),n.get.call(this,e,t)}},{http:17,url:37}],8:[function(e,t,r){ +"use strict";var t=e("base64-js"),n=e("ieee754");r.Buffer=s,r.SlowBuffer=function(e){+e!=e&&(e=0);return s.alloc(+e)},r.INSPECT_MAX_BYTES=50;var i=2147483647;function o(e){if(e>i)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return t.__proto__=s.prototype,t}function s(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return c(e)}return a(e,t,r)}function a(e,t,r){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!s.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|f(e,t),n=o(r),i=n.write(e,t);i!==r&&(n=n.slice(0,i));return n}(e,t);if(ArrayBuffer.isView(e))return l(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(q(e,ArrayBuffer)||e&&q(e.buffer,ArrayBuffer))return function(e,t,r){if(t<0||e.byteLength=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|e}function f(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||q(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return U(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return B(e).length;default:if(i)return n?-1:U(e).length;t=(""+t).toLowerCase(),i=!0}}function d(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return R(this,t,r);case"utf8":case"utf-8":return k(this,t,r);case"ascii":return O(this,t,r);case"latin1":case"binary":return x(this,t,r);case"base64":return E(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function p(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function y(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),z(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=s.from(t,n)),s.isBuffer(t))return 0===t.length?-1:g(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):g(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function g(e,t,r,n,i){var o,s=1,a=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,u/=2,r/=2}function c(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var l=-1;for(o=r;oa&&(r=a-u),o=r;o>=0;o--){for(var h=!0,f=0;fi&&(n=i):n=i;var o=t.length;n>o/2&&(n=o/2);for(var s=0;s>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function E(e,r,n){return 0===r&&n===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(r,n))}function k(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i239?4:c>223?3:c>191?2:1;if(i+h<=r)switch(h){case 1:c<128&&(l=c);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&c)<<6|63&o)>127&&(l=u);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(u=(15&c)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(l=u)}null===l?(l=65533,h=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=h}return function(e){var t=e.length;if(t<=A)return String.fromCharCode.apply(String,e);var r="",n=0;for(;nt&&(e+=" ... "),""},s.prototype.compare=function(e,t,r,n,i){if(q(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(t>>>=0),u=Math.min(o,a),c=this.slice(n,i),l=e.slice(t,r),h=0;h>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return v(this,e,t,r);case"utf8":case"utf-8":return m(this,e,t,r);case"ascii":return b(this,e,t,r);case"latin1":case"binary":return w(this,e,t,r);case"base64":return _(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var A=4096;function O(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;in)&&(r=n);for(var i="",o=t;or)throw new RangeError("Trying to access beyond buffer length")}function T(e,t,r,n,i,o){if(!s.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function j(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function L(e,t,r,i,o){return t=+t,r>>>=0,o||j(e,0,r,4),n.write(e,t,r,i,23,4),r+4}function I(e,t,r,i,o){return t=+t,r>>>=0,o||j(e,0,r,8),n.write(e,t,r,i,52,8),r+8}s.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||C(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||C(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},s.prototype.readUInt8=function(e,t){return e>>>=0,t||C(e,1,this.length),this[e]},s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||C(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||C(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||C(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||C(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||C(e,t,this.length);for(var n=this[e],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*t)),n},s.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||C(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},s.prototype.readInt8=function(e,t){return e>>>=0,t||C(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||C(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(e,t){e>>>=0,t||C(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||C(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||C(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readFloatLE=function(e,t){return e>>>=0,t||C(e,4,this.length),n.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||C(e,4,this.length),n.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||C(e,8,this.length),n.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||C(e,8,this.length),n.read(this,e,!1,52,8)},s.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t>>>=0,r>>>=0,n)||T(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n)||T(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},s.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,1,255,0),this[t]=255&e,t+1},s.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},s.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);T(this,e,t,r,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o>0)-a&255;return t+r},s.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);T(this,e,t,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},s.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeFloatLE=function(e,t,r){return L(this,e,t,!0,r)},s.prototype.writeFloatBE=function(e,t,r){return L(this,e,t,!1,r)},s.prototype.writeDoubleLE=function(e,t,r){return I(this,e,t,!0,r)},s.prototype.writeDoubleBE=function(e,t,r){return I(this,e,t,!1,r)},s.prototype.copy=function(e,t,r,n){if(!s.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--o)e[o+t]=this[o+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return i},s.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){var i=e.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(e=i)}}else"number"==typeof e&&(e&=255);if(t<0||this.length>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function B(e){return t.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(P,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function D(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function q(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function z(e){return e!=e}}).call(this)}).call(this,e("buffer").Buffer)},{"base64-js":1,buffer:4,ieee754:8}],5:[function(e,t,r){t.exports={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}},{}],6:[function(e,t,r){"use strict";var n,i="object"==typeof Reflect?Reflect:null,o=i&&"function"==typeof i.apply?i.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};n=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var s=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}t.exports=a,t.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,o),n(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}v(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&v(e,"error",t,r)}(e,i,{once:!0})}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var u=10;function c(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function h(e,t,r,n){var i,o,s,a;if(c(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),s=o[t]),void 0===s)s=o[t]=r,++e._eventsCount;else if("function"==typeof s?s=o[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=l(e))>0&&s.length>i&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=s.length,a=u,console&&console.warn&&console.warn(a)}return e}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=f.bind(n);return i.listener=r,n.wrapFn=i,i}function p(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var u=i[e];if(void 0===u)return!1;if("function"==typeof u)o(u,this,t);else{var c=u.length,l=g(u,c);for(r=0;r=0;o--)if(r[o]===t||r[o].listener===t){s=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1=0;n--)this.removeListener(e,t[n]);return this},a.prototype.listeners=function(e){return p(this,e,!0)},a.prototype.rawListeners=function(e){return p(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):y.call(e,t)},a.prototype.listenerCount=y,a.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},{}],7:[function(e,t,r){var n=e("http"),i=e("url"),o=t.exports;for(var s in n)n.hasOwnProperty(s)&&(o[s]=n[s]);function a(e){if("string"==typeof e&&(e=i.parse(e)),e.protocol||(e.protocol="https:"),"https:"!==e.protocol)throw new Error('Protocol "'+e.protocol+'" not supported. Expected "https:"');return e}o.request=function(e,t){return e=a(e),n.request.call(this,e,t)},o.get=function(e,t){return e=a(e),n.get.call(this,e,t)}},{http:17,url:37}],8:[function(e,t,r){ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ -r.read=function(e,t,r,n,i){var o,a,s=8*i-n-1,u=(1<>1,l=-7,h=r?i-1:0,f=r?-1:1,d=e[t+h];for(h+=f,o=d&(1<<-l)-1,d>>=-l,l+=s;l>0;o=256*o+e[t+h],h+=f,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=n;l>0;a=256*a+e[t+h],h+=f,l-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,n),o-=c}return(d?-1:1)*a*Math.pow(2,o-n)},r.write=function(e,t,r,n,i,o){var a,s,u,c=8*o-i-1,l=(1<>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+h>=1?f/u:f*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=l?(s=0,a=l):a+h>=1?(s=(t*u-1)*Math.pow(2,i),a+=h):(s=t*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;e[r+d]=255&s,d+=p,s/=256,i-=8);for(a=a<0;e[r+d]=255&a,d+=p,a/=256,c-=8);e[r+d-p]|=128*y}},{}],9:[function(e,t,r){"function"==typeof Object.create?t.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},{}],10:[function(e,t,r){(function(e){(function(){"use strict";function r(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function n(e,t){for(var r,n="",i=0,o=-1,a=0,s=0;s<=e.length;++s){if(s2){var u=n.lastIndexOf("/");if(u!==n.length-1){-1===u?(n="",i=0):i=(n=n.slice(0,u)).length-1-n.lastIndexOf("/"),o=s,a=0;continue}}else if(2===n.length||1===n.length){n="",i=0,o=s,a=0;continue}t&&(n.length>0?n+="/..":n="..",i=2)}else n.length>0?n+="/"+e.slice(o+1,s):n=e.slice(o+1,s),i=s-o-1;o=s,a=0}else 46===r&&-1!==a?++a:a=-1}return n}var i={resolve:function(){for(var t,i="",o=!1,a=arguments.length-1;a>=-1&&!o;a--){var s;a>=0?s=arguments[a]:(void 0===t&&(t=e.cwd()),s=t),r(s),0!==s.length&&(i=s+"/"+i,o=47===s.charCodeAt(0))}return i=n(i,!o),o?i.length>0?"/"+i:"/":i.length>0?i:"."},normalize:function(e){if(r(e),0===e.length)return".";var t=47===e.charCodeAt(0),i=47===e.charCodeAt(e.length-1);return 0!==(e=n(e,!t)).length||t||(e="."),e.length>0&&i&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return r(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,t=0;t0&&(void 0===e?e=n:e+="/"+n)}return void 0===e?".":i.normalize(e)},relative:function(e,t){if(r(e),r(t),e===t)return"";if((e=i.resolve(e))===(t=i.resolve(t)))return"";for(var n=1;nc){if(47===t.charCodeAt(s+h))return t.slice(s+h+1);if(0===h)return t.slice(s+h)}else a>c&&(47===e.charCodeAt(n+h)?l=h:0===h&&(l=0));break}var f=e.charCodeAt(n+h);if(f!==t.charCodeAt(s+h))break;47===f&&(l=h)}var d="";for(h=n+l+1;h<=o;++h)h!==o&&47!==e.charCodeAt(h)||(0===d.length?d+="..":d+="/..");return d.length>0?d+t.slice(s+l):(s+=l,47===t.charCodeAt(s)&&++s,t.slice(s))},_makeLong:function(e){return e},dirname:function(e){if(r(e),0===e.length)return".";for(var t=e.charCodeAt(0),n=47===t,i=-1,o=!0,a=e.length-1;a>=1;--a)if(47===(t=e.charCodeAt(a))){if(!o){i=a;break}}else o=!1;return-1===i?n?"/":".":n&&1===i?"//":e.slice(0,i)},basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');r(e);var n,i=0,o=-1,a=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var s=t.length-1,u=-1;for(n=e.length-1;n>=0;--n){var c=e.charCodeAt(n);if(47===c){if(!a){i=n+1;break}}else-1===u&&(a=!1,u=n+1),s>=0&&(c===t.charCodeAt(s)?-1==--s&&(o=n):(s=-1,o=u))}return i===o?o=u:-1===o&&(o=e.length),e.slice(i,o)}for(n=e.length-1;n>=0;--n)if(47===e.charCodeAt(n)){if(!a){i=n+1;break}}else-1===o&&(a=!1,o=n+1);return-1===o?"":e.slice(i,o)},extname:function(e){r(e);for(var t=-1,n=0,i=-1,o=!0,a=0,s=e.length-1;s>=0;--s){var u=e.charCodeAt(s);if(47!==u)-1===i&&(o=!1,i=s+1),46===u?-1===t?t=s:1!==a&&(a=1):-1!==t&&(a=-1);else if(!o){n=s+1;break}}return-1===t||-1===i||0===a||1===a&&t===i-1&&t===n+1?"":e.slice(t,i)},format:function(e){if(null===e||"object"!=typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var r=t.dir||t.root,n=t.base||(t.name||"")+(t.ext||"");return r?r===t.root?r+n:r+e+n:n}("/",e)},parse:function(e){r(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return t;var n,i=e.charCodeAt(0),o=47===i;o?(t.root="/",n=1):n=0;for(var a=-1,s=0,u=-1,c=!0,l=e.length-1,h=0;l>=n;--l)if(47!==(i=e.charCodeAt(l)))-1===u&&(c=!1,u=l+1),46===i?-1===a?a=l:1!==h&&(h=1):-1!==a&&(h=-1);else if(!c){s=l+1;break}return-1===a||-1===u||0===h||1===h&&a===u-1&&a===s+1?-1!==u&&(t.base=t.name=0===s&&o?e.slice(1,u):e.slice(s,u)):(0===s&&o?(t.name=e.slice(1,a),t.base=e.slice(1,u)):(t.name=e.slice(s,a),t.base=e.slice(s,u)),t.ext=e.slice(a,u)),s>0?t.dir=e.slice(0,s-1):o&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};i.posix=i,t.exports=i}).call(this)}).call(this,e("_process"))},{_process:11}],11:[function(e,t,r){var n,i,o=t.exports={};function a(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function u(e){if(n===setTimeout)return setTimeout(e,0);if((n===a||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:a}catch(e){n=a}try{i="function"==typeof clearTimeout?clearTimeout:s}catch(e){i=s}}();var c,l=[],h=!1,f=-1;function d(){h&&c&&(h=!1,c.length?l=c.concat(l):f=-1,l.length&&p())}function p(){if(!h){var e=u(d);h=!0;for(var t=l.length;t;){for(c=l,l=[];++f1)for(var r=1;r= 0x80 (not a basic code point)","invalid-input":"Invalid input"},y=Math.floor,g=String.fromCharCode;function v(e){throw new RangeError(p[e])}function m(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}function b(e,t){var r=e.split("@"),n="";return r.length>1&&(n=r[0]+"@",e=r[1]),n+m((e=e.replace(d,".")).split("."),t).join(".")}function w(e){for(var t,r,n=[],i=0,o=e.length;i=55296&&t<=56319&&i65535&&(t+=g((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=g(e)})).join("")}function S(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function E(e,t,r){var n=0;for(e=r?y(e/700):e>>1,e+=y(e/t);e>455;n+=l)e=y(e/35);return y(n+36*e/(e+38))}function k(e){var t,r,n,i,o,a,s,u,h,f,d,p=[],g=e.length,m=0,b=128,w=72;for((r=e.lastIndexOf("-"))<0&&(r=0),n=0;n=128&&v("not-basic"),p.push(e.charCodeAt(n));for(i=r>0?r+1:0;i=g&&v("invalid-input"),((u=(d=e.charCodeAt(i++))-48<10?d-22:d-65<26?d-65:d-97<26?d-97:l)>=l||u>y((c-m)/a))&&v("overflow"),m+=u*a,!(u<(h=s<=w?1:s>=w+26?26:s-w));s+=l)a>y(c/(f=l-h))&&v("overflow"),a*=f;w=E(m-o,t=p.length+1,0==o),y(m/t)>c-b&&v("overflow"),b+=y(m/t),m%=t,p.splice(m++,0,b)}return _(p)}function A(e){var t,r,n,i,o,a,s,u,h,f,d,p,m,b,_,k=[];for(p=(e=w(e)).length,t=128,r=0,o=72,a=0;a=t&&dy((c-r)/(m=n+1))&&v("overflow"),r+=(s-t)*m,t=s,a=0;ac&&v("overflow"),d==t){for(u=r,h=l;!(u<(f=h<=o?1:h>=o+26?26:h-o));h+=l)_=u-f,b=l-f,k.push(g(S(f+_%b,0))),u=y(_/b);k.push(g(S(u,0))),o=E(r,m,n==i),r=0,++n}++r,++t}return k.join("")}if(s={version:"1.4.1",ucs2:{decode:w,encode:_},decode:k,encode:A,toASCII:function(e){return b(e,(function(e){return f.test(e)?"xn--"+A(e):e}))},toUnicode:function(e){return b(e,(function(e){return h.test(e)?k(e.slice(4).toLowerCase()):e}))}},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",(function(){return s}));else if(i&&o)if(t.exports==i)o.exports=s;else for(u in s)s.hasOwnProperty(u)&&(i[u]=s[u]);else n.punycode=s}(this)}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],13:[function(e,t,r){"use strict";function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.exports=function(e,t,r,o){t=t||"&",r=r||"=";var a={};if("string"!=typeof e||0===e.length)return a;var s=/\+/g;e=e.split(t);var u=1e3;o&&"number"==typeof o.maxKeys&&(u=o.maxKeys);var c=e.length;u>0&&c>u&&(c=u);for(var l=0;l=0?(h=y.substr(0,g),f=y.substr(g+1)):(h=y,f=""),d=decodeURIComponent(h),p=decodeURIComponent(f),n(a,d)?i(a[d])?a[d].push(p):a[d]=[a[d],p]:a[d]=p}return a};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{}],14:[function(e,t,r){"use strict";var n=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};t.exports=function(e,t,r,s){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?o(a(e),(function(a){var s=encodeURIComponent(n(a))+r;return i(e[a])?o(e[a],(function(e){return s+encodeURIComponent(n(e))})).join(t):s+encodeURIComponent(n(e[a]))})).join(t):s?encodeURIComponent(n(s))+r+encodeURIComponent(n(e)):""};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function o(e,t){if(e.map)return e.map(t);for(var r=[],n=0;n>1,l=-7,h=r?i-1:0,f=r?-1:1,d=e[t+h];for(h+=f,o=d&(1<<-l)-1,d>>=-l,l+=a;l>0;o=256*o+e[t+h],h+=f,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=n;l>0;s=256*s+e[t+h],h+=f,l-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,n),o-=c}return(d?-1:1)*s*Math.pow(2,o-n)},r.write=function(e,t,r,n,i,o){var s,a,u,c=8*o-i-1,l=(1<>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+h>=1?f/u:f*Math.pow(2,1-h))*u>=2&&(s++,u/=2),s+h>=l?(a=0,s=l):s+h>=1?(a=(t*u-1)*Math.pow(2,i),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;e[r+d]=255&a,d+=p,a/=256,i-=8);for(s=s<0;e[r+d]=255&s,d+=p,s/=256,c-=8);e[r+d-p]|=128*y}},{}],9:[function(e,t,r){"function"==typeof Object.create?t.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},{}],10:[function(e,t,r){(function(e){(function(){"use strict";function r(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function n(e,t){for(var r,n="",i=0,o=-1,s=0,a=0;a<=e.length;++a){if(a2){var u=n.lastIndexOf("/");if(u!==n.length-1){-1===u?(n="",i=0):i=(n=n.slice(0,u)).length-1-n.lastIndexOf("/"),o=a,s=0;continue}}else if(2===n.length||1===n.length){n="",i=0,o=a,s=0;continue}t&&(n.length>0?n+="/..":n="..",i=2)}else n.length>0?n+="/"+e.slice(o+1,a):n=e.slice(o+1,a),i=a-o-1;o=a,s=0}else 46===r&&-1!==s?++s:s=-1}return n}var i={resolve:function(){for(var t,i="",o=!1,s=arguments.length-1;s>=-1&&!o;s--){var a;s>=0?a=arguments[s]:(void 0===t&&(t=e.cwd()),a=t),r(a),0!==a.length&&(i=a+"/"+i,o=47===a.charCodeAt(0))}return i=n(i,!o),o?i.length>0?"/"+i:"/":i.length>0?i:"."},normalize:function(e){if(r(e),0===e.length)return".";var t=47===e.charCodeAt(0),i=47===e.charCodeAt(e.length-1);return 0!==(e=n(e,!t)).length||t||(e="."),e.length>0&&i&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return r(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,t=0;t0&&(void 0===e?e=n:e+="/"+n)}return void 0===e?".":i.normalize(e)},relative:function(e,t){if(r(e),r(t),e===t)return"";if((e=i.resolve(e))===(t=i.resolve(t)))return"";for(var n=1;nc){if(47===t.charCodeAt(a+h))return t.slice(a+h+1);if(0===h)return t.slice(a+h)}else s>c&&(47===e.charCodeAt(n+h)?l=h:0===h&&(l=0));break}var f=e.charCodeAt(n+h);if(f!==t.charCodeAt(a+h))break;47===f&&(l=h)}var d="";for(h=n+l+1;h<=o;++h)h!==o&&47!==e.charCodeAt(h)||(0===d.length?d+="..":d+="/..");return d.length>0?d+t.slice(a+l):(a+=l,47===t.charCodeAt(a)&&++a,t.slice(a))},_makeLong:function(e){return e},dirname:function(e){if(r(e),0===e.length)return".";for(var t=e.charCodeAt(0),n=47===t,i=-1,o=!0,s=e.length-1;s>=1;--s)if(47===(t=e.charCodeAt(s))){if(!o){i=s;break}}else o=!1;return-1===i?n?"/":".":n&&1===i?"//":e.slice(0,i)},basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');r(e);var n,i=0,o=-1,s=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var a=t.length-1,u=-1;for(n=e.length-1;n>=0;--n){var c=e.charCodeAt(n);if(47===c){if(!s){i=n+1;break}}else-1===u&&(s=!1,u=n+1),a>=0&&(c===t.charCodeAt(a)?-1==--a&&(o=n):(a=-1,o=u))}return i===o?o=u:-1===o&&(o=e.length),e.slice(i,o)}for(n=e.length-1;n>=0;--n)if(47===e.charCodeAt(n)){if(!s){i=n+1;break}}else-1===o&&(s=!1,o=n+1);return-1===o?"":e.slice(i,o)},extname:function(e){r(e);for(var t=-1,n=0,i=-1,o=!0,s=0,a=e.length-1;a>=0;--a){var u=e.charCodeAt(a);if(47!==u)-1===i&&(o=!1,i=a+1),46===u?-1===t?t=a:1!==s&&(s=1):-1!==t&&(s=-1);else if(!o){n=a+1;break}}return-1===t||-1===i||0===s||1===s&&t===i-1&&t===n+1?"":e.slice(t,i)},format:function(e){if(null===e||"object"!=typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var r=t.dir||t.root,n=t.base||(t.name||"")+(t.ext||"");return r?r===t.root?r+n:r+e+n:n}("/",e)},parse:function(e){r(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return t;var n,i=e.charCodeAt(0),o=47===i;o?(t.root="/",n=1):n=0;for(var s=-1,a=0,u=-1,c=!0,l=e.length-1,h=0;l>=n;--l)if(47!==(i=e.charCodeAt(l)))-1===u&&(c=!1,u=l+1),46===i?-1===s?s=l:1!==h&&(h=1):-1!==s&&(h=-1);else if(!c){a=l+1;break}return-1===s||-1===u||0===h||1===h&&s===u-1&&s===a+1?-1!==u&&(t.base=t.name=0===a&&o?e.slice(1,u):e.slice(a,u)):(0===a&&o?(t.name=e.slice(1,s),t.base=e.slice(1,u)):(t.name=e.slice(a,s),t.base=e.slice(a,u)),t.ext=e.slice(s,u)),a>0?t.dir=e.slice(0,a-1):o&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};i.posix=i,t.exports=i}).call(this)}).call(this,e("_process"))},{_process:11}],11:[function(e,t,r){var n,i,o=t.exports={};function s(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function u(e){if(n===setTimeout)return setTimeout(e,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:s}catch(e){n=s}try{i="function"==typeof clearTimeout?clearTimeout:a}catch(e){i=a}}();var c,l=[],h=!1,f=-1;function d(){h&&c&&(h=!1,c.length?l=c.concat(l):f=-1,l.length&&p())}function p(){if(!h){var e=u(d);h=!0;for(var t=l.length;t;){for(c=l,l=[];++f1)for(var r=1;r= 0x80 (not a basic code point)","invalid-input":"Invalid input"},y=Math.floor,g=String.fromCharCode;function v(e){throw new RangeError(p[e])}function m(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}function b(e,t){var r=e.split("@"),n="";return r.length>1&&(n=r[0]+"@",e=r[1]),n+m((e=e.replace(d,".")).split("."),t).join(".")}function w(e){for(var t,r,n=[],i=0,o=e.length;i=55296&&t<=56319&&i65535&&(t+=g((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=g(e)})).join("")}function S(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function E(e,t,r){var n=0;for(e=r?y(e/700):e>>1,e+=y(e/t);e>455;n+=l)e=y(e/35);return y(n+36*e/(e+38))}function k(e){var t,r,n,i,o,s,a,u,h,f,d,p=[],g=e.length,m=0,b=128,w=72;for((r=e.lastIndexOf("-"))<0&&(r=0),n=0;n=128&&v("not-basic"),p.push(e.charCodeAt(n));for(i=r>0?r+1:0;i=g&&v("invalid-input"),((u=(d=e.charCodeAt(i++))-48<10?d-22:d-65<26?d-65:d-97<26?d-97:l)>=l||u>y((c-m)/s))&&v("overflow"),m+=u*s,!(u<(h=a<=w?1:a>=w+26?26:a-w));a+=l)s>y(c/(f=l-h))&&v("overflow"),s*=f;w=E(m-o,t=p.length+1,0==o),y(m/t)>c-b&&v("overflow"),b+=y(m/t),m%=t,p.splice(m++,0,b)}return _(p)}function A(e){var t,r,n,i,o,s,a,u,h,f,d,p,m,b,_,k=[];for(p=(e=w(e)).length,t=128,r=0,o=72,s=0;s=t&&dy((c-r)/(m=n+1))&&v("overflow"),r+=(a-t)*m,t=a,s=0;sc&&v("overflow"),d==t){for(u=r,h=l;!(u<(f=h<=o?1:h>=o+26?26:h-o));h+=l)_=u-f,b=l-f,k.push(g(S(f+_%b,0))),u=y(_/b);k.push(g(S(u,0))),o=E(r,m,n==i),r=0,++n}++r,++t}return k.join("")}if(a={version:"1.4.1",ucs2:{decode:w,encode:_},decode:k,encode:A,toASCII:function(e){return b(e,(function(e){return f.test(e)?"xn--"+A(e):e}))},toUnicode:function(e){return b(e,(function(e){return h.test(e)?k(e.slice(4).toLowerCase()):e}))}},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",(function(){return a}));else if(i&&o)if(t.exports==i)o.exports=a;else for(u in a)a.hasOwnProperty(u)&&(i[u]=a[u]);else n.punycode=a}(this)}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],13:[function(e,t,r){"use strict";function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.exports=function(e,t,r,o){t=t||"&",r=r||"=";var s={};if("string"!=typeof e||0===e.length)return s;var a=/\+/g;e=e.split(t);var u=1e3;o&&"number"==typeof o.maxKeys&&(u=o.maxKeys);var c=e.length;u>0&&c>u&&(c=u);for(var l=0;l=0?(h=y.substr(0,g),f=y.substr(g+1)):(h=y,f=""),d=decodeURIComponent(h),p=decodeURIComponent(f),n(s,d)?i(s[d])?s[d].push(p):s[d]=[s[d],p]:s[d]=p}return s};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{}],14:[function(e,t,r){"use strict";var n=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};t.exports=function(e,t,r,a){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?o(s(e),(function(s){var a=encodeURIComponent(n(s))+r;return i(e[s])?o(e[s],(function(e){return a+encodeURIComponent(n(e))})).join(t):a+encodeURIComponent(n(e[s]))})).join(t):a?encodeURIComponent(n(a))+r+encodeURIComponent(n(e)):""};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function o(e,t){if(e.map)return e.map(t);for(var r=[],n=0;n */ -var n=e("buffer"),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function a(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=n:(o(n,r),r.Buffer=a),a.prototype=Object.create(i.prototype),o(i,a),a.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},a.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},{buffer:4}],17:[function(e,t,r){(function(t){(function(){var n=e("./lib/request"),i=e("./lib/response"),o=e("xtend"),a=e("builtin-status-codes"),s=e("url"),u=r;u.request=function(e,r){e="string"==typeof e?s.parse(e):o(e);var i=-1===t.location.protocol.search(/^https?:$/)?"http:":"",a=e.protocol||i,u=e.hostname||e.host,c=e.port,l=e.path||"/";u&&-1!==u.indexOf(":")&&(u="["+u+"]"),e.url=(u?a+"//"+u:"")+(c?":"+c:"")+l,e.method=(e.method||"GET").toUpperCase(),e.headers=e.headers||{};var h=new n(e);return r&&h.on("response",r),h},u.get=function(e,t){var r=u.request(e,t);return r.end(),r},u.ClientRequest=n,u.IncomingMessage=i.IncomingMessage,u.Agent=function(){},u.Agent.defaultMaxSockets=4,u.globalAgent=new u.Agent,u.STATUS_CODES=a,u.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./lib/request":19,"./lib/response":20,"builtin-status-codes":5,url:37,xtend:40}],18:[function(e,t,r){(function(e){(function(){var t;function n(){if(void 0!==t)return t;if(e.XMLHttpRequest){t=new e.XMLHttpRequest;try{t.open("GET",e.XDomainRequest?"/":"https://example.com")}catch(e){t=null}}else t=null;return t}function i(e){var t=n();if(!t)return!1;try{return t.responseType=e,t.responseType===e}catch(e){}return!1}function o(e){return"function"==typeof e}r.fetch=o(e.fetch)&&o(e.ReadableStream),r.writableStream=o(e.WritableStream),r.abortController=o(e.AbortController),r.arraybuffer=r.fetch||i("arraybuffer"),r.msstream=!r.fetch&&i("ms-stream"),r.mozchunkedarraybuffer=!r.fetch&&i("moz-chunked-arraybuffer"),r.overrideMimeType=r.fetch||!!n()&&o(n().overrideMimeType),t=null}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],19:[function(e,t,r){(function(r,n,i){(function(){var o=e("./capability"),a=e("inherits"),s=e("./response"),u=e("readable-stream"),c=s.IncomingMessage,l=s.readyStates;var h=t.exports=function(e){var t,r=this;u.Writable.call(r),r._opts=e,r._body=[],r._headers={},e.auth&&r.setHeader("Authorization","Basic "+i.from(e.auth).toString("base64")),Object.keys(e.headers).forEach((function(t){r.setHeader(t,e.headers[t])}));var n=!0;if("disable-fetch"===e.mode||"requestTimeout"in e&&!o.abortController)n=!1,t=!0;else if("prefer-streaming"===e.mode)t=!1;else if("allow-wrong-content-type"===e.mode)t=!o.overrideMimeType;else{if(e.mode&&"default"!==e.mode&&"prefer-fast"!==e.mode)throw new Error("Invalid value for opts.mode");t=!0}r._mode=function(e,t){return o.fetch&&t?"fetch":o.mozchunkedarraybuffer?"moz-chunked-arraybuffer":o.msstream?"ms-stream":o.arraybuffer&&e?"arraybuffer":"text"}(t,n),r._fetchTimer=null,r._socketTimeout=null,r._socketTimer=null,r.on("finish",(function(){r._onFinish()}))};a(h,u.Writable),h.prototype.setHeader=function(e,t){var r=e.toLowerCase();-1===f.indexOf(r)&&(this._headers[r]={name:e,value:t})},h.prototype.getHeader=function(e){var t=this._headers[e.toLowerCase()];return t?t.value:null},h.prototype.removeHeader=function(e){delete this._headers[e.toLowerCase()]},h.prototype._onFinish=function(){var e=this;if(!e._destroyed){var t=e._opts;"timeout"in t&&0!==t.timeout&&e.setTimeout(t.timeout);var i=e._headers,a=null;"GET"!==t.method&&"HEAD"!==t.method&&(a=new Blob(e._body,{type:(i["content-type"]||{}).value||""}));var s=[];if(Object.keys(i).forEach((function(e){var t=i[e].name,r=i[e].value;Array.isArray(r)?r.forEach((function(e){s.push([t,e])})):s.push([t,r])})),"fetch"===e._mode){var u=null;if(o.abortController){var c=new AbortController;u=c.signal,e._fetchAbortController=c,"requestTimeout"in t&&0!==t.requestTimeout&&(e._fetchTimer=n.setTimeout((function(){e.emit("requestTimeout"),e._fetchAbortController&&e._fetchAbortController.abort()}),t.requestTimeout))}n.fetch(e._opts.url,{method:e._opts.method,headers:s,body:a||void 0,mode:"cors",credentials:t.withCredentials?"include":"same-origin",signal:u}).then((function(t){e._fetchResponse=t,e._resetTimers(!1),e._connect()}),(function(t){e._resetTimers(!0),e._destroyed||e.emit("error",t)}))}else{var h=e._xhr=new n.XMLHttpRequest;try{h.open(e._opts.method,e._opts.url,!0)}catch(t){return void r.nextTick((function(){e.emit("error",t)}))}"responseType"in h&&(h.responseType=e._mode),"withCredentials"in h&&(h.withCredentials=!!t.withCredentials),"text"===e._mode&&"overrideMimeType"in h&&h.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in t&&(h.timeout=t.requestTimeout,h.ontimeout=function(){e.emit("requestTimeout")}),s.forEach((function(e){h.setRequestHeader(e[0],e[1])})),e._response=null,h.onreadystatechange=function(){switch(h.readyState){case l.LOADING:case l.DONE:e._onXHRProgress()}},"moz-chunked-arraybuffer"===e._mode&&(h.onprogress=function(){e._onXHRProgress()}),h.onerror=function(){e._destroyed||(e._resetTimers(!0),e.emit("error",new Error("XHR error")))};try{h.send(a)}catch(t){return void r.nextTick((function(){e.emit("error",t)}))}}}},h.prototype._onXHRProgress=function(){var e=this;e._resetTimers(!1),function(e){try{var t=e.status;return null!==t&&0!==t}catch(e){return!1}}(e._xhr)&&!e._destroyed&&(e._response||e._connect(),e._response._onXHRProgress(e._resetTimers.bind(e)))},h.prototype._connect=function(){var e=this;e._destroyed||(e._response=new c(e._xhr,e._fetchResponse,e._mode,e._resetTimers.bind(e)),e._response.on("error",(function(t){e.emit("error",t)})),e.emit("response",e._response))},h.prototype._write=function(e,t,r){this._body.push(e),r()},h.prototype._resetTimers=function(e){var t=this;n.clearTimeout(t._socketTimer),t._socketTimer=null,e?(n.clearTimeout(t._fetchTimer),t._fetchTimer=null):t._socketTimeout&&(t._socketTimer=n.setTimeout((function(){t.emit("timeout")}),t._socketTimeout))},h.prototype.abort=h.prototype.destroy=function(e){var t=this;t._destroyed=!0,t._resetTimers(!0),t._response&&(t._response._destroyed=!0),t._xhr?t._xhr.abort():t._fetchAbortController&&t._fetchAbortController.abort(),e&&t.emit("error",e)},h.prototype.end=function(e,t,r){"function"==typeof e&&(r=e,e=void 0),u.Writable.prototype.end.call(this,e,t,r)},h.prototype.setTimeout=function(e,t){var r=this;t&&r.once("timeout",t),r._socketTimeout=e,r._resetTimers(!1)},h.prototype.flushHeaders=function(){},h.prototype.setNoDelay=function(){},h.prototype.setSocketKeepAlive=function(){};var f=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"]}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer)},{"./capability":18,"./response":20,_process:11,buffer:4,inherits:9,"readable-stream":35}],20:[function(e,t,r){(function(t,n,i){(function(){var o=e("./capability"),a=e("inherits"),s=e("readable-stream"),u=r.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},c=r.IncomingMessage=function(e,r,n,a){var u=this;if(s.Readable.call(u),u._mode=n,u.headers={},u.rawHeaders=[],u.trailers={},u.rawTrailers=[],u.on("end",(function(){t.nextTick((function(){u.emit("close")}))})),"fetch"===n){if(u._fetchResponse=r,u.url=r.url,u.statusCode=r.status,u.statusMessage=r.statusText,r.headers.forEach((function(e,t){u.headers[t.toLowerCase()]=e,u.rawHeaders.push(t,e)})),o.writableStream){var c=new WritableStream({write:function(e){return a(!1),new Promise((function(t,r){u._destroyed?r():u.push(i.from(e))?t():u._resumeFetch=t}))},close:function(){a(!0),u._destroyed||u.push(null)},abort:function(e){a(!0),u._destroyed||u.emit("error",e)}});try{return void r.body.pipeTo(c).catch((function(e){a(!0),u._destroyed||u.emit("error",e)}))}catch(e){}}var l=r.body.getReader();!function e(){l.read().then((function(t){u._destroyed||(a(t.done),t.done?u.push(null):(u.push(i.from(t.value)),e()))})).catch((function(e){a(!0),u._destroyed||u.emit("error",e)}))}()}else{if(u._xhr=e,u._pos=0,u.url=e.responseURL,u.statusCode=e.status,u.statusMessage=e.statusText,e.getAllResponseHeaders().split(/\r?\n/).forEach((function(e){var t=e.match(/^([^:]+):\s*(.*)/);if(t){var r=t[1].toLowerCase();"set-cookie"===r?(void 0===u.headers[r]&&(u.headers[r]=[]),u.headers[r].push(t[2])):void 0!==u.headers[r]?u.headers[r]+=", "+t[2]:u.headers[r]=t[2],u.rawHeaders.push(t[1],t[2])}})),u._charset="x-user-defined",!o.overrideMimeType){var h=u.rawHeaders["mime-type"];if(h){var f=h.match(/;\s*charset=([^;])(;|$)/);f&&(u._charset=f[1].toLowerCase())}u._charset||(u._charset="utf-8")}}};a(c,s.Readable),c.prototype._read=function(){var e=this._resumeFetch;e&&(this._resumeFetch=null,e())},c.prototype._onXHRProgress=function(e){var t=this,r=t._xhr,o=null;switch(t._mode){case"text":if((o=r.responseText).length>t._pos){var a=o.substr(t._pos);if("x-user-defined"===t._charset){for(var s=i.alloc(a.length),c=0;ct._pos&&(t.push(i.from(new Uint8Array(l.result.slice(t._pos)))),t._pos=l.result.byteLength)},l.onload=function(){e(!0),t.push(null)},l.readAsArrayBuffer(o)}t._xhr.readyState===u.DONE&&"ms-stream"!==t._mode&&(e(!0),t.push(null))}}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer)},{"./capability":18,_process:11,buffer:4,inherits:9,"readable-stream":35}],21:[function(e,t,r){"use strict";var n={};function i(e,t,r){r||(r=Error);var i=function(e){var r,n;function i(r,n,i){return e.call(this,function(e,r,n){return"string"==typeof t?t:t(e,r,n)}(r,n,i))||this}return n=e,(r=i).prototype=Object.create(n.prototype),r.prototype.constructor=r,r.__proto__=n,i}(r);i.prototype.name=r.name,i.prototype.code=e,n[e]=i}function o(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}i("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),i("ERR_INVALID_ARG_TYPE",(function(e,t,r){var n,i,a,s;if("string"==typeof t&&(i="not ",t.substr(!a||a<0?0:+a,i.length)===i)?(n="must not be",t=t.replace(/^not /,"")):n="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))s="The ".concat(e," ").concat(n," ").concat(o(t,"type"));else{var u=function(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}(e,".")?"property":"argument";s='The "'.concat(e,'" ').concat(u," ").concat(n," ").concat(o(t,"type"))}return s+=". Received type ".concat(typeof r)}),TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},{}],22:[function(e,t,r){(function(r){(function(){"use strict";var n=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};t.exports=c;var i=e("./_stream_readable"),o=e("./_stream_writable");e("inherits")(c,i);for(var a=n(o.prototype),s=0;s0)if("string"==typeof t||a.objectMode||Object.getPrototypeOf(t)===s.prototype||(t=function(e){return s.from(e)}(t)),n)a.endEmitted?S(e,new _):x(e,a,t,!0);else if(a.ended)S(e,new b);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!r?(t=a.decoder.write(t),a.objectMode||0!==t.length?x(e,a,t,!1):j(e,a)):x(e,a,t,!1)}else n||(a.reading=!1,j(e,a));return!a.ended&&(a.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=R?e=R:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function M(e){var t=e._readableState;c("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(c("emitReadable",t.flowing),t.emittedReadable=!0,r.nextTick(T,e))}function T(e){var t=e._readableState;c("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,U(e)}function j(e,t){t.readingMore||(t.readingMore=!0,r.nextTick(L,e,t))}function L(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function P(e){c("readable nexttick read 0"),e.read(0)}function N(e,t){c("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),U(e),t.flowing&&!t.reading&&e.read(0)}function U(e){var t=e._readableState;for(c("flow",t.flowing);t.flowing&&null!==e.read(););}function B(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function D(e){var t=e._readableState;c("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,r.nextTick(q,t,e))}function q(e,t){if(c("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function z(e,t){for(var r=0,n=e.length;r=t.highWaterMark:t.length>0)||t.ended))return c("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?D(this):M(this),null;if(0===(e=C(e,t))&&t.ended)return 0===t.length&&D(this),null;var n,i=t.needReadable;return c("need readable",i),(0===t.length||t.length-e0?B(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&D(this)),null!==n&&this.emit("data",n),n},A.prototype._read=function(e){S(this,new w("_read()"))},A.prototype.pipe=function(e,t){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e)}i.pipesCount+=1,c("pipe count=%d opts=%j",i.pipesCount,t);var a=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr?u:g;function s(t,r){c("onunpipe"),t===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,c("cleanup"),e.removeListener("close",p),e.removeListener("finish",y),e.removeListener("drain",l),e.removeListener("error",d),e.removeListener("unpipe",s),n.removeListener("end",u),n.removeListener("end",g),n.removeListener("data",f),h=!0,!i.awaitDrain||e._writableState&&!e._writableState.needDrain||l())}function u(){c("onend"),e.end()}i.endEmitted?r.nextTick(a):n.once("end",a),e.on("unpipe",s);var l=function(e){return function(){var t=e._readableState;c("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&o(e,"data")&&(t.flowing=!0,U(e))}}(n);e.on("drain",l);var h=!1;function f(t){c("ondata");var r=e.write(t);c("dest.write",r),!1===r&&((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==z(i.pipes,e))&&!h&&(c("false write response, pause",i.awaitDrain),i.awaitDrain++),n.pause())}function d(t){c("onerror",t),g(),e.removeListener("error",d),0===o(e,"error")&&S(e,t)}function p(){e.removeListener("finish",y),g()}function y(){c("onfinish"),e.removeListener("close",p),g()}function g(){c("unpipe"),n.unpipe(e)}return n.on("data",f),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",d),e.once("close",p),e.once("finish",y),e.emit("pipe",n),i.flowing||(c("pipe resume"),n.resume()),e},A.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,c("on readable",i.length,i.reading),i.length?M(this):i.reading||r.nextTick(P,this))),n},A.prototype.addListener=A.prototype.on,A.prototype.removeListener=function(e,t){var n=a.prototype.removeListener.call(this,e,t);return"readable"===e&&r.nextTick(I,this),n},A.prototype.removeAllListeners=function(e){var t=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||r.nextTick(I,this),t},A.prototype.resume=function(){var e=this._readableState;return e.flowing||(c("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,r.nextTick(N,e,t))}(this,e)),e.paused=!1,this},A.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},A.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var i in e.on("end",(function(){if(c("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(i){(c("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(t.push(i)||(n=!0,e.pause()))})),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var o=0;o-1))throw new _(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(A.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(A.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),A.prototype._write=function(e,t,r){r(new y("_write()"))},A.prototype._writev=null,A.prototype.end=function(e,t,n){var i=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||function(e,t,n){t.ending=!0,T(e,t),n&&(t.finished?r.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,i,n),this},Object.defineProperty(A.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(A.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),A.prototype.destroy=h.destroy,A.prototype._undestroy=h.undestroy,A.prototype._destroy=function(e,t){t(e)}}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../errors":21,"./_stream_duplex":22,"./internal/streams/destroy":29,"./internal/streams/state":33,"./internal/streams/stream":34,_process:11,buffer:4,inherits:9,"util-deprecate":39}],27:[function(e,t,r){(function(r){(function(){"use strict";var n;function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var o=e("./end-of-stream"),a=Symbol("lastResolve"),s=Symbol("lastReject"),u=Symbol("error"),c=Symbol("ended"),l=Symbol("lastPromise"),h=Symbol("handlePromise"),f=Symbol("stream");function d(e,t){return{value:e,done:t}}function p(e){var t=e[a];if(null!==t){var r=e[f].read();null!==r&&(e[l]=null,e[a]=null,e[s]=null,t(d(r,!1)))}}function y(e){r.nextTick(p,e)}var g=Object.getPrototypeOf((function(){})),v=Object.setPrototypeOf((i(n={get stream(){return this[f]},next:function(){var e=this,t=this[u];if(null!==t)return Promise.reject(t);if(this[c])return Promise.resolve(d(void 0,!0));if(this[f].destroyed)return new Promise((function(t,n){r.nextTick((function(){e[u]?n(e[u]):t(d(void 0,!0))}))}));var n,i=this[l];if(i)n=new Promise(function(e,t){return function(r,n){e.then((function(){t[c]?r(d(void 0,!0)):t[h](r,n)}),n)}}(i,this));else{var o=this[f].read();if(null!==o)return Promise.resolve(d(o,!1));n=new Promise(this[h])}return this[l]=n,n}},Symbol.asyncIterator,(function(){return this})),i(n,"return",(function(){var e=this;return new Promise((function(t,r){e[f].destroy(null,(function(e){e?r(e):t(d(void 0,!0))}))}))})),n),g);t.exports=function(e){var t,r=Object.create(v,(i(t={},f,{value:e,writable:!0}),i(t,a,{value:null,writable:!0}),i(t,s,{value:null,writable:!0}),i(t,u,{value:null,writable:!0}),i(t,c,{value:e._readableState.endEmitted,writable:!0}),i(t,h,{value:function(e,t){var n=r[f].read();n?(r[l]=null,r[a]=null,r[s]=null,e(d(n,!1))):(r[a]=e,r[s]=t)},writable:!0}),t));return r[l]=null,o(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[s];return null!==t&&(r[l]=null,r[a]=null,r[s]=null,t(e)),void(r[u]=e)}var n=r[a];null!==n&&(r[l]=null,r[a]=null,r[s]=null,n(d(void 0,!0))),r[c]=!0})),e.on("readable",y.bind(null,r)),r}}).call(this)}).call(this,e("_process"))},{"./end-of-stream":30,_process:11}],28:[function(e,t,r){"use strict";function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){for(var r=0;r0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return a.alloc(0);for(var t,r,n,i=a.allocUnsafe(e>>>0),o=this.head,s=0;o;)t=o.data,r=i,n=s,a.prototype.copy.call(t,r,n),s+=o.data.length,o=o.next;return i}},{key:"consume",value:function(e,t){var r;return ei.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0==(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=a.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0==(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,t}},{key:u,value:function(e,t){return s(this,function(e){for(var t=1;t0,(function(e){n||(n=e),e&&a.forEach(c),o||(a.forEach(c),i(n))}))}));return t.reduce(l)}},{"../../../errors":21,"./end-of-stream":30}],33:[function(e,t,r){"use strict";var n=e("../../../errors").codes.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(e,t,r,i){var o=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,i,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new n(i?r:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}},{"../../../errors":21}],34:[function(e,t,r){t.exports=e("events").EventEmitter},{events:6}],35:[function(e,t,r){(r=t.exports=e("./lib/_stream_readable.js")).Stream=r,r.Readable=r,r.Writable=e("./lib/_stream_writable.js"),r.Duplex=e("./lib/_stream_duplex.js"),r.Transform=e("./lib/_stream_transform.js"),r.PassThrough=e("./lib/_stream_passthrough.js"),r.finished=e("./lib/internal/streams/end-of-stream.js"),r.pipeline=e("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":22,"./lib/_stream_passthrough.js":23,"./lib/_stream_readable.js":24,"./lib/_stream_transform.js":25,"./lib/_stream_writable.js":26,"./lib/internal/streams/end-of-stream.js":30,"./lib/internal/streams/pipeline.js":32}],36:[function(e,t,r){"use strict";var n=e("safe-buffer").Buffer,i=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=u,this.end=c,t=4;break;case"utf8":this.fillLast=s,t=4;break;case"base64":this.text=l,this.end=h,t=3;break;default:return this.write=f,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function a(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function s(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function u(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function c(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function l(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function h(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function f(e){return e.toString(this.encoding)}function d(e){return e&&e.length?this.write(e):""}r.StringDecoder=o,o.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0)return i>0&&(e.lastNeed=i-1),i;if(--n=0)return i>0&&(e.lastNeed=i-2),i;if(--n=0)return i>0&&(2===i?i=0:e.lastNeed=i-3),i;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},{"safe-buffer":16}],37:[function(e,t,r){"use strict";var n=e("punycode"),i=e("./util");function o(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}r.parse=b,r.resolve=function(e,t){return b(e,!1,!0).resolve(t)},r.resolveObject=function(e,t){return e?b(e,!1,!0).resolveObject(t):t},r.format=function(e){i.isString(e)&&(e=b(e));return e instanceof o?e.format():o.prototype.format.call(e)},r.Url=o;var a=/^([a-z0-9.+-]+:)/i,s=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,c=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),l=["'"].concat(c),h=["%","/","?",";","#"].concat(l),f=["/","?","#"],d=/^[+a-z0-9A-Z_-]{0,63}$/,p=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,y={javascript:!0,"javascript:":!0},g={javascript:!0,"javascript:":!0},v={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},m=e("querystring");function b(e,t,r){if(e&&i.isObject(e)&&e instanceof o)return e;var n=new o;return n.parse(e,t,r),n}o.prototype.parse=function(e,t,r){if(!i.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var o=e.indexOf("?"),s=-1!==o&&o127?L+="x":L+=j[I];if(!L.match(d)){var N=M.slice(0,x),U=M.slice(x+1),B=j.match(p);B&&(N.push(B[1]),U.unshift(B[2])),U.length&&(b="/"+U.join(".")+b),this.hostname=N.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),C||(this.hostname=n.toASCII(this.hostname));var D=this.port?":"+this.port:"",q=this.hostname||"";this.host=q+D,this.href+=this.host,C&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!y[S])for(x=0,T=l.length;x0)&&r.host.split("@"))&&(r.auth=C.shift(),r.host=r.hostname=C.shift());return r.search=e.search,r.query=e.query,i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!E.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var A=E.slice(-1)[0],O=(r.host||e.host||E.length>1)&&("."===A||".."===A)||""===A,x=0,R=E.length;R>=0;R--)"."===(A=E[R])?E.splice(R,1):".."===A?(E.splice(R,1),x++):x&&(E.splice(R,1),x--);if(!_&&!S)for(;x--;x)E.unshift("..");!_||""===E[0]||E[0]&&"/"===E[0].charAt(0)||E.unshift(""),O&&"/"!==E.join("/").substr(-1)&&E.push("");var C,M=""===E[0]||E[0]&&"/"===E[0].charAt(0);k&&(r.hostname=r.host=M?"":E.length?E.shift():"",(C=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=C.shift(),r.host=r.hostname=C.shift()));return(_=_||r.host&&E.length)&&!M&&E.unshift(""),E.length?r.pathname=E.join("/"):(r.pathname=null,r.path=null),i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},o.prototype.parseHost=function(){var e=this.host,t=s.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},{"./util":38,punycode:12,querystring:15}],38:[function(e,t,r){"use strict";t.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},{}],39:[function(e,t,r){(function(e){(function(){function r(t){try{if(!e.localStorage)return!1}catch(e){return!1}var r=e.localStorage[t];return null!=r&&"true"===String(r).toLowerCase()}t.exports=function(e,t){if(r("noDeprecation"))return e;var n=!1;return function(){if(!n){if(r("throwDeprecation"))throw new Error(t);r("traceDeprecation")?console.trace(t):console.warn(t),n=!0}return e.apply(this,arguments)}}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],40:[function(e,t,r){t.exports=function(){for(var e={},t=0;t0)return this.client.emit("updateAvalible",e),Promise.all(e.map((async e=>{let t=Object.values(JSON.parse(await(0,a.fetch)(i.data[e]))||[]);this.client.set(e,t),o.default.writeFileSync(i.local[e],JSON.stringify(t))})))}start(){this.cron||this.client.emit("debug","Notify for new data updates enabled. AzurAPI Client will check for data updates every hour."),this.cron&&clearInterval(this.cron),this.cron=setInterval((()=>this.update()),this.client.rate)}stop(){this.cron&&clearInterval(this.cron),this.cron=void 0}async init(){o.default.existsSync(i.baseFolder)||o.default.mkdirSync(i.baseFolder),await this.load(),this.client.emit("ready")}load(){for(let e=0;ea.default.get(e,(e=>{let r="";e.on("data",(e=>r+=e)),e.on("end",(()=>t(r)))})).on("error",(e=>r(e)))))}r.check=async function(){!u&&o.default.existsSync(i.versionInfo)&&(u=JSON.parse(o.default.readFileSync(i.versionInfo).toString())),c=JSON.parse(await l(i.data.version));let e=[];for(let t of s)u&&u[t]&&c[t]["version-number"]===u[t]["version-number"]||e.push(t);return e},r.save=function(){c&&o.default.writeFileSync(i.versionInfo,JSON.stringify(u=c))},r.fetch=l},{"./Data":43,fs:3,https:7}],45:[function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.normalize=r.NATIONS=void 0;const i=n(e("fuse.js"));r.NATIONS={"Eagle Union":["uss","eagle union"],"Royal Navy":["hms","royal navy"],"Sakura Empire":["ijn","sakura empire"],"Iron Blood":["kms","iron blood"],"Dragon Empery":["pran","dragon empery"],"Northern Parliament":["sn","northern parliament"],"Iris Libre":["ffnf","iris libre"],"Vichya Domination":["mnf","vichya domination"],"Sardenga Empire":["rn","sardegna empire"],Neptunia:["hdn","neptunia"],Bilibili:["bili","bilibili"],"Venus Vacation":["venus","venus vacation"],Utawarerumono:["utawarerumono"],"Kizuna AI":["kizunaai","kizuna ai"],Hololive:["hololive"],META:["meta"],Universal:["universal","univ"]};r.default=class{raw;fuse;client;constructor(e,t){this.raw=[],t&&(this.fuse=new i.default(this.raw,{keys:t,threshold:.4})),this.client=e}setData(e){(new Error).stack.match(/AzurAPI\.set/)&&(this.raw.splice(0,this.raw.length,...e),this.fuse&&this.fuse.setCollection(this.raw))}fuze(e){return this.fuse?this.fuse.search(e,{limit:10}).sort(((e,t)=>(t.score||0)-(e.score||0))):[]}id(e){for(let t of this.raw)if(a(t.id.toUpperCase())===a(e.toUpperCase()))return t}get(e){return this.id(e)||this.fuze(e)?.map((e=>e.item))[0]}filter(e){return this.raw.filter(e)}map(e){return this.raw.map(e)}forEach(e){return this.raw.forEach(e)}every(e){return this.raw.every(e)}some(e){return this.raw.some(e)}};const o=/[\u0300-\u036F]/g;function a(e){return e.normalize("NFKD").replace(o,"")}r.normalize=a},{"fuse.js":52}],46:[function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(r,"__esModule",{value:!0}),r.Barrages=void 0;const a=o(e("./api"));class s extends a.default{constructor(e){super(e,["id","name"])}name(e){for(let t of this.raw)if((0,a.normalize)(t.name.toUpperCase())===(0,a.normalize)(e.toUpperCase()))return t}type(e){return this.raw.filter((t=>(0,a.normalize)(t.type.toUpperCase())===(0,a.normalize)(e.toUpperCase())))}hull(e){return this.raw.filter((t=>(0,a.normalize)(t.hull.toUpperCase())===(0,a.normalize)(e.toUpperCase())))}ships(e){return this.raw.filter((t=>t.ships.map((e=>(0,a.normalize)(e.toUpperCase()))).includes((0,a.normalize)(e.toUpperCase()))))}}r.Barrages=s},{"./api":45}],47:[function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(r,"__esModule",{value:!0}),r.Chapters=void 0;const a=o(e("./api"));class s extends a.default{constructor(e){super(e)}name(e,t=["en","cn","jp"]){for(let r of this.raw)if(t.some((t=>r.names[t]&&(0,a.normalize)(r.names[t].toUpperCase())===(0,a.normalize)(e.toUpperCase()))))return r}}r.Chapters=s},{"./api":45}],48:[function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(r,"__esModule",{value:!0}),r.Equipments=void 0;const a=o(e("./api"));class s extends a.default{constructor(e){super(e,["names.en","names.cn","names.jp","names.kr","names.code","id"])}name(e,t=["en","cn","jp","kr"]){for(let r of this.raw)if(t.some((t=>r.names[t]&&(0,a.normalize)(r.names[t].toUpperCase())===(0,a.normalize)(e.toUpperCase()))))return r}category(e){let t=[];for(let r of this.raw)(0,a.normalize)(r.category.toUpperCase()===(0,a.normalize)(e.toUpperCase()))&&t.push(r);return t}nationality(e){let t=[];e=Object.keys(a.NATIONS).find((t=>a.NATIONS[t].includes(e.toLowerCase())))||e;for(let r of this.raw)(0,a.normalize)(r.nationality.toUpperCase())===(0,a.normalize)(e.toUpperCase())&&t.push(r);return t}_nameAll(e,t=["en","cn","jp","kr"]){return this.raw.filter((r=>t.some((t=>r.names[t]&&(0,a.normalize)(r.names[t].toUpperCase())===(0,a.normalize)(e.toUpperCase())))))}get(e,t){if(!t){let t=this.fuze(e).sort(((e,t)=>(t.score||0)-(e.score||0)))[0];return this.id(e)||this.name(e)||(t?t.item:void 0)}return t.idOnly?this.id(e):t.nameOnly||t.nameOnly&&!t.language?this.name(e):t.nameOnly&&t.language?this.name(e,[t.language]):void 0}all(e){let t=[];return t.push(this.id(e)),t.push(...this._nameAll(e).filter((e=>e))),t.push(...this.fuze(e).map((e=>e.item))),t.filter((e=>null!=e)).filter(((e,t,r)=>t===r.findIndex((t=>t.id===e.id))))}}r.Equipments=s},{"./api":45}],49:[function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(r,"__esModule",{value:!0}),r.Ships=void 0;const a=o(e("./api"));class s extends a.default{constructor(e){super(e,["names.en","names.cn","names.jp","names.kr","names.code","id"])}name(e,t=["en","cn","jp","kr"]){for(let r of this.raw)if(t.some((t=>r.names[t]&&(0,a.normalize)(r.names[t].toUpperCase())===(0,a.normalize)(e.toUpperCase()))))return r}hull(e){return this.raw.filter((t=>t.hullType&&(0,a.normalize)(t.hullType.toUpperCase())===(0,a.normalize)(e.toUpperCase())||t.retrofitHullType&&(0,a.normalize)(t.retrofitHullType.toUpperCase())===(0,a.normalize)(e.toUpperCase())))}nationality(e){let t=[];e=Object.keys(a.NATIONS).find((t=>a.NATIONS[t].includes(e.toLowerCase())))||e;for(let r of this.raw)(0,a.normalize)(r.nationality.toUpperCase())===(0,a.normalize)(e.toUpperCase())&&t.push(r);return t}_nameAll(e,t=["en","cn","jp","kr"]){return this.raw.filter((r=>t.some((t=>r.names[t]&&(0,a.normalize)(r.names[t].toUpperCase())===(0,a.normalize)(e.toUpperCase())))))}get(e,t){if(!t){let t=this.fuze(e).sort(((e,t)=>(t.score||0)-(e.score||0)))[0];return this.id(e)||this.name(e)||(t?t.item:void 0)}return t.idOnly?this.id(e):t.nameOnly||t.nameOnly&&!t.language?this.name(e):t.nameOnly&&t.language?this.name(e,[t.language]):void 0}all(e){let t=[];return t.push(this.id(e)),t.push(...this._nameAll(e).filter((e=>e))),t.push(...this.fuze(e).map((e=>e.item))),t.filter((e=>null!=e)).filter(((e,t,r)=>t===r.findIndex((t=>t.id===e.id))))}}r.Ships=s},{"./api":45}],50:[function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.Voicelines=void 0;const i=n(e("./api"));class o extends i.default{constructor(e){super(e)}}r.Voicelines=o},{"./api":45}],51:[function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(r,"__esModule",{value:!0}),i(e("./core/Client"),r)},{"./core/Client":42}],52:[function(e,t,r){"use strict";function n(e){return n="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},n(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&void 0!==arguments[0]?arguments[0]:3,t=new Map,r=Math.pow(10,e);return{get:function(e){var n=e.match(L).length;if(t.has(n))return t.get(n);var i=1/Math.sqrt(n),o=parseFloat(Math.round(i*r)/r);return t.set(n,o),o},clear:function(){t.clear()}}}var P=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.getFn,n=void 0===r?j.getFn:r;i(this,e),this.norm=I(3),this.getFn=n,this.isCreated=!1,this.setIndexRecords()}return a(e,[{key:"setSources",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.docs=e}},{key:"setIndexRecords",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.records=e}},{key:"setKeys",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.keys=t,this._keysMap={},t.forEach((function(t,r){e._keysMap[t.id]=r}))}},{key:"create",value:function(){var e=this;!this.isCreated&&this.docs.length&&(this.isCreated=!0,m(this.docs[0])?this.docs.forEach((function(t,r){e._addString(t,r)})):this.docs.forEach((function(t,r){e._addObject(t,r)})),this.norm.clear())}},{key:"add",value:function(e){var t=this.size();m(e)?this._addString(e,t):this._addObject(e,t)}},{key:"removeAt",value:function(e){this.records.splice(e,1);for(var t=e,r=this.size();t2&&void 0!==arguments[2]?arguments[2]:{},n=r.getFn,i=void 0===n?j.getFn:n,o=new P({getFn:i});return o.setKeys(e.map(C)),o.setSources(t),o.create(),o}function U(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.errors,n=void 0===r?0:r,i=t.currentLocation,o=void 0===i?0:i,a=t.expectedLocation,s=void 0===a?0:a,u=t.distance,c=void 0===u?j.distance:u,l=t.ignoreLocation,h=void 0===l?j.ignoreLocation:l,f=n/e.length;if(h)return f;var d=Math.abs(s-o);return c?f+d/c:d?1:f}function B(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:j.minMatchCharLength,r=[],n=-1,i=-1,o=0,a=e.length;o=t&&r.push([n,i]),n=-1)}return e[o-1]&&o-n>=t&&r.push([n,o-1]),r}var D=32;function q(e){for(var t={},r=0,n=e.length;r1&&void 0!==arguments[1]?arguments[1]:{},o=n.location,a=void 0===o?j.location:o,s=n.threshold,u=void 0===s?j.threshold:s,c=n.distance,l=void 0===c?j.distance:c,h=n.includeMatches,f=void 0===h?j.includeMatches:h,d=n.findAllMatches,p=void 0===d?j.findAllMatches:d,y=n.minMatchCharLength,g=void 0===y?j.minMatchCharLength:y,v=n.isCaseSensitive,m=void 0===v?j.isCaseSensitive:v,b=n.ignoreLocation,w=void 0===b?j.ignoreLocation:b;if(i(this,e),this.options={location:a,threshold:u,distance:l,includeMatches:f,findAllMatches:p,minMatchCharLength:g,isCaseSensitive:m,ignoreLocation:w},this.pattern=m?t:t.toLowerCase(),this.chunks=[],this.pattern.length){var _=function(e,t){r.chunks.push({pattern:e,alphabet:q(e),startIndex:t})},S=this.pattern.length;if(S>D){for(var E=0,k=S%D,A=S-k;E3&&void 0!==arguments[3]?arguments[3]:{},i=n.location,o=void 0===i?j.location:i,a=n.distance,s=void 0===a?j.distance:a,u=n.threshold,c=void 0===u?j.threshold:u,l=n.findAllMatches,h=void 0===l?j.findAllMatches:l,f=n.minMatchCharLength,d=void 0===f?j.minMatchCharLength:f,p=n.includeMatches,y=void 0===p?j.includeMatches:p,g=n.ignoreLocation,v=void 0===g?j.ignoreLocation:g;if(t.length>D)throw new Error(O(D));for(var m,b=t.length,w=e.length,_=Math.max(0,Math.min(o,w)),S=c,E=_,k=d>1||y,A=k?Array(w):[];(m=e.indexOf(t,E))>-1;){var x=U(t,{currentLocation:m,expectedLocation:_,distance:s,ignoreLocation:v});if(S=Math.min(x,S),E=m+b,k)for(var R=0;R=q;H-=1){var W=H-1,$=r[e.charAt(W)];if(k&&(A[W]=+!!$),F[H]=(F[H+1]<<1|1)&$,I&&(F[H]|=(C[H+1]|C[H])<<1|1|C[H+1]),F[H]&L&&(M=U(t,{errors:I,currentLocation:W,expectedLocation:_,distance:s,ignoreLocation:v}))<=S){if(S=M,(E=W)<=_)break;q=Math.max(1,2*_-E)}}if(U(t,{errors:I+1,currentLocation:_,expectedLocation:_,distance:s,ignoreLocation:v})>S)break;C=F}var V={isMatch:E>=0,score:Math.max(.001,M)};if(k){var K=B(A,d);K.length?y&&(V.indices=K):V.isMatch=!1}return V}(e,r,i,{location:a+o,distance:s,threshold:u,findAllMatches:c,minMatchCharLength:l,includeMatches:n,ignoreLocation:h}),v=g.isMatch,m=g.score,b=g.indices;v&&(p=!0),d+=m,v&&b&&(f=[].concat(y(f),y(b)))}));var g={isMatch:p,score:p?d/this.chunks.length:1};return p&&n&&(g.indices=f),g}}]),e}(),F=function(){function e(t){i(this,e),this.pattern=t}return a(e,[{key:"search",value:function(){}}],[{key:"isMultiMatch",value:function(e){return H(e,this.multiRegex)}},{key:"isSingleMatch",value:function(e){return H(e,this.singleRegex)}}]),e}();function H(e,t){var r=e.match(t);return r?r[1]:null}var W=function(e){l(r,e);var t=p(r);function r(e){return i(this,r),t.call(this,e)}return a(r,[{key:"search",value:function(e){var t=e===this.pattern;return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}}],[{key:"type",get:function(){return"exact"}},{key:"multiRegex",get:function(){return/^="(.*)"$/}},{key:"singleRegex",get:function(){return/^=(.*)$/}}]),r}(F),$=function(e){l(r,e);var t=p(r);function r(e){return i(this,r),t.call(this,e)}return a(r,[{key:"search",value:function(e){var t=-1===e.indexOf(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}],[{key:"type",get:function(){return"inverse-exact"}},{key:"multiRegex",get:function(){return/^!"(.*)"$/}},{key:"singleRegex",get:function(){return/^!(.*)$/}}]),r}(F),V=function(e){l(r,e);var t=p(r);function r(e){return i(this,r),t.call(this,e)}return a(r,[{key:"search",value:function(e){var t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}}],[{key:"type",get:function(){return"prefix-exact"}},{key:"multiRegex",get:function(){return/^\^"(.*)"$/}},{key:"singleRegex",get:function(){return/^\^(.*)$/}}]),r}(F),K=function(e){l(r,e);var t=p(r);function r(e){return i(this,r),t.call(this,e)}return a(r,[{key:"search",value:function(e){var t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}],[{key:"type",get:function(){return"inverse-prefix-exact"}},{key:"multiRegex",get:function(){return/^!\^"(.*)"$/}},{key:"singleRegex",get:function(){return/^!\^(.*)$/}}]),r}(F),G=function(e){l(r,e);var t=p(r);function r(e){return i(this,r),t.call(this,e)}return a(r,[{key:"search",value:function(e){var t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}}],[{key:"type",get:function(){return"suffix-exact"}},{key:"multiRegex",get:function(){return/^"(.*)"\$$/}},{key:"singleRegex",get:function(){return/^(.*)\$$/}}]),r}(F),Y=function(e){l(r,e);var t=p(r);function r(e){return i(this,r),t.call(this,e)}return a(r,[{key:"search",value:function(e){var t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}],[{key:"type",get:function(){return"inverse-suffix-exact"}},{key:"multiRegex",get:function(){return/^!"(.*)"\$$/}},{key:"singleRegex",get:function(){return/^!(.*)\$$/}}]),r}(F),X=function(e){l(r,e);var t=p(r);function r(e){var n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=o.location,s=void 0===a?j.location:a,u=o.threshold,c=void 0===u?j.threshold:u,l=o.distance,h=void 0===l?j.distance:l,f=o.includeMatches,d=void 0===f?j.includeMatches:f,p=o.findAllMatches,y=void 0===p?j.findAllMatches:p,g=o.minMatchCharLength,v=void 0===g?j.minMatchCharLength:g,m=o.isCaseSensitive,b=void 0===m?j.isCaseSensitive:m,w=o.ignoreLocation,_=void 0===w?j.ignoreLocation:w;return i(this,r),(n=t.call(this,e))._bitapSearch=new z(e,{location:s,threshold:c,distance:h,includeMatches:d,findAllMatches:y,minMatchCharLength:v,isCaseSensitive:b,ignoreLocation:_}),n}return a(r,[{key:"search",value:function(e){return this._bitapSearch.searchIn(e)}}],[{key:"type",get:function(){return"fuzzy"}},{key:"multiRegex",get:function(){return/^"(.*)"$/}},{key:"singleRegex",get:function(){return/^(.*)$/}}]),r}(F),J=function(e){l(r,e);var t=p(r);function r(e){return i(this,r),t.call(this,e)}return a(r,[{key:"search",value:function(e){for(var t,r=0,n=[],i=this.pattern.length;(t=e.indexOf(this.pattern,r))>-1;)r=t+i,n.push([t,r-1]);var o=!!n.length;return{isMatch:o,score:o?0:1,indices:n}}}],[{key:"type",get:function(){return"include"}},{key:"multiRegex",get:function(){return/^'"(.*)"$/}},{key:"singleRegex",get:function(){return/^'(.*)$/}}]),r}(F),Z=[W,J,V,K,Y,G,$,X],Q=Z.length,ee=/ +(?=([^\"]*\"[^\"]*\")*[^\"]*$)/;function te(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.split("|").map((function(e){for(var r=e.trim().split(ee).filter((function(e){return e&&!!e.trim()})),n=[],i=0,o=r.length;i1&&void 0!==arguments[1]?arguments[1]:{},n=r.isCaseSensitive,o=void 0===n?j.isCaseSensitive:n,a=r.includeMatches,s=void 0===a?j.includeMatches:a,u=r.minMatchCharLength,c=void 0===u?j.minMatchCharLength:u,l=r.ignoreLocation,h=void 0===l?j.ignoreLocation:l,f=r.findAllMatches,d=void 0===f?j.findAllMatches:f,p=r.location,y=void 0===p?j.location:p,g=r.threshold,v=void 0===g?j.threshold:g,m=r.distance,b=void 0===m?j.distance:m;i(this,e),this.query=null,this.options={isCaseSensitive:o,includeMatches:s,minMatchCharLength:c,findAllMatches:d,ignoreLocation:h,location:y,threshold:v,distance:b},this.pattern=o?t:t.toLowerCase(),this.query=te(this.pattern,this.options)}return a(e,[{key:"searchIn",value:function(e){var t=this.query;if(!t)return{isMatch:!1,score:1};var r=this.options,n=r.includeMatches;e=r.isCaseSensitive?e:e.toLowerCase();for(var i=0,o=[],a=0,s=0,u=t.length;s2&&void 0!==arguments[2]?arguments[2]:{},n=r.auto,i=void 0===n||n,o=function e(r){var n=Object.keys(r),o=he(r);if(!o&&n.length>1&&!le(r))return e(de(r));if(fe(r)){var a=o?r[ue]:n[0],s=o?r[ce]:r[a];if(!m(s))throw new Error(A(a));var u={keyId:T(a),pattern:s};return i&&(u.searcher=oe(s,t)),u}var c={children:[],operator:n[0]};return n.forEach((function(t){var n=r[t];v(n)&&n.forEach((function(t){c.children.push(e(t))}))})),c};return le(e)||(e=de(e)),o(e)}function ye(e,t){var r=t.ignoreFieldNorm,n=void 0===r?j.ignoreFieldNorm:r;e.forEach((function(e){var t=1;e.matches.forEach((function(e){var r=e.key,i=e.norm,o=e.score,a=r?r.weight:null;t*=Math.pow(0===o&&a?Number.EPSILON:o,(a||1)*(n?1:i))})),e.score=t}))}function ge(e,t){var r=e.matches;t.matches=[],S(r)&&r.forEach((function(e){if(S(e.indices)&&e.indices.length){var r={indices:e.indices,value:e.value};e.key&&(r.key=e.key.src),e.idx>-1&&(r.refIndex=e.idx),t.matches.push(r)}}))}function ve(e,t){t.score=e.score}function me(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r.includeMatches,i=void 0===n?j.includeMatches:n,o=r.includeScore,a=void 0===o?j.includeScore:o,s=[];return i&&s.push(ge),a&&s.push(ve),e.map((function(e){var r=e.idx,n={item:t[r],refIndex:r};return s.length&&s.forEach((function(t){t(e,n)})),n}))}var be=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;i(this,e),this.options=c({},j,{},r),this.options.useExtendedSearch,this._keyStore=new R(this.options.keys),this.setCollection(t,n)}return a(e,[{key:"setCollection",value:function(e,t){if(this._docs=e,t&&!(t instanceof P))throw new Error("Incorrect 'index' type");this._myIndex=t||N(this.options.keys,this._docs,{getFn:this.options.getFn})}},{key:"add",value:function(e){S(e)&&(this._docs.push(e),this._myIndex.add(e))}},{key:"remove",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){return!1},t=[],r=0,n=this._docs.length;r1&&void 0!==arguments[1]?arguments[1]:{},r=t.limit,n=void 0===r?-1:r,i=this.options,o=i.includeMatches,a=i.includeScore,s=i.shouldSort,u=i.sortFn,c=i.ignoreFieldNorm,l=m(e)?m(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return ye(l,{ignoreFieldNorm:c}),s&&l.sort(u),b(n)&&n>-1&&(l=l.slice(0,n)),me(l,this._docs,{includeMatches:o,includeScore:a})}},{key:"_searchStringList",value:function(e){var t=oe(e,this.options),r=this._myIndex.records,n=[];return r.forEach((function(e){var r=e.v,i=e.i,o=e.n;if(S(r)){var a=t.searchIn(r),s=a.isMatch,u=a.score,c=a.indices;s&&n.push({item:r,idx:i,matches:[{score:u,value:r,norm:o,indices:c}]})}})),n}},{key:"_searchLogical",value:function(e){var t=this,r=pe(e,this.options),n=function e(r,n,i){if(!r.children){var o=r.keyId,a=r.searcher,s=t._findMatches({key:t._keyStore.get(o),value:t._myIndex.getValueForItemAtKeyId(n,o),searcher:a});return s&&s.length?[{idx:i,item:n,matches:s}]:[]}switch(r.operator){case ae:for(var u=[],c=0,l=r.children.length;c1&&void 0!==arguments[1]?arguments[1]:{},r=t.getFn,n=void 0===r?j.getFn:r,i=e.keys,o=e.records,a=new P({getFn:n});return a.setKeys(i),a.setIndexRecords(o),a},be.config=j,be.parseQuery=pe,function(){ie.push.apply(ie,arguments)}(ne),t.exports=be},{}]},{},[51]); \ No newline at end of file +var n=e("buffer"),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=n:(o(n,r),r.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},s.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},{buffer:4}],17:[function(e,t,r){(function(t){(function(){var n=e("./lib/request"),i=e("./lib/response"),o=e("xtend"),s=e("builtin-status-codes"),a=e("url"),u=r;u.request=function(e,r){e="string"==typeof e?a.parse(e):o(e);var i=-1===t.location.protocol.search(/^https?:$/)?"http:":"",s=e.protocol||i,u=e.hostname||e.host,c=e.port,l=e.path||"/";u&&-1!==u.indexOf(":")&&(u="["+u+"]"),e.url=(u?s+"//"+u:"")+(c?":"+c:"")+l,e.method=(e.method||"GET").toUpperCase(),e.headers=e.headers||{};var h=new n(e);return r&&h.on("response",r),h},u.get=function(e,t){var r=u.request(e,t);return r.end(),r},u.ClientRequest=n,u.IncomingMessage=i.IncomingMessage,u.Agent=function(){},u.Agent.defaultMaxSockets=4,u.globalAgent=new u.Agent,u.STATUS_CODES=s,u.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./lib/request":19,"./lib/response":20,"builtin-status-codes":5,url:37,xtend:40}],18:[function(e,t,r){(function(e){(function(){var t;function n(){if(void 0!==t)return t;if(e.XMLHttpRequest){t=new e.XMLHttpRequest;try{t.open("GET",e.XDomainRequest?"/":"https://example.com")}catch(e){t=null}}else t=null;return t}function i(e){var t=n();if(!t)return!1;try{return t.responseType=e,t.responseType===e}catch(e){}return!1}function o(e){return"function"==typeof e}r.fetch=o(e.fetch)&&o(e.ReadableStream),r.writableStream=o(e.WritableStream),r.abortController=o(e.AbortController),r.arraybuffer=r.fetch||i("arraybuffer"),r.msstream=!r.fetch&&i("ms-stream"),r.mozchunkedarraybuffer=!r.fetch&&i("moz-chunked-arraybuffer"),r.overrideMimeType=r.fetch||!!n()&&o(n().overrideMimeType),t=null}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],19:[function(e,t,r){(function(r,n,i){(function(){var o=e("./capability"),s=e("inherits"),a=e("./response"),u=e("readable-stream"),c=a.IncomingMessage,l=a.readyStates;var h=t.exports=function(e){var t,r=this;u.Writable.call(r),r._opts=e,r._body=[],r._headers={},e.auth&&r.setHeader("Authorization","Basic "+i.from(e.auth).toString("base64")),Object.keys(e.headers).forEach((function(t){r.setHeader(t,e.headers[t])}));var n=!0;if("disable-fetch"===e.mode||"requestTimeout"in e&&!o.abortController)n=!1,t=!0;else if("prefer-streaming"===e.mode)t=!1;else if("allow-wrong-content-type"===e.mode)t=!o.overrideMimeType;else{if(e.mode&&"default"!==e.mode&&"prefer-fast"!==e.mode)throw new Error("Invalid value for opts.mode");t=!0}r._mode=function(e,t){return o.fetch&&t?"fetch":o.mozchunkedarraybuffer?"moz-chunked-arraybuffer":o.msstream?"ms-stream":o.arraybuffer&&e?"arraybuffer":"text"}(t,n),r._fetchTimer=null,r._socketTimeout=null,r._socketTimer=null,r.on("finish",(function(){r._onFinish()}))};s(h,u.Writable),h.prototype.setHeader=function(e,t){var r=e.toLowerCase();-1===f.indexOf(r)&&(this._headers[r]={name:e,value:t})},h.prototype.getHeader=function(e){var t=this._headers[e.toLowerCase()];return t?t.value:null},h.prototype.removeHeader=function(e){delete this._headers[e.toLowerCase()]},h.prototype._onFinish=function(){var e=this;if(!e._destroyed){var t=e._opts;"timeout"in t&&0!==t.timeout&&e.setTimeout(t.timeout);var i=e._headers,s=null;"GET"!==t.method&&"HEAD"!==t.method&&(s=new Blob(e._body,{type:(i["content-type"]||{}).value||""}));var a=[];if(Object.keys(i).forEach((function(e){var t=i[e].name,r=i[e].value;Array.isArray(r)?r.forEach((function(e){a.push([t,e])})):a.push([t,r])})),"fetch"===e._mode){var u=null;if(o.abortController){var c=new AbortController;u=c.signal,e._fetchAbortController=c,"requestTimeout"in t&&0!==t.requestTimeout&&(e._fetchTimer=n.setTimeout((function(){e.emit("requestTimeout"),e._fetchAbortController&&e._fetchAbortController.abort()}),t.requestTimeout))}n.fetch(e._opts.url,{method:e._opts.method,headers:a,body:s||void 0,mode:"cors",credentials:t.withCredentials?"include":"same-origin",signal:u}).then((function(t){e._fetchResponse=t,e._resetTimers(!1),e._connect()}),(function(t){e._resetTimers(!0),e._destroyed||e.emit("error",t)}))}else{var h=e._xhr=new n.XMLHttpRequest;try{h.open(e._opts.method,e._opts.url,!0)}catch(t){return void r.nextTick((function(){e.emit("error",t)}))}"responseType"in h&&(h.responseType=e._mode),"withCredentials"in h&&(h.withCredentials=!!t.withCredentials),"text"===e._mode&&"overrideMimeType"in h&&h.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in t&&(h.timeout=t.requestTimeout,h.ontimeout=function(){e.emit("requestTimeout")}),a.forEach((function(e){h.setRequestHeader(e[0],e[1])})),e._response=null,h.onreadystatechange=function(){switch(h.readyState){case l.LOADING:case l.DONE:e._onXHRProgress()}},"moz-chunked-arraybuffer"===e._mode&&(h.onprogress=function(){e._onXHRProgress()}),h.onerror=function(){e._destroyed||(e._resetTimers(!0),e.emit("error",new Error("XHR error")))};try{h.send(s)}catch(t){return void r.nextTick((function(){e.emit("error",t)}))}}}},h.prototype._onXHRProgress=function(){var e=this;e._resetTimers(!1),function(e){try{var t=e.status;return null!==t&&0!==t}catch(e){return!1}}(e._xhr)&&!e._destroyed&&(e._response||e._connect(),e._response._onXHRProgress(e._resetTimers.bind(e)))},h.prototype._connect=function(){var e=this;e._destroyed||(e._response=new c(e._xhr,e._fetchResponse,e._mode,e._resetTimers.bind(e)),e._response.on("error",(function(t){e.emit("error",t)})),e.emit("response",e._response))},h.prototype._write=function(e,t,r){this._body.push(e),r()},h.prototype._resetTimers=function(e){var t=this;n.clearTimeout(t._socketTimer),t._socketTimer=null,e?(n.clearTimeout(t._fetchTimer),t._fetchTimer=null):t._socketTimeout&&(t._socketTimer=n.setTimeout((function(){t.emit("timeout")}),t._socketTimeout))},h.prototype.abort=h.prototype.destroy=function(e){var t=this;t._destroyed=!0,t._resetTimers(!0),t._response&&(t._response._destroyed=!0),t._xhr?t._xhr.abort():t._fetchAbortController&&t._fetchAbortController.abort(),e&&t.emit("error",e)},h.prototype.end=function(e,t,r){"function"==typeof e&&(r=e,e=void 0),u.Writable.prototype.end.call(this,e,t,r)},h.prototype.setTimeout=function(e,t){var r=this;t&&r.once("timeout",t),r._socketTimeout=e,r._resetTimers(!1)},h.prototype.flushHeaders=function(){},h.prototype.setNoDelay=function(){},h.prototype.setSocketKeepAlive=function(){};var f=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"]}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer)},{"./capability":18,"./response":20,_process:11,buffer:4,inherits:9,"readable-stream":35}],20:[function(e,t,r){(function(t,n,i){(function(){var o=e("./capability"),s=e("inherits"),a=e("readable-stream"),u=r.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},c=r.IncomingMessage=function(e,r,n,s){var u=this;if(a.Readable.call(u),u._mode=n,u.headers={},u.rawHeaders=[],u.trailers={},u.rawTrailers=[],u.on("end",(function(){t.nextTick((function(){u.emit("close")}))})),"fetch"===n){if(u._fetchResponse=r,u.url=r.url,u.statusCode=r.status,u.statusMessage=r.statusText,r.headers.forEach((function(e,t){u.headers[t.toLowerCase()]=e,u.rawHeaders.push(t,e)})),o.writableStream){var c=new WritableStream({write:function(e){return s(!1),new Promise((function(t,r){u._destroyed?r():u.push(i.from(e))?t():u._resumeFetch=t}))},close:function(){s(!0),u._destroyed||u.push(null)},abort:function(e){s(!0),u._destroyed||u.emit("error",e)}});try{return void r.body.pipeTo(c).catch((function(e){s(!0),u._destroyed||u.emit("error",e)}))}catch(e){}}var l=r.body.getReader();!function e(){l.read().then((function(t){u._destroyed||(s(t.done),t.done?u.push(null):(u.push(i.from(t.value)),e()))})).catch((function(e){s(!0),u._destroyed||u.emit("error",e)}))}()}else{if(u._xhr=e,u._pos=0,u.url=e.responseURL,u.statusCode=e.status,u.statusMessage=e.statusText,e.getAllResponseHeaders().split(/\r?\n/).forEach((function(e){var t=e.match(/^([^:]+):\s*(.*)/);if(t){var r=t[1].toLowerCase();"set-cookie"===r?(void 0===u.headers[r]&&(u.headers[r]=[]),u.headers[r].push(t[2])):void 0!==u.headers[r]?u.headers[r]+=", "+t[2]:u.headers[r]=t[2],u.rawHeaders.push(t[1],t[2])}})),u._charset="x-user-defined",!o.overrideMimeType){var h=u.rawHeaders["mime-type"];if(h){var f=h.match(/;\s*charset=([^;])(;|$)/);f&&(u._charset=f[1].toLowerCase())}u._charset||(u._charset="utf-8")}}};s(c,a.Readable),c.prototype._read=function(){var e=this._resumeFetch;e&&(this._resumeFetch=null,e())},c.prototype._onXHRProgress=function(e){var t=this,r=t._xhr,o=null;switch(t._mode){case"text":if((o=r.responseText).length>t._pos){var s=o.substr(t._pos);if("x-user-defined"===t._charset){for(var a=i.alloc(s.length),c=0;ct._pos&&(t.push(i.from(new Uint8Array(l.result.slice(t._pos)))),t._pos=l.result.byteLength)},l.onload=function(){e(!0),t.push(null)},l.readAsArrayBuffer(o)}t._xhr.readyState===u.DONE&&"ms-stream"!==t._mode&&(e(!0),t.push(null))}}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer)},{"./capability":18,_process:11,buffer:4,inherits:9,"readable-stream":35}],21:[function(e,t,r){"use strict";var n={};function i(e,t,r){r||(r=Error);var i=function(e){var r,n;function i(r,n,i){return e.call(this,function(e,r,n){return"string"==typeof t?t:t(e,r,n)}(r,n,i))||this}return n=e,(r=i).prototype=Object.create(n.prototype),r.prototype.constructor=r,r.__proto__=n,i}(r);i.prototype.name=r.name,i.prototype.code=e,n[e]=i}function o(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}i("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),i("ERR_INVALID_ARG_TYPE",(function(e,t,r){var n,i,s,a;if("string"==typeof t&&(i="not ",t.substr(!s||s<0?0:+s,i.length)===i)?(n="must not be",t=t.replace(/^not /,"")):n="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))a="The ".concat(e," ").concat(n," ").concat(o(t,"type"));else{var u=function(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}(e,".")?"property":"argument";a='The "'.concat(e,'" ').concat(u," ").concat(n," ").concat(o(t,"type"))}return a+=". Received type ".concat(typeof r)}),TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},{}],22:[function(e,t,r){(function(r){(function(){"use strict";var n=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};t.exports=c;var i=e("./_stream_readable"),o=e("./_stream_writable");e("inherits")(c,i);for(var s=n(o.prototype),a=0;a0)if("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===a.prototype||(t=function(e){return a.from(e)}(t)),n)s.endEmitted?S(e,new _):x(e,s,t,!0);else if(s.ended)S(e,new b);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||0!==t.length?x(e,s,t,!1):j(e,s)):x(e,s,t,!1)}else n||(s.reading=!1,j(e,s));return!s.ended&&(s.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=R?e=R:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function C(e){var t=e._readableState;c("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(c("emitReadable",t.flowing),t.emittedReadable=!0,r.nextTick(T,e))}function T(e){var t=e._readableState;c("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,U(e)}function j(e,t){t.readingMore||(t.readingMore=!0,r.nextTick(L,e,t))}function L(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function P(e){c("readable nexttick read 0"),e.read(0)}function N(e,t){c("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),U(e),t.flowing&&!t.reading&&e.read(0)}function U(e){var t=e._readableState;for(c("flow",t.flowing);t.flowing&&null!==e.read(););}function B(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function D(e){var t=e._readableState;c("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,r.nextTick(q,t,e))}function q(e,t){if(c("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function z(e,t){for(var r=0,n=e.length;r=t.highWaterMark:t.length>0)||t.ended))return c("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?D(this):C(this),null;if(0===(e=M(e,t))&&t.ended)return 0===t.length&&D(this),null;var n,i=t.needReadable;return c("need readable",i),(0===t.length||t.length-e0?B(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&D(this)),null!==n&&this.emit("data",n),n},A.prototype._read=function(e){S(this,new w("_read()"))},A.prototype.pipe=function(e,t){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e)}i.pipesCount+=1,c("pipe count=%d opts=%j",i.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr?u:g;function a(t,r){c("onunpipe"),t===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,c("cleanup"),e.removeListener("close",p),e.removeListener("finish",y),e.removeListener("drain",l),e.removeListener("error",d),e.removeListener("unpipe",a),n.removeListener("end",u),n.removeListener("end",g),n.removeListener("data",f),h=!0,!i.awaitDrain||e._writableState&&!e._writableState.needDrain||l())}function u(){c("onend"),e.end()}i.endEmitted?r.nextTick(s):n.once("end",s),e.on("unpipe",a);var l=function(e){return function(){var t=e._readableState;c("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&o(e,"data")&&(t.flowing=!0,U(e))}}(n);e.on("drain",l);var h=!1;function f(t){c("ondata");var r=e.write(t);c("dest.write",r),!1===r&&((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==z(i.pipes,e))&&!h&&(c("false write response, pause",i.awaitDrain),i.awaitDrain++),n.pause())}function d(t){c("onerror",t),g(),e.removeListener("error",d),0===o(e,"error")&&S(e,t)}function p(){e.removeListener("finish",y),g()}function y(){c("onfinish"),e.removeListener("close",p),g()}function g(){c("unpipe"),n.unpipe(e)}return n.on("data",f),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",d),e.once("close",p),e.once("finish",y),e.emit("pipe",n),i.flowing||(c("pipe resume"),n.resume()),e},A.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,c("on readable",i.length,i.reading),i.length?C(this):i.reading||r.nextTick(P,this))),n},A.prototype.addListener=A.prototype.on,A.prototype.removeListener=function(e,t){var n=s.prototype.removeListener.call(this,e,t);return"readable"===e&&r.nextTick(I,this),n},A.prototype.removeAllListeners=function(e){var t=s.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||r.nextTick(I,this),t},A.prototype.resume=function(){var e=this._readableState;return e.flowing||(c("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,r.nextTick(N,e,t))}(this,e)),e.paused=!1,this},A.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},A.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var i in e.on("end",(function(){if(c("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(i){(c("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(t.push(i)||(n=!0,e.pause()))})),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var o=0;o-1))throw new _(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(A.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(A.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),A.prototype._write=function(e,t,r){r(new y("_write()"))},A.prototype._writev=null,A.prototype.end=function(e,t,n){var i=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||function(e,t,n){t.ending=!0,T(e,t),n&&(t.finished?r.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,i,n),this},Object.defineProperty(A.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(A.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),A.prototype.destroy=h.destroy,A.prototype._undestroy=h.undestroy,A.prototype._destroy=function(e,t){t(e)}}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../errors":21,"./_stream_duplex":22,"./internal/streams/destroy":29,"./internal/streams/state":33,"./internal/streams/stream":34,_process:11,buffer:4,inherits:9,"util-deprecate":39}],27:[function(e,t,r){(function(r){(function(){"use strict";var n;function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var o=e("./end-of-stream"),s=Symbol("lastResolve"),a=Symbol("lastReject"),u=Symbol("error"),c=Symbol("ended"),l=Symbol("lastPromise"),h=Symbol("handlePromise"),f=Symbol("stream");function d(e,t){return{value:e,done:t}}function p(e){var t=e[s];if(null!==t){var r=e[f].read();null!==r&&(e[l]=null,e[s]=null,e[a]=null,t(d(r,!1)))}}function y(e){r.nextTick(p,e)}var g=Object.getPrototypeOf((function(){})),v=Object.setPrototypeOf((i(n={get stream(){return this[f]},next:function(){var e=this,t=this[u];if(null!==t)return Promise.reject(t);if(this[c])return Promise.resolve(d(void 0,!0));if(this[f].destroyed)return new Promise((function(t,n){r.nextTick((function(){e[u]?n(e[u]):t(d(void 0,!0))}))}));var n,i=this[l];if(i)n=new Promise(function(e,t){return function(r,n){e.then((function(){t[c]?r(d(void 0,!0)):t[h](r,n)}),n)}}(i,this));else{var o=this[f].read();if(null!==o)return Promise.resolve(d(o,!1));n=new Promise(this[h])}return this[l]=n,n}},Symbol.asyncIterator,(function(){return this})),i(n,"return",(function(){var e=this;return new Promise((function(t,r){e[f].destroy(null,(function(e){e?r(e):t(d(void 0,!0))}))}))})),n),g);t.exports=function(e){var t,r=Object.create(v,(i(t={},f,{value:e,writable:!0}),i(t,s,{value:null,writable:!0}),i(t,a,{value:null,writable:!0}),i(t,u,{value:null,writable:!0}),i(t,c,{value:e._readableState.endEmitted,writable:!0}),i(t,h,{value:function(e,t){var n=r[f].read();n?(r[l]=null,r[s]=null,r[a]=null,e(d(n,!1))):(r[s]=e,r[a]=t)},writable:!0}),t));return r[l]=null,o(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[a];return null!==t&&(r[l]=null,r[s]=null,r[a]=null,t(e)),void(r[u]=e)}var n=r[s];null!==n&&(r[l]=null,r[s]=null,r[a]=null,n(d(void 0,!0))),r[c]=!0})),e.on("readable",y.bind(null,r)),r}}).call(this)}).call(this,e("_process"))},{"./end-of-stream":30,_process:11}],28:[function(e,t,r){"use strict";function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){for(var r=0;r0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return s.alloc(0);for(var t,r,n,i=s.allocUnsafe(e>>>0),o=this.head,a=0;o;)t=o.data,r=i,n=a,s.prototype.copy.call(t,r,n),a+=o.data.length,o=o.next;return i}},{key:"consume",value:function(e,t){var r;return ei.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0==(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=s.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0==(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,t}},{key:u,value:function(e,t){return a(this,function(e){for(var t=1;t0,(function(e){n||(n=e),e&&s.forEach(c),o||(s.forEach(c),i(n))}))}));return t.reduce(l)}},{"../../../errors":21,"./end-of-stream":30}],33:[function(e,t,r){"use strict";var n=e("../../../errors").codes.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(e,t,r,i){var o=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,i,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new n(i?r:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}},{"../../../errors":21}],34:[function(e,t,r){t.exports=e("events").EventEmitter},{events:6}],35:[function(e,t,r){(r=t.exports=e("./lib/_stream_readable.js")).Stream=r,r.Readable=r,r.Writable=e("./lib/_stream_writable.js"),r.Duplex=e("./lib/_stream_duplex.js"),r.Transform=e("./lib/_stream_transform.js"),r.PassThrough=e("./lib/_stream_passthrough.js"),r.finished=e("./lib/internal/streams/end-of-stream.js"),r.pipeline=e("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":22,"./lib/_stream_passthrough.js":23,"./lib/_stream_readable.js":24,"./lib/_stream_transform.js":25,"./lib/_stream_writable.js":26,"./lib/internal/streams/end-of-stream.js":30,"./lib/internal/streams/pipeline.js":32}],36:[function(e,t,r){"use strict";var n=e("safe-buffer").Buffer,i=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=u,this.end=c,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=l,this.end=h,t=3;break;default:return this.write=f,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function s(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function u(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function c(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function l(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function h(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function f(e){return e.toString(this.encoding)}function d(e){return e&&e.length?this.write(e):""}r.StringDecoder=o,o.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0)return i>0&&(e.lastNeed=i-1),i;if(--n=0)return i>0&&(e.lastNeed=i-2),i;if(--n=0)return i>0&&(2===i?i=0:e.lastNeed=i-3),i;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},{"safe-buffer":16}],37:[function(e,t,r){"use strict";var n=e("punycode"),i=e("./util");function o(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}r.parse=b,r.resolve=function(e,t){return b(e,!1,!0).resolve(t)},r.resolveObject=function(e,t){return e?b(e,!1,!0).resolveObject(t):t},r.format=function(e){i.isString(e)&&(e=b(e));return e instanceof o?e.format():o.prototype.format.call(e)},r.Url=o;var s=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,c=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),l=["'"].concat(c),h=["%","/","?",";","#"].concat(l),f=["/","?","#"],d=/^[+a-z0-9A-Z_-]{0,63}$/,p=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,y={javascript:!0,"javascript:":!0},g={javascript:!0,"javascript:":!0},v={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},m=e("querystring");function b(e,t,r){if(e&&i.isObject(e)&&e instanceof o)return e;var n=new o;return n.parse(e,t,r),n}o.prototype.parse=function(e,t,r){if(!i.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var o=e.indexOf("?"),a=-1!==o&&o127?L+="x":L+=j[I];if(!L.match(d)){var N=C.slice(0,x),U=C.slice(x+1),B=j.match(p);B&&(N.push(B[1]),U.unshift(B[2])),U.length&&(b="/"+U.join(".")+b),this.hostname=N.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),M||(this.hostname=n.toASCII(this.hostname));var D=this.port?":"+this.port:"",q=this.hostname||"";this.host=q+D,this.href+=this.host,M&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!y[S])for(x=0,T=l.length;x0)&&r.host.split("@"))&&(r.auth=M.shift(),r.host=r.hostname=M.shift());return r.search=e.search,r.query=e.query,i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!E.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var A=E.slice(-1)[0],O=(r.host||e.host||E.length>1)&&("."===A||".."===A)||""===A,x=0,R=E.length;R>=0;R--)"."===(A=E[R])?E.splice(R,1):".."===A?(E.splice(R,1),x++):x&&(E.splice(R,1),x--);if(!_&&!S)for(;x--;x)E.unshift("..");!_||""===E[0]||E[0]&&"/"===E[0].charAt(0)||E.unshift(""),O&&"/"!==E.join("/").substr(-1)&&E.push("");var M,C=""===E[0]||E[0]&&"/"===E[0].charAt(0);k&&(r.hostname=r.host=C?"":E.length?E.shift():"",(M=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=M.shift(),r.host=r.hostname=M.shift()));return(_=_||r.host&&E.length)&&!C&&E.unshift(""),E.length?r.pathname=E.join("/"):(r.pathname=null,r.path=null),i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},o.prototype.parseHost=function(){var e=this.host,t=a.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},{"./util":38,punycode:12,querystring:15}],38:[function(e,t,r){"use strict";t.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},{}],39:[function(e,t,r){(function(e){(function(){function r(t){try{if(!e.localStorage)return!1}catch(e){return!1}var r=e.localStorage[t];return null!=r&&"true"===String(r).toLowerCase()}t.exports=function(e,t){if(r("noDeprecation"))return e;var n=!1;return function(){if(!n){if(r("throwDeprecation"))throw new Error(t);r("traceDeprecation")?console.trace(t):console.warn(t),n=!0}return e.apply(this,arguments)}}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],40:[function(e,t,r){t.exports=function(){for(var e={},t=0;t0)return this.client.emit("updateAvalible",e),Promise.all(e.map((async e=>{let t=Object.values(JSON.parse(await(0,s.fetch)(i.data[e]))||[]);this.client.set(e,t),o.default.writeFileSync(i.local[e],JSON.stringify(t))})))}start(){this.cron||this.client.emit("debug","Notify for new data updates enabled. AzurAPI Client will check for data updates every hour."),this.cron&&clearInterval(this.cron),this.cron=setInterval((()=>this.update()),this.client.rate)}stop(){this.cron&&clearInterval(this.cron),this.cron=void 0}async init(){o.default.existsSync(i.baseFolder)||o.default.mkdirSync(i.baseFolder),await this.load(),this.client.emit("ready")}load(){for(let e=0;es.default.get(e,(e=>{let r="";e.on("data",(e=>r+=e)),e.on("end",(()=>t(r)))})).on("error",(e=>r(e)))))}r.check=async function(){!u&&o.default.existsSync(i.versionInfo)&&(u=JSON.parse(o.default.readFileSync(i.versionInfo).toString())),c=JSON.parse(await l(i.data.version));let e=[];for(let t of a)u&&u[t]&&c[t]["version-number"]===u[t]["version-number"]||e.push(t);return e},r.save=function(){c&&o.default.writeFileSync(i.versionInfo,JSON.stringify(u=c))},r.fetch=l},{"./Data":43,fs:3,https:7}],45:[function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.normalize=r.NATIONS=void 0;const i=n(e("fuse.js"));r.NATIONS={"Eagle Union":["uss","eagle union"],"Royal Navy":["hms","royal navy"],"Sakura Empire":["ijn","sakura empire"],"Iron Blood":["kms","iron blood"],"Dragon Empery":["pran","dragon empery"],"Northern Parliament":["sn","northern parliament"],"Iris Libre":["ffnf","iris libre"],"Vichya Domination":["mnf","vichya domination"],"Sardenga Empire":["rn","sardegna empire"],Neptunia:["hdn","neptunia"],Bilibili:["bili","bilibili"],"Venus Vacation":["venus","venus vacation"],Utawarerumono:["utawarerumono"],"Kizuna AI":["kizunaai","kizuna ai"],Hololive:["hololive"],META:["meta"],Universal:["universal","univ"]};r.default=class{raw;fuse;client;constructor(e,t){this.raw=[],t&&(this.fuse=new i.default(this.raw,{keys:t,threshold:.4})),this.client=e}setData(e){(new Error).stack.match(/AzurAPI\.set/)&&(this.raw.splice(0,this.raw.length,...e),this.fuse&&this.fuse.setCollection(this.raw))}fuze(e){return this.fuse?this.fuse.search(e,{limit:10}).sort(((e,t)=>(t.score||0)-(e.score||0))):[]}id(e){for(let t of this.raw)if(s(t.id.toUpperCase())===s(e.toUpperCase()))return t}get(e){return this.id(e)||this.fuze(e)?.map((e=>e.item))}filter(e){return this.raw.filter(e)}map(e){return this.raw.map(e)}forEach(e){return this.raw.forEach(e)}every(e){return this.raw.every(e)}some(e){return this.raw.some(e)}};const o=/[\u0300-\u036F]/g;function s(e){return e.normalize("NFKD").replace(o,"")}r.normalize=s},{"fuse.js":52}],46:[function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(r,"__esModule",{value:!0}),r.Barrages=void 0;const s=o(e("./api"));class a extends s.default{constructor(e){super(e,["id","name"])}name(e){return this.raw.filter((t=>(0,s.normalize)(t.name.toUpperCase())===(0,s.normalize)(e.toUpperCase())))}type(e){return this.raw.filter((t=>(0,s.normalize)(t.type.toUpperCase())===(0,s.normalize)(e.toUpperCase())))}hull(e){return this.raw.filter((t=>(0,s.normalize)(t.hull.toUpperCase())===(0,s.normalize)(e.toUpperCase())))}ships(e){return this.raw.filter((t=>t.ships.map((e=>(0,s.normalize)(e.toUpperCase()))).includes((0,s.normalize)(e.toUpperCase()))))}}r.Barrages=a},{"./api":45}],47:[function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(r,"__esModule",{value:!0}),r.Chapters=void 0;const s=o(e("./api"));class a extends s.default{constructor(e){super(e)}name(e,t=["en","cn","jp"]){let r=[];for(let n of this.raw){t.some((t=>n.names[t]&&(0,s.normalize)(n.names[t].toUpperCase())===(0,s.normalize)(e.toUpperCase())))&&r.push(n);for(let i of Object.values(n))void 0!==i.names&&t.some((t=>i.names[t]&&(0,s.normalize)(i.names[t].toUpperCase())===(0,s.normalize)(e.toUpperCase())))&&r.push(i)}return r}}r.Chapters=a},{"./api":45}],48:[function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(r,"__esModule",{value:!0}),r.Equipments=void 0;const s=o(e("./api"));class a extends s.default{constructor(e){super(e,["names.en","names.cn","names.jp","names.kr","names.code","id"])}name(e,t=["en","cn","jp","kr"]){return this.raw.filter((r=>t.some((t=>r.names[t]&&(0,s.normalize)(r.names[t].toUpperCase())===(0,s.normalize)(e.toUpperCase())))))}category(e){return this.raw.filter((t=>(0,s.normalize)(t.category.toUpperCase()===(0,s.normalize)(e.toUpperCase()))))}nationality(e){return e=Object.keys(s.NATIONS).find((t=>s.NATIONS[t].includes(e.toLowerCase())))||e,this.raw.filter((t=>(0,s.normalize)(t.nationality.toUpperCase())===(0,s.normalize)(e.toUpperCase())))}get(e){let t=this.fuze(e).sort(((e,t)=>(t.score||0)-(e.score||0)))[0];return this.id(e)||this.name(e)||(t?t.item:void 0)}all(e){let t=[];return t.push(this.id(e)),t.push(...this.name(e).filter((e=>e))),t.push(...this.fuze(e).map((e=>e.item))),t.filter((e=>null!=e)).filter(((e,t,r)=>t===r.findIndex((t=>t.id===e.id))))}}r.Equipments=a},{"./api":45}],49:[function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(r,"__esModule",{value:!0}),r.Ships=void 0;const s=o(e("./api"));class a extends s.default{constructor(e){super(e,["names.en","names.cn","names.jp","names.kr","names.code","id"])}name(e,t=["en","cn","jp","kr"]){return this.raw.filter((r=>t.some((t=>r.names[t]&&(0,s.normalize)(r.names[t].toUpperCase())===(0,s.normalize)(e.toUpperCase())))))}hull(e){return this.raw.filter((t=>t.hullType&&(0,s.normalize)(t.hullType.toUpperCase())===(0,s.normalize)(e.toUpperCase())||t.retrofitHullType&&(0,s.normalize)(t.retrofitHullType.toUpperCase())===(0,s.normalize)(e.toUpperCase())))}nationality(e){let t=[];e=Object.keys(s.NATIONS).find((t=>s.NATIONS[t].includes(e.toLowerCase())))||e;for(let r of this.raw)(0,s.normalize)(r.nationality.toUpperCase())===(0,s.normalize)(e.toUpperCase())&&t.push(r);return t}get(e){let t=this.fuze(e).sort(((e,t)=>(t.score||0)-(e.score||0)))[0];return this.id(e)||this.name(e)[0]||(t?t.item:void 0)}all(e){let t=[];return t.push(this.id(e)),t.push(...this.name(e).filter((e=>e))),t.push(...this.fuze(e).map((e=>e.item))),t.filter((e=>null!=e)).filter(((e,t,r)=>t===r.findIndex((t=>t.id===e.id))))}}r.Ships=a},{"./api":45}],50:[function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.Voicelines=void 0;const i=n(e("./api"));class o extends i.default{constructor(e){super(e)}}r.Voicelines=o},{"./api":45}],51:[function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(r,"__esModule",{value:!0}),i(e("./core/Client"),r)},{"./core/Client":42}],52:[function(e,t,r){"use strict";function n(e){return n="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},n(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&void 0!==arguments[0]?arguments[0]:3,t=new Map,r=Math.pow(10,e);return{get:function(e){var n=e.match(L).length;if(t.has(n))return t.get(n);var i=1/Math.sqrt(n),o=parseFloat(Math.round(i*r)/r);return t.set(n,o),o},clear:function(){t.clear()}}}var P=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.getFn,n=void 0===r?j.getFn:r;i(this,e),this.norm=I(3),this.getFn=n,this.isCreated=!1,this.setIndexRecords()}return s(e,[{key:"setSources",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.docs=e}},{key:"setIndexRecords",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.records=e}},{key:"setKeys",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.keys=t,this._keysMap={},t.forEach((function(t,r){e._keysMap[t.id]=r}))}},{key:"create",value:function(){var e=this;!this.isCreated&&this.docs.length&&(this.isCreated=!0,m(this.docs[0])?this.docs.forEach((function(t,r){e._addString(t,r)})):this.docs.forEach((function(t,r){e._addObject(t,r)})),this.norm.clear())}},{key:"add",value:function(e){var t=this.size();m(e)?this._addString(e,t):this._addObject(e,t)}},{key:"removeAt",value:function(e){this.records.splice(e,1);for(var t=e,r=this.size();t2&&void 0!==arguments[2]?arguments[2]:{},n=r.getFn,i=void 0===n?j.getFn:n,o=new P({getFn:i});return o.setKeys(e.map(M)),o.setSources(t),o.create(),o}function U(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.errors,n=void 0===r?0:r,i=t.currentLocation,o=void 0===i?0:i,s=t.expectedLocation,a=void 0===s?0:s,u=t.distance,c=void 0===u?j.distance:u,l=t.ignoreLocation,h=void 0===l?j.ignoreLocation:l,f=n/e.length;if(h)return f;var d=Math.abs(a-o);return c?f+d/c:d?1:f}function B(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:j.minMatchCharLength,r=[],n=-1,i=-1,o=0,s=e.length;o=t&&r.push([n,i]),n=-1)}return e[o-1]&&o-n>=t&&r.push([n,o-1]),r}var D=32;function q(e){for(var t={},r=0,n=e.length;r1&&void 0!==arguments[1]?arguments[1]:{},o=n.location,s=void 0===o?j.location:o,a=n.threshold,u=void 0===a?j.threshold:a,c=n.distance,l=void 0===c?j.distance:c,h=n.includeMatches,f=void 0===h?j.includeMatches:h,d=n.findAllMatches,p=void 0===d?j.findAllMatches:d,y=n.minMatchCharLength,g=void 0===y?j.minMatchCharLength:y,v=n.isCaseSensitive,m=void 0===v?j.isCaseSensitive:v,b=n.ignoreLocation,w=void 0===b?j.ignoreLocation:b;if(i(this,e),this.options={location:s,threshold:u,distance:l,includeMatches:f,findAllMatches:p,minMatchCharLength:g,isCaseSensitive:m,ignoreLocation:w},this.pattern=m?t:t.toLowerCase(),this.chunks=[],this.pattern.length){var _=function(e,t){r.chunks.push({pattern:e,alphabet:q(e),startIndex:t})},S=this.pattern.length;if(S>D){for(var E=0,k=S%D,A=S-k;E3&&void 0!==arguments[3]?arguments[3]:{},i=n.location,o=void 0===i?j.location:i,s=n.distance,a=void 0===s?j.distance:s,u=n.threshold,c=void 0===u?j.threshold:u,l=n.findAllMatches,h=void 0===l?j.findAllMatches:l,f=n.minMatchCharLength,d=void 0===f?j.minMatchCharLength:f,p=n.includeMatches,y=void 0===p?j.includeMatches:p,g=n.ignoreLocation,v=void 0===g?j.ignoreLocation:g;if(t.length>D)throw new Error(O(D));for(var m,b=t.length,w=e.length,_=Math.max(0,Math.min(o,w)),S=c,E=_,k=d>1||y,A=k?Array(w):[];(m=e.indexOf(t,E))>-1;){var x=U(t,{currentLocation:m,expectedLocation:_,distance:a,ignoreLocation:v});if(S=Math.min(x,S),E=m+b,k)for(var R=0;R=q;H-=1){var W=H-1,$=r[e.charAt(W)];if(k&&(A[W]=+!!$),F[H]=(F[H+1]<<1|1)&$,I&&(F[H]|=(M[H+1]|M[H])<<1|1|M[H+1]),F[H]&L&&(C=U(t,{errors:I,currentLocation:W,expectedLocation:_,distance:a,ignoreLocation:v}))<=S){if(S=C,(E=W)<=_)break;q=Math.max(1,2*_-E)}}if(U(t,{errors:I+1,currentLocation:_,expectedLocation:_,distance:a,ignoreLocation:v})>S)break;M=F}var V={isMatch:E>=0,score:Math.max(.001,C)};if(k){var K=B(A,d);K.length?y&&(V.indices=K):V.isMatch=!1}return V}(e,r,i,{location:s+o,distance:a,threshold:u,findAllMatches:c,minMatchCharLength:l,includeMatches:n,ignoreLocation:h}),v=g.isMatch,m=g.score,b=g.indices;v&&(p=!0),d+=m,v&&b&&(f=[].concat(y(f),y(b)))}));var g={isMatch:p,score:p?d/this.chunks.length:1};return p&&n&&(g.indices=f),g}}]),e}(),F=function(){function e(t){i(this,e),this.pattern=t}return s(e,[{key:"search",value:function(){}}],[{key:"isMultiMatch",value:function(e){return H(e,this.multiRegex)}},{key:"isSingleMatch",value:function(e){return H(e,this.singleRegex)}}]),e}();function H(e,t){var r=e.match(t);return r?r[1]:null}var W=function(e){l(r,e);var t=p(r);function r(e){return i(this,r),t.call(this,e)}return s(r,[{key:"search",value:function(e){var t=e===this.pattern;return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}}],[{key:"type",get:function(){return"exact"}},{key:"multiRegex",get:function(){return/^="(.*)"$/}},{key:"singleRegex",get:function(){return/^=(.*)$/}}]),r}(F),$=function(e){l(r,e);var t=p(r);function r(e){return i(this,r),t.call(this,e)}return s(r,[{key:"search",value:function(e){var t=-1===e.indexOf(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}],[{key:"type",get:function(){return"inverse-exact"}},{key:"multiRegex",get:function(){return/^!"(.*)"$/}},{key:"singleRegex",get:function(){return/^!(.*)$/}}]),r}(F),V=function(e){l(r,e);var t=p(r);function r(e){return i(this,r),t.call(this,e)}return s(r,[{key:"search",value:function(e){var t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}}],[{key:"type",get:function(){return"prefix-exact"}},{key:"multiRegex",get:function(){return/^\^"(.*)"$/}},{key:"singleRegex",get:function(){return/^\^(.*)$/}}]),r}(F),K=function(e){l(r,e);var t=p(r);function r(e){return i(this,r),t.call(this,e)}return s(r,[{key:"search",value:function(e){var t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}],[{key:"type",get:function(){return"inverse-prefix-exact"}},{key:"multiRegex",get:function(){return/^!\^"(.*)"$/}},{key:"singleRegex",get:function(){return/^!\^(.*)$/}}]),r}(F),G=function(e){l(r,e);var t=p(r);function r(e){return i(this,r),t.call(this,e)}return s(r,[{key:"search",value:function(e){var t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}}],[{key:"type",get:function(){return"suffix-exact"}},{key:"multiRegex",get:function(){return/^"(.*)"\$$/}},{key:"singleRegex",get:function(){return/^(.*)\$$/}}]),r}(F),Y=function(e){l(r,e);var t=p(r);function r(e){return i(this,r),t.call(this,e)}return s(r,[{key:"search",value:function(e){var t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}],[{key:"type",get:function(){return"inverse-suffix-exact"}},{key:"multiRegex",get:function(){return/^!"(.*)"\$$/}},{key:"singleRegex",get:function(){return/^!(.*)\$$/}}]),r}(F),X=function(e){l(r,e);var t=p(r);function r(e){var n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=o.location,a=void 0===s?j.location:s,u=o.threshold,c=void 0===u?j.threshold:u,l=o.distance,h=void 0===l?j.distance:l,f=o.includeMatches,d=void 0===f?j.includeMatches:f,p=o.findAllMatches,y=void 0===p?j.findAllMatches:p,g=o.minMatchCharLength,v=void 0===g?j.minMatchCharLength:g,m=o.isCaseSensitive,b=void 0===m?j.isCaseSensitive:m,w=o.ignoreLocation,_=void 0===w?j.ignoreLocation:w;return i(this,r),(n=t.call(this,e))._bitapSearch=new z(e,{location:a,threshold:c,distance:h,includeMatches:d,findAllMatches:y,minMatchCharLength:v,isCaseSensitive:b,ignoreLocation:_}),n}return s(r,[{key:"search",value:function(e){return this._bitapSearch.searchIn(e)}}],[{key:"type",get:function(){return"fuzzy"}},{key:"multiRegex",get:function(){return/^"(.*)"$/}},{key:"singleRegex",get:function(){return/^(.*)$/}}]),r}(F),J=function(e){l(r,e);var t=p(r);function r(e){return i(this,r),t.call(this,e)}return s(r,[{key:"search",value:function(e){for(var t,r=0,n=[],i=this.pattern.length;(t=e.indexOf(this.pattern,r))>-1;)r=t+i,n.push([t,r-1]);var o=!!n.length;return{isMatch:o,score:o?0:1,indices:n}}}],[{key:"type",get:function(){return"include"}},{key:"multiRegex",get:function(){return/^'"(.*)"$/}},{key:"singleRegex",get:function(){return/^'(.*)$/}}]),r}(F),Z=[W,J,V,K,Y,G,$,X],Q=Z.length,ee=/ +(?=([^\"]*\"[^\"]*\")*[^\"]*$)/;function te(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.split("|").map((function(e){for(var r=e.trim().split(ee).filter((function(e){return e&&!!e.trim()})),n=[],i=0,o=r.length;i1&&void 0!==arguments[1]?arguments[1]:{},n=r.isCaseSensitive,o=void 0===n?j.isCaseSensitive:n,s=r.includeMatches,a=void 0===s?j.includeMatches:s,u=r.minMatchCharLength,c=void 0===u?j.minMatchCharLength:u,l=r.ignoreLocation,h=void 0===l?j.ignoreLocation:l,f=r.findAllMatches,d=void 0===f?j.findAllMatches:f,p=r.location,y=void 0===p?j.location:p,g=r.threshold,v=void 0===g?j.threshold:g,m=r.distance,b=void 0===m?j.distance:m;i(this,e),this.query=null,this.options={isCaseSensitive:o,includeMatches:a,minMatchCharLength:c,findAllMatches:d,ignoreLocation:h,location:y,threshold:v,distance:b},this.pattern=o?t:t.toLowerCase(),this.query=te(this.pattern,this.options)}return s(e,[{key:"searchIn",value:function(e){var t=this.query;if(!t)return{isMatch:!1,score:1};var r=this.options,n=r.includeMatches;e=r.isCaseSensitive?e:e.toLowerCase();for(var i=0,o=[],s=0,a=0,u=t.length;a2&&void 0!==arguments[2]?arguments[2]:{},n=r.auto,i=void 0===n||n,o=function e(r){var n=Object.keys(r),o=he(r);if(!o&&n.length>1&&!le(r))return e(de(r));if(fe(r)){var s=o?r[ue]:n[0],a=o?r[ce]:r[s];if(!m(a))throw new Error(A(s));var u={keyId:T(s),pattern:a};return i&&(u.searcher=oe(a,t)),u}var c={children:[],operator:n[0]};return n.forEach((function(t){var n=r[t];v(n)&&n.forEach((function(t){c.children.push(e(t))}))})),c};return le(e)||(e=de(e)),o(e)}function ye(e,t){var r=t.ignoreFieldNorm,n=void 0===r?j.ignoreFieldNorm:r;e.forEach((function(e){var t=1;e.matches.forEach((function(e){var r=e.key,i=e.norm,o=e.score,s=r?r.weight:null;t*=Math.pow(0===o&&s?Number.EPSILON:o,(s||1)*(n?1:i))})),e.score=t}))}function ge(e,t){var r=e.matches;t.matches=[],S(r)&&r.forEach((function(e){if(S(e.indices)&&e.indices.length){var r={indices:e.indices,value:e.value};e.key&&(r.key=e.key.src),e.idx>-1&&(r.refIndex=e.idx),t.matches.push(r)}}))}function ve(e,t){t.score=e.score}function me(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r.includeMatches,i=void 0===n?j.includeMatches:n,o=r.includeScore,s=void 0===o?j.includeScore:o,a=[];return i&&a.push(ge),s&&a.push(ve),e.map((function(e){var r=e.idx,n={item:t[r],refIndex:r};return a.length&&a.forEach((function(t){t(e,n)})),n}))}var be=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;i(this,e),this.options=c({},j,{},r),this.options.useExtendedSearch,this._keyStore=new R(this.options.keys),this.setCollection(t,n)}return s(e,[{key:"setCollection",value:function(e,t){if(this._docs=e,t&&!(t instanceof P))throw new Error("Incorrect 'index' type");this._myIndex=t||N(this.options.keys,this._docs,{getFn:this.options.getFn})}},{key:"add",value:function(e){S(e)&&(this._docs.push(e),this._myIndex.add(e))}},{key:"remove",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){return!1},t=[],r=0,n=this._docs.length;r1&&void 0!==arguments[1]?arguments[1]:{},r=t.limit,n=void 0===r?-1:r,i=this.options,o=i.includeMatches,s=i.includeScore,a=i.shouldSort,u=i.sortFn,c=i.ignoreFieldNorm,l=m(e)?m(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return ye(l,{ignoreFieldNorm:c}),a&&l.sort(u),b(n)&&n>-1&&(l=l.slice(0,n)),me(l,this._docs,{includeMatches:o,includeScore:s})}},{key:"_searchStringList",value:function(e){var t=oe(e,this.options),r=this._myIndex.records,n=[];return r.forEach((function(e){var r=e.v,i=e.i,o=e.n;if(S(r)){var s=t.searchIn(r),a=s.isMatch,u=s.score,c=s.indices;a&&n.push({item:r,idx:i,matches:[{score:u,value:r,norm:o,indices:c}]})}})),n}},{key:"_searchLogical",value:function(e){var t=this,r=pe(e,this.options),n=function e(r,n,i){if(!r.children){var o=r.keyId,s=r.searcher,a=t._findMatches({key:t._keyStore.get(o),value:t._myIndex.getValueForItemAtKeyId(n,o),searcher:s});return a&&a.length?[{idx:i,item:n,matches:a}]:[]}switch(r.operator){case se:for(var u=[],c=0,l=r.children.length;c1&&void 0!==arguments[1]?arguments[1]:{},r=t.getFn,n=void 0===r?j.getFn:r,i=e.keys,o=e.records,s=new P({getFn:n});return s.setKeys(i),s.setIndexRecords(o),s},be.config=j,be.parseQuery=pe,function(){ie.push.apply(ie,arguments)}(ne),t.exports=be},{}]},{},[51]); \ No newline at end of file diff --git a/bundles/azurapi.umd.js b/bundles/azurapi.umd.js index a5fa9d6e..9441bf24 100644 --- a/bundles/azurapi.umd.js +++ b/bundles/azurapi.umd.js @@ -1,12 +1,12 @@ -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).AzurAPI=e()}}((function(){return function e(t,r,n){function i(a,s){if(!r[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var l=r[a]={exports:{}};t[a][0].call(l.exports,(function(e){return i(t[a][1][e]||e)}),l,l.exports,e,t,r,n)}return r[a].exports}for(var o="function"==typeof require&&require,a=0;a0?a-4:a;for(r=0;r>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===s&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,u[l++]=255&t);1===s&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},r.fromByteArray=function(e){for(var t,r=e.length,i=r%3,o=[],a=16383,s=0,u=r-i;su?u:s+a));1===i?(t=e[r-1],o.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],o.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=a.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function l(e,t,r){for(var i,o,a=[],s=t;s>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],2:[function(e,t,r){},{}],3:[function(e,t,r){arguments[4][2][0].apply(r,arguments)},{dup:2}],4:[function(e,t,r){(function(t){(function(){ +!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).AzurAPI=e()}}((function(){return function e(t,r,n){function i(s,a){if(!r[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(o)return o(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=r[s]={exports:{}};t[s][0].call(l.exports,(function(e){return i(t[s][1][e]||e)}),l,l.exports,e,t,r,n)}return r[s].exports}for(var o="function"==typeof require&&require,s=0;s0?s-4:s;for(r=0;r>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===a&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,u[l++]=255&t);1===a&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},r.fromByteArray=function(e){for(var t,r=e.length,i=r%3,o=[],s=16383,a=0,u=r-i;au?u:a+s));1===i?(t=e[r-1],o.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],o.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function l(e,t,r){for(var i,o,s=[],a=t;a>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],2:[function(e,t,r){},{}],3:[function(e,t,r){arguments[4][2][0].apply(r,arguments)},{dup:2}],4:[function(e,t,r){(function(t){(function(){ /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ -"use strict";var t=e("base64-js"),n=e("ieee754");r.Buffer=a,r.SlowBuffer=function(e){+e!=e&&(e=0);return a.alloc(+e)},r.INSPECT_MAX_BYTES=50;var i=2147483647;function o(e){if(e>i)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return t.__proto__=a.prototype,t}function a(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return c(e)}return s(e,t,r)}function s(e,t,r){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!a.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|f(e,t),n=o(r),i=n.write(e,t);i!==r&&(n=n.slice(0,i));return n}(e,t);if(ArrayBuffer.isView(e))return l(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(q(e,ArrayBuffer)||e&&q(e.buffer,ArrayBuffer))return function(e,t,r){if(t<0||e.byteLength=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|e}function f(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||q(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return U(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return B(e).length;default:if(i)return n?-1:U(e).length;t=(""+t).toLowerCase(),i=!0}}function d(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return R(this,t,r);case"utf8":case"utf-8":return k(this,t,r);case"ascii":return O(this,t,r);case"latin1":case"binary":return x(this,t,r);case"base64":return E(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function p(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function y(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),z(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=a.from(t,n)),a.isBuffer(t))return 0===t.length?-1:g(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):g(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function g(e,t,r,n,i){var o,a=1,s=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,r/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var l=-1;for(o=r;os&&(r=s-u),o=r;o>=0;o--){for(var h=!0,f=0;fi&&(n=i):n=i;var o=t.length;n>o/2&&(n=o/2);for(var a=0;a>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function E(e,r,n){return 0===r&&n===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(r,n))}function k(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i239?4:c>223?3:c>191?2:1;if(i+h<=r)switch(h){case 1:c<128&&(l=c);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&c)<<6|63&o)>127&&(l=u);break;case 3:o=e[i+1],a=e[i+2],128==(192&o)&&128==(192&a)&&(u=(15&c)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&c)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(l=u)}null===l?(l=65533,h=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=h}return function(e){var t=e.length;if(t<=A)return String.fromCharCode.apply(String,e);var r="",n=0;for(;nt&&(e+=" ... "),""},a.prototype.compare=function(e,t,r,n,i){if(q(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),u=Math.min(o,s),c=this.slice(n,i),l=e.slice(t,r),h=0;h>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return v(this,e,t,r);case"utf8":case"utf-8":return m(this,e,t,r);case"ascii":return b(this,e,t,r);case"latin1":case"binary":return w(this,e,t,r);case"base64":return _(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var A=4096;function O(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;in)&&(r=n);for(var i="",o=t;or)throw new RangeError("Trying to access beyond buffer length")}function T(e,t,r,n,i,o){if(!a.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function j(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function L(e,t,r,i,o){return t=+t,r>>>=0,o||j(e,0,r,4),n.write(e,t,r,i,23,4),r+4}function I(e,t,r,i,o){return t=+t,r>>>=0,o||j(e,0,r,8),n.write(e,t,r,i,52,8),r+8}a.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||M(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||M(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},a.prototype.readUInt8=function(e,t){return e>>>=0,t||M(e,1,this.length),this[e]},a.prototype.readUInt16LE=function(e,t){return e>>>=0,t||M(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUInt16BE=function(e,t){return e>>>=0,t||M(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUInt32LE=function(e,t){return e>>>=0,t||M(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},a.prototype.readUInt32BE=function(e,t){return e>>>=0,t||M(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||M(e,t,this.length);for(var n=this[e],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*t)),n},a.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||M(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},a.prototype.readInt8=function(e,t){return e>>>=0,t||M(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},a.prototype.readInt16LE=function(e,t){e>>>=0,t||M(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(e,t){e>>>=0,t||M(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(e,t){return e>>>=0,t||M(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e>>>=0,t||M(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,t){return e>>>=0,t||M(e,4,this.length),n.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e>>>=0,t||M(e,4,this.length),n.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e>>>=0,t||M(e,8,this.length),n.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e>>>=0,t||M(e,8,this.length),n.read(this,e,!1,52,8)},a.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t>>>=0,r>>>=0,n)||T(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n)||T(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},a.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,1,255,0),this[t]=255&e,t+1},a.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},a.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);T(this,e,t,r,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+r},a.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);T(this,e,t,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+r},a.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeFloatLE=function(e,t,r){return L(this,e,t,!0,r)},a.prototype.writeFloatBE=function(e,t,r){return L(this,e,t,!1,r)},a.prototype.writeDoubleLE=function(e,t,r){return I(this,e,t,!0,r)},a.prototype.writeDoubleBE=function(e,t,r){return I(this,e,t,!1,r)},a.prototype.copy=function(e,t,r,n){if(!a.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--o)e[o+t]=this[o+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return i},a.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!a.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){var i=e.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(e=i)}}else"number"==typeof e&&(e&=255);if(t<0||this.length>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function B(e){return t.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(P,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function D(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function q(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function z(e){return e!=e}}).call(this)}).call(this,e("buffer").Buffer)},{"base64-js":1,buffer:4,ieee754:8}],5:[function(e,t,r){t.exports={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}},{}],6:[function(e,t,r){"use strict";var n,i="object"==typeof Reflect?Reflect:null,o=i&&"function"==typeof i.apply?i.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};n=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var a=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}t.exports=s,t.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,o),n(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}v(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&v(e,"error",t,r)}(e,i,{once:!0})}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var u=10;function c(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function h(e,t,r,n){var i,o,a,s;if(c(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),a=o[t]),void 0===a)a=o[t]=r,++e._eventsCount;else if("function"==typeof a?a=o[t]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),(i=l(e))>0&&a.length>i&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=a.length,s=u,console&&console.warn&&console.warn(s)}return e}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=f.bind(n);return i.listener=r,n.wrapFn=i,i}function p(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var u=i[e];if(void 0===u)return!1;if("function"==typeof u)o(u,this,t);else{var c=u.length,l=g(u,c);for(r=0;r=0;o--)if(r[o]===t||r[o].listener===t){a=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1=0;n--)this.removeListener(e,t[n]);return this},s.prototype.listeners=function(e){return p(this,e,!0)},s.prototype.rawListeners=function(e){return p(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):y.call(e,t)},s.prototype.listenerCount=y,s.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},{}],7:[function(e,t,r){var n=e("http"),i=e("url"),o=t.exports;for(var a in n)n.hasOwnProperty(a)&&(o[a]=n[a]);function s(e){if("string"==typeof e&&(e=i.parse(e)),e.protocol||(e.protocol="https:"),"https:"!==e.protocol)throw new Error('Protocol "'+e.protocol+'" not supported. Expected "https:"');return e}o.request=function(e,t){return e=s(e),n.request.call(this,e,t)},o.get=function(e,t){return e=s(e),n.get.call(this,e,t)}},{http:17,url:37}],8:[function(e,t,r){ +"use strict";var t=e("base64-js"),n=e("ieee754");r.Buffer=s,r.SlowBuffer=function(e){+e!=e&&(e=0);return s.alloc(+e)},r.INSPECT_MAX_BYTES=50;var i=2147483647;function o(e){if(e>i)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return t.__proto__=s.prototype,t}function s(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return c(e)}return a(e,t,r)}function a(e,t,r){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!s.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|f(e,t),n=o(r),i=n.write(e,t);i!==r&&(n=n.slice(0,i));return n}(e,t);if(ArrayBuffer.isView(e))return l(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(q(e,ArrayBuffer)||e&&q(e.buffer,ArrayBuffer))return function(e,t,r){if(t<0||e.byteLength=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|e}function f(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||q(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return U(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return B(e).length;default:if(i)return n?-1:U(e).length;t=(""+t).toLowerCase(),i=!0}}function d(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return R(this,t,r);case"utf8":case"utf-8":return k(this,t,r);case"ascii":return x(this,t,r);case"latin1":case"binary":return O(this,t,r);case"base64":return E(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function p(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function y(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),z(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=s.from(t,n)),s.isBuffer(t))return 0===t.length?-1:g(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):g(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function g(e,t,r,n,i){var o,s=1,a=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,u/=2,r/=2}function c(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var l=-1;for(o=r;oa&&(r=a-u),o=r;o>=0;o--){for(var h=!0,f=0;fi&&(n=i):n=i;var o=t.length;n>o/2&&(n=o/2);for(var s=0;s>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function E(e,r,n){return 0===r&&n===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(r,n))}function k(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i239?4:c>223?3:c>191?2:1;if(i+h<=r)switch(h){case 1:c<128&&(l=c);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&c)<<6|63&o)>127&&(l=u);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(u=(15&c)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(l=u)}null===l?(l=65533,h=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=h}return function(e){var t=e.length;if(t<=A)return String.fromCharCode.apply(String,e);var r="",n=0;for(;nt&&(e+=" ... "),""},s.prototype.compare=function(e,t,r,n,i){if(q(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(t>>>=0),u=Math.min(o,a),c=this.slice(n,i),l=e.slice(t,r),h=0;h>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return v(this,e,t,r);case"utf8":case"utf-8":return m(this,e,t,r);case"ascii":return b(this,e,t,r);case"latin1":case"binary":return w(this,e,t,r);case"base64":return _(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var A=4096;function x(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;in)&&(r=n);for(var i="",o=t;or)throw new RangeError("Trying to access beyond buffer length")}function T(e,t,r,n,i,o){if(!s.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function j(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function L(e,t,r,i,o){return t=+t,r>>>=0,o||j(e,0,r,4),n.write(e,t,r,i,23,4),r+4}function I(e,t,r,i,o){return t=+t,r>>>=0,o||j(e,0,r,8),n.write(e,t,r,i,52,8),r+8}s.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||C(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||C(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},s.prototype.readUInt8=function(e,t){return e>>>=0,t||C(e,1,this.length),this[e]},s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||C(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||C(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||C(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||C(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||C(e,t,this.length);for(var n=this[e],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*t)),n},s.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||C(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},s.prototype.readInt8=function(e,t){return e>>>=0,t||C(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||C(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(e,t){e>>>=0,t||C(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||C(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||C(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readFloatLE=function(e,t){return e>>>=0,t||C(e,4,this.length),n.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||C(e,4,this.length),n.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||C(e,8,this.length),n.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||C(e,8,this.length),n.read(this,e,!1,52,8)},s.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t>>>=0,r>>>=0,n)||T(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n)||T(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},s.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,1,255,0),this[t]=255&e,t+1},s.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},s.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);T(this,e,t,r,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o>0)-a&255;return t+r},s.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);T(this,e,t,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},s.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeFloatLE=function(e,t,r){return L(this,e,t,!0,r)},s.prototype.writeFloatBE=function(e,t,r){return L(this,e,t,!1,r)},s.prototype.writeDoubleLE=function(e,t,r){return I(this,e,t,!0,r)},s.prototype.writeDoubleBE=function(e,t,r){return I(this,e,t,!1,r)},s.prototype.copy=function(e,t,r,n){if(!s.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--o)e[o+t]=this[o+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return i},s.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){var i=e.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(e=i)}}else"number"==typeof e&&(e&=255);if(t<0||this.length>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function B(e){return t.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(P,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function D(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function q(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function z(e){return e!=e}}).call(this)}).call(this,e("buffer").Buffer)},{"base64-js":1,buffer:4,ieee754:8}],5:[function(e,t,r){t.exports={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}},{}],6:[function(e,t,r){"use strict";var n,i="object"==typeof Reflect?Reflect:null,o=i&&"function"==typeof i.apply?i.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};n=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var s=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}t.exports=a,t.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,o),n(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}v(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&v(e,"error",t,r)}(e,i,{once:!0})}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var u=10;function c(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function h(e,t,r,n){var i,o,s,a;if(c(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),s=o[t]),void 0===s)s=o[t]=r,++e._eventsCount;else if("function"==typeof s?s=o[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=l(e))>0&&s.length>i&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=s.length,a=u,console&&console.warn&&console.warn(a)}return e}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=f.bind(n);return i.listener=r,n.wrapFn=i,i}function p(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var u=i[e];if(void 0===u)return!1;if("function"==typeof u)o(u,this,t);else{var c=u.length,l=g(u,c);for(r=0;r=0;o--)if(r[o]===t||r[o].listener===t){s=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1=0;n--)this.removeListener(e,t[n]);return this},a.prototype.listeners=function(e){return p(this,e,!0)},a.prototype.rawListeners=function(e){return p(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):y.call(e,t)},a.prototype.listenerCount=y,a.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},{}],7:[function(e,t,r){var n=e("http"),i=e("url"),o=t.exports;for(var s in n)n.hasOwnProperty(s)&&(o[s]=n[s]);function a(e){if("string"==typeof e&&(e=i.parse(e)),e.protocol||(e.protocol="https:"),"https:"!==e.protocol)throw new Error('Protocol "'+e.protocol+'" not supported. Expected "https:"');return e}o.request=function(e,t){return e=a(e),n.request.call(this,e,t)},o.get=function(e,t){return e=a(e),n.get.call(this,e,t)}},{http:17,url:37}],8:[function(e,t,r){ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ -r.read=function(e,t,r,n,i){var o,a,s=8*i-n-1,u=(1<>1,l=-7,h=r?i-1:0,f=r?-1:1,d=e[t+h];for(h+=f,o=d&(1<<-l)-1,d>>=-l,l+=s;l>0;o=256*o+e[t+h],h+=f,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=n;l>0;a=256*a+e[t+h],h+=f,l-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,n),o-=c}return(d?-1:1)*a*Math.pow(2,o-n)},r.write=function(e,t,r,n,i,o){var a,s,u,c=8*o-i-1,l=(1<>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+h>=1?f/u:f*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=l?(s=0,a=l):a+h>=1?(s=(t*u-1)*Math.pow(2,i),a+=h):(s=t*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;e[r+d]=255&s,d+=p,s/=256,i-=8);for(a=a<0;e[r+d]=255&a,d+=p,a/=256,c-=8);e[r+d-p]|=128*y}},{}],9:[function(e,t,r){"function"==typeof Object.create?t.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},{}],10:[function(e,t,r){(function(e){(function(){"use strict";function r(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function n(e,t){for(var r,n="",i=0,o=-1,a=0,s=0;s<=e.length;++s){if(s2){var u=n.lastIndexOf("/");if(u!==n.length-1){-1===u?(n="",i=0):i=(n=n.slice(0,u)).length-1-n.lastIndexOf("/"),o=s,a=0;continue}}else if(2===n.length||1===n.length){n="",i=0,o=s,a=0;continue}t&&(n.length>0?n+="/..":n="..",i=2)}else n.length>0?n+="/"+e.slice(o+1,s):n=e.slice(o+1,s),i=s-o-1;o=s,a=0}else 46===r&&-1!==a?++a:a=-1}return n}var i={resolve:function(){for(var t,i="",o=!1,a=arguments.length-1;a>=-1&&!o;a--){var s;a>=0?s=arguments[a]:(void 0===t&&(t=e.cwd()),s=t),r(s),0!==s.length&&(i=s+"/"+i,o=47===s.charCodeAt(0))}return i=n(i,!o),o?i.length>0?"/"+i:"/":i.length>0?i:"."},normalize:function(e){if(r(e),0===e.length)return".";var t=47===e.charCodeAt(0),i=47===e.charCodeAt(e.length-1);return 0!==(e=n(e,!t)).length||t||(e="."),e.length>0&&i&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return r(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,t=0;t0&&(void 0===e?e=n:e+="/"+n)}return void 0===e?".":i.normalize(e)},relative:function(e,t){if(r(e),r(t),e===t)return"";if((e=i.resolve(e))===(t=i.resolve(t)))return"";for(var n=1;nc){if(47===t.charCodeAt(s+h))return t.slice(s+h+1);if(0===h)return t.slice(s+h)}else a>c&&(47===e.charCodeAt(n+h)?l=h:0===h&&(l=0));break}var f=e.charCodeAt(n+h);if(f!==t.charCodeAt(s+h))break;47===f&&(l=h)}var d="";for(h=n+l+1;h<=o;++h)h!==o&&47!==e.charCodeAt(h)||(0===d.length?d+="..":d+="/..");return d.length>0?d+t.slice(s+l):(s+=l,47===t.charCodeAt(s)&&++s,t.slice(s))},_makeLong:function(e){return e},dirname:function(e){if(r(e),0===e.length)return".";for(var t=e.charCodeAt(0),n=47===t,i=-1,o=!0,a=e.length-1;a>=1;--a)if(47===(t=e.charCodeAt(a))){if(!o){i=a;break}}else o=!1;return-1===i?n?"/":".":n&&1===i?"//":e.slice(0,i)},basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');r(e);var n,i=0,o=-1,a=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var s=t.length-1,u=-1;for(n=e.length-1;n>=0;--n){var c=e.charCodeAt(n);if(47===c){if(!a){i=n+1;break}}else-1===u&&(a=!1,u=n+1),s>=0&&(c===t.charCodeAt(s)?-1==--s&&(o=n):(s=-1,o=u))}return i===o?o=u:-1===o&&(o=e.length),e.slice(i,o)}for(n=e.length-1;n>=0;--n)if(47===e.charCodeAt(n)){if(!a){i=n+1;break}}else-1===o&&(a=!1,o=n+1);return-1===o?"":e.slice(i,o)},extname:function(e){r(e);for(var t=-1,n=0,i=-1,o=!0,a=0,s=e.length-1;s>=0;--s){var u=e.charCodeAt(s);if(47!==u)-1===i&&(o=!1,i=s+1),46===u?-1===t?t=s:1!==a&&(a=1):-1!==t&&(a=-1);else if(!o){n=s+1;break}}return-1===t||-1===i||0===a||1===a&&t===i-1&&t===n+1?"":e.slice(t,i)},format:function(e){if(null===e||"object"!=typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var r=t.dir||t.root,n=t.base||(t.name||"")+(t.ext||"");return r?r===t.root?r+n:r+e+n:n}("/",e)},parse:function(e){r(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return t;var n,i=e.charCodeAt(0),o=47===i;o?(t.root="/",n=1):n=0;for(var a=-1,s=0,u=-1,c=!0,l=e.length-1,h=0;l>=n;--l)if(47!==(i=e.charCodeAt(l)))-1===u&&(c=!1,u=l+1),46===i?-1===a?a=l:1!==h&&(h=1):-1!==a&&(h=-1);else if(!c){s=l+1;break}return-1===a||-1===u||0===h||1===h&&a===u-1&&a===s+1?-1!==u&&(t.base=t.name=0===s&&o?e.slice(1,u):e.slice(s,u)):(0===s&&o?(t.name=e.slice(1,a),t.base=e.slice(1,u)):(t.name=e.slice(s,a),t.base=e.slice(s,u)),t.ext=e.slice(a,u)),s>0?t.dir=e.slice(0,s-1):o&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};i.posix=i,t.exports=i}).call(this)}).call(this,e("_process"))},{_process:11}],11:[function(e,t,r){var n,i,o=t.exports={};function a(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function u(e){if(n===setTimeout)return setTimeout(e,0);if((n===a||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:a}catch(e){n=a}try{i="function"==typeof clearTimeout?clearTimeout:s}catch(e){i=s}}();var c,l=[],h=!1,f=-1;function d(){h&&c&&(h=!1,c.length?l=c.concat(l):f=-1,l.length&&p())}function p(){if(!h){var e=u(d);h=!0;for(var t=l.length;t;){for(c=l,l=[];++f1)for(var r=1;r= 0x80 (not a basic code point)","invalid-input":"Invalid input"},y=Math.floor,g=String.fromCharCode;function v(e){throw new RangeError(p[e])}function m(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}function b(e,t){var r=e.split("@"),n="";return r.length>1&&(n=r[0]+"@",e=r[1]),n+m((e=e.replace(d,".")).split("."),t).join(".")}function w(e){for(var t,r,n=[],i=0,o=e.length;i=55296&&t<=56319&&i65535&&(t+=g((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=g(e)})).join("")}function S(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function E(e,t,r){var n=0;for(e=r?y(e/700):e>>1,e+=y(e/t);e>455;n+=l)e=y(e/35);return y(n+36*e/(e+38))}function k(e){var t,r,n,i,o,a,s,u,h,f,d,p=[],g=e.length,m=0,b=128,w=72;for((r=e.lastIndexOf("-"))<0&&(r=0),n=0;n=128&&v("not-basic"),p.push(e.charCodeAt(n));for(i=r>0?r+1:0;i=g&&v("invalid-input"),((u=(d=e.charCodeAt(i++))-48<10?d-22:d-65<26?d-65:d-97<26?d-97:l)>=l||u>y((c-m)/a))&&v("overflow"),m+=u*a,!(u<(h=s<=w?1:s>=w+26?26:s-w));s+=l)a>y(c/(f=l-h))&&v("overflow"),a*=f;w=E(m-o,t=p.length+1,0==o),y(m/t)>c-b&&v("overflow"),b+=y(m/t),m%=t,p.splice(m++,0,b)}return _(p)}function A(e){var t,r,n,i,o,a,s,u,h,f,d,p,m,b,_,k=[];for(p=(e=w(e)).length,t=128,r=0,o=72,a=0;a=t&&dy((c-r)/(m=n+1))&&v("overflow"),r+=(s-t)*m,t=s,a=0;ac&&v("overflow"),d==t){for(u=r,h=l;!(u<(f=h<=o?1:h>=o+26?26:h-o));h+=l)_=u-f,b=l-f,k.push(g(S(f+_%b,0))),u=y(_/b);k.push(g(S(u,0))),o=E(r,m,n==i),r=0,++n}++r,++t}return k.join("")}if(s={version:"1.4.1",ucs2:{decode:w,encode:_},decode:k,encode:A,toASCII:function(e){return b(e,(function(e){return f.test(e)?"xn--"+A(e):e}))},toUnicode:function(e){return b(e,(function(e){return h.test(e)?k(e.slice(4).toLowerCase()):e}))}},i&&o)if(t.exports==i)o.exports=s;else for(u in s)s.hasOwnProperty(u)&&(i[u]=s[u]);else n.punycode=s}(this)}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],13:[function(e,t,r){"use strict";function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.exports=function(e,t,r,o){t=t||"&",r=r||"=";var a={};if("string"!=typeof e||0===e.length)return a;var s=/\+/g;e=e.split(t);var u=1e3;o&&"number"==typeof o.maxKeys&&(u=o.maxKeys);var c=e.length;u>0&&c>u&&(c=u);for(var l=0;l=0?(h=y.substr(0,g),f=y.substr(g+1)):(h=y,f=""),d=decodeURIComponent(h),p=decodeURIComponent(f),n(a,d)?i(a[d])?a[d].push(p):a[d]=[a[d],p]:a[d]=p}return a};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{}],14:[function(e,t,r){"use strict";var n=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};t.exports=function(e,t,r,s){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?o(a(e),(function(a){var s=encodeURIComponent(n(a))+r;return i(e[a])?o(e[a],(function(e){return s+encodeURIComponent(n(e))})).join(t):s+encodeURIComponent(n(e[a]))})).join(t):s?encodeURIComponent(n(s))+r+encodeURIComponent(n(e)):""};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function o(e,t){if(e.map)return e.map(t);for(var r=[],n=0;n>1,l=-7,h=r?i-1:0,f=r?-1:1,d=e[t+h];for(h+=f,o=d&(1<<-l)-1,d>>=-l,l+=a;l>0;o=256*o+e[t+h],h+=f,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=n;l>0;s=256*s+e[t+h],h+=f,l-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,n),o-=c}return(d?-1:1)*s*Math.pow(2,o-n)},r.write=function(e,t,r,n,i,o){var s,a,u,c=8*o-i-1,l=(1<>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+h>=1?f/u:f*Math.pow(2,1-h))*u>=2&&(s++,u/=2),s+h>=l?(a=0,s=l):s+h>=1?(a=(t*u-1)*Math.pow(2,i),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;e[r+d]=255&a,d+=p,a/=256,i-=8);for(s=s<0;e[r+d]=255&s,d+=p,s/=256,c-=8);e[r+d-p]|=128*y}},{}],9:[function(e,t,r){"function"==typeof Object.create?t.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},{}],10:[function(e,t,r){(function(e){(function(){"use strict";function r(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function n(e,t){for(var r,n="",i=0,o=-1,s=0,a=0;a<=e.length;++a){if(a2){var u=n.lastIndexOf("/");if(u!==n.length-1){-1===u?(n="",i=0):i=(n=n.slice(0,u)).length-1-n.lastIndexOf("/"),o=a,s=0;continue}}else if(2===n.length||1===n.length){n="",i=0,o=a,s=0;continue}t&&(n.length>0?n+="/..":n="..",i=2)}else n.length>0?n+="/"+e.slice(o+1,a):n=e.slice(o+1,a),i=a-o-1;o=a,s=0}else 46===r&&-1!==s?++s:s=-1}return n}var i={resolve:function(){for(var t,i="",o=!1,s=arguments.length-1;s>=-1&&!o;s--){var a;s>=0?a=arguments[s]:(void 0===t&&(t=e.cwd()),a=t),r(a),0!==a.length&&(i=a+"/"+i,o=47===a.charCodeAt(0))}return i=n(i,!o),o?i.length>0?"/"+i:"/":i.length>0?i:"."},normalize:function(e){if(r(e),0===e.length)return".";var t=47===e.charCodeAt(0),i=47===e.charCodeAt(e.length-1);return 0!==(e=n(e,!t)).length||t||(e="."),e.length>0&&i&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return r(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,t=0;t0&&(void 0===e?e=n:e+="/"+n)}return void 0===e?".":i.normalize(e)},relative:function(e,t){if(r(e),r(t),e===t)return"";if((e=i.resolve(e))===(t=i.resolve(t)))return"";for(var n=1;nc){if(47===t.charCodeAt(a+h))return t.slice(a+h+1);if(0===h)return t.slice(a+h)}else s>c&&(47===e.charCodeAt(n+h)?l=h:0===h&&(l=0));break}var f=e.charCodeAt(n+h);if(f!==t.charCodeAt(a+h))break;47===f&&(l=h)}var d="";for(h=n+l+1;h<=o;++h)h!==o&&47!==e.charCodeAt(h)||(0===d.length?d+="..":d+="/..");return d.length>0?d+t.slice(a+l):(a+=l,47===t.charCodeAt(a)&&++a,t.slice(a))},_makeLong:function(e){return e},dirname:function(e){if(r(e),0===e.length)return".";for(var t=e.charCodeAt(0),n=47===t,i=-1,o=!0,s=e.length-1;s>=1;--s)if(47===(t=e.charCodeAt(s))){if(!o){i=s;break}}else o=!1;return-1===i?n?"/":".":n&&1===i?"//":e.slice(0,i)},basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');r(e);var n,i=0,o=-1,s=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var a=t.length-1,u=-1;for(n=e.length-1;n>=0;--n){var c=e.charCodeAt(n);if(47===c){if(!s){i=n+1;break}}else-1===u&&(s=!1,u=n+1),a>=0&&(c===t.charCodeAt(a)?-1==--a&&(o=n):(a=-1,o=u))}return i===o?o=u:-1===o&&(o=e.length),e.slice(i,o)}for(n=e.length-1;n>=0;--n)if(47===e.charCodeAt(n)){if(!s){i=n+1;break}}else-1===o&&(s=!1,o=n+1);return-1===o?"":e.slice(i,o)},extname:function(e){r(e);for(var t=-1,n=0,i=-1,o=!0,s=0,a=e.length-1;a>=0;--a){var u=e.charCodeAt(a);if(47!==u)-1===i&&(o=!1,i=a+1),46===u?-1===t?t=a:1!==s&&(s=1):-1!==t&&(s=-1);else if(!o){n=a+1;break}}return-1===t||-1===i||0===s||1===s&&t===i-1&&t===n+1?"":e.slice(t,i)},format:function(e){if(null===e||"object"!=typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var r=t.dir||t.root,n=t.base||(t.name||"")+(t.ext||"");return r?r===t.root?r+n:r+e+n:n}("/",e)},parse:function(e){r(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return t;var n,i=e.charCodeAt(0),o=47===i;o?(t.root="/",n=1):n=0;for(var s=-1,a=0,u=-1,c=!0,l=e.length-1,h=0;l>=n;--l)if(47!==(i=e.charCodeAt(l)))-1===u&&(c=!1,u=l+1),46===i?-1===s?s=l:1!==h&&(h=1):-1!==s&&(h=-1);else if(!c){a=l+1;break}return-1===s||-1===u||0===h||1===h&&s===u-1&&s===a+1?-1!==u&&(t.base=t.name=0===a&&o?e.slice(1,u):e.slice(a,u)):(0===a&&o?(t.name=e.slice(1,s),t.base=e.slice(1,u)):(t.name=e.slice(a,s),t.base=e.slice(a,u)),t.ext=e.slice(s,u)),a>0?t.dir=e.slice(0,a-1):o&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};i.posix=i,t.exports=i}).call(this)}).call(this,e("_process"))},{_process:11}],11:[function(e,t,r){var n,i,o=t.exports={};function s(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function u(e){if(n===setTimeout)return setTimeout(e,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:s}catch(e){n=s}try{i="function"==typeof clearTimeout?clearTimeout:a}catch(e){i=a}}();var c,l=[],h=!1,f=-1;function d(){h&&c&&(h=!1,c.length?l=c.concat(l):f=-1,l.length&&p())}function p(){if(!h){var e=u(d);h=!0;for(var t=l.length;t;){for(c=l,l=[];++f1)for(var r=1;r= 0x80 (not a basic code point)","invalid-input":"Invalid input"},y=Math.floor,g=String.fromCharCode;function v(e){throw new RangeError(p[e])}function m(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}function b(e,t){var r=e.split("@"),n="";return r.length>1&&(n=r[0]+"@",e=r[1]),n+m((e=e.replace(d,".")).split("."),t).join(".")}function w(e){for(var t,r,n=[],i=0,o=e.length;i=55296&&t<=56319&&i65535&&(t+=g((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=g(e)})).join("")}function S(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function E(e,t,r){var n=0;for(e=r?y(e/700):e>>1,e+=y(e/t);e>455;n+=l)e=y(e/35);return y(n+36*e/(e+38))}function k(e){var t,r,n,i,o,s,a,u,h,f,d,p=[],g=e.length,m=0,b=128,w=72;for((r=e.lastIndexOf("-"))<0&&(r=0),n=0;n=128&&v("not-basic"),p.push(e.charCodeAt(n));for(i=r>0?r+1:0;i=g&&v("invalid-input"),((u=(d=e.charCodeAt(i++))-48<10?d-22:d-65<26?d-65:d-97<26?d-97:l)>=l||u>y((c-m)/s))&&v("overflow"),m+=u*s,!(u<(h=a<=w?1:a>=w+26?26:a-w));a+=l)s>y(c/(f=l-h))&&v("overflow"),s*=f;w=E(m-o,t=p.length+1,0==o),y(m/t)>c-b&&v("overflow"),b+=y(m/t),m%=t,p.splice(m++,0,b)}return _(p)}function A(e){var t,r,n,i,o,s,a,u,h,f,d,p,m,b,_,k=[];for(p=(e=w(e)).length,t=128,r=0,o=72,s=0;s=t&&dy((c-r)/(m=n+1))&&v("overflow"),r+=(a-t)*m,t=a,s=0;sc&&v("overflow"),d==t){for(u=r,h=l;!(u<(f=h<=o?1:h>=o+26?26:h-o));h+=l)_=u-f,b=l-f,k.push(g(S(f+_%b,0))),u=y(_/b);k.push(g(S(u,0))),o=E(r,m,n==i),r=0,++n}++r,++t}return k.join("")}if(a={version:"1.4.1",ucs2:{decode:w,encode:_},decode:k,encode:A,toASCII:function(e){return b(e,(function(e){return f.test(e)?"xn--"+A(e):e}))},toUnicode:function(e){return b(e,(function(e){return h.test(e)?k(e.slice(4).toLowerCase()):e}))}},i&&o)if(t.exports==i)o.exports=a;else for(u in a)a.hasOwnProperty(u)&&(i[u]=a[u]);else n.punycode=a}(this)}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],13:[function(e,t,r){"use strict";function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.exports=function(e,t,r,o){t=t||"&",r=r||"=";var s={};if("string"!=typeof e||0===e.length)return s;var a=/\+/g;e=e.split(t);var u=1e3;o&&"number"==typeof o.maxKeys&&(u=o.maxKeys);var c=e.length;u>0&&c>u&&(c=u);for(var l=0;l=0?(h=y.substr(0,g),f=y.substr(g+1)):(h=y,f=""),d=decodeURIComponent(h),p=decodeURIComponent(f),n(s,d)?i(s[d])?s[d].push(p):s[d]=[s[d],p]:s[d]=p}return s};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{}],14:[function(e,t,r){"use strict";var n=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};t.exports=function(e,t,r,a){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?o(s(e),(function(s){var a=encodeURIComponent(n(s))+r;return i(e[s])?o(e[s],(function(e){return a+encodeURIComponent(n(e))})).join(t):a+encodeURIComponent(n(e[s]))})).join(t):a?encodeURIComponent(n(a))+r+encodeURIComponent(n(e)):""};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function o(e,t){if(e.map)return e.map(t);for(var r=[],n=0;n */ -var n=e("buffer"),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function a(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=n:(o(n,r),r.Buffer=a),a.prototype=Object.create(i.prototype),o(i,a),a.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},a.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},{buffer:4}],17:[function(e,t,r){(function(t){(function(){var n=e("./lib/request"),i=e("./lib/response"),o=e("xtend"),a=e("builtin-status-codes"),s=e("url"),u=r;u.request=function(e,r){e="string"==typeof e?s.parse(e):o(e);var i=-1===t.location.protocol.search(/^https?:$/)?"http:":"",a=e.protocol||i,u=e.hostname||e.host,c=e.port,l=e.path||"/";u&&-1!==u.indexOf(":")&&(u="["+u+"]"),e.url=(u?a+"//"+u:"")+(c?":"+c:"")+l,e.method=(e.method||"GET").toUpperCase(),e.headers=e.headers||{};var h=new n(e);return r&&h.on("response",r),h},u.get=function(e,t){var r=u.request(e,t);return r.end(),r},u.ClientRequest=n,u.IncomingMessage=i.IncomingMessage,u.Agent=function(){},u.Agent.defaultMaxSockets=4,u.globalAgent=new u.Agent,u.STATUS_CODES=a,u.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./lib/request":19,"./lib/response":20,"builtin-status-codes":5,url:37,xtend:40}],18:[function(e,t,r){(function(e){(function(){var t;function n(){if(void 0!==t)return t;if(e.XMLHttpRequest){t=new e.XMLHttpRequest;try{t.open("GET",e.XDomainRequest?"/":"https://example.com")}catch(e){t=null}}else t=null;return t}function i(e){var t=n();if(!t)return!1;try{return t.responseType=e,t.responseType===e}catch(e){}return!1}function o(e){return"function"==typeof e}r.fetch=o(e.fetch)&&o(e.ReadableStream),r.writableStream=o(e.WritableStream),r.abortController=o(e.AbortController),r.arraybuffer=r.fetch||i("arraybuffer"),r.msstream=!r.fetch&&i("ms-stream"),r.mozchunkedarraybuffer=!r.fetch&&i("moz-chunked-arraybuffer"),r.overrideMimeType=r.fetch||!!n()&&o(n().overrideMimeType),t=null}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],19:[function(e,t,r){(function(r,n,i){(function(){var o=e("./capability"),a=e("inherits"),s=e("./response"),u=e("readable-stream"),c=s.IncomingMessage,l=s.readyStates;var h=t.exports=function(e){var t,r=this;u.Writable.call(r),r._opts=e,r._body=[],r._headers={},e.auth&&r.setHeader("Authorization","Basic "+i.from(e.auth).toString("base64")),Object.keys(e.headers).forEach((function(t){r.setHeader(t,e.headers[t])}));var n=!0;if("disable-fetch"===e.mode||"requestTimeout"in e&&!o.abortController)n=!1,t=!0;else if("prefer-streaming"===e.mode)t=!1;else if("allow-wrong-content-type"===e.mode)t=!o.overrideMimeType;else{if(e.mode&&"default"!==e.mode&&"prefer-fast"!==e.mode)throw new Error("Invalid value for opts.mode");t=!0}r._mode=function(e,t){return o.fetch&&t?"fetch":o.mozchunkedarraybuffer?"moz-chunked-arraybuffer":o.msstream?"ms-stream":o.arraybuffer&&e?"arraybuffer":"text"}(t,n),r._fetchTimer=null,r._socketTimeout=null,r._socketTimer=null,r.on("finish",(function(){r._onFinish()}))};a(h,u.Writable),h.prototype.setHeader=function(e,t){var r=e.toLowerCase();-1===f.indexOf(r)&&(this._headers[r]={name:e,value:t})},h.prototype.getHeader=function(e){var t=this._headers[e.toLowerCase()];return t?t.value:null},h.prototype.removeHeader=function(e){delete this._headers[e.toLowerCase()]},h.prototype._onFinish=function(){var e=this;if(!e._destroyed){var t=e._opts;"timeout"in t&&0!==t.timeout&&e.setTimeout(t.timeout);var i=e._headers,a=null;"GET"!==t.method&&"HEAD"!==t.method&&(a=new Blob(e._body,{type:(i["content-type"]||{}).value||""}));var s=[];if(Object.keys(i).forEach((function(e){var t=i[e].name,r=i[e].value;Array.isArray(r)?r.forEach((function(e){s.push([t,e])})):s.push([t,r])})),"fetch"===e._mode){var u=null;if(o.abortController){var c=new AbortController;u=c.signal,e._fetchAbortController=c,"requestTimeout"in t&&0!==t.requestTimeout&&(e._fetchTimer=n.setTimeout((function(){e.emit("requestTimeout"),e._fetchAbortController&&e._fetchAbortController.abort()}),t.requestTimeout))}n.fetch(e._opts.url,{method:e._opts.method,headers:s,body:a||void 0,mode:"cors",credentials:t.withCredentials?"include":"same-origin",signal:u}).then((function(t){e._fetchResponse=t,e._resetTimers(!1),e._connect()}),(function(t){e._resetTimers(!0),e._destroyed||e.emit("error",t)}))}else{var h=e._xhr=new n.XMLHttpRequest;try{h.open(e._opts.method,e._opts.url,!0)}catch(t){return void r.nextTick((function(){e.emit("error",t)}))}"responseType"in h&&(h.responseType=e._mode),"withCredentials"in h&&(h.withCredentials=!!t.withCredentials),"text"===e._mode&&"overrideMimeType"in h&&h.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in t&&(h.timeout=t.requestTimeout,h.ontimeout=function(){e.emit("requestTimeout")}),s.forEach((function(e){h.setRequestHeader(e[0],e[1])})),e._response=null,h.onreadystatechange=function(){switch(h.readyState){case l.LOADING:case l.DONE:e._onXHRProgress()}},"moz-chunked-arraybuffer"===e._mode&&(h.onprogress=function(){e._onXHRProgress()}),h.onerror=function(){e._destroyed||(e._resetTimers(!0),e.emit("error",new Error("XHR error")))};try{h.send(a)}catch(t){return void r.nextTick((function(){e.emit("error",t)}))}}}},h.prototype._onXHRProgress=function(){var e=this;e._resetTimers(!1),function(e){try{var t=e.status;return null!==t&&0!==t}catch(e){return!1}}(e._xhr)&&!e._destroyed&&(e._response||e._connect(),e._response._onXHRProgress(e._resetTimers.bind(e)))},h.prototype._connect=function(){var e=this;e._destroyed||(e._response=new c(e._xhr,e._fetchResponse,e._mode,e._resetTimers.bind(e)),e._response.on("error",(function(t){e.emit("error",t)})),e.emit("response",e._response))},h.prototype._write=function(e,t,r){this._body.push(e),r()},h.prototype._resetTimers=function(e){var t=this;n.clearTimeout(t._socketTimer),t._socketTimer=null,e?(n.clearTimeout(t._fetchTimer),t._fetchTimer=null):t._socketTimeout&&(t._socketTimer=n.setTimeout((function(){t.emit("timeout")}),t._socketTimeout))},h.prototype.abort=h.prototype.destroy=function(e){var t=this;t._destroyed=!0,t._resetTimers(!0),t._response&&(t._response._destroyed=!0),t._xhr?t._xhr.abort():t._fetchAbortController&&t._fetchAbortController.abort(),e&&t.emit("error",e)},h.prototype.end=function(e,t,r){"function"==typeof e&&(r=e,e=void 0),u.Writable.prototype.end.call(this,e,t,r)},h.prototype.setTimeout=function(e,t){var r=this;t&&r.once("timeout",t),r._socketTimeout=e,r._resetTimers(!1)},h.prototype.flushHeaders=function(){},h.prototype.setNoDelay=function(){},h.prototype.setSocketKeepAlive=function(){};var f=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"]}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer)},{"./capability":18,"./response":20,_process:11,buffer:4,inherits:9,"readable-stream":35}],20:[function(e,t,r){(function(t,n,i){(function(){var o=e("./capability"),a=e("inherits"),s=e("readable-stream"),u=r.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},c=r.IncomingMessage=function(e,r,n,a){var u=this;if(s.Readable.call(u),u._mode=n,u.headers={},u.rawHeaders=[],u.trailers={},u.rawTrailers=[],u.on("end",(function(){t.nextTick((function(){u.emit("close")}))})),"fetch"===n){if(u._fetchResponse=r,u.url=r.url,u.statusCode=r.status,u.statusMessage=r.statusText,r.headers.forEach((function(e,t){u.headers[t.toLowerCase()]=e,u.rawHeaders.push(t,e)})),o.writableStream){var c=new WritableStream({write:function(e){return a(!1),new Promise((function(t,r){u._destroyed?r():u.push(i.from(e))?t():u._resumeFetch=t}))},close:function(){a(!0),u._destroyed||u.push(null)},abort:function(e){a(!0),u._destroyed||u.emit("error",e)}});try{return void r.body.pipeTo(c).catch((function(e){a(!0),u._destroyed||u.emit("error",e)}))}catch(e){}}var l=r.body.getReader();!function e(){l.read().then((function(t){u._destroyed||(a(t.done),t.done?u.push(null):(u.push(i.from(t.value)),e()))})).catch((function(e){a(!0),u._destroyed||u.emit("error",e)}))}()}else{if(u._xhr=e,u._pos=0,u.url=e.responseURL,u.statusCode=e.status,u.statusMessage=e.statusText,e.getAllResponseHeaders().split(/\r?\n/).forEach((function(e){var t=e.match(/^([^:]+):\s*(.*)/);if(t){var r=t[1].toLowerCase();"set-cookie"===r?(void 0===u.headers[r]&&(u.headers[r]=[]),u.headers[r].push(t[2])):void 0!==u.headers[r]?u.headers[r]+=", "+t[2]:u.headers[r]=t[2],u.rawHeaders.push(t[1],t[2])}})),u._charset="x-user-defined",!o.overrideMimeType){var h=u.rawHeaders["mime-type"];if(h){var f=h.match(/;\s*charset=([^;])(;|$)/);f&&(u._charset=f[1].toLowerCase())}u._charset||(u._charset="utf-8")}}};a(c,s.Readable),c.prototype._read=function(){var e=this._resumeFetch;e&&(this._resumeFetch=null,e())},c.prototype._onXHRProgress=function(e){var t=this,r=t._xhr,o=null;switch(t._mode){case"text":if((o=r.responseText).length>t._pos){var a=o.substr(t._pos);if("x-user-defined"===t._charset){for(var s=i.alloc(a.length),c=0;ct._pos&&(t.push(i.from(new Uint8Array(l.result.slice(t._pos)))),t._pos=l.result.byteLength)},l.onload=function(){e(!0),t.push(null)},l.readAsArrayBuffer(o)}t._xhr.readyState===u.DONE&&"ms-stream"!==t._mode&&(e(!0),t.push(null))}}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer)},{"./capability":18,_process:11,buffer:4,inherits:9,"readable-stream":35}],21:[function(e,t,r){"use strict";var n={};function i(e,t,r){r||(r=Error);var i=function(e){var r,n;function i(r,n,i){return e.call(this,function(e,r,n){return"string"==typeof t?t:t(e,r,n)}(r,n,i))||this}return n=e,(r=i).prototype=Object.create(n.prototype),r.prototype.constructor=r,r.__proto__=n,i}(r);i.prototype.name=r.name,i.prototype.code=e,n[e]=i}function o(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}i("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),i("ERR_INVALID_ARG_TYPE",(function(e,t,r){var n,i,a,s;if("string"==typeof t&&(i="not ",t.substr(!a||a<0?0:+a,i.length)===i)?(n="must not be",t=t.replace(/^not /,"")):n="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))s="The ".concat(e," ").concat(n," ").concat(o(t,"type"));else{var u=function(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}(e,".")?"property":"argument";s='The "'.concat(e,'" ').concat(u," ").concat(n," ").concat(o(t,"type"))}return s+=". Received type ".concat(typeof r)}),TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},{}],22:[function(e,t,r){(function(r){(function(){"use strict";var n=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};t.exports=c;var i=e("./_stream_readable"),o=e("./_stream_writable");e("inherits")(c,i);for(var a=n(o.prototype),s=0;s0)if("string"==typeof t||a.objectMode||Object.getPrototypeOf(t)===s.prototype||(t=function(e){return s.from(e)}(t)),n)a.endEmitted?S(e,new _):x(e,a,t,!0);else if(a.ended)S(e,new b);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!r?(t=a.decoder.write(t),a.objectMode||0!==t.length?x(e,a,t,!1):j(e,a)):x(e,a,t,!1)}else n||(a.reading=!1,j(e,a));return!a.ended&&(a.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=R?e=R:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function M(e){var t=e._readableState;c("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(c("emitReadable",t.flowing),t.emittedReadable=!0,r.nextTick(T,e))}function T(e){var t=e._readableState;c("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,U(e)}function j(e,t){t.readingMore||(t.readingMore=!0,r.nextTick(L,e,t))}function L(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function P(e){c("readable nexttick read 0"),e.read(0)}function N(e,t){c("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),U(e),t.flowing&&!t.reading&&e.read(0)}function U(e){var t=e._readableState;for(c("flow",t.flowing);t.flowing&&null!==e.read(););}function B(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function D(e){var t=e._readableState;c("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,r.nextTick(q,t,e))}function q(e,t){if(c("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function z(e,t){for(var r=0,n=e.length;r=t.highWaterMark:t.length>0)||t.ended))return c("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?D(this):M(this),null;if(0===(e=C(e,t))&&t.ended)return 0===t.length&&D(this),null;var n,i=t.needReadable;return c("need readable",i),(0===t.length||t.length-e0?B(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&D(this)),null!==n&&this.emit("data",n),n},A.prototype._read=function(e){S(this,new w("_read()"))},A.prototype.pipe=function(e,t){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e)}i.pipesCount+=1,c("pipe count=%d opts=%j",i.pipesCount,t);var a=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr?u:g;function s(t,r){c("onunpipe"),t===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,c("cleanup"),e.removeListener("close",p),e.removeListener("finish",y),e.removeListener("drain",l),e.removeListener("error",d),e.removeListener("unpipe",s),n.removeListener("end",u),n.removeListener("end",g),n.removeListener("data",f),h=!0,!i.awaitDrain||e._writableState&&!e._writableState.needDrain||l())}function u(){c("onend"),e.end()}i.endEmitted?r.nextTick(a):n.once("end",a),e.on("unpipe",s);var l=function(e){return function(){var t=e._readableState;c("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&o(e,"data")&&(t.flowing=!0,U(e))}}(n);e.on("drain",l);var h=!1;function f(t){c("ondata");var r=e.write(t);c("dest.write",r),!1===r&&((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==z(i.pipes,e))&&!h&&(c("false write response, pause",i.awaitDrain),i.awaitDrain++),n.pause())}function d(t){c("onerror",t),g(),e.removeListener("error",d),0===o(e,"error")&&S(e,t)}function p(){e.removeListener("finish",y),g()}function y(){c("onfinish"),e.removeListener("close",p),g()}function g(){c("unpipe"),n.unpipe(e)}return n.on("data",f),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",d),e.once("close",p),e.once("finish",y),e.emit("pipe",n),i.flowing||(c("pipe resume"),n.resume()),e},A.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,c("on readable",i.length,i.reading),i.length?M(this):i.reading||r.nextTick(P,this))),n},A.prototype.addListener=A.prototype.on,A.prototype.removeListener=function(e,t){var n=a.prototype.removeListener.call(this,e,t);return"readable"===e&&r.nextTick(I,this),n},A.prototype.removeAllListeners=function(e){var t=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||r.nextTick(I,this),t},A.prototype.resume=function(){var e=this._readableState;return e.flowing||(c("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,r.nextTick(N,e,t))}(this,e)),e.paused=!1,this},A.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},A.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var i in e.on("end",(function(){if(c("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(i){(c("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(t.push(i)||(n=!0,e.pause()))})),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var o=0;o-1))throw new _(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(A.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(A.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),A.prototype._write=function(e,t,r){r(new y("_write()"))},A.prototype._writev=null,A.prototype.end=function(e,t,n){var i=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||function(e,t,n){t.ending=!0,T(e,t),n&&(t.finished?r.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,i,n),this},Object.defineProperty(A.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(A.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),A.prototype.destroy=h.destroy,A.prototype._undestroy=h.undestroy,A.prototype._destroy=function(e,t){t(e)}}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../errors":21,"./_stream_duplex":22,"./internal/streams/destroy":29,"./internal/streams/state":33,"./internal/streams/stream":34,_process:11,buffer:4,inherits:9,"util-deprecate":39}],27:[function(e,t,r){(function(r){(function(){"use strict";var n;function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var o=e("./end-of-stream"),a=Symbol("lastResolve"),s=Symbol("lastReject"),u=Symbol("error"),c=Symbol("ended"),l=Symbol("lastPromise"),h=Symbol("handlePromise"),f=Symbol("stream");function d(e,t){return{value:e,done:t}}function p(e){var t=e[a];if(null!==t){var r=e[f].read();null!==r&&(e[l]=null,e[a]=null,e[s]=null,t(d(r,!1)))}}function y(e){r.nextTick(p,e)}var g=Object.getPrototypeOf((function(){})),v=Object.setPrototypeOf((i(n={get stream(){return this[f]},next:function(){var e=this,t=this[u];if(null!==t)return Promise.reject(t);if(this[c])return Promise.resolve(d(void 0,!0));if(this[f].destroyed)return new Promise((function(t,n){r.nextTick((function(){e[u]?n(e[u]):t(d(void 0,!0))}))}));var n,i=this[l];if(i)n=new Promise(function(e,t){return function(r,n){e.then((function(){t[c]?r(d(void 0,!0)):t[h](r,n)}),n)}}(i,this));else{var o=this[f].read();if(null!==o)return Promise.resolve(d(o,!1));n=new Promise(this[h])}return this[l]=n,n}},Symbol.asyncIterator,(function(){return this})),i(n,"return",(function(){var e=this;return new Promise((function(t,r){e[f].destroy(null,(function(e){e?r(e):t(d(void 0,!0))}))}))})),n),g);t.exports=function(e){var t,r=Object.create(v,(i(t={},f,{value:e,writable:!0}),i(t,a,{value:null,writable:!0}),i(t,s,{value:null,writable:!0}),i(t,u,{value:null,writable:!0}),i(t,c,{value:e._readableState.endEmitted,writable:!0}),i(t,h,{value:function(e,t){var n=r[f].read();n?(r[l]=null,r[a]=null,r[s]=null,e(d(n,!1))):(r[a]=e,r[s]=t)},writable:!0}),t));return r[l]=null,o(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[s];return null!==t&&(r[l]=null,r[a]=null,r[s]=null,t(e)),void(r[u]=e)}var n=r[a];null!==n&&(r[l]=null,r[a]=null,r[s]=null,n(d(void 0,!0))),r[c]=!0})),e.on("readable",y.bind(null,r)),r}}).call(this)}).call(this,e("_process"))},{"./end-of-stream":30,_process:11}],28:[function(e,t,r){"use strict";function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){for(var r=0;r0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return a.alloc(0);for(var t,r,n,i=a.allocUnsafe(e>>>0),o=this.head,s=0;o;)t=o.data,r=i,n=s,a.prototype.copy.call(t,r,n),s+=o.data.length,o=o.next;return i}},{key:"consume",value:function(e,t){var r;return ei.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0==(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=a.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0==(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,t}},{key:u,value:function(e,t){return s(this,function(e){for(var t=1;t0,(function(e){n||(n=e),e&&a.forEach(c),o||(a.forEach(c),i(n))}))}));return t.reduce(l)}},{"../../../errors":21,"./end-of-stream":30}],33:[function(e,t,r){"use strict";var n=e("../../../errors").codes.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(e,t,r,i){var o=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,i,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new n(i?r:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}},{"../../../errors":21}],34:[function(e,t,r){t.exports=e("events").EventEmitter},{events:6}],35:[function(e,t,r){(r=t.exports=e("./lib/_stream_readable.js")).Stream=r,r.Readable=r,r.Writable=e("./lib/_stream_writable.js"),r.Duplex=e("./lib/_stream_duplex.js"),r.Transform=e("./lib/_stream_transform.js"),r.PassThrough=e("./lib/_stream_passthrough.js"),r.finished=e("./lib/internal/streams/end-of-stream.js"),r.pipeline=e("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":22,"./lib/_stream_passthrough.js":23,"./lib/_stream_readable.js":24,"./lib/_stream_transform.js":25,"./lib/_stream_writable.js":26,"./lib/internal/streams/end-of-stream.js":30,"./lib/internal/streams/pipeline.js":32}],36:[function(e,t,r){"use strict";var n=e("safe-buffer").Buffer,i=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=u,this.end=c,t=4;break;case"utf8":this.fillLast=s,t=4;break;case"base64":this.text=l,this.end=h,t=3;break;default:return this.write=f,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function a(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function s(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function u(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function c(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function l(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function h(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function f(e){return e.toString(this.encoding)}function d(e){return e&&e.length?this.write(e):""}r.StringDecoder=o,o.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0)return i>0&&(e.lastNeed=i-1),i;if(--n=0)return i>0&&(e.lastNeed=i-2),i;if(--n=0)return i>0&&(2===i?i=0:e.lastNeed=i-3),i;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},{"safe-buffer":16}],37:[function(e,t,r){"use strict";var n=e("punycode"),i=e("./util");function o(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}r.parse=b,r.resolve=function(e,t){return b(e,!1,!0).resolve(t)},r.resolveObject=function(e,t){return e?b(e,!1,!0).resolveObject(t):t},r.format=function(e){i.isString(e)&&(e=b(e));return e instanceof o?e.format():o.prototype.format.call(e)},r.Url=o;var a=/^([a-z0-9.+-]+:)/i,s=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,c=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),l=["'"].concat(c),h=["%","/","?",";","#"].concat(l),f=["/","?","#"],d=/^[+a-z0-9A-Z_-]{0,63}$/,p=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,y={javascript:!0,"javascript:":!0},g={javascript:!0,"javascript:":!0},v={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},m=e("querystring");function b(e,t,r){if(e&&i.isObject(e)&&e instanceof o)return e;var n=new o;return n.parse(e,t,r),n}o.prototype.parse=function(e,t,r){if(!i.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var o=e.indexOf("?"),s=-1!==o&&o127?L+="x":L+=j[I];if(!L.match(d)){var N=M.slice(0,x),U=M.slice(x+1),B=j.match(p);B&&(N.push(B[1]),U.unshift(B[2])),U.length&&(b="/"+U.join(".")+b),this.hostname=N.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),C||(this.hostname=n.toASCII(this.hostname));var D=this.port?":"+this.port:"",q=this.hostname||"";this.host=q+D,this.href+=this.host,C&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!y[S])for(x=0,T=l.length;x0)&&r.host.split("@"))&&(r.auth=C.shift(),r.host=r.hostname=C.shift());return r.search=e.search,r.query=e.query,i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!E.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var A=E.slice(-1)[0],O=(r.host||e.host||E.length>1)&&("."===A||".."===A)||""===A,x=0,R=E.length;R>=0;R--)"."===(A=E[R])?E.splice(R,1):".."===A?(E.splice(R,1),x++):x&&(E.splice(R,1),x--);if(!_&&!S)for(;x--;x)E.unshift("..");!_||""===E[0]||E[0]&&"/"===E[0].charAt(0)||E.unshift(""),O&&"/"!==E.join("/").substr(-1)&&E.push("");var C,M=""===E[0]||E[0]&&"/"===E[0].charAt(0);k&&(r.hostname=r.host=M?"":E.length?E.shift():"",(C=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=C.shift(),r.host=r.hostname=C.shift()));return(_=_||r.host&&E.length)&&!M&&E.unshift(""),E.length?r.pathname=E.join("/"):(r.pathname=null,r.path=null),i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},o.prototype.parseHost=function(){var e=this.host,t=s.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},{"./util":38,punycode:12,querystring:15}],38:[function(e,t,r){"use strict";t.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},{}],39:[function(e,t,r){(function(e){(function(){function r(t){try{if(!e.localStorage)return!1}catch(e){return!1}var r=e.localStorage[t];return null!=r&&"true"===String(r).toLowerCase()}t.exports=function(e,t){if(r("noDeprecation"))return e;var n=!1;return function(){if(!n){if(r("throwDeprecation"))throw new Error(t);r("traceDeprecation")?console.trace(t):console.warn(t),n=!0}return e.apply(this,arguments)}}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],40:[function(e,t,r){t.exports=function(){for(var e={},t=0;t0)return this.client.emit("updateAvalible",e),Promise.all(e.map((async e=>{let t=Object.values(JSON.parse(await(0,a.fetch)(i.data[e]))||[]);this.client.set(e,t),o.default.writeFileSync(i.local[e],JSON.stringify(t))})))}start(){this.cron||this.client.emit("debug","Notify for new data updates enabled. AzurAPI Client will check for data updates every hour."),this.cron&&clearInterval(this.cron),this.cron=setInterval((()=>this.update()),this.client.rate)}stop(){this.cron&&clearInterval(this.cron),this.cron=void 0}async init(){o.default.existsSync(i.baseFolder)||o.default.mkdirSync(i.baseFolder),await this.load(),this.client.emit("ready")}load(){for(let e=0;ea.default.get(e,(e=>{let r="";e.on("data",(e=>r+=e)),e.on("end",(()=>t(r)))})).on("error",(e=>r(e)))))}r.check=async function(){!u&&o.default.existsSync(i.versionInfo)&&(u=JSON.parse(o.default.readFileSync(i.versionInfo).toString())),c=JSON.parse(await l(i.data.version));let e=[];for(let t of s)u&&u[t]&&c[t]["version-number"]===u[t]["version-number"]||e.push(t);return e},r.save=function(){c&&o.default.writeFileSync(i.versionInfo,JSON.stringify(u=c))},r.fetch=l},{"./Data":43,fs:3,https:7}],45:[function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.normalize=r.NATIONS=void 0;const i=n(e("fuse.js"));r.NATIONS={"Eagle Union":["uss","eagle union"],"Royal Navy":["hms","royal navy"],"Sakura Empire":["ijn","sakura empire"],"Iron Blood":["kms","iron blood"],"Dragon Empery":["pran","dragon empery"],"Northern Parliament":["sn","northern parliament"],"Iris Libre":["ffnf","iris libre"],"Vichya Domination":["mnf","vichya domination"],"Sardenga Empire":["rn","sardegna empire"],Neptunia:["hdn","neptunia"],Bilibili:["bili","bilibili"],"Venus Vacation":["venus","venus vacation"],Utawarerumono:["utawarerumono"],"Kizuna AI":["kizunaai","kizuna ai"],Hololive:["hololive"],META:["meta"],Universal:["universal","univ"]};r.default=class{raw;fuse;client;constructor(e,t){this.raw=[],t&&(this.fuse=new i.default(this.raw,{keys:t,threshold:.4})),this.client=e}setData(e){(new Error).stack.match(/AzurAPI\.set/)&&(this.raw.splice(0,this.raw.length,...e),this.fuse&&this.fuse.setCollection(this.raw))}fuze(e){return this.fuse?this.fuse.search(e,{limit:10}).sort(((e,t)=>(t.score||0)-(e.score||0))):[]}id(e){for(let t of this.raw)if(a(t.id.toUpperCase())===a(e.toUpperCase()))return t}get(e){return this.id(e)||this.fuze(e)?.map((e=>e.item))[0]}filter(e){return this.raw.filter(e)}map(e){return this.raw.map(e)}forEach(e){return this.raw.forEach(e)}every(e){return this.raw.every(e)}some(e){return this.raw.some(e)}};const o=/[\u0300-\u036F]/g;function a(e){return e.normalize("NFKD").replace(o,"")}r.normalize=a},{"fuse.js":52}],46:[function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(r,"__esModule",{value:!0}),r.Barrages=void 0;const a=o(e("./api"));class s extends a.default{constructor(e){super(e,["id","name"])}name(e){for(let t of this.raw)if((0,a.normalize)(t.name.toUpperCase())===(0,a.normalize)(e.toUpperCase()))return t}type(e){return this.raw.filter((t=>(0,a.normalize)(t.type.toUpperCase())===(0,a.normalize)(e.toUpperCase())))}hull(e){return this.raw.filter((t=>(0,a.normalize)(t.hull.toUpperCase())===(0,a.normalize)(e.toUpperCase())))}ships(e){return this.raw.filter((t=>t.ships.map((e=>(0,a.normalize)(e.toUpperCase()))).includes((0,a.normalize)(e.toUpperCase()))))}}r.Barrages=s},{"./api":45}],47:[function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(r,"__esModule",{value:!0}),r.Chapters=void 0;const a=o(e("./api"));class s extends a.default{constructor(e){super(e)}name(e,t=["en","cn","jp"]){for(let r of this.raw)if(t.some((t=>r.names[t]&&(0,a.normalize)(r.names[t].toUpperCase())===(0,a.normalize)(e.toUpperCase()))))return r}}r.Chapters=s},{"./api":45}],48:[function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(r,"__esModule",{value:!0}),r.Equipments=void 0;const a=o(e("./api"));class s extends a.default{constructor(e){super(e,["names.en","names.cn","names.jp","names.kr","names.code","id"])}name(e,t=["en","cn","jp","kr"]){for(let r of this.raw)if(t.some((t=>r.names[t]&&(0,a.normalize)(r.names[t].toUpperCase())===(0,a.normalize)(e.toUpperCase()))))return r}category(e){let t=[];for(let r of this.raw)(0,a.normalize)(r.category.toUpperCase()===(0,a.normalize)(e.toUpperCase()))&&t.push(r);return t}nationality(e){let t=[];e=Object.keys(a.NATIONS).find((t=>a.NATIONS[t].includes(e.toLowerCase())))||e;for(let r of this.raw)(0,a.normalize)(r.nationality.toUpperCase())===(0,a.normalize)(e.toUpperCase())&&t.push(r);return t}_nameAll(e,t=["en","cn","jp","kr"]){return this.raw.filter((r=>t.some((t=>r.names[t]&&(0,a.normalize)(r.names[t].toUpperCase())===(0,a.normalize)(e.toUpperCase())))))}get(e,t){if(!t){let t=this.fuze(e).sort(((e,t)=>(t.score||0)-(e.score||0)))[0];return this.id(e)||this.name(e)||(t?t.item:void 0)}return t.idOnly?this.id(e):t.nameOnly||t.nameOnly&&!t.language?this.name(e):t.nameOnly&&t.language?this.name(e,[t.language]):void 0}all(e){let t=[];return t.push(this.id(e)),t.push(...this._nameAll(e).filter((e=>e))),t.push(...this.fuze(e).map((e=>e.item))),t.filter((e=>null!=e)).filter(((e,t,r)=>t===r.findIndex((t=>t.id===e.id))))}}r.Equipments=s},{"./api":45}],49:[function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(r,"__esModule",{value:!0}),r.Ships=void 0;const a=o(e("./api"));class s extends a.default{constructor(e){super(e,["names.en","names.cn","names.jp","names.kr","names.code","id"])}name(e,t=["en","cn","jp","kr"]){for(let r of this.raw)if(t.some((t=>r.names[t]&&(0,a.normalize)(r.names[t].toUpperCase())===(0,a.normalize)(e.toUpperCase()))))return r}hull(e){return this.raw.filter((t=>t.hullType&&(0,a.normalize)(t.hullType.toUpperCase())===(0,a.normalize)(e.toUpperCase())||t.retrofitHullType&&(0,a.normalize)(t.retrofitHullType.toUpperCase())===(0,a.normalize)(e.toUpperCase())))}nationality(e){let t=[];e=Object.keys(a.NATIONS).find((t=>a.NATIONS[t].includes(e.toLowerCase())))||e;for(let r of this.raw)(0,a.normalize)(r.nationality.toUpperCase())===(0,a.normalize)(e.toUpperCase())&&t.push(r);return t}_nameAll(e,t=["en","cn","jp","kr"]){return this.raw.filter((r=>t.some((t=>r.names[t]&&(0,a.normalize)(r.names[t].toUpperCase())===(0,a.normalize)(e.toUpperCase())))))}get(e,t){if(!t){let t=this.fuze(e).sort(((e,t)=>(t.score||0)-(e.score||0)))[0];return this.id(e)||this.name(e)||(t?t.item:void 0)}return t.idOnly?this.id(e):t.nameOnly||t.nameOnly&&!t.language?this.name(e):t.nameOnly&&t.language?this.name(e,[t.language]):void 0}all(e){let t=[];return t.push(this.id(e)),t.push(...this._nameAll(e).filter((e=>e))),t.push(...this.fuze(e).map((e=>e.item))),t.filter((e=>null!=e)).filter(((e,t,r)=>t===r.findIndex((t=>t.id===e.id))))}}r.Ships=s},{"./api":45}],50:[function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.Voicelines=void 0;const i=n(e("./api"));class o extends i.default{constructor(e){super(e)}}r.Voicelines=o},{"./api":45}],51:[function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(r,"__esModule",{value:!0}),i(e("./core/Client"),r)},{"./core/Client":42}],52:[function(e,t,r){"use strict";function n(e){return n="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},n(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&void 0!==arguments[0]?arguments[0]:3,t=new Map,r=Math.pow(10,e);return{get:function(e){var n=e.match(L).length;if(t.has(n))return t.get(n);var i=1/Math.sqrt(n),o=parseFloat(Math.round(i*r)/r);return t.set(n,o),o},clear:function(){t.clear()}}}var P=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.getFn,n=void 0===r?j.getFn:r;i(this,e),this.norm=I(3),this.getFn=n,this.isCreated=!1,this.setIndexRecords()}return a(e,[{key:"setSources",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.docs=e}},{key:"setIndexRecords",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.records=e}},{key:"setKeys",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.keys=t,this._keysMap={},t.forEach((function(t,r){e._keysMap[t.id]=r}))}},{key:"create",value:function(){var e=this;!this.isCreated&&this.docs.length&&(this.isCreated=!0,m(this.docs[0])?this.docs.forEach((function(t,r){e._addString(t,r)})):this.docs.forEach((function(t,r){e._addObject(t,r)})),this.norm.clear())}},{key:"add",value:function(e){var t=this.size();m(e)?this._addString(e,t):this._addObject(e,t)}},{key:"removeAt",value:function(e){this.records.splice(e,1);for(var t=e,r=this.size();t2&&void 0!==arguments[2]?arguments[2]:{},n=r.getFn,i=void 0===n?j.getFn:n,o=new P({getFn:i});return o.setKeys(e.map(C)),o.setSources(t),o.create(),o}function U(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.errors,n=void 0===r?0:r,i=t.currentLocation,o=void 0===i?0:i,a=t.expectedLocation,s=void 0===a?0:a,u=t.distance,c=void 0===u?j.distance:u,l=t.ignoreLocation,h=void 0===l?j.ignoreLocation:l,f=n/e.length;if(h)return f;var d=Math.abs(s-o);return c?f+d/c:d?1:f}function B(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:j.minMatchCharLength,r=[],n=-1,i=-1,o=0,a=e.length;o=t&&r.push([n,i]),n=-1)}return e[o-1]&&o-n>=t&&r.push([n,o-1]),r}var D=32;function q(e){for(var t={},r=0,n=e.length;r1&&void 0!==arguments[1]?arguments[1]:{},o=n.location,a=void 0===o?j.location:o,s=n.threshold,u=void 0===s?j.threshold:s,c=n.distance,l=void 0===c?j.distance:c,h=n.includeMatches,f=void 0===h?j.includeMatches:h,d=n.findAllMatches,p=void 0===d?j.findAllMatches:d,y=n.minMatchCharLength,g=void 0===y?j.minMatchCharLength:y,v=n.isCaseSensitive,m=void 0===v?j.isCaseSensitive:v,b=n.ignoreLocation,w=void 0===b?j.ignoreLocation:b;if(i(this,e),this.options={location:a,threshold:u,distance:l,includeMatches:f,findAllMatches:p,minMatchCharLength:g,isCaseSensitive:m,ignoreLocation:w},this.pattern=m?t:t.toLowerCase(),this.chunks=[],this.pattern.length){var _=function(e,t){r.chunks.push({pattern:e,alphabet:q(e),startIndex:t})},S=this.pattern.length;if(S>D){for(var E=0,k=S%D,A=S-k;E3&&void 0!==arguments[3]?arguments[3]:{},i=n.location,o=void 0===i?j.location:i,a=n.distance,s=void 0===a?j.distance:a,u=n.threshold,c=void 0===u?j.threshold:u,l=n.findAllMatches,h=void 0===l?j.findAllMatches:l,f=n.minMatchCharLength,d=void 0===f?j.minMatchCharLength:f,p=n.includeMatches,y=void 0===p?j.includeMatches:p,g=n.ignoreLocation,v=void 0===g?j.ignoreLocation:g;if(t.length>D)throw new Error(O(D));for(var m,b=t.length,w=e.length,_=Math.max(0,Math.min(o,w)),S=c,E=_,k=d>1||y,A=k?Array(w):[];(m=e.indexOf(t,E))>-1;){var x=U(t,{currentLocation:m,expectedLocation:_,distance:s,ignoreLocation:v});if(S=Math.min(x,S),E=m+b,k)for(var R=0;R=q;H-=1){var W=H-1,$=r[e.charAt(W)];if(k&&(A[W]=+!!$),F[H]=(F[H+1]<<1|1)&$,I&&(F[H]|=(C[H+1]|C[H])<<1|1|C[H+1]),F[H]&L&&(M=U(t,{errors:I,currentLocation:W,expectedLocation:_,distance:s,ignoreLocation:v}))<=S){if(S=M,(E=W)<=_)break;q=Math.max(1,2*_-E)}}if(U(t,{errors:I+1,currentLocation:_,expectedLocation:_,distance:s,ignoreLocation:v})>S)break;C=F}var V={isMatch:E>=0,score:Math.max(.001,M)};if(k){var K=B(A,d);K.length?y&&(V.indices=K):V.isMatch=!1}return V}(e,r,i,{location:a+o,distance:s,threshold:u,findAllMatches:c,minMatchCharLength:l,includeMatches:n,ignoreLocation:h}),v=g.isMatch,m=g.score,b=g.indices;v&&(p=!0),d+=m,v&&b&&(f=[].concat(y(f),y(b)))}));var g={isMatch:p,score:p?d/this.chunks.length:1};return p&&n&&(g.indices=f),g}}]),e}(),F=function(){function e(t){i(this,e),this.pattern=t}return a(e,[{key:"search",value:function(){}}],[{key:"isMultiMatch",value:function(e){return H(e,this.multiRegex)}},{key:"isSingleMatch",value:function(e){return H(e,this.singleRegex)}}]),e}();function H(e,t){var r=e.match(t);return r?r[1]:null}var W=function(e){l(r,e);var t=p(r);function r(e){return i(this,r),t.call(this,e)}return a(r,[{key:"search",value:function(e){var t=e===this.pattern;return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}}],[{key:"type",get:function(){return"exact"}},{key:"multiRegex",get:function(){return/^="(.*)"$/}},{key:"singleRegex",get:function(){return/^=(.*)$/}}]),r}(F),$=function(e){l(r,e);var t=p(r);function r(e){return i(this,r),t.call(this,e)}return a(r,[{key:"search",value:function(e){var t=-1===e.indexOf(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}],[{key:"type",get:function(){return"inverse-exact"}},{key:"multiRegex",get:function(){return/^!"(.*)"$/}},{key:"singleRegex",get:function(){return/^!(.*)$/}}]),r}(F),V=function(e){l(r,e);var t=p(r);function r(e){return i(this,r),t.call(this,e)}return a(r,[{key:"search",value:function(e){var t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}}],[{key:"type",get:function(){return"prefix-exact"}},{key:"multiRegex",get:function(){return/^\^"(.*)"$/}},{key:"singleRegex",get:function(){return/^\^(.*)$/}}]),r}(F),K=function(e){l(r,e);var t=p(r);function r(e){return i(this,r),t.call(this,e)}return a(r,[{key:"search",value:function(e){var t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}],[{key:"type",get:function(){return"inverse-prefix-exact"}},{key:"multiRegex",get:function(){return/^!\^"(.*)"$/}},{key:"singleRegex",get:function(){return/^!\^(.*)$/}}]),r}(F),G=function(e){l(r,e);var t=p(r);function r(e){return i(this,r),t.call(this,e)}return a(r,[{key:"search",value:function(e){var t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}}],[{key:"type",get:function(){return"suffix-exact"}},{key:"multiRegex",get:function(){return/^"(.*)"\$$/}},{key:"singleRegex",get:function(){return/^(.*)\$$/}}]),r}(F),Y=function(e){l(r,e);var t=p(r);function r(e){return i(this,r),t.call(this,e)}return a(r,[{key:"search",value:function(e){var t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}],[{key:"type",get:function(){return"inverse-suffix-exact"}},{key:"multiRegex",get:function(){return/^!"(.*)"\$$/}},{key:"singleRegex",get:function(){return/^!(.*)\$$/}}]),r}(F),X=function(e){l(r,e);var t=p(r);function r(e){var n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=o.location,s=void 0===a?j.location:a,u=o.threshold,c=void 0===u?j.threshold:u,l=o.distance,h=void 0===l?j.distance:l,f=o.includeMatches,d=void 0===f?j.includeMatches:f,p=o.findAllMatches,y=void 0===p?j.findAllMatches:p,g=o.minMatchCharLength,v=void 0===g?j.minMatchCharLength:g,m=o.isCaseSensitive,b=void 0===m?j.isCaseSensitive:m,w=o.ignoreLocation,_=void 0===w?j.ignoreLocation:w;return i(this,r),(n=t.call(this,e))._bitapSearch=new z(e,{location:s,threshold:c,distance:h,includeMatches:d,findAllMatches:y,minMatchCharLength:v,isCaseSensitive:b,ignoreLocation:_}),n}return a(r,[{key:"search",value:function(e){return this._bitapSearch.searchIn(e)}}],[{key:"type",get:function(){return"fuzzy"}},{key:"multiRegex",get:function(){return/^"(.*)"$/}},{key:"singleRegex",get:function(){return/^(.*)$/}}]),r}(F),J=function(e){l(r,e);var t=p(r);function r(e){return i(this,r),t.call(this,e)}return a(r,[{key:"search",value:function(e){for(var t,r=0,n=[],i=this.pattern.length;(t=e.indexOf(this.pattern,r))>-1;)r=t+i,n.push([t,r-1]);var o=!!n.length;return{isMatch:o,score:o?0:1,indices:n}}}],[{key:"type",get:function(){return"include"}},{key:"multiRegex",get:function(){return/^'"(.*)"$/}},{key:"singleRegex",get:function(){return/^'(.*)$/}}]),r}(F),Z=[W,J,V,K,Y,G,$,X],Q=Z.length,ee=/ +(?=([^\"]*\"[^\"]*\")*[^\"]*$)/;function te(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.split("|").map((function(e){for(var r=e.trim().split(ee).filter((function(e){return e&&!!e.trim()})),n=[],i=0,o=r.length;i1&&void 0!==arguments[1]?arguments[1]:{},n=r.isCaseSensitive,o=void 0===n?j.isCaseSensitive:n,a=r.includeMatches,s=void 0===a?j.includeMatches:a,u=r.minMatchCharLength,c=void 0===u?j.minMatchCharLength:u,l=r.ignoreLocation,h=void 0===l?j.ignoreLocation:l,f=r.findAllMatches,d=void 0===f?j.findAllMatches:f,p=r.location,y=void 0===p?j.location:p,g=r.threshold,v=void 0===g?j.threshold:g,m=r.distance,b=void 0===m?j.distance:m;i(this,e),this.query=null,this.options={isCaseSensitive:o,includeMatches:s,minMatchCharLength:c,findAllMatches:d,ignoreLocation:h,location:y,threshold:v,distance:b},this.pattern=o?t:t.toLowerCase(),this.query=te(this.pattern,this.options)}return a(e,[{key:"searchIn",value:function(e){var t=this.query;if(!t)return{isMatch:!1,score:1};var r=this.options,n=r.includeMatches;e=r.isCaseSensitive?e:e.toLowerCase();for(var i=0,o=[],a=0,s=0,u=t.length;s2&&void 0!==arguments[2]?arguments[2]:{},n=r.auto,i=void 0===n||n,o=function e(r){var n=Object.keys(r),o=he(r);if(!o&&n.length>1&&!le(r))return e(de(r));if(fe(r)){var a=o?r[ue]:n[0],s=o?r[ce]:r[a];if(!m(s))throw new Error(A(a));var u={keyId:T(a),pattern:s};return i&&(u.searcher=oe(s,t)),u}var c={children:[],operator:n[0]};return n.forEach((function(t){var n=r[t];v(n)&&n.forEach((function(t){c.children.push(e(t))}))})),c};return le(e)||(e=de(e)),o(e)}function ye(e,t){var r=t.ignoreFieldNorm,n=void 0===r?j.ignoreFieldNorm:r;e.forEach((function(e){var t=1;e.matches.forEach((function(e){var r=e.key,i=e.norm,o=e.score,a=r?r.weight:null;t*=Math.pow(0===o&&a?Number.EPSILON:o,(a||1)*(n?1:i))})),e.score=t}))}function ge(e,t){var r=e.matches;t.matches=[],S(r)&&r.forEach((function(e){if(S(e.indices)&&e.indices.length){var r={indices:e.indices,value:e.value};e.key&&(r.key=e.key.src),e.idx>-1&&(r.refIndex=e.idx),t.matches.push(r)}}))}function ve(e,t){t.score=e.score}function me(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r.includeMatches,i=void 0===n?j.includeMatches:n,o=r.includeScore,a=void 0===o?j.includeScore:o,s=[];return i&&s.push(ge),a&&s.push(ve),e.map((function(e){var r=e.idx,n={item:t[r],refIndex:r};return s.length&&s.forEach((function(t){t(e,n)})),n}))}var be=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;i(this,e),this.options=c({},j,{},r),this.options.useExtendedSearch,this._keyStore=new R(this.options.keys),this.setCollection(t,n)}return a(e,[{key:"setCollection",value:function(e,t){if(this._docs=e,t&&!(t instanceof P))throw new Error("Incorrect 'index' type");this._myIndex=t||N(this.options.keys,this._docs,{getFn:this.options.getFn})}},{key:"add",value:function(e){S(e)&&(this._docs.push(e),this._myIndex.add(e))}},{key:"remove",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){return!1},t=[],r=0,n=this._docs.length;r1&&void 0!==arguments[1]?arguments[1]:{},r=t.limit,n=void 0===r?-1:r,i=this.options,o=i.includeMatches,a=i.includeScore,s=i.shouldSort,u=i.sortFn,c=i.ignoreFieldNorm,l=m(e)?m(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return ye(l,{ignoreFieldNorm:c}),s&&l.sort(u),b(n)&&n>-1&&(l=l.slice(0,n)),me(l,this._docs,{includeMatches:o,includeScore:a})}},{key:"_searchStringList",value:function(e){var t=oe(e,this.options),r=this._myIndex.records,n=[];return r.forEach((function(e){var r=e.v,i=e.i,o=e.n;if(S(r)){var a=t.searchIn(r),s=a.isMatch,u=a.score,c=a.indices;s&&n.push({item:r,idx:i,matches:[{score:u,value:r,norm:o,indices:c}]})}})),n}},{key:"_searchLogical",value:function(e){var t=this,r=pe(e,this.options),n=function e(r,n,i){if(!r.children){var o=r.keyId,a=r.searcher,s=t._findMatches({key:t._keyStore.get(o),value:t._myIndex.getValueForItemAtKeyId(n,o),searcher:a});return s&&s.length?[{idx:i,item:n,matches:s}]:[]}switch(r.operator){case ae:for(var u=[],c=0,l=r.children.length;c1&&void 0!==arguments[1]?arguments[1]:{},r=t.getFn,n=void 0===r?j.getFn:r,i=e.keys,o=e.records,a=new P({getFn:n});return a.setKeys(i),a.setIndexRecords(o),a},be.config=j,be.parseQuery=pe,function(){ie.push.apply(ie,arguments)}(ne),t.exports=be},{}]},{},[51])(51)})); \ No newline at end of file +var n=e("buffer"),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=n:(o(n,r),r.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},s.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},{buffer:4}],17:[function(e,t,r){(function(t){(function(){var n=e("./lib/request"),i=e("./lib/response"),o=e("xtend"),s=e("builtin-status-codes"),a=e("url"),u=r;u.request=function(e,r){e="string"==typeof e?a.parse(e):o(e);var i=-1===t.location.protocol.search(/^https?:$/)?"http:":"",s=e.protocol||i,u=e.hostname||e.host,c=e.port,l=e.path||"/";u&&-1!==u.indexOf(":")&&(u="["+u+"]"),e.url=(u?s+"//"+u:"")+(c?":"+c:"")+l,e.method=(e.method||"GET").toUpperCase(),e.headers=e.headers||{};var h=new n(e);return r&&h.on("response",r),h},u.get=function(e,t){var r=u.request(e,t);return r.end(),r},u.ClientRequest=n,u.IncomingMessage=i.IncomingMessage,u.Agent=function(){},u.Agent.defaultMaxSockets=4,u.globalAgent=new u.Agent,u.STATUS_CODES=s,u.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./lib/request":19,"./lib/response":20,"builtin-status-codes":5,url:37,xtend:40}],18:[function(e,t,r){(function(e){(function(){var t;function n(){if(void 0!==t)return t;if(e.XMLHttpRequest){t=new e.XMLHttpRequest;try{t.open("GET",e.XDomainRequest?"/":"https://example.com")}catch(e){t=null}}else t=null;return t}function i(e){var t=n();if(!t)return!1;try{return t.responseType=e,t.responseType===e}catch(e){}return!1}function o(e){return"function"==typeof e}r.fetch=o(e.fetch)&&o(e.ReadableStream),r.writableStream=o(e.WritableStream),r.abortController=o(e.AbortController),r.arraybuffer=r.fetch||i("arraybuffer"),r.msstream=!r.fetch&&i("ms-stream"),r.mozchunkedarraybuffer=!r.fetch&&i("moz-chunked-arraybuffer"),r.overrideMimeType=r.fetch||!!n()&&o(n().overrideMimeType),t=null}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],19:[function(e,t,r){(function(r,n,i){(function(){var o=e("./capability"),s=e("inherits"),a=e("./response"),u=e("readable-stream"),c=a.IncomingMessage,l=a.readyStates;var h=t.exports=function(e){var t,r=this;u.Writable.call(r),r._opts=e,r._body=[],r._headers={},e.auth&&r.setHeader("Authorization","Basic "+i.from(e.auth).toString("base64")),Object.keys(e.headers).forEach((function(t){r.setHeader(t,e.headers[t])}));var n=!0;if("disable-fetch"===e.mode||"requestTimeout"in e&&!o.abortController)n=!1,t=!0;else if("prefer-streaming"===e.mode)t=!1;else if("allow-wrong-content-type"===e.mode)t=!o.overrideMimeType;else{if(e.mode&&"default"!==e.mode&&"prefer-fast"!==e.mode)throw new Error("Invalid value for opts.mode");t=!0}r._mode=function(e,t){return o.fetch&&t?"fetch":o.mozchunkedarraybuffer?"moz-chunked-arraybuffer":o.msstream?"ms-stream":o.arraybuffer&&e?"arraybuffer":"text"}(t,n),r._fetchTimer=null,r._socketTimeout=null,r._socketTimer=null,r.on("finish",(function(){r._onFinish()}))};s(h,u.Writable),h.prototype.setHeader=function(e,t){var r=e.toLowerCase();-1===f.indexOf(r)&&(this._headers[r]={name:e,value:t})},h.prototype.getHeader=function(e){var t=this._headers[e.toLowerCase()];return t?t.value:null},h.prototype.removeHeader=function(e){delete this._headers[e.toLowerCase()]},h.prototype._onFinish=function(){var e=this;if(!e._destroyed){var t=e._opts;"timeout"in t&&0!==t.timeout&&e.setTimeout(t.timeout);var i=e._headers,s=null;"GET"!==t.method&&"HEAD"!==t.method&&(s=new Blob(e._body,{type:(i["content-type"]||{}).value||""}));var a=[];if(Object.keys(i).forEach((function(e){var t=i[e].name,r=i[e].value;Array.isArray(r)?r.forEach((function(e){a.push([t,e])})):a.push([t,r])})),"fetch"===e._mode){var u=null;if(o.abortController){var c=new AbortController;u=c.signal,e._fetchAbortController=c,"requestTimeout"in t&&0!==t.requestTimeout&&(e._fetchTimer=n.setTimeout((function(){e.emit("requestTimeout"),e._fetchAbortController&&e._fetchAbortController.abort()}),t.requestTimeout))}n.fetch(e._opts.url,{method:e._opts.method,headers:a,body:s||void 0,mode:"cors",credentials:t.withCredentials?"include":"same-origin",signal:u}).then((function(t){e._fetchResponse=t,e._resetTimers(!1),e._connect()}),(function(t){e._resetTimers(!0),e._destroyed||e.emit("error",t)}))}else{var h=e._xhr=new n.XMLHttpRequest;try{h.open(e._opts.method,e._opts.url,!0)}catch(t){return void r.nextTick((function(){e.emit("error",t)}))}"responseType"in h&&(h.responseType=e._mode),"withCredentials"in h&&(h.withCredentials=!!t.withCredentials),"text"===e._mode&&"overrideMimeType"in h&&h.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in t&&(h.timeout=t.requestTimeout,h.ontimeout=function(){e.emit("requestTimeout")}),a.forEach((function(e){h.setRequestHeader(e[0],e[1])})),e._response=null,h.onreadystatechange=function(){switch(h.readyState){case l.LOADING:case l.DONE:e._onXHRProgress()}},"moz-chunked-arraybuffer"===e._mode&&(h.onprogress=function(){e._onXHRProgress()}),h.onerror=function(){e._destroyed||(e._resetTimers(!0),e.emit("error",new Error("XHR error")))};try{h.send(s)}catch(t){return void r.nextTick((function(){e.emit("error",t)}))}}}},h.prototype._onXHRProgress=function(){var e=this;e._resetTimers(!1),function(e){try{var t=e.status;return null!==t&&0!==t}catch(e){return!1}}(e._xhr)&&!e._destroyed&&(e._response||e._connect(),e._response._onXHRProgress(e._resetTimers.bind(e)))},h.prototype._connect=function(){var e=this;e._destroyed||(e._response=new c(e._xhr,e._fetchResponse,e._mode,e._resetTimers.bind(e)),e._response.on("error",(function(t){e.emit("error",t)})),e.emit("response",e._response))},h.prototype._write=function(e,t,r){this._body.push(e),r()},h.prototype._resetTimers=function(e){var t=this;n.clearTimeout(t._socketTimer),t._socketTimer=null,e?(n.clearTimeout(t._fetchTimer),t._fetchTimer=null):t._socketTimeout&&(t._socketTimer=n.setTimeout((function(){t.emit("timeout")}),t._socketTimeout))},h.prototype.abort=h.prototype.destroy=function(e){var t=this;t._destroyed=!0,t._resetTimers(!0),t._response&&(t._response._destroyed=!0),t._xhr?t._xhr.abort():t._fetchAbortController&&t._fetchAbortController.abort(),e&&t.emit("error",e)},h.prototype.end=function(e,t,r){"function"==typeof e&&(r=e,e=void 0),u.Writable.prototype.end.call(this,e,t,r)},h.prototype.setTimeout=function(e,t){var r=this;t&&r.once("timeout",t),r._socketTimeout=e,r._resetTimers(!1)},h.prototype.flushHeaders=function(){},h.prototype.setNoDelay=function(){},h.prototype.setSocketKeepAlive=function(){};var f=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"]}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer)},{"./capability":18,"./response":20,_process:11,buffer:4,inherits:9,"readable-stream":35}],20:[function(e,t,r){(function(t,n,i){(function(){var o=e("./capability"),s=e("inherits"),a=e("readable-stream"),u=r.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},c=r.IncomingMessage=function(e,r,n,s){var u=this;if(a.Readable.call(u),u._mode=n,u.headers={},u.rawHeaders=[],u.trailers={},u.rawTrailers=[],u.on("end",(function(){t.nextTick((function(){u.emit("close")}))})),"fetch"===n){if(u._fetchResponse=r,u.url=r.url,u.statusCode=r.status,u.statusMessage=r.statusText,r.headers.forEach((function(e,t){u.headers[t.toLowerCase()]=e,u.rawHeaders.push(t,e)})),o.writableStream){var c=new WritableStream({write:function(e){return s(!1),new Promise((function(t,r){u._destroyed?r():u.push(i.from(e))?t():u._resumeFetch=t}))},close:function(){s(!0),u._destroyed||u.push(null)},abort:function(e){s(!0),u._destroyed||u.emit("error",e)}});try{return void r.body.pipeTo(c).catch((function(e){s(!0),u._destroyed||u.emit("error",e)}))}catch(e){}}var l=r.body.getReader();!function e(){l.read().then((function(t){u._destroyed||(s(t.done),t.done?u.push(null):(u.push(i.from(t.value)),e()))})).catch((function(e){s(!0),u._destroyed||u.emit("error",e)}))}()}else{if(u._xhr=e,u._pos=0,u.url=e.responseURL,u.statusCode=e.status,u.statusMessage=e.statusText,e.getAllResponseHeaders().split(/\r?\n/).forEach((function(e){var t=e.match(/^([^:]+):\s*(.*)/);if(t){var r=t[1].toLowerCase();"set-cookie"===r?(void 0===u.headers[r]&&(u.headers[r]=[]),u.headers[r].push(t[2])):void 0!==u.headers[r]?u.headers[r]+=", "+t[2]:u.headers[r]=t[2],u.rawHeaders.push(t[1],t[2])}})),u._charset="x-user-defined",!o.overrideMimeType){var h=u.rawHeaders["mime-type"];if(h){var f=h.match(/;\s*charset=([^;])(;|$)/);f&&(u._charset=f[1].toLowerCase())}u._charset||(u._charset="utf-8")}}};s(c,a.Readable),c.prototype._read=function(){var e=this._resumeFetch;e&&(this._resumeFetch=null,e())},c.prototype._onXHRProgress=function(e){var t=this,r=t._xhr,o=null;switch(t._mode){case"text":if((o=r.responseText).length>t._pos){var s=o.substr(t._pos);if("x-user-defined"===t._charset){for(var a=i.alloc(s.length),c=0;ct._pos&&(t.push(i.from(new Uint8Array(l.result.slice(t._pos)))),t._pos=l.result.byteLength)},l.onload=function(){e(!0),t.push(null)},l.readAsArrayBuffer(o)}t._xhr.readyState===u.DONE&&"ms-stream"!==t._mode&&(e(!0),t.push(null))}}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer)},{"./capability":18,_process:11,buffer:4,inherits:9,"readable-stream":35}],21:[function(e,t,r){"use strict";var n={};function i(e,t,r){r||(r=Error);var i=function(e){var r,n;function i(r,n,i){return e.call(this,function(e,r,n){return"string"==typeof t?t:t(e,r,n)}(r,n,i))||this}return n=e,(r=i).prototype=Object.create(n.prototype),r.prototype.constructor=r,r.__proto__=n,i}(r);i.prototype.name=r.name,i.prototype.code=e,n[e]=i}function o(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}i("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),i("ERR_INVALID_ARG_TYPE",(function(e,t,r){var n,i,s,a;if("string"==typeof t&&(i="not ",t.substr(!s||s<0?0:+s,i.length)===i)?(n="must not be",t=t.replace(/^not /,"")):n="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))a="The ".concat(e," ").concat(n," ").concat(o(t,"type"));else{var u=function(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}(e,".")?"property":"argument";a='The "'.concat(e,'" ').concat(u," ").concat(n," ").concat(o(t,"type"))}return a+=". Received type ".concat(typeof r)}),TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},{}],22:[function(e,t,r){(function(r){(function(){"use strict";var n=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};t.exports=c;var i=e("./_stream_readable"),o=e("./_stream_writable");e("inherits")(c,i);for(var s=n(o.prototype),a=0;a0)if("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===a.prototype||(t=function(e){return a.from(e)}(t)),n)s.endEmitted?S(e,new _):O(e,s,t,!0);else if(s.ended)S(e,new b);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||0!==t.length?O(e,s,t,!1):j(e,s)):O(e,s,t,!1)}else n||(s.reading=!1,j(e,s));return!s.ended&&(s.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=R?e=R:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function C(e){var t=e._readableState;c("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(c("emitReadable",t.flowing),t.emittedReadable=!0,r.nextTick(T,e))}function T(e){var t=e._readableState;c("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,U(e)}function j(e,t){t.readingMore||(t.readingMore=!0,r.nextTick(L,e,t))}function L(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function P(e){c("readable nexttick read 0"),e.read(0)}function N(e,t){c("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),U(e),t.flowing&&!t.reading&&e.read(0)}function U(e){var t=e._readableState;for(c("flow",t.flowing);t.flowing&&null!==e.read(););}function B(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function D(e){var t=e._readableState;c("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,r.nextTick(q,t,e))}function q(e,t){if(c("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function z(e,t){for(var r=0,n=e.length;r=t.highWaterMark:t.length>0)||t.ended))return c("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?D(this):C(this),null;if(0===(e=M(e,t))&&t.ended)return 0===t.length&&D(this),null;var n,i=t.needReadable;return c("need readable",i),(0===t.length||t.length-e0?B(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&D(this)),null!==n&&this.emit("data",n),n},A.prototype._read=function(e){S(this,new w("_read()"))},A.prototype.pipe=function(e,t){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e)}i.pipesCount+=1,c("pipe count=%d opts=%j",i.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr?u:g;function a(t,r){c("onunpipe"),t===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,c("cleanup"),e.removeListener("close",p),e.removeListener("finish",y),e.removeListener("drain",l),e.removeListener("error",d),e.removeListener("unpipe",a),n.removeListener("end",u),n.removeListener("end",g),n.removeListener("data",f),h=!0,!i.awaitDrain||e._writableState&&!e._writableState.needDrain||l())}function u(){c("onend"),e.end()}i.endEmitted?r.nextTick(s):n.once("end",s),e.on("unpipe",a);var l=function(e){return function(){var t=e._readableState;c("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&o(e,"data")&&(t.flowing=!0,U(e))}}(n);e.on("drain",l);var h=!1;function f(t){c("ondata");var r=e.write(t);c("dest.write",r),!1===r&&((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==z(i.pipes,e))&&!h&&(c("false write response, pause",i.awaitDrain),i.awaitDrain++),n.pause())}function d(t){c("onerror",t),g(),e.removeListener("error",d),0===o(e,"error")&&S(e,t)}function p(){e.removeListener("finish",y),g()}function y(){c("onfinish"),e.removeListener("close",p),g()}function g(){c("unpipe"),n.unpipe(e)}return n.on("data",f),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",d),e.once("close",p),e.once("finish",y),e.emit("pipe",n),i.flowing||(c("pipe resume"),n.resume()),e},A.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,c("on readable",i.length,i.reading),i.length?C(this):i.reading||r.nextTick(P,this))),n},A.prototype.addListener=A.prototype.on,A.prototype.removeListener=function(e,t){var n=s.prototype.removeListener.call(this,e,t);return"readable"===e&&r.nextTick(I,this),n},A.prototype.removeAllListeners=function(e){var t=s.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||r.nextTick(I,this),t},A.prototype.resume=function(){var e=this._readableState;return e.flowing||(c("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,r.nextTick(N,e,t))}(this,e)),e.paused=!1,this},A.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},A.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var i in e.on("end",(function(){if(c("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(i){(c("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(t.push(i)||(n=!0,e.pause()))})),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var o=0;o-1))throw new _(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(A.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(A.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),A.prototype._write=function(e,t,r){r(new y("_write()"))},A.prototype._writev=null,A.prototype.end=function(e,t,n){var i=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||function(e,t,n){t.ending=!0,T(e,t),n&&(t.finished?r.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,i,n),this},Object.defineProperty(A.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(A.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),A.prototype.destroy=h.destroy,A.prototype._undestroy=h.undestroy,A.prototype._destroy=function(e,t){t(e)}}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../errors":21,"./_stream_duplex":22,"./internal/streams/destroy":29,"./internal/streams/state":33,"./internal/streams/stream":34,_process:11,buffer:4,inherits:9,"util-deprecate":39}],27:[function(e,t,r){(function(r){(function(){"use strict";var n;function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var o=e("./end-of-stream"),s=Symbol("lastResolve"),a=Symbol("lastReject"),u=Symbol("error"),c=Symbol("ended"),l=Symbol("lastPromise"),h=Symbol("handlePromise"),f=Symbol("stream");function d(e,t){return{value:e,done:t}}function p(e){var t=e[s];if(null!==t){var r=e[f].read();null!==r&&(e[l]=null,e[s]=null,e[a]=null,t(d(r,!1)))}}function y(e){r.nextTick(p,e)}var g=Object.getPrototypeOf((function(){})),v=Object.setPrototypeOf((i(n={get stream(){return this[f]},next:function(){var e=this,t=this[u];if(null!==t)return Promise.reject(t);if(this[c])return Promise.resolve(d(void 0,!0));if(this[f].destroyed)return new Promise((function(t,n){r.nextTick((function(){e[u]?n(e[u]):t(d(void 0,!0))}))}));var n,i=this[l];if(i)n=new Promise(function(e,t){return function(r,n){e.then((function(){t[c]?r(d(void 0,!0)):t[h](r,n)}),n)}}(i,this));else{var o=this[f].read();if(null!==o)return Promise.resolve(d(o,!1));n=new Promise(this[h])}return this[l]=n,n}},Symbol.asyncIterator,(function(){return this})),i(n,"return",(function(){var e=this;return new Promise((function(t,r){e[f].destroy(null,(function(e){e?r(e):t(d(void 0,!0))}))}))})),n),g);t.exports=function(e){var t,r=Object.create(v,(i(t={},f,{value:e,writable:!0}),i(t,s,{value:null,writable:!0}),i(t,a,{value:null,writable:!0}),i(t,u,{value:null,writable:!0}),i(t,c,{value:e._readableState.endEmitted,writable:!0}),i(t,h,{value:function(e,t){var n=r[f].read();n?(r[l]=null,r[s]=null,r[a]=null,e(d(n,!1))):(r[s]=e,r[a]=t)},writable:!0}),t));return r[l]=null,o(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[a];return null!==t&&(r[l]=null,r[s]=null,r[a]=null,t(e)),void(r[u]=e)}var n=r[s];null!==n&&(r[l]=null,r[s]=null,r[a]=null,n(d(void 0,!0))),r[c]=!0})),e.on("readable",y.bind(null,r)),r}}).call(this)}).call(this,e("_process"))},{"./end-of-stream":30,_process:11}],28:[function(e,t,r){"use strict";function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){for(var r=0;r0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return s.alloc(0);for(var t,r,n,i=s.allocUnsafe(e>>>0),o=this.head,a=0;o;)t=o.data,r=i,n=a,s.prototype.copy.call(t,r,n),a+=o.data.length,o=o.next;return i}},{key:"consume",value:function(e,t){var r;return ei.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0==(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=s.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0==(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,t}},{key:u,value:function(e,t){return a(this,function(e){for(var t=1;t0,(function(e){n||(n=e),e&&s.forEach(c),o||(s.forEach(c),i(n))}))}));return t.reduce(l)}},{"../../../errors":21,"./end-of-stream":30}],33:[function(e,t,r){"use strict";var n=e("../../../errors").codes.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(e,t,r,i){var o=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,i,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new n(i?r:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}},{"../../../errors":21}],34:[function(e,t,r){t.exports=e("events").EventEmitter},{events:6}],35:[function(e,t,r){(r=t.exports=e("./lib/_stream_readable.js")).Stream=r,r.Readable=r,r.Writable=e("./lib/_stream_writable.js"),r.Duplex=e("./lib/_stream_duplex.js"),r.Transform=e("./lib/_stream_transform.js"),r.PassThrough=e("./lib/_stream_passthrough.js"),r.finished=e("./lib/internal/streams/end-of-stream.js"),r.pipeline=e("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":22,"./lib/_stream_passthrough.js":23,"./lib/_stream_readable.js":24,"./lib/_stream_transform.js":25,"./lib/_stream_writable.js":26,"./lib/internal/streams/end-of-stream.js":30,"./lib/internal/streams/pipeline.js":32}],36:[function(e,t,r){"use strict";var n=e("safe-buffer").Buffer,i=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=u,this.end=c,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=l,this.end=h,t=3;break;default:return this.write=f,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function s(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function u(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function c(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function l(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function h(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function f(e){return e.toString(this.encoding)}function d(e){return e&&e.length?this.write(e):""}r.StringDecoder=o,o.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0)return i>0&&(e.lastNeed=i-1),i;if(--n=0)return i>0&&(e.lastNeed=i-2),i;if(--n=0)return i>0&&(2===i?i=0:e.lastNeed=i-3),i;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},{"safe-buffer":16}],37:[function(e,t,r){"use strict";var n=e("punycode"),i=e("./util");function o(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}r.parse=b,r.resolve=function(e,t){return b(e,!1,!0).resolve(t)},r.resolveObject=function(e,t){return e?b(e,!1,!0).resolveObject(t):t},r.format=function(e){i.isString(e)&&(e=b(e));return e instanceof o?e.format():o.prototype.format.call(e)},r.Url=o;var s=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,c=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),l=["'"].concat(c),h=["%","/","?",";","#"].concat(l),f=["/","?","#"],d=/^[+a-z0-9A-Z_-]{0,63}$/,p=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,y={javascript:!0,"javascript:":!0},g={javascript:!0,"javascript:":!0},v={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},m=e("querystring");function b(e,t,r){if(e&&i.isObject(e)&&e instanceof o)return e;var n=new o;return n.parse(e,t,r),n}o.prototype.parse=function(e,t,r){if(!i.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var o=e.indexOf("?"),a=-1!==o&&o127?L+="x":L+=j[I];if(!L.match(d)){var N=C.slice(0,O),U=C.slice(O+1),B=j.match(p);B&&(N.push(B[1]),U.unshift(B[2])),U.length&&(b="/"+U.join(".")+b),this.hostname=N.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),M||(this.hostname=n.toASCII(this.hostname));var D=this.port?":"+this.port:"",q=this.hostname||"";this.host=q+D,this.href+=this.host,M&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!y[S])for(O=0,T=l.length;O0)&&r.host.split("@"))&&(r.auth=M.shift(),r.host=r.hostname=M.shift());return r.search=e.search,r.query=e.query,i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!E.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var A=E.slice(-1)[0],x=(r.host||e.host||E.length>1)&&("."===A||".."===A)||""===A,O=0,R=E.length;R>=0;R--)"."===(A=E[R])?E.splice(R,1):".."===A?(E.splice(R,1),O++):O&&(E.splice(R,1),O--);if(!_&&!S)for(;O--;O)E.unshift("..");!_||""===E[0]||E[0]&&"/"===E[0].charAt(0)||E.unshift(""),x&&"/"!==E.join("/").substr(-1)&&E.push("");var M,C=""===E[0]||E[0]&&"/"===E[0].charAt(0);k&&(r.hostname=r.host=C?"":E.length?E.shift():"",(M=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=M.shift(),r.host=r.hostname=M.shift()));return(_=_||r.host&&E.length)&&!C&&E.unshift(""),E.length?r.pathname=E.join("/"):(r.pathname=null,r.path=null),i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},o.prototype.parseHost=function(){var e=this.host,t=a.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},{"./util":38,punycode:12,querystring:15}],38:[function(e,t,r){"use strict";t.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},{}],39:[function(e,t,r){(function(e){(function(){function r(t){try{if(!e.localStorage)return!1}catch(e){return!1}var r=e.localStorage[t];return null!=r&&"true"===String(r).toLowerCase()}t.exports=function(e,t){if(r("noDeprecation"))return e;var n=!1;return function(){if(!n){if(r("throwDeprecation"))throw new Error(t);r("traceDeprecation")?console.trace(t):console.warn(t),n=!0}return e.apply(this,arguments)}}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],40:[function(e,t,r){t.exports=function(){for(var e={},t=0;t0)return this.client.emit("updateAvalible",e),Promise.all(e.map((async e=>{let t=Object.values(JSON.parse(await(0,s.fetch)(i.data[e]))||[]);this.client.set(e,t),o.default.writeFileSync(i.local[e],JSON.stringify(t))})))}start(){this.cron||this.client.emit("debug","Notify for new data updates enabled. AzurAPI Client will check for data updates every hour."),this.cron&&clearInterval(this.cron),this.cron=setInterval((()=>this.update()),this.client.rate)}stop(){this.cron&&clearInterval(this.cron),this.cron=void 0}async init(){o.default.existsSync(i.baseFolder)||o.default.mkdirSync(i.baseFolder),await this.load(),this.client.emit("ready")}load(){for(let e=0;es.default.get(e,(e=>{let r="";e.on("data",(e=>r+=e)),e.on("end",(()=>t(r)))})).on("error",(e=>r(e)))))}r.check=async function(){!u&&o.default.existsSync(i.versionInfo)&&(u=JSON.parse(o.default.readFileSync(i.versionInfo).toString())),c=JSON.parse(await l(i.data.version));let e=[];for(let t of a)u&&u[t]&&c[t]["version-number"]===u[t]["version-number"]||e.push(t);return e},r.save=function(){c&&o.default.writeFileSync(i.versionInfo,JSON.stringify(u=c))},r.fetch=l},{"./Data":43,fs:3,https:7}],45:[function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.normalize=r.NATIONS=void 0;const i=n(e("fuse.js"));r.NATIONS={"Eagle Union":["uss","eagle union"],"Royal Navy":["hms","royal navy"],"Sakura Empire":["ijn","sakura empire"],"Iron Blood":["kms","iron blood"],"Dragon Empery":["pran","dragon empery"],"Northern Parliament":["sn","northern parliament"],"Iris Libre":["ffnf","iris libre"],"Vichya Domination":["mnf","vichya domination"],"Sardenga Empire":["rn","sardegna empire"],Neptunia:["hdn","neptunia"],Bilibili:["bili","bilibili"],"Venus Vacation":["venus","venus vacation"],Utawarerumono:["utawarerumono"],"Kizuna AI":["kizunaai","kizuna ai"],Hololive:["hololive"],META:["meta"],Universal:["universal","univ"]};r.default=class{raw;fuse;client;constructor(e,t){this.raw=[],t&&(this.fuse=new i.default(this.raw,{keys:t,threshold:.4})),this.client=e}setData(e){(new Error).stack.match(/AzurAPI\.set/)&&(this.raw.splice(0,this.raw.length,...e),this.fuse&&this.fuse.setCollection(this.raw))}fuze(e){return this.fuse?this.fuse.search(e,{limit:10}).sort(((e,t)=>(t.score||0)-(e.score||0))):[]}id(e){for(let t of this.raw)if(s(t.id.toUpperCase())===s(e.toUpperCase()))return t}get(e){return this.id(e)||this.fuze(e)?.map((e=>e.item))}filter(e){return this.raw.filter(e)}map(e){return this.raw.map(e)}forEach(e){return this.raw.forEach(e)}every(e){return this.raw.every(e)}some(e){return this.raw.some(e)}};const o=/[\u0300-\u036F]/g;function s(e){return e.normalize("NFKD").replace(o,"")}r.normalize=s},{"fuse.js":52}],46:[function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(r,"__esModule",{value:!0}),r.Barrages=void 0;const s=o(e("./api"));class a extends s.default{constructor(e){super(e,["id","name"])}name(e){return this.raw.filter((t=>(0,s.normalize)(t.name.toUpperCase())===(0,s.normalize)(e.toUpperCase())))}type(e){return this.raw.filter((t=>(0,s.normalize)(t.type.toUpperCase())===(0,s.normalize)(e.toUpperCase())))}hull(e){return this.raw.filter((t=>(0,s.normalize)(t.hull.toUpperCase())===(0,s.normalize)(e.toUpperCase())))}ships(e){return this.raw.filter((t=>t.ships.map((e=>(0,s.normalize)(e.toUpperCase()))).includes((0,s.normalize)(e.toUpperCase()))))}}r.Barrages=a},{"./api":45}],47:[function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(r,"__esModule",{value:!0}),r.Chapters=void 0;const s=o(e("./api"));class a extends s.default{constructor(e){super(e)}name(e,t=["en","cn","jp"]){let r=[];for(let n of this.raw){t.some((t=>n.names[t]&&(0,s.normalize)(n.names[t].toUpperCase())===(0,s.normalize)(e.toUpperCase())))&&r.push(n);for(let i of Object.values(n))void 0!==i.names&&t.some((t=>i.names[t]&&(0,s.normalize)(i.names[t].toUpperCase())===(0,s.normalize)(e.toUpperCase())))&&r.push(i)}return r}}r.Chapters=a},{"./api":45}],48:[function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(r,"__esModule",{value:!0}),r.Equipments=void 0;const s=o(e("./api"));class a extends s.default{constructor(e){super(e,["names.en","names.cn","names.jp","names.kr","names.code","id"])}name(e,t=["en","cn","jp","kr"]){return this.raw.filter((r=>t.some((t=>r.names[t]&&(0,s.normalize)(r.names[t].toUpperCase())===(0,s.normalize)(e.toUpperCase())))))}category(e){return this.raw.filter((t=>(0,s.normalize)(t.category.toUpperCase()===(0,s.normalize)(e.toUpperCase()))))}nationality(e){return e=Object.keys(s.NATIONS).find((t=>s.NATIONS[t].includes(e.toLowerCase())))||e,this.raw.filter((t=>(0,s.normalize)(t.nationality.toUpperCase())===(0,s.normalize)(e.toUpperCase())))}get(e){let t=this.fuze(e).sort(((e,t)=>(t.score||0)-(e.score||0)))[0];return this.id(e)||this.name(e)||(t?t.item:void 0)}all(e){let t=[];return t.push(this.id(e)),t.push(...this.name(e).filter((e=>e))),t.push(...this.fuze(e).map((e=>e.item))),t.filter((e=>null!=e)).filter(((e,t,r)=>t===r.findIndex((t=>t.id===e.id))))}}r.Equipments=a},{"./api":45}],49:[function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(r,"__esModule",{value:!0}),r.Ships=void 0;const s=o(e("./api"));class a extends s.default{constructor(e){super(e,["names.en","names.cn","names.jp","names.kr","names.code","id"])}name(e,t=["en","cn","jp","kr"]){return this.raw.filter((r=>t.some((t=>r.names[t]&&(0,s.normalize)(r.names[t].toUpperCase())===(0,s.normalize)(e.toUpperCase())))))}hull(e){return this.raw.filter((t=>t.hullType&&(0,s.normalize)(t.hullType.toUpperCase())===(0,s.normalize)(e.toUpperCase())||t.retrofitHullType&&(0,s.normalize)(t.retrofitHullType.toUpperCase())===(0,s.normalize)(e.toUpperCase())))}nationality(e){let t=[];e=Object.keys(s.NATIONS).find((t=>s.NATIONS[t].includes(e.toLowerCase())))||e;for(let r of this.raw)(0,s.normalize)(r.nationality.toUpperCase())===(0,s.normalize)(e.toUpperCase())&&t.push(r);return t}get(e){let t=this.fuze(e).sort(((e,t)=>(t.score||0)-(e.score||0)))[0];return this.id(e)||this.name(e)[0]||(t?t.item:void 0)}all(e){let t=[];return t.push(this.id(e)),t.push(...this.name(e).filter((e=>e))),t.push(...this.fuze(e).map((e=>e.item))),t.filter((e=>null!=e)).filter(((e,t,r)=>t===r.findIndex((t=>t.id===e.id))))}}r.Ships=a},{"./api":45}],50:[function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.Voicelines=void 0;const i=n(e("./api"));class o extends i.default{constructor(e){super(e)}}r.Voicelines=o},{"./api":45}],51:[function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(r,"__esModule",{value:!0}),i(e("./core/Client"),r)},{"./core/Client":42}],52:[function(e,t,r){"use strict";function n(e){return n="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},n(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&void 0!==arguments[0]?arguments[0]:3,t=new Map,r=Math.pow(10,e);return{get:function(e){var n=e.match(L).length;if(t.has(n))return t.get(n);var i=1/Math.sqrt(n),o=parseFloat(Math.round(i*r)/r);return t.set(n,o),o},clear:function(){t.clear()}}}var P=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.getFn,n=void 0===r?j.getFn:r;i(this,e),this.norm=I(3),this.getFn=n,this.isCreated=!1,this.setIndexRecords()}return s(e,[{key:"setSources",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.docs=e}},{key:"setIndexRecords",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.records=e}},{key:"setKeys",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.keys=t,this._keysMap={},t.forEach((function(t,r){e._keysMap[t.id]=r}))}},{key:"create",value:function(){var e=this;!this.isCreated&&this.docs.length&&(this.isCreated=!0,m(this.docs[0])?this.docs.forEach((function(t,r){e._addString(t,r)})):this.docs.forEach((function(t,r){e._addObject(t,r)})),this.norm.clear())}},{key:"add",value:function(e){var t=this.size();m(e)?this._addString(e,t):this._addObject(e,t)}},{key:"removeAt",value:function(e){this.records.splice(e,1);for(var t=e,r=this.size();t2&&void 0!==arguments[2]?arguments[2]:{},n=r.getFn,i=void 0===n?j.getFn:n,o=new P({getFn:i});return o.setKeys(e.map(M)),o.setSources(t),o.create(),o}function U(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.errors,n=void 0===r?0:r,i=t.currentLocation,o=void 0===i?0:i,s=t.expectedLocation,a=void 0===s?0:s,u=t.distance,c=void 0===u?j.distance:u,l=t.ignoreLocation,h=void 0===l?j.ignoreLocation:l,f=n/e.length;if(h)return f;var d=Math.abs(a-o);return c?f+d/c:d?1:f}function B(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:j.minMatchCharLength,r=[],n=-1,i=-1,o=0,s=e.length;o=t&&r.push([n,i]),n=-1)}return e[o-1]&&o-n>=t&&r.push([n,o-1]),r}var D=32;function q(e){for(var t={},r=0,n=e.length;r1&&void 0!==arguments[1]?arguments[1]:{},o=n.location,s=void 0===o?j.location:o,a=n.threshold,u=void 0===a?j.threshold:a,c=n.distance,l=void 0===c?j.distance:c,h=n.includeMatches,f=void 0===h?j.includeMatches:h,d=n.findAllMatches,p=void 0===d?j.findAllMatches:d,y=n.minMatchCharLength,g=void 0===y?j.minMatchCharLength:y,v=n.isCaseSensitive,m=void 0===v?j.isCaseSensitive:v,b=n.ignoreLocation,w=void 0===b?j.ignoreLocation:b;if(i(this,e),this.options={location:s,threshold:u,distance:l,includeMatches:f,findAllMatches:p,minMatchCharLength:g,isCaseSensitive:m,ignoreLocation:w},this.pattern=m?t:t.toLowerCase(),this.chunks=[],this.pattern.length){var _=function(e,t){r.chunks.push({pattern:e,alphabet:q(e),startIndex:t})},S=this.pattern.length;if(S>D){for(var E=0,k=S%D,A=S-k;E3&&void 0!==arguments[3]?arguments[3]:{},i=n.location,o=void 0===i?j.location:i,s=n.distance,a=void 0===s?j.distance:s,u=n.threshold,c=void 0===u?j.threshold:u,l=n.findAllMatches,h=void 0===l?j.findAllMatches:l,f=n.minMatchCharLength,d=void 0===f?j.minMatchCharLength:f,p=n.includeMatches,y=void 0===p?j.includeMatches:p,g=n.ignoreLocation,v=void 0===g?j.ignoreLocation:g;if(t.length>D)throw new Error(x(D));for(var m,b=t.length,w=e.length,_=Math.max(0,Math.min(o,w)),S=c,E=_,k=d>1||y,A=k?Array(w):[];(m=e.indexOf(t,E))>-1;){var O=U(t,{currentLocation:m,expectedLocation:_,distance:a,ignoreLocation:v});if(S=Math.min(O,S),E=m+b,k)for(var R=0;R=q;H-=1){var W=H-1,$=r[e.charAt(W)];if(k&&(A[W]=+!!$),F[H]=(F[H+1]<<1|1)&$,I&&(F[H]|=(M[H+1]|M[H])<<1|1|M[H+1]),F[H]&L&&(C=U(t,{errors:I,currentLocation:W,expectedLocation:_,distance:a,ignoreLocation:v}))<=S){if(S=C,(E=W)<=_)break;q=Math.max(1,2*_-E)}}if(U(t,{errors:I+1,currentLocation:_,expectedLocation:_,distance:a,ignoreLocation:v})>S)break;M=F}var V={isMatch:E>=0,score:Math.max(.001,C)};if(k){var K=B(A,d);K.length?y&&(V.indices=K):V.isMatch=!1}return V}(e,r,i,{location:s+o,distance:a,threshold:u,findAllMatches:c,minMatchCharLength:l,includeMatches:n,ignoreLocation:h}),v=g.isMatch,m=g.score,b=g.indices;v&&(p=!0),d+=m,v&&b&&(f=[].concat(y(f),y(b)))}));var g={isMatch:p,score:p?d/this.chunks.length:1};return p&&n&&(g.indices=f),g}}]),e}(),F=function(){function e(t){i(this,e),this.pattern=t}return s(e,[{key:"search",value:function(){}}],[{key:"isMultiMatch",value:function(e){return H(e,this.multiRegex)}},{key:"isSingleMatch",value:function(e){return H(e,this.singleRegex)}}]),e}();function H(e,t){var r=e.match(t);return r?r[1]:null}var W=function(e){l(r,e);var t=p(r);function r(e){return i(this,r),t.call(this,e)}return s(r,[{key:"search",value:function(e){var t=e===this.pattern;return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}}],[{key:"type",get:function(){return"exact"}},{key:"multiRegex",get:function(){return/^="(.*)"$/}},{key:"singleRegex",get:function(){return/^=(.*)$/}}]),r}(F),$=function(e){l(r,e);var t=p(r);function r(e){return i(this,r),t.call(this,e)}return s(r,[{key:"search",value:function(e){var t=-1===e.indexOf(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}],[{key:"type",get:function(){return"inverse-exact"}},{key:"multiRegex",get:function(){return/^!"(.*)"$/}},{key:"singleRegex",get:function(){return/^!(.*)$/}}]),r}(F),V=function(e){l(r,e);var t=p(r);function r(e){return i(this,r),t.call(this,e)}return s(r,[{key:"search",value:function(e){var t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}}],[{key:"type",get:function(){return"prefix-exact"}},{key:"multiRegex",get:function(){return/^\^"(.*)"$/}},{key:"singleRegex",get:function(){return/^\^(.*)$/}}]),r}(F),K=function(e){l(r,e);var t=p(r);function r(e){return i(this,r),t.call(this,e)}return s(r,[{key:"search",value:function(e){var t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}],[{key:"type",get:function(){return"inverse-prefix-exact"}},{key:"multiRegex",get:function(){return/^!\^"(.*)"$/}},{key:"singleRegex",get:function(){return/^!\^(.*)$/}}]),r}(F),G=function(e){l(r,e);var t=p(r);function r(e){return i(this,r),t.call(this,e)}return s(r,[{key:"search",value:function(e){var t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}}],[{key:"type",get:function(){return"suffix-exact"}},{key:"multiRegex",get:function(){return/^"(.*)"\$$/}},{key:"singleRegex",get:function(){return/^(.*)\$$/}}]),r}(F),Y=function(e){l(r,e);var t=p(r);function r(e){return i(this,r),t.call(this,e)}return s(r,[{key:"search",value:function(e){var t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}],[{key:"type",get:function(){return"inverse-suffix-exact"}},{key:"multiRegex",get:function(){return/^!"(.*)"\$$/}},{key:"singleRegex",get:function(){return/^!(.*)\$$/}}]),r}(F),X=function(e){l(r,e);var t=p(r);function r(e){var n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=o.location,a=void 0===s?j.location:s,u=o.threshold,c=void 0===u?j.threshold:u,l=o.distance,h=void 0===l?j.distance:l,f=o.includeMatches,d=void 0===f?j.includeMatches:f,p=o.findAllMatches,y=void 0===p?j.findAllMatches:p,g=o.minMatchCharLength,v=void 0===g?j.minMatchCharLength:g,m=o.isCaseSensitive,b=void 0===m?j.isCaseSensitive:m,w=o.ignoreLocation,_=void 0===w?j.ignoreLocation:w;return i(this,r),(n=t.call(this,e))._bitapSearch=new z(e,{location:a,threshold:c,distance:h,includeMatches:d,findAllMatches:y,minMatchCharLength:v,isCaseSensitive:b,ignoreLocation:_}),n}return s(r,[{key:"search",value:function(e){return this._bitapSearch.searchIn(e)}}],[{key:"type",get:function(){return"fuzzy"}},{key:"multiRegex",get:function(){return/^"(.*)"$/}},{key:"singleRegex",get:function(){return/^(.*)$/}}]),r}(F),J=function(e){l(r,e);var t=p(r);function r(e){return i(this,r),t.call(this,e)}return s(r,[{key:"search",value:function(e){for(var t,r=0,n=[],i=this.pattern.length;(t=e.indexOf(this.pattern,r))>-1;)r=t+i,n.push([t,r-1]);var o=!!n.length;return{isMatch:o,score:o?0:1,indices:n}}}],[{key:"type",get:function(){return"include"}},{key:"multiRegex",get:function(){return/^'"(.*)"$/}},{key:"singleRegex",get:function(){return/^'(.*)$/}}]),r}(F),Z=[W,J,V,K,Y,G,$,X],Q=Z.length,ee=/ +(?=([^\"]*\"[^\"]*\")*[^\"]*$)/;function te(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.split("|").map((function(e){for(var r=e.trim().split(ee).filter((function(e){return e&&!!e.trim()})),n=[],i=0,o=r.length;i1&&void 0!==arguments[1]?arguments[1]:{},n=r.isCaseSensitive,o=void 0===n?j.isCaseSensitive:n,s=r.includeMatches,a=void 0===s?j.includeMatches:s,u=r.minMatchCharLength,c=void 0===u?j.minMatchCharLength:u,l=r.ignoreLocation,h=void 0===l?j.ignoreLocation:l,f=r.findAllMatches,d=void 0===f?j.findAllMatches:f,p=r.location,y=void 0===p?j.location:p,g=r.threshold,v=void 0===g?j.threshold:g,m=r.distance,b=void 0===m?j.distance:m;i(this,e),this.query=null,this.options={isCaseSensitive:o,includeMatches:a,minMatchCharLength:c,findAllMatches:d,ignoreLocation:h,location:y,threshold:v,distance:b},this.pattern=o?t:t.toLowerCase(),this.query=te(this.pattern,this.options)}return s(e,[{key:"searchIn",value:function(e){var t=this.query;if(!t)return{isMatch:!1,score:1};var r=this.options,n=r.includeMatches;e=r.isCaseSensitive?e:e.toLowerCase();for(var i=0,o=[],s=0,a=0,u=t.length;a2&&void 0!==arguments[2]?arguments[2]:{},n=r.auto,i=void 0===n||n,o=function e(r){var n=Object.keys(r),o=he(r);if(!o&&n.length>1&&!le(r))return e(de(r));if(fe(r)){var s=o?r[ue]:n[0],a=o?r[ce]:r[s];if(!m(a))throw new Error(A(s));var u={keyId:T(s),pattern:a};return i&&(u.searcher=oe(a,t)),u}var c={children:[],operator:n[0]};return n.forEach((function(t){var n=r[t];v(n)&&n.forEach((function(t){c.children.push(e(t))}))})),c};return le(e)||(e=de(e)),o(e)}function ye(e,t){var r=t.ignoreFieldNorm,n=void 0===r?j.ignoreFieldNorm:r;e.forEach((function(e){var t=1;e.matches.forEach((function(e){var r=e.key,i=e.norm,o=e.score,s=r?r.weight:null;t*=Math.pow(0===o&&s?Number.EPSILON:o,(s||1)*(n?1:i))})),e.score=t}))}function ge(e,t){var r=e.matches;t.matches=[],S(r)&&r.forEach((function(e){if(S(e.indices)&&e.indices.length){var r={indices:e.indices,value:e.value};e.key&&(r.key=e.key.src),e.idx>-1&&(r.refIndex=e.idx),t.matches.push(r)}}))}function ve(e,t){t.score=e.score}function me(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r.includeMatches,i=void 0===n?j.includeMatches:n,o=r.includeScore,s=void 0===o?j.includeScore:o,a=[];return i&&a.push(ge),s&&a.push(ve),e.map((function(e){var r=e.idx,n={item:t[r],refIndex:r};return a.length&&a.forEach((function(t){t(e,n)})),n}))}var be=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;i(this,e),this.options=c({},j,{},r),this.options.useExtendedSearch,this._keyStore=new R(this.options.keys),this.setCollection(t,n)}return s(e,[{key:"setCollection",value:function(e,t){if(this._docs=e,t&&!(t instanceof P))throw new Error("Incorrect 'index' type");this._myIndex=t||N(this.options.keys,this._docs,{getFn:this.options.getFn})}},{key:"add",value:function(e){S(e)&&(this._docs.push(e),this._myIndex.add(e))}},{key:"remove",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){return!1},t=[],r=0,n=this._docs.length;r1&&void 0!==arguments[1]?arguments[1]:{},r=t.limit,n=void 0===r?-1:r,i=this.options,o=i.includeMatches,s=i.includeScore,a=i.shouldSort,u=i.sortFn,c=i.ignoreFieldNorm,l=m(e)?m(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return ye(l,{ignoreFieldNorm:c}),a&&l.sort(u),b(n)&&n>-1&&(l=l.slice(0,n)),me(l,this._docs,{includeMatches:o,includeScore:s})}},{key:"_searchStringList",value:function(e){var t=oe(e,this.options),r=this._myIndex.records,n=[];return r.forEach((function(e){var r=e.v,i=e.i,o=e.n;if(S(r)){var s=t.searchIn(r),a=s.isMatch,u=s.score,c=s.indices;a&&n.push({item:r,idx:i,matches:[{score:u,value:r,norm:o,indices:c}]})}})),n}},{key:"_searchLogical",value:function(e){var t=this,r=pe(e,this.options),n=function e(r,n,i){if(!r.children){var o=r.keyId,s=r.searcher,a=t._findMatches({key:t._keyStore.get(o),value:t._myIndex.getValueForItemAtKeyId(n,o),searcher:s});return a&&a.length?[{idx:i,item:n,matches:a}]:[]}switch(r.operator){case se:for(var u=[],c=0,l=r.children.length;c1&&void 0!==arguments[1]?arguments[1]:{},r=t.getFn,n=void 0===r?j.getFn:r,i=e.keys,o=e.records,s=new P({getFn:n});return s.setKeys(i),s.setIndexRecords(o),s},be.config=j,be.parseQuery=pe,function(){ie.push.apply(ie,arguments)}(ne),t.exports=be},{}]},{},[51])(51)})); \ No newline at end of file diff --git a/docs/CNAME b/docs/CNAME deleted file mode 100644 index 6919a4eb..00000000 --- a/docs/CNAME +++ /dev/null @@ -1 +0,0 @@ -azurapi.js.org \ No newline at end of file diff --git a/docs/assets/search.js b/docs/assets/search.js index 41709540..739a3445 100644 --- a/docs/assets/search.js +++ b/docs/assets/search.js @@ -1 +1 @@ -window.searchData = JSON.parse("{\"kinds\":{\"2\":\"Module\",\"32\":\"Variable\",\"64\":\"Function\",\"128\":\"Class\",\"256\":\"Interface\",\"512\":\"Constructor\",\"1024\":\"Property\",\"2048\":\"Method\",\"65536\":\"Type literal\",\"4194304\":\"Type alias\",\"16777216\":\"Reference\"},\"rows\":[{\"id\":0,\"kind\":2,\"name\":\"core/api/api\",\"url\":\"modules/core_api_api.html\",\"classes\":\"tsd-kind-module\"},{\"id\":1,\"kind\":64,\"name\":\"normalize\",\"url\":\"modules/core_api_api.html#normalize\",\"classes\":\"tsd-kind-function tsd-parent-kind-module\",\"parent\":\"core/api/api\"},{\"id\":2,\"kind\":4194304,\"name\":\"Language\",\"url\":\"modules/core_api_api.html#Language\",\"classes\":\"tsd-kind-type-alias tsd-parent-kind-module\",\"parent\":\"core/api/api\"},{\"id\":3,\"kind\":256,\"name\":\"advancedOptions\",\"url\":\"interfaces/core_api_api.advancedOptions.html\",\"classes\":\"tsd-kind-interface tsd-parent-kind-module\",\"parent\":\"core/api/api\"},{\"id\":4,\"kind\":1024,\"name\":\"nameOnly\",\"url\":\"interfaces/core_api_api.advancedOptions.html#nameOnly\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"core/api/api.advancedOptions\"},{\"id\":5,\"kind\":1024,\"name\":\"idOnly\",\"url\":\"interfaces/core_api_api.advancedOptions.html#idOnly\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"core/api/api.advancedOptions\"},{\"id\":6,\"kind\":1024,\"name\":\"language\",\"url\":\"interfaces/core_api_api.advancedOptions.html#language\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"core/api/api.advancedOptions\"},{\"id\":7,\"kind\":32,\"name\":\"NATIONS\",\"url\":\"modules/core_api_api.html#NATIONS\",\"classes\":\"tsd-kind-variable tsd-parent-kind-module\",\"parent\":\"core/api/api\"},{\"id\":8,\"kind\":65536,\"name\":\"__type\",\"url\":\"modules/core_api_api.html#NATIONS.__type\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-variable\",\"parent\":\"core/api/api.NATIONS\"},{\"id\":9,\"kind\":1024,\"name\":\"Eagle Union\",\"url\":\"modules/core_api_api.html#NATIONS.__type.Eagle_Union\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/api/api.NATIONS.__type\"},{\"id\":10,\"kind\":1024,\"name\":\"Royal Navy\",\"url\":\"modules/core_api_api.html#NATIONS.__type.Royal_Navy\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/api/api.NATIONS.__type\"},{\"id\":11,\"kind\":1024,\"name\":\"Sakura Empire\",\"url\":\"modules/core_api_api.html#NATIONS.__type.Sakura_Empire\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/api/api.NATIONS.__type\"},{\"id\":12,\"kind\":1024,\"name\":\"Iron Blood\",\"url\":\"modules/core_api_api.html#NATIONS.__type.Iron_Blood\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/api/api.NATIONS.__type\"},{\"id\":13,\"kind\":1024,\"name\":\"Dragon Empery\",\"url\":\"modules/core_api_api.html#NATIONS.__type.Dragon_Empery\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/api/api.NATIONS.__type\"},{\"id\":14,\"kind\":1024,\"name\":\"Northern Parliament\",\"url\":\"modules/core_api_api.html#NATIONS.__type.Northern_Parliament\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/api/api.NATIONS.__type\"},{\"id\":15,\"kind\":1024,\"name\":\"Iris Libre\",\"url\":\"modules/core_api_api.html#NATIONS.__type.Iris_Libre\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/api/api.NATIONS.__type\"},{\"id\":16,\"kind\":1024,\"name\":\"Vichya Domination\",\"url\":\"modules/core_api_api.html#NATIONS.__type.Vichya_Domination\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/api/api.NATIONS.__type\"},{\"id\":17,\"kind\":1024,\"name\":\"Sardenga Empire\",\"url\":\"modules/core_api_api.html#NATIONS.__type.Sardenga_Empire\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/api/api.NATIONS.__type\"},{\"id\":18,\"kind\":1024,\"name\":\"Neptunia\",\"url\":\"modules/core_api_api.html#NATIONS.__type.Neptunia\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/api/api.NATIONS.__type\"},{\"id\":19,\"kind\":1024,\"name\":\"Bilibili\",\"url\":\"modules/core_api_api.html#NATIONS.__type.Bilibili\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/api/api.NATIONS.__type\"},{\"id\":20,\"kind\":1024,\"name\":\"Venus Vacation\",\"url\":\"modules/core_api_api.html#NATIONS.__type.Venus_Vacation\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/api/api.NATIONS.__type\"},{\"id\":21,\"kind\":1024,\"name\":\"Utawarerumono\",\"url\":\"modules/core_api_api.html#NATIONS.__type.Utawarerumono\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/api/api.NATIONS.__type\"},{\"id\":22,\"kind\":1024,\"name\":\"Kizuna AI\",\"url\":\"modules/core_api_api.html#NATIONS.__type.Kizuna_AI\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/api/api.NATIONS.__type\"},{\"id\":23,\"kind\":1024,\"name\":\"Hololive\",\"url\":\"modules/core_api_api.html#NATIONS.__type.Hololive\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/api/api.NATIONS.__type\"},{\"id\":24,\"kind\":1024,\"name\":\"META\",\"url\":\"modules/core_api_api.html#NATIONS.__type.META\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/api/api.NATIONS.__type\"},{\"id\":25,\"kind\":1024,\"name\":\"Universal\",\"url\":\"modules/core_api_api.html#NATIONS.__type.Universal\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/api/api.NATIONS.__type\"},{\"id\":26,\"kind\":128,\"name\":\"default\",\"url\":\"classes/core_api_api.default.html\",\"classes\":\"tsd-kind-class tsd-parent-kind-module tsd-has-type-parameter\",\"parent\":\"core/api/api\"},{\"id\":27,\"kind\":512,\"name\":\"constructor\",\"url\":\"classes/core_api_api.default.html#constructor\",\"classes\":\"tsd-kind-constructor tsd-parent-kind-class tsd-has-type-parameter\",\"parent\":\"core/api/api.default\"},{\"id\":28,\"kind\":1024,\"name\":\"raw\",\"url\":\"classes/core_api_api.default.html#raw\",\"classes\":\"tsd-kind-property tsd-parent-kind-class\",\"parent\":\"core/api/api.default\"},{\"id\":29,\"kind\":1024,\"name\":\"fuse\",\"url\":\"classes/core_api_api.default.html#fuse\",\"classes\":\"tsd-kind-property tsd-parent-kind-class\",\"parent\":\"core/api/api.default\"},{\"id\":30,\"kind\":1024,\"name\":\"client\",\"url\":\"classes/core_api_api.default.html#client\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-private\",\"parent\":\"core/api/api.default\"},{\"id\":31,\"kind\":2048,\"name\":\"setData\",\"url\":\"classes/core_api_api.default.html#setData\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/api/api.default\"},{\"id\":32,\"kind\":2048,\"name\":\"fuze\",\"url\":\"classes/core_api_api.default.html#fuze\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/api/api.default\"},{\"id\":33,\"kind\":2048,\"name\":\"id\",\"url\":\"classes/core_api_api.default.html#id\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/api/api.default\"},{\"id\":34,\"kind\":2048,\"name\":\"get\",\"url\":\"classes/core_api_api.default.html#get\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/api/api.default\"},{\"id\":35,\"kind\":2048,\"name\":\"filter\",\"url\":\"classes/core_api_api.default.html#filter\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/api/api.default\"},{\"id\":36,\"kind\":2048,\"name\":\"map\",\"url\":\"classes/core_api_api.default.html#map\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter\",\"parent\":\"core/api/api.default\"},{\"id\":37,\"kind\":2048,\"name\":\"forEach\",\"url\":\"classes/core_api_api.default.html#forEach\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/api/api.default\"},{\"id\":38,\"kind\":2048,\"name\":\"every\",\"url\":\"classes/core_api_api.default.html#every\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/api/api.default\"},{\"id\":39,\"kind\":2048,\"name\":\"some\",\"url\":\"classes/core_api_api.default.html#some\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/api/api.default\"},{\"id\":40,\"kind\":2,\"name\":\"core/api/api_barrage\",\"url\":\"modules/core_api_api_barrage.html\",\"classes\":\"tsd-kind-module\"},{\"id\":41,\"kind\":128,\"name\":\"Barrages\",\"url\":\"classes/core_api_api_barrage.Barrages.html\",\"classes\":\"tsd-kind-class tsd-parent-kind-module\",\"parent\":\"core/api/api_barrage\"},{\"id\":42,\"kind\":512,\"name\":\"constructor\",\"url\":\"classes/core_api_api_barrage.Barrages.html#constructor\",\"classes\":\"tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite\",\"parent\":\"core/api/api_barrage.Barrages\"},{\"id\":43,\"kind\":2048,\"name\":\"name\",\"url\":\"classes/core_api_api_barrage.Barrages.html#name\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/api/api_barrage.Barrages\"},{\"id\":44,\"kind\":2048,\"name\":\"type\",\"url\":\"classes/core_api_api_barrage.Barrages.html#type\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/api/api_barrage.Barrages\"},{\"id\":45,\"kind\":2048,\"name\":\"hull\",\"url\":\"classes/core_api_api_barrage.Barrages.html#hull\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/api/api_barrage.Barrages\"},{\"id\":46,\"kind\":2048,\"name\":\"ships\",\"url\":\"classes/core_api_api_barrage.Barrages.html#ships\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/api/api_barrage.Barrages\"},{\"id\":47,\"kind\":1024,\"name\":\"raw\",\"url\":\"classes/core_api_api_barrage.Barrages.html#raw\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_barrage.Barrages\"},{\"id\":48,\"kind\":1024,\"name\":\"fuse\",\"url\":\"classes/core_api_api_barrage.Barrages.html#fuse\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_barrage.Barrages\"},{\"id\":49,\"kind\":2048,\"name\":\"setData\",\"url\":\"classes/core_api_api_barrage.Barrages.html#setData\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_barrage.Barrages\"},{\"id\":50,\"kind\":2048,\"name\":\"fuze\",\"url\":\"classes/core_api_api_barrage.Barrages.html#fuze\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_barrage.Barrages\"},{\"id\":51,\"kind\":2048,\"name\":\"id\",\"url\":\"classes/core_api_api_barrage.Barrages.html#id\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_barrage.Barrages\"},{\"id\":52,\"kind\":2048,\"name\":\"get\",\"url\":\"classes/core_api_api_barrage.Barrages.html#get\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_barrage.Barrages\"},{\"id\":53,\"kind\":2048,\"name\":\"filter\",\"url\":\"classes/core_api_api_barrage.Barrages.html#filter\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_barrage.Barrages\"},{\"id\":54,\"kind\":2048,\"name\":\"map\",\"url\":\"classes/core_api_api_barrage.Barrages.html#map\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited\",\"parent\":\"core/api/api_barrage.Barrages\"},{\"id\":55,\"kind\":2048,\"name\":\"forEach\",\"url\":\"classes/core_api_api_barrage.Barrages.html#forEach\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_barrage.Barrages\"},{\"id\":56,\"kind\":2048,\"name\":\"every\",\"url\":\"classes/core_api_api_barrage.Barrages.html#every\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_barrage.Barrages\"},{\"id\":57,\"kind\":2048,\"name\":\"some\",\"url\":\"classes/core_api_api_barrage.Barrages.html#some\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_barrage.Barrages\"},{\"id\":58,\"kind\":2,\"name\":\"core/api/api_chapter\",\"url\":\"modules/core_api_api_chapter.html\",\"classes\":\"tsd-kind-module\"},{\"id\":59,\"kind\":128,\"name\":\"Chapters\",\"url\":\"classes/core_api_api_chapter.Chapters.html\",\"classes\":\"tsd-kind-class tsd-parent-kind-module\",\"parent\":\"core/api/api_chapter\"},{\"id\":60,\"kind\":512,\"name\":\"constructor\",\"url\":\"classes/core_api_api_chapter.Chapters.html#constructor\",\"classes\":\"tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite\",\"parent\":\"core/api/api_chapter.Chapters\"},{\"id\":61,\"kind\":2048,\"name\":\"name\",\"url\":\"classes/core_api_api_chapter.Chapters.html#name\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/api/api_chapter.Chapters\"},{\"id\":62,\"kind\":1024,\"name\":\"raw\",\"url\":\"classes/core_api_api_chapter.Chapters.html#raw\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_chapter.Chapters\"},{\"id\":63,\"kind\":1024,\"name\":\"fuse\",\"url\":\"classes/core_api_api_chapter.Chapters.html#fuse\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_chapter.Chapters\"},{\"id\":64,\"kind\":2048,\"name\":\"setData\",\"url\":\"classes/core_api_api_chapter.Chapters.html#setData\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_chapter.Chapters\"},{\"id\":65,\"kind\":2048,\"name\":\"fuze\",\"url\":\"classes/core_api_api_chapter.Chapters.html#fuze\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_chapter.Chapters\"},{\"id\":66,\"kind\":2048,\"name\":\"id\",\"url\":\"classes/core_api_api_chapter.Chapters.html#id\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_chapter.Chapters\"},{\"id\":67,\"kind\":2048,\"name\":\"get\",\"url\":\"classes/core_api_api_chapter.Chapters.html#get\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_chapter.Chapters\"},{\"id\":68,\"kind\":2048,\"name\":\"filter\",\"url\":\"classes/core_api_api_chapter.Chapters.html#filter\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_chapter.Chapters\"},{\"id\":69,\"kind\":2048,\"name\":\"map\",\"url\":\"classes/core_api_api_chapter.Chapters.html#map\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited\",\"parent\":\"core/api/api_chapter.Chapters\"},{\"id\":70,\"kind\":2048,\"name\":\"forEach\",\"url\":\"classes/core_api_api_chapter.Chapters.html#forEach\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_chapter.Chapters\"},{\"id\":71,\"kind\":2048,\"name\":\"every\",\"url\":\"classes/core_api_api_chapter.Chapters.html#every\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_chapter.Chapters\"},{\"id\":72,\"kind\":2048,\"name\":\"some\",\"url\":\"classes/core_api_api_chapter.Chapters.html#some\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_chapter.Chapters\"},{\"id\":73,\"kind\":2,\"name\":\"core/api/api_equipment\",\"url\":\"modules/core_api_api_equipment.html\",\"classes\":\"tsd-kind-module\"},{\"id\":74,\"kind\":128,\"name\":\"Equipments\",\"url\":\"classes/core_api_api_equipment.Equipments.html\",\"classes\":\"tsd-kind-class tsd-parent-kind-module\",\"parent\":\"core/api/api_equipment\"},{\"id\":75,\"kind\":512,\"name\":\"constructor\",\"url\":\"classes/core_api_api_equipment.Equipments.html#constructor\",\"classes\":\"tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite\",\"parent\":\"core/api/api_equipment.Equipments\"},{\"id\":76,\"kind\":2048,\"name\":\"name\",\"url\":\"classes/core_api_api_equipment.Equipments.html#name\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/api/api_equipment.Equipments\"},{\"id\":77,\"kind\":2048,\"name\":\"category\",\"url\":\"classes/core_api_api_equipment.Equipments.html#category\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/api/api_equipment.Equipments\"},{\"id\":78,\"kind\":2048,\"name\":\"nationality\",\"url\":\"classes/core_api_api_equipment.Equipments.html#nationality\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/api/api_equipment.Equipments\"},{\"id\":79,\"kind\":2048,\"name\":\"_nameAll\",\"url\":\"classes/core_api_api_equipment.Equipments.html#_nameAll\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-private\",\"parent\":\"core/api/api_equipment.Equipments\"},{\"id\":80,\"kind\":2048,\"name\":\"get\",\"url\":\"classes/core_api_api_equipment.Equipments.html#get\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-overwrite\",\"parent\":\"core/api/api_equipment.Equipments\"},{\"id\":81,\"kind\":2048,\"name\":\"all\",\"url\":\"classes/core_api_api_equipment.Equipments.html#all\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/api/api_equipment.Equipments\"},{\"id\":82,\"kind\":1024,\"name\":\"raw\",\"url\":\"classes/core_api_api_equipment.Equipments.html#raw\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_equipment.Equipments\"},{\"id\":83,\"kind\":1024,\"name\":\"fuse\",\"url\":\"classes/core_api_api_equipment.Equipments.html#fuse\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_equipment.Equipments\"},{\"id\":84,\"kind\":2048,\"name\":\"setData\",\"url\":\"classes/core_api_api_equipment.Equipments.html#setData\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_equipment.Equipments\"},{\"id\":85,\"kind\":2048,\"name\":\"fuze\",\"url\":\"classes/core_api_api_equipment.Equipments.html#fuze\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_equipment.Equipments\"},{\"id\":86,\"kind\":2048,\"name\":\"id\",\"url\":\"classes/core_api_api_equipment.Equipments.html#id\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_equipment.Equipments\"},{\"id\":87,\"kind\":2048,\"name\":\"filter\",\"url\":\"classes/core_api_api_equipment.Equipments.html#filter\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_equipment.Equipments\"},{\"id\":88,\"kind\":2048,\"name\":\"map\",\"url\":\"classes/core_api_api_equipment.Equipments.html#map\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited\",\"parent\":\"core/api/api_equipment.Equipments\"},{\"id\":89,\"kind\":2048,\"name\":\"forEach\",\"url\":\"classes/core_api_api_equipment.Equipments.html#forEach\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_equipment.Equipments\"},{\"id\":90,\"kind\":2048,\"name\":\"every\",\"url\":\"classes/core_api_api_equipment.Equipments.html#every\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_equipment.Equipments\"},{\"id\":91,\"kind\":2048,\"name\":\"some\",\"url\":\"classes/core_api_api_equipment.Equipments.html#some\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_equipment.Equipments\"},{\"id\":92,\"kind\":2,\"name\":\"core/api/api_ship\",\"url\":\"modules/core_api_api_ship.html\",\"classes\":\"tsd-kind-module\"},{\"id\":93,\"kind\":128,\"name\":\"Ships\",\"url\":\"classes/core_api_api_ship.Ships.html\",\"classes\":\"tsd-kind-class tsd-parent-kind-module\",\"parent\":\"core/api/api_ship\"},{\"id\":94,\"kind\":512,\"name\":\"constructor\",\"url\":\"classes/core_api_api_ship.Ships.html#constructor\",\"classes\":\"tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite\",\"parent\":\"core/api/api_ship.Ships\"},{\"id\":95,\"kind\":2048,\"name\":\"name\",\"url\":\"classes/core_api_api_ship.Ships.html#name\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/api/api_ship.Ships\"},{\"id\":96,\"kind\":2048,\"name\":\"hull\",\"url\":\"classes/core_api_api_ship.Ships.html#hull\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/api/api_ship.Ships\"},{\"id\":97,\"kind\":2048,\"name\":\"nationality\",\"url\":\"classes/core_api_api_ship.Ships.html#nationality\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/api/api_ship.Ships\"},{\"id\":98,\"kind\":2048,\"name\":\"_nameAll\",\"url\":\"classes/core_api_api_ship.Ships.html#_nameAll\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-private\",\"parent\":\"core/api/api_ship.Ships\"},{\"id\":99,\"kind\":2048,\"name\":\"get\",\"url\":\"classes/core_api_api_ship.Ships.html#get\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-overwrite\",\"parent\":\"core/api/api_ship.Ships\"},{\"id\":100,\"kind\":2048,\"name\":\"all\",\"url\":\"classes/core_api_api_ship.Ships.html#all\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/api/api_ship.Ships\"},{\"id\":101,\"kind\":1024,\"name\":\"raw\",\"url\":\"classes/core_api_api_ship.Ships.html#raw\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_ship.Ships\"},{\"id\":102,\"kind\":1024,\"name\":\"fuse\",\"url\":\"classes/core_api_api_ship.Ships.html#fuse\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_ship.Ships\"},{\"id\":103,\"kind\":2048,\"name\":\"setData\",\"url\":\"classes/core_api_api_ship.Ships.html#setData\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_ship.Ships\"},{\"id\":104,\"kind\":2048,\"name\":\"fuze\",\"url\":\"classes/core_api_api_ship.Ships.html#fuze\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_ship.Ships\"},{\"id\":105,\"kind\":2048,\"name\":\"id\",\"url\":\"classes/core_api_api_ship.Ships.html#id\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_ship.Ships\"},{\"id\":106,\"kind\":2048,\"name\":\"filter\",\"url\":\"classes/core_api_api_ship.Ships.html#filter\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_ship.Ships\"},{\"id\":107,\"kind\":2048,\"name\":\"map\",\"url\":\"classes/core_api_api_ship.Ships.html#map\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited\",\"parent\":\"core/api/api_ship.Ships\"},{\"id\":108,\"kind\":2048,\"name\":\"forEach\",\"url\":\"classes/core_api_api_ship.Ships.html#forEach\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_ship.Ships\"},{\"id\":109,\"kind\":2048,\"name\":\"every\",\"url\":\"classes/core_api_api_ship.Ships.html#every\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_ship.Ships\"},{\"id\":110,\"kind\":2048,\"name\":\"some\",\"url\":\"classes/core_api_api_ship.Ships.html#some\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_ship.Ships\"},{\"id\":111,\"kind\":2,\"name\":\"core/api/api_voiceline\",\"url\":\"modules/core_api_api_voiceline.html\",\"classes\":\"tsd-kind-module\"},{\"id\":112,\"kind\":128,\"name\":\"Voicelines\",\"url\":\"classes/core_api_api_voiceline.Voicelines.html\",\"classes\":\"tsd-kind-class tsd-parent-kind-module\",\"parent\":\"core/api/api_voiceline\"},{\"id\":113,\"kind\":512,\"name\":\"constructor\",\"url\":\"classes/core_api_api_voiceline.Voicelines.html#constructor\",\"classes\":\"tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite\",\"parent\":\"core/api/api_voiceline.Voicelines\"},{\"id\":114,\"kind\":1024,\"name\":\"raw\",\"url\":\"classes/core_api_api_voiceline.Voicelines.html#raw\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_voiceline.Voicelines\"},{\"id\":115,\"kind\":1024,\"name\":\"fuse\",\"url\":\"classes/core_api_api_voiceline.Voicelines.html#fuse\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_voiceline.Voicelines\"},{\"id\":116,\"kind\":2048,\"name\":\"setData\",\"url\":\"classes/core_api_api_voiceline.Voicelines.html#setData\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_voiceline.Voicelines\"},{\"id\":117,\"kind\":2048,\"name\":\"fuze\",\"url\":\"classes/core_api_api_voiceline.Voicelines.html#fuze\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_voiceline.Voicelines\"},{\"id\":118,\"kind\":2048,\"name\":\"id\",\"url\":\"classes/core_api_api_voiceline.Voicelines.html#id\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_voiceline.Voicelines\"},{\"id\":119,\"kind\":2048,\"name\":\"get\",\"url\":\"classes/core_api_api_voiceline.Voicelines.html#get\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_voiceline.Voicelines\"},{\"id\":120,\"kind\":2048,\"name\":\"filter\",\"url\":\"classes/core_api_api_voiceline.Voicelines.html#filter\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_voiceline.Voicelines\"},{\"id\":121,\"kind\":2048,\"name\":\"map\",\"url\":\"classes/core_api_api_voiceline.Voicelines.html#map\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited\",\"parent\":\"core/api/api_voiceline.Voicelines\"},{\"id\":122,\"kind\":2048,\"name\":\"forEach\",\"url\":\"classes/core_api_api_voiceline.Voicelines.html#forEach\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_voiceline.Voicelines\"},{\"id\":123,\"kind\":2048,\"name\":\"every\",\"url\":\"classes/core_api_api_voiceline.Voicelines.html#every\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_voiceline.Voicelines\"},{\"id\":124,\"kind\":2048,\"name\":\"some\",\"url\":\"classes/core_api_api_voiceline.Voicelines.html#some\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_voiceline.Voicelines\"},{\"id\":125,\"kind\":2,\"name\":\"core/CacheUpdater\",\"url\":\"modules/core_CacheUpdater.html\",\"classes\":\"tsd-kind-module\"},{\"id\":126,\"kind\":128,\"name\":\"default\",\"url\":\"classes/core_CacheUpdater.default.html\",\"classes\":\"tsd-kind-class tsd-parent-kind-module\",\"parent\":\"core/CacheUpdater\"},{\"id\":127,\"kind\":512,\"name\":\"constructor\",\"url\":\"classes/core_CacheUpdater.default.html#constructor\",\"classes\":\"tsd-kind-constructor tsd-parent-kind-class\",\"parent\":\"core/CacheUpdater.default\"},{\"id\":128,\"kind\":1024,\"name\":\"cron\",\"url\":\"classes/core_CacheUpdater.default.html#cron\",\"classes\":\"tsd-kind-property tsd-parent-kind-class\",\"parent\":\"core/CacheUpdater.default\"},{\"id\":129,\"kind\":1024,\"name\":\"client\",\"url\":\"classes/core_CacheUpdater.default.html#client\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-private\",\"parent\":\"core/CacheUpdater.default\"},{\"id\":130,\"kind\":2048,\"name\":\"update\",\"url\":\"classes/core_CacheUpdater.default.html#update\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/CacheUpdater.default\"},{\"id\":131,\"kind\":2048,\"name\":\"start\",\"url\":\"classes/core_CacheUpdater.default.html#start\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/CacheUpdater.default\"},{\"id\":132,\"kind\":2048,\"name\":\"stop\",\"url\":\"classes/core_CacheUpdater.default.html#stop\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/CacheUpdater.default\"},{\"id\":133,\"kind\":2048,\"name\":\"init\",\"url\":\"classes/core_CacheUpdater.default.html#init\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/CacheUpdater.default\"},{\"id\":134,\"kind\":2048,\"name\":\"load\",\"url\":\"classes/core_CacheUpdater.default.html#load\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/CacheUpdater.default\"},{\"id\":135,\"kind\":2,\"name\":\"core/Client\",\"url\":\"modules/core_Client.html\",\"classes\":\"tsd-kind-module\"},{\"id\":136,\"kind\":4194304,\"name\":\"Source\",\"url\":\"modules/core_Client.html#Source\",\"classes\":\"tsd-kind-type-alias tsd-parent-kind-module\",\"parent\":\"core/Client\"},{\"id\":137,\"kind\":256,\"name\":\"CacheOptions\",\"url\":\"interfaces/core_Client.CacheOptions.html\",\"classes\":\"tsd-kind-interface tsd-parent-kind-module\",\"parent\":\"core/Client\"},{\"id\":138,\"kind\":1024,\"name\":\"source\",\"url\":\"interfaces/core_Client.CacheOptions.html#source\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"core/Client.CacheOptions\"},{\"id\":139,\"kind\":1024,\"name\":\"autoupdate\",\"url\":\"interfaces/core_Client.CacheOptions.html#autoupdate\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"core/Client.CacheOptions\"},{\"id\":140,\"kind\":1024,\"name\":\"rate\",\"url\":\"interfaces/core_Client.CacheOptions.html#rate\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"core/Client.CacheOptions\"},{\"id\":141,\"kind\":32,\"name\":\"instance\",\"url\":\"modules/core_Client.html#instance\",\"classes\":\"tsd-kind-variable tsd-parent-kind-module\",\"parent\":\"core/Client\"},{\"id\":142,\"kind\":128,\"name\":\"AzurAPI\",\"url\":\"classes/core_Client.AzurAPI.html\",\"classes\":\"tsd-kind-class tsd-parent-kind-module\",\"parent\":\"core/Client\"},{\"id\":143,\"kind\":512,\"name\":\"constructor\",\"url\":\"classes/core_Client.AzurAPI.html#constructor\",\"classes\":\"tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite\",\"parent\":\"core/Client.AzurAPI\"},{\"id\":144,\"kind\":1024,\"name\":\"options\",\"url\":\"classes/core_Client.AzurAPI.html#options\",\"classes\":\"tsd-kind-property tsd-parent-kind-class\",\"parent\":\"core/Client.AzurAPI\"},{\"id\":145,\"kind\":1024,\"name\":\"source\",\"url\":\"classes/core_Client.AzurAPI.html#source\",\"classes\":\"tsd-kind-property tsd-parent-kind-class\",\"parent\":\"core/Client.AzurAPI\"},{\"id\":146,\"kind\":1024,\"name\":\"autoupdate\",\"url\":\"classes/core_Client.AzurAPI.html#autoupdate\",\"classes\":\"tsd-kind-property tsd-parent-kind-class\",\"parent\":\"core/Client.AzurAPI\"},{\"id\":147,\"kind\":1024,\"name\":\"rate\",\"url\":\"classes/core_Client.AzurAPI.html#rate\",\"classes\":\"tsd-kind-property tsd-parent-kind-class\",\"parent\":\"core/Client.AzurAPI\"},{\"id\":148,\"kind\":1024,\"name\":\"updater\",\"url\":\"classes/core_Client.AzurAPI.html#updater\",\"classes\":\"tsd-kind-property tsd-parent-kind-class\",\"parent\":\"core/Client.AzurAPI\"},{\"id\":149,\"kind\":1024,\"name\":\"ships\",\"url\":\"classes/core_Client.AzurAPI.html#ships-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-class\",\"parent\":\"core/Client.AzurAPI\"},{\"id\":150,\"kind\":1024,\"name\":\"equipments\",\"url\":\"classes/core_Client.AzurAPI.html#equipments-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-class\",\"parent\":\"core/Client.AzurAPI\"},{\"id\":151,\"kind\":1024,\"name\":\"chapters\",\"url\":\"classes/core_Client.AzurAPI.html#chapters-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-class\",\"parent\":\"core/Client.AzurAPI\"},{\"id\":152,\"kind\":1024,\"name\":\"voicelines\",\"url\":\"classes/core_Client.AzurAPI.html#voicelines-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-class\",\"parent\":\"core/Client.AzurAPI\"},{\"id\":153,\"kind\":1024,\"name\":\"barrages\",\"url\":\"classes/core_Client.AzurAPI.html#barrages-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-class\",\"parent\":\"core/Client.AzurAPI\"},{\"id\":154,\"kind\":1024,\"name\":\"apis\",\"url\":\"classes/core_Client.AzurAPI.html#apis\",\"classes\":\"tsd-kind-property tsd-parent-kind-class\",\"parent\":\"core/Client.AzurAPI\"},{\"id\":155,\"kind\":65536,\"name\":\"__type\",\"url\":\"classes/core_Client.AzurAPI.html#__type\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-class\",\"parent\":\"core/Client.AzurAPI\"},{\"id\":156,\"kind\":1024,\"name\":\"ships\",\"url\":\"classes/core_Client.AzurAPI.html#__type.ships\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/Client.AzurAPI.__type\"},{\"id\":157,\"kind\":1024,\"name\":\"equipments\",\"url\":\"classes/core_Client.AzurAPI.html#__type.equipments\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/Client.AzurAPI.__type\"},{\"id\":158,\"kind\":1024,\"name\":\"chapters\",\"url\":\"classes/core_Client.AzurAPI.html#__type.chapters\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/Client.AzurAPI.__type\"},{\"id\":159,\"kind\":1024,\"name\":\"voicelines\",\"url\":\"classes/core_Client.AzurAPI.html#__type.voicelines\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/Client.AzurAPI.__type\"},{\"id\":160,\"kind\":1024,\"name\":\"barrages\",\"url\":\"classes/core_Client.AzurAPI.html#__type.barrages\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/Client.AzurAPI.__type\"},{\"id\":161,\"kind\":2048,\"name\":\"set\",\"url\":\"classes/core_Client.AzurAPI.html#set\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/Client.AzurAPI\"},{\"id\":162,\"kind\":2,\"name\":\"core/Data\",\"url\":\"modules/core_Data.html\",\"classes\":\"tsd-kind-module\"},{\"id\":163,\"kind\":32,\"name\":\"data\",\"url\":\"modules/core_Data.html#data\",\"classes\":\"tsd-kind-variable tsd-parent-kind-module\",\"parent\":\"core/Data\"},{\"id\":164,\"kind\":65536,\"name\":\"__type\",\"url\":\"modules/core_Data.html#data.__type\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-variable\",\"parent\":\"core/Data.data\"},{\"id\":165,\"kind\":1024,\"name\":\"version\",\"url\":\"modules/core_Data.html#data.__type.version\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/Data.data.__type\"},{\"id\":166,\"kind\":1024,\"name\":\"ships\",\"url\":\"modules/core_Data.html#data.__type.ships\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/Data.data.__type\"},{\"id\":167,\"kind\":1024,\"name\":\"equipments\",\"url\":\"modules/core_Data.html#data.__type.equipments\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/Data.data.__type\"},{\"id\":168,\"kind\":1024,\"name\":\"chapters\",\"url\":\"modules/core_Data.html#data.__type.chapters\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/Data.data.__type\"},{\"id\":169,\"kind\":1024,\"name\":\"voicelines\",\"url\":\"modules/core_Data.html#data.__type.voicelines\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/Data.data.__type\"},{\"id\":170,\"kind\":1024,\"name\":\"barrages\",\"url\":\"modules/core_Data.html#data.__type.barrages\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/Data.data.__type\"},{\"id\":171,\"kind\":1024,\"name\":\"shipList\",\"url\":\"modules/core_Data.html#data.__type.shipList\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/Data.data.__type\"},{\"id\":172,\"kind\":1024,\"name\":\"idMap\",\"url\":\"modules/core_Data.html#data.__type.idMap\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/Data.data.__type\"},{\"id\":173,\"kind\":32,\"name\":\"local\",\"url\":\"modules/core_Data.html#local\",\"classes\":\"tsd-kind-variable tsd-parent-kind-module\",\"parent\":\"core/Data\"},{\"id\":174,\"kind\":65536,\"name\":\"__type\",\"url\":\"modules/core_Data.html#local.__type-1\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-variable\",\"parent\":\"core/Data.local\"},{\"id\":175,\"kind\":1024,\"name\":\"ships\",\"url\":\"modules/core_Data.html#local.__type-1.ships-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/Data.local.__type\"},{\"id\":176,\"kind\":1024,\"name\":\"equipments\",\"url\":\"modules/core_Data.html#local.__type-1.equipments-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/Data.local.__type\"},{\"id\":177,\"kind\":1024,\"name\":\"chapters\",\"url\":\"modules/core_Data.html#local.__type-1.chapters-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/Data.local.__type\"},{\"id\":178,\"kind\":1024,\"name\":\"voicelines\",\"url\":\"modules/core_Data.html#local.__type-1.voicelines-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/Data.local.__type\"},{\"id\":179,\"kind\":1024,\"name\":\"barrages\",\"url\":\"modules/core_Data.html#local.__type-1.barrages-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/Data.local.__type\"},{\"id\":180,\"kind\":1024,\"name\":\"shipList\",\"url\":\"modules/core_Data.html#local.__type-1.shipList-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/Data.local.__type\"},{\"id\":181,\"kind\":1024,\"name\":\"idMap\",\"url\":\"modules/core_Data.html#local.__type-1.idMap-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/Data.local.__type\"},{\"id\":182,\"kind\":4194304,\"name\":\"datatype\",\"url\":\"modules/core_Data.html#datatype\",\"classes\":\"tsd-kind-type-alias tsd-parent-kind-module\",\"parent\":\"core/Data\"},{\"id\":183,\"kind\":32,\"name\":\"baseFolder\",\"url\":\"modules/core_Data.html#baseFolder\",\"classes\":\"tsd-kind-variable tsd-parent-kind-module\",\"parent\":\"core/Data\"},{\"id\":184,\"kind\":32,\"name\":\"versionInfo\",\"url\":\"modules/core_Data.html#versionInfo\",\"classes\":\"tsd-kind-variable tsd-parent-kind-module\",\"parent\":\"core/Data\"},{\"id\":185,\"kind\":2,\"name\":\"core/UpdateChecker\",\"url\":\"modules/core_UpdateChecker.html\",\"classes\":\"tsd-kind-module\"},{\"id\":186,\"kind\":64,\"name\":\"check\",\"url\":\"modules/core_UpdateChecker.html#check\",\"classes\":\"tsd-kind-function tsd-parent-kind-module\",\"parent\":\"core/UpdateChecker\"},{\"id\":187,\"kind\":64,\"name\":\"save\",\"url\":\"modules/core_UpdateChecker.html#save\",\"classes\":\"tsd-kind-function tsd-parent-kind-module\",\"parent\":\"core/UpdateChecker\"},{\"id\":188,\"kind\":64,\"name\":\"fetch\",\"url\":\"modules/core_UpdateChecker.html#fetch\",\"classes\":\"tsd-kind-function tsd-parent-kind-module\",\"parent\":\"core/UpdateChecker\"},{\"id\":189,\"kind\":2,\"name\":\"index\",\"url\":\"modules/index.html\",\"classes\":\"tsd-kind-module\"},{\"id\":190,\"kind\":2,\"name\":\"types/barrage\",\"url\":\"modules/types_barrage.html\",\"classes\":\"tsd-kind-module\"},{\"id\":191,\"kind\":4194304,\"name\":\"Url\",\"url\":\"modules/types_barrage.html#Url\",\"classes\":\"tsd-kind-type-alias tsd-parent-kind-module\",\"parent\":\"types/barrage\"},{\"id\":192,\"kind\":4194304,\"name\":\"Ships\",\"url\":\"modules/types_barrage.html#Ships\",\"classes\":\"tsd-kind-type-alias tsd-parent-kind-module\",\"parent\":\"types/barrage\"},{\"id\":193,\"kind\":4194304,\"name\":\"Hull\",\"url\":\"modules/types_barrage.html#Hull\",\"classes\":\"tsd-kind-type-alias tsd-parent-kind-module\",\"parent\":\"types/barrage\"},{\"id\":194,\"kind\":4194304,\"name\":\"RoundType\",\"url\":\"modules/types_barrage.html#RoundType\",\"classes\":\"tsd-kind-type-alias tsd-parent-kind-module\",\"parent\":\"types/barrage\"},{\"id\":195,\"kind\":256,\"name\":\"Rounds\",\"url\":\"interfaces/types_barrage.Rounds.html\",\"classes\":\"tsd-kind-interface tsd-parent-kind-module\",\"parent\":\"types/barrage\"},{\"id\":196,\"kind\":1024,\"name\":\"type\",\"url\":\"interfaces/types_barrage.Rounds.html#type\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/barrage.Rounds\"},{\"id\":197,\"kind\":1024,\"name\":\"dmgL\",\"url\":\"interfaces/types_barrage.Rounds.html#dmgL\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/barrage.Rounds\"},{\"id\":198,\"kind\":1024,\"name\":\"dmgM\",\"url\":\"interfaces/types_barrage.Rounds.html#dmgM\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/barrage.Rounds\"},{\"id\":199,\"kind\":1024,\"name\":\"note\",\"url\":\"interfaces/types_barrage.Rounds.html#note\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/barrage.Rounds\"},{\"id\":200,\"kind\":256,\"name\":\"Barrage\",\"url\":\"interfaces/types_barrage.Barrage.html\",\"classes\":\"tsd-kind-interface tsd-parent-kind-module\",\"parent\":\"types/barrage\"},{\"id\":201,\"kind\":1024,\"name\":\"type\",\"url\":\"interfaces/types_barrage.Barrage.html#type\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/barrage.Barrage\"},{\"id\":202,\"kind\":1024,\"name\":\"icon\",\"url\":\"interfaces/types_barrage.Barrage.html#icon\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/barrage.Barrage\"},{\"id\":203,\"kind\":1024,\"name\":\"name\",\"url\":\"interfaces/types_barrage.Barrage.html#name\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/barrage.Barrage\"},{\"id\":204,\"kind\":1024,\"name\":\"ships\",\"url\":\"interfaces/types_barrage.Barrage.html#ships\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/barrage.Barrage\"},{\"id\":205,\"kind\":1024,\"name\":\"hull\",\"url\":\"interfaces/types_barrage.Barrage.html#hull\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/barrage.Barrage\"},{\"id\":206,\"kind\":1024,\"name\":\"rounds\",\"url\":\"interfaces/types_barrage.Barrage.html#rounds\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/barrage.Barrage\"},{\"id\":207,\"kind\":1024,\"name\":\"id\",\"url\":\"interfaces/types_barrage.Barrage.html#id\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited\",\"parent\":\"types/barrage.Barrage\"},{\"id\":208,\"kind\":2,\"name\":\"types/chapter\",\"url\":\"modules/types_chapter.html\",\"classes\":\"tsd-kind-module\"},{\"id\":209,\"kind\":256,\"name\":\"Chapter\",\"url\":\"interfaces/types_chapter.Chapter.html\",\"classes\":\"tsd-kind-interface tsd-parent-kind-module\",\"parent\":\"types/chapter\"},{\"id\":210,\"kind\":1024,\"name\":\"1\",\"url\":\"interfaces/types_chapter.Chapter.html#1\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/chapter.Chapter\"},{\"id\":211,\"kind\":1024,\"name\":\"2\",\"url\":\"interfaces/types_chapter.Chapter.html#2\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/chapter.Chapter\"},{\"id\":212,\"kind\":1024,\"name\":\"3\",\"url\":\"interfaces/types_chapter.Chapter.html#3\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/chapter.Chapter\"},{\"id\":213,\"kind\":1024,\"name\":\"4\",\"url\":\"interfaces/types_chapter.Chapter.html#4\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/chapter.Chapter\"},{\"id\":214,\"kind\":1024,\"name\":\"names\",\"url\":\"interfaces/types_chapter.Chapter.html#names\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/chapter.Chapter\"},{\"id\":215,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_chapter.Chapter.html#__type\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"types/chapter.Chapter\"},{\"id\":216,\"kind\":1024,\"name\":\"en\",\"url\":\"interfaces/types_chapter.Chapter.html#__type.en\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.Chapter.__type\"},{\"id\":217,\"kind\":1024,\"name\":\"cn\",\"url\":\"interfaces/types_chapter.Chapter.html#__type.cn\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.Chapter.__type\"},{\"id\":218,\"kind\":1024,\"name\":\"jp\",\"url\":\"interfaces/types_chapter.Chapter.html#__type.jp\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.Chapter.__type\"},{\"id\":219,\"kind\":1024,\"name\":\"id\",\"url\":\"interfaces/types_chapter.Chapter.html#id\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited\",\"parent\":\"types/chapter.Chapter\"},{\"id\":220,\"kind\":256,\"name\":\"SubChapter\",\"url\":\"interfaces/types_chapter.SubChapter.html\",\"classes\":\"tsd-kind-interface tsd-parent-kind-module\",\"parent\":\"types/chapter\"},{\"id\":221,\"kind\":1024,\"name\":\"names\",\"url\":\"interfaces/types_chapter.SubChapter.html#names\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/chapter.SubChapter\"},{\"id\":222,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-8\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"types/chapter.SubChapter\"},{\"id\":223,\"kind\":1024,\"name\":\"en\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-8.en\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":224,\"kind\":1024,\"name\":\"cn\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-8.cn\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":225,\"kind\":1024,\"name\":\"jp\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-8.jp\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":226,\"kind\":1024,\"name\":\"normal\",\"url\":\"interfaces/types_chapter.SubChapter.html#normal\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/chapter.SubChapter\"},{\"id\":227,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"types/chapter.SubChapter\"},{\"id\":228,\"kind\":1024,\"name\":\"title\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.title-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":229,\"kind\":1024,\"name\":\"code\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.code-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":230,\"kind\":1024,\"name\":\"introduction\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.introduction-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":231,\"kind\":1024,\"name\":\"unlockRequirements\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.unlockRequirements-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":232,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-15\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":233,\"kind\":1024,\"name\":\"text\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-15.text-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":234,\"kind\":1024,\"name\":\"requiredLevel\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-15.requiredLevel-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":235,\"kind\":1024,\"name\":\"clearRewards\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.clearRewards\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":236,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-12\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":237,\"kind\":1024,\"name\":\"cube\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-12.cube\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":238,\"kind\":1024,\"name\":\"coin\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-12.coin\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":239,\"kind\":1024,\"name\":\"ship\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-12.ship\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":240,\"kind\":1024,\"name\":\"threeStarRewards\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.threeStarRewards-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":241,\"kind\":1024,\"name\":\"enemyLevel\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.enemyLevel-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":242,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-13\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":243,\"kind\":1024,\"name\":\"mobLevel\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-13.mobLevel-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":244,\"kind\":1024,\"name\":\"bossLevel\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-13.bossLevel-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":245,\"kind\":1024,\"name\":\"boss\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-13.boss-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":246,\"kind\":1024,\"name\":\"baseXP\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.baseXP-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":247,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-11\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":248,\"kind\":1024,\"name\":\"smallFleet\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-11.smallFleet-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":249,\"kind\":1024,\"name\":\"mediumFleet\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-11.mediumFleet-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":250,\"kind\":1024,\"name\":\"largeFleet\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-11.largeFleet-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":251,\"kind\":1024,\"name\":\"bossFleet\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-11.bossFleet-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":252,\"kind\":1024,\"name\":\"requiredBattles\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.requiredBattles-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":253,\"kind\":1024,\"name\":\"bossKillsToClear\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.bossKillsToClear-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":254,\"kind\":1024,\"name\":\"starConditions\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.starConditions-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":255,\"kind\":1024,\"name\":\"airSupremacy\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.airSupremacy-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":256,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-10\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":257,\"kind\":1024,\"name\":\"actual\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-10.actual-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":258,\"kind\":1024,\"name\":\"superiority\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-10.superiority-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":259,\"kind\":1024,\"name\":\"supremacy\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-10.supremacy-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":260,\"kind\":1024,\"name\":\"mapDrops\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.mapDrops-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":261,\"kind\":1024,\"name\":\"equipmentBlueprintDrops\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.equipmentBlueprintDrops-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":262,\"kind\":1024,\"name\":\"shipDrops\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.shipDrops-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":263,\"kind\":1024,\"name\":\"nodeMap\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.nodeMap-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":264,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-14\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":265,\"kind\":1024,\"name\":\"width\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-14.width-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":266,\"kind\":1024,\"name\":\"height\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-14.height-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":267,\"kind\":1024,\"name\":\"map\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-14.map-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":268,\"kind\":1024,\"name\":\"nodes\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-14.nodes-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":269,\"kind\":1024,\"name\":\"hard\",\"url\":\"interfaces/types_chapter.SubChapter.html#hard\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/chapter.SubChapter\"},{\"id\":270,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"types/chapter.SubChapter\"},{\"id\":271,\"kind\":1024,\"name\":\"title\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.title\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":272,\"kind\":1024,\"name\":\"code\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.code\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":273,\"kind\":1024,\"name\":\"introduction\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.introduction\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":274,\"kind\":1024,\"name\":\"unlockRequirements\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.unlockRequirements\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":275,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-7\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":276,\"kind\":1024,\"name\":\"text\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-7.text\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":277,\"kind\":1024,\"name\":\"requiredLevel\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-7.requiredLevel\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":278,\"kind\":1024,\"name\":\"threeStarRewards\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.threeStarRewards\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":279,\"kind\":1024,\"name\":\"enemyLevel\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.enemyLevel\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":280,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-3\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":281,\"kind\":1024,\"name\":\"mobLevel\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-3.mobLevel\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":282,\"kind\":1024,\"name\":\"bossLevel\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-3.bossLevel\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":283,\"kind\":1024,\"name\":\"boss\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-3.boss\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":284,\"kind\":1024,\"name\":\"baseXP\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.baseXP\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":285,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-2\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":286,\"kind\":1024,\"name\":\"smallFleet\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-2.smallFleet\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":287,\"kind\":1024,\"name\":\"mediumFleet\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-2.mediumFleet\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":288,\"kind\":1024,\"name\":\"largeFleet\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-2.largeFleet\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":289,\"kind\":1024,\"name\":\"bossFleet\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-2.bossFleet\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":290,\"kind\":1024,\"name\":\"requiredBattles\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.requiredBattles\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":291,\"kind\":1024,\"name\":\"bossKillsToClear\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.bossKillsToClear\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":292,\"kind\":1024,\"name\":\"starConditions\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.starConditions\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":293,\"kind\":1024,\"name\":\"airSupremacy\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.airSupremacy\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":294,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-1\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":295,\"kind\":1024,\"name\":\"actual\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-1.actual\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":296,\"kind\":1024,\"name\":\"superiority\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-1.superiority\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":297,\"kind\":1024,\"name\":\"supremacy\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-1.supremacy\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":298,\"kind\":1024,\"name\":\"fleetRestrictions\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.fleetRestrictions\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":299,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-4\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":300,\"kind\":1024,\"name\":\"fleet1\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-4.fleet1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":301,\"kind\":1024,\"name\":\"fleet2\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-4.fleet2\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":302,\"kind\":1024,\"name\":\"statRestrictions\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.statRestrictions\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":303,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-6\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":304,\"kind\":1024,\"name\":\"averageLevel\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-6.averageLevel\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":305,\"kind\":1024,\"name\":\"firepower\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-6.firepower\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":306,\"kind\":1024,\"name\":\"aviation\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-6.aviation\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":307,\"kind\":1024,\"name\":\"mapDrops\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.mapDrops\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":308,\"kind\":1024,\"name\":\"equipmentBlueprintDrops\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.equipmentBlueprintDrops\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":309,\"kind\":1024,\"name\":\"shipDrops\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.shipDrops\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":310,\"kind\":1024,\"name\":\"nodeMap\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.nodeMap\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":311,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-5\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":312,\"kind\":1024,\"name\":\"width\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-5.width\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":313,\"kind\":1024,\"name\":\"height\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-5.height\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":314,\"kind\":1024,\"name\":\"map\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-5.map\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":315,\"kind\":1024,\"name\":\"nodes\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-5.nodes\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":316,\"kind\":1024,\"name\":\"id\",\"url\":\"interfaces/types_chapter.SubChapter.html#id\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited\",\"parent\":\"types/chapter.SubChapter\"},{\"id\":317,\"kind\":2,\"name\":\"types/equipment\",\"url\":\"modules/types_equipment.html\",\"classes\":\"tsd-kind-module\"},{\"id\":318,\"kind\":256,\"name\":\"Equipment\",\"url\":\"interfaces/types_equipment.Equipment.html\",\"classes\":\"tsd-kind-interface tsd-parent-kind-module\",\"parent\":\"types/equipment\"},{\"id\":319,\"kind\":1024,\"name\":\"wikiUrl\",\"url\":\"interfaces/types_equipment.Equipment.html#wikiUrl\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/equipment.Equipment\"},{\"id\":320,\"kind\":1024,\"name\":\"category\",\"url\":\"interfaces/types_equipment.Equipment.html#category\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/equipment.Equipment\"},{\"id\":321,\"kind\":1024,\"name\":\"names\",\"url\":\"interfaces/types_equipment.Equipment.html#names\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/equipment.Equipment\"},{\"id\":322,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_equipment.Equipment.html#__type-1\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"types/equipment.Equipment\"},{\"id\":323,\"kind\":1024,\"name\":\"en\",\"url\":\"interfaces/types_equipment.Equipment.html#__type-1.en\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/equipment.Equipment.__type\"},{\"id\":324,\"kind\":1024,\"name\":\"cn\",\"url\":\"interfaces/types_equipment.Equipment.html#__type-1.cn\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/equipment.Equipment.__type\"},{\"id\":325,\"kind\":1024,\"name\":\"jp\",\"url\":\"interfaces/types_equipment.Equipment.html#__type-1.jp\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/equipment.Equipment.__type\"},{\"id\":326,\"kind\":1024,\"name\":\"kr\",\"url\":\"interfaces/types_equipment.Equipment.html#__type-1.kr\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/equipment.Equipment.__type\"},{\"id\":327,\"kind\":1024,\"name\":\"type\",\"url\":\"interfaces/types_equipment.Equipment.html#type\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/equipment.Equipment\"},{\"id\":328,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_equipment.Equipment.html#__type-3\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"types/equipment.Equipment\"},{\"id\":329,\"kind\":1024,\"name\":\"focus\",\"url\":\"interfaces/types_equipment.Equipment.html#__type-3.focus\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/equipment.Equipment.__type\"},{\"id\":330,\"kind\":1024,\"name\":\"name\",\"url\":\"interfaces/types_equipment.Equipment.html#__type-3.name\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/equipment.Equipment.__type\"},{\"id\":331,\"kind\":1024,\"name\":\"nationality\",\"url\":\"interfaces/types_equipment.Equipment.html#nationality\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/equipment.Equipment\"},{\"id\":332,\"kind\":1024,\"name\":\"image\",\"url\":\"interfaces/types_equipment.Equipment.html#image\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/equipment.Equipment\"},{\"id\":333,\"kind\":1024,\"name\":\"fits\",\"url\":\"interfaces/types_equipment.Equipment.html#fits\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/equipment.Equipment\"},{\"id\":334,\"kind\":1024,\"name\":\"misc\",\"url\":\"interfaces/types_equipment.Equipment.html#misc\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/equipment.Equipment\"},{\"id\":335,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_equipment.Equipment.html#__type\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"types/equipment.Equipment\"},{\"id\":336,\"kind\":1024,\"name\":\"obtainedFrom\",\"url\":\"interfaces/types_equipment.Equipment.html#__type.obtainedFrom\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/equipment.Equipment.__type\"},{\"id\":337,\"kind\":1024,\"name\":\"animation\",\"url\":\"interfaces/types_equipment.Equipment.html#__type.animation\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/equipment.Equipment.__type\"},{\"id\":338,\"kind\":1024,\"name\":\"tiers\",\"url\":\"interfaces/types_equipment.Equipment.html#tiers\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/equipment.Equipment\"},{\"id\":339,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_equipment.Equipment.html#__type-2\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"types/equipment.Equipment\"},{\"id\":340,\"kind\":1024,\"name\":\"T0\",\"url\":\"interfaces/types_equipment.Equipment.html#__type-2.T0\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/equipment.Equipment.__type\"},{\"id\":341,\"kind\":1024,\"name\":\"T1\",\"url\":\"interfaces/types_equipment.Equipment.html#__type-2.T1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/equipment.Equipment.__type\"},{\"id\":342,\"kind\":1024,\"name\":\"T2\",\"url\":\"interfaces/types_equipment.Equipment.html#__type-2.T2\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/equipment.Equipment.__type\"},{\"id\":343,\"kind\":1024,\"name\":\"T3\",\"url\":\"interfaces/types_equipment.Equipment.html#__type-2.T3\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/equipment.Equipment.__type\"},{\"id\":344,\"kind\":1024,\"name\":\"id\",\"url\":\"interfaces/types_equipment.Equipment.html#id\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited\",\"parent\":\"types/equipment.Equipment\"},{\"id\":345,\"kind\":2,\"name\":\"types/identifiable\",\"url\":\"modules/types_identifiable.html\",\"classes\":\"tsd-kind-module\"},{\"id\":346,\"kind\":256,\"name\":\"Identifiable\",\"url\":\"interfaces/types_identifiable.Identifiable.html\",\"classes\":\"tsd-kind-interface tsd-parent-kind-module\",\"parent\":\"types/identifiable\"},{\"id\":347,\"kind\":1024,\"name\":\"id\",\"url\":\"interfaces/types_identifiable.Identifiable.html#id\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/identifiable.Identifiable\"},{\"id\":348,\"kind\":2,\"name\":\"types/ship\",\"url\":\"modules/types_ship.html\",\"classes\":\"tsd-kind-module\"},{\"id\":349,\"kind\":256,\"name\":\"shipAdvancedOptions\",\"url\":\"interfaces/types_ship.shipAdvancedOptions.html\",\"classes\":\"tsd-kind-interface tsd-parent-kind-module\",\"parent\":\"types/ship\"},{\"id\":350,\"kind\":1024,\"name\":\"nameOnly\",\"url\":\"interfaces/types_ship.shipAdvancedOptions.html#nameOnly\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.shipAdvancedOptions\"},{\"id\":351,\"kind\":1024,\"name\":\"idOnly\",\"url\":\"interfaces/types_ship.shipAdvancedOptions.html#idOnly\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.shipAdvancedOptions\"},{\"id\":352,\"kind\":1024,\"name\":\"language\",\"url\":\"interfaces/types_ship.shipAdvancedOptions.html#language\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.shipAdvancedOptions\"},{\"id\":353,\"kind\":256,\"name\":\"Ship\",\"url\":\"interfaces/types_ship.Ship.html\",\"classes\":\"tsd-kind-interface tsd-parent-kind-module\",\"parent\":\"types/ship\"},{\"id\":354,\"kind\":1024,\"name\":\"wikiUrl\",\"url\":\"interfaces/types_ship.Ship.html#wikiUrl\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":355,\"kind\":1024,\"name\":\"names\",\"url\":\"interfaces/types_ship.Ship.html#names\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":356,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_ship.Ship.html#__type-6\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":357,\"kind\":1024,\"name\":\"code\",\"url\":\"interfaces/types_ship.Ship.html#__type-6.code\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":358,\"kind\":1024,\"name\":\"en\",\"url\":\"interfaces/types_ship.Ship.html#__type-6.en\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":359,\"kind\":1024,\"name\":\"cn\",\"url\":\"interfaces/types_ship.Ship.html#__type-6.cn\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":360,\"kind\":1024,\"name\":\"jp\",\"url\":\"interfaces/types_ship.Ship.html#__type-6.jp\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":361,\"kind\":1024,\"name\":\"kr\",\"url\":\"interfaces/types_ship.Ship.html#__type-6.kr\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":362,\"kind\":1024,\"name\":\"thumbnail\",\"url\":\"interfaces/types_ship.Ship.html#thumbnail\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":363,\"kind\":1024,\"name\":\"hexagon\",\"url\":\"interfaces/types_ship.Ship.html#hexagon\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":364,\"kind\":1024,\"name\":\"class\",\"url\":\"interfaces/types_ship.Ship.html#class\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":365,\"kind\":1024,\"name\":\"nationality\",\"url\":\"interfaces/types_ship.Ship.html#nationality\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":366,\"kind\":1024,\"name\":\"hullType\",\"url\":\"interfaces/types_ship.Ship.html#hullType\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":367,\"kind\":1024,\"name\":\"rarity\",\"url\":\"interfaces/types_ship.Ship.html#rarity\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":368,\"kind\":1024,\"name\":\"stars\",\"url\":\"interfaces/types_ship.Ship.html#stars\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":369,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_ship.Ship.html#__type-9\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":370,\"kind\":1024,\"name\":\"stars\",\"url\":\"interfaces/types_ship.Ship.html#__type-9.stars-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":371,\"kind\":1024,\"name\":\"value\",\"url\":\"interfaces/types_ship.Ship.html#__type-9.value\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":372,\"kind\":1024,\"name\":\"stats\",\"url\":\"interfaces/types_ship.Ship.html#stats\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":373,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_ship.Ship.html#__type-10\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":374,\"kind\":1024,\"name\":\"baseStats\",\"url\":\"interfaces/types_ship.Ship.html#__type-10.baseStats\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":375,\"kind\":1024,\"name\":\"level100\",\"url\":\"interfaces/types_ship.Ship.html#__type-10.level100\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":376,\"kind\":1024,\"name\":\"level120\",\"url\":\"interfaces/types_ship.Ship.html#__type-10.level120\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":377,\"kind\":1024,\"name\":\"level100Retrofit\",\"url\":\"interfaces/types_ship.Ship.html#__type-10.level100Retrofit\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":378,\"kind\":1024,\"name\":\"level120Retrofit\",\"url\":\"interfaces/types_ship.Ship.html#__type-10.level120Retrofit\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":379,\"kind\":1024,\"name\":\"slots\",\"url\":\"interfaces/types_ship.Ship.html#slots\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":380,\"kind\":1024,\"name\":\"enhanceValue\",\"url\":\"interfaces/types_ship.Ship.html#enhanceValue\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":381,\"kind\":1024,\"name\":\"scrapValue\",\"url\":\"interfaces/types_ship.Ship.html#scrapValue\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":382,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_ship.Ship.html#__type-8\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":383,\"kind\":1024,\"name\":\"coin\",\"url\":\"interfaces/types_ship.Ship.html#__type-8.coin\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":384,\"kind\":1024,\"name\":\"oil\",\"url\":\"interfaces/types_ship.Ship.html#__type-8.oil\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":385,\"kind\":1024,\"name\":\"medal\",\"url\":\"interfaces/types_ship.Ship.html#__type-8.medal\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":386,\"kind\":1024,\"name\":\"skills\",\"url\":\"interfaces/types_ship.Ship.html#skills\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":387,\"kind\":1024,\"name\":\"skins\",\"url\":\"interfaces/types_ship.Ship.html#skins\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":388,\"kind\":1024,\"name\":\"gallery\",\"url\":\"interfaces/types_ship.Ship.html#gallery\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":389,\"kind\":1024,\"name\":\"limitBreaks\",\"url\":\"interfaces/types_ship.Ship.html#limitBreaks\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":390,\"kind\":1024,\"name\":\"fleetTech\",\"url\":\"interfaces/types_ship.Ship.html#fleetTech\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":391,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_ship.Ship.html#__type-2\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":392,\"kind\":1024,\"name\":\"statsBonus\",\"url\":\"interfaces/types_ship.Ship.html#__type-2.statsBonus\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":393,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_ship.Ship.html#__type-2.__type-3\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":394,\"kind\":1024,\"name\":\"collection\",\"url\":\"interfaces/types_ship.Ship.html#__type-2.__type-3.collection\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type.__type\"},{\"id\":395,\"kind\":1024,\"name\":\"maxLevel\",\"url\":\"interfaces/types_ship.Ship.html#__type-2.__type-3.maxLevel\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type.__type\"},{\"id\":396,\"kind\":1024,\"name\":\"techPoints\",\"url\":\"interfaces/types_ship.Ship.html#__type-2.techPoints\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":397,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_ship.Ship.html#__type-2.__type-4\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":398,\"kind\":1024,\"name\":\"collection\",\"url\":\"interfaces/types_ship.Ship.html#__type-2.__type-4.collection-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type.__type\"},{\"id\":399,\"kind\":1024,\"name\":\"maxLimitBreak\",\"url\":\"interfaces/types_ship.Ship.html#__type-2.__type-4.maxLimitBreak\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type.__type\"},{\"id\":400,\"kind\":1024,\"name\":\"maxLevel\",\"url\":\"interfaces/types_ship.Ship.html#__type-2.__type-4.maxLevel-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type.__type\"},{\"id\":401,\"kind\":1024,\"name\":\"total\",\"url\":\"interfaces/types_ship.Ship.html#__type-2.__type-4.total\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type.__type\"},{\"id\":402,\"kind\":1024,\"name\":\"retrofit\",\"url\":\"interfaces/types_ship.Ship.html#retrofit\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":403,\"kind\":1024,\"name\":\"retrofitId\",\"url\":\"interfaces/types_ship.Ship.html#retrofitId\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":404,\"kind\":1024,\"name\":\"retrofitHullType\",\"url\":\"interfaces/types_ship.Ship.html#retrofitHullType\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":405,\"kind\":1024,\"name\":\"retrofitProjects\",\"url\":\"interfaces/types_ship.Ship.html#retrofitProjects\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":406,\"kind\":1024,\"name\":\"construction\",\"url\":\"interfaces/types_ship.Ship.html#construction\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":407,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_ship.Ship.html#__type\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":408,\"kind\":1024,\"name\":\"constructionTime\",\"url\":\"interfaces/types_ship.Ship.html#__type.constructionTime\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":409,\"kind\":1024,\"name\":\"availableIn\",\"url\":\"interfaces/types_ship.Ship.html#__type.availableIn\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":410,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_ship.Ship.html#__type.__type-1\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":411,\"kind\":1024,\"name\":\"light\",\"url\":\"interfaces/types_ship.Ship.html#__type.__type-1.light\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type.__type\"},{\"id\":412,\"kind\":1024,\"name\":\"heavy\",\"url\":\"interfaces/types_ship.Ship.html#__type.__type-1.heavy\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type.__type\"},{\"id\":413,\"kind\":1024,\"name\":\"aviation\",\"url\":\"interfaces/types_ship.Ship.html#__type.__type-1.aviation\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type.__type\"},{\"id\":414,\"kind\":1024,\"name\":\"limited\",\"url\":\"interfaces/types_ship.Ship.html#__type.__type-1.limited\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type.__type\"},{\"id\":415,\"kind\":1024,\"name\":\"exchange\",\"url\":\"interfaces/types_ship.Ship.html#__type.__type-1.exchange\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type.__type\"},{\"id\":416,\"kind\":1024,\"name\":\"obtainedFrom\",\"url\":\"interfaces/types_ship.Ship.html#obtainedFrom\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":417,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_ship.Ship.html#__type-7\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":418,\"kind\":1024,\"name\":\"obtainedFrom\",\"url\":\"interfaces/types_ship.Ship.html#__type-7.obtainedFrom-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":419,\"kind\":1024,\"name\":\"fromMaps\",\"url\":\"interfaces/types_ship.Ship.html#__type-7.fromMaps\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":420,\"kind\":1024,\"name\":\"misc\",\"url\":\"interfaces/types_ship.Ship.html#misc\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":421,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_ship.Ship.html#__type-5\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":422,\"kind\":1024,\"name\":\"artist\",\"url\":\"interfaces/types_ship.Ship.html#__type-5.artist\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":423,\"kind\":1024,\"name\":\"web\",\"url\":\"interfaces/types_ship.Ship.html#__type-5.web\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":424,\"kind\":1024,\"name\":\"pixiv\",\"url\":\"interfaces/types_ship.Ship.html#__type-5.pixiv\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":425,\"kind\":1024,\"name\":\"twitter\",\"url\":\"interfaces/types_ship.Ship.html#__type-5.twitter\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":426,\"kind\":1024,\"name\":\"voice\",\"url\":\"interfaces/types_ship.Ship.html#__type-5.voice\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":427,\"kind\":1024,\"name\":\"id\",\"url\":\"interfaces/types_ship.Ship.html#id\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited\",\"parent\":\"types/ship.Ship\"},{\"id\":428,\"kind\":2,\"name\":\"types/voiceline\",\"url\":\"modules/types_voiceline.html\",\"classes\":\"tsd-kind-module\"},{\"id\":429,\"kind\":256,\"name\":\"Voiceline\",\"url\":\"interfaces/types_voiceline.Voiceline.html\",\"classes\":\"tsd-kind-interface tsd-parent-kind-module\",\"parent\":\"types/voiceline\"},{\"id\":430,\"kind\":1024,\"name\":\"event\",\"url\":\"interfaces/types_voiceline.Voiceline.html#event\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/voiceline.Voiceline\"},{\"id\":431,\"kind\":1024,\"name\":\"en\",\"url\":\"interfaces/types_voiceline.Voiceline.html#en\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/voiceline.Voiceline\"},{\"id\":432,\"kind\":1024,\"name\":\"zh\",\"url\":\"interfaces/types_voiceline.Voiceline.html#zh\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/voiceline.Voiceline\"},{\"id\":433,\"kind\":1024,\"name\":\"jp\",\"url\":\"interfaces/types_voiceline.Voiceline.html#jp\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/voiceline.Voiceline\"},{\"id\":434,\"kind\":1024,\"name\":\"audio\",\"url\":\"interfaces/types_voiceline.Voiceline.html#audio\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/voiceline.Voiceline\"},{\"id\":435,\"kind\":1024,\"name\":\"id\",\"url\":\"interfaces/types_voiceline.Voiceline.html#id\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited\",\"parent\":\"types/voiceline.Voiceline\"},{\"id\":436,\"kind\":16777216,\"name\":\"Source\",\"url\":\"modules/index.html#Source\",\"classes\":\"tsd-kind-reference tsd-parent-kind-module\",\"parent\":\"index\"},{\"id\":437,\"kind\":16777216,\"name\":\"CacheOptions\",\"url\":\"modules/index.html#CacheOptions\",\"classes\":\"tsd-kind-reference tsd-parent-kind-module\",\"parent\":\"index\"},{\"id\":438,\"kind\":16777216,\"name\":\"instance\",\"url\":\"modules/index.html#instance\",\"classes\":\"tsd-kind-reference tsd-parent-kind-module\",\"parent\":\"index\"},{\"id\":439,\"kind\":16777216,\"name\":\"AzurAPI\",\"url\":\"modules/index.html#AzurAPI\",\"classes\":\"tsd-kind-reference tsd-parent-kind-module\",\"parent\":\"index\"}],\"index\":{\"version\":\"2.3.9\",\"fields\":[\"name\",\"parent\"],\"fieldVectors\":[[\"name/0\",[0,42.597]],[\"parent/0\",[]],[\"name/1\",[1,57.409]],[\"parent/1\",[0,4.149]],[\"name/2\",[2,48.85]],[\"parent/2\",[0,4.149]],[\"name/3\",[3,57.409]],[\"parent/3\",[0,4.149]],[\"name/4\",[4,52.249]],[\"parent/4\",[5,4.758]],[\"name/5\",[6,52.249]],[\"parent/5\",[5,4.758]],[\"name/6\",[2,48.85]],[\"parent/6\",[5,4.758]],[\"name/7\",[7,57.409]],[\"parent/7\",[0,4.149]],[\"name/8\",[8,25.168]],[\"parent/8\",[9,5.592]],[\"name/9\",[10,40.915,11,40.915]],[\"parent/9\",[12,3.175]],[\"name/10\",[13,40.915,14,40.915]],[\"parent/10\",[12,3.175]],[\"name/11\",[15,40.915,16,37.237]],[\"parent/11\",[12,3.175]],[\"name/12\",[17,40.915,18,40.915]],[\"parent/12\",[12,3.175]],[\"name/13\",[19,40.915,20,40.915]],[\"parent/13\",[12,3.175]],[\"name/14\",[21,40.915,22,40.915]],[\"parent/14\",[12,3.175]],[\"name/15\",[23,40.915,24,40.915]],[\"parent/15\",[12,3.175]],[\"name/16\",[25,40.915,26,40.915]],[\"parent/16\",[12,3.175]],[\"name/17\",[16,37.237,27,40.915]],[\"parent/17\",[12,3.175]],[\"name/18\",[28,57.409]],[\"parent/18\",[12,3.175]],[\"name/19\",[29,57.409]],[\"parent/19\",[12,3.175]],[\"name/20\",[30,40.915,31,40.915]],[\"parent/20\",[12,3.175]],[\"name/21\",[32,57.409]],[\"parent/21\",[12,3.175]],[\"name/22\",[33,40.915,34,40.915]],[\"parent/22\",[12,3.175]],[\"name/23\",[35,57.409]],[\"parent/23\",[12,3.175]],[\"name/24\",[36,57.409]],[\"parent/24\",[12,3.175]],[\"name/25\",[37,57.409]],[\"parent/25\",[12,3.175]],[\"name/26\",[38,52.249]],[\"parent/26\",[0,4.149]],[\"name/27\",[39,39.888]],[\"parent/27\",[40,3.43]],[\"name/28\",[41,42.597]],[\"parent/28\",[40,3.43]],[\"name/29\",[42,42.597]],[\"parent/29\",[40,3.43]],[\"name/30\",[43,52.249]],[\"parent/30\",[40,3.43]],[\"name/31\",[44,42.597]],[\"parent/31\",[40,3.43]],[\"name/32\",[45,42.597]],[\"parent/32\",[40,3.43]],[\"name/33\",[46,35.215]],[\"parent/33\",[40,3.43]],[\"name/34\",[47,42.597]],[\"parent/34\",[40,3.43]],[\"name/35\",[48,42.597]],[\"parent/35\",[40,3.43]],[\"name/36\",[49,39.888]],[\"parent/36\",[40,3.43]],[\"name/37\",[50,42.597]],[\"parent/37\",[40,3.43]],[\"name/38\",[51,42.597]],[\"parent/38\",[40,3.43]],[\"name/39\",[52,42.597]],[\"parent/39\",[40,3.43]],[\"name/40\",[53,52.249]],[\"parent/40\",[]],[\"name/41\",[54,44.285]],[\"parent/41\",[53,5.089]],[\"name/42\",[39,39.888]],[\"parent/42\",[55,3.233]],[\"name/43\",[56,42.597]],[\"parent/43\",[55,3.233]],[\"name/44\",[57,46.312]],[\"parent/44\",[55,3.233]],[\"name/45\",[58,46.312]],[\"parent/45\",[55,3.233]],[\"name/46\",[59,39.888]],[\"parent/46\",[55,3.233]],[\"name/47\",[41,42.597]],[\"parent/47\",[55,3.233]],[\"name/48\",[42,42.597]],[\"parent/48\",[55,3.233]],[\"name/49\",[44,42.597]],[\"parent/49\",[55,3.233]],[\"name/50\",[45,42.597]],[\"parent/50\",[55,3.233]],[\"name/51\",[46,35.215]],[\"parent/51\",[55,3.233]],[\"name/52\",[47,42.597]],[\"parent/52\",[55,3.233]],[\"name/53\",[48,42.597]],[\"parent/53\",[55,3.233]],[\"name/54\",[49,39.888]],[\"parent/54\",[55,3.233]],[\"name/55\",[50,42.597]],[\"parent/55\",[55,3.233]],[\"name/56\",[51,42.597]],[\"parent/56\",[55,3.233]],[\"name/57\",[52,42.597]],[\"parent/57\",[55,3.233]],[\"name/58\",[60,52.249]],[\"parent/58\",[]],[\"name/59\",[61,44.285]],[\"parent/59\",[60,5.089]],[\"name/60\",[39,39.888]],[\"parent/60\",[62,3.43]],[\"name/61\",[56,42.597]],[\"parent/61\",[62,3.43]],[\"name/62\",[41,42.597]],[\"parent/62\",[62,3.43]],[\"name/63\",[42,42.597]],[\"parent/63\",[62,3.43]],[\"name/64\",[44,42.597]],[\"parent/64\",[62,3.43]],[\"name/65\",[45,42.597]],[\"parent/65\",[62,3.43]],[\"name/66\",[46,35.215]],[\"parent/66\",[62,3.43]],[\"name/67\",[47,42.597]],[\"parent/67\",[62,3.43]],[\"name/68\",[48,42.597]],[\"parent/68\",[62,3.43]],[\"name/69\",[49,39.888]],[\"parent/69\",[62,3.43]],[\"name/70\",[50,42.597]],[\"parent/70\",[62,3.43]],[\"name/71\",[51,42.597]],[\"parent/71\",[62,3.43]],[\"name/72\",[52,42.597]],[\"parent/72\",[62,3.43]],[\"name/73\",[63,52.249]],[\"parent/73\",[]],[\"name/74\",[64,44.285]],[\"parent/74\",[63,5.089]],[\"name/75\",[39,39.888]],[\"parent/75\",[65,3.175]],[\"name/76\",[56,42.597]],[\"parent/76\",[65,3.175]],[\"name/77\",[66,52.249]],[\"parent/77\",[65,3.175]],[\"name/78\",[67,46.312]],[\"parent/78\",[65,3.175]],[\"name/79\",[68,52.249]],[\"parent/79\",[65,3.175]],[\"name/80\",[47,42.597]],[\"parent/80\",[65,3.175]],[\"name/81\",[69,52.249]],[\"parent/81\",[65,3.175]],[\"name/82\",[41,42.597]],[\"parent/82\",[65,3.175]],[\"name/83\",[42,42.597]],[\"parent/83\",[65,3.175]],[\"name/84\",[44,42.597]],[\"parent/84\",[65,3.175]],[\"name/85\",[45,42.597]],[\"parent/85\",[65,3.175]],[\"name/86\",[46,35.215]],[\"parent/86\",[65,3.175]],[\"name/87\",[48,42.597]],[\"parent/87\",[65,3.175]],[\"name/88\",[49,39.888]],[\"parent/88\",[65,3.175]],[\"name/89\",[50,42.597]],[\"parent/89\",[65,3.175]],[\"name/90\",[51,42.597]],[\"parent/90\",[65,3.175]],[\"name/91\",[52,42.597]],[\"parent/91\",[65,3.175]],[\"name/92\",[70,52.249]],[\"parent/92\",[]],[\"name/93\",[59,39.888]],[\"parent/93\",[70,5.089]],[\"name/94\",[39,39.888]],[\"parent/94\",[71,3.175]],[\"name/95\",[56,42.597]],[\"parent/95\",[71,3.175]],[\"name/96\",[58,46.312]],[\"parent/96\",[71,3.175]],[\"name/97\",[67,46.312]],[\"parent/97\",[71,3.175]],[\"name/98\",[68,52.249]],[\"parent/98\",[71,3.175]],[\"name/99\",[47,42.597]],[\"parent/99\",[71,3.175]],[\"name/100\",[69,52.249]],[\"parent/100\",[71,3.175]],[\"name/101\",[41,42.597]],[\"parent/101\",[71,3.175]],[\"name/102\",[42,42.597]],[\"parent/102\",[71,3.175]],[\"name/103\",[44,42.597]],[\"parent/103\",[71,3.175]],[\"name/104\",[45,42.597]],[\"parent/104\",[71,3.175]],[\"name/105\",[46,35.215]],[\"parent/105\",[71,3.175]],[\"name/106\",[48,42.597]],[\"parent/106\",[71,3.175]],[\"name/107\",[49,39.888]],[\"parent/107\",[71,3.175]],[\"name/108\",[50,42.597]],[\"parent/108\",[71,3.175]],[\"name/109\",[51,42.597]],[\"parent/109\",[71,3.175]],[\"name/110\",[52,42.597]],[\"parent/110\",[71,3.175]],[\"name/111\",[72,52.249]],[\"parent/111\",[]],[\"name/112\",[73,44.285]],[\"parent/112\",[72,5.089]],[\"name/113\",[39,39.888]],[\"parent/113\",[74,3.506]],[\"name/114\",[41,42.597]],[\"parent/114\",[74,3.506]],[\"name/115\",[42,42.597]],[\"parent/115\",[74,3.506]],[\"name/116\",[44,42.597]],[\"parent/116\",[74,3.506]],[\"name/117\",[45,42.597]],[\"parent/117\",[74,3.506]],[\"name/118\",[46,35.215]],[\"parent/118\",[74,3.506]],[\"name/119\",[47,42.597]],[\"parent/119\",[74,3.506]],[\"name/120\",[48,42.597]],[\"parent/120\",[74,3.506]],[\"name/121\",[49,39.888]],[\"parent/121\",[74,3.506]],[\"name/122\",[50,42.597]],[\"parent/122\",[74,3.506]],[\"name/123\",[51,42.597]],[\"parent/123\",[74,3.506]],[\"name/124\",[52,42.597]],[\"parent/124\",[74,3.506]],[\"name/125\",[75,52.249]],[\"parent/125\",[]],[\"name/126\",[38,52.249]],[\"parent/126\",[75,5.089]],[\"name/127\",[39,39.888]],[\"parent/127\",[76,3.885]],[\"name/128\",[77,57.409]],[\"parent/128\",[76,3.885]],[\"name/129\",[43,52.249]],[\"parent/129\",[76,3.885]],[\"name/130\",[78,57.409]],[\"parent/130\",[76,3.885]],[\"name/131\",[79,57.409]],[\"parent/131\",[76,3.885]],[\"name/132\",[80,57.409]],[\"parent/132\",[76,3.885]],[\"name/133\",[81,57.409]],[\"parent/133\",[76,3.885]],[\"name/134\",[82,57.409]],[\"parent/134\",[76,3.885]],[\"name/135\",[83,44.285]],[\"parent/135\",[]],[\"name/136\",[84,46.312]],[\"parent/136\",[83,4.313]],[\"name/137\",[85,52.249]],[\"parent/137\",[83,4.313]],[\"name/138\",[84,46.312]],[\"parent/138\",[86,4.758]],[\"name/139\",[87,52.249]],[\"parent/139\",[86,4.758]],[\"name/140\",[88,52.249]],[\"parent/140\",[86,4.758]],[\"name/141\",[89,52.249]],[\"parent/141\",[83,4.313]],[\"name/142\",[90,52.249]],[\"parent/142\",[83,4.313]],[\"name/143\",[39,39.888]],[\"parent/143\",[91,3.36]],[\"name/144\",[92,57.409]],[\"parent/144\",[91,3.36]],[\"name/145\",[84,46.312]],[\"parent/145\",[91,3.36]],[\"name/146\",[87,52.249]],[\"parent/146\",[91,3.36]],[\"name/147\",[88,52.249]],[\"parent/147\",[91,3.36]],[\"name/148\",[93,57.409]],[\"parent/148\",[91,3.36]],[\"name/149\",[59,39.888]],[\"parent/149\",[91,3.36]],[\"name/150\",[64,44.285]],[\"parent/150\",[91,3.36]],[\"name/151\",[61,44.285]],[\"parent/151\",[91,3.36]],[\"name/152\",[73,44.285]],[\"parent/152\",[91,3.36]],[\"name/153\",[54,44.285]],[\"parent/153\",[91,3.36]],[\"name/154\",[94,57.409]],[\"parent/154\",[91,3.36]],[\"name/155\",[8,25.168]],[\"parent/155\",[91,3.36]],[\"name/156\",[59,39.888]],[\"parent/156\",[95,4.313]],[\"name/157\",[64,44.285]],[\"parent/157\",[95,4.313]],[\"name/158\",[61,44.285]],[\"parent/158\",[95,4.313]],[\"name/159\",[73,44.285]],[\"parent/159\",[95,4.313]],[\"name/160\",[54,44.285]],[\"parent/160\",[95,4.313]],[\"name/161\",[96,57.409]],[\"parent/161\",[91,3.36]],[\"name/162\",[97,42.597]],[\"parent/162\",[]],[\"name/163\",[98,57.409]],[\"parent/163\",[97,4.149]],[\"name/164\",[8,25.168]],[\"parent/164\",[99,5.592]],[\"name/165\",[100,57.409]],[\"parent/165\",[101,3.885]],[\"name/166\",[59,39.888]],[\"parent/166\",[101,3.885]],[\"name/167\",[64,44.285]],[\"parent/167\",[101,3.885]],[\"name/168\",[61,44.285]],[\"parent/168\",[101,3.885]],[\"name/169\",[73,44.285]],[\"parent/169\",[101,3.885]],[\"name/170\",[54,44.285]],[\"parent/170\",[101,3.885]],[\"name/171\",[102,52.249]],[\"parent/171\",[101,3.885]],[\"name/172\",[103,52.249]],[\"parent/172\",[101,3.885]],[\"name/173\",[104,57.409]],[\"parent/173\",[97,4.149]],[\"name/174\",[8,25.168]],[\"parent/174\",[105,5.592]],[\"name/175\",[59,39.888]],[\"parent/175\",[106,4.008]],[\"name/176\",[64,44.285]],[\"parent/176\",[106,4.008]],[\"name/177\",[61,44.285]],[\"parent/177\",[106,4.008]],[\"name/178\",[73,44.285]],[\"parent/178\",[106,4.008]],[\"name/179\",[54,44.285]],[\"parent/179\",[106,4.008]],[\"name/180\",[102,52.249]],[\"parent/180\",[106,4.008]],[\"name/181\",[103,52.249]],[\"parent/181\",[106,4.008]],[\"name/182\",[107,57.409]],[\"parent/182\",[97,4.149]],[\"name/183\",[108,57.409]],[\"parent/183\",[97,4.149]],[\"name/184\",[109,57.409]],[\"parent/184\",[97,4.149]],[\"name/185\",[110,46.312]],[\"parent/185\",[]],[\"name/186\",[111,57.409]],[\"parent/186\",[110,4.511]],[\"name/187\",[112,57.409]],[\"parent/187\",[110,4.511]],[\"name/188\",[113,57.409]],[\"parent/188\",[110,4.511]],[\"name/189\",[114,44.285]],[\"parent/189\",[]],[\"name/190\",[115,41.152]],[\"parent/190\",[]],[\"name/191\",[116,57.409]],[\"parent/191\",[115,4.008]],[\"name/192\",[59,39.888]],[\"parent/192\",[115,4.008]],[\"name/193\",[58,46.312]],[\"parent/193\",[115,4.008]],[\"name/194\",[117,57.409]],[\"parent/194\",[115,4.008]],[\"name/195\",[118,52.249]],[\"parent/195\",[115,4.008]],[\"name/196\",[57,46.312]],[\"parent/196\",[119,4.511]],[\"name/197\",[120,57.409]],[\"parent/197\",[119,4.511]],[\"name/198\",[121,57.409]],[\"parent/198\",[119,4.511]],[\"name/199\",[122,57.409]],[\"parent/199\",[119,4.511]],[\"name/200\",[123,57.409]],[\"parent/200\",[115,4.008]],[\"name/201\",[57,46.312]],[\"parent/201\",[124,4.008]],[\"name/202\",[125,57.409]],[\"parent/202\",[124,4.008]],[\"name/203\",[56,42.597]],[\"parent/203\",[124,4.008]],[\"name/204\",[59,39.888]],[\"parent/204\",[124,4.008]],[\"name/205\",[58,46.312]],[\"parent/205\",[124,4.008]],[\"name/206\",[118,52.249]],[\"parent/206\",[124,4.008]],[\"name/207\",[46,35.215]],[\"parent/207\",[124,4.008]],[\"name/208\",[126,48.85]],[\"parent/208\",[]],[\"name/209\",[127,57.409]],[\"parent/209\",[126,4.758]],[\"name/210\",[128,57.409]],[\"parent/210\",[129,4.008]],[\"name/211\",[130,57.409]],[\"parent/211\",[129,4.008]],[\"name/212\",[131,57.409]],[\"parent/212\",[129,4.008]],[\"name/213\",[132,57.409]],[\"parent/213\",[129,4.008]],[\"name/214\",[133,46.312]],[\"parent/214\",[129,4.008]],[\"name/215\",[8,25.168]],[\"parent/215\",[129,4.008]],[\"name/216\",[134,44.285]],[\"parent/216\",[135,4.758]],[\"name/217\",[136,46.312]],[\"parent/217\",[135,4.758]],[\"name/218\",[137,44.285]],[\"parent/218\",[135,4.758]],[\"name/219\",[46,35.215]],[\"parent/219\",[129,4.008]],[\"name/220\",[138,57.409]],[\"parent/220\",[126,4.758]],[\"name/221\",[133,46.312]],[\"parent/221\",[139,4.008]],[\"name/222\",[8,25.168]],[\"parent/222\",[139,4.008]],[\"name/223\",[134,44.285]],[\"parent/223\",[140,2.152]],[\"name/224\",[136,46.312]],[\"parent/224\",[140,2.152]],[\"name/225\",[137,44.285]],[\"parent/225\",[140,2.152]],[\"name/226\",[141,57.409]],[\"parent/226\",[139,4.008]],[\"name/227\",[8,25.168]],[\"parent/227\",[139,4.008]],[\"name/228\",[142,52.249]],[\"parent/228\",[140,2.152]],[\"name/229\",[143,48.85]],[\"parent/229\",[140,2.152]],[\"name/230\",[144,52.249]],[\"parent/230\",[140,2.152]],[\"name/231\",[145,52.249]],[\"parent/231\",[140,2.152]],[\"name/232\",[8,25.168]],[\"parent/232\",[140,2.152]],[\"name/233\",[146,52.249]],[\"parent/233\",[147,2.349]],[\"name/234\",[148,52.249]],[\"parent/234\",[147,2.349]],[\"name/235\",[149,57.409]],[\"parent/235\",[140,2.152]],[\"name/236\",[8,25.168]],[\"parent/236\",[140,2.152]],[\"name/237\",[150,57.409]],[\"parent/237\",[147,2.349]],[\"name/238\",[151,52.249]],[\"parent/238\",[147,2.349]],[\"name/239\",[152,52.249]],[\"parent/239\",[147,2.349]],[\"name/240\",[153,52.249]],[\"parent/240\",[140,2.152]],[\"name/241\",[154,52.249]],[\"parent/241\",[140,2.152]],[\"name/242\",[8,25.168]],[\"parent/242\",[140,2.152]],[\"name/243\",[155,52.249]],[\"parent/243\",[147,2.349]],[\"name/244\",[156,52.249]],[\"parent/244\",[147,2.349]],[\"name/245\",[157,52.249]],[\"parent/245\",[147,2.349]],[\"name/246\",[158,52.249]],[\"parent/246\",[140,2.152]],[\"name/247\",[8,25.168]],[\"parent/247\",[140,2.152]],[\"name/248\",[159,52.249]],[\"parent/248\",[147,2.349]],[\"name/249\",[160,52.249]],[\"parent/249\",[147,2.349]],[\"name/250\",[161,52.249]],[\"parent/250\",[147,2.349]],[\"name/251\",[162,52.249]],[\"parent/251\",[147,2.349]],[\"name/252\",[163,52.249]],[\"parent/252\",[140,2.152]],[\"name/253\",[164,52.249]],[\"parent/253\",[140,2.152]],[\"name/254\",[165,52.249]],[\"parent/254\",[140,2.152]],[\"name/255\",[166,52.249]],[\"parent/255\",[140,2.152]],[\"name/256\",[8,25.168]],[\"parent/256\",[140,2.152]],[\"name/257\",[167,52.249]],[\"parent/257\",[147,2.349]],[\"name/258\",[168,52.249]],[\"parent/258\",[147,2.349]],[\"name/259\",[169,52.249]],[\"parent/259\",[147,2.349]],[\"name/260\",[170,52.249]],[\"parent/260\",[140,2.152]],[\"name/261\",[171,52.249]],[\"parent/261\",[140,2.152]],[\"name/262\",[172,52.249]],[\"parent/262\",[140,2.152]],[\"name/263\",[173,52.249]],[\"parent/263\",[140,2.152]],[\"name/264\",[8,25.168]],[\"parent/264\",[140,2.152]],[\"name/265\",[174,52.249]],[\"parent/265\",[147,2.349]],[\"name/266\",[175,52.249]],[\"parent/266\",[147,2.349]],[\"name/267\",[49,39.888]],[\"parent/267\",[147,2.349]],[\"name/268\",[176,52.249]],[\"parent/268\",[147,2.349]],[\"name/269\",[177,57.409]],[\"parent/269\",[139,4.008]],[\"name/270\",[8,25.168]],[\"parent/270\",[139,4.008]],[\"name/271\",[142,52.249]],[\"parent/271\",[140,2.152]],[\"name/272\",[143,48.85]],[\"parent/272\",[140,2.152]],[\"name/273\",[144,52.249]],[\"parent/273\",[140,2.152]],[\"name/274\",[145,52.249]],[\"parent/274\",[140,2.152]],[\"name/275\",[8,25.168]],[\"parent/275\",[140,2.152]],[\"name/276\",[146,52.249]],[\"parent/276\",[147,2.349]],[\"name/277\",[148,52.249]],[\"parent/277\",[147,2.349]],[\"name/278\",[153,52.249]],[\"parent/278\",[140,2.152]],[\"name/279\",[154,52.249]],[\"parent/279\",[140,2.152]],[\"name/280\",[8,25.168]],[\"parent/280\",[140,2.152]],[\"name/281\",[155,52.249]],[\"parent/281\",[147,2.349]],[\"name/282\",[156,52.249]],[\"parent/282\",[147,2.349]],[\"name/283\",[157,52.249]],[\"parent/283\",[147,2.349]],[\"name/284\",[158,52.249]],[\"parent/284\",[140,2.152]],[\"name/285\",[8,25.168]],[\"parent/285\",[140,2.152]],[\"name/286\",[159,52.249]],[\"parent/286\",[147,2.349]],[\"name/287\",[160,52.249]],[\"parent/287\",[147,2.349]],[\"name/288\",[161,52.249]],[\"parent/288\",[147,2.349]],[\"name/289\",[162,52.249]],[\"parent/289\",[147,2.349]],[\"name/290\",[163,52.249]],[\"parent/290\",[140,2.152]],[\"name/291\",[164,52.249]],[\"parent/291\",[140,2.152]],[\"name/292\",[165,52.249]],[\"parent/292\",[140,2.152]],[\"name/293\",[166,52.249]],[\"parent/293\",[140,2.152]],[\"name/294\",[8,25.168]],[\"parent/294\",[140,2.152]],[\"name/295\",[167,52.249]],[\"parent/295\",[147,2.349]],[\"name/296\",[168,52.249]],[\"parent/296\",[147,2.349]],[\"name/297\",[169,52.249]],[\"parent/297\",[147,2.349]],[\"name/298\",[178,57.409]],[\"parent/298\",[140,2.152]],[\"name/299\",[8,25.168]],[\"parent/299\",[140,2.152]],[\"name/300\",[179,57.409]],[\"parent/300\",[147,2.349]],[\"name/301\",[180,57.409]],[\"parent/301\",[147,2.349]],[\"name/302\",[181,57.409]],[\"parent/302\",[140,2.152]],[\"name/303\",[8,25.168]],[\"parent/303\",[140,2.152]],[\"name/304\",[182,57.409]],[\"parent/304\",[147,2.349]],[\"name/305\",[183,57.409]],[\"parent/305\",[147,2.349]],[\"name/306\",[184,52.249]],[\"parent/306\",[147,2.349]],[\"name/307\",[170,52.249]],[\"parent/307\",[140,2.152]],[\"name/308\",[171,52.249]],[\"parent/308\",[140,2.152]],[\"name/309\",[172,52.249]],[\"parent/309\",[140,2.152]],[\"name/310\",[173,52.249]],[\"parent/310\",[140,2.152]],[\"name/311\",[8,25.168]],[\"parent/311\",[140,2.152]],[\"name/312\",[174,52.249]],[\"parent/312\",[147,2.349]],[\"name/313\",[175,52.249]],[\"parent/313\",[147,2.349]],[\"name/314\",[49,39.888]],[\"parent/314\",[147,2.349]],[\"name/315\",[176,52.249]],[\"parent/315\",[147,2.349]],[\"name/316\",[46,35.215]],[\"parent/316\",[139,4.008]],[\"name/317\",[185,52.249]],[\"parent/317\",[]],[\"name/318\",[186,57.409]],[\"parent/318\",[185,5.089]],[\"name/319\",[187,52.249]],[\"parent/319\",[188,3.36]],[\"name/320\",[66,52.249]],[\"parent/320\",[188,3.36]],[\"name/321\",[133,46.312]],[\"parent/321\",[188,3.36]],[\"name/322\",[8,25.168]],[\"parent/322\",[188,3.36]],[\"name/323\",[134,44.285]],[\"parent/323\",[189,3.506]],[\"name/324\",[136,46.312]],[\"parent/324\",[189,3.506]],[\"name/325\",[137,44.285]],[\"parent/325\",[189,3.506]],[\"name/326\",[190,52.249]],[\"parent/326\",[189,3.506]],[\"name/327\",[57,46.312]],[\"parent/327\",[188,3.36]],[\"name/328\",[8,25.168]],[\"parent/328\",[188,3.36]],[\"name/329\",[191,57.409]],[\"parent/329\",[189,3.506]],[\"name/330\",[56,42.597]],[\"parent/330\",[189,3.506]],[\"name/331\",[67,46.312]],[\"parent/331\",[188,3.36]],[\"name/332\",[192,57.409]],[\"parent/332\",[188,3.36]],[\"name/333\",[193,57.409]],[\"parent/333\",[188,3.36]],[\"name/334\",[194,52.249]],[\"parent/334\",[188,3.36]],[\"name/335\",[8,25.168]],[\"parent/335\",[188,3.36]],[\"name/336\",[195,48.85]],[\"parent/336\",[189,3.506]],[\"name/337\",[196,57.409]],[\"parent/337\",[189,3.506]],[\"name/338\",[197,57.409]],[\"parent/338\",[188,3.36]],[\"name/339\",[8,25.168]],[\"parent/339\",[188,3.36]],[\"name/340\",[198,57.409]],[\"parent/340\",[189,3.506]],[\"name/341\",[199,57.409]],[\"parent/341\",[189,3.506]],[\"name/342\",[200,57.409]],[\"parent/342\",[189,3.506]],[\"name/343\",[201,57.409]],[\"parent/343\",[189,3.506]],[\"name/344\",[46,35.215]],[\"parent/344\",[188,3.36]],[\"name/345\",[202,52.249]],[\"parent/345\",[]],[\"name/346\",[203,57.409]],[\"parent/346\",[202,5.089]],[\"name/347\",[46,35.215]],[\"parent/347\",[204,5.592]],[\"name/348\",[205,48.85]],[\"parent/348\",[]],[\"name/349\",[206,57.409]],[\"parent/349\",[205,4.758]],[\"name/350\",[4,52.249]],[\"parent/350\",[207,4.758]],[\"name/351\",[6,52.249]],[\"parent/351\",[207,4.758]],[\"name/352\",[2,48.85]],[\"parent/352\",[207,4.758]],[\"name/353\",[152,52.249]],[\"parent/353\",[205,4.758]],[\"name/354\",[187,52.249]],[\"parent/354\",[208,2.507]],[\"name/355\",[133,46.312]],[\"parent/355\",[208,2.507]],[\"name/356\",[8,25.168]],[\"parent/356\",[208,2.507]],[\"name/357\",[143,48.85]],[\"parent/357\",[209,2.661]],[\"name/358\",[134,44.285]],[\"parent/358\",[209,2.661]],[\"name/359\",[136,46.312]],[\"parent/359\",[209,2.661]],[\"name/360\",[137,44.285]],[\"parent/360\",[209,2.661]],[\"name/361\",[190,52.249]],[\"parent/361\",[209,2.661]],[\"name/362\",[210,57.409]],[\"parent/362\",[208,2.507]],[\"name/363\",[211,57.409]],[\"parent/363\",[208,2.507]],[\"name/364\",[212,57.409]],[\"parent/364\",[208,2.507]],[\"name/365\",[67,46.312]],[\"parent/365\",[208,2.507]],[\"name/366\",[213,57.409]],[\"parent/366\",[208,2.507]],[\"name/367\",[214,57.409]],[\"parent/367\",[208,2.507]],[\"name/368\",[215,52.249]],[\"parent/368\",[208,2.507]],[\"name/369\",[8,25.168]],[\"parent/369\",[208,2.507]],[\"name/370\",[215,52.249]],[\"parent/370\",[209,2.661]],[\"name/371\",[216,57.409]],[\"parent/371\",[209,2.661]],[\"name/372\",[217,57.409]],[\"parent/372\",[208,2.507]],[\"name/373\",[8,25.168]],[\"parent/373\",[208,2.507]],[\"name/374\",[218,57.409]],[\"parent/374\",[209,2.661]],[\"name/375\",[219,57.409]],[\"parent/375\",[209,2.661]],[\"name/376\",[220,57.409]],[\"parent/376\",[209,2.661]],[\"name/377\",[221,57.409]],[\"parent/377\",[209,2.661]],[\"name/378\",[222,57.409]],[\"parent/378\",[209,2.661]],[\"name/379\",[223,57.409]],[\"parent/379\",[208,2.507]],[\"name/380\",[224,57.409]],[\"parent/380\",[208,2.507]],[\"name/381\",[225,57.409]],[\"parent/381\",[208,2.507]],[\"name/382\",[8,25.168]],[\"parent/382\",[208,2.507]],[\"name/383\",[151,52.249]],[\"parent/383\",[209,2.661]],[\"name/384\",[226,57.409]],[\"parent/384\",[209,2.661]],[\"name/385\",[227,57.409]],[\"parent/385\",[209,2.661]],[\"name/386\",[228,57.409]],[\"parent/386\",[208,2.507]],[\"name/387\",[229,57.409]],[\"parent/387\",[208,2.507]],[\"name/388\",[230,57.409]],[\"parent/388\",[208,2.507]],[\"name/389\",[231,57.409]],[\"parent/389\",[208,2.507]],[\"name/390\",[232,57.409]],[\"parent/390\",[208,2.507]],[\"name/391\",[8,25.168]],[\"parent/391\",[208,2.507]],[\"name/392\",[233,57.409]],[\"parent/392\",[209,2.661]],[\"name/393\",[8,25.168]],[\"parent/393\",[209,2.661]],[\"name/394\",[234,52.249]],[\"parent/394\",[235,3.588]],[\"name/395\",[236,52.249]],[\"parent/395\",[235,3.588]],[\"name/396\",[237,57.409]],[\"parent/396\",[209,2.661]],[\"name/397\",[8,25.168]],[\"parent/397\",[209,2.661]],[\"name/398\",[234,52.249]],[\"parent/398\",[235,3.588]],[\"name/399\",[238,57.409]],[\"parent/399\",[235,3.588]],[\"name/400\",[236,52.249]],[\"parent/400\",[235,3.588]],[\"name/401\",[239,57.409]],[\"parent/401\",[235,3.588]],[\"name/402\",[240,57.409]],[\"parent/402\",[208,2.507]],[\"name/403\",[241,57.409]],[\"parent/403\",[208,2.507]],[\"name/404\",[242,57.409]],[\"parent/404\",[208,2.507]],[\"name/405\",[243,57.409]],[\"parent/405\",[208,2.507]],[\"name/406\",[244,57.409]],[\"parent/406\",[208,2.507]],[\"name/407\",[8,25.168]],[\"parent/407\",[208,2.507]],[\"name/408\",[245,57.409]],[\"parent/408\",[209,2.661]],[\"name/409\",[246,57.409]],[\"parent/409\",[209,2.661]],[\"name/410\",[8,25.168]],[\"parent/410\",[209,2.661]],[\"name/411\",[247,57.409]],[\"parent/411\",[235,3.588]],[\"name/412\",[248,57.409]],[\"parent/412\",[235,3.588]],[\"name/413\",[184,52.249]],[\"parent/413\",[235,3.588]],[\"name/414\",[249,57.409]],[\"parent/414\",[235,3.588]],[\"name/415\",[250,57.409]],[\"parent/415\",[235,3.588]],[\"name/416\",[195,48.85]],[\"parent/416\",[208,2.507]],[\"name/417\",[8,25.168]],[\"parent/417\",[208,2.507]],[\"name/418\",[195,48.85]],[\"parent/418\",[209,2.661]],[\"name/419\",[251,57.409]],[\"parent/419\",[209,2.661]],[\"name/420\",[194,52.249]],[\"parent/420\",[208,2.507]],[\"name/421\",[8,25.168]],[\"parent/421\",[208,2.507]],[\"name/422\",[252,57.409]],[\"parent/422\",[209,2.661]],[\"name/423\",[253,57.409]],[\"parent/423\",[209,2.661]],[\"name/424\",[254,57.409]],[\"parent/424\",[209,2.661]],[\"name/425\",[255,57.409]],[\"parent/425\",[209,2.661]],[\"name/426\",[256,57.409]],[\"parent/426\",[209,2.661]],[\"name/427\",[46,35.215]],[\"parent/427\",[208,2.507]],[\"name/428\",[257,52.249]],[\"parent/428\",[]],[\"name/429\",[258,57.409]],[\"parent/429\",[257,5.089]],[\"name/430\",[259,57.409]],[\"parent/430\",[260,4.149]],[\"name/431\",[134,44.285]],[\"parent/431\",[260,4.149]],[\"name/432\",[261,57.409]],[\"parent/432\",[260,4.149]],[\"name/433\",[137,44.285]],[\"parent/433\",[260,4.149]],[\"name/434\",[262,57.409]],[\"parent/434\",[260,4.149]],[\"name/435\",[46,35.215]],[\"parent/435\",[260,4.149]],[\"name/436\",[84,46.312]],[\"parent/436\",[114,4.313]],[\"name/437\",[85,52.249]],[\"parent/437\",[114,4.313]],[\"name/438\",[89,52.249]],[\"parent/438\",[114,4.313]],[\"name/439\",[90,52.249]],[\"parent/439\",[114,4.313]]],\"invertedIndex\":[[\"1\",{\"_index\":128,\"name\":{\"210\":{}},\"parent\":{}}],[\"2\",{\"_index\":130,\"name\":{\"211\":{}},\"parent\":{}}],[\"3\",{\"_index\":131,\"name\":{\"212\":{}},\"parent\":{}}],[\"4\",{\"_index\":132,\"name\":{\"213\":{}},\"parent\":{}}],[\"__type\",{\"_index\":8,\"name\":{\"8\":{},\"155\":{},\"164\":{},\"174\":{},\"215\":{},\"222\":{},\"227\":{},\"232\":{},\"236\":{},\"242\":{},\"247\":{},\"256\":{},\"264\":{},\"270\":{},\"275\":{},\"280\":{},\"285\":{},\"294\":{},\"299\":{},\"303\":{},\"311\":{},\"322\":{},\"328\":{},\"335\":{},\"339\":{},\"356\":{},\"369\":{},\"373\":{},\"382\":{},\"391\":{},\"393\":{},\"397\":{},\"407\":{},\"410\":{},\"417\":{},\"421\":{}},\"parent\":{}}],[\"_nameall\",{\"_index\":68,\"name\":{\"79\":{},\"98\":{}},\"parent\":{}}],[\"actual\",{\"_index\":167,\"name\":{\"257\":{},\"295\":{}},\"parent\":{}}],[\"advancedoptions\",{\"_index\":3,\"name\":{\"3\":{}},\"parent\":{}}],[\"ai\",{\"_index\":34,\"name\":{\"22\":{}},\"parent\":{}}],[\"airsupremacy\",{\"_index\":166,\"name\":{\"255\":{},\"293\":{}},\"parent\":{}}],[\"all\",{\"_index\":69,\"name\":{\"81\":{},\"100\":{}},\"parent\":{}}],[\"animation\",{\"_index\":196,\"name\":{\"337\":{}},\"parent\":{}}],[\"apis\",{\"_index\":94,\"name\":{\"154\":{}},\"parent\":{}}],[\"artist\",{\"_index\":252,\"name\":{\"422\":{}},\"parent\":{}}],[\"audio\",{\"_index\":262,\"name\":{\"434\":{}},\"parent\":{}}],[\"autoupdate\",{\"_index\":87,\"name\":{\"139\":{},\"146\":{}},\"parent\":{}}],[\"availablein\",{\"_index\":246,\"name\":{\"409\":{}},\"parent\":{}}],[\"averagelevel\",{\"_index\":182,\"name\":{\"304\":{}},\"parent\":{}}],[\"aviation\",{\"_index\":184,\"name\":{\"306\":{},\"413\":{}},\"parent\":{}}],[\"azurapi\",{\"_index\":90,\"name\":{\"142\":{},\"439\":{}},\"parent\":{}}],[\"barrage\",{\"_index\":123,\"name\":{\"200\":{}},\"parent\":{}}],[\"barrages\",{\"_index\":54,\"name\":{\"41\":{},\"153\":{},\"160\":{},\"170\":{},\"179\":{}},\"parent\":{}}],[\"basefolder\",{\"_index\":108,\"name\":{\"183\":{}},\"parent\":{}}],[\"basestats\",{\"_index\":218,\"name\":{\"374\":{}},\"parent\":{}}],[\"basexp\",{\"_index\":158,\"name\":{\"246\":{},\"284\":{}},\"parent\":{}}],[\"bilibili\",{\"_index\":29,\"name\":{\"19\":{}},\"parent\":{}}],[\"blood\",{\"_index\":18,\"name\":{\"12\":{}},\"parent\":{}}],[\"boss\",{\"_index\":157,\"name\":{\"245\":{},\"283\":{}},\"parent\":{}}],[\"bossfleet\",{\"_index\":162,\"name\":{\"251\":{},\"289\":{}},\"parent\":{}}],[\"bosskillstoclear\",{\"_index\":164,\"name\":{\"253\":{},\"291\":{}},\"parent\":{}}],[\"bosslevel\",{\"_index\":156,\"name\":{\"244\":{},\"282\":{}},\"parent\":{}}],[\"cacheoptions\",{\"_index\":85,\"name\":{\"137\":{},\"437\":{}},\"parent\":{}}],[\"category\",{\"_index\":66,\"name\":{\"77\":{},\"320\":{}},\"parent\":{}}],[\"chapter\",{\"_index\":127,\"name\":{\"209\":{}},\"parent\":{}}],[\"chapters\",{\"_index\":61,\"name\":{\"59\":{},\"151\":{},\"158\":{},\"168\":{},\"177\":{}},\"parent\":{}}],[\"check\",{\"_index\":111,\"name\":{\"186\":{}},\"parent\":{}}],[\"class\",{\"_index\":212,\"name\":{\"364\":{}},\"parent\":{}}],[\"clearrewards\",{\"_index\":149,\"name\":{\"235\":{}},\"parent\":{}}],[\"client\",{\"_index\":43,\"name\":{\"30\":{},\"129\":{}},\"parent\":{}}],[\"cn\",{\"_index\":136,\"name\":{\"217\":{},\"224\":{},\"324\":{},\"359\":{}},\"parent\":{}}],[\"code\",{\"_index\":143,\"name\":{\"229\":{},\"272\":{},\"357\":{}},\"parent\":{}}],[\"coin\",{\"_index\":151,\"name\":{\"238\":{},\"383\":{}},\"parent\":{}}],[\"collection\",{\"_index\":234,\"name\":{\"394\":{},\"398\":{}},\"parent\":{}}],[\"construction\",{\"_index\":244,\"name\":{\"406\":{}},\"parent\":{}}],[\"constructiontime\",{\"_index\":245,\"name\":{\"408\":{}},\"parent\":{}}],[\"constructor\",{\"_index\":39,\"name\":{\"27\":{},\"42\":{},\"60\":{},\"75\":{},\"94\":{},\"113\":{},\"127\":{},\"143\":{}},\"parent\":{}}],[\"core/api/api\",{\"_index\":0,\"name\":{\"0\":{}},\"parent\":{\"1\":{},\"2\":{},\"3\":{},\"7\":{},\"26\":{}}}],[\"core/api/api.advancedoptions\",{\"_index\":5,\"name\":{},\"parent\":{\"4\":{},\"5\":{},\"6\":{}}}],[\"core/api/api.default\",{\"_index\":40,\"name\":{},\"parent\":{\"27\":{},\"28\":{},\"29\":{},\"30\":{},\"31\":{},\"32\":{},\"33\":{},\"34\":{},\"35\":{},\"36\":{},\"37\":{},\"38\":{},\"39\":{}}}],[\"core/api/api.nations\",{\"_index\":9,\"name\":{},\"parent\":{\"8\":{}}}],[\"core/api/api.nations.__type\",{\"_index\":12,\"name\":{},\"parent\":{\"9\":{},\"10\":{},\"11\":{},\"12\":{},\"13\":{},\"14\":{},\"15\":{},\"16\":{},\"17\":{},\"18\":{},\"19\":{},\"20\":{},\"21\":{},\"22\":{},\"23\":{},\"24\":{},\"25\":{}}}],[\"core/api/api_barrage\",{\"_index\":53,\"name\":{\"40\":{}},\"parent\":{\"41\":{}}}],[\"core/api/api_barrage.barrages\",{\"_index\":55,\"name\":{},\"parent\":{\"42\":{},\"43\":{},\"44\":{},\"45\":{},\"46\":{},\"47\":{},\"48\":{},\"49\":{},\"50\":{},\"51\":{},\"52\":{},\"53\":{},\"54\":{},\"55\":{},\"56\":{},\"57\":{}}}],[\"core/api/api_chapter\",{\"_index\":60,\"name\":{\"58\":{}},\"parent\":{\"59\":{}}}],[\"core/api/api_chapter.chapters\",{\"_index\":62,\"name\":{},\"parent\":{\"60\":{},\"61\":{},\"62\":{},\"63\":{},\"64\":{},\"65\":{},\"66\":{},\"67\":{},\"68\":{},\"69\":{},\"70\":{},\"71\":{},\"72\":{}}}],[\"core/api/api_equipment\",{\"_index\":63,\"name\":{\"73\":{}},\"parent\":{\"74\":{}}}],[\"core/api/api_equipment.equipments\",{\"_index\":65,\"name\":{},\"parent\":{\"75\":{},\"76\":{},\"77\":{},\"78\":{},\"79\":{},\"80\":{},\"81\":{},\"82\":{},\"83\":{},\"84\":{},\"85\":{},\"86\":{},\"87\":{},\"88\":{},\"89\":{},\"90\":{},\"91\":{}}}],[\"core/api/api_ship\",{\"_index\":70,\"name\":{\"92\":{}},\"parent\":{\"93\":{}}}],[\"core/api/api_ship.ships\",{\"_index\":71,\"name\":{},\"parent\":{\"94\":{},\"95\":{},\"96\":{},\"97\":{},\"98\":{},\"99\":{},\"100\":{},\"101\":{},\"102\":{},\"103\":{},\"104\":{},\"105\":{},\"106\":{},\"107\":{},\"108\":{},\"109\":{},\"110\":{}}}],[\"core/api/api_voiceline\",{\"_index\":72,\"name\":{\"111\":{}},\"parent\":{\"112\":{}}}],[\"core/api/api_voiceline.voicelines\",{\"_index\":74,\"name\":{},\"parent\":{\"113\":{},\"114\":{},\"115\":{},\"116\":{},\"117\":{},\"118\":{},\"119\":{},\"120\":{},\"121\":{},\"122\":{},\"123\":{},\"124\":{}}}],[\"core/cacheupdater\",{\"_index\":75,\"name\":{\"125\":{}},\"parent\":{\"126\":{}}}],[\"core/cacheupdater.default\",{\"_index\":76,\"name\":{},\"parent\":{\"127\":{},\"128\":{},\"129\":{},\"130\":{},\"131\":{},\"132\":{},\"133\":{},\"134\":{}}}],[\"core/client\",{\"_index\":83,\"name\":{\"135\":{}},\"parent\":{\"136\":{},\"137\":{},\"141\":{},\"142\":{}}}],[\"core/client.azurapi\",{\"_index\":91,\"name\":{},\"parent\":{\"143\":{},\"144\":{},\"145\":{},\"146\":{},\"147\":{},\"148\":{},\"149\":{},\"150\":{},\"151\":{},\"152\":{},\"153\":{},\"154\":{},\"155\":{},\"161\":{}}}],[\"core/client.azurapi.__type\",{\"_index\":95,\"name\":{},\"parent\":{\"156\":{},\"157\":{},\"158\":{},\"159\":{},\"160\":{}}}],[\"core/client.cacheoptions\",{\"_index\":86,\"name\":{},\"parent\":{\"138\":{},\"139\":{},\"140\":{}}}],[\"core/data\",{\"_index\":97,\"name\":{\"162\":{}},\"parent\":{\"163\":{},\"173\":{},\"182\":{},\"183\":{},\"184\":{}}}],[\"core/data.data\",{\"_index\":99,\"name\":{},\"parent\":{\"164\":{}}}],[\"core/data.data.__type\",{\"_index\":101,\"name\":{},\"parent\":{\"165\":{},\"166\":{},\"167\":{},\"168\":{},\"169\":{},\"170\":{},\"171\":{},\"172\":{}}}],[\"core/data.local\",{\"_index\":105,\"name\":{},\"parent\":{\"174\":{}}}],[\"core/data.local.__type\",{\"_index\":106,\"name\":{},\"parent\":{\"175\":{},\"176\":{},\"177\":{},\"178\":{},\"179\":{},\"180\":{},\"181\":{}}}],[\"core/updatechecker\",{\"_index\":110,\"name\":{\"185\":{}},\"parent\":{\"186\":{},\"187\":{},\"188\":{}}}],[\"cron\",{\"_index\":77,\"name\":{\"128\":{}},\"parent\":{}}],[\"cube\",{\"_index\":150,\"name\":{\"237\":{}},\"parent\":{}}],[\"data\",{\"_index\":98,\"name\":{\"163\":{}},\"parent\":{}}],[\"datatype\",{\"_index\":107,\"name\":{\"182\":{}},\"parent\":{}}],[\"default\",{\"_index\":38,\"name\":{\"26\":{},\"126\":{}},\"parent\":{}}],[\"dmgl\",{\"_index\":120,\"name\":{\"197\":{}},\"parent\":{}}],[\"dmgm\",{\"_index\":121,\"name\":{\"198\":{}},\"parent\":{}}],[\"domination\",{\"_index\":26,\"name\":{\"16\":{}},\"parent\":{}}],[\"dragon\",{\"_index\":19,\"name\":{\"13\":{}},\"parent\":{}}],[\"eagle\",{\"_index\":10,\"name\":{\"9\":{}},\"parent\":{}}],[\"empery\",{\"_index\":20,\"name\":{\"13\":{}},\"parent\":{}}],[\"empire\",{\"_index\":16,\"name\":{\"11\":{},\"17\":{}},\"parent\":{}}],[\"en\",{\"_index\":134,\"name\":{\"216\":{},\"223\":{},\"323\":{},\"358\":{},\"431\":{}},\"parent\":{}}],[\"enemylevel\",{\"_index\":154,\"name\":{\"241\":{},\"279\":{}},\"parent\":{}}],[\"enhancevalue\",{\"_index\":224,\"name\":{\"380\":{}},\"parent\":{}}],[\"equipment\",{\"_index\":186,\"name\":{\"318\":{}},\"parent\":{}}],[\"equipmentblueprintdrops\",{\"_index\":171,\"name\":{\"261\":{},\"308\":{}},\"parent\":{}}],[\"equipments\",{\"_index\":64,\"name\":{\"74\":{},\"150\":{},\"157\":{},\"167\":{},\"176\":{}},\"parent\":{}}],[\"event\",{\"_index\":259,\"name\":{\"430\":{}},\"parent\":{}}],[\"every\",{\"_index\":51,\"name\":{\"38\":{},\"56\":{},\"71\":{},\"90\":{},\"109\":{},\"123\":{}},\"parent\":{}}],[\"exchange\",{\"_index\":250,\"name\":{\"415\":{}},\"parent\":{}}],[\"fetch\",{\"_index\":113,\"name\":{\"188\":{}},\"parent\":{}}],[\"filter\",{\"_index\":48,\"name\":{\"35\":{},\"53\":{},\"68\":{},\"87\":{},\"106\":{},\"120\":{}},\"parent\":{}}],[\"firepower\",{\"_index\":183,\"name\":{\"305\":{}},\"parent\":{}}],[\"fits\",{\"_index\":193,\"name\":{\"333\":{}},\"parent\":{}}],[\"fleet1\",{\"_index\":179,\"name\":{\"300\":{}},\"parent\":{}}],[\"fleet2\",{\"_index\":180,\"name\":{\"301\":{}},\"parent\":{}}],[\"fleetrestrictions\",{\"_index\":178,\"name\":{\"298\":{}},\"parent\":{}}],[\"fleettech\",{\"_index\":232,\"name\":{\"390\":{}},\"parent\":{}}],[\"focus\",{\"_index\":191,\"name\":{\"329\":{}},\"parent\":{}}],[\"foreach\",{\"_index\":50,\"name\":{\"37\":{},\"55\":{},\"70\":{},\"89\":{},\"108\":{},\"122\":{}},\"parent\":{}}],[\"frommaps\",{\"_index\":251,\"name\":{\"419\":{}},\"parent\":{}}],[\"fuse\",{\"_index\":42,\"name\":{\"29\":{},\"48\":{},\"63\":{},\"83\":{},\"102\":{},\"115\":{}},\"parent\":{}}],[\"fuze\",{\"_index\":45,\"name\":{\"32\":{},\"50\":{},\"65\":{},\"85\":{},\"104\":{},\"117\":{}},\"parent\":{}}],[\"gallery\",{\"_index\":230,\"name\":{\"388\":{}},\"parent\":{}}],[\"get\",{\"_index\":47,\"name\":{\"34\":{},\"52\":{},\"67\":{},\"80\":{},\"99\":{},\"119\":{}},\"parent\":{}}],[\"hard\",{\"_index\":177,\"name\":{\"269\":{}},\"parent\":{}}],[\"heavy\",{\"_index\":248,\"name\":{\"412\":{}},\"parent\":{}}],[\"height\",{\"_index\":175,\"name\":{\"266\":{},\"313\":{}},\"parent\":{}}],[\"hexagon\",{\"_index\":211,\"name\":{\"363\":{}},\"parent\":{}}],[\"hololive\",{\"_index\":35,\"name\":{\"23\":{}},\"parent\":{}}],[\"hull\",{\"_index\":58,\"name\":{\"45\":{},\"96\":{},\"193\":{},\"205\":{}},\"parent\":{}}],[\"hulltype\",{\"_index\":213,\"name\":{\"366\":{}},\"parent\":{}}],[\"icon\",{\"_index\":125,\"name\":{\"202\":{}},\"parent\":{}}],[\"id\",{\"_index\":46,\"name\":{\"33\":{},\"51\":{},\"66\":{},\"86\":{},\"105\":{},\"118\":{},\"207\":{},\"219\":{},\"316\":{},\"344\":{},\"347\":{},\"427\":{},\"435\":{}},\"parent\":{}}],[\"identifiable\",{\"_index\":203,\"name\":{\"346\":{}},\"parent\":{}}],[\"idmap\",{\"_index\":103,\"name\":{\"172\":{},\"181\":{}},\"parent\":{}}],[\"idonly\",{\"_index\":6,\"name\":{\"5\":{},\"351\":{}},\"parent\":{}}],[\"image\",{\"_index\":192,\"name\":{\"332\":{}},\"parent\":{}}],[\"index\",{\"_index\":114,\"name\":{\"189\":{}},\"parent\":{\"436\":{},\"437\":{},\"438\":{},\"439\":{}}}],[\"init\",{\"_index\":81,\"name\":{\"133\":{}},\"parent\":{}}],[\"instance\",{\"_index\":89,\"name\":{\"141\":{},\"438\":{}},\"parent\":{}}],[\"introduction\",{\"_index\":144,\"name\":{\"230\":{},\"273\":{}},\"parent\":{}}],[\"iris\",{\"_index\":23,\"name\":{\"15\":{}},\"parent\":{}}],[\"iron\",{\"_index\":17,\"name\":{\"12\":{}},\"parent\":{}}],[\"jp\",{\"_index\":137,\"name\":{\"218\":{},\"225\":{},\"325\":{},\"360\":{},\"433\":{}},\"parent\":{}}],[\"kizuna\",{\"_index\":33,\"name\":{\"22\":{}},\"parent\":{}}],[\"kr\",{\"_index\":190,\"name\":{\"326\":{},\"361\":{}},\"parent\":{}}],[\"language\",{\"_index\":2,\"name\":{\"2\":{},\"6\":{},\"352\":{}},\"parent\":{}}],[\"largefleet\",{\"_index\":161,\"name\":{\"250\":{},\"288\":{}},\"parent\":{}}],[\"level100\",{\"_index\":219,\"name\":{\"375\":{}},\"parent\":{}}],[\"level100retrofit\",{\"_index\":221,\"name\":{\"377\":{}},\"parent\":{}}],[\"level120\",{\"_index\":220,\"name\":{\"376\":{}},\"parent\":{}}],[\"level120retrofit\",{\"_index\":222,\"name\":{\"378\":{}},\"parent\":{}}],[\"libre\",{\"_index\":24,\"name\":{\"15\":{}},\"parent\":{}}],[\"light\",{\"_index\":247,\"name\":{\"411\":{}},\"parent\":{}}],[\"limitbreaks\",{\"_index\":231,\"name\":{\"389\":{}},\"parent\":{}}],[\"limited\",{\"_index\":249,\"name\":{\"414\":{}},\"parent\":{}}],[\"load\",{\"_index\":82,\"name\":{\"134\":{}},\"parent\":{}}],[\"local\",{\"_index\":104,\"name\":{\"173\":{}},\"parent\":{}}],[\"map\",{\"_index\":49,\"name\":{\"36\":{},\"54\":{},\"69\":{},\"88\":{},\"107\":{},\"121\":{},\"267\":{},\"314\":{}},\"parent\":{}}],[\"mapdrops\",{\"_index\":170,\"name\":{\"260\":{},\"307\":{}},\"parent\":{}}],[\"maxlevel\",{\"_index\":236,\"name\":{\"395\":{},\"400\":{}},\"parent\":{}}],[\"maxlimitbreak\",{\"_index\":238,\"name\":{\"399\":{}},\"parent\":{}}],[\"medal\",{\"_index\":227,\"name\":{\"385\":{}},\"parent\":{}}],[\"mediumfleet\",{\"_index\":160,\"name\":{\"249\":{},\"287\":{}},\"parent\":{}}],[\"meta\",{\"_index\":36,\"name\":{\"24\":{}},\"parent\":{}}],[\"misc\",{\"_index\":194,\"name\":{\"334\":{},\"420\":{}},\"parent\":{}}],[\"moblevel\",{\"_index\":155,\"name\":{\"243\":{},\"281\":{}},\"parent\":{}}],[\"name\",{\"_index\":56,\"name\":{\"43\":{},\"61\":{},\"76\":{},\"95\":{},\"203\":{},\"330\":{}},\"parent\":{}}],[\"nameonly\",{\"_index\":4,\"name\":{\"4\":{},\"350\":{}},\"parent\":{}}],[\"names\",{\"_index\":133,\"name\":{\"214\":{},\"221\":{},\"321\":{},\"355\":{}},\"parent\":{}}],[\"nationality\",{\"_index\":67,\"name\":{\"78\":{},\"97\":{},\"331\":{},\"365\":{}},\"parent\":{}}],[\"nations\",{\"_index\":7,\"name\":{\"7\":{}},\"parent\":{}}],[\"navy\",{\"_index\":14,\"name\":{\"10\":{}},\"parent\":{}}],[\"neptunia\",{\"_index\":28,\"name\":{\"18\":{}},\"parent\":{}}],[\"nodemap\",{\"_index\":173,\"name\":{\"263\":{},\"310\":{}},\"parent\":{}}],[\"nodes\",{\"_index\":176,\"name\":{\"268\":{},\"315\":{}},\"parent\":{}}],[\"normal\",{\"_index\":141,\"name\":{\"226\":{}},\"parent\":{}}],[\"normalize\",{\"_index\":1,\"name\":{\"1\":{}},\"parent\":{}}],[\"northern\",{\"_index\":21,\"name\":{\"14\":{}},\"parent\":{}}],[\"note\",{\"_index\":122,\"name\":{\"199\":{}},\"parent\":{}}],[\"obtainedfrom\",{\"_index\":195,\"name\":{\"336\":{},\"416\":{},\"418\":{}},\"parent\":{}}],[\"oil\",{\"_index\":226,\"name\":{\"384\":{}},\"parent\":{}}],[\"options\",{\"_index\":92,\"name\":{\"144\":{}},\"parent\":{}}],[\"parliament\",{\"_index\":22,\"name\":{\"14\":{}},\"parent\":{}}],[\"pixiv\",{\"_index\":254,\"name\":{\"424\":{}},\"parent\":{}}],[\"rarity\",{\"_index\":214,\"name\":{\"367\":{}},\"parent\":{}}],[\"rate\",{\"_index\":88,\"name\":{\"140\":{},\"147\":{}},\"parent\":{}}],[\"raw\",{\"_index\":41,\"name\":{\"28\":{},\"47\":{},\"62\":{},\"82\":{},\"101\":{},\"114\":{}},\"parent\":{}}],[\"requiredbattles\",{\"_index\":163,\"name\":{\"252\":{},\"290\":{}},\"parent\":{}}],[\"requiredlevel\",{\"_index\":148,\"name\":{\"234\":{},\"277\":{}},\"parent\":{}}],[\"retrofit\",{\"_index\":240,\"name\":{\"402\":{}},\"parent\":{}}],[\"retrofithulltype\",{\"_index\":242,\"name\":{\"404\":{}},\"parent\":{}}],[\"retrofitid\",{\"_index\":241,\"name\":{\"403\":{}},\"parent\":{}}],[\"retrofitprojects\",{\"_index\":243,\"name\":{\"405\":{}},\"parent\":{}}],[\"rounds\",{\"_index\":118,\"name\":{\"195\":{},\"206\":{}},\"parent\":{}}],[\"roundtype\",{\"_index\":117,\"name\":{\"194\":{}},\"parent\":{}}],[\"royal\",{\"_index\":13,\"name\":{\"10\":{}},\"parent\":{}}],[\"sakura\",{\"_index\":15,\"name\":{\"11\":{}},\"parent\":{}}],[\"sardenga\",{\"_index\":27,\"name\":{\"17\":{}},\"parent\":{}}],[\"save\",{\"_index\":112,\"name\":{\"187\":{}},\"parent\":{}}],[\"scrapvalue\",{\"_index\":225,\"name\":{\"381\":{}},\"parent\":{}}],[\"set\",{\"_index\":96,\"name\":{\"161\":{}},\"parent\":{}}],[\"setdata\",{\"_index\":44,\"name\":{\"31\":{},\"49\":{},\"64\":{},\"84\":{},\"103\":{},\"116\":{}},\"parent\":{}}],[\"ship\",{\"_index\":152,\"name\":{\"239\":{},\"353\":{}},\"parent\":{}}],[\"shipadvancedoptions\",{\"_index\":206,\"name\":{\"349\":{}},\"parent\":{}}],[\"shipdrops\",{\"_index\":172,\"name\":{\"262\":{},\"309\":{}},\"parent\":{}}],[\"shiplist\",{\"_index\":102,\"name\":{\"171\":{},\"180\":{}},\"parent\":{}}],[\"ships\",{\"_index\":59,\"name\":{\"46\":{},\"93\":{},\"149\":{},\"156\":{},\"166\":{},\"175\":{},\"192\":{},\"204\":{}},\"parent\":{}}],[\"skills\",{\"_index\":228,\"name\":{\"386\":{}},\"parent\":{}}],[\"skins\",{\"_index\":229,\"name\":{\"387\":{}},\"parent\":{}}],[\"slots\",{\"_index\":223,\"name\":{\"379\":{}},\"parent\":{}}],[\"smallfleet\",{\"_index\":159,\"name\":{\"248\":{},\"286\":{}},\"parent\":{}}],[\"some\",{\"_index\":52,\"name\":{\"39\":{},\"57\":{},\"72\":{},\"91\":{},\"110\":{},\"124\":{}},\"parent\":{}}],[\"source\",{\"_index\":84,\"name\":{\"136\":{},\"138\":{},\"145\":{},\"436\":{}},\"parent\":{}}],[\"starconditions\",{\"_index\":165,\"name\":{\"254\":{},\"292\":{}},\"parent\":{}}],[\"stars\",{\"_index\":215,\"name\":{\"368\":{},\"370\":{}},\"parent\":{}}],[\"start\",{\"_index\":79,\"name\":{\"131\":{}},\"parent\":{}}],[\"statrestrictions\",{\"_index\":181,\"name\":{\"302\":{}},\"parent\":{}}],[\"stats\",{\"_index\":217,\"name\":{\"372\":{}},\"parent\":{}}],[\"statsbonus\",{\"_index\":233,\"name\":{\"392\":{}},\"parent\":{}}],[\"stop\",{\"_index\":80,\"name\":{\"132\":{}},\"parent\":{}}],[\"subchapter\",{\"_index\":138,\"name\":{\"220\":{}},\"parent\":{}}],[\"superiority\",{\"_index\":168,\"name\":{\"258\":{},\"296\":{}},\"parent\":{}}],[\"supremacy\",{\"_index\":169,\"name\":{\"259\":{},\"297\":{}},\"parent\":{}}],[\"t0\",{\"_index\":198,\"name\":{\"340\":{}},\"parent\":{}}],[\"t1\",{\"_index\":199,\"name\":{\"341\":{}},\"parent\":{}}],[\"t2\",{\"_index\":200,\"name\":{\"342\":{}},\"parent\":{}}],[\"t3\",{\"_index\":201,\"name\":{\"343\":{}},\"parent\":{}}],[\"techpoints\",{\"_index\":237,\"name\":{\"396\":{}},\"parent\":{}}],[\"text\",{\"_index\":146,\"name\":{\"233\":{},\"276\":{}},\"parent\":{}}],[\"threestarrewards\",{\"_index\":153,\"name\":{\"240\":{},\"278\":{}},\"parent\":{}}],[\"thumbnail\",{\"_index\":210,\"name\":{\"362\":{}},\"parent\":{}}],[\"tiers\",{\"_index\":197,\"name\":{\"338\":{}},\"parent\":{}}],[\"title\",{\"_index\":142,\"name\":{\"228\":{},\"271\":{}},\"parent\":{}}],[\"total\",{\"_index\":239,\"name\":{\"401\":{}},\"parent\":{}}],[\"twitter\",{\"_index\":255,\"name\":{\"425\":{}},\"parent\":{}}],[\"type\",{\"_index\":57,\"name\":{\"44\":{},\"196\":{},\"201\":{},\"327\":{}},\"parent\":{}}],[\"types/barrage\",{\"_index\":115,\"name\":{\"190\":{}},\"parent\":{\"191\":{},\"192\":{},\"193\":{},\"194\":{},\"195\":{},\"200\":{}}}],[\"types/barrage.barrage\",{\"_index\":124,\"name\":{},\"parent\":{\"201\":{},\"202\":{},\"203\":{},\"204\":{},\"205\":{},\"206\":{},\"207\":{}}}],[\"types/barrage.rounds\",{\"_index\":119,\"name\":{},\"parent\":{\"196\":{},\"197\":{},\"198\":{},\"199\":{}}}],[\"types/chapter\",{\"_index\":126,\"name\":{\"208\":{}},\"parent\":{\"209\":{},\"220\":{}}}],[\"types/chapter.chapter\",{\"_index\":129,\"name\":{},\"parent\":{\"210\":{},\"211\":{},\"212\":{},\"213\":{},\"214\":{},\"215\":{},\"219\":{}}}],[\"types/chapter.chapter.__type\",{\"_index\":135,\"name\":{},\"parent\":{\"216\":{},\"217\":{},\"218\":{}}}],[\"types/chapter.subchapter\",{\"_index\":139,\"name\":{},\"parent\":{\"221\":{},\"222\":{},\"226\":{},\"227\":{},\"269\":{},\"270\":{},\"316\":{}}}],[\"types/chapter.subchapter.__type\",{\"_index\":140,\"name\":{},\"parent\":{\"223\":{},\"224\":{},\"225\":{},\"228\":{},\"229\":{},\"230\":{},\"231\":{},\"232\":{},\"235\":{},\"236\":{},\"240\":{},\"241\":{},\"242\":{},\"246\":{},\"247\":{},\"252\":{},\"253\":{},\"254\":{},\"255\":{},\"256\":{},\"260\":{},\"261\":{},\"262\":{},\"263\":{},\"264\":{},\"271\":{},\"272\":{},\"273\":{},\"274\":{},\"275\":{},\"278\":{},\"279\":{},\"280\":{},\"284\":{},\"285\":{},\"290\":{},\"291\":{},\"292\":{},\"293\":{},\"294\":{},\"298\":{},\"299\":{},\"302\":{},\"303\":{},\"307\":{},\"308\":{},\"309\":{},\"310\":{},\"311\":{}}}],[\"types/chapter.subchapter.__type.__type\",{\"_index\":147,\"name\":{},\"parent\":{\"233\":{},\"234\":{},\"237\":{},\"238\":{},\"239\":{},\"243\":{},\"244\":{},\"245\":{},\"248\":{},\"249\":{},\"250\":{},\"251\":{},\"257\":{},\"258\":{},\"259\":{},\"265\":{},\"266\":{},\"267\":{},\"268\":{},\"276\":{},\"277\":{},\"281\":{},\"282\":{},\"283\":{},\"286\":{},\"287\":{},\"288\":{},\"289\":{},\"295\":{},\"296\":{},\"297\":{},\"300\":{},\"301\":{},\"304\":{},\"305\":{},\"306\":{},\"312\":{},\"313\":{},\"314\":{},\"315\":{}}}],[\"types/equipment\",{\"_index\":185,\"name\":{\"317\":{}},\"parent\":{\"318\":{}}}],[\"types/equipment.equipment\",{\"_index\":188,\"name\":{},\"parent\":{\"319\":{},\"320\":{},\"321\":{},\"322\":{},\"327\":{},\"328\":{},\"331\":{},\"332\":{},\"333\":{},\"334\":{},\"335\":{},\"338\":{},\"339\":{},\"344\":{}}}],[\"types/equipment.equipment.__type\",{\"_index\":189,\"name\":{},\"parent\":{\"323\":{},\"324\":{},\"325\":{},\"326\":{},\"329\":{},\"330\":{},\"336\":{},\"337\":{},\"340\":{},\"341\":{},\"342\":{},\"343\":{}}}],[\"types/identifiable\",{\"_index\":202,\"name\":{\"345\":{}},\"parent\":{\"346\":{}}}],[\"types/identifiable.identifiable\",{\"_index\":204,\"name\":{},\"parent\":{\"347\":{}}}],[\"types/ship\",{\"_index\":205,\"name\":{\"348\":{}},\"parent\":{\"349\":{},\"353\":{}}}],[\"types/ship.ship\",{\"_index\":208,\"name\":{},\"parent\":{\"354\":{},\"355\":{},\"356\":{},\"362\":{},\"363\":{},\"364\":{},\"365\":{},\"366\":{},\"367\":{},\"368\":{},\"369\":{},\"372\":{},\"373\":{},\"379\":{},\"380\":{},\"381\":{},\"382\":{},\"386\":{},\"387\":{},\"388\":{},\"389\":{},\"390\":{},\"391\":{},\"402\":{},\"403\":{},\"404\":{},\"405\":{},\"406\":{},\"407\":{},\"416\":{},\"417\":{},\"420\":{},\"421\":{},\"427\":{}}}],[\"types/ship.ship.__type\",{\"_index\":209,\"name\":{},\"parent\":{\"357\":{},\"358\":{},\"359\":{},\"360\":{},\"361\":{},\"370\":{},\"371\":{},\"374\":{},\"375\":{},\"376\":{},\"377\":{},\"378\":{},\"383\":{},\"384\":{},\"385\":{},\"392\":{},\"393\":{},\"396\":{},\"397\":{},\"408\":{},\"409\":{},\"410\":{},\"418\":{},\"419\":{},\"422\":{},\"423\":{},\"424\":{},\"425\":{},\"426\":{}}}],[\"types/ship.ship.__type.__type\",{\"_index\":235,\"name\":{},\"parent\":{\"394\":{},\"395\":{},\"398\":{},\"399\":{},\"400\":{},\"401\":{},\"411\":{},\"412\":{},\"413\":{},\"414\":{},\"415\":{}}}],[\"types/ship.shipadvancedoptions\",{\"_index\":207,\"name\":{},\"parent\":{\"350\":{},\"351\":{},\"352\":{}}}],[\"types/voiceline\",{\"_index\":257,\"name\":{\"428\":{}},\"parent\":{\"429\":{}}}],[\"types/voiceline.voiceline\",{\"_index\":260,\"name\":{},\"parent\":{\"430\":{},\"431\":{},\"432\":{},\"433\":{},\"434\":{},\"435\":{}}}],[\"union\",{\"_index\":11,\"name\":{\"9\":{}},\"parent\":{}}],[\"universal\",{\"_index\":37,\"name\":{\"25\":{}},\"parent\":{}}],[\"unlockrequirements\",{\"_index\":145,\"name\":{\"231\":{},\"274\":{}},\"parent\":{}}],[\"update\",{\"_index\":78,\"name\":{\"130\":{}},\"parent\":{}}],[\"updater\",{\"_index\":93,\"name\":{\"148\":{}},\"parent\":{}}],[\"url\",{\"_index\":116,\"name\":{\"191\":{}},\"parent\":{}}],[\"utawarerumono\",{\"_index\":32,\"name\":{\"21\":{}},\"parent\":{}}],[\"vacation\",{\"_index\":31,\"name\":{\"20\":{}},\"parent\":{}}],[\"value\",{\"_index\":216,\"name\":{\"371\":{}},\"parent\":{}}],[\"venus\",{\"_index\":30,\"name\":{\"20\":{}},\"parent\":{}}],[\"version\",{\"_index\":100,\"name\":{\"165\":{}},\"parent\":{}}],[\"versioninfo\",{\"_index\":109,\"name\":{\"184\":{}},\"parent\":{}}],[\"vichya\",{\"_index\":25,\"name\":{\"16\":{}},\"parent\":{}}],[\"voice\",{\"_index\":256,\"name\":{\"426\":{}},\"parent\":{}}],[\"voiceline\",{\"_index\":258,\"name\":{\"429\":{}},\"parent\":{}}],[\"voicelines\",{\"_index\":73,\"name\":{\"112\":{},\"152\":{},\"159\":{},\"169\":{},\"178\":{}},\"parent\":{}}],[\"web\",{\"_index\":253,\"name\":{\"423\":{}},\"parent\":{}}],[\"width\",{\"_index\":174,\"name\":{\"265\":{},\"312\":{}},\"parent\":{}}],[\"wikiurl\",{\"_index\":187,\"name\":{\"319\":{},\"354\":{}},\"parent\":{}}],[\"zh\",{\"_index\":261,\"name\":{\"432\":{}},\"parent\":{}}]],\"pipeline\":[]}}"); \ No newline at end of file +window.searchData = JSON.parse("{\"kinds\":{\"2\":\"Module\",\"32\":\"Variable\",\"64\":\"Function\",\"128\":\"Class\",\"256\":\"Interface\",\"512\":\"Constructor\",\"1024\":\"Property\",\"2048\":\"Method\",\"65536\":\"Type literal\",\"4194304\":\"Type alias\",\"16777216\":\"Reference\"},\"rows\":[{\"id\":0,\"kind\":2,\"name\":\"core/api/api\",\"url\":\"modules/core_api_api.html\",\"classes\":\"tsd-kind-module\"},{\"id\":1,\"kind\":64,\"name\":\"normalize\",\"url\":\"modules/core_api_api.html#normalize\",\"classes\":\"tsd-kind-function tsd-parent-kind-module\",\"parent\":\"core/api/api\"},{\"id\":2,\"kind\":4194304,\"name\":\"Language\",\"url\":\"modules/core_api_api.html#Language\",\"classes\":\"tsd-kind-type-alias tsd-parent-kind-module\",\"parent\":\"core/api/api\"},{\"id\":3,\"kind\":256,\"name\":\"advancedOptions\",\"url\":\"interfaces/core_api_api.advancedOptions.html\",\"classes\":\"tsd-kind-interface tsd-parent-kind-module\",\"parent\":\"core/api/api\"},{\"id\":4,\"kind\":1024,\"name\":\"nameOnly\",\"url\":\"interfaces/core_api_api.advancedOptions.html#nameOnly\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"core/api/api.advancedOptions\"},{\"id\":5,\"kind\":1024,\"name\":\"idOnly\",\"url\":\"interfaces/core_api_api.advancedOptions.html#idOnly\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"core/api/api.advancedOptions\"},{\"id\":6,\"kind\":1024,\"name\":\"language\",\"url\":\"interfaces/core_api_api.advancedOptions.html#language\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"core/api/api.advancedOptions\"},{\"id\":7,\"kind\":32,\"name\":\"NATIONS\",\"url\":\"modules/core_api_api.html#NATIONS\",\"classes\":\"tsd-kind-variable tsd-parent-kind-module\",\"parent\":\"core/api/api\"},{\"id\":8,\"kind\":65536,\"name\":\"__type\",\"url\":\"modules/core_api_api.html#NATIONS.__type\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-variable\",\"parent\":\"core/api/api.NATIONS\"},{\"id\":9,\"kind\":1024,\"name\":\"Eagle Union\",\"url\":\"modules/core_api_api.html#NATIONS.__type.Eagle_Union\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/api/api.NATIONS.__type\"},{\"id\":10,\"kind\":1024,\"name\":\"Royal Navy\",\"url\":\"modules/core_api_api.html#NATIONS.__type.Royal_Navy\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/api/api.NATIONS.__type\"},{\"id\":11,\"kind\":1024,\"name\":\"Sakura Empire\",\"url\":\"modules/core_api_api.html#NATIONS.__type.Sakura_Empire\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/api/api.NATIONS.__type\"},{\"id\":12,\"kind\":1024,\"name\":\"Iron Blood\",\"url\":\"modules/core_api_api.html#NATIONS.__type.Iron_Blood\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/api/api.NATIONS.__type\"},{\"id\":13,\"kind\":1024,\"name\":\"Dragon Empery\",\"url\":\"modules/core_api_api.html#NATIONS.__type.Dragon_Empery\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/api/api.NATIONS.__type\"},{\"id\":14,\"kind\":1024,\"name\":\"Northern Parliament\",\"url\":\"modules/core_api_api.html#NATIONS.__type.Northern_Parliament\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/api/api.NATIONS.__type\"},{\"id\":15,\"kind\":1024,\"name\":\"Iris Libre\",\"url\":\"modules/core_api_api.html#NATIONS.__type.Iris_Libre\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/api/api.NATIONS.__type\"},{\"id\":16,\"kind\":1024,\"name\":\"Vichya Domination\",\"url\":\"modules/core_api_api.html#NATIONS.__type.Vichya_Domination\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/api/api.NATIONS.__type\"},{\"id\":17,\"kind\":1024,\"name\":\"Sardenga Empire\",\"url\":\"modules/core_api_api.html#NATIONS.__type.Sardenga_Empire\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/api/api.NATIONS.__type\"},{\"id\":18,\"kind\":1024,\"name\":\"Neptunia\",\"url\":\"modules/core_api_api.html#NATIONS.__type.Neptunia\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/api/api.NATIONS.__type\"},{\"id\":19,\"kind\":1024,\"name\":\"Bilibili\",\"url\":\"modules/core_api_api.html#NATIONS.__type.Bilibili\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/api/api.NATIONS.__type\"},{\"id\":20,\"kind\":1024,\"name\":\"Venus Vacation\",\"url\":\"modules/core_api_api.html#NATIONS.__type.Venus_Vacation\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/api/api.NATIONS.__type\"},{\"id\":21,\"kind\":1024,\"name\":\"Utawarerumono\",\"url\":\"modules/core_api_api.html#NATIONS.__type.Utawarerumono\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/api/api.NATIONS.__type\"},{\"id\":22,\"kind\":1024,\"name\":\"Kizuna AI\",\"url\":\"modules/core_api_api.html#NATIONS.__type.Kizuna_AI\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/api/api.NATIONS.__type\"},{\"id\":23,\"kind\":1024,\"name\":\"Hololive\",\"url\":\"modules/core_api_api.html#NATIONS.__type.Hololive\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/api/api.NATIONS.__type\"},{\"id\":24,\"kind\":1024,\"name\":\"META\",\"url\":\"modules/core_api_api.html#NATIONS.__type.META\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/api/api.NATIONS.__type\"},{\"id\":25,\"kind\":1024,\"name\":\"Universal\",\"url\":\"modules/core_api_api.html#NATIONS.__type.Universal\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/api/api.NATIONS.__type\"},{\"id\":26,\"kind\":128,\"name\":\"default\",\"url\":\"classes/core_api_api.default.html\",\"classes\":\"tsd-kind-class tsd-parent-kind-module tsd-has-type-parameter\",\"parent\":\"core/api/api\"},{\"id\":27,\"kind\":512,\"name\":\"constructor\",\"url\":\"classes/core_api_api.default.html#constructor\",\"classes\":\"tsd-kind-constructor tsd-parent-kind-class tsd-has-type-parameter\",\"parent\":\"core/api/api.default\"},{\"id\":28,\"kind\":1024,\"name\":\"raw\",\"url\":\"classes/core_api_api.default.html#raw\",\"classes\":\"tsd-kind-property tsd-parent-kind-class\",\"parent\":\"core/api/api.default\"},{\"id\":29,\"kind\":1024,\"name\":\"fuse\",\"url\":\"classes/core_api_api.default.html#fuse\",\"classes\":\"tsd-kind-property tsd-parent-kind-class\",\"parent\":\"core/api/api.default\"},{\"id\":30,\"kind\":1024,\"name\":\"client\",\"url\":\"classes/core_api_api.default.html#client\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-private\",\"parent\":\"core/api/api.default\"},{\"id\":31,\"kind\":2048,\"name\":\"setData\",\"url\":\"classes/core_api_api.default.html#setData\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/api/api.default\"},{\"id\":32,\"kind\":2048,\"name\":\"fuze\",\"url\":\"classes/core_api_api.default.html#fuze\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/api/api.default\"},{\"id\":33,\"kind\":2048,\"name\":\"id\",\"url\":\"classes/core_api_api.default.html#id\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/api/api.default\"},{\"id\":34,\"kind\":2048,\"name\":\"get\",\"url\":\"classes/core_api_api.default.html#get\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/api/api.default\"},{\"id\":35,\"kind\":2048,\"name\":\"filter\",\"url\":\"classes/core_api_api.default.html#filter\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/api/api.default\"},{\"id\":36,\"kind\":2048,\"name\":\"map\",\"url\":\"classes/core_api_api.default.html#map\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter\",\"parent\":\"core/api/api.default\"},{\"id\":37,\"kind\":2048,\"name\":\"forEach\",\"url\":\"classes/core_api_api.default.html#forEach\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/api/api.default\"},{\"id\":38,\"kind\":2048,\"name\":\"every\",\"url\":\"classes/core_api_api.default.html#every\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/api/api.default\"},{\"id\":39,\"kind\":2048,\"name\":\"some\",\"url\":\"classes/core_api_api.default.html#some\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/api/api.default\"},{\"id\":40,\"kind\":2,\"name\":\"core/api/api_barrage\",\"url\":\"modules/core_api_api_barrage.html\",\"classes\":\"tsd-kind-module\"},{\"id\":41,\"kind\":128,\"name\":\"Barrages\",\"url\":\"classes/core_api_api_barrage.Barrages.html\",\"classes\":\"tsd-kind-class tsd-parent-kind-module\",\"parent\":\"core/api/api_barrage\"},{\"id\":42,\"kind\":512,\"name\":\"constructor\",\"url\":\"classes/core_api_api_barrage.Barrages.html#constructor\",\"classes\":\"tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite\",\"parent\":\"core/api/api_barrage.Barrages\"},{\"id\":43,\"kind\":2048,\"name\":\"name\",\"url\":\"classes/core_api_api_barrage.Barrages.html#name\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/api/api_barrage.Barrages\"},{\"id\":44,\"kind\":2048,\"name\":\"type\",\"url\":\"classes/core_api_api_barrage.Barrages.html#type\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/api/api_barrage.Barrages\"},{\"id\":45,\"kind\":2048,\"name\":\"hull\",\"url\":\"classes/core_api_api_barrage.Barrages.html#hull\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/api/api_barrage.Barrages\"},{\"id\":46,\"kind\":2048,\"name\":\"ships\",\"url\":\"classes/core_api_api_barrage.Barrages.html#ships\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/api/api_barrage.Barrages\"},{\"id\":47,\"kind\":1024,\"name\":\"raw\",\"url\":\"classes/core_api_api_barrage.Barrages.html#raw\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_barrage.Barrages\"},{\"id\":48,\"kind\":1024,\"name\":\"fuse\",\"url\":\"classes/core_api_api_barrage.Barrages.html#fuse\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_barrage.Barrages\"},{\"id\":49,\"kind\":2048,\"name\":\"setData\",\"url\":\"classes/core_api_api_barrage.Barrages.html#setData\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_barrage.Barrages\"},{\"id\":50,\"kind\":2048,\"name\":\"fuze\",\"url\":\"classes/core_api_api_barrage.Barrages.html#fuze\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_barrage.Barrages\"},{\"id\":51,\"kind\":2048,\"name\":\"id\",\"url\":\"classes/core_api_api_barrage.Barrages.html#id\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_barrage.Barrages\"},{\"id\":52,\"kind\":2048,\"name\":\"get\",\"url\":\"classes/core_api_api_barrage.Barrages.html#get\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_barrage.Barrages\"},{\"id\":53,\"kind\":2048,\"name\":\"filter\",\"url\":\"classes/core_api_api_barrage.Barrages.html#filter\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_barrage.Barrages\"},{\"id\":54,\"kind\":2048,\"name\":\"map\",\"url\":\"classes/core_api_api_barrage.Barrages.html#map\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited\",\"parent\":\"core/api/api_barrage.Barrages\"},{\"id\":55,\"kind\":2048,\"name\":\"forEach\",\"url\":\"classes/core_api_api_barrage.Barrages.html#forEach\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_barrage.Barrages\"},{\"id\":56,\"kind\":2048,\"name\":\"every\",\"url\":\"classes/core_api_api_barrage.Barrages.html#every\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_barrage.Barrages\"},{\"id\":57,\"kind\":2048,\"name\":\"some\",\"url\":\"classes/core_api_api_barrage.Barrages.html#some\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_barrage.Barrages\"},{\"id\":58,\"kind\":2,\"name\":\"core/api/api_chapter\",\"url\":\"modules/core_api_api_chapter.html\",\"classes\":\"tsd-kind-module\"},{\"id\":59,\"kind\":128,\"name\":\"Chapters\",\"url\":\"classes/core_api_api_chapter.Chapters.html\",\"classes\":\"tsd-kind-class tsd-parent-kind-module\",\"parent\":\"core/api/api_chapter\"},{\"id\":60,\"kind\":512,\"name\":\"constructor\",\"url\":\"classes/core_api_api_chapter.Chapters.html#constructor\",\"classes\":\"tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite\",\"parent\":\"core/api/api_chapter.Chapters\"},{\"id\":61,\"kind\":2048,\"name\":\"name\",\"url\":\"classes/core_api_api_chapter.Chapters.html#name\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/api/api_chapter.Chapters\"},{\"id\":62,\"kind\":1024,\"name\":\"raw\",\"url\":\"classes/core_api_api_chapter.Chapters.html#raw\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_chapter.Chapters\"},{\"id\":63,\"kind\":1024,\"name\":\"fuse\",\"url\":\"classes/core_api_api_chapter.Chapters.html#fuse\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_chapter.Chapters\"},{\"id\":64,\"kind\":2048,\"name\":\"setData\",\"url\":\"classes/core_api_api_chapter.Chapters.html#setData\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_chapter.Chapters\"},{\"id\":65,\"kind\":2048,\"name\":\"fuze\",\"url\":\"classes/core_api_api_chapter.Chapters.html#fuze\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_chapter.Chapters\"},{\"id\":66,\"kind\":2048,\"name\":\"id\",\"url\":\"classes/core_api_api_chapter.Chapters.html#id\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_chapter.Chapters\"},{\"id\":67,\"kind\":2048,\"name\":\"get\",\"url\":\"classes/core_api_api_chapter.Chapters.html#get\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_chapter.Chapters\"},{\"id\":68,\"kind\":2048,\"name\":\"filter\",\"url\":\"classes/core_api_api_chapter.Chapters.html#filter\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_chapter.Chapters\"},{\"id\":69,\"kind\":2048,\"name\":\"map\",\"url\":\"classes/core_api_api_chapter.Chapters.html#map\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited\",\"parent\":\"core/api/api_chapter.Chapters\"},{\"id\":70,\"kind\":2048,\"name\":\"forEach\",\"url\":\"classes/core_api_api_chapter.Chapters.html#forEach\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_chapter.Chapters\"},{\"id\":71,\"kind\":2048,\"name\":\"every\",\"url\":\"classes/core_api_api_chapter.Chapters.html#every\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_chapter.Chapters\"},{\"id\":72,\"kind\":2048,\"name\":\"some\",\"url\":\"classes/core_api_api_chapter.Chapters.html#some\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_chapter.Chapters\"},{\"id\":73,\"kind\":2,\"name\":\"core/api/api_equipment\",\"url\":\"modules/core_api_api_equipment.html\",\"classes\":\"tsd-kind-module\"},{\"id\":74,\"kind\":128,\"name\":\"Equipments\",\"url\":\"classes/core_api_api_equipment.Equipments.html\",\"classes\":\"tsd-kind-class tsd-parent-kind-module\",\"parent\":\"core/api/api_equipment\"},{\"id\":75,\"kind\":512,\"name\":\"constructor\",\"url\":\"classes/core_api_api_equipment.Equipments.html#constructor\",\"classes\":\"tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite\",\"parent\":\"core/api/api_equipment.Equipments\"},{\"id\":76,\"kind\":2048,\"name\":\"name\",\"url\":\"classes/core_api_api_equipment.Equipments.html#name\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/api/api_equipment.Equipments\"},{\"id\":77,\"kind\":2048,\"name\":\"category\",\"url\":\"classes/core_api_api_equipment.Equipments.html#category\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/api/api_equipment.Equipments\"},{\"id\":78,\"kind\":2048,\"name\":\"nationality\",\"url\":\"classes/core_api_api_equipment.Equipments.html#nationality\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/api/api_equipment.Equipments\"},{\"id\":79,\"kind\":2048,\"name\":\"get\",\"url\":\"classes/core_api_api_equipment.Equipments.html#get\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-overwrite\",\"parent\":\"core/api/api_equipment.Equipments\"},{\"id\":80,\"kind\":2048,\"name\":\"all\",\"url\":\"classes/core_api_api_equipment.Equipments.html#all\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/api/api_equipment.Equipments\"},{\"id\":81,\"kind\":1024,\"name\":\"raw\",\"url\":\"classes/core_api_api_equipment.Equipments.html#raw\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_equipment.Equipments\"},{\"id\":82,\"kind\":1024,\"name\":\"fuse\",\"url\":\"classes/core_api_api_equipment.Equipments.html#fuse\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_equipment.Equipments\"},{\"id\":83,\"kind\":2048,\"name\":\"setData\",\"url\":\"classes/core_api_api_equipment.Equipments.html#setData\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_equipment.Equipments\"},{\"id\":84,\"kind\":2048,\"name\":\"fuze\",\"url\":\"classes/core_api_api_equipment.Equipments.html#fuze\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_equipment.Equipments\"},{\"id\":85,\"kind\":2048,\"name\":\"id\",\"url\":\"classes/core_api_api_equipment.Equipments.html#id\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_equipment.Equipments\"},{\"id\":86,\"kind\":2048,\"name\":\"filter\",\"url\":\"classes/core_api_api_equipment.Equipments.html#filter\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_equipment.Equipments\"},{\"id\":87,\"kind\":2048,\"name\":\"map\",\"url\":\"classes/core_api_api_equipment.Equipments.html#map\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited\",\"parent\":\"core/api/api_equipment.Equipments\"},{\"id\":88,\"kind\":2048,\"name\":\"forEach\",\"url\":\"classes/core_api_api_equipment.Equipments.html#forEach\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_equipment.Equipments\"},{\"id\":89,\"kind\":2048,\"name\":\"every\",\"url\":\"classes/core_api_api_equipment.Equipments.html#every\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_equipment.Equipments\"},{\"id\":90,\"kind\":2048,\"name\":\"some\",\"url\":\"classes/core_api_api_equipment.Equipments.html#some\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_equipment.Equipments\"},{\"id\":91,\"kind\":2,\"name\":\"core/api/api_ship\",\"url\":\"modules/core_api_api_ship.html\",\"classes\":\"tsd-kind-module\"},{\"id\":92,\"kind\":128,\"name\":\"Ships\",\"url\":\"classes/core_api_api_ship.Ships.html\",\"classes\":\"tsd-kind-class tsd-parent-kind-module\",\"parent\":\"core/api/api_ship\"},{\"id\":93,\"kind\":512,\"name\":\"constructor\",\"url\":\"classes/core_api_api_ship.Ships.html#constructor\",\"classes\":\"tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite\",\"parent\":\"core/api/api_ship.Ships\"},{\"id\":94,\"kind\":2048,\"name\":\"name\",\"url\":\"classes/core_api_api_ship.Ships.html#name\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/api/api_ship.Ships\"},{\"id\":95,\"kind\":2048,\"name\":\"hull\",\"url\":\"classes/core_api_api_ship.Ships.html#hull\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/api/api_ship.Ships\"},{\"id\":96,\"kind\":2048,\"name\":\"nationality\",\"url\":\"classes/core_api_api_ship.Ships.html#nationality\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/api/api_ship.Ships\"},{\"id\":97,\"kind\":2048,\"name\":\"get\",\"url\":\"classes/core_api_api_ship.Ships.html#get\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-overwrite\",\"parent\":\"core/api/api_ship.Ships\"},{\"id\":98,\"kind\":2048,\"name\":\"all\",\"url\":\"classes/core_api_api_ship.Ships.html#all\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/api/api_ship.Ships\"},{\"id\":99,\"kind\":1024,\"name\":\"raw\",\"url\":\"classes/core_api_api_ship.Ships.html#raw\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_ship.Ships\"},{\"id\":100,\"kind\":1024,\"name\":\"fuse\",\"url\":\"classes/core_api_api_ship.Ships.html#fuse\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_ship.Ships\"},{\"id\":101,\"kind\":2048,\"name\":\"setData\",\"url\":\"classes/core_api_api_ship.Ships.html#setData\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_ship.Ships\"},{\"id\":102,\"kind\":2048,\"name\":\"fuze\",\"url\":\"classes/core_api_api_ship.Ships.html#fuze\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_ship.Ships\"},{\"id\":103,\"kind\":2048,\"name\":\"id\",\"url\":\"classes/core_api_api_ship.Ships.html#id\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_ship.Ships\"},{\"id\":104,\"kind\":2048,\"name\":\"filter\",\"url\":\"classes/core_api_api_ship.Ships.html#filter\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_ship.Ships\"},{\"id\":105,\"kind\":2048,\"name\":\"map\",\"url\":\"classes/core_api_api_ship.Ships.html#map\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited\",\"parent\":\"core/api/api_ship.Ships\"},{\"id\":106,\"kind\":2048,\"name\":\"forEach\",\"url\":\"classes/core_api_api_ship.Ships.html#forEach\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_ship.Ships\"},{\"id\":107,\"kind\":2048,\"name\":\"every\",\"url\":\"classes/core_api_api_ship.Ships.html#every\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_ship.Ships\"},{\"id\":108,\"kind\":2048,\"name\":\"some\",\"url\":\"classes/core_api_api_ship.Ships.html#some\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_ship.Ships\"},{\"id\":109,\"kind\":2,\"name\":\"core/api/api_voiceline\",\"url\":\"modules/core_api_api_voiceline.html\",\"classes\":\"tsd-kind-module\"},{\"id\":110,\"kind\":128,\"name\":\"Voicelines\",\"url\":\"classes/core_api_api_voiceline.Voicelines.html\",\"classes\":\"tsd-kind-class tsd-parent-kind-module\",\"parent\":\"core/api/api_voiceline\"},{\"id\":111,\"kind\":512,\"name\":\"constructor\",\"url\":\"classes/core_api_api_voiceline.Voicelines.html#constructor\",\"classes\":\"tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite\",\"parent\":\"core/api/api_voiceline.Voicelines\"},{\"id\":112,\"kind\":1024,\"name\":\"raw\",\"url\":\"classes/core_api_api_voiceline.Voicelines.html#raw\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_voiceline.Voicelines\"},{\"id\":113,\"kind\":1024,\"name\":\"fuse\",\"url\":\"classes/core_api_api_voiceline.Voicelines.html#fuse\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_voiceline.Voicelines\"},{\"id\":114,\"kind\":2048,\"name\":\"setData\",\"url\":\"classes/core_api_api_voiceline.Voicelines.html#setData\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_voiceline.Voicelines\"},{\"id\":115,\"kind\":2048,\"name\":\"fuze\",\"url\":\"classes/core_api_api_voiceline.Voicelines.html#fuze\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_voiceline.Voicelines\"},{\"id\":116,\"kind\":2048,\"name\":\"id\",\"url\":\"classes/core_api_api_voiceline.Voicelines.html#id\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_voiceline.Voicelines\"},{\"id\":117,\"kind\":2048,\"name\":\"get\",\"url\":\"classes/core_api_api_voiceline.Voicelines.html#get\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_voiceline.Voicelines\"},{\"id\":118,\"kind\":2048,\"name\":\"filter\",\"url\":\"classes/core_api_api_voiceline.Voicelines.html#filter\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_voiceline.Voicelines\"},{\"id\":119,\"kind\":2048,\"name\":\"map\",\"url\":\"classes/core_api_api_voiceline.Voicelines.html#map\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited\",\"parent\":\"core/api/api_voiceline.Voicelines\"},{\"id\":120,\"kind\":2048,\"name\":\"forEach\",\"url\":\"classes/core_api_api_voiceline.Voicelines.html#forEach\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_voiceline.Voicelines\"},{\"id\":121,\"kind\":2048,\"name\":\"every\",\"url\":\"classes/core_api_api_voiceline.Voicelines.html#every\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_voiceline.Voicelines\"},{\"id\":122,\"kind\":2048,\"name\":\"some\",\"url\":\"classes/core_api_api_voiceline.Voicelines.html#some\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"core/api/api_voiceline.Voicelines\"},{\"id\":123,\"kind\":2,\"name\":\"core/CacheUpdater\",\"url\":\"modules/core_CacheUpdater.html\",\"classes\":\"tsd-kind-module\"},{\"id\":124,\"kind\":128,\"name\":\"default\",\"url\":\"classes/core_CacheUpdater.default.html\",\"classes\":\"tsd-kind-class tsd-parent-kind-module\",\"parent\":\"core/CacheUpdater\"},{\"id\":125,\"kind\":512,\"name\":\"constructor\",\"url\":\"classes/core_CacheUpdater.default.html#constructor\",\"classes\":\"tsd-kind-constructor tsd-parent-kind-class\",\"parent\":\"core/CacheUpdater.default\"},{\"id\":126,\"kind\":1024,\"name\":\"cron\",\"url\":\"classes/core_CacheUpdater.default.html#cron\",\"classes\":\"tsd-kind-property tsd-parent-kind-class\",\"parent\":\"core/CacheUpdater.default\"},{\"id\":127,\"kind\":1024,\"name\":\"client\",\"url\":\"classes/core_CacheUpdater.default.html#client\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-private\",\"parent\":\"core/CacheUpdater.default\"},{\"id\":128,\"kind\":2048,\"name\":\"update\",\"url\":\"classes/core_CacheUpdater.default.html#update\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/CacheUpdater.default\"},{\"id\":129,\"kind\":2048,\"name\":\"start\",\"url\":\"classes/core_CacheUpdater.default.html#start\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/CacheUpdater.default\"},{\"id\":130,\"kind\":2048,\"name\":\"stop\",\"url\":\"classes/core_CacheUpdater.default.html#stop\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/CacheUpdater.default\"},{\"id\":131,\"kind\":2048,\"name\":\"init\",\"url\":\"classes/core_CacheUpdater.default.html#init\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/CacheUpdater.default\"},{\"id\":132,\"kind\":2048,\"name\":\"load\",\"url\":\"classes/core_CacheUpdater.default.html#load\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/CacheUpdater.default\"},{\"id\":133,\"kind\":2,\"name\":\"core/Client\",\"url\":\"modules/core_Client.html\",\"classes\":\"tsd-kind-module\"},{\"id\":134,\"kind\":4194304,\"name\":\"Source\",\"url\":\"modules/core_Client.html#Source\",\"classes\":\"tsd-kind-type-alias tsd-parent-kind-module\",\"parent\":\"core/Client\"},{\"id\":135,\"kind\":256,\"name\":\"CacheOptions\",\"url\":\"interfaces/core_Client.CacheOptions.html\",\"classes\":\"tsd-kind-interface tsd-parent-kind-module\",\"parent\":\"core/Client\"},{\"id\":136,\"kind\":1024,\"name\":\"source\",\"url\":\"interfaces/core_Client.CacheOptions.html#source\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"core/Client.CacheOptions\"},{\"id\":137,\"kind\":1024,\"name\":\"autoupdate\",\"url\":\"interfaces/core_Client.CacheOptions.html#autoupdate\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"core/Client.CacheOptions\"},{\"id\":138,\"kind\":1024,\"name\":\"rate\",\"url\":\"interfaces/core_Client.CacheOptions.html#rate\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"core/Client.CacheOptions\"},{\"id\":139,\"kind\":32,\"name\":\"instance\",\"url\":\"modules/core_Client.html#instance\",\"classes\":\"tsd-kind-variable tsd-parent-kind-module\",\"parent\":\"core/Client\"},{\"id\":140,\"kind\":128,\"name\":\"AzurAPI\",\"url\":\"classes/core_Client.AzurAPI.html\",\"classes\":\"tsd-kind-class tsd-parent-kind-module\",\"parent\":\"core/Client\"},{\"id\":141,\"kind\":512,\"name\":\"constructor\",\"url\":\"classes/core_Client.AzurAPI.html#constructor\",\"classes\":\"tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite\",\"parent\":\"core/Client.AzurAPI\"},{\"id\":142,\"kind\":1024,\"name\":\"options\",\"url\":\"classes/core_Client.AzurAPI.html#options\",\"classes\":\"tsd-kind-property tsd-parent-kind-class\",\"parent\":\"core/Client.AzurAPI\"},{\"id\":143,\"kind\":1024,\"name\":\"source\",\"url\":\"classes/core_Client.AzurAPI.html#source\",\"classes\":\"tsd-kind-property tsd-parent-kind-class\",\"parent\":\"core/Client.AzurAPI\"},{\"id\":144,\"kind\":1024,\"name\":\"autoupdate\",\"url\":\"classes/core_Client.AzurAPI.html#autoupdate\",\"classes\":\"tsd-kind-property tsd-parent-kind-class\",\"parent\":\"core/Client.AzurAPI\"},{\"id\":145,\"kind\":1024,\"name\":\"rate\",\"url\":\"classes/core_Client.AzurAPI.html#rate\",\"classes\":\"tsd-kind-property tsd-parent-kind-class\",\"parent\":\"core/Client.AzurAPI\"},{\"id\":146,\"kind\":1024,\"name\":\"updater\",\"url\":\"classes/core_Client.AzurAPI.html#updater\",\"classes\":\"tsd-kind-property tsd-parent-kind-class\",\"parent\":\"core/Client.AzurAPI\"},{\"id\":147,\"kind\":1024,\"name\":\"ships\",\"url\":\"classes/core_Client.AzurAPI.html#ships-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-class\",\"parent\":\"core/Client.AzurAPI\"},{\"id\":148,\"kind\":1024,\"name\":\"equipments\",\"url\":\"classes/core_Client.AzurAPI.html#equipments-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-class\",\"parent\":\"core/Client.AzurAPI\"},{\"id\":149,\"kind\":1024,\"name\":\"chapters\",\"url\":\"classes/core_Client.AzurAPI.html#chapters-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-class\",\"parent\":\"core/Client.AzurAPI\"},{\"id\":150,\"kind\":1024,\"name\":\"voicelines\",\"url\":\"classes/core_Client.AzurAPI.html#voicelines-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-class\",\"parent\":\"core/Client.AzurAPI\"},{\"id\":151,\"kind\":1024,\"name\":\"barrages\",\"url\":\"classes/core_Client.AzurAPI.html#barrages-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-class\",\"parent\":\"core/Client.AzurAPI\"},{\"id\":152,\"kind\":1024,\"name\":\"apis\",\"url\":\"classes/core_Client.AzurAPI.html#apis\",\"classes\":\"tsd-kind-property tsd-parent-kind-class\",\"parent\":\"core/Client.AzurAPI\"},{\"id\":153,\"kind\":65536,\"name\":\"__type\",\"url\":\"classes/core_Client.AzurAPI.html#__type\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-class\",\"parent\":\"core/Client.AzurAPI\"},{\"id\":154,\"kind\":1024,\"name\":\"ships\",\"url\":\"classes/core_Client.AzurAPI.html#__type.ships\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/Client.AzurAPI.__type\"},{\"id\":155,\"kind\":1024,\"name\":\"equipments\",\"url\":\"classes/core_Client.AzurAPI.html#__type.equipments\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/Client.AzurAPI.__type\"},{\"id\":156,\"kind\":1024,\"name\":\"chapters\",\"url\":\"classes/core_Client.AzurAPI.html#__type.chapters\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/Client.AzurAPI.__type\"},{\"id\":157,\"kind\":1024,\"name\":\"voicelines\",\"url\":\"classes/core_Client.AzurAPI.html#__type.voicelines\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/Client.AzurAPI.__type\"},{\"id\":158,\"kind\":1024,\"name\":\"barrages\",\"url\":\"classes/core_Client.AzurAPI.html#__type.barrages\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/Client.AzurAPI.__type\"},{\"id\":159,\"kind\":2048,\"name\":\"set\",\"url\":\"classes/core_Client.AzurAPI.html#set\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"core/Client.AzurAPI\"},{\"id\":160,\"kind\":2,\"name\":\"core/Data\",\"url\":\"modules/core_Data.html\",\"classes\":\"tsd-kind-module\"},{\"id\":161,\"kind\":32,\"name\":\"data\",\"url\":\"modules/core_Data.html#data\",\"classes\":\"tsd-kind-variable tsd-parent-kind-module\",\"parent\":\"core/Data\"},{\"id\":162,\"kind\":65536,\"name\":\"__type\",\"url\":\"modules/core_Data.html#data.__type\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-variable\",\"parent\":\"core/Data.data\"},{\"id\":163,\"kind\":1024,\"name\":\"version\",\"url\":\"modules/core_Data.html#data.__type.version\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/Data.data.__type\"},{\"id\":164,\"kind\":1024,\"name\":\"ships\",\"url\":\"modules/core_Data.html#data.__type.ships\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/Data.data.__type\"},{\"id\":165,\"kind\":1024,\"name\":\"equipments\",\"url\":\"modules/core_Data.html#data.__type.equipments\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/Data.data.__type\"},{\"id\":166,\"kind\":1024,\"name\":\"chapters\",\"url\":\"modules/core_Data.html#data.__type.chapters\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/Data.data.__type\"},{\"id\":167,\"kind\":1024,\"name\":\"voicelines\",\"url\":\"modules/core_Data.html#data.__type.voicelines\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/Data.data.__type\"},{\"id\":168,\"kind\":1024,\"name\":\"barrages\",\"url\":\"modules/core_Data.html#data.__type.barrages\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/Data.data.__type\"},{\"id\":169,\"kind\":1024,\"name\":\"shipList\",\"url\":\"modules/core_Data.html#data.__type.shipList\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/Data.data.__type\"},{\"id\":170,\"kind\":1024,\"name\":\"idMap\",\"url\":\"modules/core_Data.html#data.__type.idMap\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/Data.data.__type\"},{\"id\":171,\"kind\":32,\"name\":\"local\",\"url\":\"modules/core_Data.html#local\",\"classes\":\"tsd-kind-variable tsd-parent-kind-module\",\"parent\":\"core/Data\"},{\"id\":172,\"kind\":65536,\"name\":\"__type\",\"url\":\"modules/core_Data.html#local.__type-1\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-variable\",\"parent\":\"core/Data.local\"},{\"id\":173,\"kind\":1024,\"name\":\"ships\",\"url\":\"modules/core_Data.html#local.__type-1.ships-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/Data.local.__type\"},{\"id\":174,\"kind\":1024,\"name\":\"equipments\",\"url\":\"modules/core_Data.html#local.__type-1.equipments-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/Data.local.__type\"},{\"id\":175,\"kind\":1024,\"name\":\"chapters\",\"url\":\"modules/core_Data.html#local.__type-1.chapters-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/Data.local.__type\"},{\"id\":176,\"kind\":1024,\"name\":\"voicelines\",\"url\":\"modules/core_Data.html#local.__type-1.voicelines-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/Data.local.__type\"},{\"id\":177,\"kind\":1024,\"name\":\"barrages\",\"url\":\"modules/core_Data.html#local.__type-1.barrages-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/Data.local.__type\"},{\"id\":178,\"kind\":1024,\"name\":\"shipList\",\"url\":\"modules/core_Data.html#local.__type-1.shipList-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/Data.local.__type\"},{\"id\":179,\"kind\":1024,\"name\":\"idMap\",\"url\":\"modules/core_Data.html#local.__type-1.idMap-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"core/Data.local.__type\"},{\"id\":180,\"kind\":4194304,\"name\":\"datatype\",\"url\":\"modules/core_Data.html#datatype\",\"classes\":\"tsd-kind-type-alias tsd-parent-kind-module\",\"parent\":\"core/Data\"},{\"id\":181,\"kind\":32,\"name\":\"baseFolder\",\"url\":\"modules/core_Data.html#baseFolder\",\"classes\":\"tsd-kind-variable tsd-parent-kind-module\",\"parent\":\"core/Data\"},{\"id\":182,\"kind\":32,\"name\":\"versionInfo\",\"url\":\"modules/core_Data.html#versionInfo\",\"classes\":\"tsd-kind-variable tsd-parent-kind-module\",\"parent\":\"core/Data\"},{\"id\":183,\"kind\":2,\"name\":\"core/UpdateChecker\",\"url\":\"modules/core_UpdateChecker.html\",\"classes\":\"tsd-kind-module\"},{\"id\":184,\"kind\":64,\"name\":\"check\",\"url\":\"modules/core_UpdateChecker.html#check\",\"classes\":\"tsd-kind-function tsd-parent-kind-module\",\"parent\":\"core/UpdateChecker\"},{\"id\":185,\"kind\":64,\"name\":\"save\",\"url\":\"modules/core_UpdateChecker.html#save\",\"classes\":\"tsd-kind-function tsd-parent-kind-module\",\"parent\":\"core/UpdateChecker\"},{\"id\":186,\"kind\":64,\"name\":\"fetch\",\"url\":\"modules/core_UpdateChecker.html#fetch\",\"classes\":\"tsd-kind-function tsd-parent-kind-module\",\"parent\":\"core/UpdateChecker\"},{\"id\":187,\"kind\":2,\"name\":\"index\",\"url\":\"modules/index.html\",\"classes\":\"tsd-kind-module\"},{\"id\":188,\"kind\":2,\"name\":\"types/barrage\",\"url\":\"modules/types_barrage.html\",\"classes\":\"tsd-kind-module\"},{\"id\":189,\"kind\":4194304,\"name\":\"Url\",\"url\":\"modules/types_barrage.html#Url\",\"classes\":\"tsd-kind-type-alias tsd-parent-kind-module\",\"parent\":\"types/barrage\"},{\"id\":190,\"kind\":4194304,\"name\":\"Ships\",\"url\":\"modules/types_barrage.html#Ships\",\"classes\":\"tsd-kind-type-alias tsd-parent-kind-module\",\"parent\":\"types/barrage\"},{\"id\":191,\"kind\":4194304,\"name\":\"Hull\",\"url\":\"modules/types_barrage.html#Hull\",\"classes\":\"tsd-kind-type-alias tsd-parent-kind-module\",\"parent\":\"types/barrage\"},{\"id\":192,\"kind\":4194304,\"name\":\"RoundType\",\"url\":\"modules/types_barrage.html#RoundType\",\"classes\":\"tsd-kind-type-alias tsd-parent-kind-module\",\"parent\":\"types/barrage\"},{\"id\":193,\"kind\":256,\"name\":\"Rounds\",\"url\":\"interfaces/types_barrage.Rounds.html\",\"classes\":\"tsd-kind-interface tsd-parent-kind-module\",\"parent\":\"types/barrage\"},{\"id\":194,\"kind\":1024,\"name\":\"type\",\"url\":\"interfaces/types_barrage.Rounds.html#type\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/barrage.Rounds\"},{\"id\":195,\"kind\":1024,\"name\":\"dmgL\",\"url\":\"interfaces/types_barrage.Rounds.html#dmgL\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/barrage.Rounds\"},{\"id\":196,\"kind\":1024,\"name\":\"dmgM\",\"url\":\"interfaces/types_barrage.Rounds.html#dmgM\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/barrage.Rounds\"},{\"id\":197,\"kind\":1024,\"name\":\"note\",\"url\":\"interfaces/types_barrage.Rounds.html#note\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/barrage.Rounds\"},{\"id\":198,\"kind\":256,\"name\":\"Barrage\",\"url\":\"interfaces/types_barrage.Barrage.html\",\"classes\":\"tsd-kind-interface tsd-parent-kind-module\",\"parent\":\"types/barrage\"},{\"id\":199,\"kind\":1024,\"name\":\"type\",\"url\":\"interfaces/types_barrage.Barrage.html#type\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/barrage.Barrage\"},{\"id\":200,\"kind\":1024,\"name\":\"icon\",\"url\":\"interfaces/types_barrage.Barrage.html#icon\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/barrage.Barrage\"},{\"id\":201,\"kind\":1024,\"name\":\"name\",\"url\":\"interfaces/types_barrage.Barrage.html#name\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/barrage.Barrage\"},{\"id\":202,\"kind\":1024,\"name\":\"ships\",\"url\":\"interfaces/types_barrage.Barrage.html#ships\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/barrage.Barrage\"},{\"id\":203,\"kind\":1024,\"name\":\"hull\",\"url\":\"interfaces/types_barrage.Barrage.html#hull\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/barrage.Barrage\"},{\"id\":204,\"kind\":1024,\"name\":\"rounds\",\"url\":\"interfaces/types_barrage.Barrage.html#rounds\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/barrage.Barrage\"},{\"id\":205,\"kind\":1024,\"name\":\"id\",\"url\":\"interfaces/types_barrage.Barrage.html#id\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited\",\"parent\":\"types/barrage.Barrage\"},{\"id\":206,\"kind\":2,\"name\":\"types/chapter\",\"url\":\"modules/types_chapter.html\",\"classes\":\"tsd-kind-module\"},{\"id\":207,\"kind\":256,\"name\":\"Chapter\",\"url\":\"interfaces/types_chapter.Chapter.html\",\"classes\":\"tsd-kind-interface tsd-parent-kind-module\",\"parent\":\"types/chapter\"},{\"id\":208,\"kind\":1024,\"name\":\"1\",\"url\":\"interfaces/types_chapter.Chapter.html#1\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/chapter.Chapter\"},{\"id\":209,\"kind\":1024,\"name\":\"2\",\"url\":\"interfaces/types_chapter.Chapter.html#2\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/chapter.Chapter\"},{\"id\":210,\"kind\":1024,\"name\":\"3\",\"url\":\"interfaces/types_chapter.Chapter.html#3\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/chapter.Chapter\"},{\"id\":211,\"kind\":1024,\"name\":\"4\",\"url\":\"interfaces/types_chapter.Chapter.html#4\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/chapter.Chapter\"},{\"id\":212,\"kind\":1024,\"name\":\"names\",\"url\":\"interfaces/types_chapter.Chapter.html#names\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/chapter.Chapter\"},{\"id\":213,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_chapter.Chapter.html#__type\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"types/chapter.Chapter\"},{\"id\":214,\"kind\":1024,\"name\":\"en\",\"url\":\"interfaces/types_chapter.Chapter.html#__type.en\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.Chapter.__type\"},{\"id\":215,\"kind\":1024,\"name\":\"cn\",\"url\":\"interfaces/types_chapter.Chapter.html#__type.cn\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.Chapter.__type\"},{\"id\":216,\"kind\":1024,\"name\":\"jp\",\"url\":\"interfaces/types_chapter.Chapter.html#__type.jp\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.Chapter.__type\"},{\"id\":217,\"kind\":1024,\"name\":\"id\",\"url\":\"interfaces/types_chapter.Chapter.html#id\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited\",\"parent\":\"types/chapter.Chapter\"},{\"id\":218,\"kind\":256,\"name\":\"SubChapter\",\"url\":\"interfaces/types_chapter.SubChapter.html\",\"classes\":\"tsd-kind-interface tsd-parent-kind-module\",\"parent\":\"types/chapter\"},{\"id\":219,\"kind\":1024,\"name\":\"names\",\"url\":\"interfaces/types_chapter.SubChapter.html#names\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/chapter.SubChapter\"},{\"id\":220,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-8\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"types/chapter.SubChapter\"},{\"id\":221,\"kind\":1024,\"name\":\"en\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-8.en\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":222,\"kind\":1024,\"name\":\"cn\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-8.cn\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":223,\"kind\":1024,\"name\":\"jp\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-8.jp\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":224,\"kind\":1024,\"name\":\"normal\",\"url\":\"interfaces/types_chapter.SubChapter.html#normal\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/chapter.SubChapter\"},{\"id\":225,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"types/chapter.SubChapter\"},{\"id\":226,\"kind\":1024,\"name\":\"title\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.title-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":227,\"kind\":1024,\"name\":\"code\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.code-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":228,\"kind\":1024,\"name\":\"introduction\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.introduction-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":229,\"kind\":1024,\"name\":\"unlockRequirements\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.unlockRequirements-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":230,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-15\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":231,\"kind\":1024,\"name\":\"text\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-15.text-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":232,\"kind\":1024,\"name\":\"requiredLevel\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-15.requiredLevel-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":233,\"kind\":1024,\"name\":\"clearRewards\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.clearRewards\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":234,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-12\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":235,\"kind\":1024,\"name\":\"cube\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-12.cube\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":236,\"kind\":1024,\"name\":\"coin\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-12.coin\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":237,\"kind\":1024,\"name\":\"ship\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-12.ship\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":238,\"kind\":1024,\"name\":\"threeStarRewards\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.threeStarRewards-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":239,\"kind\":1024,\"name\":\"enemyLevel\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.enemyLevel-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":240,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-13\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":241,\"kind\":1024,\"name\":\"mobLevel\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-13.mobLevel-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":242,\"kind\":1024,\"name\":\"bossLevel\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-13.bossLevel-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":243,\"kind\":1024,\"name\":\"boss\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-13.boss-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":244,\"kind\":1024,\"name\":\"baseXP\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.baseXP-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":245,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-11\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":246,\"kind\":1024,\"name\":\"smallFleet\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-11.smallFleet-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":247,\"kind\":1024,\"name\":\"mediumFleet\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-11.mediumFleet-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":248,\"kind\":1024,\"name\":\"largeFleet\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-11.largeFleet-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":249,\"kind\":1024,\"name\":\"bossFleet\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-11.bossFleet-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":250,\"kind\":1024,\"name\":\"requiredBattles\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.requiredBattles-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":251,\"kind\":1024,\"name\":\"bossKillsToClear\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.bossKillsToClear-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":252,\"kind\":1024,\"name\":\"starConditions\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.starConditions-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":253,\"kind\":1024,\"name\":\"airSupremacy\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.airSupremacy-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":254,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-10\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":255,\"kind\":1024,\"name\":\"actual\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-10.actual-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":256,\"kind\":1024,\"name\":\"superiority\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-10.superiority-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":257,\"kind\":1024,\"name\":\"supremacy\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-10.supremacy-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":258,\"kind\":1024,\"name\":\"mapDrops\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.mapDrops-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":259,\"kind\":1024,\"name\":\"equipmentBlueprintDrops\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.equipmentBlueprintDrops-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":260,\"kind\":1024,\"name\":\"shipDrops\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.shipDrops-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":261,\"kind\":1024,\"name\":\"nodeMap\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.nodeMap-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":262,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-14\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":263,\"kind\":1024,\"name\":\"width\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-14.width-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":264,\"kind\":1024,\"name\":\"height\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-14.height-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":265,\"kind\":1024,\"name\":\"map\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-14.map-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":266,\"kind\":1024,\"name\":\"nodes\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type-9.__type-14.nodes-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":267,\"kind\":1024,\"name\":\"hard\",\"url\":\"interfaces/types_chapter.SubChapter.html#hard\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/chapter.SubChapter\"},{\"id\":268,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"types/chapter.SubChapter\"},{\"id\":269,\"kind\":1024,\"name\":\"title\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.title\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":270,\"kind\":1024,\"name\":\"code\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.code\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":271,\"kind\":1024,\"name\":\"introduction\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.introduction\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":272,\"kind\":1024,\"name\":\"unlockRequirements\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.unlockRequirements\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":273,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-7\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":274,\"kind\":1024,\"name\":\"text\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-7.text\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":275,\"kind\":1024,\"name\":\"requiredLevel\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-7.requiredLevel\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":276,\"kind\":1024,\"name\":\"threeStarRewards\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.threeStarRewards\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":277,\"kind\":1024,\"name\":\"enemyLevel\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.enemyLevel\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":278,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-3\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":279,\"kind\":1024,\"name\":\"mobLevel\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-3.mobLevel\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":280,\"kind\":1024,\"name\":\"bossLevel\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-3.bossLevel\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":281,\"kind\":1024,\"name\":\"boss\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-3.boss\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":282,\"kind\":1024,\"name\":\"baseXP\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.baseXP\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":283,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-2\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":284,\"kind\":1024,\"name\":\"smallFleet\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-2.smallFleet\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":285,\"kind\":1024,\"name\":\"mediumFleet\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-2.mediumFleet\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":286,\"kind\":1024,\"name\":\"largeFleet\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-2.largeFleet\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":287,\"kind\":1024,\"name\":\"bossFleet\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-2.bossFleet\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":288,\"kind\":1024,\"name\":\"requiredBattles\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.requiredBattles\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":289,\"kind\":1024,\"name\":\"bossKillsToClear\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.bossKillsToClear\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":290,\"kind\":1024,\"name\":\"starConditions\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.starConditions\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":291,\"kind\":1024,\"name\":\"airSupremacy\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.airSupremacy\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":292,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-1\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":293,\"kind\":1024,\"name\":\"actual\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-1.actual\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":294,\"kind\":1024,\"name\":\"superiority\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-1.superiority\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":295,\"kind\":1024,\"name\":\"supremacy\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-1.supremacy\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":296,\"kind\":1024,\"name\":\"fleetRestrictions\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.fleetRestrictions\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":297,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-4\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":298,\"kind\":1024,\"name\":\"fleet1\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-4.fleet1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":299,\"kind\":1024,\"name\":\"fleet2\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-4.fleet2\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":300,\"kind\":1024,\"name\":\"statRestrictions\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.statRestrictions\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":301,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-6\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":302,\"kind\":1024,\"name\":\"averageLevel\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-6.averageLevel\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":303,\"kind\":1024,\"name\":\"firepower\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-6.firepower\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":304,\"kind\":1024,\"name\":\"aviation\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-6.aviation\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":305,\"kind\":1024,\"name\":\"mapDrops\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.mapDrops\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":306,\"kind\":1024,\"name\":\"equipmentBlueprintDrops\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.equipmentBlueprintDrops\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":307,\"kind\":1024,\"name\":\"shipDrops\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.shipDrops\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":308,\"kind\":1024,\"name\":\"nodeMap\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.nodeMap\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":309,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-5\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type\"},{\"id\":310,\"kind\":1024,\"name\":\"width\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-5.width\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":311,\"kind\":1024,\"name\":\"height\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-5.height\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":312,\"kind\":1024,\"name\":\"map\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-5.map\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":313,\"kind\":1024,\"name\":\"nodes\",\"url\":\"interfaces/types_chapter.SubChapter.html#__type.__type-5.nodes\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/chapter.SubChapter.__type.__type\"},{\"id\":314,\"kind\":1024,\"name\":\"id\",\"url\":\"interfaces/types_chapter.SubChapter.html#id\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited\",\"parent\":\"types/chapter.SubChapter\"},{\"id\":315,\"kind\":2,\"name\":\"types/equipment\",\"url\":\"modules/types_equipment.html\",\"classes\":\"tsd-kind-module\"},{\"id\":316,\"kind\":256,\"name\":\"Equipment\",\"url\":\"interfaces/types_equipment.Equipment.html\",\"classes\":\"tsd-kind-interface tsd-parent-kind-module\",\"parent\":\"types/equipment\"},{\"id\":317,\"kind\":1024,\"name\":\"wikiUrl\",\"url\":\"interfaces/types_equipment.Equipment.html#wikiUrl\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/equipment.Equipment\"},{\"id\":318,\"kind\":1024,\"name\":\"category\",\"url\":\"interfaces/types_equipment.Equipment.html#category\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/equipment.Equipment\"},{\"id\":319,\"kind\":1024,\"name\":\"names\",\"url\":\"interfaces/types_equipment.Equipment.html#names\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/equipment.Equipment\"},{\"id\":320,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_equipment.Equipment.html#__type-1\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"types/equipment.Equipment\"},{\"id\":321,\"kind\":1024,\"name\":\"en\",\"url\":\"interfaces/types_equipment.Equipment.html#__type-1.en\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/equipment.Equipment.__type\"},{\"id\":322,\"kind\":1024,\"name\":\"cn\",\"url\":\"interfaces/types_equipment.Equipment.html#__type-1.cn\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/equipment.Equipment.__type\"},{\"id\":323,\"kind\":1024,\"name\":\"jp\",\"url\":\"interfaces/types_equipment.Equipment.html#__type-1.jp\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/equipment.Equipment.__type\"},{\"id\":324,\"kind\":1024,\"name\":\"kr\",\"url\":\"interfaces/types_equipment.Equipment.html#__type-1.kr\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/equipment.Equipment.__type\"},{\"id\":325,\"kind\":1024,\"name\":\"type\",\"url\":\"interfaces/types_equipment.Equipment.html#type\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/equipment.Equipment\"},{\"id\":326,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_equipment.Equipment.html#__type-3\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"types/equipment.Equipment\"},{\"id\":327,\"kind\":1024,\"name\":\"focus\",\"url\":\"interfaces/types_equipment.Equipment.html#__type-3.focus\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/equipment.Equipment.__type\"},{\"id\":328,\"kind\":1024,\"name\":\"name\",\"url\":\"interfaces/types_equipment.Equipment.html#__type-3.name\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/equipment.Equipment.__type\"},{\"id\":329,\"kind\":1024,\"name\":\"nationality\",\"url\":\"interfaces/types_equipment.Equipment.html#nationality\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/equipment.Equipment\"},{\"id\":330,\"kind\":1024,\"name\":\"image\",\"url\":\"interfaces/types_equipment.Equipment.html#image\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/equipment.Equipment\"},{\"id\":331,\"kind\":1024,\"name\":\"fits\",\"url\":\"interfaces/types_equipment.Equipment.html#fits\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/equipment.Equipment\"},{\"id\":332,\"kind\":1024,\"name\":\"misc\",\"url\":\"interfaces/types_equipment.Equipment.html#misc\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/equipment.Equipment\"},{\"id\":333,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_equipment.Equipment.html#__type\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"types/equipment.Equipment\"},{\"id\":334,\"kind\":1024,\"name\":\"obtainedFrom\",\"url\":\"interfaces/types_equipment.Equipment.html#__type.obtainedFrom\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/equipment.Equipment.__type\"},{\"id\":335,\"kind\":1024,\"name\":\"animation\",\"url\":\"interfaces/types_equipment.Equipment.html#__type.animation\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/equipment.Equipment.__type\"},{\"id\":336,\"kind\":1024,\"name\":\"tiers\",\"url\":\"interfaces/types_equipment.Equipment.html#tiers\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/equipment.Equipment\"},{\"id\":337,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_equipment.Equipment.html#__type-2\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"types/equipment.Equipment\"},{\"id\":338,\"kind\":1024,\"name\":\"T0\",\"url\":\"interfaces/types_equipment.Equipment.html#__type-2.T0\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/equipment.Equipment.__type\"},{\"id\":339,\"kind\":1024,\"name\":\"T1\",\"url\":\"interfaces/types_equipment.Equipment.html#__type-2.T1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/equipment.Equipment.__type\"},{\"id\":340,\"kind\":1024,\"name\":\"T2\",\"url\":\"interfaces/types_equipment.Equipment.html#__type-2.T2\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/equipment.Equipment.__type\"},{\"id\":341,\"kind\":1024,\"name\":\"T3\",\"url\":\"interfaces/types_equipment.Equipment.html#__type-2.T3\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/equipment.Equipment.__type\"},{\"id\":342,\"kind\":1024,\"name\":\"id\",\"url\":\"interfaces/types_equipment.Equipment.html#id\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited\",\"parent\":\"types/equipment.Equipment\"},{\"id\":343,\"kind\":2,\"name\":\"types/identifiable\",\"url\":\"modules/types_identifiable.html\",\"classes\":\"tsd-kind-module\"},{\"id\":344,\"kind\":256,\"name\":\"Identifiable\",\"url\":\"interfaces/types_identifiable.Identifiable.html\",\"classes\":\"tsd-kind-interface tsd-parent-kind-module\",\"parent\":\"types/identifiable\"},{\"id\":345,\"kind\":1024,\"name\":\"id\",\"url\":\"interfaces/types_identifiable.Identifiable.html#id\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/identifiable.Identifiable\"},{\"id\":346,\"kind\":2,\"name\":\"types/ship\",\"url\":\"modules/types_ship.html\",\"classes\":\"tsd-kind-module\"},{\"id\":347,\"kind\":256,\"name\":\"shipAdvancedOptions\",\"url\":\"interfaces/types_ship.shipAdvancedOptions.html\",\"classes\":\"tsd-kind-interface tsd-parent-kind-module\",\"parent\":\"types/ship\"},{\"id\":348,\"kind\":1024,\"name\":\"nameOnly\",\"url\":\"interfaces/types_ship.shipAdvancedOptions.html#nameOnly\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.shipAdvancedOptions\"},{\"id\":349,\"kind\":1024,\"name\":\"idOnly\",\"url\":\"interfaces/types_ship.shipAdvancedOptions.html#idOnly\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.shipAdvancedOptions\"},{\"id\":350,\"kind\":1024,\"name\":\"language\",\"url\":\"interfaces/types_ship.shipAdvancedOptions.html#language\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.shipAdvancedOptions\"},{\"id\":351,\"kind\":256,\"name\":\"Ship\",\"url\":\"interfaces/types_ship.Ship.html\",\"classes\":\"tsd-kind-interface tsd-parent-kind-module\",\"parent\":\"types/ship\"},{\"id\":352,\"kind\":1024,\"name\":\"wikiUrl\",\"url\":\"interfaces/types_ship.Ship.html#wikiUrl\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":353,\"kind\":1024,\"name\":\"names\",\"url\":\"interfaces/types_ship.Ship.html#names\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":354,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_ship.Ship.html#__type-6\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":355,\"kind\":1024,\"name\":\"code\",\"url\":\"interfaces/types_ship.Ship.html#__type-6.code\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":356,\"kind\":1024,\"name\":\"en\",\"url\":\"interfaces/types_ship.Ship.html#__type-6.en\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":357,\"kind\":1024,\"name\":\"cn\",\"url\":\"interfaces/types_ship.Ship.html#__type-6.cn\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":358,\"kind\":1024,\"name\":\"jp\",\"url\":\"interfaces/types_ship.Ship.html#__type-6.jp\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":359,\"kind\":1024,\"name\":\"kr\",\"url\":\"interfaces/types_ship.Ship.html#__type-6.kr\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":360,\"kind\":1024,\"name\":\"thumbnail\",\"url\":\"interfaces/types_ship.Ship.html#thumbnail\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":361,\"kind\":1024,\"name\":\"hexagon\",\"url\":\"interfaces/types_ship.Ship.html#hexagon\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":362,\"kind\":1024,\"name\":\"class\",\"url\":\"interfaces/types_ship.Ship.html#class\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":363,\"kind\":1024,\"name\":\"nationality\",\"url\":\"interfaces/types_ship.Ship.html#nationality\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":364,\"kind\":1024,\"name\":\"hullType\",\"url\":\"interfaces/types_ship.Ship.html#hullType\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":365,\"kind\":1024,\"name\":\"rarity\",\"url\":\"interfaces/types_ship.Ship.html#rarity\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":366,\"kind\":1024,\"name\":\"stars\",\"url\":\"interfaces/types_ship.Ship.html#stars\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":367,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_ship.Ship.html#__type-9\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":368,\"kind\":1024,\"name\":\"stars\",\"url\":\"interfaces/types_ship.Ship.html#__type-9.stars-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":369,\"kind\":1024,\"name\":\"value\",\"url\":\"interfaces/types_ship.Ship.html#__type-9.value\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":370,\"kind\":1024,\"name\":\"stats\",\"url\":\"interfaces/types_ship.Ship.html#stats\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":371,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_ship.Ship.html#__type-10\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":372,\"kind\":1024,\"name\":\"baseStats\",\"url\":\"interfaces/types_ship.Ship.html#__type-10.baseStats\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":373,\"kind\":1024,\"name\":\"level100\",\"url\":\"interfaces/types_ship.Ship.html#__type-10.level100\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":374,\"kind\":1024,\"name\":\"level120\",\"url\":\"interfaces/types_ship.Ship.html#__type-10.level120\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":375,\"kind\":1024,\"name\":\"level100Retrofit\",\"url\":\"interfaces/types_ship.Ship.html#__type-10.level100Retrofit\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":376,\"kind\":1024,\"name\":\"level120Retrofit\",\"url\":\"interfaces/types_ship.Ship.html#__type-10.level120Retrofit\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":377,\"kind\":1024,\"name\":\"slots\",\"url\":\"interfaces/types_ship.Ship.html#slots\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":378,\"kind\":1024,\"name\":\"enhanceValue\",\"url\":\"interfaces/types_ship.Ship.html#enhanceValue\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":379,\"kind\":1024,\"name\":\"scrapValue\",\"url\":\"interfaces/types_ship.Ship.html#scrapValue\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":380,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_ship.Ship.html#__type-8\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":381,\"kind\":1024,\"name\":\"coin\",\"url\":\"interfaces/types_ship.Ship.html#__type-8.coin\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":382,\"kind\":1024,\"name\":\"oil\",\"url\":\"interfaces/types_ship.Ship.html#__type-8.oil\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":383,\"kind\":1024,\"name\":\"medal\",\"url\":\"interfaces/types_ship.Ship.html#__type-8.medal\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":384,\"kind\":1024,\"name\":\"skills\",\"url\":\"interfaces/types_ship.Ship.html#skills\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":385,\"kind\":1024,\"name\":\"skins\",\"url\":\"interfaces/types_ship.Ship.html#skins\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":386,\"kind\":1024,\"name\":\"gallery\",\"url\":\"interfaces/types_ship.Ship.html#gallery\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":387,\"kind\":1024,\"name\":\"limitBreaks\",\"url\":\"interfaces/types_ship.Ship.html#limitBreaks\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":388,\"kind\":1024,\"name\":\"fleetTech\",\"url\":\"interfaces/types_ship.Ship.html#fleetTech\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":389,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_ship.Ship.html#__type-2\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":390,\"kind\":1024,\"name\":\"statsBonus\",\"url\":\"interfaces/types_ship.Ship.html#__type-2.statsBonus\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":391,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_ship.Ship.html#__type-2.__type-3\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":392,\"kind\":1024,\"name\":\"collection\",\"url\":\"interfaces/types_ship.Ship.html#__type-2.__type-3.collection\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type.__type\"},{\"id\":393,\"kind\":1024,\"name\":\"maxLevel\",\"url\":\"interfaces/types_ship.Ship.html#__type-2.__type-3.maxLevel\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type.__type\"},{\"id\":394,\"kind\":1024,\"name\":\"techPoints\",\"url\":\"interfaces/types_ship.Ship.html#__type-2.techPoints\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":395,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_ship.Ship.html#__type-2.__type-4\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":396,\"kind\":1024,\"name\":\"collection\",\"url\":\"interfaces/types_ship.Ship.html#__type-2.__type-4.collection-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type.__type\"},{\"id\":397,\"kind\":1024,\"name\":\"maxLimitBreak\",\"url\":\"interfaces/types_ship.Ship.html#__type-2.__type-4.maxLimitBreak\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type.__type\"},{\"id\":398,\"kind\":1024,\"name\":\"maxLevel\",\"url\":\"interfaces/types_ship.Ship.html#__type-2.__type-4.maxLevel-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type.__type\"},{\"id\":399,\"kind\":1024,\"name\":\"total\",\"url\":\"interfaces/types_ship.Ship.html#__type-2.__type-4.total\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type.__type\"},{\"id\":400,\"kind\":1024,\"name\":\"retrofit\",\"url\":\"interfaces/types_ship.Ship.html#retrofit\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":401,\"kind\":1024,\"name\":\"retrofitId\",\"url\":\"interfaces/types_ship.Ship.html#retrofitId\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":402,\"kind\":1024,\"name\":\"retrofitHullType\",\"url\":\"interfaces/types_ship.Ship.html#retrofitHullType\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":403,\"kind\":1024,\"name\":\"retrofitProjects\",\"url\":\"interfaces/types_ship.Ship.html#retrofitProjects\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":404,\"kind\":1024,\"name\":\"construction\",\"url\":\"interfaces/types_ship.Ship.html#construction\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":405,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_ship.Ship.html#__type\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":406,\"kind\":1024,\"name\":\"constructionTime\",\"url\":\"interfaces/types_ship.Ship.html#__type.constructionTime\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":407,\"kind\":1024,\"name\":\"availableIn\",\"url\":\"interfaces/types_ship.Ship.html#__type.availableIn\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":408,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_ship.Ship.html#__type.__type-1\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":409,\"kind\":1024,\"name\":\"light\",\"url\":\"interfaces/types_ship.Ship.html#__type.__type-1.light\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type.__type\"},{\"id\":410,\"kind\":1024,\"name\":\"heavy\",\"url\":\"interfaces/types_ship.Ship.html#__type.__type-1.heavy\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type.__type\"},{\"id\":411,\"kind\":1024,\"name\":\"aviation\",\"url\":\"interfaces/types_ship.Ship.html#__type.__type-1.aviation\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type.__type\"},{\"id\":412,\"kind\":1024,\"name\":\"limited\",\"url\":\"interfaces/types_ship.Ship.html#__type.__type-1.limited\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type.__type\"},{\"id\":413,\"kind\":1024,\"name\":\"exchange\",\"url\":\"interfaces/types_ship.Ship.html#__type.__type-1.exchange\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type.__type\"},{\"id\":414,\"kind\":1024,\"name\":\"obtainedFrom\",\"url\":\"interfaces/types_ship.Ship.html#obtainedFrom\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":415,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_ship.Ship.html#__type-7\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":416,\"kind\":1024,\"name\":\"obtainedFrom\",\"url\":\"interfaces/types_ship.Ship.html#__type-7.obtainedFrom-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":417,\"kind\":1024,\"name\":\"fromMaps\",\"url\":\"interfaces/types_ship.Ship.html#__type-7.fromMaps\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":418,\"kind\":1024,\"name\":\"misc\",\"url\":\"interfaces/types_ship.Ship.html#misc\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":419,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/types_ship.Ship.html#__type-5\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"types/ship.Ship\"},{\"id\":420,\"kind\":1024,\"name\":\"artist\",\"url\":\"interfaces/types_ship.Ship.html#__type-5.artist\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":421,\"kind\":1024,\"name\":\"web\",\"url\":\"interfaces/types_ship.Ship.html#__type-5.web\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":422,\"kind\":1024,\"name\":\"pixiv\",\"url\":\"interfaces/types_ship.Ship.html#__type-5.pixiv\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":423,\"kind\":1024,\"name\":\"twitter\",\"url\":\"interfaces/types_ship.Ship.html#__type-5.twitter\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":424,\"kind\":1024,\"name\":\"voice\",\"url\":\"interfaces/types_ship.Ship.html#__type-5.voice\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"types/ship.Ship.__type\"},{\"id\":425,\"kind\":1024,\"name\":\"id\",\"url\":\"interfaces/types_ship.Ship.html#id\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited\",\"parent\":\"types/ship.Ship\"},{\"id\":426,\"kind\":2,\"name\":\"types/voiceline\",\"url\":\"modules/types_voiceline.html\",\"classes\":\"tsd-kind-module\"},{\"id\":427,\"kind\":256,\"name\":\"Voiceline\",\"url\":\"interfaces/types_voiceline.Voiceline.html\",\"classes\":\"tsd-kind-interface tsd-parent-kind-module\",\"parent\":\"types/voiceline\"},{\"id\":428,\"kind\":1024,\"name\":\"event\",\"url\":\"interfaces/types_voiceline.Voiceline.html#event\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/voiceline.Voiceline\"},{\"id\":429,\"kind\":1024,\"name\":\"en\",\"url\":\"interfaces/types_voiceline.Voiceline.html#en\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/voiceline.Voiceline\"},{\"id\":430,\"kind\":1024,\"name\":\"zh\",\"url\":\"interfaces/types_voiceline.Voiceline.html#zh\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/voiceline.Voiceline\"},{\"id\":431,\"kind\":1024,\"name\":\"jp\",\"url\":\"interfaces/types_voiceline.Voiceline.html#jp\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/voiceline.Voiceline\"},{\"id\":432,\"kind\":1024,\"name\":\"audio\",\"url\":\"interfaces/types_voiceline.Voiceline.html#audio\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"types/voiceline.Voiceline\"},{\"id\":433,\"kind\":1024,\"name\":\"id\",\"url\":\"interfaces/types_voiceline.Voiceline.html#id\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited\",\"parent\":\"types/voiceline.Voiceline\"},{\"id\":434,\"kind\":16777216,\"name\":\"Source\",\"url\":\"modules/index.html#Source\",\"classes\":\"tsd-kind-reference tsd-parent-kind-module\",\"parent\":\"index\"},{\"id\":435,\"kind\":16777216,\"name\":\"CacheOptions\",\"url\":\"modules/index.html#CacheOptions\",\"classes\":\"tsd-kind-reference tsd-parent-kind-module\",\"parent\":\"index\"},{\"id\":436,\"kind\":16777216,\"name\":\"instance\",\"url\":\"modules/index.html#instance\",\"classes\":\"tsd-kind-reference tsd-parent-kind-module\",\"parent\":\"index\"},{\"id\":437,\"kind\":16777216,\"name\":\"AzurAPI\",\"url\":\"modules/index.html#AzurAPI\",\"classes\":\"tsd-kind-reference tsd-parent-kind-module\",\"parent\":\"index\"}],\"index\":{\"version\":\"2.3.9\",\"fields\":[\"name\",\"parent\"],\"fieldVectors\":[[\"name/0\",[0,42.553]],[\"parent/0\",[]],[\"name/1\",[1,57.365]],[\"parent/1\",[0,4.144]],[\"name/2\",[2,48.807]],[\"parent/2\",[0,4.144]],[\"name/3\",[3,57.365]],[\"parent/3\",[0,4.144]],[\"name/4\",[4,52.205]],[\"parent/4\",[5,4.753]],[\"name/5\",[6,52.205]],[\"parent/5\",[5,4.753]],[\"name/6\",[2,48.807]],[\"parent/6\",[5,4.753]],[\"name/7\",[7,57.365]],[\"parent/7\",[0,4.144]],[\"name/8\",[8,25.124]],[\"parent/8\",[9,5.587]],[\"name/9\",[10,40.884,11,40.884]],[\"parent/9\",[12,3.17]],[\"name/10\",[13,40.884,14,40.884]],[\"parent/10\",[12,3.17]],[\"name/11\",[15,40.884,16,37.207]],[\"parent/11\",[12,3.17]],[\"name/12\",[17,40.884,18,40.884]],[\"parent/12\",[12,3.17]],[\"name/13\",[19,40.884,20,40.884]],[\"parent/13\",[12,3.17]],[\"name/14\",[21,40.884,22,40.884]],[\"parent/14\",[12,3.17]],[\"name/15\",[23,40.884,24,40.884]],[\"parent/15\",[12,3.17]],[\"name/16\",[25,40.884,26,40.884]],[\"parent/16\",[12,3.17]],[\"name/17\",[16,37.207,27,40.884]],[\"parent/17\",[12,3.17]],[\"name/18\",[28,57.365]],[\"parent/18\",[12,3.17]],[\"name/19\",[29,57.365]],[\"parent/19\",[12,3.17]],[\"name/20\",[30,40.884,31,40.884]],[\"parent/20\",[12,3.17]],[\"name/21\",[32,57.365]],[\"parent/21\",[12,3.17]],[\"name/22\",[33,40.884,34,40.884]],[\"parent/22\",[12,3.17]],[\"name/23\",[35,57.365]],[\"parent/23\",[12,3.17]],[\"name/24\",[36,57.365]],[\"parent/24\",[12,3.17]],[\"name/25\",[37,57.365]],[\"parent/25\",[12,3.17]],[\"name/26\",[38,52.205]],[\"parent/26\",[0,4.144]],[\"name/27\",[39,39.844]],[\"parent/27\",[40,3.425]],[\"name/28\",[41,42.553]],[\"parent/28\",[40,3.425]],[\"name/29\",[42,42.553]],[\"parent/29\",[40,3.425]],[\"name/30\",[43,52.205]],[\"parent/30\",[40,3.425]],[\"name/31\",[44,42.553]],[\"parent/31\",[40,3.425]],[\"name/32\",[45,42.553]],[\"parent/32\",[40,3.425]],[\"name/33\",[46,35.171]],[\"parent/33\",[40,3.425]],[\"name/34\",[47,42.553]],[\"parent/34\",[40,3.425]],[\"name/35\",[48,42.553]],[\"parent/35\",[40,3.425]],[\"name/36\",[49,39.844]],[\"parent/36\",[40,3.425]],[\"name/37\",[50,42.553]],[\"parent/37\",[40,3.425]],[\"name/38\",[51,42.553]],[\"parent/38\",[40,3.425]],[\"name/39\",[52,42.553]],[\"parent/39\",[40,3.425]],[\"name/40\",[53,52.205]],[\"parent/40\",[]],[\"name/41\",[54,44.241]],[\"parent/41\",[53,5.084]],[\"name/42\",[39,39.844]],[\"parent/42\",[55,3.228]],[\"name/43\",[56,42.553]],[\"parent/43\",[55,3.228]],[\"name/44\",[57,46.268]],[\"parent/44\",[55,3.228]],[\"name/45\",[58,46.268]],[\"parent/45\",[55,3.228]],[\"name/46\",[59,39.844]],[\"parent/46\",[55,3.228]],[\"name/47\",[41,42.553]],[\"parent/47\",[55,3.228]],[\"name/48\",[42,42.553]],[\"parent/48\",[55,3.228]],[\"name/49\",[44,42.553]],[\"parent/49\",[55,3.228]],[\"name/50\",[45,42.553]],[\"parent/50\",[55,3.228]],[\"name/51\",[46,35.171]],[\"parent/51\",[55,3.228]],[\"name/52\",[47,42.553]],[\"parent/52\",[55,3.228]],[\"name/53\",[48,42.553]],[\"parent/53\",[55,3.228]],[\"name/54\",[49,39.844]],[\"parent/54\",[55,3.228]],[\"name/55\",[50,42.553]],[\"parent/55\",[55,3.228]],[\"name/56\",[51,42.553]],[\"parent/56\",[55,3.228]],[\"name/57\",[52,42.553]],[\"parent/57\",[55,3.228]],[\"name/58\",[60,52.205]],[\"parent/58\",[]],[\"name/59\",[61,44.241]],[\"parent/59\",[60,5.084]],[\"name/60\",[39,39.844]],[\"parent/60\",[62,3.425]],[\"name/61\",[56,42.553]],[\"parent/61\",[62,3.425]],[\"name/62\",[41,42.553]],[\"parent/62\",[62,3.425]],[\"name/63\",[42,42.553]],[\"parent/63\",[62,3.425]],[\"name/64\",[44,42.553]],[\"parent/64\",[62,3.425]],[\"name/65\",[45,42.553]],[\"parent/65\",[62,3.425]],[\"name/66\",[46,35.171]],[\"parent/66\",[62,3.425]],[\"name/67\",[47,42.553]],[\"parent/67\",[62,3.425]],[\"name/68\",[48,42.553]],[\"parent/68\",[62,3.425]],[\"name/69\",[49,39.844]],[\"parent/69\",[62,3.425]],[\"name/70\",[50,42.553]],[\"parent/70\",[62,3.425]],[\"name/71\",[51,42.553]],[\"parent/71\",[62,3.425]],[\"name/72\",[52,42.553]],[\"parent/72\",[62,3.425]],[\"name/73\",[63,52.205]],[\"parent/73\",[]],[\"name/74\",[64,44.241]],[\"parent/74\",[63,5.084]],[\"name/75\",[39,39.844]],[\"parent/75\",[65,3.228]],[\"name/76\",[56,42.553]],[\"parent/76\",[65,3.228]],[\"name/77\",[66,52.205]],[\"parent/77\",[65,3.228]],[\"name/78\",[67,46.268]],[\"parent/78\",[65,3.228]],[\"name/79\",[47,42.553]],[\"parent/79\",[65,3.228]],[\"name/80\",[68,52.205]],[\"parent/80\",[65,3.228]],[\"name/81\",[41,42.553]],[\"parent/81\",[65,3.228]],[\"name/82\",[42,42.553]],[\"parent/82\",[65,3.228]],[\"name/83\",[44,42.553]],[\"parent/83\",[65,3.228]],[\"name/84\",[45,42.553]],[\"parent/84\",[65,3.228]],[\"name/85\",[46,35.171]],[\"parent/85\",[65,3.228]],[\"name/86\",[48,42.553]],[\"parent/86\",[65,3.228]],[\"name/87\",[49,39.844]],[\"parent/87\",[65,3.228]],[\"name/88\",[50,42.553]],[\"parent/88\",[65,3.228]],[\"name/89\",[51,42.553]],[\"parent/89\",[65,3.228]],[\"name/90\",[52,42.553]],[\"parent/90\",[65,3.228]],[\"name/91\",[69,52.205]],[\"parent/91\",[]],[\"name/92\",[59,39.844]],[\"parent/92\",[69,5.084]],[\"name/93\",[39,39.844]],[\"parent/93\",[70,3.228]],[\"name/94\",[56,42.553]],[\"parent/94\",[70,3.228]],[\"name/95\",[58,46.268]],[\"parent/95\",[70,3.228]],[\"name/96\",[67,46.268]],[\"parent/96\",[70,3.228]],[\"name/97\",[47,42.553]],[\"parent/97\",[70,3.228]],[\"name/98\",[68,52.205]],[\"parent/98\",[70,3.228]],[\"name/99\",[41,42.553]],[\"parent/99\",[70,3.228]],[\"name/100\",[42,42.553]],[\"parent/100\",[70,3.228]],[\"name/101\",[44,42.553]],[\"parent/101\",[70,3.228]],[\"name/102\",[45,42.553]],[\"parent/102\",[70,3.228]],[\"name/103\",[46,35.171]],[\"parent/103\",[70,3.228]],[\"name/104\",[48,42.553]],[\"parent/104\",[70,3.228]],[\"name/105\",[49,39.844]],[\"parent/105\",[70,3.228]],[\"name/106\",[50,42.553]],[\"parent/106\",[70,3.228]],[\"name/107\",[51,42.553]],[\"parent/107\",[70,3.228]],[\"name/108\",[52,42.553]],[\"parent/108\",[70,3.228]],[\"name/109\",[71,52.205]],[\"parent/109\",[]],[\"name/110\",[72,44.241]],[\"parent/110\",[71,5.084]],[\"name/111\",[39,39.844]],[\"parent/111\",[73,3.501]],[\"name/112\",[41,42.553]],[\"parent/112\",[73,3.501]],[\"name/113\",[42,42.553]],[\"parent/113\",[73,3.501]],[\"name/114\",[44,42.553]],[\"parent/114\",[73,3.501]],[\"name/115\",[45,42.553]],[\"parent/115\",[73,3.501]],[\"name/116\",[46,35.171]],[\"parent/116\",[73,3.501]],[\"name/117\",[47,42.553]],[\"parent/117\",[73,3.501]],[\"name/118\",[48,42.553]],[\"parent/118\",[73,3.501]],[\"name/119\",[49,39.844]],[\"parent/119\",[73,3.501]],[\"name/120\",[50,42.553]],[\"parent/120\",[73,3.501]],[\"name/121\",[51,42.553]],[\"parent/121\",[73,3.501]],[\"name/122\",[52,42.553]],[\"parent/122\",[73,3.501]],[\"name/123\",[74,52.205]],[\"parent/123\",[]],[\"name/124\",[38,52.205]],[\"parent/124\",[74,5.084]],[\"name/125\",[39,39.844]],[\"parent/125\",[75,3.88]],[\"name/126\",[76,57.365]],[\"parent/126\",[75,3.88]],[\"name/127\",[43,52.205]],[\"parent/127\",[75,3.88]],[\"name/128\",[77,57.365]],[\"parent/128\",[75,3.88]],[\"name/129\",[78,57.365]],[\"parent/129\",[75,3.88]],[\"name/130\",[79,57.365]],[\"parent/130\",[75,3.88]],[\"name/131\",[80,57.365]],[\"parent/131\",[75,3.88]],[\"name/132\",[81,57.365]],[\"parent/132\",[75,3.88]],[\"name/133\",[82,44.241]],[\"parent/133\",[]],[\"name/134\",[83,46.268]],[\"parent/134\",[82,4.309]],[\"name/135\",[84,52.205]],[\"parent/135\",[82,4.309]],[\"name/136\",[83,46.268]],[\"parent/136\",[85,4.753]],[\"name/137\",[86,52.205]],[\"parent/137\",[85,4.753]],[\"name/138\",[87,52.205]],[\"parent/138\",[85,4.753]],[\"name/139\",[88,52.205]],[\"parent/139\",[82,4.309]],[\"name/140\",[89,52.205]],[\"parent/140\",[82,4.309]],[\"name/141\",[39,39.844]],[\"parent/141\",[90,3.355]],[\"name/142\",[91,57.365]],[\"parent/142\",[90,3.355]],[\"name/143\",[83,46.268]],[\"parent/143\",[90,3.355]],[\"name/144\",[86,52.205]],[\"parent/144\",[90,3.355]],[\"name/145\",[87,52.205]],[\"parent/145\",[90,3.355]],[\"name/146\",[92,57.365]],[\"parent/146\",[90,3.355]],[\"name/147\",[59,39.844]],[\"parent/147\",[90,3.355]],[\"name/148\",[64,44.241]],[\"parent/148\",[90,3.355]],[\"name/149\",[61,44.241]],[\"parent/149\",[90,3.355]],[\"name/150\",[72,44.241]],[\"parent/150\",[90,3.355]],[\"name/151\",[54,44.241]],[\"parent/151\",[90,3.355]],[\"name/152\",[93,57.365]],[\"parent/152\",[90,3.355]],[\"name/153\",[8,25.124]],[\"parent/153\",[90,3.355]],[\"name/154\",[59,39.844]],[\"parent/154\",[94,4.309]],[\"name/155\",[64,44.241]],[\"parent/155\",[94,4.309]],[\"name/156\",[61,44.241]],[\"parent/156\",[94,4.309]],[\"name/157\",[72,44.241]],[\"parent/157\",[94,4.309]],[\"name/158\",[54,44.241]],[\"parent/158\",[94,4.309]],[\"name/159\",[95,57.365]],[\"parent/159\",[90,3.355]],[\"name/160\",[96,42.553]],[\"parent/160\",[]],[\"name/161\",[97,57.365]],[\"parent/161\",[96,4.144]],[\"name/162\",[8,25.124]],[\"parent/162\",[98,5.587]],[\"name/163\",[99,57.365]],[\"parent/163\",[100,3.88]],[\"name/164\",[59,39.844]],[\"parent/164\",[100,3.88]],[\"name/165\",[64,44.241]],[\"parent/165\",[100,3.88]],[\"name/166\",[61,44.241]],[\"parent/166\",[100,3.88]],[\"name/167\",[72,44.241]],[\"parent/167\",[100,3.88]],[\"name/168\",[54,44.241]],[\"parent/168\",[100,3.88]],[\"name/169\",[101,52.205]],[\"parent/169\",[100,3.88]],[\"name/170\",[102,52.205]],[\"parent/170\",[100,3.88]],[\"name/171\",[103,57.365]],[\"parent/171\",[96,4.144]],[\"name/172\",[8,25.124]],[\"parent/172\",[104,5.587]],[\"name/173\",[59,39.844]],[\"parent/173\",[105,4.003]],[\"name/174\",[64,44.241]],[\"parent/174\",[105,4.003]],[\"name/175\",[61,44.241]],[\"parent/175\",[105,4.003]],[\"name/176\",[72,44.241]],[\"parent/176\",[105,4.003]],[\"name/177\",[54,44.241]],[\"parent/177\",[105,4.003]],[\"name/178\",[101,52.205]],[\"parent/178\",[105,4.003]],[\"name/179\",[102,52.205]],[\"parent/179\",[105,4.003]],[\"name/180\",[106,57.365]],[\"parent/180\",[96,4.144]],[\"name/181\",[107,57.365]],[\"parent/181\",[96,4.144]],[\"name/182\",[108,57.365]],[\"parent/182\",[96,4.144]],[\"name/183\",[109,46.268]],[\"parent/183\",[]],[\"name/184\",[110,57.365]],[\"parent/184\",[109,4.506]],[\"name/185\",[111,57.365]],[\"parent/185\",[109,4.506]],[\"name/186\",[112,57.365]],[\"parent/186\",[109,4.506]],[\"name/187\",[113,44.241]],[\"parent/187\",[]],[\"name/188\",[114,41.108]],[\"parent/188\",[]],[\"name/189\",[115,57.365]],[\"parent/189\",[114,4.003]],[\"name/190\",[59,39.844]],[\"parent/190\",[114,4.003]],[\"name/191\",[58,46.268]],[\"parent/191\",[114,4.003]],[\"name/192\",[116,57.365]],[\"parent/192\",[114,4.003]],[\"name/193\",[117,52.205]],[\"parent/193\",[114,4.003]],[\"name/194\",[57,46.268]],[\"parent/194\",[118,4.506]],[\"name/195\",[119,57.365]],[\"parent/195\",[118,4.506]],[\"name/196\",[120,57.365]],[\"parent/196\",[118,4.506]],[\"name/197\",[121,57.365]],[\"parent/197\",[118,4.506]],[\"name/198\",[122,57.365]],[\"parent/198\",[114,4.003]],[\"name/199\",[57,46.268]],[\"parent/199\",[123,4.003]],[\"name/200\",[124,57.365]],[\"parent/200\",[123,4.003]],[\"name/201\",[56,42.553]],[\"parent/201\",[123,4.003]],[\"name/202\",[59,39.844]],[\"parent/202\",[123,4.003]],[\"name/203\",[58,46.268]],[\"parent/203\",[123,4.003]],[\"name/204\",[117,52.205]],[\"parent/204\",[123,4.003]],[\"name/205\",[46,35.171]],[\"parent/205\",[123,4.003]],[\"name/206\",[125,48.807]],[\"parent/206\",[]],[\"name/207\",[126,57.365]],[\"parent/207\",[125,4.753]],[\"name/208\",[127,57.365]],[\"parent/208\",[128,4.003]],[\"name/209\",[129,57.365]],[\"parent/209\",[128,4.003]],[\"name/210\",[130,57.365]],[\"parent/210\",[128,4.003]],[\"name/211\",[131,57.365]],[\"parent/211\",[128,4.003]],[\"name/212\",[132,46.268]],[\"parent/212\",[128,4.003]],[\"name/213\",[8,25.124]],[\"parent/213\",[128,4.003]],[\"name/214\",[133,44.241]],[\"parent/214\",[134,4.753]],[\"name/215\",[135,46.268]],[\"parent/215\",[134,4.753]],[\"name/216\",[136,44.241]],[\"parent/216\",[134,4.753]],[\"name/217\",[46,35.171]],[\"parent/217\",[128,4.003]],[\"name/218\",[137,57.365]],[\"parent/218\",[125,4.753]],[\"name/219\",[132,46.268]],[\"parent/219\",[138,4.003]],[\"name/220\",[8,25.124]],[\"parent/220\",[138,4.003]],[\"name/221\",[133,44.241]],[\"parent/221\",[139,2.147]],[\"name/222\",[135,46.268]],[\"parent/222\",[139,2.147]],[\"name/223\",[136,44.241]],[\"parent/223\",[139,2.147]],[\"name/224\",[140,57.365]],[\"parent/224\",[138,4.003]],[\"name/225\",[8,25.124]],[\"parent/225\",[138,4.003]],[\"name/226\",[141,52.205]],[\"parent/226\",[139,2.147]],[\"name/227\",[142,48.807]],[\"parent/227\",[139,2.147]],[\"name/228\",[143,52.205]],[\"parent/228\",[139,2.147]],[\"name/229\",[144,52.205]],[\"parent/229\",[139,2.147]],[\"name/230\",[8,25.124]],[\"parent/230\",[139,2.147]],[\"name/231\",[145,52.205]],[\"parent/231\",[146,2.344]],[\"name/232\",[147,52.205]],[\"parent/232\",[146,2.344]],[\"name/233\",[148,57.365]],[\"parent/233\",[139,2.147]],[\"name/234\",[8,25.124]],[\"parent/234\",[139,2.147]],[\"name/235\",[149,57.365]],[\"parent/235\",[146,2.344]],[\"name/236\",[150,52.205]],[\"parent/236\",[146,2.344]],[\"name/237\",[151,52.205]],[\"parent/237\",[146,2.344]],[\"name/238\",[152,52.205]],[\"parent/238\",[139,2.147]],[\"name/239\",[153,52.205]],[\"parent/239\",[139,2.147]],[\"name/240\",[8,25.124]],[\"parent/240\",[139,2.147]],[\"name/241\",[154,52.205]],[\"parent/241\",[146,2.344]],[\"name/242\",[155,52.205]],[\"parent/242\",[146,2.344]],[\"name/243\",[156,52.205]],[\"parent/243\",[146,2.344]],[\"name/244\",[157,52.205]],[\"parent/244\",[139,2.147]],[\"name/245\",[8,25.124]],[\"parent/245\",[139,2.147]],[\"name/246\",[158,52.205]],[\"parent/246\",[146,2.344]],[\"name/247\",[159,52.205]],[\"parent/247\",[146,2.344]],[\"name/248\",[160,52.205]],[\"parent/248\",[146,2.344]],[\"name/249\",[161,52.205]],[\"parent/249\",[146,2.344]],[\"name/250\",[162,52.205]],[\"parent/250\",[139,2.147]],[\"name/251\",[163,52.205]],[\"parent/251\",[139,2.147]],[\"name/252\",[164,52.205]],[\"parent/252\",[139,2.147]],[\"name/253\",[165,52.205]],[\"parent/253\",[139,2.147]],[\"name/254\",[8,25.124]],[\"parent/254\",[139,2.147]],[\"name/255\",[166,52.205]],[\"parent/255\",[146,2.344]],[\"name/256\",[167,52.205]],[\"parent/256\",[146,2.344]],[\"name/257\",[168,52.205]],[\"parent/257\",[146,2.344]],[\"name/258\",[169,52.205]],[\"parent/258\",[139,2.147]],[\"name/259\",[170,52.205]],[\"parent/259\",[139,2.147]],[\"name/260\",[171,52.205]],[\"parent/260\",[139,2.147]],[\"name/261\",[172,52.205]],[\"parent/261\",[139,2.147]],[\"name/262\",[8,25.124]],[\"parent/262\",[139,2.147]],[\"name/263\",[173,52.205]],[\"parent/263\",[146,2.344]],[\"name/264\",[174,52.205]],[\"parent/264\",[146,2.344]],[\"name/265\",[49,39.844]],[\"parent/265\",[146,2.344]],[\"name/266\",[175,52.205]],[\"parent/266\",[146,2.344]],[\"name/267\",[176,57.365]],[\"parent/267\",[138,4.003]],[\"name/268\",[8,25.124]],[\"parent/268\",[138,4.003]],[\"name/269\",[141,52.205]],[\"parent/269\",[139,2.147]],[\"name/270\",[142,48.807]],[\"parent/270\",[139,2.147]],[\"name/271\",[143,52.205]],[\"parent/271\",[139,2.147]],[\"name/272\",[144,52.205]],[\"parent/272\",[139,2.147]],[\"name/273\",[8,25.124]],[\"parent/273\",[139,2.147]],[\"name/274\",[145,52.205]],[\"parent/274\",[146,2.344]],[\"name/275\",[147,52.205]],[\"parent/275\",[146,2.344]],[\"name/276\",[152,52.205]],[\"parent/276\",[139,2.147]],[\"name/277\",[153,52.205]],[\"parent/277\",[139,2.147]],[\"name/278\",[8,25.124]],[\"parent/278\",[139,2.147]],[\"name/279\",[154,52.205]],[\"parent/279\",[146,2.344]],[\"name/280\",[155,52.205]],[\"parent/280\",[146,2.344]],[\"name/281\",[156,52.205]],[\"parent/281\",[146,2.344]],[\"name/282\",[157,52.205]],[\"parent/282\",[139,2.147]],[\"name/283\",[8,25.124]],[\"parent/283\",[139,2.147]],[\"name/284\",[158,52.205]],[\"parent/284\",[146,2.344]],[\"name/285\",[159,52.205]],[\"parent/285\",[146,2.344]],[\"name/286\",[160,52.205]],[\"parent/286\",[146,2.344]],[\"name/287\",[161,52.205]],[\"parent/287\",[146,2.344]],[\"name/288\",[162,52.205]],[\"parent/288\",[139,2.147]],[\"name/289\",[163,52.205]],[\"parent/289\",[139,2.147]],[\"name/290\",[164,52.205]],[\"parent/290\",[139,2.147]],[\"name/291\",[165,52.205]],[\"parent/291\",[139,2.147]],[\"name/292\",[8,25.124]],[\"parent/292\",[139,2.147]],[\"name/293\",[166,52.205]],[\"parent/293\",[146,2.344]],[\"name/294\",[167,52.205]],[\"parent/294\",[146,2.344]],[\"name/295\",[168,52.205]],[\"parent/295\",[146,2.344]],[\"name/296\",[177,57.365]],[\"parent/296\",[139,2.147]],[\"name/297\",[8,25.124]],[\"parent/297\",[139,2.147]],[\"name/298\",[178,57.365]],[\"parent/298\",[146,2.344]],[\"name/299\",[179,57.365]],[\"parent/299\",[146,2.344]],[\"name/300\",[180,57.365]],[\"parent/300\",[139,2.147]],[\"name/301\",[8,25.124]],[\"parent/301\",[139,2.147]],[\"name/302\",[181,57.365]],[\"parent/302\",[146,2.344]],[\"name/303\",[182,57.365]],[\"parent/303\",[146,2.344]],[\"name/304\",[183,52.205]],[\"parent/304\",[146,2.344]],[\"name/305\",[169,52.205]],[\"parent/305\",[139,2.147]],[\"name/306\",[170,52.205]],[\"parent/306\",[139,2.147]],[\"name/307\",[171,52.205]],[\"parent/307\",[139,2.147]],[\"name/308\",[172,52.205]],[\"parent/308\",[139,2.147]],[\"name/309\",[8,25.124]],[\"parent/309\",[139,2.147]],[\"name/310\",[173,52.205]],[\"parent/310\",[146,2.344]],[\"name/311\",[174,52.205]],[\"parent/311\",[146,2.344]],[\"name/312\",[49,39.844]],[\"parent/312\",[146,2.344]],[\"name/313\",[175,52.205]],[\"parent/313\",[146,2.344]],[\"name/314\",[46,35.171]],[\"parent/314\",[138,4.003]],[\"name/315\",[184,52.205]],[\"parent/315\",[]],[\"name/316\",[185,57.365]],[\"parent/316\",[184,5.084]],[\"name/317\",[186,52.205]],[\"parent/317\",[187,3.355]],[\"name/318\",[66,52.205]],[\"parent/318\",[187,3.355]],[\"name/319\",[132,46.268]],[\"parent/319\",[187,3.355]],[\"name/320\",[8,25.124]],[\"parent/320\",[187,3.355]],[\"name/321\",[133,44.241]],[\"parent/321\",[188,3.501]],[\"name/322\",[135,46.268]],[\"parent/322\",[188,3.501]],[\"name/323\",[136,44.241]],[\"parent/323\",[188,3.501]],[\"name/324\",[189,52.205]],[\"parent/324\",[188,3.501]],[\"name/325\",[57,46.268]],[\"parent/325\",[187,3.355]],[\"name/326\",[8,25.124]],[\"parent/326\",[187,3.355]],[\"name/327\",[190,57.365]],[\"parent/327\",[188,3.501]],[\"name/328\",[56,42.553]],[\"parent/328\",[188,3.501]],[\"name/329\",[67,46.268]],[\"parent/329\",[187,3.355]],[\"name/330\",[191,57.365]],[\"parent/330\",[187,3.355]],[\"name/331\",[192,57.365]],[\"parent/331\",[187,3.355]],[\"name/332\",[193,52.205]],[\"parent/332\",[187,3.355]],[\"name/333\",[8,25.124]],[\"parent/333\",[187,3.355]],[\"name/334\",[194,48.807]],[\"parent/334\",[188,3.501]],[\"name/335\",[195,57.365]],[\"parent/335\",[188,3.501]],[\"name/336\",[196,57.365]],[\"parent/336\",[187,3.355]],[\"name/337\",[8,25.124]],[\"parent/337\",[187,3.355]],[\"name/338\",[197,57.365]],[\"parent/338\",[188,3.501]],[\"name/339\",[198,57.365]],[\"parent/339\",[188,3.501]],[\"name/340\",[199,57.365]],[\"parent/340\",[188,3.501]],[\"name/341\",[200,57.365]],[\"parent/341\",[188,3.501]],[\"name/342\",[46,35.171]],[\"parent/342\",[187,3.355]],[\"name/343\",[201,52.205]],[\"parent/343\",[]],[\"name/344\",[202,57.365]],[\"parent/344\",[201,5.084]],[\"name/345\",[46,35.171]],[\"parent/345\",[203,5.587]],[\"name/346\",[204,48.807]],[\"parent/346\",[]],[\"name/347\",[205,57.365]],[\"parent/347\",[204,4.753]],[\"name/348\",[4,52.205]],[\"parent/348\",[206,4.753]],[\"name/349\",[6,52.205]],[\"parent/349\",[206,4.753]],[\"name/350\",[2,48.807]],[\"parent/350\",[206,4.753]],[\"name/351\",[151,52.205]],[\"parent/351\",[204,4.753]],[\"name/352\",[186,52.205]],[\"parent/352\",[207,2.502]],[\"name/353\",[132,46.268]],[\"parent/353\",[207,2.502]],[\"name/354\",[8,25.124]],[\"parent/354\",[207,2.502]],[\"name/355\",[142,48.807]],[\"parent/355\",[208,2.656]],[\"name/356\",[133,44.241]],[\"parent/356\",[208,2.656]],[\"name/357\",[135,46.268]],[\"parent/357\",[208,2.656]],[\"name/358\",[136,44.241]],[\"parent/358\",[208,2.656]],[\"name/359\",[189,52.205]],[\"parent/359\",[208,2.656]],[\"name/360\",[209,57.365]],[\"parent/360\",[207,2.502]],[\"name/361\",[210,57.365]],[\"parent/361\",[207,2.502]],[\"name/362\",[211,57.365]],[\"parent/362\",[207,2.502]],[\"name/363\",[67,46.268]],[\"parent/363\",[207,2.502]],[\"name/364\",[212,57.365]],[\"parent/364\",[207,2.502]],[\"name/365\",[213,57.365]],[\"parent/365\",[207,2.502]],[\"name/366\",[214,52.205]],[\"parent/366\",[207,2.502]],[\"name/367\",[8,25.124]],[\"parent/367\",[207,2.502]],[\"name/368\",[214,52.205]],[\"parent/368\",[208,2.656]],[\"name/369\",[215,57.365]],[\"parent/369\",[208,2.656]],[\"name/370\",[216,57.365]],[\"parent/370\",[207,2.502]],[\"name/371\",[8,25.124]],[\"parent/371\",[207,2.502]],[\"name/372\",[217,57.365]],[\"parent/372\",[208,2.656]],[\"name/373\",[218,57.365]],[\"parent/373\",[208,2.656]],[\"name/374\",[219,57.365]],[\"parent/374\",[208,2.656]],[\"name/375\",[220,57.365]],[\"parent/375\",[208,2.656]],[\"name/376\",[221,57.365]],[\"parent/376\",[208,2.656]],[\"name/377\",[222,57.365]],[\"parent/377\",[207,2.502]],[\"name/378\",[223,57.365]],[\"parent/378\",[207,2.502]],[\"name/379\",[224,57.365]],[\"parent/379\",[207,2.502]],[\"name/380\",[8,25.124]],[\"parent/380\",[207,2.502]],[\"name/381\",[150,52.205]],[\"parent/381\",[208,2.656]],[\"name/382\",[225,57.365]],[\"parent/382\",[208,2.656]],[\"name/383\",[226,57.365]],[\"parent/383\",[208,2.656]],[\"name/384\",[227,57.365]],[\"parent/384\",[207,2.502]],[\"name/385\",[228,57.365]],[\"parent/385\",[207,2.502]],[\"name/386\",[229,57.365]],[\"parent/386\",[207,2.502]],[\"name/387\",[230,57.365]],[\"parent/387\",[207,2.502]],[\"name/388\",[231,57.365]],[\"parent/388\",[207,2.502]],[\"name/389\",[8,25.124]],[\"parent/389\",[207,2.502]],[\"name/390\",[232,57.365]],[\"parent/390\",[208,2.656]],[\"name/391\",[8,25.124]],[\"parent/391\",[208,2.656]],[\"name/392\",[233,52.205]],[\"parent/392\",[234,3.583]],[\"name/393\",[235,52.205]],[\"parent/393\",[234,3.583]],[\"name/394\",[236,57.365]],[\"parent/394\",[208,2.656]],[\"name/395\",[8,25.124]],[\"parent/395\",[208,2.656]],[\"name/396\",[233,52.205]],[\"parent/396\",[234,3.583]],[\"name/397\",[237,57.365]],[\"parent/397\",[234,3.583]],[\"name/398\",[235,52.205]],[\"parent/398\",[234,3.583]],[\"name/399\",[238,57.365]],[\"parent/399\",[234,3.583]],[\"name/400\",[239,57.365]],[\"parent/400\",[207,2.502]],[\"name/401\",[240,57.365]],[\"parent/401\",[207,2.502]],[\"name/402\",[241,57.365]],[\"parent/402\",[207,2.502]],[\"name/403\",[242,57.365]],[\"parent/403\",[207,2.502]],[\"name/404\",[243,57.365]],[\"parent/404\",[207,2.502]],[\"name/405\",[8,25.124]],[\"parent/405\",[207,2.502]],[\"name/406\",[244,57.365]],[\"parent/406\",[208,2.656]],[\"name/407\",[245,57.365]],[\"parent/407\",[208,2.656]],[\"name/408\",[8,25.124]],[\"parent/408\",[208,2.656]],[\"name/409\",[246,57.365]],[\"parent/409\",[234,3.583]],[\"name/410\",[247,57.365]],[\"parent/410\",[234,3.583]],[\"name/411\",[183,52.205]],[\"parent/411\",[234,3.583]],[\"name/412\",[248,57.365]],[\"parent/412\",[234,3.583]],[\"name/413\",[249,57.365]],[\"parent/413\",[234,3.583]],[\"name/414\",[194,48.807]],[\"parent/414\",[207,2.502]],[\"name/415\",[8,25.124]],[\"parent/415\",[207,2.502]],[\"name/416\",[194,48.807]],[\"parent/416\",[208,2.656]],[\"name/417\",[250,57.365]],[\"parent/417\",[208,2.656]],[\"name/418\",[193,52.205]],[\"parent/418\",[207,2.502]],[\"name/419\",[8,25.124]],[\"parent/419\",[207,2.502]],[\"name/420\",[251,57.365]],[\"parent/420\",[208,2.656]],[\"name/421\",[252,57.365]],[\"parent/421\",[208,2.656]],[\"name/422\",[253,57.365]],[\"parent/422\",[208,2.656]],[\"name/423\",[254,57.365]],[\"parent/423\",[208,2.656]],[\"name/424\",[255,57.365]],[\"parent/424\",[208,2.656]],[\"name/425\",[46,35.171]],[\"parent/425\",[207,2.502]],[\"name/426\",[256,52.205]],[\"parent/426\",[]],[\"name/427\",[257,57.365]],[\"parent/427\",[256,5.084]],[\"name/428\",[258,57.365]],[\"parent/428\",[259,4.144]],[\"name/429\",[133,44.241]],[\"parent/429\",[259,4.144]],[\"name/430\",[260,57.365]],[\"parent/430\",[259,4.144]],[\"name/431\",[136,44.241]],[\"parent/431\",[259,4.144]],[\"name/432\",[261,57.365]],[\"parent/432\",[259,4.144]],[\"name/433\",[46,35.171]],[\"parent/433\",[259,4.144]],[\"name/434\",[83,46.268]],[\"parent/434\",[113,4.309]],[\"name/435\",[84,52.205]],[\"parent/435\",[113,4.309]],[\"name/436\",[88,52.205]],[\"parent/436\",[113,4.309]],[\"name/437\",[89,52.205]],[\"parent/437\",[113,4.309]]],\"invertedIndex\":[[\"1\",{\"_index\":127,\"name\":{\"208\":{}},\"parent\":{}}],[\"2\",{\"_index\":129,\"name\":{\"209\":{}},\"parent\":{}}],[\"3\",{\"_index\":130,\"name\":{\"210\":{}},\"parent\":{}}],[\"4\",{\"_index\":131,\"name\":{\"211\":{}},\"parent\":{}}],[\"__type\",{\"_index\":8,\"name\":{\"8\":{},\"153\":{},\"162\":{},\"172\":{},\"213\":{},\"220\":{},\"225\":{},\"230\":{},\"234\":{},\"240\":{},\"245\":{},\"254\":{},\"262\":{},\"268\":{},\"273\":{},\"278\":{},\"283\":{},\"292\":{},\"297\":{},\"301\":{},\"309\":{},\"320\":{},\"326\":{},\"333\":{},\"337\":{},\"354\":{},\"367\":{},\"371\":{},\"380\":{},\"389\":{},\"391\":{},\"395\":{},\"405\":{},\"408\":{},\"415\":{},\"419\":{}},\"parent\":{}}],[\"actual\",{\"_index\":166,\"name\":{\"255\":{},\"293\":{}},\"parent\":{}}],[\"advancedoptions\",{\"_index\":3,\"name\":{\"3\":{}},\"parent\":{}}],[\"ai\",{\"_index\":34,\"name\":{\"22\":{}},\"parent\":{}}],[\"airsupremacy\",{\"_index\":165,\"name\":{\"253\":{},\"291\":{}},\"parent\":{}}],[\"all\",{\"_index\":68,\"name\":{\"80\":{},\"98\":{}},\"parent\":{}}],[\"animation\",{\"_index\":195,\"name\":{\"335\":{}},\"parent\":{}}],[\"apis\",{\"_index\":93,\"name\":{\"152\":{}},\"parent\":{}}],[\"artist\",{\"_index\":251,\"name\":{\"420\":{}},\"parent\":{}}],[\"audio\",{\"_index\":261,\"name\":{\"432\":{}},\"parent\":{}}],[\"autoupdate\",{\"_index\":86,\"name\":{\"137\":{},\"144\":{}},\"parent\":{}}],[\"availablein\",{\"_index\":245,\"name\":{\"407\":{}},\"parent\":{}}],[\"averagelevel\",{\"_index\":181,\"name\":{\"302\":{}},\"parent\":{}}],[\"aviation\",{\"_index\":183,\"name\":{\"304\":{},\"411\":{}},\"parent\":{}}],[\"azurapi\",{\"_index\":89,\"name\":{\"140\":{},\"437\":{}},\"parent\":{}}],[\"barrage\",{\"_index\":122,\"name\":{\"198\":{}},\"parent\":{}}],[\"barrages\",{\"_index\":54,\"name\":{\"41\":{},\"151\":{},\"158\":{},\"168\":{},\"177\":{}},\"parent\":{}}],[\"basefolder\",{\"_index\":107,\"name\":{\"181\":{}},\"parent\":{}}],[\"basestats\",{\"_index\":217,\"name\":{\"372\":{}},\"parent\":{}}],[\"basexp\",{\"_index\":157,\"name\":{\"244\":{},\"282\":{}},\"parent\":{}}],[\"bilibili\",{\"_index\":29,\"name\":{\"19\":{}},\"parent\":{}}],[\"blood\",{\"_index\":18,\"name\":{\"12\":{}},\"parent\":{}}],[\"boss\",{\"_index\":156,\"name\":{\"243\":{},\"281\":{}},\"parent\":{}}],[\"bossfleet\",{\"_index\":161,\"name\":{\"249\":{},\"287\":{}},\"parent\":{}}],[\"bosskillstoclear\",{\"_index\":163,\"name\":{\"251\":{},\"289\":{}},\"parent\":{}}],[\"bosslevel\",{\"_index\":155,\"name\":{\"242\":{},\"280\":{}},\"parent\":{}}],[\"cacheoptions\",{\"_index\":84,\"name\":{\"135\":{},\"435\":{}},\"parent\":{}}],[\"category\",{\"_index\":66,\"name\":{\"77\":{},\"318\":{}},\"parent\":{}}],[\"chapter\",{\"_index\":126,\"name\":{\"207\":{}},\"parent\":{}}],[\"chapters\",{\"_index\":61,\"name\":{\"59\":{},\"149\":{},\"156\":{},\"166\":{},\"175\":{}},\"parent\":{}}],[\"check\",{\"_index\":110,\"name\":{\"184\":{}},\"parent\":{}}],[\"class\",{\"_index\":211,\"name\":{\"362\":{}},\"parent\":{}}],[\"clearrewards\",{\"_index\":148,\"name\":{\"233\":{}},\"parent\":{}}],[\"client\",{\"_index\":43,\"name\":{\"30\":{},\"127\":{}},\"parent\":{}}],[\"cn\",{\"_index\":135,\"name\":{\"215\":{},\"222\":{},\"322\":{},\"357\":{}},\"parent\":{}}],[\"code\",{\"_index\":142,\"name\":{\"227\":{},\"270\":{},\"355\":{}},\"parent\":{}}],[\"coin\",{\"_index\":150,\"name\":{\"236\":{},\"381\":{}},\"parent\":{}}],[\"collection\",{\"_index\":233,\"name\":{\"392\":{},\"396\":{}},\"parent\":{}}],[\"construction\",{\"_index\":243,\"name\":{\"404\":{}},\"parent\":{}}],[\"constructiontime\",{\"_index\":244,\"name\":{\"406\":{}},\"parent\":{}}],[\"constructor\",{\"_index\":39,\"name\":{\"27\":{},\"42\":{},\"60\":{},\"75\":{},\"93\":{},\"111\":{},\"125\":{},\"141\":{}},\"parent\":{}}],[\"core/api/api\",{\"_index\":0,\"name\":{\"0\":{}},\"parent\":{\"1\":{},\"2\":{},\"3\":{},\"7\":{},\"26\":{}}}],[\"core/api/api.advancedoptions\",{\"_index\":5,\"name\":{},\"parent\":{\"4\":{},\"5\":{},\"6\":{}}}],[\"core/api/api.default\",{\"_index\":40,\"name\":{},\"parent\":{\"27\":{},\"28\":{},\"29\":{},\"30\":{},\"31\":{},\"32\":{},\"33\":{},\"34\":{},\"35\":{},\"36\":{},\"37\":{},\"38\":{},\"39\":{}}}],[\"core/api/api.nations\",{\"_index\":9,\"name\":{},\"parent\":{\"8\":{}}}],[\"core/api/api.nations.__type\",{\"_index\":12,\"name\":{},\"parent\":{\"9\":{},\"10\":{},\"11\":{},\"12\":{},\"13\":{},\"14\":{},\"15\":{},\"16\":{},\"17\":{},\"18\":{},\"19\":{},\"20\":{},\"21\":{},\"22\":{},\"23\":{},\"24\":{},\"25\":{}}}],[\"core/api/api_barrage\",{\"_index\":53,\"name\":{\"40\":{}},\"parent\":{\"41\":{}}}],[\"core/api/api_barrage.barrages\",{\"_index\":55,\"name\":{},\"parent\":{\"42\":{},\"43\":{},\"44\":{},\"45\":{},\"46\":{},\"47\":{},\"48\":{},\"49\":{},\"50\":{},\"51\":{},\"52\":{},\"53\":{},\"54\":{},\"55\":{},\"56\":{},\"57\":{}}}],[\"core/api/api_chapter\",{\"_index\":60,\"name\":{\"58\":{}},\"parent\":{\"59\":{}}}],[\"core/api/api_chapter.chapters\",{\"_index\":62,\"name\":{},\"parent\":{\"60\":{},\"61\":{},\"62\":{},\"63\":{},\"64\":{},\"65\":{},\"66\":{},\"67\":{},\"68\":{},\"69\":{},\"70\":{},\"71\":{},\"72\":{}}}],[\"core/api/api_equipment\",{\"_index\":63,\"name\":{\"73\":{}},\"parent\":{\"74\":{}}}],[\"core/api/api_equipment.equipments\",{\"_index\":65,\"name\":{},\"parent\":{\"75\":{},\"76\":{},\"77\":{},\"78\":{},\"79\":{},\"80\":{},\"81\":{},\"82\":{},\"83\":{},\"84\":{},\"85\":{},\"86\":{},\"87\":{},\"88\":{},\"89\":{},\"90\":{}}}],[\"core/api/api_ship\",{\"_index\":69,\"name\":{\"91\":{}},\"parent\":{\"92\":{}}}],[\"core/api/api_ship.ships\",{\"_index\":70,\"name\":{},\"parent\":{\"93\":{},\"94\":{},\"95\":{},\"96\":{},\"97\":{},\"98\":{},\"99\":{},\"100\":{},\"101\":{},\"102\":{},\"103\":{},\"104\":{},\"105\":{},\"106\":{},\"107\":{},\"108\":{}}}],[\"core/api/api_voiceline\",{\"_index\":71,\"name\":{\"109\":{}},\"parent\":{\"110\":{}}}],[\"core/api/api_voiceline.voicelines\",{\"_index\":73,\"name\":{},\"parent\":{\"111\":{},\"112\":{},\"113\":{},\"114\":{},\"115\":{},\"116\":{},\"117\":{},\"118\":{},\"119\":{},\"120\":{},\"121\":{},\"122\":{}}}],[\"core/cacheupdater\",{\"_index\":74,\"name\":{\"123\":{}},\"parent\":{\"124\":{}}}],[\"core/cacheupdater.default\",{\"_index\":75,\"name\":{},\"parent\":{\"125\":{},\"126\":{},\"127\":{},\"128\":{},\"129\":{},\"130\":{},\"131\":{},\"132\":{}}}],[\"core/client\",{\"_index\":82,\"name\":{\"133\":{}},\"parent\":{\"134\":{},\"135\":{},\"139\":{},\"140\":{}}}],[\"core/client.azurapi\",{\"_index\":90,\"name\":{},\"parent\":{\"141\":{},\"142\":{},\"143\":{},\"144\":{},\"145\":{},\"146\":{},\"147\":{},\"148\":{},\"149\":{},\"150\":{},\"151\":{},\"152\":{},\"153\":{},\"159\":{}}}],[\"core/client.azurapi.__type\",{\"_index\":94,\"name\":{},\"parent\":{\"154\":{},\"155\":{},\"156\":{},\"157\":{},\"158\":{}}}],[\"core/client.cacheoptions\",{\"_index\":85,\"name\":{},\"parent\":{\"136\":{},\"137\":{},\"138\":{}}}],[\"core/data\",{\"_index\":96,\"name\":{\"160\":{}},\"parent\":{\"161\":{},\"171\":{},\"180\":{},\"181\":{},\"182\":{}}}],[\"core/data.data\",{\"_index\":98,\"name\":{},\"parent\":{\"162\":{}}}],[\"core/data.data.__type\",{\"_index\":100,\"name\":{},\"parent\":{\"163\":{},\"164\":{},\"165\":{},\"166\":{},\"167\":{},\"168\":{},\"169\":{},\"170\":{}}}],[\"core/data.local\",{\"_index\":104,\"name\":{},\"parent\":{\"172\":{}}}],[\"core/data.local.__type\",{\"_index\":105,\"name\":{},\"parent\":{\"173\":{},\"174\":{},\"175\":{},\"176\":{},\"177\":{},\"178\":{},\"179\":{}}}],[\"core/updatechecker\",{\"_index\":109,\"name\":{\"183\":{}},\"parent\":{\"184\":{},\"185\":{},\"186\":{}}}],[\"cron\",{\"_index\":76,\"name\":{\"126\":{}},\"parent\":{}}],[\"cube\",{\"_index\":149,\"name\":{\"235\":{}},\"parent\":{}}],[\"data\",{\"_index\":97,\"name\":{\"161\":{}},\"parent\":{}}],[\"datatype\",{\"_index\":106,\"name\":{\"180\":{}},\"parent\":{}}],[\"default\",{\"_index\":38,\"name\":{\"26\":{},\"124\":{}},\"parent\":{}}],[\"dmgl\",{\"_index\":119,\"name\":{\"195\":{}},\"parent\":{}}],[\"dmgm\",{\"_index\":120,\"name\":{\"196\":{}},\"parent\":{}}],[\"domination\",{\"_index\":26,\"name\":{\"16\":{}},\"parent\":{}}],[\"dragon\",{\"_index\":19,\"name\":{\"13\":{}},\"parent\":{}}],[\"eagle\",{\"_index\":10,\"name\":{\"9\":{}},\"parent\":{}}],[\"empery\",{\"_index\":20,\"name\":{\"13\":{}},\"parent\":{}}],[\"empire\",{\"_index\":16,\"name\":{\"11\":{},\"17\":{}},\"parent\":{}}],[\"en\",{\"_index\":133,\"name\":{\"214\":{},\"221\":{},\"321\":{},\"356\":{},\"429\":{}},\"parent\":{}}],[\"enemylevel\",{\"_index\":153,\"name\":{\"239\":{},\"277\":{}},\"parent\":{}}],[\"enhancevalue\",{\"_index\":223,\"name\":{\"378\":{}},\"parent\":{}}],[\"equipment\",{\"_index\":185,\"name\":{\"316\":{}},\"parent\":{}}],[\"equipmentblueprintdrops\",{\"_index\":170,\"name\":{\"259\":{},\"306\":{}},\"parent\":{}}],[\"equipments\",{\"_index\":64,\"name\":{\"74\":{},\"148\":{},\"155\":{},\"165\":{},\"174\":{}},\"parent\":{}}],[\"event\",{\"_index\":258,\"name\":{\"428\":{}},\"parent\":{}}],[\"every\",{\"_index\":51,\"name\":{\"38\":{},\"56\":{},\"71\":{},\"89\":{},\"107\":{},\"121\":{}},\"parent\":{}}],[\"exchange\",{\"_index\":249,\"name\":{\"413\":{}},\"parent\":{}}],[\"fetch\",{\"_index\":112,\"name\":{\"186\":{}},\"parent\":{}}],[\"filter\",{\"_index\":48,\"name\":{\"35\":{},\"53\":{},\"68\":{},\"86\":{},\"104\":{},\"118\":{}},\"parent\":{}}],[\"firepower\",{\"_index\":182,\"name\":{\"303\":{}},\"parent\":{}}],[\"fits\",{\"_index\":192,\"name\":{\"331\":{}},\"parent\":{}}],[\"fleet1\",{\"_index\":178,\"name\":{\"298\":{}},\"parent\":{}}],[\"fleet2\",{\"_index\":179,\"name\":{\"299\":{}},\"parent\":{}}],[\"fleetrestrictions\",{\"_index\":177,\"name\":{\"296\":{}},\"parent\":{}}],[\"fleettech\",{\"_index\":231,\"name\":{\"388\":{}},\"parent\":{}}],[\"focus\",{\"_index\":190,\"name\":{\"327\":{}},\"parent\":{}}],[\"foreach\",{\"_index\":50,\"name\":{\"37\":{},\"55\":{},\"70\":{},\"88\":{},\"106\":{},\"120\":{}},\"parent\":{}}],[\"frommaps\",{\"_index\":250,\"name\":{\"417\":{}},\"parent\":{}}],[\"fuse\",{\"_index\":42,\"name\":{\"29\":{},\"48\":{},\"63\":{},\"82\":{},\"100\":{},\"113\":{}},\"parent\":{}}],[\"fuze\",{\"_index\":45,\"name\":{\"32\":{},\"50\":{},\"65\":{},\"84\":{},\"102\":{},\"115\":{}},\"parent\":{}}],[\"gallery\",{\"_index\":229,\"name\":{\"386\":{}},\"parent\":{}}],[\"get\",{\"_index\":47,\"name\":{\"34\":{},\"52\":{},\"67\":{},\"79\":{},\"97\":{},\"117\":{}},\"parent\":{}}],[\"hard\",{\"_index\":176,\"name\":{\"267\":{}},\"parent\":{}}],[\"heavy\",{\"_index\":247,\"name\":{\"410\":{}},\"parent\":{}}],[\"height\",{\"_index\":174,\"name\":{\"264\":{},\"311\":{}},\"parent\":{}}],[\"hexagon\",{\"_index\":210,\"name\":{\"361\":{}},\"parent\":{}}],[\"hololive\",{\"_index\":35,\"name\":{\"23\":{}},\"parent\":{}}],[\"hull\",{\"_index\":58,\"name\":{\"45\":{},\"95\":{},\"191\":{},\"203\":{}},\"parent\":{}}],[\"hulltype\",{\"_index\":212,\"name\":{\"364\":{}},\"parent\":{}}],[\"icon\",{\"_index\":124,\"name\":{\"200\":{}},\"parent\":{}}],[\"id\",{\"_index\":46,\"name\":{\"33\":{},\"51\":{},\"66\":{},\"85\":{},\"103\":{},\"116\":{},\"205\":{},\"217\":{},\"314\":{},\"342\":{},\"345\":{},\"425\":{},\"433\":{}},\"parent\":{}}],[\"identifiable\",{\"_index\":202,\"name\":{\"344\":{}},\"parent\":{}}],[\"idmap\",{\"_index\":102,\"name\":{\"170\":{},\"179\":{}},\"parent\":{}}],[\"idonly\",{\"_index\":6,\"name\":{\"5\":{},\"349\":{}},\"parent\":{}}],[\"image\",{\"_index\":191,\"name\":{\"330\":{}},\"parent\":{}}],[\"index\",{\"_index\":113,\"name\":{\"187\":{}},\"parent\":{\"434\":{},\"435\":{},\"436\":{},\"437\":{}}}],[\"init\",{\"_index\":80,\"name\":{\"131\":{}},\"parent\":{}}],[\"instance\",{\"_index\":88,\"name\":{\"139\":{},\"436\":{}},\"parent\":{}}],[\"introduction\",{\"_index\":143,\"name\":{\"228\":{},\"271\":{}},\"parent\":{}}],[\"iris\",{\"_index\":23,\"name\":{\"15\":{}},\"parent\":{}}],[\"iron\",{\"_index\":17,\"name\":{\"12\":{}},\"parent\":{}}],[\"jp\",{\"_index\":136,\"name\":{\"216\":{},\"223\":{},\"323\":{},\"358\":{},\"431\":{}},\"parent\":{}}],[\"kizuna\",{\"_index\":33,\"name\":{\"22\":{}},\"parent\":{}}],[\"kr\",{\"_index\":189,\"name\":{\"324\":{},\"359\":{}},\"parent\":{}}],[\"language\",{\"_index\":2,\"name\":{\"2\":{},\"6\":{},\"350\":{}},\"parent\":{}}],[\"largefleet\",{\"_index\":160,\"name\":{\"248\":{},\"286\":{}},\"parent\":{}}],[\"level100\",{\"_index\":218,\"name\":{\"373\":{}},\"parent\":{}}],[\"level100retrofit\",{\"_index\":220,\"name\":{\"375\":{}},\"parent\":{}}],[\"level120\",{\"_index\":219,\"name\":{\"374\":{}},\"parent\":{}}],[\"level120retrofit\",{\"_index\":221,\"name\":{\"376\":{}},\"parent\":{}}],[\"libre\",{\"_index\":24,\"name\":{\"15\":{}},\"parent\":{}}],[\"light\",{\"_index\":246,\"name\":{\"409\":{}},\"parent\":{}}],[\"limitbreaks\",{\"_index\":230,\"name\":{\"387\":{}},\"parent\":{}}],[\"limited\",{\"_index\":248,\"name\":{\"412\":{}},\"parent\":{}}],[\"load\",{\"_index\":81,\"name\":{\"132\":{}},\"parent\":{}}],[\"local\",{\"_index\":103,\"name\":{\"171\":{}},\"parent\":{}}],[\"map\",{\"_index\":49,\"name\":{\"36\":{},\"54\":{},\"69\":{},\"87\":{},\"105\":{},\"119\":{},\"265\":{},\"312\":{}},\"parent\":{}}],[\"mapdrops\",{\"_index\":169,\"name\":{\"258\":{},\"305\":{}},\"parent\":{}}],[\"maxlevel\",{\"_index\":235,\"name\":{\"393\":{},\"398\":{}},\"parent\":{}}],[\"maxlimitbreak\",{\"_index\":237,\"name\":{\"397\":{}},\"parent\":{}}],[\"medal\",{\"_index\":226,\"name\":{\"383\":{}},\"parent\":{}}],[\"mediumfleet\",{\"_index\":159,\"name\":{\"247\":{},\"285\":{}},\"parent\":{}}],[\"meta\",{\"_index\":36,\"name\":{\"24\":{}},\"parent\":{}}],[\"misc\",{\"_index\":193,\"name\":{\"332\":{},\"418\":{}},\"parent\":{}}],[\"moblevel\",{\"_index\":154,\"name\":{\"241\":{},\"279\":{}},\"parent\":{}}],[\"name\",{\"_index\":56,\"name\":{\"43\":{},\"61\":{},\"76\":{},\"94\":{},\"201\":{},\"328\":{}},\"parent\":{}}],[\"nameonly\",{\"_index\":4,\"name\":{\"4\":{},\"348\":{}},\"parent\":{}}],[\"names\",{\"_index\":132,\"name\":{\"212\":{},\"219\":{},\"319\":{},\"353\":{}},\"parent\":{}}],[\"nationality\",{\"_index\":67,\"name\":{\"78\":{},\"96\":{},\"329\":{},\"363\":{}},\"parent\":{}}],[\"nations\",{\"_index\":7,\"name\":{\"7\":{}},\"parent\":{}}],[\"navy\",{\"_index\":14,\"name\":{\"10\":{}},\"parent\":{}}],[\"neptunia\",{\"_index\":28,\"name\":{\"18\":{}},\"parent\":{}}],[\"nodemap\",{\"_index\":172,\"name\":{\"261\":{},\"308\":{}},\"parent\":{}}],[\"nodes\",{\"_index\":175,\"name\":{\"266\":{},\"313\":{}},\"parent\":{}}],[\"normal\",{\"_index\":140,\"name\":{\"224\":{}},\"parent\":{}}],[\"normalize\",{\"_index\":1,\"name\":{\"1\":{}},\"parent\":{}}],[\"northern\",{\"_index\":21,\"name\":{\"14\":{}},\"parent\":{}}],[\"note\",{\"_index\":121,\"name\":{\"197\":{}},\"parent\":{}}],[\"obtainedfrom\",{\"_index\":194,\"name\":{\"334\":{},\"414\":{},\"416\":{}},\"parent\":{}}],[\"oil\",{\"_index\":225,\"name\":{\"382\":{}},\"parent\":{}}],[\"options\",{\"_index\":91,\"name\":{\"142\":{}},\"parent\":{}}],[\"parliament\",{\"_index\":22,\"name\":{\"14\":{}},\"parent\":{}}],[\"pixiv\",{\"_index\":253,\"name\":{\"422\":{}},\"parent\":{}}],[\"rarity\",{\"_index\":213,\"name\":{\"365\":{}},\"parent\":{}}],[\"rate\",{\"_index\":87,\"name\":{\"138\":{},\"145\":{}},\"parent\":{}}],[\"raw\",{\"_index\":41,\"name\":{\"28\":{},\"47\":{},\"62\":{},\"81\":{},\"99\":{},\"112\":{}},\"parent\":{}}],[\"requiredbattles\",{\"_index\":162,\"name\":{\"250\":{},\"288\":{}},\"parent\":{}}],[\"requiredlevel\",{\"_index\":147,\"name\":{\"232\":{},\"275\":{}},\"parent\":{}}],[\"retrofit\",{\"_index\":239,\"name\":{\"400\":{}},\"parent\":{}}],[\"retrofithulltype\",{\"_index\":241,\"name\":{\"402\":{}},\"parent\":{}}],[\"retrofitid\",{\"_index\":240,\"name\":{\"401\":{}},\"parent\":{}}],[\"retrofitprojects\",{\"_index\":242,\"name\":{\"403\":{}},\"parent\":{}}],[\"rounds\",{\"_index\":117,\"name\":{\"193\":{},\"204\":{}},\"parent\":{}}],[\"roundtype\",{\"_index\":116,\"name\":{\"192\":{}},\"parent\":{}}],[\"royal\",{\"_index\":13,\"name\":{\"10\":{}},\"parent\":{}}],[\"sakura\",{\"_index\":15,\"name\":{\"11\":{}},\"parent\":{}}],[\"sardenga\",{\"_index\":27,\"name\":{\"17\":{}},\"parent\":{}}],[\"save\",{\"_index\":111,\"name\":{\"185\":{}},\"parent\":{}}],[\"scrapvalue\",{\"_index\":224,\"name\":{\"379\":{}},\"parent\":{}}],[\"set\",{\"_index\":95,\"name\":{\"159\":{}},\"parent\":{}}],[\"setdata\",{\"_index\":44,\"name\":{\"31\":{},\"49\":{},\"64\":{},\"83\":{},\"101\":{},\"114\":{}},\"parent\":{}}],[\"ship\",{\"_index\":151,\"name\":{\"237\":{},\"351\":{}},\"parent\":{}}],[\"shipadvancedoptions\",{\"_index\":205,\"name\":{\"347\":{}},\"parent\":{}}],[\"shipdrops\",{\"_index\":171,\"name\":{\"260\":{},\"307\":{}},\"parent\":{}}],[\"shiplist\",{\"_index\":101,\"name\":{\"169\":{},\"178\":{}},\"parent\":{}}],[\"ships\",{\"_index\":59,\"name\":{\"46\":{},\"92\":{},\"147\":{},\"154\":{},\"164\":{},\"173\":{},\"190\":{},\"202\":{}},\"parent\":{}}],[\"skills\",{\"_index\":227,\"name\":{\"384\":{}},\"parent\":{}}],[\"skins\",{\"_index\":228,\"name\":{\"385\":{}},\"parent\":{}}],[\"slots\",{\"_index\":222,\"name\":{\"377\":{}},\"parent\":{}}],[\"smallfleet\",{\"_index\":158,\"name\":{\"246\":{},\"284\":{}},\"parent\":{}}],[\"some\",{\"_index\":52,\"name\":{\"39\":{},\"57\":{},\"72\":{},\"90\":{},\"108\":{},\"122\":{}},\"parent\":{}}],[\"source\",{\"_index\":83,\"name\":{\"134\":{},\"136\":{},\"143\":{},\"434\":{}},\"parent\":{}}],[\"starconditions\",{\"_index\":164,\"name\":{\"252\":{},\"290\":{}},\"parent\":{}}],[\"stars\",{\"_index\":214,\"name\":{\"366\":{},\"368\":{}},\"parent\":{}}],[\"start\",{\"_index\":78,\"name\":{\"129\":{}},\"parent\":{}}],[\"statrestrictions\",{\"_index\":180,\"name\":{\"300\":{}},\"parent\":{}}],[\"stats\",{\"_index\":216,\"name\":{\"370\":{}},\"parent\":{}}],[\"statsbonus\",{\"_index\":232,\"name\":{\"390\":{}},\"parent\":{}}],[\"stop\",{\"_index\":79,\"name\":{\"130\":{}},\"parent\":{}}],[\"subchapter\",{\"_index\":137,\"name\":{\"218\":{}},\"parent\":{}}],[\"superiority\",{\"_index\":167,\"name\":{\"256\":{},\"294\":{}},\"parent\":{}}],[\"supremacy\",{\"_index\":168,\"name\":{\"257\":{},\"295\":{}},\"parent\":{}}],[\"t0\",{\"_index\":197,\"name\":{\"338\":{}},\"parent\":{}}],[\"t1\",{\"_index\":198,\"name\":{\"339\":{}},\"parent\":{}}],[\"t2\",{\"_index\":199,\"name\":{\"340\":{}},\"parent\":{}}],[\"t3\",{\"_index\":200,\"name\":{\"341\":{}},\"parent\":{}}],[\"techpoints\",{\"_index\":236,\"name\":{\"394\":{}},\"parent\":{}}],[\"text\",{\"_index\":145,\"name\":{\"231\":{},\"274\":{}},\"parent\":{}}],[\"threestarrewards\",{\"_index\":152,\"name\":{\"238\":{},\"276\":{}},\"parent\":{}}],[\"thumbnail\",{\"_index\":209,\"name\":{\"360\":{}},\"parent\":{}}],[\"tiers\",{\"_index\":196,\"name\":{\"336\":{}},\"parent\":{}}],[\"title\",{\"_index\":141,\"name\":{\"226\":{},\"269\":{}},\"parent\":{}}],[\"total\",{\"_index\":238,\"name\":{\"399\":{}},\"parent\":{}}],[\"twitter\",{\"_index\":254,\"name\":{\"423\":{}},\"parent\":{}}],[\"type\",{\"_index\":57,\"name\":{\"44\":{},\"194\":{},\"199\":{},\"325\":{}},\"parent\":{}}],[\"types/barrage\",{\"_index\":114,\"name\":{\"188\":{}},\"parent\":{\"189\":{},\"190\":{},\"191\":{},\"192\":{},\"193\":{},\"198\":{}}}],[\"types/barrage.barrage\",{\"_index\":123,\"name\":{},\"parent\":{\"199\":{},\"200\":{},\"201\":{},\"202\":{},\"203\":{},\"204\":{},\"205\":{}}}],[\"types/barrage.rounds\",{\"_index\":118,\"name\":{},\"parent\":{\"194\":{},\"195\":{},\"196\":{},\"197\":{}}}],[\"types/chapter\",{\"_index\":125,\"name\":{\"206\":{}},\"parent\":{\"207\":{},\"218\":{}}}],[\"types/chapter.chapter\",{\"_index\":128,\"name\":{},\"parent\":{\"208\":{},\"209\":{},\"210\":{},\"211\":{},\"212\":{},\"213\":{},\"217\":{}}}],[\"types/chapter.chapter.__type\",{\"_index\":134,\"name\":{},\"parent\":{\"214\":{},\"215\":{},\"216\":{}}}],[\"types/chapter.subchapter\",{\"_index\":138,\"name\":{},\"parent\":{\"219\":{},\"220\":{},\"224\":{},\"225\":{},\"267\":{},\"268\":{},\"314\":{}}}],[\"types/chapter.subchapter.__type\",{\"_index\":139,\"name\":{},\"parent\":{\"221\":{},\"222\":{},\"223\":{},\"226\":{},\"227\":{},\"228\":{},\"229\":{},\"230\":{},\"233\":{},\"234\":{},\"238\":{},\"239\":{},\"240\":{},\"244\":{},\"245\":{},\"250\":{},\"251\":{},\"252\":{},\"253\":{},\"254\":{},\"258\":{},\"259\":{},\"260\":{},\"261\":{},\"262\":{},\"269\":{},\"270\":{},\"271\":{},\"272\":{},\"273\":{},\"276\":{},\"277\":{},\"278\":{},\"282\":{},\"283\":{},\"288\":{},\"289\":{},\"290\":{},\"291\":{},\"292\":{},\"296\":{},\"297\":{},\"300\":{},\"301\":{},\"305\":{},\"306\":{},\"307\":{},\"308\":{},\"309\":{}}}],[\"types/chapter.subchapter.__type.__type\",{\"_index\":146,\"name\":{},\"parent\":{\"231\":{},\"232\":{},\"235\":{},\"236\":{},\"237\":{},\"241\":{},\"242\":{},\"243\":{},\"246\":{},\"247\":{},\"248\":{},\"249\":{},\"255\":{},\"256\":{},\"257\":{},\"263\":{},\"264\":{},\"265\":{},\"266\":{},\"274\":{},\"275\":{},\"279\":{},\"280\":{},\"281\":{},\"284\":{},\"285\":{},\"286\":{},\"287\":{},\"293\":{},\"294\":{},\"295\":{},\"298\":{},\"299\":{},\"302\":{},\"303\":{},\"304\":{},\"310\":{},\"311\":{},\"312\":{},\"313\":{}}}],[\"types/equipment\",{\"_index\":184,\"name\":{\"315\":{}},\"parent\":{\"316\":{}}}],[\"types/equipment.equipment\",{\"_index\":187,\"name\":{},\"parent\":{\"317\":{},\"318\":{},\"319\":{},\"320\":{},\"325\":{},\"326\":{},\"329\":{},\"330\":{},\"331\":{},\"332\":{},\"333\":{},\"336\":{},\"337\":{},\"342\":{}}}],[\"types/equipment.equipment.__type\",{\"_index\":188,\"name\":{},\"parent\":{\"321\":{},\"322\":{},\"323\":{},\"324\":{},\"327\":{},\"328\":{},\"334\":{},\"335\":{},\"338\":{},\"339\":{},\"340\":{},\"341\":{}}}],[\"types/identifiable\",{\"_index\":201,\"name\":{\"343\":{}},\"parent\":{\"344\":{}}}],[\"types/identifiable.identifiable\",{\"_index\":203,\"name\":{},\"parent\":{\"345\":{}}}],[\"types/ship\",{\"_index\":204,\"name\":{\"346\":{}},\"parent\":{\"347\":{},\"351\":{}}}],[\"types/ship.ship\",{\"_index\":207,\"name\":{},\"parent\":{\"352\":{},\"353\":{},\"354\":{},\"360\":{},\"361\":{},\"362\":{},\"363\":{},\"364\":{},\"365\":{},\"366\":{},\"367\":{},\"370\":{},\"371\":{},\"377\":{},\"378\":{},\"379\":{},\"380\":{},\"384\":{},\"385\":{},\"386\":{},\"387\":{},\"388\":{},\"389\":{},\"400\":{},\"401\":{},\"402\":{},\"403\":{},\"404\":{},\"405\":{},\"414\":{},\"415\":{},\"418\":{},\"419\":{},\"425\":{}}}],[\"types/ship.ship.__type\",{\"_index\":208,\"name\":{},\"parent\":{\"355\":{},\"356\":{},\"357\":{},\"358\":{},\"359\":{},\"368\":{},\"369\":{},\"372\":{},\"373\":{},\"374\":{},\"375\":{},\"376\":{},\"381\":{},\"382\":{},\"383\":{},\"390\":{},\"391\":{},\"394\":{},\"395\":{},\"406\":{},\"407\":{},\"408\":{},\"416\":{},\"417\":{},\"420\":{},\"421\":{},\"422\":{},\"423\":{},\"424\":{}}}],[\"types/ship.ship.__type.__type\",{\"_index\":234,\"name\":{},\"parent\":{\"392\":{},\"393\":{},\"396\":{},\"397\":{},\"398\":{},\"399\":{},\"409\":{},\"410\":{},\"411\":{},\"412\":{},\"413\":{}}}],[\"types/ship.shipadvancedoptions\",{\"_index\":206,\"name\":{},\"parent\":{\"348\":{},\"349\":{},\"350\":{}}}],[\"types/voiceline\",{\"_index\":256,\"name\":{\"426\":{}},\"parent\":{\"427\":{}}}],[\"types/voiceline.voiceline\",{\"_index\":259,\"name\":{},\"parent\":{\"428\":{},\"429\":{},\"430\":{},\"431\":{},\"432\":{},\"433\":{}}}],[\"union\",{\"_index\":11,\"name\":{\"9\":{}},\"parent\":{}}],[\"universal\",{\"_index\":37,\"name\":{\"25\":{}},\"parent\":{}}],[\"unlockrequirements\",{\"_index\":144,\"name\":{\"229\":{},\"272\":{}},\"parent\":{}}],[\"update\",{\"_index\":77,\"name\":{\"128\":{}},\"parent\":{}}],[\"updater\",{\"_index\":92,\"name\":{\"146\":{}},\"parent\":{}}],[\"url\",{\"_index\":115,\"name\":{\"189\":{}},\"parent\":{}}],[\"utawarerumono\",{\"_index\":32,\"name\":{\"21\":{}},\"parent\":{}}],[\"vacation\",{\"_index\":31,\"name\":{\"20\":{}},\"parent\":{}}],[\"value\",{\"_index\":215,\"name\":{\"369\":{}},\"parent\":{}}],[\"venus\",{\"_index\":30,\"name\":{\"20\":{}},\"parent\":{}}],[\"version\",{\"_index\":99,\"name\":{\"163\":{}},\"parent\":{}}],[\"versioninfo\",{\"_index\":108,\"name\":{\"182\":{}},\"parent\":{}}],[\"vichya\",{\"_index\":25,\"name\":{\"16\":{}},\"parent\":{}}],[\"voice\",{\"_index\":255,\"name\":{\"424\":{}},\"parent\":{}}],[\"voiceline\",{\"_index\":257,\"name\":{\"427\":{}},\"parent\":{}}],[\"voicelines\",{\"_index\":72,\"name\":{\"110\":{},\"150\":{},\"157\":{},\"167\":{},\"176\":{}},\"parent\":{}}],[\"web\",{\"_index\":252,\"name\":{\"421\":{}},\"parent\":{}}],[\"width\",{\"_index\":173,\"name\":{\"263\":{},\"310\":{}},\"parent\":{}}],[\"wikiurl\",{\"_index\":186,\"name\":{\"317\":{},\"352\":{}},\"parent\":{}}],[\"zh\",{\"_index\":260,\"name\":{\"430\":{}},\"parent\":{}}]],\"pipeline\":[]}}"); \ No newline at end of file diff --git a/docs/classes/core_CacheUpdater.default.html b/docs/classes/core_CacheUpdater.default.html index dd73e8d4..7e701afd 100644 --- a/docs/classes/core_CacheUpdater.default.html +++ b/docs/classes/core_CacheUpdater.default.html @@ -1,15 +1,15 @@ -default | @azurapi/azurapi
Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • default

Index

Constructors

Properties

client: AzurAPI
cron?: Timeout

Methods

  • init(): Promise<void>
  • load(): undefined | Promise<undefined | void[]>
  • load(): undefined | Promise<undefined | void[]>
  • start(): void
  • start(): void
  • stop(): void
  • stop(): void
  • update(): Promise<undefined | void[]>
  • update(): Promise<undefined | void[]>

Legend

  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Variable
  • Function
  • Type alias
  • Interface
  • Private property

Settings

Theme

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/classes/core_Client.AzurAPI.html b/docs/classes/core_Client.AzurAPI.html index 25d4ab40..d060d01e 100644 --- a/docs/classes/core_Client.AzurAPI.html +++ b/docs/classes/core_Client.AzurAPI.html @@ -1,10 +1,10 @@ AzurAPI | @azurapi/azurapi
Options
All
  • Public
  • Public/Protected
  • All
Menu

The main AzurAPI class

-

Hierarchy

  • EventEmitter
    • AzurAPI

Index

Constructors

Hierarchy

  • EventEmitter
    • AzurAPI

Index

Constructors

Properties

apis: { barrages: Barrages; chapters: Chapters; equipments: Equipments; ships: Ships; voicelines: Voicelines } = ...

Type declaration

autoupdate: boolean
barrages: Barrages = ...
chapters: Chapters = ...
equipments: Equipments = ...
options: CacheOptions
rate: number
ships: Ships = ...
source: string
updater: default
voicelines: Voicelines = ...
captureRejectionSymbol: typeof captureRejectionSymbol
captureRejections: boolean
+

Returns AzurAPI

Properties

apis: { barrages: Barrages; chapters: Chapters; equipments: Equipments; ships: Ships; voicelines: Voicelines } = ...

Type declaration

autoupdate: boolean
barrages: Barrages = ...
chapters: Chapters = ...
equipments: Equipments = ...
options: CacheOptions
rate: number
ships: Ships = ...
source: string
updater: default
voicelines: Voicelines = ...
captureRejectionSymbol: typeof captureRejectionSymbol
captureRejections: boolean

Sets or gets the default captureRejection value for all emitters.

defaultMaxListeners: number
errorMonitor: typeof errorMonitor

This symbol shall be used to install a listener for only monitoring 'error' @@ -13,7 +13,7 @@

Installing a listener using this symbol does not change the behavior once an 'error' event is emitted, therefore the process will still crash if no regular 'error' listener is installed.

-

Methods

  • addListener(event: string | symbol, listener: (...args: any[]) => void): AzurAPI
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns AzurAPI

  • emit(event: string | symbol, ...args: any[]): boolean
  • Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

  • eventNames(): (string | symbol)[]
  • Returns (string | symbol)[]

  • getMaxListeners(): number
  • Returns number

  • listenerCount(event: string | symbol): number
  • Parameters

    • event: string | symbol

    Returns number

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

  • off(event: string | symbol, listener: (...args: any[]) => void): AzurAPI
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns AzurAPI

  • on(event: string | symbol, listener: (...args: any[]) => void): AzurAPI
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns AzurAPI

  • once(event: string | symbol, listener: (...args: any[]) => void): AzurAPI
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns AzurAPI

  • prependListener(event: string | symbol, listener: (...args: any[]) => void): AzurAPI
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns AzurAPI

  • prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): AzurAPI
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns AzurAPI

  • rawListeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

  • removeAllListeners(event?: string | symbol): AzurAPI
  • Parameters

    • Optional event: string | symbol

    Returns AzurAPI

  • removeListener(event: string | symbol, listener: (...args: any[]) => void): AzurAPI
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns AzurAPI

Methods

  • addListener(event: string | symbol, listener: (...args: any[]) => void): AzurAPI
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns AzurAPI

  • emit(event: string | symbol, ...args: any[]): boolean
  • Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

  • eventNames(): (string | symbol)[]
  • Returns (string | symbol)[]

  • getMaxListeners(): number
  • Returns number

  • listenerCount(event: string | symbol): number
  • Parameters

    • event: string | symbol

    Returns number

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

  • off(event: string | symbol, listener: (...args: any[]) => void): AzurAPI
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns AzurAPI

  • on(event: string | symbol, listener: (...args: any[]) => void): AzurAPI
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns AzurAPI

  • once(event: string | symbol, listener: (...args: any[]) => void): AzurAPI
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns AzurAPI

  • prependListener(event: string | symbol, listener: (...args: any[]) => void): AzurAPI
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns AzurAPI

  • prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): AzurAPI
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns AzurAPI

  • rawListeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

  • removeAllListeners(event?: string | symbol): AzurAPI
  • Parameters

    • Optional event: string | symbol

    Returns AzurAPI

  • removeListener(event: string | symbol, listener: (...args: any[]) => void): AzurAPI
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns AzurAPI

Properties

client: AzurAPI
fuse?: Fuse<T>
raw: T[]

Methods

  • every(predicate: (value: T, index: number, array: T[]) => unknown): boolean
  • Determines whether all the members of an array satisfy the specified test

    Parameters

    • predicate: (value: T, index: number, array: T[]) => unknown

      A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array.

      -
        • (value: T, index: number, array: T[]): unknown
        • Parameters

          • value: T
          • index: number
          • array: T[]

          Returns unknown

    Returns boolean

  • filter(predicate: (value: T, index: number, array: T[]) => unknown): T[]
  • +
      • (value: T, index: number, array: T[]): unknown
      • Parameters

        • value: T
        • index: number
        • array: T[]

        Returns unknown

Returns boolean

  • filter(predicate: (value: T, index: number, array: T[]) => unknown): T[]
  • Returns the elements of an array that meet the condition specified in a callback function.

    Parameters

    • predicate: (value: T, index: number, array: T[]) => unknown

      A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.

      -
        • (value: T, index: number, array: T[]): unknown
        • Parameters

          • value: T
          • index: number
          • array: T[]

          Returns unknown

    Returns T[]

  • forEach(callbackfn: (value: T, index: number, array: T[]) => void): void
  • +
      • (value: T, index: number, array: T[]): unknown
      • Parameters

        • value: T
        • index: number
        • array: T[]

        Returns unknown

Returns T[]

  • forEach(callbackfn: (value: T, index: number, array: T[]) => void): void
  • Performs the specified action for each element in an array.

    Parameters

    • callbackfn: (value: T, index: number, array: T[]) => void

      A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.

      -
        • (value: T, index: number, array: T[]): void
        • Parameters

          • value: T
          • index: number
          • array: T[]

          Returns void

    Returns void

  • fuze(name: string): FuseResult<T>[]
  • +
      • (value: T, index: number, array: T[]): void
      • Parameters

        • value: T
        • index: number
        • array: T[]

        Returns void

Returns void

  • fuze(name: string): FuseResult<T>[]
  • get(query: string): undefined | T

Returns FuseResult<T>[]

  • get(query: string): T | T[]
  • id(id: string): undefined | T

Returns T | T[]

Array

+
  • id(id: string): undefined | T
  • map<U>(callbackfn: (value: T, index: number, array: T[]) => U): U[]

Returns undefined | T

  • map<U>(callbackfn: (value: T, index: number, array: T[]) => U): U[]
  • Calls a defined callback function on each element of an array, and returns an array that contains the results.

    Type parameters

    • U

    Parameters

    • callbackfn: (value: T, index: number, array: T[]) => U

      A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

      -
        • (value: T, index: number, array: T[]): U
        • Parameters

          • value: T
          • index: number
          • array: T[]

          Returns U

    Returns U[]

  • setData(raw: T[]): void
  • +
      • (value: T, index: number, array: T[]): U
      • Parameters

        • value: T
        • index: number
        • array: T[]

        Returns U

Returns U[]

  • setData(raw: T[]): void
  • some(predicate: (value: T, index: number, array: T[]) => unknown): boolean

Returns void

  • some(predicate: (value: T, index: number, array: T[]) => unknown): boolean

Properties

fuse?: Fuse<Barrage>
raw: Barrage[]

Methods

  • every(predicate: (value: Barrage, index: number, array: Barrage[]) => unknown): boolean
  • Determines whether all the members of an array satisfy the specified test

    Parameters

    • predicate: (value: Barrage, index: number, array: Barrage[]) => unknown

      A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array.

      -

    Returns boolean

Returns boolean

  • Returns the elements of an array that meet the condition specified in a callback function.

    Parameters

    • predicate: (value: Barrage, index: number, array: Barrage[]) => unknown

      A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.

      -

    Returns Barrage[]

  • forEach(callbackfn: (value: Barrage, index: number, array: Barrage[]) => void): void

Returns Barrage[]

  • forEach(callbackfn: (value: Barrage, index: number, array: Barrage[]) => void): void
  • Performs the specified action for each element in an array.

    Parameters

    • callbackfn: (value: Barrage, index: number, array: Barrage[]) => void

      A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.

      -

    Returns void

  • fuze(name: string): FuseResult<Barrage>[]

Returns void

  • fuze(name: string): FuseResult<Barrage>[]
  • get(query: string): undefined | Barrage

Returns FuseResult<Barrage>[]

Returns Barrage | Barrage[]

Array

+
  • id(id: string): undefined | Barrage

Returns Barrage[] | []

  • id(id: string): undefined | Barrage
  • map<U>(callbackfn: (value: Barrage, index: number, array: Barrage[]) => U): U[]

Returns undefined | Barrage

  • map<U>(callbackfn: (value: Barrage, index: number, array: Barrage[]) => U): U[]
  • Calls a defined callback function on each element of an array, and returns an array that contains the results.

    Type parameters

    • U

    Parameters

    • callbackfn: (value: Barrage, index: number, array: Barrage[]) => U

      A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

      -

    Returns U[]

  • name(name: string): undefined | Barrage

Returns U[]

Returns Barrage[] | []

Returns void

  • some(predicate: (value: Barrage, index: number, array: Barrage[]) => unknown): boolean

Returns Barrage[] | []

  • some(predicate: (value: Barrage, index: number, array: Barrage[]) => unknown): boolean
  • Determines whether the specified callback function returns true for any element of an array.

    Parameters

    • predicate: (value: Barrage, index: number, array: Barrage[]) => unknown

      A function that accepts up to three arguments. The some method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value true, or until the end of the array.

      -

    Returns boolean

  • type(type: "ship" | "class" | "skill"): Barrage[] | void[]

Returns boolean

  • type(type: "ship" | "class" | "skill"): Barrage[] | []

Legend

  • Class
  • Class with type parameter
  • Constructor
  • Method
  • Variable
  • Function
  • Type alias
  • Inherited property
  • Inherited method
  • Interface

Settings

Theme

Generated using TypeDoc

\ No newline at end of file +

Returns Barrage[] | []

Legend

  • Class
  • Class with type parameter
  • Constructor
  • Method
  • Variable
  • Function
  • Type alias
  • Inherited property
  • Inherited method
  • Interface

Settings

Theme

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/classes/core_api_api_chapter.Chapters.html b/docs/classes/core_api_api_chapter.Chapters.html index 64295a5e..6304681f 100644 --- a/docs/classes/core_api_api_chapter.Chapters.html +++ b/docs/classes/core_api_api_chapter.Chapters.html @@ -1,48 +1,49 @@ Chapters | @azurapi/azurapi
Options
All
  • Public
  • Public/Protected
  • All
Menu

Special chapter class for extended functionality

-

Hierarchy

Index

Constructors

Hierarchy

Index

Constructors

Properties

fuse?: Fuse<Chapter>
raw: Chapter[]

Methods

  • every(predicate: (value: Chapter, index: number, array: Chapter[]) => unknown): boolean

Returns Chapters

Properties

fuse?: Fuse<Chapter>
raw: Chapter[]

Methods

  • every(predicate: (value: Chapter, index: number, array: Chapter[]) => unknown): boolean
  • Determines whether all the members of an array satisfy the specified test

    Parameters

    • predicate: (value: Chapter, index: number, array: Chapter[]) => unknown

      A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array.

      -

    Returns boolean

Returns boolean

  • Returns the elements of an array that meet the condition specified in a callback function.

    Parameters

    • predicate: (value: Chapter, index: number, array: Chapter[]) => unknown

      A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.

      -

    Returns Chapter[]

  • forEach(callbackfn: (value: Chapter, index: number, array: Chapter[]) => void): void

Returns Chapter[]

  • forEach(callbackfn: (value: Chapter, index: number, array: Chapter[]) => void): void
  • Performs the specified action for each element in an array.

    Parameters

    • callbackfn: (value: Chapter, index: number, array: Chapter[]) => void

      A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.

      -

    Returns void

  • fuze(name: string): FuseResult<Chapter>[]

Returns void

  • fuze(name: string): FuseResult<Chapter>[]
  • get(query: string): undefined | Chapter

Returns FuseResult<Chapter>[]

  • id(id: string): undefined | Chapter

Returns Chapter | Chapter[]

Array

+
  • id(id: string): undefined | Chapter
  • map<U>(callbackfn: (value: Chapter, index: number, array: Chapter[]) => U): U[]

Returns undefined | Chapter

  • map<U>(callbackfn: (value: Chapter, index: number, array: Chapter[]) => U): U[]
  • Calls a defined callback function on each element of an array, and returns an array that contains the results.

    Type parameters

    • U

    Parameters

    • callbackfn: (value: Chapter, index: number, array: Chapter[]) => U

      A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

      -

    Returns U[]

Returns U[]

Returns [] | (Chapter | SubChapter)[]

  • some(predicate: (value: Chapter, index: number, array: Chapter[]) => unknown): boolean

Returns void

  • some(predicate: (value: Chapter, index: number, array: Chapter[]) => unknown): boolean

Properties

fuse?: Fuse<Equipment>
raw: Equipment[]

Methods

Returns [] | Equipment[]

  • every(predicate: (value: Equipment, index: number, array: Equipment[]) => unknown): boolean

Returns [] | Equipment[]

  • every(predicate: (value: Equipment, index: number, array: Equipment[]) => unknown): boolean
  • Determines whether all the members of an array satisfy the specified test

    Parameters

    • predicate: (value: Equipment, index: number, array: Equipment[]) => unknown

      A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array.

      -

    Returns boolean

Returns boolean

  • Returns the elements of an array that meet the condition specified in a callback function.

    Parameters

    • predicate: (value: Equipment, index: number, array: Equipment[]) => unknown

      A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.

      -

    Returns Equipment[]

Returns Equipment[]

  • Performs the specified action for each element in an array.

    Parameters

    • callbackfn: (value: Equipment, index: number, array: Equipment[]) => void

      A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.

      -

    Returns void

Returns void

Returns FuseResult<Equipment>[]

Returns Equipment | Equipment[]

Returns undefined | Equipment

  • Calls a defined callback function on each element of an array, and returns an array that contains the results.

    Type parameters

    • U

    Parameters

    • callbackfn: (value: Equipment, index: number, array: Equipment[]) => U

      A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

      -

    Returns U[]

Returns U[]

  • nationality(nationality: string): Equipment[]

Returns [] | Equipment[]

  • nationality(nationality: string): [] | Equipment[]

Returns [] | Equipment[]

  • some(predicate: (value: Equipment, index: number, array: Equipment[]) => unknown): boolean

Returns void

  • some(predicate: (value: Equipment, index: number, array: Equipment[]) => unknown): boolean
  • Determines whether the specified callback function returns true for any element of an array.

    Parameters

    • predicate: (value: Equipment, index: number, array: Equipment[]) => unknown

      A function that accepts up to three arguments. The some method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value true, or until the end of the array.

      -

    Returns boolean

Legend

  • Class
  • Class with type parameter
  • Constructor
  • Method
  • Variable
  • Function
  • Type alias
  • Inherited property
  • Inherited method
  • Interface
  • Private method

Settings

Theme

Generated using TypeDoc

\ No newline at end of file +

Returns boolean

Legend

  • Class
  • Class with type parameter
  • Constructor
  • Method
  • Variable
  • Function
  • Type alias
  • Inherited property
  • Inherited method
  • Interface

Settings

Theme

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/classes/core_api_api_ship.Ships.html b/docs/classes/core_api_api_ship.Ships.html index a757a80a..e0824dad 100644 --- a/docs/classes/core_api_api_ship.Ships.html +++ b/docs/classes/core_api_api_ship.Ships.html @@ -1,61 +1,61 @@ Ships | @azurapi/azurapi
Options
All
  • Public
  • Public/Protected
  • All
Menu

Special ships class for extended functionality

-

Hierarchy

Index

Constructors

Hierarchy

Index

Constructors

Properties

fuse?: Fuse<Ship>
raw: Ship[]

Methods

  • all(query: string): Ship[]

Returns Ships

Properties

fuse?: Fuse<Ship>
raw: Ship[]

Methods

  • all(query: string): [] | Ship[]
  • every(predicate: (value: Ship, index: number, array: Ship[]) => unknown): boolean

Returns [] | Ship[]

  • every(predicate: (value: Ship, index: number, array: Ship[]) => unknown): boolean
  • Determines whether all the members of an array satisfy the specified test

    Parameters

    • predicate: (value: Ship, index: number, array: Ship[]) => unknown

      A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array.

      -
        • (value: Ship, index: number, array: Ship[]): unknown
        • Parameters

          Returns unknown

    Returns boolean

  • filter(predicate: (value: Ship, index: number, array: Ship[]) => unknown): Ship[]

Returns boolean

  • filter(predicate: (value: Ship, index: number, array: Ship[]) => unknown): Ship[]
  • Returns the elements of an array that meet the condition specified in a callback function.

    Parameters

    • predicate: (value: Ship, index: number, array: Ship[]) => unknown

      A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.

      -
        • (value: Ship, index: number, array: Ship[]): unknown
        • Parameters

          Returns unknown

    Returns Ship[]

  • forEach(callbackfn: (value: Ship, index: number, array: Ship[]) => void): void

Returns Ship[]

  • forEach(callbackfn: (value: Ship, index: number, array: Ship[]) => void): void
  • Performs the specified action for each element in an array.

    Parameters

    • callbackfn: (value: Ship, index: number, array: Ship[]) => void

      A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.

      -
        • (value: Ship, index: number, array: Ship[]): void
        • Parameters

          Returns void

    Returns void

  • fuze(name: string): FuseResult<Ship>[]

Returns void

  • fuze(name: string): FuseResult<Ship>[]

Returns FuseResult<Ship>[]

  • hull(hull: string): Ship[]

Returns Ship | Ship[]

  • hull(hull: string): [] | Ship[]
  • id(id: string): undefined | Ship

Returns [] | Ship[]

  • id(id: string): undefined | Ship
  • map<U>(callbackfn: (value: Ship, index: number, array: Ship[]) => U): U[]

Returns undefined | Ship

  • map<U>(callbackfn: (value: Ship, index: number, array: Ship[]) => U): U[]
  • Calls a defined callback function on each element of an array, and returns an array that contains the results.

    Type parameters

    • U

    Parameters

    • callbackfn: (value: Ship, index: number, array: Ship[]) => U

      A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

      -
        • (value: Ship, index: number, array: Ship[]): U
        • Parameters

          Returns U

    Returns U[]

  • name(name: string, languages?: Language[]): undefined | Ship

Returns U[]

  • nationality(nationality: string): Ship[]

Returns [] | Ship[]

  • nationality(nationality: string): [] | Ship[]
  • setData(raw: Ship[]): void

Returns [] | Ship[]

  • setData(raw: Ship[]): void
  • some(predicate: (value: Ship, index: number, array: Ship[]) => unknown): boolean

Returns void

  • some(predicate: (value: Ship, index: number, array: Ship[]) => unknown): boolean
  • Determines whether the specified callback function returns true for any element of an array.

    Parameters

    • predicate: (value: Ship, index: number, array: Ship[]) => unknown

      A function that accepts up to three arguments. The some method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value true, or until the end of the array.

      -
        • (value: Ship, index: number, array: Ship[]): unknown
        • Parameters

          Returns unknown

    Returns boolean

Legend

  • Class
  • Class with type parameter
  • Constructor
  • Method
  • Variable
  • Function
  • Type alias
  • Inherited property
  • Inherited method
  • Interface
  • Private method

Settings

Theme

Generated using TypeDoc

\ No newline at end of file +
    • (value: Ship, index: number, array: Ship[]): unknown
    • Parameters

      Returns unknown

Returns boolean

Legend

  • Class
  • Class with type parameter
  • Constructor
  • Method
  • Variable
  • Function
  • Type alias
  • Inherited property
  • Inherited method
  • Interface

Settings

Theme

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/classes/core_api_api_voiceline.Voicelines.html b/docs/classes/core_api_api_voiceline.Voicelines.html index c4142a13..ec534da1 100644 --- a/docs/classes/core_api_api_voiceline.Voicelines.html +++ b/docs/classes/core_api_api_voiceline.Voicelines.html @@ -1,42 +1,43 @@ Voicelines | @azurapi/azurapi
Options
All
  • Public
  • Public/Protected
  • All
Menu

Special chapter class for extended functionality

-

Hierarchy

Index

Constructors

Hierarchy

Index

Constructors

Properties

fuse?: Fuse<Voiceline>
raw: Voiceline[]

Methods

  • every(predicate: (value: Voiceline, index: number, array: Voiceline[]) => unknown): boolean

Returns Voicelines

Properties

fuse?: Fuse<Voiceline>
raw: Voiceline[]

Methods

  • every(predicate: (value: Voiceline, index: number, array: Voiceline[]) => unknown): boolean
  • Determines whether all the members of an array satisfy the specified test

    Parameters

    • predicate: (value: Voiceline, index: number, array: Voiceline[]) => unknown

      A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array.

      -

    Returns boolean

Returns boolean

  • Returns the elements of an array that meet the condition specified in a callback function.

    Parameters

    • predicate: (value: Voiceline, index: number, array: Voiceline[]) => unknown

      A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.

      -

    Returns Voiceline[]

Returns Voiceline[]

  • Performs the specified action for each element in an array.

    Parameters

    • callbackfn: (value: Voiceline, index: number, array: Voiceline[]) => void

      A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.

      -

    Returns void

Returns void

Returns FuseResult<Voiceline>[]

Returns Voiceline | Voiceline[]

Array

+

Returns undefined | Voiceline

  • Calls a defined callback function on each element of an array, and returns an array that contains the results.

    Type parameters

    • U

    Parameters

    • callbackfn: (value: Voiceline, index: number, array: Voiceline[]) => U

      A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

      -

    Returns U[]

Returns U[]

  • some(predicate: (value: Voiceline, index: number, array: Voiceline[]) => unknown): boolean

Returns void

  • some(predicate: (value: Voiceline, index: number, array: Voiceline[]) => unknown): boolean

Index

Type aliases

datatype: "ships" | "equipments" | "voicelines" | "chapters" | "barrages"

Variables

baseFolder: string = ...
data: { barrages: string; chapters: string; equipments: string; idMap: string; shipList: string; ships: string; version: string; voicelines: string } = ...

Type declaration

  • barrages: string
  • chapters: string
  • equipments: string
  • idMap: string
  • shipList: string
  • ships: string
  • version: string
  • voicelines: string
local: { barrages: string; chapters: string; equipments: string; idMap: string; shipList: string; ships: string; voicelines: string } = ...

Type declaration

  • barrages: string
  • chapters: string
  • equipments: string
  • idMap: string
  • shipList: string
  • ships: string
  • voicelines: string
versionInfo: string = ...

Legend

  • Variable
  • Function
  • Type alias
  • Class
  • Class with type parameter
  • Interface

Settings

Theme

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/modules/core_UpdateChecker.html b/docs/modules/core_UpdateChecker.html index 4cb45a4c..3fce8f50 100644 --- a/docs/modules/core_UpdateChecker.html +++ b/docs/modules/core_UpdateChecker.html @@ -1,11 +1,11 @@ core/UpdateChecker | @azurapi/azurapi
Options
All
  • Public
  • Public/Protected
  • All
Menu

Module core/UpdateChecker

Check for updates and functions relating to updates

-

Index

Functions

Index

Functions

  • fetch(url: string): Promise<string>
  • fetch(url: string): Promise<string>
  • save(): void

Returns Promise<string>

  • save(): void

Legend

  • Variable
  • Function
  • Type alias
  • Class
  • Class with type parameter
  • Interface

Settings

Theme

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/modules/core_api_api.html b/docs/modules/core_api_api.html index 4f4a878f..c17e5f59 100644 --- a/docs/modules/core_api_api.html +++ b/docs/modules/core_api_api.html @@ -1,6 +1,6 @@ core/api/api | @azurapi/azurapi
Options
All
  • Public
  • Public/Protected
  • All
Menu

Module core/api/api

Default api function

-

Index

Classes

Interfaces

Type aliases

Variables

Functions

Type aliases

Language: "en" | "cn" | "jp" | "kr"

Variables

NATIONS: { Bilibili: string[]; Dragon Empery: string[]; Eagle Union: string[]; Hololive: string[]; Iris Libre: string[]; Iron Blood: string[]; Kizuna AI: string[]; META: string[]; Neptunia: string[]; Northern Parliament: string[]; Royal Navy: string[]; Sakura Empire: string[]; Sardenga Empire: string[]; Universal: string[]; Utawarerumono: string[]; Venus Vacation: string[]; Vichya Domination: string[] } = ...

Type declaration

  • Bilibili: string[]
  • Dragon Empery: string[]
  • Eagle Union: string[]
  • Hololive: string[]
  • Iris Libre: string[]
  • Iron Blood: string[]
  • Kizuna AI: string[]
  • META: string[]
  • Neptunia: string[]
  • Northern Parliament: string[]
  • Royal Navy: string[]
  • Sakura Empire: string[]
  • Sardenga Empire: string[]
  • Universal: string[]
  • Utawarerumono: string[]
  • Venus Vacation: string[]
  • Vichya Domination: string[]

Functions

  • normalize(string: any): any

Index

Classes

Interfaces

Type aliases

Variables

Functions

Type aliases

Language: "en" | "cn" | "jp" | "kr"

Variables

NATIONS: { Bilibili: string[]; Dragon Empery: string[]; Eagle Union: string[]; Hololive: string[]; Iris Libre: string[]; Iron Blood: string[]; Kizuna AI: string[]; META: string[]; Neptunia: string[]; Northern Parliament: string[]; Royal Navy: string[]; Sakura Empire: string[]; Sardenga Empire: string[]; Universal: string[]; Utawarerumono: string[]; Venus Vacation: string[]; Vichya Domination: string[] } = ...

Type declaration

  • Bilibili: string[]
  • Dragon Empery: string[]
  • Eagle Union: string[]
  • Hololive: string[]
  • Iris Libre: string[]
  • Iron Blood: string[]
  • Kizuna AI: string[]
  • META: string[]
  • Neptunia: string[]
  • Northern Parliament: string[]
  • Royal Navy: string[]
  • Sakura Empire: string[]
  • Sardenga Empire: string[]
  • Universal: string[]
  • Utawarerumono: string[]
  • Venus Vacation: string[]
  • Vichya Domination: string[]

Functions

  • normalize(string: any): any
  • Normalize a string

    Parameters

    • string: any

      A string

      diff --git a/docs/modules/types_barrage.html b/docs/modules/types_barrage.html index e3566af6..e4aee4a1 100644 --- a/docs/modules/types_barrage.html +++ b/docs/modules/types_barrage.html @@ -1,3 +1,3 @@ types/barrage | @azurapi/azurapi
      Options
      All
      • Public
      • Public/Protected
      • All
      Menu

      Module types/barrage

      Barrage types

      -

      Index

      Type aliases

      Hull: "DD" | "CL" | "CA" | "CB" | "BB" | "BC" | "BM" | "BBV" | "CV" | "CVL" | "AR" | "SS" | "SSV"
      RoundType: "Normal" | "Normal+" | "Normal*" | "HE" | "HE+" | "AP" | "AP+/SHS" | "SSD* Shell" | "SSD* Fragments"
      Ships: "22" | "33" | "Abercrombie" | "Abukuma" | "Acasta" | "Achilles" | "Admiral Graf Spee" | "Admiral Hipper" | "Admiral Hipper μ" | "Agano" | "Ajax" | "Akagi" | "Akagi μ" | "Akagi-chan" | "Akashi" | "Akatsuki" | "Alabama" | "Albacore" | "Albacore μ" | "Algérie" | "Amagi" | "Amazon" | "An Shan" | "Anniversary Kizuna AI" | "Aoba" | "Arashio" | "Ardent" | "Arethusa" | "Ariake" | "Arizona" | "Ark Royal" | "Asashio" | "Ashigara" | "Astoria" | "Atago" | "Atlanta" | "Aulick" | "Aurora" | "Avrora" | "Ayanami" | "Aylwin" | "Azuma" | "Bache" | "Bailey" | "Baltimore" | "Baltimore μ" | "Bataan" | "Beagle" | "Belfast" | "Benson" | "Biloxi" | "Birmingham" | "Bismarck" | "Black Heart" | "Black Prince" | "Blanc" | "Bluegill" | "Bogue" | "Bremerton" | "Brooklyn" | "Bulldog" | "Bunker Hill" | "Bush" | "Béarn" | "California" | "Carabiniere" | "Casablanca" | "Cassin" | "Cavalla" | "Centaur" | "Champagne" | "Chang Chun" | "Chapayev" | "Charles Ausburne" | "Chaser" | "Cheshire" | "Chicago" | "Chitose" | "Chiyoda" | "Choukai" | "Clevelad" | "Cleveland" | "Cleveland μ" | "Colorado" | "Columbia" | "Comet" | "Concord" | "Conte di Cavour" | "Cooper" | "Craven" | "Crescent" | "Curacoa" | "Curlew" | "Cygnet" | "Dace" | "Denver" | "Deutschland" | "Dewey" | "Dido" | "Dido μ" | "Dorsetshire" | "Downes" | "Drake" | "Duke of York" | "Dunkerque" | "Eagle" | "Echo" | "Edinburgh" | "Eldridge" | "Elegant Kizuna AI" | "Enterprise" | "Erebus" | "Eskimo" | "Essex" | "Exeter" | "Fiji" | "Fletcher" | "Foote" | "Forbin" | "Formidable" | "Fortune" | "Foxhound" | "Friedrich der Große" | "Fu Shun" | "Fubuki" | "Fumiruiru" | "Fumizuki" | "Furutaka" | "Fusou" | "Galatea" | "Gangut" | "Gascogne" | "Gascogne μ" | "Georgia" | "Giulio Cesare" | "Glasgow" | "Glorious" | "Gloucester" | "Glowworm" | "Gneisenau" | "Graf Zeppelin" | "Green Heart" | "Grenville" | "Gridley" | "Grozny" | "Halsey Powell" | "Hamakaze" | "Hammann" | "Hanazuki" | "Hardy" | "Haruna" | "Harutsuki" | "Hatakaze" | "Hatsuharu" | "Hatsushimo" | "Hazelwood" | "Helena" | "Hermes" | "Hermione" | "Hibiki" | "Hiei" | "Hiei-chan" | "Hiryuu" | "Hiyou" | "Hobby" | "Honoka" | "Honolulu" | "Hood" | "Hornet" | "Houshou" | "Houston" | "Howe" | "Hunter" | "Hyuuga" | "I-13" | "I-168" | "I-19" | "I-25" | "I-26" | "I-56" | "I-58" | "Ibuki" | "Icarus" | "Ikazuchi" | "Illustrious" | "Illustrious μ" | "Inazuma" | "Independence" | "Indianapolis" | "Intrepid" | "Ise" | "Isokaze" | "Isuzu" | "Izumo" | "Jamaica" | "Javelin" | "Jean Bart" | "Jeanne d'Arc" | "Jenkins" | "Jersey" | "Jintsuu" | "Juneau" | "Juno" | "Junyou" | "Jupiter" | "Kaga" | "Kaga(BB)" | "Kagerou" | "Kako" | "Kalk" | "Kamikaze" | "Karlsruhe" | "Kashino" | "Kasumi" | "Kasumi" | "Kawakaze" | "Kent" | "Kii" | "Kimberly" | "King George V" | "Kinu" | "Kinugasa" | "Kirishima" | "Kisaragi" | "Kitakaze" | "Kiyonami" | "Kizuna AI" | "Kongou" | "Kumano" | "Kuon" | "Kuroshio" | "Köln" | "Königsberg" | "L'Opiniâtre" | "La Galissonnière" | "Laffey" | "Langley" | "Le Malin" | "Le Malin μ" | "Le Mars" | "Le Triomphant" | "Le Téméraire" | "Leander" | "Leipzig" | "Lena" | "Lexington" | "Li'l Sandy" | "Little Bel" | "Little Illustrious" | "Little Renown" | "Littorio" | "London" | "Long Island" | "Mainz" | "Makinami" | "Marblehead" | "Marie Rose" | "Maryland" | "Massachusetts" | "Matchless" | "Matsukaze" | "Maury" | "Maya" | "McCall" | "Memphis" | "Michishio" | "Mikasa" | "Mikazuki" | "Mikuma" | "Minato Aqua" | "Minazuki" | "Minneapolis" | "Minsk" | "Misaki" | "Mogami" | "Monarch" | "Monica" | "Montpelier" | "Mullany" | "Murasaki Shion" | "Musketeer" | "Mutsu" | "Mutsuki" | "Myoukou" | "Nachi" | "Naganami" | "Nagara" | "Nagato" | "Nagatsuki" | "Nagisa" | "Naka" | "Nakiri Ayame" | "Natsuiro Matsuri" | "Nekone" | "Nelson" | "Neptune" | "Neptune" | "Nevada" | "Newcastle" | "Nicholas" | "Niizuki" | "Ning Hai" | "Noire" | "Norfolk" | "North Carolina" | "Northampton" | "Noshiro" | "Nowaki" | "Nyotengu" | "Nürnberg" | "Odin" | "Oklahoma" | "Omaha" | "Ooshio" | "Oyashio" | "Pamiat' Merkuria" | "Pennsylvania" | "Pensacola" | "Perseus" | "Peter Strasser" | "Phoenix" | "Ping Hai" | "Portland" | "Prince of Wales" | "Princeton" | "Prinz Eugen" | "Prinz Heinrich" | "Prototype Bulin MKII" | "Purple Heart" | "Queen Elizabeth" | "Quincy" | "Radford" | "Raleigh" | "Ranger" | "Reno" | "Renown" | "Repulse" | "Richelieu" | "Richmond" | "Rodney" | "Roon" | "Roon μ" | "Rurutie" | "Ryuuhou" | "Ryuujou" | "Saint Louis" | "Salt Lake City" | "San Diego" | "San Juan" | "Saraana" | "Saratoga" | "Scharnhorst" | "Seattle" | "Sendai" | "Shangri-La" | "Sheffield" | "Sheffield μ" | "Shigure" | "Shinano" | "Shirakami Fubuki" | "Shiranui" | "Shiratsuyu" | "Shouhou" | "Shoukaku" | "Shropshire" | "Sims" | "Sirius" | "Smalley" | "Souryuu" | "South Dakota" | "Southampton" | "Sovetskaya Rossiya" | "Specialized Bulin Custom MKIII" | "Spence" | "St. Louis" | "Stanly" | "Suffolk" | "Super Gamer Kizuna AI" | "Surcouf" | "Suruga" | "Sussex" | "Suzutsuki" | "Suzuya" | "Swiftsure" | "Tai Yuan" | "Taihou" | "Taihou μ" | "Takao" | "Tanikaze" | "Tartu" | "Tashkent" | "Tashkent μ" | "Tennessee" | "Terror" | "Thatcher" | "Tirpitz" | "Tokino Sora" | "Tosa" | "Trento" | "U-101" | "U-110" | "U-37" | "U-47" | "U-522" | "U-556" | "U-557" | "U-73" | "U-81" | "U-96" | "Unicorn" | "Universal Bulin" | "Urakaze" | "Uranami" | "Uruuru" | "Uzuki" | "Valiant" | "Vampire" | "Vauquelin" | "Vert" | "Vestal" | "Victorious" | "Vincennes" | "Wakaba" | "Warspite" | "Washington" | "Wasp" | "Weser" | "West Virginia" | "White Heart" | "Wichita" | "Yamashiro" | "Yat Sen" | "Yoizuki" | "York" | "Yorktown" | "Yukikaze" | "Yuubari" | "Yuudachi" | "Yuugure" | "Z1" | "Z18" | "Z19" | "Z2" | "Z20" | "Z21" | "Z23" | "Z24" | "Z25" | "Z26" | "Z28" | "Z35" | "Z36" | "Z46" | "Zara" | "Zeppy" | "Zuikaku" | "Émile Bertin" | "Ōkami Mio"
      Url: string

      Legend

      • Variable
      • Function
      • Type alias
      • Class
      • Class with type parameter
      • Interface

      Settings

      Theme

      Generated using TypeDoc

      \ No newline at end of file +

Index

Type aliases

Hull: "DD" | "CL" | "CA" | "CB" | "BB" | "BC" | "BM" | "BBV" | "CV" | "CVL" | "AR" | "SS" | "SSV"
RoundType: "Normal" | "Normal+" | "Normal*" | "HE" | "HE+" | "AP" | "AP+/SHS" | "SSD* Shell" | "SSD* Fragments"
Ships: "22" | "33" | "Abercrombie" | "Abukuma" | "Acasta" | "Achilles" | "Admiral Graf Spee" | "Admiral Hipper" | "Admiral Hipper μ" | "Agano" | "Ajax" | "Akagi" | "Akagi μ" | "Akagi-chan" | "Akashi" | "Akatsuki" | "Alabama" | "Albacore" | "Albacore μ" | "Algérie" | "Amagi" | "Amazon" | "An Shan" | "Anniversary Kizuna AI" | "Aoba" | "Arashio" | "Ardent" | "Arethusa" | "Ariake" | "Arizona" | "Ark Royal" | "Asashio" | "Ashigara" | "Astoria" | "Atago" | "Atlanta" | "Aulick" | "Aurora" | "Avrora" | "Ayanami" | "Aylwin" | "Azuma" | "Bache" | "Bailey" | "Baltimore" | "Baltimore μ" | "Bataan" | "Beagle" | "Belfast" | "Benson" | "Biloxi" | "Birmingham" | "Bismarck" | "Black Heart" | "Black Prince" | "Blanc" | "Bluegill" | "Bogue" | "Bremerton" | "Brooklyn" | "Bulldog" | "Bunker Hill" | "Bush" | "Béarn" | "California" | "Carabiniere" | "Casablanca" | "Cassin" | "Cavalla" | "Centaur" | "Champagne" | "Chang Chun" | "Chapayev" | "Charles Ausburne" | "Chaser" | "Cheshire" | "Chicago" | "Chitose" | "Chiyoda" | "Choukai" | "Clevelad" | "Cleveland" | "Cleveland μ" | "Colorado" | "Columbia" | "Comet" | "Concord" | "Conte di Cavour" | "Cooper" | "Craven" | "Crescent" | "Curacoa" | "Curlew" | "Cygnet" | "Dace" | "Denver" | "Deutschland" | "Dewey" | "Dido" | "Dido μ" | "Dorsetshire" | "Downes" | "Drake" | "Duke of York" | "Dunkerque" | "Eagle" | "Echo" | "Edinburgh" | "Eldridge" | "Elegant Kizuna AI" | "Enterprise" | "Erebus" | "Eskimo" | "Essex" | "Exeter" | "Fiji" | "Fletcher" | "Foote" | "Forbin" | "Formidable" | "Fortune" | "Foxhound" | "Friedrich der Große" | "Fu Shun" | "Fubuki" | "Fumiruiru" | "Fumizuki" | "Furutaka" | "Fusou" | "Galatea" | "Gangut" | "Gascogne" | "Gascogne μ" | "Georgia" | "Giulio Cesare" | "Glasgow" | "Glorious" | "Gloucester" | "Glowworm" | "Gneisenau" | "Graf Zeppelin" | "Green Heart" | "Grenville" | "Gridley" | "Grozny" | "Halsey Powell" | "Hamakaze" | "Hammann" | "Hanazuki" | "Hardy" | "Haruna" | "Harutsuki" | "Hatakaze" | "Hatsuharu" | "Hatsushimo" | "Hazelwood" | "Helena" | "Hermes" | "Hermione" | "Hibiki" | "Hiei" | "Hiei-chan" | "Hiryuu" | "Hiyou" | "Hobby" | "Honoka" | "Honolulu" | "Hood" | "Hornet" | "Houshou" | "Houston" | "Howe" | "Hunter" | "Hyuuga" | "I-13" | "I-168" | "I-19" | "I-25" | "I-26" | "I-56" | "I-58" | "Ibuki" | "Icarus" | "Ikazuchi" | "Illustrious" | "Illustrious μ" | "Inazuma" | "Independence" | "Indianapolis" | "Intrepid" | "Ise" | "Isokaze" | "Isuzu" | "Izumo" | "Jamaica" | "Javelin" | "Jean Bart" | "Jeanne d'Arc" | "Jenkins" | "Jersey" | "Jintsuu" | "Juneau" | "Juno" | "Junyou" | "Jupiter" | "Kaga" | "Kaga(BB)" | "Kagerou" | "Kako" | "Kalk" | "Kamikaze" | "Karlsruhe" | "Kashino" | "Kasumi" | "Kasumi" | "Kawakaze" | "Kent" | "Kii" | "Kimberly" | "King George V" | "Kinu" | "Kinugasa" | "Kirishima" | "Kisaragi" | "Kitakaze" | "Kiyonami" | "Kizuna AI" | "Kongou" | "Kumano" | "Kuon" | "Kuroshio" | "Köln" | "Königsberg" | "L'Opiniâtre" | "La Galissonnière" | "Laffey" | "Langley" | "Le Malin" | "Le Malin μ" | "Le Mars" | "Le Triomphant" | "Le Téméraire" | "Leander" | "Leipzig" | "Lena" | "Lexington" | "Li'l Sandy" | "Little Bel" | "Little Illustrious" | "Little Renown" | "Littorio" | "London" | "Long Island" | "Mainz" | "Makinami" | "Marblehead" | "Marie Rose" | "Maryland" | "Massachusetts" | "Matchless" | "Matsukaze" | "Maury" | "Maya" | "McCall" | "Memphis" | "Michishio" | "Mikasa" | "Mikazuki" | "Mikuma" | "Minato Aqua" | "Minazuki" | "Minneapolis" | "Minsk" | "Misaki" | "Mogami" | "Monarch" | "Monica" | "Montpelier" | "Mullany" | "Murasaki Shion" | "Musketeer" | "Mutsu" | "Mutsuki" | "Myoukou" | "Nachi" | "Naganami" | "Nagara" | "Nagato" | "Nagatsuki" | "Nagisa" | "Naka" | "Nakiri Ayame" | "Natsuiro Matsuri" | "Nekone" | "Nelson" | "Neptune" | "Neptune" | "Nevada" | "Newcastle" | "Nicholas" | "Niizuki" | "Ning Hai" | "Noire" | "Norfolk" | "North Carolina" | "Northampton" | "Noshiro" | "Nowaki" | "Nyotengu" | "Nürnberg" | "Odin" | "Oklahoma" | "Omaha" | "Ooshio" | "Oyashio" | "Pamiat' Merkuria" | "Pennsylvania" | "Pensacola" | "Perseus" | "Peter Strasser" | "Phoenix" | "Ping Hai" | "Portland" | "Prince of Wales" | "Princeton" | "Prinz Eugen" | "Prinz Heinrich" | "Prototype Bulin MKII" | "Purple Heart" | "Queen Elizabeth" | "Quincy" | "Radford" | "Raleigh" | "Ranger" | "Reno" | "Renown" | "Repulse" | "Richelieu" | "Richmond" | "Rodney" | "Roon" | "Roon μ" | "Rurutie" | "Ryuuhou" | "Ryuujou" | "Saint Louis" | "Salt Lake City" | "San Diego" | "San Juan" | "Saraana" | "Saratoga" | "Scharnhorst" | "Seattle" | "Sendai" | "Shangri-La" | "Sheffield" | "Sheffield μ" | "Shigure" | "Shinano" | "Shirakami Fubuki" | "Shiranui" | "Shiratsuyu" | "Shouhou" | "Shoukaku" | "Shropshire" | "Sims" | "Sirius" | "Smalley" | "Souryuu" | "South Dakota" | "Southampton" | "Sovetskaya Rossiya" | "Specialized Bulin Custom MKIII" | "Spence" | "St. Louis" | "Stanly" | "Suffolk" | "Super Gamer Kizuna AI" | "Surcouf" | "Suruga" | "Sussex" | "Suzutsuki" | "Suzuya" | "Swiftsure" | "Tai Yuan" | "Taihou" | "Taihou μ" | "Takao" | "Tanikaze" | "Tartu" | "Tashkent" | "Tashkent μ" | "Tennessee" | "Terror" | "Thatcher" | "Tirpitz" | "Tokino Sora" | "Tosa" | "Trento" | "U-101" | "U-110" | "U-37" | "U-47" | "U-522" | "U-556" | "U-557" | "U-73" | "U-81" | "U-96" | "Unicorn" | "Universal Bulin" | "Urakaze" | "Uranami" | "Uruuru" | "Uzuki" | "Valiant" | "Vampire" | "Vauquelin" | "Vert" | "Vestal" | "Victorious" | "Vincennes" | "Wakaba" | "Warspite" | "Washington" | "Wasp" | "Weser" | "West Virginia" | "White Heart" | "Wichita" | "Yamashiro" | "Yat Sen" | "Yoizuki" | "York" | "Yorktown" | "Yukikaze" | "Yuubari" | "Yuudachi" | "Yuugure" | "Z1" | "Z18" | "Z19" | "Z2" | "Z20" | "Z21" | "Z23" | "Z24" | "Z25" | "Z26" | "Z28" | "Z35" | "Z36" | "Z46" | "Zara" | "Zeppy" | "Zuikaku" | "Émile Bertin" | "Ōkami Mio"
Url: string

Legend

  • Variable
  • Function
  • Type alias
  • Class
  • Class with type parameter
  • Interface

Settings

Theme

Generated using TypeDoc

\ No newline at end of file diff --git a/package.json b/package.json index 95bc7e54..88120537 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@azurapi/azurapi", - "version": "1.0.6", + "version": "1.1.0", "description": "Open Source Azur Lane Local Database", "main": "./build/index.js", "types": "./build/index.d.ts", diff --git a/src/core/api/api.ts b/src/core/api/api.ts index 04dafbfd..c2d9e3e8 100644 --- a/src/core/api/api.ts +++ b/src/core/api/api.ts @@ -87,9 +87,10 @@ export default class API { /** * Get by any * @param query Any + * @returns Array */ - get(query: string): T | undefined { - return this.id(query) || this.fuze(query)?.map(s => s.item)[0]; + get(query: string): T | T[] { + return this.id(query) || this.fuze(query)?.map(s => s.item); } /** diff --git a/src/core/api/api_barrage.ts b/src/core/api/api_barrage.ts index c44e7337..eee5a718 100644 --- a/src/core/api/api_barrage.ts +++ b/src/core/api/api_barrage.ts @@ -22,16 +22,15 @@ export class Barrages extends API { * Get barrage by name * @param name Barrage name */ - name(name: string): Barrage | undefined { - for (let barrage of this.raw) if (normalize(barrage.name.toUpperCase()) === normalize(name.toUpperCase())) return barrage; - return undefined; + name(name: string): Barrage[] | [] { + return this.raw.filter(barrage => normalize(barrage.name.toUpperCase()) === normalize(name.toUpperCase())); } /** * Get barrage by type * @param type Barrage type */ - type(type: 'ship' | 'class' | 'skill'): Barrage[] | void[] { + type(type: 'ship' | 'class' | 'skill'): Barrage[] | [] { return this.raw.filter(barrage => normalize(barrage.type.toUpperCase()) === normalize(type.toUpperCase())); } @@ -39,7 +38,7 @@ export class Barrages extends API { * Get barrage by hull type * @param hull Hull type */ - hull(hull: Hull): Barrage[] | void[] { + hull(hull: Hull): Barrage[] | [] { return this.raw.filter(barrage => normalize(barrage.hull.toUpperCase()) === normalize(hull.toUpperCase())); } @@ -47,7 +46,7 @@ export class Barrages extends API { * Sort barrages by compatable ship * @param ship A ship name */ - ships(ship: Ships): Barrage[] | void[] { + ships(ship: Ships): Barrage[] | [] { return this.raw.filter(barrage => barrage.ships.map(ship => normalize(ship.toUpperCase())).includes(normalize(ship.toUpperCase()))); } } diff --git a/src/core/api/api_chapter.ts b/src/core/api/api_chapter.ts index 8095c9b1..d364b7ef 100644 --- a/src/core/api/api_chapter.ts +++ b/src/core/api/api_chapter.ts @@ -24,11 +24,16 @@ export class Chapters extends API { * @param name Chapter name * @param languages Language to search */ - name(name: string, languages: Language[] = ['en', 'cn', 'jp']): Chapter | SubChapter | undefined { - for (let chapter of this.raw) if (languages.some(lang => chapter.names[lang] && normalize(chapter.names[lang].toUpperCase()) === normalize(name.toUpperCase()))) return chapter; - /*for (let chapter of this.raw) { - for (let sub of chapter) if (languages.some(lang => sub.names[lang] && normalize(sub.names[lang].toUpperCase()) === normalize(name.toUpperCase()))) return sub; - }*/ - return undefined; + name(name: string, languages: Language[] = ['en', 'cn', 'jp']): (Chapter | SubChapter)[] | [] { + let result: (Chapter | SubChapter)[] = []; + for (let chapter of this.raw) { + if (languages.some(lang => chapter.names[lang] && normalize(chapter.names[lang].toUpperCase()) === normalize(name.toUpperCase()))) result.push(chapter); + for (let sub of Object.values(chapter)) { + if (sub.names !== undefined) { + if (languages.some(lang => sub.names[lang] && normalize(sub.names[lang].toUpperCase()) === normalize(name.toUpperCase()))) result.push(sub); + } + } + } + return result; } } diff --git a/src/core/api/api_equipment.ts b/src/core/api/api_equipment.ts index 6f0e97a7..b56ccae3 100644 --- a/src/core/api/api_equipment.ts +++ b/src/core/api/api_equipment.ts @@ -24,63 +24,44 @@ export class Equipments extends API { * @param name Equipment name * @param languages Language to search */ - name(name: string, languages: Language[] = ['en', 'cn', 'jp', 'kr']): Equipment | undefined { - for (let equipment of this.raw) if (languages.some(lang => equipment.names[lang] && normalize(equipment.names[lang].toUpperCase()) === normalize(name.toUpperCase()))) return equipment; - return undefined; + name(name: string, languages: Language[] = ['en', 'cn', 'jp', 'kr']): Equipment[] | [] { + return this.raw.filter(equipment => languages.some(lang => equipment.names[lang] && normalize(equipment.names[lang].toUpperCase()) === normalize(name.toUpperCase()))); } /** * Lists the equipments by category * @param category name of the category you want to search for */ - category(category: string): Equipment[] { - let results: Equipment[] = []; - for (let equipment of this.raw) if (normalize(equipment.category.toUpperCase() === normalize(category.toUpperCase()))) results.push(equipment); - return results; + category(category: string): Equipment[] | [] { + return this.raw.filter(equipment => normalize(equipment.category.toUpperCase() === normalize(category.toUpperCase()))); } /** * Lists the equipments by nationality * @param nationality naitionality name of the equipments you want to search for */ - nationality(nationality: string): Equipment[] { - let results: Equipment[] = []; + nationality(nationality: string): Equipment[] | [] { nationality = Object.keys(NATIONS).find(key => NATIONS[key].includes(nationality.toLowerCase())) || nationality; - for (let equipment of this.raw) if (normalize(equipment.nationality.toUpperCase()) === normalize(nationality.toUpperCase())) results.push(equipment); - return results; - } - - private _nameAll(name: string, languages: Language[] = ['en', 'cn', 'jp', 'kr']): Equipment[] { - return this.raw.filter(equipment => languages.some(lang => equipment.names[lang] && normalize(equipment.names[lang].toUpperCase()) === normalize(name.toUpperCase()))); + return this.raw.filter(equipment => normalize(equipment.nationality.toUpperCase()) === normalize(nationality.toUpperCase())); } /** * Get equipment using name in any language or id * @param query Equipment name in any language or equipment id */ - get(query: string, adv?: advancedOptions): Equipment | undefined { - if (adv) { - if (adv.idOnly) { - return this.id(query); - } else if (adv.nameOnly || adv.nameOnly && !adv.language) { - return this.name(query); - } else if (adv.nameOnly && adv.language) { - return this.name(query, [adv.language]); - } - } else { - let fuzeResult = this.fuze(query).sort((a, b) => (b.score || 0) - (a.score || 0))[0]; - return this.id(query) || this.name(query) || (fuzeResult ? fuzeResult.item : undefined); - } + get(query: string): Equipment | Equipment[] { + let fuzeResult = this.fuze(query).sort((a, b) => (b.score || 0) - (a.score || 0))[0]; + return this.id(query) || this.name(query) || (fuzeResult ? fuzeResult.item : undefined); } /** * Get equipment using everything * @param query basically anyting i guess */ - all(query: string): Equipment[] { + all(query: string): Equipment[] | [] { let results: (Equipment | undefined)[] = []; results.push(this.id(query)); - results.push(...this._nameAll(query).filter(i => i)); + results.push(...this.name(query).filter(i => i)); results.push(...this.fuze(query).map(i => i.item)); return results .filter((value: Equipment | undefined): value is Equipment => value !== null && value !== undefined) diff --git a/src/core/api/api_ship.ts b/src/core/api/api_ship.ts index ca47b44e..c8dd6ad1 100644 --- a/src/core/api/api_ship.ts +++ b/src/core/api/api_ship.ts @@ -24,19 +24,18 @@ export class Ships extends API { * @param name Ship name * @param languages Language to search */ - name(name: string, languages: Language[] = ['en', 'cn', 'jp', 'kr']): Ship | undefined { - for (let ship of this.raw) if (languages.some(lang => ship.names[lang] && normalize(ship.names[lang].toUpperCase()) === normalize(name.toUpperCase()))) return ship; - return undefined; + name(name: string, languages: Language[] = ['en', 'cn', 'jp', 'kr']): Ship[] | [] { + return this.raw.filter(ship => languages.some(lang => ship.names[lang] && normalize(ship.names[lang].toUpperCase()) === normalize(name.toUpperCase()))); } /** * Get ship by hull * @param hull Hull name */ - hull(hull: string): Ship[] { + hull(hull: string): Ship[] | [] { return this.raw.filter(ship => (ship.hullType && normalize(ship.hullType.toUpperCase()) === normalize(hull.toUpperCase())) || - (ship.retrofitHullType && normalize(ship.retrofitHullType.toUpperCase()) === normalize(hull.toUpperCase())) + (ship.retrofitHullType && normalize(ship.retrofitHullType.toUpperCase()) === normalize(hull.toUpperCase())) ); } @@ -44,44 +43,30 @@ export class Ships extends API { * Get ship by nationality * @param nationality Nationality name */ - nationality(nationality: string): Ship[] { + nationality(nationality: string): Ship[] | [] { let results: Ship[] = []; nationality = Object.keys(NATIONS).find(key => NATIONS[key].includes(nationality.toLowerCase())) || nationality; for (let ship of this.raw) if (normalize(ship.nationality.toUpperCase()) === normalize(nationality.toUpperCase())) results.push(ship); return results; } - private _nameAll(name: string, languages: Language[] = ['en', 'cn', 'jp', 'kr']): Ship[] { - return this.raw.filter(ship => languages.some(lang => ship.names[lang] && normalize(ship.names[lang].toUpperCase()) === normalize(name.toUpperCase()))); - } - /** * Get ship using name in any language or id * @param query Ship name in any language or ship id */ - get(query: string, adv?: advancedOptions): Ship | undefined { - if (adv) { - if (adv.idOnly) { - return this.id(query); - } else if (adv.nameOnly || adv.nameOnly && !adv.language) { - return this.name(query); - } else if (adv.nameOnly && adv.language) { - return this.name(query, [adv.language]); - } - } else { - let fuzeResult = this.fuze(query).sort((a, b) => (b.score || 0) - (a.score || 0))[0]; - return this.id(query) || this.name(query) || (fuzeResult ? fuzeResult.item : undefined); - } + get(query: string): Ship | Ship[] { + let fuzeResult = this.fuze(query).sort((a, b) => (b.score || 0) - (a.score || 0))[0]; + return this.id(query) || this.name(query)[0] || (fuzeResult ? fuzeResult.item : undefined); } /** * Get ship using everything * @param query basically anyting i guess */ - all(query: string): Ship[] { + all(query: string): Ship[] | [] { let results: (Ship | undefined)[] = []; results.push(this.id(query)); - results.push(...this._nameAll(query).filter(i => i)); + results.push(...this.name(query).filter(i => i)); results.push(...this.fuze(query).map(i => i.item)); return results .filter((value: Ship | undefined): value is Ship => value !== null && value !== undefined)