@wise-old-man/utils 1.0.28 → 2.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,2544 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var axios = require('axios');
6
+ var dayjs = require('dayjs');
7
+ var customParseFormaPlugin = require('dayjs/plugin/customParseFormat');
8
+ var lodash = require('lodash');
9
+
10
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
11
+
12
+ var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
13
+ var dayjs__default = /*#__PURE__*/_interopDefaultLegacy(dayjs);
14
+ var customParseFormaPlugin__default = /*#__PURE__*/_interopDefaultLegacy(customParseFormaPlugin);
15
+
16
+ /******************************************************************************
17
+ Copyright (c) Microsoft Corporation.
18
+
19
+ Permission to use, copy, modify, and/or distribute this software for any
20
+ purpose with or without fee is hereby granted.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
23
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
24
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
25
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
26
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
27
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
28
+ PERFORMANCE OF THIS SOFTWARE.
29
+ ***************************************************************************** */
30
+
31
+ function __awaiter(thisArg, _arguments, P, generator) {
32
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
33
+ return new (P || (P = Promise))(function (resolve, reject) {
34
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
35
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
36
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
37
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
38
+ });
39
+ }
40
+
41
+ var config = {
42
+ // apiBaseUrl: 'http://localhost:5001'
43
+ apiBaseUrl: 'https://api.wiseoldman.net/v2'
44
+ };
45
+
46
+ dayjs__default["default"].extend(customParseFormaPlugin__default["default"]);
47
+ function traverseTransform(input, transformation) {
48
+ if (Array.isArray(input)) {
49
+ return input.map(item => traverseTransform(item, transformation));
50
+ }
51
+ if (input !== null && typeof input === 'object') {
52
+ return Object.fromEntries(Object.keys(input).map(key => [key, traverseTransform(input[key], transformation)]));
53
+ }
54
+ return transformation(input);
55
+ }
56
+ function isValidISODate(input) {
57
+ if (!input || typeof input !== 'string')
58
+ return false;
59
+ // DayJS has a bug with strict parsing with timezones https://github.com/iamkun/dayjs/issues/929
60
+ // So I'll just strip the "Z" timezone
61
+ return input.endsWith('Z') && dayjs__default["default"](input.slice(0, -1), 'YYYY-MM-DDTHH:mm:ss.SSS', true).isValid();
62
+ }
63
+ function transformDates(input) {
64
+ return traverseTransform(input, val => (isValidISODate(val) ? new Date(val) : val));
65
+ }
66
+ function handleError(requestURL, e) {
67
+ var _a;
68
+ if (!((_a = e.response) === null || _a === void 0 ? void 0 : _a.data))
69
+ return;
70
+ const data = e.response.data;
71
+ if (e.response.status === 400) {
72
+ throw new BadRequestError(requestURL, data.message, data.data);
73
+ }
74
+ if (e.response.status === 403) {
75
+ throw new ForbiddenError(requestURL, data.message);
76
+ }
77
+ if (e.response.status === 404) {
78
+ throw new NotFoundError(requestURL, data.message);
79
+ }
80
+ if (e.response.status === 429) {
81
+ throw new RateLimitError(requestURL, data.message);
82
+ }
83
+ if (e.response.status === 500) {
84
+ throw new InternalServerError(requestURL, data.message);
85
+ }
86
+ }
87
+ function sendPostRequest(path, body) {
88
+ return __awaiter(this, void 0, void 0, function* () {
89
+ const requestURL = `${config.apiBaseUrl}${path}`;
90
+ return axios__default["default"]
91
+ .post(requestURL, body || {})
92
+ .then(response => transformDates(response.data))
93
+ .catch(e => {
94
+ if (axios__default["default"].isAxiosError(e))
95
+ handleError(requestURL, e);
96
+ throw e;
97
+ });
98
+ });
99
+ }
100
+ function sendPutRequest(path, body) {
101
+ return __awaiter(this, void 0, void 0, function* () {
102
+ const requestURL = `${config.apiBaseUrl}${path}`;
103
+ return axios__default["default"]
104
+ .put(requestURL, body || {})
105
+ .then(response => transformDates(response.data))
106
+ .catch(e => {
107
+ if (axios__default["default"].isAxiosError(e))
108
+ handleError(requestURL, e);
109
+ throw e;
110
+ });
111
+ });
112
+ }
113
+ function sendDeleteRequest(path, body) {
114
+ return __awaiter(this, void 0, void 0, function* () {
115
+ const requestURL = `${config.apiBaseUrl}${path}`;
116
+ return axios__default["default"]
117
+ .delete(requestURL, { data: body })
118
+ .then(response => transformDates(response.data))
119
+ .catch(e => {
120
+ if (axios__default["default"].isAxiosError(e))
121
+ handleError(requestURL, e);
122
+ throw e;
123
+ });
124
+ });
125
+ }
126
+ function sendGetRequest(path, params) {
127
+ return __awaiter(this, void 0, void 0, function* () {
128
+ const requestURL = `${config.apiBaseUrl}${path}`;
129
+ return axios__default["default"]
130
+ .get(requestURL, { params })
131
+ .then(response => transformDates(response.data))
132
+ .catch(e => {
133
+ if (axios__default["default"].isAxiosError(e))
134
+ handleError(requestURL, e);
135
+ throw e;
136
+ });
137
+ });
138
+ }
139
+ class BadRequestError extends Error {
140
+ constructor(resource, message, data) {
141
+ super(message);
142
+ this.name = 'BadRequestError';
143
+ this.resource = resource;
144
+ this.statusCode = 400;
145
+ this.data = data;
146
+ }
147
+ }
148
+ class ForbiddenError extends Error {
149
+ constructor(resource, message) {
150
+ super(message);
151
+ this.name = 'ForbiddenError';
152
+ this.resource = resource;
153
+ this.statusCode = 403;
154
+ }
155
+ }
156
+ class NotFoundError extends Error {
157
+ constructor(resource, message) {
158
+ super(message);
159
+ this.name = 'NotFoundError';
160
+ this.resource = resource;
161
+ this.statusCode = 404;
162
+ }
163
+ }
164
+ class RateLimitError extends Error {
165
+ constructor(resource, message) {
166
+ super(message);
167
+ this.name = 'RateLimitError';
168
+ this.resource = resource;
169
+ this.statusCode = 429;
170
+ }
171
+ }
172
+ class InternalServerError extends Error {
173
+ constructor(resource, message) {
174
+ super(message);
175
+ this.name = 'InternalServerError';
176
+ this.resource = resource;
177
+ this.statusCode = 500;
178
+ }
179
+ }
180
+
181
+ class DeltasClient {
182
+ /**
183
+ * Fetches the current top leaderboard for a specific metric, period, playerType, playerBuild and country.
184
+ * @returns A list of deltas, with their respective players, values and dates included.
185
+ */
186
+ getDeltaLeaderboard(filter) {
187
+ return sendGetRequest('/deltas/leaderboard', filter);
188
+ }
189
+ }
190
+
191
+ class GroupsClient {
192
+ /**
193
+ * Searches for groups that match a partial name.
194
+ * @returns A list of groups.
195
+ */
196
+ searchGroups(name, pagination) {
197
+ return sendGetRequest('/groups', Object.assign({ name }, pagination));
198
+ }
199
+ /**
200
+ * Fetches a group's details.
201
+ * @returns A group details object.
202
+ */
203
+ getGroupDetails(id) {
204
+ return sendGetRequest(`/groups/${id}`);
205
+ }
206
+ /**
207
+ * Fetches a group's entire members list.
208
+ * @returns A list of memberships, with players included.
209
+ */
210
+ getGroupMembers(id) {
211
+ return sendGetRequest(`/groups/${id}/members`);
212
+ }
213
+ /**
214
+ * Creates a new group.
215
+ * @returns The newly created group, and the verification code that authorizes future changes to it.
216
+ */
217
+ createGroup(payload) {
218
+ return sendPostRequest('/groups', payload);
219
+ }
220
+ /**
221
+ * Edits an existing group.
222
+ * @returns The updated group.
223
+ */
224
+ editGroup(id, payload, verificationCode) {
225
+ return sendPutRequest(`/groups/${id}`, Object.assign(Object.assign({}, payload), { verificationCode }));
226
+ }
227
+ /**
228
+ * Deletes an existing group.
229
+ * @returns A confirmation message.
230
+ */
231
+ deleteGroup(id, verificationCode) {
232
+ return sendDeleteRequest(`/groups/${id}`, { verificationCode });
233
+ }
234
+ /**
235
+ * Adds all (valid) given usernames (and roles) to a group, ignoring duplicates.
236
+ * @returns The number of members added and a confirmation message.
237
+ */
238
+ addMembers(id, members, verificationCode) {
239
+ return sendPostRequest(`/groups/${id}/members`, {
240
+ verificationCode,
241
+ members
242
+ });
243
+ }
244
+ /**
245
+ * Remove all given usernames from a group, ignoring usernames that aren't members.
246
+ * @returns The number of members removed and a confirmation message.
247
+ */
248
+ removeMembers(id, usernames, verificationCode) {
249
+ return sendDeleteRequest(`/groups/${id}/members`, {
250
+ verificationCode,
251
+ members: usernames
252
+ });
253
+ }
254
+ /**
255
+ * Changes a player's role in a given group.
256
+ * @returns The updated membership, with player included.
257
+ */
258
+ changeRole(id, payload, verificationCode) {
259
+ return sendPutRequest(`/groups/${id}/role`, Object.assign(Object.assign({}, payload), { verificationCode }));
260
+ }
261
+ /**
262
+ * Adds an "update" request to the queue, for each outdated group member.
263
+ * @returns The number of players to be updated and a confirmation message.
264
+ */
265
+ updateAll(id, verificationCode) {
266
+ return sendPostRequest(`/groups/${id}/update-all`, {
267
+ verificationCode
268
+ });
269
+ }
270
+ /**
271
+ * Fetches all of the groups's competitions
272
+ * @returns A list of competitions.
273
+ */
274
+ getGroupCompetitions(id, pagination) {
275
+ return sendGetRequest(`/groups/${id}/competitions`, Object.assign({}, pagination));
276
+ }
277
+ getGroupGains(id, filter, pagination) {
278
+ return sendGetRequest(`/groups/${id}/gained`, Object.assign(Object.assign({}, pagination), filter));
279
+ }
280
+ /**
281
+ * Fetches a group members' latest achievements.
282
+ * @returns A list of achievements.
283
+ */
284
+ getGroupAchievements(id, pagination) {
285
+ return sendGetRequest(`/groups/${id}/achievements`, Object.assign({}, pagination));
286
+ }
287
+ /**
288
+ * Fetches a group's record leaderboard for a specific metric and period.
289
+ * @returns A list of records, including their respective players.
290
+ */
291
+ getGroupRecords(id, filter, pagination) {
292
+ return sendGetRequest(`/groups/${id}/records`, Object.assign(Object.assign({}, pagination), filter));
293
+ }
294
+ /**
295
+ * Fetches a group's hiscores for a specific metric.
296
+ * @returns A list of hiscores entries (value, rank), including their respective players.
297
+ */
298
+ getGroupHiscores(id, metric, pagination) {
299
+ return sendGetRequest(`/groups/${id}/hiscores`, Object.assign(Object.assign({}, pagination), { metric }));
300
+ }
301
+ /**
302
+ * Fetches a group members' latest name changes.
303
+ * @returns A list of name change (approved) requests.
304
+ */
305
+ getGroupNameChanges(id, pagination) {
306
+ return sendGetRequest(`/groups/${id}/name-changes`, Object.assign({}, pagination));
307
+ }
308
+ /**
309
+ * Fetches a group's general statistics.
310
+ * @returns An object with a few statistic values and an average stats snapshot.
311
+ */
312
+ getGroupStatistics(id) {
313
+ return sendGetRequest(`/groups/${id}/statistics`);
314
+ }
315
+ }
316
+
317
+ class PlayersClient {
318
+ /**
319
+ * Searches players by partial username.
320
+ * @returns A list of players.
321
+ */
322
+ searchPlayers(partialUsername, pagination) {
323
+ return sendGetRequest('/players/search', Object.assign({ username: partialUsername }, pagination));
324
+ }
325
+ /**
326
+ * Updates/tracks a player.
327
+ * @returns The player's new details, including the latest snapshot.
328
+ */
329
+ updatePlayer(player) {
330
+ return sendPostRequest(getPlayerURL(player));
331
+ }
332
+ /**
333
+ * Asserts (and attempts to fix, if necessary) a player's game-mode type.
334
+ * @returns The updated player, and an indication of whether the type was changed.
335
+ */
336
+ assertPlayerType(player) {
337
+ return sendPostRequest(`${getPlayerURL(player)}/assert-type`);
338
+ }
339
+ /**
340
+ * Attempts to import a player's snapshot history from CrystalMathLabs.
341
+ * @returns The number of snapshots that were imported.
342
+ */
343
+ importPlayer(player) {
344
+ return sendPostRequest(`${getPlayerURL(player)}/import-history`);
345
+ }
346
+ /**
347
+ * Fetches a player's details.
348
+ * @returns The player's details, including the latest snapshot.
349
+ */
350
+ getPlayerDetails(player) {
351
+ return sendGetRequest(getPlayerURL(player));
352
+ }
353
+ /**
354
+ * Fetches a player's current achievements.
355
+ * @returns A list of achievements.
356
+ */
357
+ getPlayerAchievements(player) {
358
+ return sendGetRequest(`${getPlayerURL(player)}/achievements`);
359
+ }
360
+ /**
361
+ * Fetches a player's current achievement progress.
362
+ * @returns A list of achievements (completed or otherwise), with their respective relative/absolute progress percentage.
363
+ */
364
+ getPlayerAchievementProgress(player) {
365
+ return sendGetRequest(`${getPlayerURL(player)}/achievements/progress`);
366
+ }
367
+ /**
368
+ * Fetches all of the player's competition participations.
369
+ * @returns A list of participations, with the respective competition included.
370
+ */
371
+ getPlayerCompetitions(player, pagination) {
372
+ return sendGetRequest(`${getPlayerURL(player)}/competitions`, pagination);
373
+ }
374
+ /**
375
+ * Fetches all of the player's group memberships.
376
+ * @returns A list of memberships, with the respective group included.
377
+ */
378
+ getPlayerGroups(player, pagination) {
379
+ return sendGetRequest(`${getPlayerURL(player)}/groups`, pagination);
380
+ }
381
+ /**
382
+ * Fetches a player's gains, for a specific period or time range, as a [metric: data] map.
383
+ * @returns A map of each metric's gained data.
384
+ */
385
+ getPlayerGains(player, options) {
386
+ return sendGetRequest(`${getPlayerURL(player)}/gained`, options);
387
+ }
388
+ /**
389
+ * Fetches a player's gains, for a specific period or time range, as an array.
390
+ * @returns An array of each metric's gained data.
391
+ */
392
+ getPlayerGainsAsArray(player, options) {
393
+ return sendGetRequest(`${getPlayerURL(player)}/gained`, Object.assign(Object.assign({}, options), { formatting: 'array' }));
394
+ }
395
+ /**
396
+ * Fetches all of the player's records.
397
+ * @returns A list of records.
398
+ */
399
+ getPlayerRecords(player, options) {
400
+ return sendGetRequest(`${getPlayerURL(player)}/records`, options);
401
+ }
402
+ /**
403
+ * Fetches all of the player's past snapshots.
404
+ * @returns A list of snapshots.
405
+ */
406
+ getPlayerSnapshots(player, options) {
407
+ return sendGetRequest(`${getPlayerURL(player)}/snapshots`, options);
408
+ }
409
+ /**
410
+ * Fetches all of the player's approved name changes.
411
+ * @returns A list of name changes.
412
+ */
413
+ getPlayerNames(player) {
414
+ return sendGetRequest(`${getPlayerURL(player)}/names`);
415
+ }
416
+ }
417
+ function getPlayerURL(player) {
418
+ if (typeof player === 'string') {
419
+ return `/players/${player}`;
420
+ }
421
+ if (player.id) {
422
+ return `/players/id/${player.id}`;
423
+ }
424
+ return `/players/${player.username}`;
425
+ }
426
+
427
+ class RecordsClient {
428
+ /**
429
+ * Fetches the current records leaderboard for a specific metric, period, playerType, playerBuild and country.
430
+ * @returns A list of records, with their respective players, dates and values included.
431
+ */
432
+ getRecordLeaderboard(filter) {
433
+ return sendGetRequest('/records/leaderboard', filter);
434
+ }
435
+ }
436
+
437
+ /**
438
+ * Prisma currently seems to ignore the @map() in enum declarations.
439
+ *
440
+ * So by declaring this enum in the schema file:
441
+ *
442
+ * enum NameChangeStatus {
443
+ * PENDING @map('pending')
444
+ * DENIED @map('denied')
445
+ * APPROVED @map('approved')
446
+ * }
447
+ *
448
+ * you would expect the prisma client to then generate the following object:
449
+ *
450
+ * const NameChangeStatus = {
451
+ * PENDING: 'pending',
452
+ * DENIED: 'denied',
453
+ * APPROVED: 'approved',
454
+ * }
455
+ *
456
+ * but unfortunately, the mapping is only used for queries, and the actual esulting object is this:
457
+ *
458
+ * const NameChangeStatus = {
459
+ * PENDING: 'PENDING',
460
+ * DENIED: 'DENIED',
461
+ * APPROVED: 'APPROVED',
462
+ * }
463
+ *
464
+ * And because I'd hate having to call enum values in lowercase, like:
465
+ * NameChangeStatus.pending
466
+ * Metric.king_black_dragon
467
+ * Period.day
468
+ *
469
+ * I'd rather do some mapping to ensure I have the best of both worlds,
470
+ * lowercase database values, but with uppercase in code.
471
+ * With the mappings below, we can now use prisma enums by calling them with uppercase, like:
472
+ *
473
+ * NameChangeStatus.PENDING
474
+ * Metric.KING_BLACK_DRAGON
475
+ * Period.DAY
476
+ *
477
+ */
478
+ const Skill = {
479
+ OVERALL: 'overall',
480
+ ATTACK: 'attack',
481
+ DEFENCE: 'defence',
482
+ STRENGTH: 'strength',
483
+ HITPOINTS: 'hitpoints',
484
+ RANGED: 'ranged',
485
+ PRAYER: 'prayer',
486
+ MAGIC: 'magic',
487
+ COOKING: 'cooking',
488
+ WOODCUTTING: 'woodcutting',
489
+ FLETCHING: 'fletching',
490
+ FISHING: 'fishing',
491
+ FIREMAKING: 'firemaking',
492
+ CRAFTING: 'crafting',
493
+ SMITHING: 'smithing',
494
+ MINING: 'mining',
495
+ HERBLORE: 'herblore',
496
+ AGILITY: 'agility',
497
+ THIEVING: 'thieving',
498
+ SLAYER: 'slayer',
499
+ FARMING: 'farming',
500
+ RUNECRAFTING: 'runecrafting',
501
+ HUNTER: 'hunter',
502
+ CONSTRUCTION: 'construction'
503
+ };
504
+ const Activity = {
505
+ LEAGUE_POINTS: 'league_points',
506
+ BOUNTY_HUNTER_HUNTER: 'bounty_hunter_hunter',
507
+ BOUNTY_HUNTER_ROGUE: 'bounty_hunter_rogue',
508
+ CLUE_SCROLLS_ALL: 'clue_scrolls_all',
509
+ CLUE_SCROLLS_BEGINNER: 'clue_scrolls_beginner',
510
+ CLUE_SCROLLS_EASY: 'clue_scrolls_easy',
511
+ CLUE_SCROLLS_MEDIUM: 'clue_scrolls_medium',
512
+ CLUE_SCROLLS_HARD: 'clue_scrolls_hard',
513
+ CLUE_SCROLLS_ELITE: 'clue_scrolls_elite',
514
+ CLUE_SCROLLS_MASTER: 'clue_scrolls_master',
515
+ LAST_MAN_STANDING: 'last_man_standing',
516
+ PVP_ARENA: 'pvp_arena',
517
+ SOUL_WARS_ZEAL: 'soul_wars_zeal',
518
+ GUARDIANS_OF_THE_RIFT: 'guardians_of_the_rift'
519
+ };
520
+ const Boss = {
521
+ ABYSSAL_SIRE: 'abyssal_sire',
522
+ ALCHEMICAL_HYDRA: 'alchemical_hydra',
523
+ BARROWS_CHESTS: 'barrows_chests',
524
+ BRYOPHYTA: 'bryophyta',
525
+ CALLISTO: 'callisto',
526
+ CERBERUS: 'cerberus',
527
+ CHAMBERS_OF_XERIC: 'chambers_of_xeric',
528
+ CHAMBERS_OF_XERIC_CM: 'chambers_of_xeric_challenge_mode',
529
+ CHAOS_ELEMENTAL: 'chaos_elemental',
530
+ CHAOS_FANATIC: 'chaos_fanatic',
531
+ COMMANDER_ZILYANA: 'commander_zilyana',
532
+ CORPOREAL_BEAST: 'corporeal_beast',
533
+ CRAZY_ARCHAEOLOGIST: 'crazy_archaeologist',
534
+ DAGANNOTH_PRIME: 'dagannoth_prime',
535
+ DAGANNOTH_REX: 'dagannoth_rex',
536
+ DAGANNOTH_SUPREME: 'dagannoth_supreme',
537
+ DERANGED_ARCHAEOLOGIST: 'deranged_archaeologist',
538
+ GENERAL_GRAARDOR: 'general_graardor',
539
+ GIANT_MOLE: 'giant_mole',
540
+ GROTESQUE_GUARDIANS: 'grotesque_guardians',
541
+ HESPORI: 'hespori',
542
+ KALPHITE_QUEEN: 'kalphite_queen',
543
+ KING_BLACK_DRAGON: 'king_black_dragon',
544
+ KRAKEN: 'kraken',
545
+ KREEARRA: 'kreearra',
546
+ KRIL_TSUTSAROTH: 'kril_tsutsaroth',
547
+ MIMIC: 'mimic',
548
+ NEX: 'nex',
549
+ NIGHTMARE: 'nightmare',
550
+ PHOSANIS_NIGHTMARE: 'phosanis_nightmare',
551
+ OBOR: 'obor',
552
+ SARACHNIS: 'sarachnis',
553
+ SCORPIA: 'scorpia',
554
+ SKOTIZO: 'skotizo',
555
+ TEMPOROSS: 'tempoross',
556
+ THE_GAUNTLET: 'the_gauntlet',
557
+ THE_CORRUPTED_GAUNTLET: 'the_corrupted_gauntlet',
558
+ THEATRE_OF_BLOOD: 'theatre_of_blood',
559
+ THEATRE_OF_BLOOD_HARD_MODE: 'theatre_of_blood_hard_mode',
560
+ THERMONUCLEAR_SMOKE_DEVIL: 'thermonuclear_smoke_devil',
561
+ TOMBS_OF_AMASCUT: 'tombs_of_amascut',
562
+ TOMBS_OF_AMASCUT_EXPERT: 'tombs_of_amascut_expert',
563
+ TZKAL_ZUK: 'tzkal_zuk',
564
+ TZTOK_JAD: 'tztok_jad',
565
+ VENENATIS: 'venenatis',
566
+ VETION: 'vetion',
567
+ VORKATH: 'vorkath',
568
+ WINTERTODT: 'wintertodt',
569
+ ZALCANO: 'zalcano',
570
+ ZULRAH: 'zulrah'
571
+ };
572
+ const Virtual = {
573
+ EHP: 'ehp',
574
+ EHB: 'ehb'
575
+ };
576
+ const Metric = Object.assign(Object.assign(Object.assign(Object.assign({}, Skill), Activity), Boss), Virtual);
577
+ const NameChangeStatus = {
578
+ PENDING: 'pending',
579
+ DENIED: 'denied',
580
+ APPROVED: 'approved'
581
+ };
582
+ const Period = {
583
+ FIVE_MIN: 'five_min',
584
+ DAY: 'day',
585
+ WEEK: 'week',
586
+ MONTH: 'month',
587
+ YEAR: 'year'
588
+ };
589
+ const PlayerType = {
590
+ UNKNOWN: 'unknown',
591
+ REGULAR: 'regular',
592
+ IRONMAN: 'ironman',
593
+ HARDCORE: 'hardcore',
594
+ ULTIMATE: 'ultimate'
595
+ };
596
+ const PlayerBuild = {
597
+ MAIN: 'main',
598
+ F2P: 'f2p',
599
+ LVL3: 'lvl3',
600
+ ZERKER: 'zerker',
601
+ DEF1: 'def1',
602
+ HP10: 'hp10'
603
+ };
604
+ const CompetitionType = {
605
+ CLASSIC: 'classic',
606
+ TEAM: 'team'
607
+ };
608
+ const GroupRole = {
609
+ ACHIEVER: 'achiever',
610
+ ADAMANT: 'adamant',
611
+ ADEPT: 'adept',
612
+ ADMINISTRATOR: 'administrator',
613
+ ADMIRAL: 'admiral',
614
+ ADVENTURER: 'adventurer',
615
+ AIR: 'air',
616
+ ANCHOR: 'anchor',
617
+ APOTHECARY: 'apothecary',
618
+ ARCHER: 'archer',
619
+ ARMADYLEAN: 'armadylean',
620
+ ARTILLERY: 'artillery',
621
+ ARTISAN: 'artisan',
622
+ ASGARNIAN: 'asgarnian',
623
+ ASSASSIN: 'assassin',
624
+ ASSISTANT: 'assistant',
625
+ ASTRAL: 'astral',
626
+ ATHLETE: 'athlete',
627
+ ATTACKER: 'attacker',
628
+ BANDIT: 'bandit',
629
+ BANDOSIAN: 'bandosian',
630
+ BARBARIAN: 'barbarian',
631
+ BATTLEMAGE: 'battlemage',
632
+ BEAST: 'beast',
633
+ BERSERKER: 'berserker',
634
+ BLISTERWOOD: 'blisterwood',
635
+ BLOOD: 'blood',
636
+ BLUE: 'blue',
637
+ BOB: 'bob',
638
+ BODY: 'body',
639
+ BRASSICAN: 'brassican',
640
+ BRAWLER: 'brawler',
641
+ BRIGADIER: 'brigadier',
642
+ BRIGAND: 'brigand',
643
+ BRONZE: 'bronze',
644
+ BRUISER: 'bruiser',
645
+ BULWARK: 'bulwark',
646
+ BURGLAR: 'burglar',
647
+ BURNT: 'burnt',
648
+ CADET: 'cadet',
649
+ CAPTAIN: 'captain',
650
+ CARRY: 'carry',
651
+ CHAMPION: 'champion',
652
+ CHAOS: 'chaos',
653
+ CLERIC: 'cleric',
654
+ COLLECTOR: 'collector',
655
+ COLONEL: 'colonel',
656
+ COMMANDER: 'commander',
657
+ COMPETITOR: 'competitor',
658
+ COMPLETIONIST: 'completionist',
659
+ CONSTRUCTOR: 'constructor',
660
+ COOK: 'cook',
661
+ COORDINATOR: 'coordinator',
662
+ CORPORAL: 'corporal',
663
+ COSMIC: 'cosmic',
664
+ COUNCILLOR: 'councillor',
665
+ CRAFTER: 'crafter',
666
+ CREW: 'crew',
667
+ CRUSADER: 'crusader',
668
+ CUTPURSE: 'cutpurse',
669
+ DEATH: 'death',
670
+ DEFENDER: 'defender',
671
+ DEFILER: 'defiler',
672
+ DEPUTY_OWNER: 'deputy_owner',
673
+ DESTROYER: 'destroyer',
674
+ DIAMOND: 'diamond',
675
+ DISEASED: 'diseased',
676
+ DOCTOR: 'doctor',
677
+ DOGSBODY: 'dogsbody',
678
+ DRAGON: 'dragon',
679
+ DRAGONSTONE: 'dragonstone',
680
+ DRUID: 'druid',
681
+ DUELLIST: 'duellist',
682
+ EARTH: 'earth',
683
+ ELITE: 'elite',
684
+ EMERALD: 'emerald',
685
+ ENFORCER: 'enforcer',
686
+ EPIC: 'epic',
687
+ EXECUTIVE: 'executive',
688
+ EXPERT: 'expert',
689
+ EXPLORER: 'explorer',
690
+ FARMER: 'farmer',
691
+ FEEDER: 'feeder',
692
+ FIGHTER: 'fighter',
693
+ FIRE: 'fire',
694
+ FIREMAKER: 'firemaker',
695
+ FIRESTARTER: 'firestarter',
696
+ FISHER: 'fisher',
697
+ FLETCHER: 'fletcher',
698
+ FORAGER: 'forager',
699
+ FREMENNIK: 'fremennik',
700
+ GAMER: 'gamer',
701
+ GATHERER: 'gatherer',
702
+ GENERAL: 'general',
703
+ GNOME_CHILD: 'gnome_child',
704
+ GNOME_ELDER: 'gnome_elder',
705
+ GOBLIN: 'goblin',
706
+ GOLD: 'gold',
707
+ GOON: 'goon',
708
+ GREEN: 'green',
709
+ GREY: 'grey',
710
+ GUARDIAN: 'guardian',
711
+ GUTHIXIAN: 'guthixian',
712
+ HARPOON: 'harpoon',
713
+ HEALER: 'healer',
714
+ HELLCAT: 'hellcat',
715
+ HELPER: 'helper',
716
+ HERBOLOGIST: 'herbologist',
717
+ HERO: 'hero',
718
+ HOLY: 'holy',
719
+ HOARDER: 'hoarder',
720
+ HUNTER: 'hunter',
721
+ IGNITOR: 'ignitor',
722
+ ILLUSIONIST: 'illusionist',
723
+ IMP: 'imp',
724
+ INFANTRY: 'infantry',
725
+ INQUISITOR: 'inquisitor',
726
+ IRON: 'iron',
727
+ JADE: 'jade',
728
+ JUSTICIAR: 'justiciar',
729
+ KANDARIN: 'kandarin',
730
+ KARAMJAN: 'karamjan',
731
+ KHARIDIAN: 'kharidian',
732
+ KITTEN: 'kitten',
733
+ KNIGHT: 'knight',
734
+ LABOURER: 'labourer',
735
+ LAW: 'law',
736
+ LEADER: 'leader',
737
+ LEARNER: 'learner',
738
+ LEGACY: 'legacy',
739
+ LEGEND: 'legend',
740
+ LEGIONNAIRE: 'legionnaire',
741
+ LIEUTENANT: 'lieutenant',
742
+ LOOTER: 'looter',
743
+ LUMBERJACK: 'lumberjack',
744
+ MAGIC: 'magic',
745
+ MAGICIAN: 'magician',
746
+ MAJOR: 'major',
747
+ MAPLE: 'maple',
748
+ MARSHAL: 'marshal',
749
+ MASTER: 'master',
750
+ MAXED: 'maxed',
751
+ MEDIATOR: 'mediator',
752
+ MEDIC: 'medic',
753
+ MENTOR: 'mentor',
754
+ MEMBER: 'member',
755
+ MERCHANT: 'merchant',
756
+ MIND: 'mind',
757
+ MINER: 'miner',
758
+ MINION: 'minion',
759
+ MISTHALINIAN: 'misthalinian',
760
+ MITHRIL: 'mithril',
761
+ MODERATOR: 'moderator',
762
+ MONARCH: 'monarch',
763
+ MORYTANIAN: 'morytanian',
764
+ MYSTIC: 'mystic',
765
+ MYTH: 'myth',
766
+ NATURAL: 'natural',
767
+ NATURE: 'nature',
768
+ NECROMANCER: 'necromancer',
769
+ NINJA: 'ninja',
770
+ NOBLE: 'noble',
771
+ NOVICE: 'novice',
772
+ NURSE: 'nurse',
773
+ OAK: 'oak',
774
+ OFFICER: 'officer',
775
+ ONYX: 'onyx',
776
+ OPAL: 'opal',
777
+ ORACLE: 'oracle',
778
+ ORANGE: 'orange',
779
+ OWNER: 'owner',
780
+ PAGE: 'page',
781
+ PALADIN: 'paladin',
782
+ PAWN: 'pawn',
783
+ PILGRIM: 'pilgrim',
784
+ PINE: 'pine',
785
+ PINK: 'pink',
786
+ PREFECT: 'prefect',
787
+ PRIEST: 'priest',
788
+ PRIVATE: 'private',
789
+ PRODIGY: 'prodigy',
790
+ PROSELYTE: 'proselyte',
791
+ PROSPECTOR: 'prospector',
792
+ PROTECTOR: 'protector',
793
+ PURE: 'pure',
794
+ PURPLE: 'purple',
795
+ PYROMANCER: 'pyromancer',
796
+ QUESTER: 'quester',
797
+ RACER: 'racer',
798
+ RAIDER: 'raider',
799
+ RANGER: 'ranger',
800
+ RECORD_CHASER: 'record_chaser',
801
+ RECRUIT: 'recruit',
802
+ RECRUITER: 'recruiter',
803
+ RED_TOPAZ: 'red_topaz',
804
+ RED: 'red',
805
+ ROGUE: 'rogue',
806
+ RUBY: 'ruby',
807
+ RUNE: 'rune',
808
+ RUNECRAFTER: 'runecrafter',
809
+ SAGE: 'sage',
810
+ SAPPHIRE: 'sapphire',
811
+ SARADOMINIST: 'saradominist',
812
+ SAVIOUR: 'saviour',
813
+ SCAVENGER: 'scavenger',
814
+ SCHOLAR: 'scholar',
815
+ SCOURGE: 'scourge',
816
+ SCOUT: 'scout',
817
+ SCRIBE: 'scribe',
818
+ SEER: 'seer',
819
+ SENATOR: 'senator',
820
+ SENTRY: 'sentry',
821
+ SERENIST: 'serenist',
822
+ SERGEANT: 'sergeant',
823
+ SHAMAN: 'shaman',
824
+ SHERIFF: 'sheriff',
825
+ SHORT_GREEN_GUY: 'short_green_guy',
826
+ SKILLER: 'skiller',
827
+ SKULLED: 'skulled',
828
+ SLAYER: 'slayer',
829
+ SMITER: 'smiter',
830
+ SMITH: 'smith',
831
+ SMUGGLER: 'smuggler',
832
+ SNIPER: 'sniper',
833
+ SOUL: 'soul',
834
+ SPECIALIST: 'specialist',
835
+ SPEED_RUNNER: 'speed_runner',
836
+ SPELLCASTER: 'spellcaster',
837
+ SQUIRE: 'squire',
838
+ STAFF: 'staff',
839
+ STEEL: 'steel',
840
+ STRIDER: 'strider',
841
+ STRIKER: 'striker',
842
+ SUMMONER: 'summoner',
843
+ SUPERIOR: 'superior',
844
+ SUPERVISOR: 'supervisor',
845
+ TEACHER: 'teacher',
846
+ TEMPLAR: 'templar',
847
+ THERAPIST: 'therapist',
848
+ THIEF: 'thief',
849
+ TIRANNIAN: 'tirannian',
850
+ TRIALIST: 'trialist',
851
+ TRICKSTER: 'trickster',
852
+ TZKAL: 'tzkal',
853
+ TZTOK: 'tztok',
854
+ UNHOLY: 'unholy',
855
+ VAGRANT: 'vagrant',
856
+ VANGUARD: 'vanguard',
857
+ WALKER: 'walker',
858
+ WANDERER: 'wanderer',
859
+ WARDEN: 'warden',
860
+ WARLOCK: 'warlock',
861
+ WARRIOR: 'warrior',
862
+ WATER: 'water',
863
+ WILD: 'wild',
864
+ WILLOW: 'willow',
865
+ WILY: 'wily',
866
+ WINTUMBER: 'wintumber',
867
+ WITCH: 'witch',
868
+ WIZARD: 'wizard',
869
+ WORKER: 'worker',
870
+ WRATH: 'wrath',
871
+ XERICIAN: 'xerician',
872
+ YELLOW: 'yellow',
873
+ YEW: 'yew',
874
+ ZAMORAKIAN: 'zamorakian',
875
+ ZAROSIAN: 'zarosian',
876
+ ZEALOT: 'zealot',
877
+ ZENYTE: 'zenyte'
878
+ };
879
+ const Country = {
880
+ AD: 'AD',
881
+ AE: 'AE',
882
+ AF: 'AF',
883
+ AG: 'AG',
884
+ AI: 'AI',
885
+ AL: 'AL',
886
+ AM: 'AM',
887
+ AO: 'AO',
888
+ AQ: 'AQ',
889
+ AR: 'AR',
890
+ AS: 'AS',
891
+ AT: 'AT',
892
+ AU: 'AU',
893
+ AW: 'AW',
894
+ AX: 'AX',
895
+ AZ: 'AZ',
896
+ BA: 'BA',
897
+ BB: 'BB',
898
+ BD: 'BD',
899
+ BE: 'BE',
900
+ BF: 'BF',
901
+ BG: 'BG',
902
+ BH: 'BH',
903
+ BI: 'BI',
904
+ BJ: 'BJ',
905
+ BL: 'BL',
906
+ BM: 'BM',
907
+ BN: 'BN',
908
+ BO: 'BO',
909
+ BQ: 'BQ',
910
+ BR: 'BR',
911
+ BS: 'BS',
912
+ BT: 'BT',
913
+ BV: 'BV',
914
+ BW: 'BW',
915
+ BY: 'BY',
916
+ BZ: 'BZ',
917
+ CA: 'CA',
918
+ CC: 'CC',
919
+ CD: 'CD',
920
+ CF: 'CF',
921
+ CG: 'CG',
922
+ CH: 'CH',
923
+ CI: 'CI',
924
+ CK: 'CK',
925
+ CL: 'CL',
926
+ CM: 'CM',
927
+ CN: 'CN',
928
+ CO: 'CO',
929
+ CR: 'CR',
930
+ CU: 'CU',
931
+ CV: 'CV',
932
+ CW: 'CW',
933
+ CX: 'CX',
934
+ CY: 'CY',
935
+ CZ: 'CZ',
936
+ DE: 'DE',
937
+ DJ: 'DJ',
938
+ DK: 'DK',
939
+ DM: 'DM',
940
+ DO: 'DO',
941
+ DZ: 'DZ',
942
+ EC: 'EC',
943
+ EE: 'EE',
944
+ EG: 'EG',
945
+ EH: 'EH',
946
+ ER: 'ER',
947
+ ES: 'ES',
948
+ ET: 'ET',
949
+ FI: 'FI',
950
+ FJ: 'FJ',
951
+ FK: 'FK',
952
+ FM: 'FM',
953
+ FO: 'FO',
954
+ FR: 'FR',
955
+ GA: 'GA',
956
+ GB: 'GB',
957
+ GD: 'GD',
958
+ GE: 'GE',
959
+ GF: 'GF',
960
+ GG: 'GG',
961
+ GH: 'GH',
962
+ GI: 'GI',
963
+ GL: 'GL',
964
+ GM: 'GM',
965
+ GN: 'GN',
966
+ GP: 'GP',
967
+ GQ: 'GQ',
968
+ GR: 'GR',
969
+ GS: 'GS',
970
+ GT: 'GT',
971
+ GU: 'GU',
972
+ GW: 'GW',
973
+ GY: 'GY',
974
+ HK: 'HK',
975
+ HM: 'HM',
976
+ HN: 'HN',
977
+ HR: 'HR',
978
+ HT: 'HT',
979
+ HU: 'HU',
980
+ ID: 'ID',
981
+ IE: 'IE',
982
+ IL: 'IL',
983
+ IM: 'IM',
984
+ IN: 'IN',
985
+ IO: 'IO',
986
+ IQ: 'IQ',
987
+ IR: 'IR',
988
+ IS: 'IS',
989
+ IT: 'IT',
990
+ JE: 'JE',
991
+ JM: 'JM',
992
+ JO: 'JO',
993
+ JP: 'JP',
994
+ KE: 'KE',
995
+ KG: 'KG',
996
+ KH: 'KH',
997
+ KI: 'KI',
998
+ KM: 'KM',
999
+ KN: 'KN',
1000
+ KP: 'KP',
1001
+ KR: 'KR',
1002
+ KW: 'KW',
1003
+ KY: 'KY',
1004
+ KZ: 'KZ',
1005
+ LA: 'LA',
1006
+ LB: 'LB',
1007
+ LC: 'LC',
1008
+ LI: 'LI',
1009
+ LK: 'LK',
1010
+ LR: 'LR',
1011
+ LS: 'LS',
1012
+ LT: 'LT',
1013
+ LU: 'LU',
1014
+ LV: 'LV',
1015
+ LY: 'LY',
1016
+ MA: 'MA',
1017
+ MC: 'MC',
1018
+ MD: 'MD',
1019
+ ME: 'ME',
1020
+ MF: 'MF',
1021
+ MG: 'MG',
1022
+ MH: 'MH',
1023
+ MK: 'MK',
1024
+ ML: 'ML',
1025
+ MM: 'MM',
1026
+ MN: 'MN',
1027
+ MO: 'MO',
1028
+ MP: 'MP',
1029
+ MQ: 'MQ',
1030
+ MR: 'MR',
1031
+ MS: 'MS',
1032
+ MT: 'MT',
1033
+ MU: 'MU',
1034
+ MV: 'MV',
1035
+ MW: 'MW',
1036
+ MX: 'MX',
1037
+ MY: 'MY',
1038
+ MZ: 'MZ',
1039
+ NA: 'NA',
1040
+ NC: 'NC',
1041
+ NE: 'NE',
1042
+ NF: 'NF',
1043
+ NG: 'NG',
1044
+ NI: 'NI',
1045
+ NL: 'NL',
1046
+ NO: 'NO',
1047
+ NP: 'NP',
1048
+ NR: 'NR',
1049
+ NU: 'NU',
1050
+ NZ: 'NZ',
1051
+ OM: 'OM',
1052
+ PA: 'PA',
1053
+ PE: 'PE',
1054
+ PF: 'PF',
1055
+ PG: 'PG',
1056
+ PH: 'PH',
1057
+ PK: 'PK',
1058
+ PL: 'PL',
1059
+ PM: 'PM',
1060
+ PN: 'PN',
1061
+ PR: 'PR',
1062
+ PS: 'PS',
1063
+ PT: 'PT',
1064
+ PW: 'PW',
1065
+ PY: 'PY',
1066
+ QA: 'QA',
1067
+ RE: 'RE',
1068
+ RO: 'RO',
1069
+ RS: 'RS',
1070
+ RU: 'RU',
1071
+ RW: 'RW',
1072
+ SA: 'SA',
1073
+ SB: 'SB',
1074
+ SC: 'SC',
1075
+ SD: 'SD',
1076
+ SE: 'SE',
1077
+ SG: 'SG',
1078
+ SH: 'SH',
1079
+ SI: 'SI',
1080
+ SJ: 'SJ',
1081
+ SK: 'SK',
1082
+ SL: 'SL',
1083
+ SM: 'SM',
1084
+ SN: 'SN',
1085
+ SO: 'SO',
1086
+ SR: 'SR',
1087
+ SS: 'SS',
1088
+ ST: 'ST',
1089
+ SV: 'SV',
1090
+ SX: 'SX',
1091
+ SY: 'SY',
1092
+ SZ: 'SZ',
1093
+ TC: 'TC',
1094
+ TD: 'TD',
1095
+ TF: 'TF',
1096
+ TG: 'TG',
1097
+ TH: 'TH',
1098
+ TJ: 'TJ',
1099
+ TK: 'TK',
1100
+ TL: 'TL',
1101
+ TM: 'TM',
1102
+ TN: 'TN',
1103
+ TO: 'TO',
1104
+ TR: 'TR',
1105
+ TT: 'TT',
1106
+ TV: 'TV',
1107
+ TW: 'TW',
1108
+ TZ: 'TZ',
1109
+ UA: 'UA',
1110
+ UG: 'UG',
1111
+ UM: 'UM',
1112
+ US: 'US',
1113
+ UY: 'UY',
1114
+ UZ: 'UZ',
1115
+ VA: 'VA',
1116
+ VC: 'VC',
1117
+ VE: 'VE',
1118
+ VG: 'VG',
1119
+ VI: 'VI',
1120
+ VN: 'VN',
1121
+ VU: 'VU',
1122
+ WF: 'WF',
1123
+ WS: 'WS',
1124
+ YE: 'YE',
1125
+ YT: 'YT',
1126
+ ZA: 'ZA',
1127
+ ZM: 'ZM',
1128
+ ZW: 'ZW'
1129
+ };
1130
+
1131
+ exports.CompetitionStatus = void 0;
1132
+ (function (CompetitionStatus) {
1133
+ CompetitionStatus["UPCOMING"] = "upcoming";
1134
+ CompetitionStatus["ONGOING"] = "ongoing";
1135
+ CompetitionStatus["FINISHED"] = "finished";
1136
+ })(exports.CompetitionStatus || (exports.CompetitionStatus = {}));
1137
+ const CompetitionTypeProps = {
1138
+ [CompetitionType.CLASSIC]: { name: 'Classic' },
1139
+ [CompetitionType.TEAM]: { name: 'Team' }
1140
+ };
1141
+ const CompetitionStatusProps = {
1142
+ [exports.CompetitionStatus.UPCOMING]: { name: 'Upcoming' },
1143
+ [exports.CompetitionStatus.ONGOING]: { name: 'Ongoing' },
1144
+ [exports.CompetitionStatus.FINISHED]: { name: 'Finished' }
1145
+ };
1146
+ const COMPETITION_TYPES = Object.values(CompetitionType);
1147
+ const COMPETITION_STATUSES = Object.values(exports.CompetitionStatus);
1148
+ function findCompetitionType(typeName) {
1149
+ for (const [key, value] of Object.entries(CompetitionTypeProps)) {
1150
+ if (value.name === typeName)
1151
+ return key;
1152
+ }
1153
+ return null;
1154
+ }
1155
+ function findCompetitionStatus(statusName) {
1156
+ for (const [key, value] of Object.entries(CompetitionStatusProps)) {
1157
+ if (value.name === statusName)
1158
+ return key;
1159
+ }
1160
+ return null;
1161
+ }
1162
+
1163
+ const CountryProps = {
1164
+ [Country.AD]: { code: 'AD', name: 'Andorra' },
1165
+ [Country.AE]: { code: 'AE', name: 'United Arab Emirates' },
1166
+ [Country.AF]: { code: 'AF', name: 'Afghanistan' },
1167
+ [Country.AG]: { code: 'AG', name: 'Antigua and Barbuda' },
1168
+ [Country.AI]: { code: 'AI', name: 'Anguilla' },
1169
+ [Country.AL]: { code: 'AL', name: 'Albania' },
1170
+ [Country.AM]: { code: 'AM', name: 'Armenia' },
1171
+ [Country.AO]: { code: 'AO', name: 'Angola' },
1172
+ [Country.AQ]: { code: 'AQ', name: 'Antarctica' },
1173
+ [Country.AR]: { code: 'AR', name: 'Argentina' },
1174
+ [Country.AS]: { code: 'AS', name: 'American Samoa' },
1175
+ [Country.AT]: { code: 'AT', name: 'Austria' },
1176
+ [Country.AU]: { code: 'AU', name: 'Australia' },
1177
+ [Country.AW]: { code: 'AW', name: 'Aruba' },
1178
+ [Country.AX]: { code: 'AX', name: 'Åland Islands' },
1179
+ [Country.AZ]: { code: 'AZ', name: 'Azerbaijan' },
1180
+ [Country.BA]: { code: 'BA', name: 'Bosnia and Herzegovina' },
1181
+ [Country.BB]: { code: 'BB', name: 'Barbados' },
1182
+ [Country.BD]: { code: 'BD', name: 'Bangladesh' },
1183
+ [Country.BE]: { code: 'BE', name: 'Belgium' },
1184
+ [Country.BF]: { code: 'BF', name: 'Burkina Faso' },
1185
+ [Country.BG]: { code: 'BG', name: 'Bulgaria' },
1186
+ [Country.BH]: { code: 'BH', name: 'Bahrain' },
1187
+ [Country.BI]: { code: 'BI', name: 'Burundi' },
1188
+ [Country.BJ]: { code: 'BJ', name: 'Benin' },
1189
+ [Country.BL]: { code: 'BL', name: 'Saint Barthélemy' },
1190
+ [Country.BM]: { code: 'BM', name: 'Bermuda' },
1191
+ [Country.BN]: { code: 'BN', name: 'Brunei Darussalam' },
1192
+ [Country.BO]: { code: 'BO', name: 'Bolivia' },
1193
+ [Country.BQ]: { code: 'BQ', name: 'Bonaire' },
1194
+ [Country.BR]: { code: 'BR', name: 'Brazil' },
1195
+ [Country.BS]: { code: 'BS', name: 'Bahamas' },
1196
+ [Country.BT]: { code: 'BT', name: 'Bhutan' },
1197
+ [Country.BV]: { code: 'BV', name: 'Bouvet Island' },
1198
+ [Country.BW]: { code: 'BW', name: 'Botswana' },
1199
+ [Country.BY]: { code: 'BY', name: 'Belarus' },
1200
+ [Country.BZ]: { code: 'BZ', name: 'Belize' },
1201
+ [Country.CA]: { code: 'CA', name: 'Canada' },
1202
+ [Country.CC]: { code: 'CC', name: 'Cocos (Keeling) Islands' },
1203
+ [Country.CD]: { code: 'CD', name: 'Congo' },
1204
+ [Country.CF]: { code: 'CF', name: 'Central African Republic' },
1205
+ [Country.CG]: { code: 'CG', name: 'Congo' },
1206
+ [Country.CH]: { code: 'CH', name: 'Switzerland' },
1207
+ [Country.CI]: { code: 'CI', name: "Côte d'Ivoire" },
1208
+ [Country.CK]: { code: 'CK', name: 'Cook Islands' },
1209
+ [Country.CL]: { code: 'CL', name: 'Chile' },
1210
+ [Country.CM]: { code: 'CM', name: 'Cameroon' },
1211
+ [Country.CN]: { code: 'CN', name: 'China' },
1212
+ [Country.CO]: { code: 'CO', name: 'Colombia' },
1213
+ [Country.CR]: { code: 'CR', name: 'Costa Rica' },
1214
+ [Country.CU]: { code: 'CU', name: 'Cuba' },
1215
+ [Country.CV]: { code: 'CV', name: 'Cabo Verde' },
1216
+ [Country.CW]: { code: 'CW', name: 'Curaçao' },
1217
+ [Country.CX]: { code: 'CX', name: 'Christmas Island' },
1218
+ [Country.CY]: { code: 'CY', name: 'Cyprus' },
1219
+ [Country.CZ]: { code: 'CZ', name: 'Czechia' },
1220
+ [Country.DE]: { code: 'DE', name: 'Germany' },
1221
+ [Country.DJ]: { code: 'DJ', name: 'Djibouti' },
1222
+ [Country.DK]: { code: 'DK', name: 'Denmark' },
1223
+ [Country.DM]: { code: 'DM', name: 'Dominica' },
1224
+ [Country.DO]: { code: 'DO', name: 'Dominican Republic' },
1225
+ [Country.DZ]: { code: 'DZ', name: 'Algeria' },
1226
+ [Country.EC]: { code: 'EC', name: 'Ecuador' },
1227
+ [Country.EE]: { code: 'EE', name: 'Estonia' },
1228
+ [Country.EG]: { code: 'EG', name: 'Egypt' },
1229
+ [Country.EH]: { code: 'EH', name: 'Western Sahara' },
1230
+ [Country.ER]: { code: 'ER', name: 'Eritrea' },
1231
+ [Country.ES]: { code: 'ES', name: 'Spain' },
1232
+ [Country.ET]: { code: 'ET', name: 'Ethiopia' },
1233
+ [Country.FI]: { code: 'FI', name: 'Finland' },
1234
+ [Country.FJ]: { code: 'FJ', name: 'Fiji' },
1235
+ [Country.FK]: { code: 'FK', name: 'Falkland Islands (Malvinas)' },
1236
+ [Country.FM]: { code: 'FM', name: 'Micronesia (Federated States of)' },
1237
+ [Country.FO]: { code: 'FO', name: 'Faroe Islands' },
1238
+ [Country.FR]: { code: 'FR', name: 'France' },
1239
+ [Country.GA]: { code: 'GA', name: 'Gabon' },
1240
+ [Country.GB]: { code: 'GB', name: 'United Kingdom' },
1241
+ [Country.GD]: { code: 'GD', name: 'Grenada' },
1242
+ [Country.GE]: { code: 'GE', name: 'Georgia' },
1243
+ [Country.GF]: { code: 'GF', name: 'French Guiana' },
1244
+ [Country.GG]: { code: 'GG', name: 'Guernsey' },
1245
+ [Country.GH]: { code: 'GH', name: 'Ghana' },
1246
+ [Country.GI]: { code: 'GI', name: 'Gibraltar' },
1247
+ [Country.GL]: { code: 'GL', name: 'Greenland' },
1248
+ [Country.GM]: { code: 'GM', name: 'Gambia' },
1249
+ [Country.GN]: { code: 'GN', name: 'Guinea' },
1250
+ [Country.GP]: { code: 'GP', name: 'Guadeloupe' },
1251
+ [Country.GQ]: { code: 'GQ', name: 'Equatorial Guinea' },
1252
+ [Country.GR]: { code: 'GR', name: 'Greece' },
1253
+ [Country.GS]: { code: 'GS', name: 'South Georgia and the South Sandwich Islands' },
1254
+ [Country.GT]: { code: 'GT', name: 'Guatemala' },
1255
+ [Country.GU]: { code: 'GU', name: 'Guam' },
1256
+ [Country.GW]: { code: 'GW', name: 'Guinea-Bissau' },
1257
+ [Country.GY]: { code: 'GY', name: 'Guyana' },
1258
+ [Country.HK]: { code: 'HK', name: 'Hong Kong' },
1259
+ [Country.HM]: { code: 'HM', name: 'Heard Island and McDonald Islands' },
1260
+ [Country.HN]: { code: 'HN', name: 'Honduras' },
1261
+ [Country.HR]: { code: 'HR', name: 'Croatia' },
1262
+ [Country.HT]: { code: 'HT', name: 'Haiti' },
1263
+ [Country.HU]: { code: 'HU', name: 'Hungary' },
1264
+ [Country.ID]: { code: 'ID', name: 'Indonesia' },
1265
+ [Country.IE]: { code: 'IE', name: 'Ireland' },
1266
+ [Country.IL]: { code: 'IL', name: 'Israel' },
1267
+ [Country.IM]: { code: 'IM', name: 'Isle of Man' },
1268
+ [Country.IN]: { code: 'IN', name: 'India' },
1269
+ [Country.IO]: { code: 'IO', name: 'British Indian Ocean Territory' },
1270
+ [Country.IQ]: { code: 'IQ', name: 'Iraq' },
1271
+ [Country.IR]: { code: 'IR', name: 'Iran (Islamic Republic of)' },
1272
+ [Country.IS]: { code: 'IS', name: 'Iceland' },
1273
+ [Country.IT]: { code: 'IT', name: 'Italy' },
1274
+ [Country.JE]: { code: 'JE', name: 'Jersey' },
1275
+ [Country.JM]: { code: 'JM', name: 'Jamaica' },
1276
+ [Country.JO]: { code: 'JO', name: 'Jordan' },
1277
+ [Country.JP]: { code: 'JP', name: 'Japan' },
1278
+ [Country.KE]: { code: 'KE', name: 'Kenya' },
1279
+ [Country.KG]: { code: 'KG', name: 'Kyrgyzstan' },
1280
+ [Country.KH]: { code: 'KH', name: 'Cambodia' },
1281
+ [Country.KI]: { code: 'KI', name: 'Kiribati' },
1282
+ [Country.KM]: { code: 'KM', name: 'Comoros' },
1283
+ [Country.KN]: { code: 'KN', name: 'Saint Kitts and Nevis' },
1284
+ [Country.KP]: { code: 'KP', name: "Korea (Democratic People's Republic of)" },
1285
+ [Country.KR]: { code: 'KR', name: 'Korea' },
1286
+ [Country.KW]: { code: 'KW', name: 'Kuwait' },
1287
+ [Country.KY]: { code: 'KY', name: 'Cayman Islands' },
1288
+ [Country.KZ]: { code: 'KZ', name: 'Kazakhstan' },
1289
+ [Country.LA]: { code: 'LA', name: "Lao People's Democratic Republic" },
1290
+ [Country.LB]: { code: 'LB', name: 'Lebanon' },
1291
+ [Country.LC]: { code: 'LC', name: 'Saint Lucia' },
1292
+ [Country.LI]: { code: 'LI', name: 'Liechtenstein' },
1293
+ [Country.LK]: { code: 'LK', name: 'Sri Lanka' },
1294
+ [Country.LR]: { code: 'LR', name: 'Liberia' },
1295
+ [Country.LS]: { code: 'LS', name: 'Lesotho' },
1296
+ [Country.LT]: { code: 'LT', name: 'Lithuania' },
1297
+ [Country.LU]: { code: 'LU', name: 'Luxembourg' },
1298
+ [Country.LV]: { code: 'LV', name: 'Latvia' },
1299
+ [Country.LY]: { code: 'LY', name: 'Libya' },
1300
+ [Country.MA]: { code: 'MA', name: 'Morocco' },
1301
+ [Country.MC]: { code: 'MC', name: 'Monaco' },
1302
+ [Country.MD]: { code: 'MD', name: 'Moldova' },
1303
+ [Country.ME]: { code: 'ME', name: 'Montenegro' },
1304
+ [Country.MF]: { code: 'MF', name: 'Saint Martin (French part)' },
1305
+ [Country.MG]: { code: 'MG', name: 'Madagascar' },
1306
+ [Country.MH]: { code: 'MH', name: 'Marshall Islands' },
1307
+ [Country.MK]: { code: 'MK', name: 'North Macedonia' },
1308
+ [Country.ML]: { code: 'ML', name: 'Mali' },
1309
+ [Country.MM]: { code: 'MM', name: 'Myanmar' },
1310
+ [Country.MN]: { code: 'MN', name: 'Mongolia' },
1311
+ [Country.MO]: { code: 'MO', name: 'Macao' },
1312
+ [Country.MP]: { code: 'MP', name: 'Northern Mariana Islands' },
1313
+ [Country.MQ]: { code: 'MQ', name: 'Martinique' },
1314
+ [Country.MR]: { code: 'MR', name: 'Mauritania' },
1315
+ [Country.MS]: { code: 'MS', name: 'Montserrat' },
1316
+ [Country.MT]: { code: 'MT', name: 'Malta' },
1317
+ [Country.MU]: { code: 'MU', name: 'Mauritius' },
1318
+ [Country.MV]: { code: 'MV', name: 'Maldives' },
1319
+ [Country.MW]: { code: 'MW', name: 'Malawi' },
1320
+ [Country.MX]: { code: 'MX', name: 'Mexico' },
1321
+ [Country.MY]: { code: 'MY', name: 'Malaysia' },
1322
+ [Country.MZ]: { code: 'MZ', name: 'Mozambique' },
1323
+ [Country.NA]: { code: 'NA', name: 'Namibia' },
1324
+ [Country.NC]: { code: 'NC', name: 'New Caledonia' },
1325
+ [Country.NE]: { code: 'NE', name: 'Niger' },
1326
+ [Country.NF]: { code: 'NF', name: 'Norfolk Island' },
1327
+ [Country.NG]: { code: 'NG', name: 'Nigeria' },
1328
+ [Country.NI]: { code: 'NI', name: 'Nicaragua' },
1329
+ [Country.NL]: { code: 'NL', name: 'Netherlands' },
1330
+ [Country.NO]: { code: 'NO', name: 'Norway' },
1331
+ [Country.NP]: { code: 'NP', name: 'Nepal' },
1332
+ [Country.NR]: { code: 'NR', name: 'Nauru' },
1333
+ [Country.NU]: { code: 'NU', name: 'Niue' },
1334
+ [Country.NZ]: { code: 'NZ', name: 'New Zealand' },
1335
+ [Country.OM]: { code: 'OM', name: 'Oman' },
1336
+ [Country.PA]: { code: 'PA', name: 'Panama' },
1337
+ [Country.PE]: { code: 'PE', name: 'Peru' },
1338
+ [Country.PF]: { code: 'PF', name: 'French Polynesia' },
1339
+ [Country.PG]: { code: 'PG', name: 'Papua New Guinea' },
1340
+ [Country.PH]: { code: 'PH', name: 'Philippines' },
1341
+ [Country.PK]: { code: 'PK', name: 'Pakistan' },
1342
+ [Country.PL]: { code: 'PL', name: 'Poland' },
1343
+ [Country.PM]: { code: 'PM', name: 'Saint Pierre and Miquelon' },
1344
+ [Country.PN]: { code: 'PN', name: 'Pitcairn' },
1345
+ [Country.PR]: { code: 'PR', name: 'Puerto Rico' },
1346
+ [Country.PS]: { code: 'PS', name: 'Palestine' },
1347
+ [Country.PT]: { code: 'PT', name: 'Portugal' },
1348
+ [Country.PW]: { code: 'PW', name: 'Palau' },
1349
+ [Country.PY]: { code: 'PY', name: 'Paraguay' },
1350
+ [Country.QA]: { code: 'QA', name: 'Qatar' },
1351
+ [Country.RE]: { code: 'RE', name: 'Réunion' },
1352
+ [Country.RO]: { code: 'RO', name: 'Romania' },
1353
+ [Country.RS]: { code: 'RS', name: 'Serbia' },
1354
+ [Country.RU]: { code: 'RU', name: 'Russian Federation' },
1355
+ [Country.RW]: { code: 'RW', name: 'Rwanda' },
1356
+ [Country.SA]: { code: 'SA', name: 'Saudi Arabia' },
1357
+ [Country.SB]: { code: 'SB', name: 'Solomon Islands' },
1358
+ [Country.SC]: { code: 'SC', name: 'Seychelles' },
1359
+ [Country.SD]: { code: 'SD', name: 'Sudan' },
1360
+ [Country.SE]: { code: 'SE', name: 'Sweden' },
1361
+ [Country.SG]: { code: 'SG', name: 'Singapore' },
1362
+ [Country.SH]: { code: 'SH', name: 'Saint Helena' },
1363
+ [Country.SI]: { code: 'SI', name: 'Slovenia' },
1364
+ [Country.SJ]: { code: 'SJ', name: 'Svalbard and Jan Mayen' },
1365
+ [Country.SK]: { code: 'SK', name: 'Slovakia' },
1366
+ [Country.SL]: { code: 'SL', name: 'Sierra Leone' },
1367
+ [Country.SM]: { code: 'SM', name: 'San Marino' },
1368
+ [Country.SN]: { code: 'SN', name: 'Senegal' },
1369
+ [Country.SO]: { code: 'SO', name: 'Somalia' },
1370
+ [Country.SR]: { code: 'SR', name: 'Suriname' },
1371
+ [Country.SS]: { code: 'SS', name: 'South Sudan' },
1372
+ [Country.ST]: { code: 'ST', name: 'Sao Tome and Principe' },
1373
+ [Country.SV]: { code: 'SV', name: 'El Salvador' },
1374
+ [Country.SX]: { code: 'SX', name: 'Sint Maarten (Dutch part)' },
1375
+ [Country.SY]: { code: 'SY', name: 'Syrian Arab Republic' },
1376
+ [Country.SZ]: { code: 'SZ', name: 'Eswatini' },
1377
+ [Country.TC]: { code: 'TC', name: 'Turks and Caicos Islands' },
1378
+ [Country.TD]: { code: 'TD', name: 'Chad' },
1379
+ [Country.TF]: { code: 'TF', name: 'French Southern Territories' },
1380
+ [Country.TG]: { code: 'TG', name: 'Togo' },
1381
+ [Country.TH]: { code: 'TH', name: 'Thailand' },
1382
+ [Country.TJ]: { code: 'TJ', name: 'Tajikistan' },
1383
+ [Country.TK]: { code: 'TK', name: 'Tokelau' },
1384
+ [Country.TL]: { code: 'TL', name: 'Timor-Leste' },
1385
+ [Country.TM]: { code: 'TM', name: 'Turkmenistan' },
1386
+ [Country.TN]: { code: 'TN', name: 'Tunisia' },
1387
+ [Country.TO]: { code: 'TO', name: 'Tonga' },
1388
+ [Country.TR]: { code: 'TR', name: 'Turkey' },
1389
+ [Country.TT]: { code: 'TT', name: 'Trinidad and Tobago' },
1390
+ [Country.TV]: { code: 'TV', name: 'Tuvalu' },
1391
+ [Country.TW]: { code: 'TW', name: 'Taiwan' },
1392
+ [Country.TZ]: { code: 'TZ', name: 'Tanzania' },
1393
+ [Country.UA]: { code: 'UA', name: 'Ukraine' },
1394
+ [Country.UG]: { code: 'UG', name: 'Uganda' },
1395
+ [Country.UM]: { code: 'UM', name: 'United States Minor Outlying Islands' },
1396
+ [Country.US]: { code: 'US', name: 'United States of America' },
1397
+ [Country.UY]: { code: 'UY', name: 'Uruguay' },
1398
+ [Country.UZ]: { code: 'UZ', name: 'Uzbekistan' },
1399
+ [Country.VA]: { code: 'VA', name: 'Holy See' },
1400
+ [Country.VC]: { code: 'VC', name: 'Saint Vincent and the Grenadines' },
1401
+ [Country.VE]: { code: 'VE', name: 'Venezuela (Bolivarian Republic of)' },
1402
+ [Country.VG]: { code: 'VG', name: 'Virgin Islands (British)' },
1403
+ [Country.VI]: { code: 'VI', name: 'Virgin Islands (U.S.)' },
1404
+ [Country.VN]: { code: 'VN', name: 'Viet Nam' },
1405
+ [Country.VU]: { code: 'VU', name: 'Vanuatu' },
1406
+ [Country.WF]: { code: 'WF', name: 'Wallis and Futuna' },
1407
+ [Country.WS]: { code: 'WS', name: 'Samoa' },
1408
+ [Country.YE]: { code: 'YE', name: 'Yemen' },
1409
+ [Country.YT]: { code: 'YT', name: 'Mayotte' },
1410
+ [Country.ZA]: { code: 'ZA', name: 'South Africa' },
1411
+ [Country.ZM]: { code: 'ZM', name: 'Zambia' },
1412
+ [Country.ZW]: { code: 'ZW', name: 'Zimbabwe' }
1413
+ };
1414
+ const COUNTRY_CODES = Object.values(Country);
1415
+ const COMMON_ALIASES = [
1416
+ { commonIdentifier: 'UK', trueIdentifier: 'GB' },
1417
+ { commonIdentifier: 'USA', trueIdentifier: 'US' }
1418
+ ];
1419
+ function findCountry(countryIdentifier) {
1420
+ return findCountryByCode(countryIdentifier) || findCountryByName(countryIdentifier);
1421
+ }
1422
+ function findCountryByName(countryName) {
1423
+ return Object.values(CountryProps).find(c => c.name.toUpperCase() === countryName.toUpperCase());
1424
+ }
1425
+ function findCountryByCode(countryCode) {
1426
+ return Object.values(CountryProps).find(c => c.code === replaceCommonAliases(countryCode.toUpperCase()));
1427
+ }
1428
+ function replaceCommonAliases(countryCode) {
1429
+ var _a;
1430
+ if (!countryCode)
1431
+ return null;
1432
+ return ((_a = COMMON_ALIASES.find(ca => ca.commonIdentifier === countryCode)) === null || _a === void 0 ? void 0 : _a.trueIdentifier) || countryCode;
1433
+ }
1434
+
1435
+ // Maximum effective skill level at 13,034,431 experience.
1436
+ const MAX_LEVEL = 99;
1437
+ // The maximum virtual skill level for any skill (200M experience).
1438
+ const MAX_VIRTUAL_LEVEL = 126;
1439
+ // The maximum skill experience (200M experience).
1440
+ const MAX_SKILL_EXP = 200000000;
1441
+ // The minimum skill exp for level 99
1442
+ const SKILL_EXP_AT_99 = 13034431;
1443
+ // The maximum skill at exactly 99 on all skills
1444
+ const CAPPED_MAX_TOTAL_XP = 23 * SKILL_EXP_AT_99;
1445
+ // Builds a lookup table for each level's required experience
1446
+ // exp = XP_FOR_LEVEL[level - 1] || 13m = XP_FOR_LEVEL[98]
1447
+ const XP_FOR_LEVEL = (function () {
1448
+ let xp = 0;
1449
+ const array = [];
1450
+ for (let level = 1; level <= MAX_VIRTUAL_LEVEL; ++level) {
1451
+ array[level - 1] = Math.floor(xp / 4);
1452
+ xp += Math.floor(level + 300 * Math.pow(2, level / 7));
1453
+ }
1454
+ return array;
1455
+ })();
1456
+ function getExpForLevel(level) {
1457
+ if (level < 1 || level > MAX_VIRTUAL_LEVEL)
1458
+ return 0;
1459
+ return XP_FOR_LEVEL[level - 1];
1460
+ }
1461
+ function getLevel(exp, virtual = false) {
1462
+ if (!exp || exp < 0) {
1463
+ return 1;
1464
+ }
1465
+ let low = 0;
1466
+ let high = virtual ? XP_FOR_LEVEL.length - 1 : 98;
1467
+ while (low <= high) {
1468
+ const mid = Math.floor(low + (high - low) / 2);
1469
+ const xpForLevel = XP_FOR_LEVEL[mid];
1470
+ if (exp < xpForLevel) {
1471
+ high = mid - 1;
1472
+ }
1473
+ else if (exp > xpForLevel) {
1474
+ low = mid + 1;
1475
+ }
1476
+ else {
1477
+ return mid + 1;
1478
+ }
1479
+ }
1480
+ return high + 1;
1481
+ }
1482
+ function getCombatLevel(attack, strength, defence, ranged, magic, hitpoints, prayer) {
1483
+ if ([attack, strength, defence, ranged, magic, hitpoints, prayer].some(l => l === 0))
1484
+ return 0;
1485
+ const baseCombat = 0.25 * (defence + Math.max(hitpoints, 10) + Math.floor(prayer / 2));
1486
+ const meleeCombat = 0.325 * (attack + strength);
1487
+ const rangeCombat = 0.325 * Math.floor((3 * ranged) / 2);
1488
+ const mageCombat = 0.325 * Math.floor((3 * magic) / 2);
1489
+ return Math.floor(baseCombat + Math.max(meleeCombat, rangeCombat, mageCombat));
1490
+ }
1491
+
1492
+ const GROUP_ROLES = Object.values(GroupRole);
1493
+ const PRIVELEGED_GROUP_ROLES = [
1494
+ GroupRole.ADMINISTRATOR,
1495
+ GroupRole.DEPUTY_OWNER,
1496
+ GroupRole.LEADER,
1497
+ GroupRole.MODERATOR,
1498
+ GroupRole.OWNER
1499
+ ];
1500
+ const GroupRoleProps = lodash.mapValues({
1501
+ [GroupRole.ACHIEVER]: { name: 'Achiever' },
1502
+ [GroupRole.ADAMANT]: { name: 'Adamant' },
1503
+ [GroupRole.ADEPT]: { name: 'Adept' },
1504
+ [GroupRole.ADMINISTRATOR]: { name: 'Administrator' },
1505
+ [GroupRole.ADMIRAL]: { name: 'Admiral' },
1506
+ [GroupRole.ADVENTURER]: { name: 'Adventurer' },
1507
+ [GroupRole.AIR]: { name: 'Air' },
1508
+ [GroupRole.ANCHOR]: { name: 'Anchor' },
1509
+ [GroupRole.APOTHECARY]: { name: 'Apothecary' },
1510
+ [GroupRole.ARCHER]: { name: 'Archer' },
1511
+ [GroupRole.ARMADYLEAN]: { name: 'Armadylean' },
1512
+ [GroupRole.ARTILLERY]: { name: 'Artillery' },
1513
+ [GroupRole.ARTISAN]: { name: 'Artisan' },
1514
+ [GroupRole.ASGARNIAN]: { name: 'Asgarnian' },
1515
+ [GroupRole.ASSASSIN]: { name: 'Assassin' },
1516
+ [GroupRole.ASSISTANT]: { name: 'Assistant' },
1517
+ [GroupRole.ASTRAL]: { name: 'Astral' },
1518
+ [GroupRole.ATHLETE]: { name: 'Athlete' },
1519
+ [GroupRole.ATTACKER]: { name: 'Attacker' },
1520
+ [GroupRole.BANDIT]: { name: 'Bandit' },
1521
+ [GroupRole.BANDOSIAN]: { name: 'Bandosian' },
1522
+ [GroupRole.BARBARIAN]: { name: 'Barbarian' },
1523
+ [GroupRole.BATTLEMAGE]: { name: 'Battlemage' },
1524
+ [GroupRole.BEAST]: { name: 'Beast' },
1525
+ [GroupRole.BERSERKER]: { name: 'Berserker' },
1526
+ [GroupRole.BLISTERWOOD]: { name: 'Blisterwood' },
1527
+ [GroupRole.BLOOD]: { name: 'Blood' },
1528
+ [GroupRole.BLUE]: { name: 'Blue' },
1529
+ [GroupRole.BOB]: { name: 'Bob' },
1530
+ [GroupRole.BODY]: { name: 'Body' },
1531
+ [GroupRole.BRASSICAN]: { name: 'Brassican' },
1532
+ [GroupRole.BRAWLER]: { name: 'Brawler' },
1533
+ [GroupRole.BRIGADIER]: { name: 'Brigadier' },
1534
+ [GroupRole.BRIGAND]: { name: 'Brigand' },
1535
+ [GroupRole.BRONZE]: { name: 'Bronze' },
1536
+ [GroupRole.BRUISER]: { name: 'Bruiser' },
1537
+ [GroupRole.BULWARK]: { name: 'Bulwark' },
1538
+ [GroupRole.BURGLAR]: { name: 'Burglar' },
1539
+ [GroupRole.BURNT]: { name: 'Burnt' },
1540
+ [GroupRole.CADET]: { name: 'Cadet' },
1541
+ [GroupRole.CAPTAIN]: { name: 'Captain' },
1542
+ [GroupRole.CARRY]: { name: 'Carry' },
1543
+ [GroupRole.CHAMPION]: { name: 'Champion' },
1544
+ [GroupRole.CHAOS]: { name: 'Chaos' },
1545
+ [GroupRole.CLERIC]: { name: 'Cleric' },
1546
+ [GroupRole.COLLECTOR]: { name: 'Collector' },
1547
+ [GroupRole.COLONEL]: { name: 'Colonel' },
1548
+ [GroupRole.COMMANDER]: { name: 'Commander' },
1549
+ [GroupRole.COMPETITOR]: { name: 'Competitor' },
1550
+ [GroupRole.COMPLETIONIST]: { name: 'Completionist' },
1551
+ [GroupRole.CONSTRUCTOR]: { name: 'Constructor' },
1552
+ [GroupRole.COOK]: { name: 'Cook' },
1553
+ [GroupRole.COORDINATOR]: { name: 'Coordinator' },
1554
+ [GroupRole.CORPORAL]: { name: 'Corporal' },
1555
+ [GroupRole.COSMIC]: { name: 'Cosmic' },
1556
+ [GroupRole.COUNCILLOR]: { name: 'Councillor' },
1557
+ [GroupRole.CRAFTER]: { name: 'Crafter' },
1558
+ [GroupRole.CREW]: { name: 'Crew' },
1559
+ [GroupRole.CRUSADER]: { name: 'Crusader' },
1560
+ [GroupRole.CUTPURSE]: { name: 'Cutpurse' },
1561
+ [GroupRole.DEATH]: { name: 'Death' },
1562
+ [GroupRole.DEFENDER]: { name: 'Defender' },
1563
+ [GroupRole.DEFILER]: { name: 'Defiler' },
1564
+ [GroupRole.DEPUTY_OWNER]: { name: 'Deputy Owner' },
1565
+ [GroupRole.DESTROYER]: { name: 'Destroyer' },
1566
+ [GroupRole.DIAMOND]: { name: 'Diamond' },
1567
+ [GroupRole.DISEASED]: { name: 'Diseased' },
1568
+ [GroupRole.DOCTOR]: { name: 'Doctor' },
1569
+ [GroupRole.DOGSBODY]: { name: 'Dogsbody' },
1570
+ [GroupRole.DRAGON]: { name: 'Dragon' },
1571
+ [GroupRole.DRAGONSTONE]: { name: 'Dragonstone' },
1572
+ [GroupRole.DRUID]: { name: 'Druid' },
1573
+ [GroupRole.DUELLIST]: { name: 'Duellist' },
1574
+ [GroupRole.EARTH]: { name: 'Earth' },
1575
+ [GroupRole.ELITE]: { name: 'Elite' },
1576
+ [GroupRole.EMERALD]: { name: 'Emerald' },
1577
+ [GroupRole.ENFORCER]: { name: 'Enforcer' },
1578
+ [GroupRole.EPIC]: { name: 'Epic' },
1579
+ [GroupRole.EXECUTIVE]: { name: 'Executive' },
1580
+ [GroupRole.EXPERT]: { name: 'Expert' },
1581
+ [GroupRole.EXPLORER]: { name: 'Explorer' },
1582
+ [GroupRole.FARMER]: { name: 'Farmer' },
1583
+ [GroupRole.FEEDER]: { name: 'Feeder' },
1584
+ [GroupRole.FIGHTER]: { name: 'Fighter' },
1585
+ [GroupRole.FIRE]: { name: 'Fire' },
1586
+ [GroupRole.FIREMAKER]: { name: 'Firemaker' },
1587
+ [GroupRole.FIRESTARTER]: { name: 'Firestarter' },
1588
+ [GroupRole.FISHER]: { name: 'Fisher' },
1589
+ [GroupRole.FLETCHER]: { name: 'Fletcher' },
1590
+ [GroupRole.FORAGER]: { name: 'Forager' },
1591
+ [GroupRole.FREMENNIK]: { name: 'Fremennik' },
1592
+ [GroupRole.GAMER]: { name: 'Gamer' },
1593
+ [GroupRole.GATHERER]: { name: 'Gatherer' },
1594
+ [GroupRole.GENERAL]: { name: 'General' },
1595
+ [GroupRole.GNOME_CHILD]: { name: 'Gnome Child' },
1596
+ [GroupRole.GNOME_ELDER]: { name: 'Gnome Elder' },
1597
+ [GroupRole.GOBLIN]: { name: 'Goblin' },
1598
+ [GroupRole.GOLD]: { name: 'Gold' },
1599
+ [GroupRole.GOON]: { name: 'Goon' },
1600
+ [GroupRole.GREEN]: { name: 'Green' },
1601
+ [GroupRole.GREY]: { name: 'Grey' },
1602
+ [GroupRole.GUARDIAN]: { name: 'Guardian' },
1603
+ [GroupRole.GUTHIXIAN]: { name: 'Guthixian' },
1604
+ [GroupRole.HARPOON]: { name: 'Harpoon' },
1605
+ [GroupRole.HEALER]: { name: 'Healer' },
1606
+ [GroupRole.HELLCAT]: { name: 'Hellcat' },
1607
+ [GroupRole.HELPER]: { name: 'Helper' },
1608
+ [GroupRole.HERBOLOGIST]: { name: 'Herbologist' },
1609
+ [GroupRole.HERO]: { name: 'Hero' },
1610
+ [GroupRole.HOLY]: { name: 'Holy' },
1611
+ [GroupRole.HOARDER]: { name: 'Hoarder' },
1612
+ [GroupRole.HUNTER]: { name: 'Hunter' },
1613
+ [GroupRole.IGNITOR]: { name: 'Ignitor' },
1614
+ [GroupRole.ILLUSIONIST]: { name: 'Illusionist' },
1615
+ [GroupRole.IMP]: { name: 'Imp' },
1616
+ [GroupRole.INFANTRY]: { name: 'Infantry' },
1617
+ [GroupRole.INQUISITOR]: { name: 'Inquisitor' },
1618
+ [GroupRole.IRON]: { name: 'Iron' },
1619
+ [GroupRole.JADE]: { name: 'Jade' },
1620
+ [GroupRole.JUSTICIAR]: { name: 'Justiciar' },
1621
+ [GroupRole.KANDARIN]: { name: 'Kandarin' },
1622
+ [GroupRole.KARAMJAN]: { name: 'Karamjan' },
1623
+ [GroupRole.KHARIDIAN]: { name: 'Kharidian' },
1624
+ [GroupRole.KITTEN]: { name: 'Kitten' },
1625
+ [GroupRole.KNIGHT]: { name: 'Knight' },
1626
+ [GroupRole.LABOURER]: { name: 'Labourer' },
1627
+ [GroupRole.LAW]: { name: 'Law' },
1628
+ [GroupRole.LEADER]: { name: 'Leader' },
1629
+ [GroupRole.LEARNER]: { name: 'Learner' },
1630
+ [GroupRole.LEGACY]: { name: 'Legacy' },
1631
+ [GroupRole.LEGEND]: { name: 'Legend' },
1632
+ [GroupRole.LEGIONNAIRE]: { name: 'Legionnaire' },
1633
+ [GroupRole.LIEUTENANT]: { name: 'Lieutenant' },
1634
+ [GroupRole.LOOTER]: { name: 'Looter' },
1635
+ [GroupRole.LUMBERJACK]: { name: 'Lumberjack' },
1636
+ [GroupRole.MAGIC]: { name: 'Magic' },
1637
+ [GroupRole.MAGICIAN]: { name: 'Magician' },
1638
+ [GroupRole.MAJOR]: { name: 'Major' },
1639
+ [GroupRole.MAPLE]: { name: 'Maple' },
1640
+ [GroupRole.MARSHAL]: { name: 'Marshal' },
1641
+ [GroupRole.MASTER]: { name: 'Master' },
1642
+ [GroupRole.MAXED]: { name: 'Maxed' },
1643
+ [GroupRole.MEDIATOR]: { name: 'Mediator' },
1644
+ [GroupRole.MEDIC]: { name: 'Medic' },
1645
+ [GroupRole.MENTOR]: { name: 'Mentor' },
1646
+ [GroupRole.MEMBER]: { name: 'Member' },
1647
+ [GroupRole.MERCHANT]: { name: 'Merchant' },
1648
+ [GroupRole.MIND]: { name: 'Mind' },
1649
+ [GroupRole.MINER]: { name: 'Miner' },
1650
+ [GroupRole.MINION]: { name: 'Minion' },
1651
+ [GroupRole.MISTHALINIAN]: { name: 'Misthalinian' },
1652
+ [GroupRole.MITHRIL]: { name: 'Mithril' },
1653
+ [GroupRole.MODERATOR]: { name: 'Moderator' },
1654
+ [GroupRole.MONARCH]: { name: 'Monarch' },
1655
+ [GroupRole.MORYTANIAN]: { name: 'Morytanian' },
1656
+ [GroupRole.MYSTIC]: { name: 'Mystic' },
1657
+ [GroupRole.MYTH]: { name: 'Myth' },
1658
+ [GroupRole.NATURAL]: { name: 'Natural' },
1659
+ [GroupRole.NATURE]: { name: 'Nature' },
1660
+ [GroupRole.NECROMANCER]: { name: 'Necromancer' },
1661
+ [GroupRole.NINJA]: { name: 'Ninja' },
1662
+ [GroupRole.NOBLE]: { name: 'Noble' },
1663
+ [GroupRole.NOVICE]: { name: 'Novice' },
1664
+ [GroupRole.NURSE]: { name: 'Nurse' },
1665
+ [GroupRole.OAK]: { name: 'Oak' },
1666
+ [GroupRole.OFFICER]: { name: 'Officer' },
1667
+ [GroupRole.ONYX]: { name: 'Onyx' },
1668
+ [GroupRole.OPAL]: { name: 'Opal' },
1669
+ [GroupRole.ORACLE]: { name: 'Oracle' },
1670
+ [GroupRole.ORANGE]: { name: 'Orange' },
1671
+ [GroupRole.OWNER]: { name: 'Owner' },
1672
+ [GroupRole.PAGE]: { name: 'Page' },
1673
+ [GroupRole.PALADIN]: { name: 'Paladin' },
1674
+ [GroupRole.PAWN]: { name: 'Pawn' },
1675
+ [GroupRole.PILGRIM]: { name: 'Pilgrim' },
1676
+ [GroupRole.PINE]: { name: 'Pine' },
1677
+ [GroupRole.PINK]: { name: 'Pink' },
1678
+ [GroupRole.PREFECT]: { name: 'Prefect' },
1679
+ [GroupRole.PRIEST]: { name: 'Priest' },
1680
+ [GroupRole.PRIVATE]: { name: 'Private' },
1681
+ [GroupRole.PRODIGY]: { name: 'Prodigy' },
1682
+ [GroupRole.PROSELYTE]: { name: 'Proselyte' },
1683
+ [GroupRole.PROSPECTOR]: { name: 'Prospector' },
1684
+ [GroupRole.PROTECTOR]: { name: 'Protector' },
1685
+ [GroupRole.PURE]: { name: 'Pure' },
1686
+ [GroupRole.PURPLE]: { name: 'Purple' },
1687
+ [GroupRole.PYROMANCER]: { name: 'Pyromancer' },
1688
+ [GroupRole.QUESTER]: { name: 'Quester' },
1689
+ [GroupRole.RACER]: { name: 'Racer' },
1690
+ [GroupRole.RAIDER]: { name: 'Raider' },
1691
+ [GroupRole.RANGER]: { name: 'Ranger' },
1692
+ [GroupRole.RECORD_CHASER]: { name: 'Record-Chaser' },
1693
+ [GroupRole.RECRUIT]: { name: 'Recruit' },
1694
+ [GroupRole.RECRUITER]: { name: 'Recruiter' },
1695
+ [GroupRole.RED_TOPAZ]: { name: 'Red Topaz' },
1696
+ [GroupRole.RED]: { name: 'Red' },
1697
+ [GroupRole.ROGUE]: { name: 'Rogue' },
1698
+ [GroupRole.RUBY]: { name: 'Ruby' },
1699
+ [GroupRole.RUNE]: { name: 'Rune' },
1700
+ [GroupRole.RUNECRAFTER]: { name: 'Runecrafter' },
1701
+ [GroupRole.SAGE]: { name: 'Sage' },
1702
+ [GroupRole.SAPPHIRE]: { name: 'Sapphire' },
1703
+ [GroupRole.SARADOMINIST]: { name: 'Saradominist' },
1704
+ [GroupRole.SAVIOUR]: { name: 'Saviour' },
1705
+ [GroupRole.SCAVENGER]: { name: 'Scavenger' },
1706
+ [GroupRole.SCHOLAR]: { name: 'Scholar' },
1707
+ [GroupRole.SCOURGE]: { name: 'Scourge' },
1708
+ [GroupRole.SCOUT]: { name: 'Scout' },
1709
+ [GroupRole.SCRIBE]: { name: 'Scribe' },
1710
+ [GroupRole.SEER]: { name: 'Seer' },
1711
+ [GroupRole.SENATOR]: { name: 'Senator' },
1712
+ [GroupRole.SENTRY]: { name: 'Sentry' },
1713
+ [GroupRole.SERENIST]: { name: 'Serenist' },
1714
+ [GroupRole.SERGEANT]: { name: 'Sergeant' },
1715
+ [GroupRole.SHAMAN]: { name: 'Shaman' },
1716
+ [GroupRole.SHERIFF]: { name: 'Sheriff' },
1717
+ [GroupRole.SHORT_GREEN_GUY]: { name: 'Short Green Guy' },
1718
+ [GroupRole.SKILLER]: { name: 'Skiller' },
1719
+ [GroupRole.SKULLED]: { name: 'Skulled' },
1720
+ [GroupRole.SLAYER]: { name: 'Slayer' },
1721
+ [GroupRole.SMITER]: { name: 'Smiter' },
1722
+ [GroupRole.SMITH]: { name: 'Smith' },
1723
+ [GroupRole.SMUGGLER]: { name: 'Smuggler' },
1724
+ [GroupRole.SNIPER]: { name: 'Sniper' },
1725
+ [GroupRole.SOUL]: { name: 'Soul' },
1726
+ [GroupRole.SPECIALIST]: { name: 'Specialist' },
1727
+ [GroupRole.SPEED_RUNNER]: { name: 'Speed-Runner' },
1728
+ [GroupRole.SPELLCASTER]: { name: 'Spellcaster' },
1729
+ [GroupRole.SQUIRE]: { name: 'Squire' },
1730
+ [GroupRole.STAFF]: { name: 'Staff' },
1731
+ [GroupRole.STEEL]: { name: 'Steel' },
1732
+ [GroupRole.STRIDER]: { name: 'Strider' },
1733
+ [GroupRole.STRIKER]: { name: 'Striker' },
1734
+ [GroupRole.SUMMONER]: { name: 'Summoner' },
1735
+ [GroupRole.SUPERIOR]: { name: 'Superior' },
1736
+ [GroupRole.SUPERVISOR]: { name: 'Supervisor' },
1737
+ [GroupRole.TEACHER]: { name: 'Teacher' },
1738
+ [GroupRole.TEMPLAR]: { name: 'Templar' },
1739
+ [GroupRole.THERAPIST]: { name: 'Therapist' },
1740
+ [GroupRole.THIEF]: { name: 'Thief' },
1741
+ [GroupRole.TIRANNIAN]: { name: 'Tirannian' },
1742
+ [GroupRole.TRIALIST]: { name: 'Trialist' },
1743
+ [GroupRole.TRICKSTER]: { name: 'Trickster' },
1744
+ [GroupRole.TZKAL]: { name: 'TzKal' },
1745
+ [GroupRole.TZTOK]: { name: 'TzTok' },
1746
+ [GroupRole.UNHOLY]: { name: 'Unholy' },
1747
+ [GroupRole.VAGRANT]: { name: 'Vagrant' },
1748
+ [GroupRole.VANGUARD]: { name: 'Vanguard' },
1749
+ [GroupRole.WALKER]: { name: 'Walker' },
1750
+ [GroupRole.WANDERER]: { name: 'Wanderer' },
1751
+ [GroupRole.WARDEN]: { name: 'Warden' },
1752
+ [GroupRole.WARLOCK]: { name: 'Warlock' },
1753
+ [GroupRole.WARRIOR]: { name: 'Warrior' },
1754
+ [GroupRole.WATER]: { name: 'Water' },
1755
+ [GroupRole.WILD]: { name: 'Wild' },
1756
+ [GroupRole.WILLOW]: { name: 'Willow' },
1757
+ [GroupRole.WILY]: { name: 'Wily' },
1758
+ [GroupRole.WINTUMBER]: { name: 'Wintumber' },
1759
+ [GroupRole.WITCH]: { name: 'Witch' },
1760
+ [GroupRole.WIZARD]: { name: 'Wizard' },
1761
+ [GroupRole.WORKER]: { name: 'Worker' },
1762
+ [GroupRole.WRATH]: { name: 'Wrath' },
1763
+ [GroupRole.XERICIAN]: { name: 'Xerician' },
1764
+ [GroupRole.YELLOW]: { name: 'Yellow' },
1765
+ [GroupRole.YEW]: { name: 'Yew' },
1766
+ [GroupRole.ZAMORAKIAN]: { name: 'Zamorakian' },
1767
+ [GroupRole.ZAROSIAN]: { name: 'Zarosian' },
1768
+ [GroupRole.ZEALOT]: { name: 'Zealot' },
1769
+ [GroupRole.ZENYTE]: { name: 'Zenyte' }
1770
+ }, (props, key) => (Object.assign(Object.assign({}, props), { isPriveleged: PRIVELEGED_GROUP_ROLES.includes(key) })));
1771
+ function findGroupRole(roleName) {
1772
+ for (const [key, value] of Object.entries(GroupRoleProps)) {
1773
+ if (value.name.toUpperCase() === roleName.toUpperCase()) {
1774
+ return key;
1775
+ }
1776
+ }
1777
+ return null;
1778
+ }
1779
+
1780
+ exports.MetricType = void 0;
1781
+ (function (MetricType) {
1782
+ MetricType["SKILL"] = "skill";
1783
+ MetricType["BOSS"] = "boss";
1784
+ MetricType["ACTIVITY"] = "activity";
1785
+ MetricType["VIRTUAL"] = "virtual";
1786
+ })(exports.MetricType || (exports.MetricType = {}));
1787
+ exports.MetricMeasure = void 0;
1788
+ (function (MetricMeasure) {
1789
+ MetricMeasure["EXPERIENCE"] = "experience";
1790
+ MetricMeasure["KILLS"] = "kills";
1791
+ MetricMeasure["SCORE"] = "score";
1792
+ MetricMeasure["VALUE"] = "value";
1793
+ })(exports.MetricMeasure || (exports.MetricMeasure = {}));
1794
+ const SkillProps = lodash.mapValues({
1795
+ [Skill.OVERALL]: { name: 'Overall', isCombat: false, isMembers: false },
1796
+ [Skill.ATTACK]: { name: 'Attack', isCombat: true, isMembers: false },
1797
+ [Skill.DEFENCE]: { name: 'Defence', isCombat: true, isMembers: false },
1798
+ [Skill.STRENGTH]: { name: 'Strength', isCombat: true, isMembers: false },
1799
+ [Skill.HITPOINTS]: { name: 'Hitpoints', isCombat: true, isMembers: false },
1800
+ [Skill.RANGED]: { name: 'Ranged', isCombat: true, isMembers: false },
1801
+ [Skill.PRAYER]: { name: 'Prayer', isCombat: true, isMembers: false },
1802
+ [Skill.MAGIC]: { name: 'Magic', isCombat: true, isMembers: false },
1803
+ [Skill.COOKING]: { name: 'Cooking', isCombat: false, isMembers: false },
1804
+ [Skill.WOODCUTTING]: { name: 'Woodcutting', isCombat: false, isMembers: false },
1805
+ [Skill.FLETCHING]: { name: 'Fletching', isCombat: false, isMembers: true },
1806
+ [Skill.FISHING]: { name: 'Fishing', isCombat: false, isMembers: false },
1807
+ [Skill.FIREMAKING]: { name: 'Firemaking', isCombat: false, isMembers: false },
1808
+ [Skill.CRAFTING]: { name: 'Crafting', isCombat: false, isMembers: false },
1809
+ [Skill.SMITHING]: { name: 'Smithing', isCombat: false, isMembers: false },
1810
+ [Skill.MINING]: { name: 'Mining', isCombat: false, isMembers: false },
1811
+ [Skill.HERBLORE]: { name: 'Herblore', isCombat: false, isMembers: true },
1812
+ [Skill.AGILITY]: { name: 'Agility', isCombat: false, isMembers: true },
1813
+ [Skill.THIEVING]: { name: 'Thieving', isCombat: false, isMembers: true },
1814
+ [Skill.SLAYER]: { name: 'Slayer', isCombat: false, isMembers: true },
1815
+ [Skill.FARMING]: { name: 'Farming', isCombat: false, isMembers: true },
1816
+ [Skill.RUNECRAFTING]: { name: 'Runecrafting', isCombat: false, isMembers: false },
1817
+ [Skill.HUNTER]: { name: 'Hunter', isCombat: false, isMembers: true },
1818
+ [Skill.CONSTRUCTION]: { name: 'Construction', isCombat: false, isMembers: false }
1819
+ }, props => (Object.assign(Object.assign({}, props), { type: exports.MetricType.SKILL, measure: exports.MetricMeasure.EXPERIENCE })));
1820
+ const BossProps = lodash.mapValues({
1821
+ [Boss.ABYSSAL_SIRE]: { name: 'Abyssal Sire', minimumKc: 50, isMembers: true },
1822
+ [Boss.ALCHEMICAL_HYDRA]: { name: 'Alchemical Hydra', minimumKc: 50, isMembers: true },
1823
+ [Boss.BARROWS_CHESTS]: { name: 'Barrows Chests', minimumKc: 50, isMembers: true },
1824
+ [Boss.BRYOPHYTA]: { name: 'Bryophyta', minimumKc: 5, isMembers: false },
1825
+ [Boss.CALLISTO]: { name: 'Callisto', minimumKc: 50, isMembers: true },
1826
+ [Boss.CERBERUS]: { name: 'Cerberus', minimumKc: 50, isMembers: true },
1827
+ [Boss.CHAMBERS_OF_XERIC]: { name: 'Chambers Of Xeric', minimumKc: 50, isMembers: true },
1828
+ [Boss.CHAMBERS_OF_XERIC_CM]: { name: 'Chambers Of Xeric (CM)', minimumKc: 5, isMembers: true },
1829
+ [Boss.CHAOS_ELEMENTAL]: { name: 'Chaos Elemental', minimumKc: 50, isMembers: true },
1830
+ [Boss.CHAOS_FANATIC]: { name: 'Chaos Fanatic', minimumKc: 50, isMembers: true },
1831
+ [Boss.COMMANDER_ZILYANA]: { name: 'Commander Zilyana', minimumKc: 50, isMembers: true },
1832
+ [Boss.CORPOREAL_BEAST]: { name: 'Corporeal Beast', minimumKc: 50, isMembers: true },
1833
+ [Boss.CRAZY_ARCHAEOLOGIST]: { name: 'Crazy Archaeologist', minimumKc: 50, isMembers: true },
1834
+ [Boss.DAGANNOTH_PRIME]: { name: 'Dagannoth Prime', minimumKc: 50, isMembers: true },
1835
+ [Boss.DAGANNOTH_REX]: { name: 'Dagannoth Rex', minimumKc: 50, isMembers: true },
1836
+ [Boss.DAGANNOTH_SUPREME]: { name: 'Dagannoth Supreme', minimumKc: 50, isMembers: true },
1837
+ [Boss.DERANGED_ARCHAEOLOGIST]: { name: 'Deranged Archaeologist', minimumKc: 50, isMembers: true },
1838
+ [Boss.GENERAL_GRAARDOR]: { name: 'General Graardor', minimumKc: 50, isMembers: true },
1839
+ [Boss.GIANT_MOLE]: { name: 'Giant Mole', minimumKc: 50, isMembers: true },
1840
+ [Boss.GROTESQUE_GUARDIANS]: { name: 'Grotesque Guardians', minimumKc: 50, isMembers: true },
1841
+ [Boss.HESPORI]: { name: 'Hespori', minimumKc: 5, isMembers: true },
1842
+ [Boss.KALPHITE_QUEEN]: { name: 'Kalphite Queen', minimumKc: 50, isMembers: true },
1843
+ [Boss.KING_BLACK_DRAGON]: { name: 'King Black Dragon', minimumKc: 50, isMembers: true },
1844
+ [Boss.KRAKEN]: { name: 'Kraken', minimumKc: 50, isMembers: true },
1845
+ [Boss.KREEARRA]: { name: "Kree'Arra", minimumKc: 50, isMembers: true },
1846
+ [Boss.KRIL_TSUTSAROTH]: { name: "K'ril Tsutsaroth", minimumKc: 50, isMembers: true },
1847
+ [Boss.MIMIC]: { name: 'Mimic', minimumKc: 1, isMembers: true },
1848
+ [Boss.NEX]: { name: 'Nex', minimumKc: 50, isMembers: true },
1849
+ [Boss.NIGHTMARE]: { name: 'Nightmare', minimumKc: 50, isMembers: true },
1850
+ [Boss.PHOSANIS_NIGHTMARE]: { name: "Phosani's Nightmare", minimumKc: 50, isMembers: true },
1851
+ [Boss.OBOR]: { name: 'Obor', minimumKc: 5, isMembers: false },
1852
+ [Boss.SARACHNIS]: { name: 'Sarachnis', minimumKc: 50, isMembers: true },
1853
+ [Boss.SKOTIZO]: { name: 'Skotizo', minimumKc: 5, isMembers: true },
1854
+ [Boss.SCORPIA]: { name: 'Scorpia', minimumKc: 50, isMembers: true },
1855
+ [Boss.TEMPOROSS]: { name: 'Tempoross', minimumKc: 50, isMembers: true },
1856
+ [Boss.THE_GAUNTLET]: { name: 'The Gauntlet', minimumKc: 50, isMembers: true },
1857
+ [Boss.THE_CORRUPTED_GAUNTLET]: { name: 'The Corrupted Gauntlet', minimumKc: 5, isMembers: true },
1858
+ [Boss.THEATRE_OF_BLOOD]: { name: 'Theatre Of Blood', minimumKc: 50, isMembers: true },
1859
+ [Boss.THEATRE_OF_BLOOD_HARD_MODE]: { name: 'Theatre Of Blood (HM)', minimumKc: 50, isMembers: true },
1860
+ [Boss.THERMONUCLEAR_SMOKE_DEVIL]: { name: 'Thermonuclear Smoke Devil', minimumKc: 50, isMembers: true },
1861
+ [Boss.TOMBS_OF_AMASCUT]: { name: 'Tombs of Amascut', minimumKc: 50, isMembers: true },
1862
+ [Boss.TOMBS_OF_AMASCUT_EXPERT]: {
1863
+ name: 'Tombs of Amascut (Expert Mode)',
1864
+ minimumKc: 50,
1865
+ isMembers: true
1866
+ },
1867
+ [Boss.TZKAL_ZUK]: { name: 'TzKal-Zuk', minimumKc: 1, isMembers: true },
1868
+ [Boss.TZTOK_JAD]: { name: 'TzTok-Jad', minimumKc: 5, isMembers: true },
1869
+ [Boss.VENENATIS]: { name: 'Venenatis', minimumKc: 50, isMembers: true },
1870
+ [Boss.VETION]: { name: "Vet'ion", minimumKc: 50, isMembers: true },
1871
+ [Boss.VORKATH]: { name: 'Vorkath', minimumKc: 50, isMembers: true },
1872
+ [Boss.WINTERTODT]: { name: 'Wintertodt', minimumKc: 50, isMembers: true },
1873
+ [Boss.ZALCANO]: { name: 'Zalcano', minimumKc: 50, isMembers: true },
1874
+ [Boss.ZULRAH]: { name: 'Zulrah', minimumKc: 50, isMembers: true }
1875
+ }, props => (Object.assign(Object.assign({}, props), { type: exports.MetricType.BOSS, measure: exports.MetricMeasure.KILLS })));
1876
+ const ActivityProps = lodash.mapValues({
1877
+ [Activity.LEAGUE_POINTS]: { name: 'League Points' },
1878
+ [Activity.BOUNTY_HUNTER_HUNTER]: { name: 'Bounty Hunter (Hunter)' },
1879
+ [Activity.BOUNTY_HUNTER_ROGUE]: { name: 'Bounty Hunter (Rogue)' },
1880
+ [Activity.CLUE_SCROLLS_ALL]: { name: 'Clue Scrolls (All)' },
1881
+ [Activity.CLUE_SCROLLS_BEGINNER]: { name: 'Clue Scrolls (Beginner)' },
1882
+ [Activity.CLUE_SCROLLS_EASY]: { name: 'Clue Scrolls (Easy)' },
1883
+ [Activity.CLUE_SCROLLS_MEDIUM]: { name: 'Clue Scrolls (Medium)' },
1884
+ [Activity.CLUE_SCROLLS_HARD]: { name: 'Clue Scrolls (Hard)' },
1885
+ [Activity.CLUE_SCROLLS_ELITE]: { name: 'Clue Scrolls (Elite)' },
1886
+ [Activity.CLUE_SCROLLS_MASTER]: { name: 'Clue Scrolls (Master)' },
1887
+ [Activity.LAST_MAN_STANDING]: { name: 'Last Man Standing' },
1888
+ [Activity.PVP_ARENA]: { name: 'PvP Arena' },
1889
+ [Activity.SOUL_WARS_ZEAL]: { name: 'Soul Wars Zeal' },
1890
+ [Activity.GUARDIANS_OF_THE_RIFT]: { name: 'Guardians of the Rift' }
1891
+ }, props => (Object.assign(Object.assign({}, props), { type: exports.MetricType.ACTIVITY, measure: exports.MetricMeasure.SCORE })));
1892
+ const VirtualProps = lodash.mapValues({
1893
+ [Virtual.EHP]: { name: 'EHP' },
1894
+ [Virtual.EHB]: { name: 'EHB' }
1895
+ }, props => (Object.assign(Object.assign({}, props), { type: exports.MetricType.VIRTUAL, measure: exports.MetricMeasure.VALUE })));
1896
+ const MetricProps = Object.assign(Object.assign(Object.assign(Object.assign({}, SkillProps), BossProps), ActivityProps), VirtualProps);
1897
+ const METRICS = Object.values(Metric);
1898
+ const SKILLS = Object.values(Skill);
1899
+ const BOSSES = Object.values(Boss);
1900
+ const ACTIVITIES = Object.values(Activity);
1901
+ const VIRTUALS = Object.values(Virtual);
1902
+ const REAL_SKILLS = SKILLS.filter(s => s !== Skill.OVERALL);
1903
+ const F2P_BOSSES = BOSSES.filter(b => !MetricProps[b].isMembers);
1904
+ const MEMBER_SKILLS = SKILLS.filter(s => MetricProps[s].isMembers);
1905
+ const COMBAT_SKILLS = SKILLS.filter(s => MetricProps[s].isCombat);
1906
+ function findMetric(metricName) {
1907
+ for (const [key, value] of Object.entries(MetricProps)) {
1908
+ if (value.name.toUpperCase() === metricName.toUpperCase())
1909
+ return key;
1910
+ }
1911
+ return null;
1912
+ }
1913
+ function isSkill(metric) {
1914
+ return metric in SkillProps;
1915
+ }
1916
+ function isActivity(metric) {
1917
+ return metric in ActivityProps;
1918
+ }
1919
+ function isBoss(metric) {
1920
+ return metric in BossProps;
1921
+ }
1922
+ function isVirtualMetric(metric) {
1923
+ return metric in VirtualProps;
1924
+ }
1925
+ function getMetricRankKey(metric) {
1926
+ return `${metric}Rank`;
1927
+ }
1928
+ function getMetricValueKey(metric) {
1929
+ return `${metric}${lodash.capitalize(MetricProps[metric].measure)}`;
1930
+ }
1931
+ function getMetricMeasure(metric) {
1932
+ return MetricProps[metric].measure;
1933
+ }
1934
+ function getMetricName(metric) {
1935
+ return MetricProps[metric].name;
1936
+ }
1937
+ function getMinimumBossKc(metric) {
1938
+ return isBoss(metric) ? MetricProps[metric].minimumKc : 0;
1939
+ }
1940
+ function getParentVirtualMetric(metric) {
1941
+ if (isBoss(metric))
1942
+ return Metric.EHB;
1943
+ if (isSkill(metric))
1944
+ return Metric.EHP;
1945
+ return null;
1946
+ }
1947
+ function parseMetricAbbreviation(abbreviation) {
1948
+ if (!abbreviation || abbreviation.length === 0) {
1949
+ return null;
1950
+ }
1951
+ switch (abbreviation.toLowerCase()) {
1952
+ // Bosses
1953
+ case 'sire':
1954
+ return Metric.ABYSSAL_SIRE;
1955
+ case 'hydra':
1956
+ return Metric.ALCHEMICAL_HYDRA;
1957
+ case 'barrows':
1958
+ return Metric.BARROWS_CHESTS;
1959
+ case 'bryo':
1960
+ return Metric.BRYOPHYTA;
1961
+ case 'cerb':
1962
+ return Metric.CERBERUS;
1963
+ case 'cox':
1964
+ case 'xeric':
1965
+ case 'chambers':
1966
+ case 'olm':
1967
+ case 'raids':
1968
+ return Metric.CHAMBERS_OF_XERIC;
1969
+ case 'cox-cm':
1970
+ case 'xeric-cm':
1971
+ case 'chambers-cm':
1972
+ case 'olm-cm':
1973
+ case 'raids-cm':
1974
+ return Metric.CHAMBERS_OF_XERIC_CM;
1975
+ case 'chaos-ele':
1976
+ return Metric.CHAOS_ELEMENTAL;
1977
+ case 'fanatic':
1978
+ return Metric.CHAOS_FANATIC;
1979
+ case 'sara':
1980
+ case 'saradomin':
1981
+ case 'zilyana':
1982
+ case 'zily':
1983
+ return Metric.COMMANDER_ZILYANA;
1984
+ case 'corp':
1985
+ return Metric.CORPOREAL_BEAST;
1986
+ case 'crazy-arch':
1987
+ return Metric.CRAZY_ARCHAEOLOGIST;
1988
+ case 'prime':
1989
+ return Metric.DAGANNOTH_PRIME;
1990
+ case 'rex':
1991
+ return Metric.DAGANNOTH_REX;
1992
+ case 'supreme':
1993
+ return Metric.DAGANNOTH_SUPREME;
1994
+ case 'deranged-arch':
1995
+ return Metric.DERANGED_ARCHAEOLOGIST;
1996
+ case 'bandos':
1997
+ case 'graardor':
1998
+ return Metric.GENERAL_GRAARDOR;
1999
+ case 'mole':
2000
+ return Metric.GIANT_MOLE;
2001
+ case 'dusk':
2002
+ case 'dawn':
2003
+ case 'gargs':
2004
+ case 'guardians':
2005
+ case 'ggs':
2006
+ return Metric.GROTESQUE_GUARDIANS;
2007
+ case 'kq':
2008
+ return Metric.KALPHITE_QUEEN;
2009
+ case 'kbd':
2010
+ return Metric.KING_BLACK_DRAGON;
2011
+ case 'kree':
2012
+ case 'kreearra':
2013
+ case 'armadyl':
2014
+ case 'arma':
2015
+ return Metric.KREEARRA;
2016
+ case 'zammy':
2017
+ case 'zamorak':
2018
+ case 'kril':
2019
+ case 'kril-tsutsaroth':
2020
+ return Metric.KRIL_TSUTSAROTH;
2021
+ case 'gaunt':
2022
+ case 'gauntlet':
2023
+ case 'the-gauntlet':
2024
+ return Metric.THE_GAUNTLET;
2025
+ case 'cgaunt':
2026
+ case 'cgauntlet':
2027
+ case 'corrupted':
2028
+ case 'corrupted-gauntlet':
2029
+ case 'the-corrupted-gauntlet':
2030
+ return Metric.THE_CORRUPTED_GAUNTLET;
2031
+ case 'tob':
2032
+ case 'theatre':
2033
+ case 'verzik':
2034
+ case 'tob-normal':
2035
+ return Metric.THEATRE_OF_BLOOD;
2036
+ case 'tob-hm':
2037
+ case 'tob-cm':
2038
+ case 'tob-hard-mode':
2039
+ case 'tob-hard':
2040
+ return Metric.THEATRE_OF_BLOOD_HARD_MODE;
2041
+ case 'toa':
2042
+ case 'tombs':
2043
+ case 'amascut':
2044
+ return Metric.TOMBS_OF_AMASCUT;
2045
+ case 'toa-expert':
2046
+ case 'toa-hm':
2047
+ case 'tombs-expert':
2048
+ case 'tombs-hm':
2049
+ case 'amascut-expert':
2050
+ case 'amascut-hm':
2051
+ return Metric.TOMBS_OF_AMASCUT_EXPERT;
2052
+ case 'nm':
2053
+ case 'tnm':
2054
+ case 'nmare':
2055
+ case 'the-nightmare':
2056
+ return Metric.NIGHTMARE;
2057
+ case 'pnm':
2058
+ case 'phosani':
2059
+ case 'phosanis':
2060
+ case 'phosani-nm':
2061
+ case 'phosani-nightmare':
2062
+ case 'phosanis nightmare':
2063
+ return Metric.PHOSANIS_NIGHTMARE;
2064
+ case 'thermy':
2065
+ case 'smoke-devil':
2066
+ return Metric.THERMONUCLEAR_SMOKE_DEVIL;
2067
+ case 'zuk':
2068
+ case 'inferno':
2069
+ return Metric.TZKAL_ZUK;
2070
+ case 'jad':
2071
+ case 'fight-caves':
2072
+ case 'fc':
2073
+ return Metric.TZTOK_JAD;
2074
+ case 'vork':
2075
+ case 'vorky':
2076
+ return Metric.VORKATH;
2077
+ case 'wt':
2078
+ return Metric.WINTERTODT;
2079
+ case 'snek':
2080
+ case 'zul':
2081
+ return Metric.ZULRAH;
2082
+ // Minigames and others
2083
+ case 'all-clues':
2084
+ case 'clues':
2085
+ return Metric.CLUE_SCROLLS_ALL;
2086
+ case 'beginner':
2087
+ case 'beginner-clues':
2088
+ case 'beg-clues':
2089
+ case 'beginners':
2090
+ return Metric.CLUE_SCROLLS_BEGINNER;
2091
+ case 'easy':
2092
+ case 'easy-clues':
2093
+ case 'easies':
2094
+ return Metric.CLUE_SCROLLS_EASY;
2095
+ case 'medium':
2096
+ case 'med':
2097
+ case 'meds':
2098
+ case 'medium-clues':
2099
+ case 'med-clues':
2100
+ case 'mediums':
2101
+ return Metric.CLUE_SCROLLS_MEDIUM;
2102
+ case 'hard':
2103
+ case 'hard-clues':
2104
+ case 'hards':
2105
+ return Metric.CLUE_SCROLLS_HARD;
2106
+ case 'elite':
2107
+ case 'elite-clues':
2108
+ case 'elites':
2109
+ return Metric.CLUE_SCROLLS_ELITE;
2110
+ case 'master':
2111
+ case 'master-clues':
2112
+ case 'masters':
2113
+ return Metric.CLUE_SCROLLS_MASTER;
2114
+ case 'lms':
2115
+ return Metric.LAST_MAN_STANDING;
2116
+ case 'league':
2117
+ case 'lp':
2118
+ case 'lps':
2119
+ return Metric.LEAGUE_POINTS;
2120
+ case 'sw':
2121
+ case 'zeal':
2122
+ case 'soul-wars':
2123
+ return Metric.SOUL_WARS_ZEAL;
2124
+ // Skills
2125
+ case 'runecraft':
2126
+ case 'rc':
2127
+ return Metric.RUNECRAFTING;
2128
+ case 'att':
2129
+ case 'atk':
2130
+ case 'attk':
2131
+ return Metric.ATTACK;
2132
+ case 'def':
2133
+ case 'defense':
2134
+ return Metric.DEFENCE;
2135
+ case 'str':
2136
+ return Metric.STRENGTH;
2137
+ case 'hp':
2138
+ return Metric.HITPOINTS;
2139
+ case 'range':
2140
+ return Metric.RANGED;
2141
+ case 'pray':
2142
+ return Metric.PRAYER;
2143
+ case 'mage':
2144
+ return Metric.MAGIC;
2145
+ case 'cook':
2146
+ return Metric.COOKING;
2147
+ case 'wc':
2148
+ return Metric.WOODCUTTING;
2149
+ case 'fletch':
2150
+ return Metric.FLETCHING;
2151
+ case 'fish':
2152
+ return Metric.FISHING;
2153
+ case 'fm':
2154
+ case 'burning':
2155
+ return Metric.FIREMAKING;
2156
+ case 'craft':
2157
+ return Metric.CRAFTING;
2158
+ case 'sm':
2159
+ case 'smith':
2160
+ return Metric.SMITHING;
2161
+ case 'mine':
2162
+ case 'smash':
2163
+ return Metric.MINING;
2164
+ case 'herb':
2165
+ return Metric.HERBLORE;
2166
+ case 'agi':
2167
+ case 'agil':
2168
+ return Metric.AGILITY;
2169
+ case 'thief':
2170
+ return Metric.THIEVING;
2171
+ case 'slay':
2172
+ return Metric.SLAYER;
2173
+ case 'farm':
2174
+ return Metric.FARMING;
2175
+ case 'hunt':
2176
+ case 'hunting':
2177
+ return Metric.HUNTER;
2178
+ case 'con':
2179
+ case 'cons':
2180
+ case 'const':
2181
+ return Metric.CONSTRUCTION;
2182
+ default:
2183
+ return abbreviation;
2184
+ }
2185
+ }
2186
+
2187
+ const CUSTOM_PERIOD_REGEX = /(\d+y)?(\d+m)?(\d+w)?(\d+d)?(\d+h)?/;
2188
+ const PeriodProps = {
2189
+ [Period.FIVE_MIN]: { name: '5 Min', milliseconds: 300000 },
2190
+ [Period.DAY]: { name: 'Day', milliseconds: 86400000 },
2191
+ [Period.WEEK]: { name: 'Week', milliseconds: 604800000 },
2192
+ [Period.MONTH]: { name: 'Month', milliseconds: 2678400000 },
2193
+ [Period.YEAR]: { name: 'Year', milliseconds: 31556926000 }
2194
+ };
2195
+ const PERIODS = Object.values(Period);
2196
+ function findPeriod(periodName) {
2197
+ for (const [key, value] of Object.entries(PeriodProps)) {
2198
+ if (value.name.toUpperCase() === periodName.toUpperCase())
2199
+ return key;
2200
+ }
2201
+ return null;
2202
+ }
2203
+ function parsePeriodExpression(periodExpression) {
2204
+ const fixed = periodExpression.toLowerCase();
2205
+ if (PERIODS.includes(fixed)) {
2206
+ return {
2207
+ expression: fixed,
2208
+ durationMs: PeriodProps[fixed].milliseconds
2209
+ };
2210
+ }
2211
+ const result = fixed.match(CUSTOM_PERIOD_REGEX);
2212
+ if (!result || result.length === 0 || result[0] !== fixed)
2213
+ return null;
2214
+ const years = result[1] ? parseInt(result[1].replace(/\D/g, '')) : 0;
2215
+ const months = result[2] ? parseInt(result[2].replace(/\D/g, '')) : 0;
2216
+ const weeks = result[3] ? parseInt(result[3].replace(/\D/g, '')) : 0;
2217
+ const days = result[4] ? parseInt(result[4].replace(/\D/g, '')) : 0;
2218
+ const hours = result[5] ? parseInt(result[5].replace(/\D/g, '')) : 0;
2219
+ const yearsMs = years * PeriodProps[Period.YEAR].milliseconds;
2220
+ const monthsMs = months * PeriodProps[Period.MONTH].milliseconds;
2221
+ const weeksMs = weeks * PeriodProps[Period.WEEK].milliseconds;
2222
+ const daysMs = days * PeriodProps[Period.DAY].milliseconds;
2223
+ const hoursMs = hours * (PeriodProps[Period.DAY].milliseconds / 24);
2224
+ const totalMs = yearsMs + monthsMs + weeksMs + daysMs + hoursMs;
2225
+ return {
2226
+ expression: result[0],
2227
+ durationMs: totalMs
2228
+ };
2229
+ }
2230
+
2231
+ const PlayerTypeProps = {
2232
+ [PlayerType.UNKNOWN]: { name: 'Unknown' },
2233
+ [PlayerType.REGULAR]: { name: 'Regular' },
2234
+ [PlayerType.IRONMAN]: { name: 'Ironman' },
2235
+ [PlayerType.HARDCORE]: { name: 'Hardcore' },
2236
+ [PlayerType.ULTIMATE]: { name: 'Ultimate' }
2237
+ };
2238
+ const PlayerBuildProps = {
2239
+ [PlayerBuild.MAIN]: { name: 'Main' },
2240
+ [PlayerBuild.F2P]: { name: 'F2P' },
2241
+ [PlayerBuild.LVL3]: { name: 'Level 3' },
2242
+ [PlayerBuild.ZERKER]: { name: 'Zerker Pure' },
2243
+ [PlayerBuild.DEF1]: { name: '1 Defence Pure' },
2244
+ [PlayerBuild.HP10]: { name: '10 Hitpoints Pure' }
2245
+ };
2246
+ const PLAYER_TYPES = Object.values(PlayerType);
2247
+ const PLAYER_BUILDS = Object.values(PlayerBuild);
2248
+ function findPlayerType(typeName) {
2249
+ for (const [key, value] of Object.entries(PlayerTypeProps)) {
2250
+ if (value.name.toUpperCase() === typeName.toUpperCase())
2251
+ return key;
2252
+ }
2253
+ return null;
2254
+ }
2255
+ function findPlayerBuild(buildName) {
2256
+ for (const [key, value] of Object.entries(PlayerBuildProps)) {
2257
+ if (value.name.toUpperCase() === buildName.toUpperCase())
2258
+ return key;
2259
+ }
2260
+ return null;
2261
+ }
2262
+
2263
+ function formatNumber(num, withLetters = false) {
2264
+ if (num === undefined || num === null)
2265
+ return -1;
2266
+ // If number is float
2267
+ if (num % 1 !== 0) {
2268
+ return (Math.round(num * 100) / 100).toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,');
2269
+ }
2270
+ if ((num < 10000 && num > -10000) || !withLetters) {
2271
+ return num.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,');
2272
+ }
2273
+ // < 10 million
2274
+ if (num < 10000000 && num > -10000000) {
2275
+ return `${Math.floor(num / 1000)}k`;
2276
+ }
2277
+ // < 1 billion
2278
+ if (num < 1000000000 && num > -1000000000) {
2279
+ return `${Math.round((num / 1000000 + Number.EPSILON) * 100) / 100}m`;
2280
+ }
2281
+ return `${Math.round((num / 1000000000 + Number.EPSILON) * 100) / 100}b`;
2282
+ }
2283
+ function padNumber(value) {
2284
+ if (!value)
2285
+ return '00';
2286
+ return value < 10 ? `0${value}` : value.toString();
2287
+ }
2288
+ function round(num, cases) {
2289
+ return Math.round(num * Math.pow(10, cases)) / Math.pow(10, cases);
2290
+ }
2291
+
2292
+ exports.BonusType = void 0;
2293
+ (function (BonusType) {
2294
+ BonusType[BonusType["START"] = 0] = "START";
2295
+ BonusType[BonusType["END"] = 1] = "END";
2296
+ })(exports.BonusType || (exports.BonusType = {}));
2297
+ exports.EfficiencyAlgorithmType = void 0;
2298
+ (function (EfficiencyAlgorithmType) {
2299
+ EfficiencyAlgorithmType["MAIN"] = "main";
2300
+ EfficiencyAlgorithmType["IRONMAN"] = "ironman";
2301
+ EfficiencyAlgorithmType["LVL3"] = "lvl3";
2302
+ EfficiencyAlgorithmType["F2P"] = "f2p";
2303
+ })(exports.EfficiencyAlgorithmType || (exports.EfficiencyAlgorithmType = {}));
2304
+
2305
+ exports.MigrationDataSource = void 0;
2306
+ (function (MigrationDataSource) {
2307
+ MigrationDataSource[MigrationDataSource["TEMPLE_OSRS"] = 0] = "TEMPLE_OSRS";
2308
+ MigrationDataSource[MigrationDataSource["CRYSTAL_MATH_LABS"] = 1] = "CRYSTAL_MATH_LABS";
2309
+ })(exports.MigrationDataSource || (exports.MigrationDataSource = {}));
2310
+
2311
+ exports.SnapshotDataSource = void 0;
2312
+ (function (SnapshotDataSource) {
2313
+ SnapshotDataSource[SnapshotDataSource["HISCORES"] = 0] = "HISCORES";
2314
+ SnapshotDataSource[SnapshotDataSource["CRYSTAL_MATH_LABS"] = 1] = "CRYSTAL_MATH_LABS";
2315
+ })(exports.SnapshotDataSource || (exports.SnapshotDataSource = {}));
2316
+
2317
+ class EfficiencyClient {
2318
+ /**
2319
+ * Fetches the current efficiency leaderboard for a specific virtual metric, playerType, playerBuild and country.
2320
+ * @returns A list of players.
2321
+ */
2322
+ getEfficiencyLeaderboards(filter, pagination) {
2323
+ return sendGetRequest('/efficiency/leaderboard', Object.assign(Object.assign({}, filter), pagination));
2324
+ }
2325
+ /**
2326
+ * Fetches the top EHP (Efficient Hours Played) rates.
2327
+ * @returns A list of skilling methods and their bonus exp ratios.
2328
+ */
2329
+ getEHPRates(algorithmType) {
2330
+ return sendGetRequest('/efficiency/rates', { metric: Metric.EHP, type: algorithmType });
2331
+ }
2332
+ /**
2333
+ * Fetches the top EHB (Efficient Hours Bossed) rates.
2334
+ * @returns A list of bosses and their respective "per-hour" kill rates.
2335
+ */
2336
+ getEHBRates(algorithmType) {
2337
+ return sendGetRequest('/efficiency/rates', { metric: Metric.EHB, type: algorithmType });
2338
+ }
2339
+ }
2340
+
2341
+ class NameChangesClient {
2342
+ /**
2343
+ * Searches for name changes that match a name and/or status filter.
2344
+ * @returns A list of name changes.
2345
+ */
2346
+ searchNameChanges(filter, pagination) {
2347
+ return sendGetRequest('/names', Object.assign(Object.assign({}, filter), pagination));
2348
+ }
2349
+ /**
2350
+ * Submits a name change request between two usernames (old and new).
2351
+ * @returns A pending name change request, to be reviewed and resolved at a later date.
2352
+ */
2353
+ submitNameChange(oldName, newName) {
2354
+ return sendPostRequest('/names', { oldName, newName });
2355
+ }
2356
+ /**
2357
+ * Gets details on a specific name change request.
2358
+ * @returns The name change request's details, which includes all data required to review.
2359
+ */
2360
+ getNameChangeDetails(id) {
2361
+ return sendGetRequest(`/names/${id}`);
2362
+ }
2363
+ }
2364
+
2365
+ class CompetitionsClient {
2366
+ /**
2367
+ * Searches for competitions that match a title, type, metric and status filter.
2368
+ * @returns A list of competitions.
2369
+ */
2370
+ searchCompetitions(filter, pagination) {
2371
+ return sendGetRequest('/competitions', Object.assign(Object.assign({}, filter), pagination));
2372
+ }
2373
+ /**
2374
+ * Fetches the competition's full details, including all the participants and their progress.
2375
+ * @returns A competition with a list of participants.
2376
+ */
2377
+ getCompetitionDetails(id, previewMetric) {
2378
+ return sendGetRequest(`/competitions/${id}`, { metric: previewMetric });
2379
+ }
2380
+ /**
2381
+ * Fetches all the values (exp, kc, etc) in chronological order within the bounds
2382
+ * of the competition, for the top 5 participants.
2383
+ * @returns A list of competition progress objects, including the player and their value history over time.
2384
+ */
2385
+ getCompetitionTopHistory(id, previewMetric) {
2386
+ return sendGetRequest(`/competitions/${id}/top-history`, {
2387
+ metric: previewMetric
2388
+ });
2389
+ }
2390
+ /**
2391
+ * Creates a new competition.
2392
+ * @returns The newly created competition, and the verification code that authorizes future changes to it.
2393
+ */
2394
+ createCompetition(payload) {
2395
+ return sendPostRequest('/competitions', payload);
2396
+ }
2397
+ /**
2398
+ * Edits an existing competition.
2399
+ * @returns The updated competition.
2400
+ */
2401
+ editCompetition(id, payload, verificationCode) {
2402
+ return sendPutRequest(`/competitions/${id}`, Object.assign(Object.assign({}, payload), { verificationCode }));
2403
+ }
2404
+ /**
2405
+ * Deletes an existing competition.
2406
+ * @returns A confirmation message.
2407
+ */
2408
+ deleteCompetition(id, verificationCode) {
2409
+ return sendDeleteRequest(`/competitions/${id}`, { verificationCode });
2410
+ }
2411
+ /**
2412
+ * Adds all (valid) given participants to a competition, ignoring duplicates.
2413
+ * @returns The number of participants added and a confirmation message.
2414
+ */
2415
+ addParticipants(id, participants, verificationCode) {
2416
+ return sendPostRequest(`/competitions/${id}/participants`, {
2417
+ verificationCode,
2418
+ participants
2419
+ });
2420
+ }
2421
+ /**
2422
+ * Remove all given usernames from a competition, ignoring usernames that aren't competing.
2423
+ * @returns The number of participants removed and a confirmation message.
2424
+ */
2425
+ removeParticipants(id, participants, verificationCode) {
2426
+ return sendDeleteRequest(`/competitions/${id}/participants`, {
2427
+ verificationCode,
2428
+ participants
2429
+ });
2430
+ }
2431
+ /**
2432
+ * Adds all (valid) given teams to a team competition, ignoring duplicates.
2433
+ * @returns The number of participants added and a confirmation message.
2434
+ */
2435
+ addTeams(id, teams, verificationCode) {
2436
+ return sendPostRequest(`/competitions/${id}/teams`, {
2437
+ verificationCode,
2438
+ teams
2439
+ });
2440
+ }
2441
+ /**
2442
+ * Remove all given team names from a competition, ignoring names that don't exist.
2443
+ * @returns The number of participants removed and a confirmation message.
2444
+ */
2445
+ removeTeams(id, teamNames, verificationCode) {
2446
+ return sendDeleteRequest(`/competitions/${id}/teams`, {
2447
+ verificationCode,
2448
+ teamNames
2449
+ });
2450
+ }
2451
+ /**
2452
+ * Adds an "update" request to the queue, for each outdated competition participant.
2453
+ * @returns The number of players to be updated and a confirmation message.
2454
+ */
2455
+ updateAll(id, verificationCode) {
2456
+ return sendPostRequest(`/competitions/${id}/update-all`, {
2457
+ verificationCode
2458
+ });
2459
+ }
2460
+ }
2461
+
2462
+ class WOMClient {
2463
+ constructor() {
2464
+ this.deltas = new DeltasClient();
2465
+ this.groups = new GroupsClient();
2466
+ this.players = new PlayersClient();
2467
+ this.records = new RecordsClient();
2468
+ this.efficiency = new EfficiencyClient();
2469
+ this.nameChanges = new NameChangesClient();
2470
+ this.competitions = new CompetitionsClient();
2471
+ }
2472
+ }
2473
+
2474
+ exports.ACTIVITIES = ACTIVITIES;
2475
+ exports.Activity = Activity;
2476
+ exports.BOSSES = BOSSES;
2477
+ exports.Boss = Boss;
2478
+ exports.CAPPED_MAX_TOTAL_XP = CAPPED_MAX_TOTAL_XP;
2479
+ exports.COMBAT_SKILLS = COMBAT_SKILLS;
2480
+ exports.COMPETITION_STATUSES = COMPETITION_STATUSES;
2481
+ exports.COMPETITION_TYPES = COMPETITION_TYPES;
2482
+ exports.COUNTRY_CODES = COUNTRY_CODES;
2483
+ exports.CompetitionStatusProps = CompetitionStatusProps;
2484
+ exports.CompetitionType = CompetitionType;
2485
+ exports.CompetitionTypeProps = CompetitionTypeProps;
2486
+ exports.Country = Country;
2487
+ exports.CountryProps = CountryProps;
2488
+ exports.F2P_BOSSES = F2P_BOSSES;
2489
+ exports.GROUP_ROLES = GROUP_ROLES;
2490
+ exports.GroupRole = GroupRole;
2491
+ exports.GroupRoleProps = GroupRoleProps;
2492
+ exports.MAX_LEVEL = MAX_LEVEL;
2493
+ exports.MAX_SKILL_EXP = MAX_SKILL_EXP;
2494
+ exports.MAX_VIRTUAL_LEVEL = MAX_VIRTUAL_LEVEL;
2495
+ exports.MEMBER_SKILLS = MEMBER_SKILLS;
2496
+ exports.METRICS = METRICS;
2497
+ exports.Metric = Metric;
2498
+ exports.MetricProps = MetricProps;
2499
+ exports.NameChangeStatus = NameChangeStatus;
2500
+ exports.PERIODS = PERIODS;
2501
+ exports.PLAYER_BUILDS = PLAYER_BUILDS;
2502
+ exports.PLAYER_TYPES = PLAYER_TYPES;
2503
+ exports.PRIVELEGED_GROUP_ROLES = PRIVELEGED_GROUP_ROLES;
2504
+ exports.Period = Period;
2505
+ exports.PeriodProps = PeriodProps;
2506
+ exports.PlayerBuild = PlayerBuild;
2507
+ exports.PlayerBuildProps = PlayerBuildProps;
2508
+ exports.PlayerType = PlayerType;
2509
+ exports.PlayerTypeProps = PlayerTypeProps;
2510
+ exports.REAL_SKILLS = REAL_SKILLS;
2511
+ exports.SKILLS = SKILLS;
2512
+ exports.SKILL_EXP_AT_99 = SKILL_EXP_AT_99;
2513
+ exports.Skill = Skill;
2514
+ exports.VIRTUALS = VIRTUALS;
2515
+ exports.Virtual = Virtual;
2516
+ exports.WOMClient = WOMClient;
2517
+ exports.findCompetitionStatus = findCompetitionStatus;
2518
+ exports.findCompetitionType = findCompetitionType;
2519
+ exports.findCountry = findCountry;
2520
+ exports.findCountryByCode = findCountryByCode;
2521
+ exports.findCountryByName = findCountryByName;
2522
+ exports.findGroupRole = findGroupRole;
2523
+ exports.findMetric = findMetric;
2524
+ exports.findPeriod = findPeriod;
2525
+ exports.findPlayerBuild = findPlayerBuild;
2526
+ exports.findPlayerType = findPlayerType;
2527
+ exports.formatNumber = formatNumber;
2528
+ exports.getCombatLevel = getCombatLevel;
2529
+ exports.getExpForLevel = getExpForLevel;
2530
+ exports.getLevel = getLevel;
2531
+ exports.getMetricMeasure = getMetricMeasure;
2532
+ exports.getMetricName = getMetricName;
2533
+ exports.getMetricRankKey = getMetricRankKey;
2534
+ exports.getMetricValueKey = getMetricValueKey;
2535
+ exports.getMinimumBossKc = getMinimumBossKc;
2536
+ exports.getParentVirtualMetric = getParentVirtualMetric;
2537
+ exports.isActivity = isActivity;
2538
+ exports.isBoss = isBoss;
2539
+ exports.isSkill = isSkill;
2540
+ exports.isVirtualMetric = isVirtualMetric;
2541
+ exports.padNumber = padNumber;
2542
+ exports.parseMetricAbbreviation = parseMetricAbbreviation;
2543
+ exports.parsePeriodExpression = parsePeriodExpression;
2544
+ exports.round = round;