pokenode-ts 2.0.0 → 2.2.0

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/README.md CHANGED
@@ -8,7 +8,6 @@
8
8
 
9
9
  [![npm version](https://img.shields.io/npm/v/pokenode-ts?logo=npm)](https://www.npmjs.com/package/pokenode-ts)
10
10
  [![CI](https://github.com/Gabb-c/pokenode-ts/actions/workflows/ci.yml/badge.svg)](https://github.com/Gabb-c/pokenode-ts/actions/workflows/ci.yml)
11
- [![codecov](https://codecov.io/gh/Gabb-c/pokenode-ts/branch/main/graph/badge.svg?token=whfY8GNSpS)](https://codecov.io/gh/Gabb-c/pokenode-ts)
12
11
  [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=Gabb-c_pokenode-ts&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=Gabb-c_pokenode-ts)
13
12
  [![install size](https://packagephobia.com/badge?p=pokenode-ts)](https://packagephobia.com/result?p=pokenode-ts)
14
13
 
package/lib/index.cjs CHANGED
@@ -1,2 +1,17 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};const n={REST:`https://pokeapi.co/api/v2`},r={CHERI:1,CHESTO:2,PECHA:3,RAWST:4,ASPEAR:5,LEPPA:6,ORAN:7,PERSIM:8,LUM:9,SITRUS:10,FIGY:11,WIKI:12,MAGO:13,AGUAV:14,IAPAPA:15,RAZZ:16,BLUK:17,NANAB:18,WEPEAR:19,PINAP:20,POMEG:21,KELPSY:22,QUALOT:23,HONDEW:24,GREPA:25,TAMATO:26,CORNN:27,MAGOST:28,RABUTA:29,NOMEL:30,SPELON:31,PAMTRE:32,WATMEL:33,DURIN:34,BELUE:35,OCCA:36,PASSHO:37,WACAN:38,RINDO:39,YACHE:40,CHOPLE:41,KEBIA:42,SHUCA:43,COBA:44,PAYAPA:45,TANGA:46,CHARTI:47,KASIB:48,HABAN:49,COLBUR:50,BABIRI:51,CHILAN:52,LIECHI:53,GANLON:54,SALAC:55,PETAYA:56,APICOT:57,LANSAT:58,STARF:59,ENIGMA:60,MICLE:61,CUSTAP:62,JABOCA:63,ROWAP:64},i={VERY_SOFT:1,SOFT:2,HARD:3,VERY_HARD:4,SUPER_HARD:5},a={SPICY:1,DRY:2,SWEET:3,BITTER:4,SOUR:5},o={COOL:1,BEAUTY:2,CUTE:3,SMART:4,TOUGH:5},s={POKE_DOLLAR:1,COIN:2,VOLCANIC_ASH:3,POKE_COUPON:4,BERRY_POWDER:5,BATTLE_POINT:6,SPHERE:7,CASTLE_POINT:8,WATT:9,ATHLETE_POINT:10,DREAM_POINT:11,DREAM_WORLD_BERRY:12,POKE_MILE:13,FESTIVAL_COIN:14,POKE_BEAN:15,HOME_POINT:16,MERIT_POINT:17,LEAGUE_POINT:18,BLUEBERRY_POINT:19},c={WALK:1,OLD_ROD:2,GOOD_ROD:3,SUPER_ROD:4,SURF:5,ROCK_SMASH:6,HEADBUTT:7,DARK_GRASS:8,GRASS_SPOTS:9,CAVE_SPOTS:10,BRIDGE_SPOTS:11,SUPER_ROD_SPOTS:12,SURF_SPOTS:13,YELLOW_FLOWERS:14,PURPLE_FLOWERS:15,RED_FLOWERS:16,ROUGH_TERRAIN:17,GIFT:18,GIFT_EGG:19,ONLY_ONE:20,POKEFLUTE:21,HEADBUTT_LOW:22,HEADBUTT_NORMAL:23,HEADBUT_HIGH:24,SQUIRT_BOTTLE:25,WAILMER_PAIL:26,SEAWEED:27},l={SWARM:1,TIME:2,RADAR:3,SLOT2:4,RADIO:5,SEASON:6,STARTER:7,TV_OPTION:8,STORY_PROGRESS:9,OTHER:10},u={SWARM_YES:1,SWARM_NO:2,TIME_MORNING:3,TIME_DAY:4,TIME_NIGHT:5,RADAR_ON:6,RADAR_OFF:7,SLOT2_NONE:8,SLOT2_RUBY:9,SLOT2_SAPHIRE:10,SLOT2_EMERALD:11,SLOT2_FIRERED:12,SLOT2_LEAFGREEN:13,RADIO_OFF:14,RADIO_HOEN:15,RADIO_SINNOH:16,SEASON_SPRING:17,SEASON_SUMMER:18,SWASON_AUTUMN:19,SEASON_WINTER:20,STARTER_BULBASAUR:21,STARTER_SQUIRTLE:22,STARTER_CHARMANDER:23,STARTER_CHESPIN:24,STARTER_FENNEKIN:25,STARTER_FROAKIE:26,TV_OPTION_BLUE:27,TV_OPTION_RED:28,STORY_PROGRESS_AWAKENED_BEASTS:29,STORY_PROGRESS_BEAT_GALACTIC_CORONET:30,STORY_PROGRESS_OAK_ETERNA_CITY:31,STORY_PROGRESS_OAK_VERMILION_COPYCAT:32,STORY_PROGRESS_MET_TORNADUS_THUNDURUS:33,STORY_PROGRESS_BEAT_ELITE_FOUR_ROUND_TWO:34,STORY_PROGRESS_HALL_OF_FAME:35,STORY_PROGRESS_NONE:36,STORY_PROGRESS_NATIONAL_DEX:37,OTHER_NONE:38,OTHER_SNORLAX_LL_BEAT_LEAGUE:39},d={BERRY:`/berry`,BERRY_FIRMNESS:`/berry-firmness`,BERRY_FLAVOR:`/berry-flavor`,CONTEST_TYPE:`/contest-type`,CONTEST_EFFECT:`/contest-effect`,SUPER_CONTEST_EFFECT:`/super-contest-effect`,CURRENCY:`/currency`,ENCOUNTER_METHOD:`/encounter-method`,ENCOUNTER_CONDITION:`/encounter-condition`,ENCOUNTER_CONDITION_VALUE:`/encounter-condition-value`,EVOLUTION_CHAIN:`/evolution-chain`,EVOLUTION_TRIGGER:`/evolution-trigger`,GENERATION:`/generation`,POKEDEX:`/pokedex`,VERSION:`/version`,VERSION_GROUP:`/version-group`,ITEM:`/item`,ITEM_ATTRIBUTE:`/item-attribute`,ITEM_CATEGORY:`/item-category`,ITEM_FLING_EFFECT:`/item-fling-effect`,ITEM_POCKET:`/item-pocket`,LOCATION:`/location`,LOCATION_AREA:`/location-area`,PALPARK_AREA:`/pal-park-area`,REGION:`/region`,MACHINE:`/machine`,MOVE:`/move`,MOVE_AILMENT:`/move-ailment`,MOVE_BATTLE_STYLE:`/move-battle-style`,MOVE_CATEGORY:`/move-category`,MOVE_DAMAGE_CLASS:`/move-damage-class`,MOVE_LEARN_METHOD:`/move-learn-method`,MOVE_TARGET:`/move-target`,ABILITY:`/ability`,CHARACTERISTIC:`/characteristic`,EGG_GROUP:`/egg-group`,GENDER:`/gender`,GROWTH_RATE:`/growth-rate`,NATURE:`/nature`,POKEATHLON_STAT:`/pokeathlon-stat`,POKEMON:`/pokemon`,POKEMON_COLOR:`/pokemon-color`,POKEMON_FORM:`/pokemon-form`,POKEMON_HABITAT:`/pokemon-habitat`,POKEMON_SHAPE:`/pokemon-shape`,POKEMON_SPECIES:`/pokemon-species`,STAT:`/stat`,TYPE:`/type`,LANGUAGE:`/language`},f={LEVEL_UP:1,TRADE:2,USE_ITEM:3,SHED:4,SPIN:5,TOWER_OF_DARKNESS:6,TOWER_OF_WATER:7,THREE_CRITICAL_HITS:8,TAKE_DAMAGE:9,OTHER:10},p={GENERATION_I:1,GENERATION_II:2,GENERATION_III:3,GENERATION_IV:4,GENERATION_V:5,GENERATION_VI:6,GENERATION_VII:7,GENERATION_VIII:8},m={NATIONAL:1,KANTO:2,ORIGINAL_JOHTO:3,HOENN:4,ORIGINAL_SINNOH:5,EXTENDED_SINNOH:6,UPDATED_JOHTO:7,ORIGINAL_UNOVA:8,UPDATED_UNOVA:9,CONQUEST_GALLERY:11,KALOS_CENTRAL:12,KALOS_COASTAL:13,KALOS_MONTAIN:14,UPDATED_HOENN:15,ORIGINAL_ALOLA:16,ORIGINAL_MELEMELE:17,ORIGINAL_AKALA:18,ORIGINAL_ULAULA:19,ORIGINAL_PONI:20,UPDATED_ALOLA:21,UPDATED_MELEMELE:22,UPDATED_AKALA:23,UPDATED_ULAULA:24,UPDATED_PONI:25,UPDATED_KANTO:26,GALAR:27,ISLE_OF_ARMOR:28,CROWN_TUNDRA:29},h={RED:1,BLUE:2,YELLOW:3,GOLD:4,SILVER:5,CRYSTAL:6,RUBY:7,SAPPHIRE:8,EMERALD:9,FIRERED:10,LEAFGREEN:11,DIAMOND:12,PEARL:13,PLATINUM:14,HEARTGOLD:15,SOULSILVER:16,BLACK:17,WHITE:18,COLOSSEUM:19,XD:20,BLACK_2:21,WHITE_2:22,X:23,Y:24,OMEGA_RUBY:25,ALPHA_SAPPHIRE:26,SUN:27,MOON:28,ULTRA_SUN:29,ULTRA_MOON:30,LETS_GO_PIKACHU:31,LETS_GO_EEVEE:32,SWORD:33,SHIELD:34,THE_ISLE_OF_ARMOR:35,THE_CROWN_TUNDRA:36,BRILLIANT_DIAMOND:37,SHINING_PEARL:38,LEGENDS_ARCEUS:39},g={RED_BLUE:1,YELLOW:2,GOLD_SILVER:3,CRYSTAL:4,RUBY_SAPPHIRE:5,EMERALD:6,FIRERED_LEAFGREEN:7,DIAMOND_PEARL:8,PLATINUM:9,HEARTGOLD_SOULSILVER:10,BLACK_WHITE:11,COLOSSEUM:12,XD:13,BLACK_2_WHITE_2:14,X_Y:15,OMEGA_RUBY_ALPHA_SAPPHIRE:16,SUN_MOON:17,ULTRA_SUN_ULTRA_MOON:18,LETS_GO:19,SWORD_SHIELD:20,THE_ISLE_OF_ARMOR:21,THE_CROWN_TUNDRA:22,BRILLIANT_DIAMOND_AND_SHINING_PEARL:23,LEGENDS_ARCEUS:24},_={COUNTABLE:1,CONSUMABLE:2,USABLE_OVERWORLD:3,USABLE_IN_BATTLE:4,HOLDABLE:5,HOLDABLE_PASSIVE:6,HOLDABLE_ACTIVE:7,UNDERGROUND:8},v={STAT_BOOSTS:1,EFFORT_DROP:2,MEDICINE:3,OTHER:4,IN_A_PINCH:5,PICKY_HEALING:6,TYPE_PROTECTION:7,BAKING_ONLY:8,COLLECTIBLES:9,EVOLUTION:10,SPELUNKING:11,HELD_ITEMS:12,CHOICE:13,EFFORT_TRAINING:14,BAD_HELD_ITEMS:15,TRAINING:16,PLATES:17,SPECIES_SPECIFIC:18,TYPE_ENHANCEMENT:19,EVENT_ITEMS:20,GAMEPLAY:21,PLOT_ADVANCEMENT:22,UNUSED:23,LOOT:24,ALL_MAIL:25,VITAMINS:26,HEALING:27,PP_RECOVERY:28,REVIVAL:29,STATUS_CURES:30,MULCH:32,SPECIAL_BALLS:33,STANDARD_BALLS:34,DEX_COMPLETION:35,SCARVES:36,ALL_MACHINES:37,FLUTES:38,APRICORN_BALLS:39,APRICORN_BOX:40,DATA_CARDS:41,JEWELS:42,MIRACLE_SHOOTER:43,MEGA_STONES:44,MEMORIES:45,Z_CRYSTALS:46,SPECIES_CANDIES:47,CATCHING_BONUS:48,DYNAMAX_CRISTALS:49,NATURE_MINTS:50,CURRY_INGREDIENTS:51},y={BADLY_POISON:1,BURN:2,BERRY_EFFECT:3,HERB_EFFECT:4,PARALYZE:5,POISON:6,FLINCH:7},b={MISC:1,MEDICINE:2,POKEBALLS:3,MACHINES:4,BERRIES:5,MAIL:6,BATTLE:7,KEY:8},x={KANTO:1,JOHTO:2,HOENN:3,SINNOH:4,UNOVA:5,KALOS:6,ALOLA:7,GALAR:8,HISUI:9},S={FOREST:1,FIELD:2,MOUNTAIN:3,POND:4,SEA:5},C={UNKNOWN:-1,NONE:0,PARALYSIS:1,SLEEP:2,FREEZE:3,BURN:4,POISON:5,CONFUSION:6,INFATUATION:7,TRAP:8,NIGHTMARE:9,TORMENT:12,DISABLE:13,YAWN:14,HEAL_BLOCK:15,NO_TYPE_IMMUNITY:17,LEECH_SEED:18,EMBARGO:19,PERISH_SONG:20,INGRAIN:21,SILENCE:24,TAR_SHOT:42},w={ATTACK:1,DEFENSE:2,SUPPORT:3},T={DAMAGE:0,AILMENT:1,NET_GOOD_STATS:2,HEAL:3,DAMAGE_AILMENT:4,SWAGGER:5,DAMAGE_LOWER:6,DAMAGE_RAISE:7,DAMAGE_HEAL:8,OHKO:9,WHOLE_FIELD_EFFECT:10,FIELD_EFFECT:11,FORCE_SWITCH:12,UNIQUE:13},E={STATUS:1,PHYSICAL:2,SPECIAL:3},D={LEVEL_UP:1,EGG:2,TUTOR:3,MACHINE:4,STADIUM_SURFING_PIKACHU:5,LIGHT_BALL_EGG:6,COLOSSEUM_PURIFICATION:7,XD_SHADOW:8,XD_PURIFICATION:9,FORM_CHANGE:10},O={SPECIFIC_MOVE:1,SELECTED_POKEMON_ME_FIRST:2,ALLY:3,USERS_FIELD:4,USER_OR_ALLY:5,OPPONENTS_FIELD:6,USER:7,RANDOM_OPPONENT:8,ALL_OTHER_POKEMON:9,SELECTED_POKEMON:10,ALL_OPPONENTS:11,ENTIRE_FIELD:12,USER_AND_ALIES:13,ALL_POKEMON:14,ALL_ALLIES:15},k={MONSTER:1,WATER1:2,BUG:3,FLYING:4,GROUND:5,FAIRY:6,PLANT:7,HUMANSHAPE:8,WATER3:9,MINERAL:10,INDETERMINATE:11,WATER2:12,DITTO:13,DRAGON:14,NO_EGGS:15},A={FEMALE:1,MALE:2,GENDERLESS:3},j={SLOW:1,MEDIUM:2,FAST:3,MEDIUM_SLOW:4,SLOW_THEN_VERY_FAST:5,FAST_THEN_VERY_SLOW:6},M={HARDY:1,BOLD:2,MODEST:3,CALM:4,TIMID:5,LONELY:6,DOCILE:7,MILD:8,GENTLE:9,HASTY:10,ADAMANT:11,IMPISH:12,BASHFUL:13,CAREFUL:14,RASH:15,JOLLY:16,NAUGHTY:17,LAX:18,QUIRKY:19,NAIVE:20,BRAVE:21,RELAXED:22,QUIET:23,SASSY:24,SERIOUS:25},N={SPEED:1,POWER:2,SKILL:3,STAMINA:4,JUMP:5},P={BLACK:1,BLUE:2,BROWN:3,GRAY:4,GREEN:5,PINK:6,PURPLE:7,RED:8,WHITE:9,YELLOW:10},F={CAVE:1,FOREST:2,GRASSLAND:3,MONTAIN:4,RARE:5,ROUGH_TERRAIN:6,SEA:7,URBAN:8,WATERS_EDGE:9},ee={BALL:1,SQUIGGLE:2,FISH:3,ARMS:4,BLOB:5,UPRIGHT:6,LEGS:7,QUADRUPED:8,WINGS:9,TENTACLES:10,HEADS:11,HUMANOID:12,BUG_WINGS:13,ARMOR:14},I={HP:1,ATTACK:2,DEFENSE:3,SPECIAL_ATTACK:4,SPECIAL_DEFENSE:5,SPEED:6,ACCURACY:7,EVASION:8},L={NORMAL:1,FIGHTING:2,FLYING:3,POISON:4,GROUND:5,ROCK:6,BUG:7,GHOST:8,STEEL:9,FIRE:10,WATER:11,GRASS:12,ELECTRIC:13,PSYCHIC:14,ICE:15,DRAGON:16,DARK:17,FAIRY:18,UNKNOWN:10001,SHADOW:10002},R={JA_HRKT:1,JA_ROMA:2,KO:3,ZH_HANT:4,FR:5,DE:6,ES:7,IT:8,EN:9,CS:10,JA:11,ZH_HANS:12,PT_BR:13};var te=t({BASE_URL:()=>n,BERRIES:()=>r,BERRY_FIRMNESSES:()=>i,BERRY_FLAVORS:()=>a,CONTEST_TYPES:()=>o,CURRENCIES:()=>s,EGG_GROUPS:()=>k,ENCOUNTER_CONDITIONS:()=>l,ENCOUNTER_CONDITION_VALUES:()=>u,ENCOUNTER_METHODS:()=>c,ENDPOINTS:()=>d,EVOLUTION_TRIGGERS:()=>f,GENDERS:()=>A,GENERATIONS:()=>p,GROWTH_RATES:()=>j,ITEM_ATTRIBUTES:()=>_,ITEM_CATEGORIES:()=>v,ITEM_FLING_EFFECTS:()=>y,ITEM_POCKETS:()=>b,LANGUAGES:()=>R,MOVE_AILMENTS:()=>C,MOVE_BATTLE_STYLES:()=>w,MOVE_CATEGORIES:()=>T,MOVE_DAMAGE_CLASSES:()=>E,MOVE_LEARN_METHODS:()=>D,MOVE_TARGETS:()=>O,NATURES:()=>M,PAL_PARK_AREAS:()=>S,POKEATHLON_STATS:()=>N,POKEDEXES:()=>m,POKEMON_COLORS:()=>P,POKEMON_HABITATS:()=>F,POKEMON_SHAPES:()=>ee,REGIONS:()=>x,STATS:()=>I,TYPES:()=>L,VERSIONS:()=>h,VERSION_GROUPS:()=>g}),z=class{entries=new Map;ttl;maxEntries;constructor(e){this.ttl=e?.ttl??3e5,this.maxEntries=e?.maxEntries??500}get(e){let t=this.entries.get(e);if(t){if(t.expiresAt<=Date.now()){this.entries.delete(e);return}return this.entries.delete(e),this.entries.set(e,t),t.value}}set(e,t){if(this.entries.delete(e),this.entries.size>=this.maxEntries){let e=this.entries.keys().next();e.done||this.entries.delete(e.value)}this.entries.set(e,{value:t,expiresAt:Date.now()+this.ttl})}delete(e){this.entries.delete(e)}clear(){this.entries.clear()}};const B=`pokenode:http`;var V=class extends Error{name=`PokenodeError`;kind=B;status;statusText;url;body;constructor(e,t){super(`Request to ${e.url} failed with status ${e.status}`),this.status=e.status,this.statusText=e.statusText,this.url=e.url,this.body=t}static isPokenodeError(e){return typeof e==`object`&&!!e&&`kind`in e&&e.kind===B}};const ne=async e=>{let t;try{t=await e.json()}catch{t=void 0}return new V(e,t)},H=e=>e.replace(/\/+$/,``),re=e=>e.replace(/\/+(?=\?|$)/,``),ie=/^v\d+$/,ae=(e,t)=>{let n=new URL(e),r=new URL(t),i=H(r.pathname);if(n.origin===r.origin&&(n.pathname===i||n.pathname.startsWith(`${i}/`)))return`${n.pathname.slice(i.length)}${n.search}`;let a=n.pathname.split(`/`),o=a.findIndex(e=>ie.test(e));if(o===-1)throw TypeError(`Cannot resolve "${e}" against the base URL "${t}"`);return`/${a.slice(o+1).join(`/`)}${n.search}`};var U=class{cache;baseURL;logger;fetch;inFlight=new Map;constructor(e){this.baseURL=H(e?.baseURL??n.REST),this.cache=e?.cache===!1?void 0:e?.cache??new z,this.logger=e?.logger,this.fetch=e?.fetch??((e,t)=>globalThis.fetch(e,t))}async clearCache(){await this.cache?.clear?.()}async request(e,t=this.baseURL){let n=re(`${H(t)}${e.startsWith(`/`)?e:`/${e}`}`);this.logger?.request(`get`,n);let r=await this.cache?.get(n);if(r!==void 0)return this.logger?.response(200,!0),r;let i=this.inFlight.get(n);if(i)return i;let a=this.fetchResource(n).finally(()=>this.inFlight.delete(n));return this.inFlight.set(n,a),a}async fetchResource(e){try{let t=await this.fetch(e,{headers:{Accept:`application/json`}});if(!t.ok)throw await ne(t);let n=await t.json();return this.logger?.response(t.status,!1),await this.cache?.set(e,n),n}catch(e){throw this.logger?.error(e),e}}async getResource(e,t){return this.request(t===void 0?e:`${e}/${t}`)}async getResourceByURL(e,t=this.baseURL){return this.request(ae(e,t),t)}async getListResource(e,t=0,n=20){let r=new URLSearchParams({offset:String(t),limit:String(n)});return this.request(`${e}?${r}`)}},W=class extends U{async getBerryByName(e){return this.getResource(d.BERRY,e)}async getBerryById(e){return this.getResource(d.BERRY,e)}async getBerryFirmnessById(e){return this.getResource(d.BERRY_FIRMNESS,e)}async getBerryFirmnessByName(e){return this.getResource(d.BERRY_FIRMNESS,e)}async getBerryFlavorById(e){return this.getResource(d.BERRY_FLAVOR,e)}async getBerryFlavorByName(e){return this.getResource(d.BERRY_FLAVOR,e)}async listBerries(e,t){return this.getListResource(d.BERRY,e,t)}async listBerryFirmnesses(e,t){return this.getListResource(d.BERRY_FIRMNESS,e,t)}async listBerryFlavors(e,t){return this.getListResource(d.BERRY_FLAVOR,e,t)}},G=class extends U{async getContestTypeByName(e){return this.getResource(d.CONTEST_TYPE,e)}async getContestTypeById(e){return this.getResource(d.CONTEST_TYPE,e)}async getContestEffectById(e){return this.getResource(d.CONTEST_EFFECT,e)}async getSuperContestEffectById(e){return this.getResource(d.SUPER_CONTEST_EFFECT,e)}async listContestTypes(e,t){return this.getListResource(d.CONTEST_TYPE,e,t)}async listContestEffects(e,t){return this.getListResource(d.CONTEST_EFFECT,e,t)}async listSuperContestEffects(e,t){return this.getListResource(d.SUPER_CONTEST_EFFECT,e,t)}},K=class extends U{async getCurrencyByName(e){return this.getResource(d.CURRENCY,e)}async getCurrencyById(e){return this.getResource(d.CURRENCY,e)}async listCurrencies(e,t){return this.getListResource(d.CURRENCY,e,t)}},q=class extends U{async getEncounterMethodByName(e){return this.getResource(d.ENCOUNTER_METHOD,e)}async getEncounterMethodById(e){return this.getResource(d.ENCOUNTER_METHOD,e)}async getEncounterConditionById(e){return this.getResource(d.ENCOUNTER_CONDITION,e)}async getEncounterConditionByName(e){return this.getResource(d.ENCOUNTER_CONDITION,e)}async getEncounterConditionValueByName(e){return this.getResource(d.ENCOUNTER_CONDITION_VALUE,e)}async getEncounterConditionValueById(e){return this.getResource(d.ENCOUNTER_CONDITION_VALUE,e)}async listEncounterMethods(e,t){return this.getListResource(d.ENCOUNTER_METHOD,e,t)}async listEncounterConditions(e,t){return this.getListResource(d.ENCOUNTER_CONDITION,e,t)}async listEncounterConditionValues(e,t){return this.getListResource(d.ENCOUNTER_CONDITION_VALUE,e,t)}},J=class extends U{async getEvolutionChainById(e){return this.getResource(d.EVOLUTION_CHAIN,e)}async getEvolutionTriggerById(e){return this.getResource(d.EVOLUTION_TRIGGER,e)}async getEvolutionTriggerByName(e){return this.getResource(d.EVOLUTION_TRIGGER,e)}async listEvolutionChains(e,t){return this.getListResource(d.EVOLUTION_CHAIN,e,t)}async listEvolutionTriggers(e,t){return this.getListResource(d.EVOLUTION_TRIGGER,e,t)}},Y=class extends U{async getGenerationByName(e){return this.getResource(d.GENERATION,e)}async getGenerationById(e){return this.getResource(d.GENERATION,e)}async getPokedexByName(e){return this.getResource(d.POKEDEX,e)}async getPokedexById(e){return this.getResource(d.POKEDEX,e)}async getVersionByName(e){return this.getResource(d.VERSION,e)}async getVersionById(e){return this.getResource(d.VERSION,e)}async getVersionGroupByName(e){return this.getResource(d.VERSION_GROUP,e)}async getVersionGroupById(e){return this.getResource(d.VERSION_GROUP,e)}async listGenerations(e,t){return this.getListResource(d.GENERATION,e,t)}async listPokedexes(e,t){return this.getListResource(d.POKEDEX,e,t)}async listVersions(e,t){return this.getListResource(d.VERSION,e,t)}async listVersionGroups(e,t){return this.getListResource(d.VERSION_GROUP,e,t)}},X=class extends U{async getItemByName(e){return this.getResource(d.ITEM,e)}async getItemById(e){return this.getResource(d.ITEM,e)}async getItemAttributeByName(e){return this.getResource(d.ITEM_ATTRIBUTE,e)}async getItemAttributeById(e){return this.getResource(d.ITEM_ATTRIBUTE,e)}async getItemCategoryByName(e){return this.getResource(d.ITEM_CATEGORY,e)}async getItemCategoryById(e){return this.getResource(d.ITEM_CATEGORY,e)}async getItemFlingEffectByName(e){return this.getResource(d.ITEM_FLING_EFFECT,e)}async getItemFlingEffectById(e){return this.getResource(d.ITEM_FLING_EFFECT,e)}async getItemPocketByName(e){return this.getResource(d.ITEM_POCKET,e)}async getItemPocketById(e){return this.getResource(d.ITEM_POCKET,e)}async listItems(e,t){return this.getListResource(d.ITEM,e,t)}async listItemAttributes(e,t){return this.getListResource(d.ITEM_ATTRIBUTE,e,t)}async listItemCategories(e,t){return this.getListResource(d.ITEM_CATEGORY,e,t)}async listItemFlingEffects(e,t){return this.getListResource(d.ITEM_FLING_EFFECT,e,t)}async listItemPockets(e,t){return this.getListResource(d.ITEM_POCKET,e,t)}},Z=class extends U{async getLocationByName(e){return this.getResource(d.LOCATION,e)}async getLocationById(e){return this.getResource(d.LOCATION,e)}async getLocationAreaByName(e){return this.getResource(d.LOCATION_AREA,e)}async getLocationAreaById(e){return this.getResource(d.LOCATION_AREA,e)}async getPalParkAreaByName(e){return this.getResource(d.PALPARK_AREA,e)}async getPalParkAreaById(e){return this.getResource(d.PALPARK_AREA,e)}async getRegionByName(e){return this.getResource(d.REGION,e)}async getRegionById(e){return this.getResource(d.REGION,e)}async listLocations(e,t){return this.getListResource(d.LOCATION,e,t)}async listLocationAreas(e,t){return this.getListResource(d.LOCATION_AREA,e,t)}async listPalParkAreas(e,t){return this.getListResource(d.PALPARK_AREA,e,t)}async listRegions(e,t){return this.getListResource(d.REGION,e,t)}},Q=class extends U{async getMachineById(e){return this.getResource(d.MACHINE,e)}async listMachines(e,t){return this.getListResource(d.MACHINE,e,t)}},$=class extends U{async getMoveByName(e){return this.getResource(d.MOVE,e)}async getMoveById(e){return this.getResource(d.MOVE,e)}async getMoveAilmentByName(e){return this.getResource(d.MOVE_AILMENT,e)}async getMoveAilmentById(e){return this.getResource(d.MOVE_AILMENT,e)}async getMoveBattleStyleByName(e){return this.getResource(d.MOVE_BATTLE_STYLE,e)}async getMoveBattleStyleById(e){return this.getResource(d.MOVE_BATTLE_STYLE,e)}async getMoveCategoryByName(e){return this.getResource(d.MOVE_CATEGORY,e)}async getMoveCategoryById(e){return this.getResource(d.MOVE_CATEGORY,e)}async getMoveDamageClassByName(e){return this.getResource(d.MOVE_DAMAGE_CLASS,e)}async getMoveDamageClassById(e){return this.getResource(d.MOVE_DAMAGE_CLASS,e)}async getMoveLearnMethodByName(e){return this.getResource(d.MOVE_LEARN_METHOD,e)}async getMoveLearnMethodById(e){return this.getResource(d.MOVE_LEARN_METHOD,e)}async getMoveTargetByName(e){return this.getResource(d.MOVE_TARGET,e)}async getMoveTargetById(e){return this.getResource(d.MOVE_TARGET,e)}async listMoves(e,t){return this.getListResource(d.MOVE,e,t)}async listMoveAilments(e,t){return this.getListResource(d.MOVE_AILMENT,e,t)}async listMoveBattleStyles(e,t){return this.getListResource(d.MOVE_BATTLE_STYLE,e,t)}async listMoveCategories(e,t){return this.getListResource(d.MOVE_CATEGORY,e,t)}async listMoveDamageClasses(e,t){return this.getListResource(d.MOVE_DAMAGE_CLASS,e,t)}async listMoveLearnMethods(e,t){return this.getListResource(d.MOVE_LEARN_METHOD,e,t)}async listMoveTargets(e,t){return this.getListResource(d.MOVE_TARGET,e,t)}},oe=class extends U{async getAbilityByName(e){return this.getResource(d.ABILITY,e)}async getAbilityById(e){return this.getResource(d.ABILITY,e)}async getCharacteristicById(e){return this.getResource(d.CHARACTERISTIC,e)}async getEggGroupByName(e){return this.getResource(d.EGG_GROUP,e)}async getEggGroupById(e){return this.getResource(d.EGG_GROUP,e)}async getGenderByName(e){return this.getResource(d.GENDER,e)}async getGenderById(e){return this.getResource(d.GENDER,e)}async getGrowthRateByName(e){return this.getResource(d.GROWTH_RATE,e)}async getGrowthRateById(e){return this.getResource(d.GROWTH_RATE,e)}async getNatureByName(e){return this.getResource(d.NATURE,e)}async getNatureById(e){return this.getResource(d.NATURE,e)}async getPokeathlonStatByName(e){return this.getResource(d.POKEATHLON_STAT,e)}async getPokeathlonStatById(e){return this.getResource(d.POKEATHLON_STAT,e)}async getPokemonByName(e){return this.getResource(d.POKEMON,e)}async getPokemonById(e){return this.getResource(d.POKEMON,e)}async getPokemonLocationAreaById(e){return this.getResource(d.POKEMON,`${e}/encounters`)}async getPokemonColorByName(e){return this.getResource(d.POKEMON_COLOR,e)}async getPokemonColorById(e){return this.getResource(d.POKEMON_COLOR,e)}async getPokemonFormByName(e){return this.getResource(d.POKEMON_FORM,e)}async getPokemonFormById(e){return this.getResource(d.POKEMON_FORM,e)}async getPokemonHabitatByName(e){return this.getResource(d.POKEMON_HABITAT,e)}async getPokemonHabitatById(e){return this.getResource(d.POKEMON_HABITAT,e)}async getPokemonShapeByName(e){return this.getResource(d.POKEMON_SHAPE,e)}async getPokemonShapeById(e){return this.getResource(d.POKEMON_SHAPE,e)}async getPokemonSpeciesByName(e){return this.getResource(d.POKEMON_SPECIES,e)}async getPokemonSpeciesById(e){return this.getResource(d.POKEMON_SPECIES,e)}async getStatByName(e){return this.getResource(d.STAT,e)}async getStatById(e){return this.getResource(d.STAT,e)}async getTypeByName(e){return this.getResource(d.TYPE,e)}async getTypeById(e){return this.getResource(d.TYPE,e)}async listAbilities(e,t){return this.getListResource(d.ABILITY,e,t)}async listCharacteristics(e,t){return this.getListResource(d.CHARACTERISTIC,e,t)}async listEggGroups(e,t){return this.getListResource(d.EGG_GROUP,e,t)}async listGenders(e,t){return this.getListResource(d.GENDER,e,t)}async listGrowthRates(e,t){return this.getListResource(d.GROWTH_RATE,e,t)}async listNatures(e,t){return this.getListResource(d.NATURE,e,t)}async listPokeathlonStats(e,t){return this.getListResource(d.POKEATHLON_STAT,e,t)}async listPokemons(e,t){return this.getListResource(d.POKEMON,e,t)}async listPokemonColors(e,t){return this.getListResource(d.POKEMON_COLOR,e,t)}async listPokemonForms(e,t){return this.getListResource(d.POKEMON_FORM,e,t)}async listPokemonHabitats(e,t){return this.getListResource(d.POKEMON_HABITAT,e,t)}async listPokemonShapes(e,t){return this.getListResource(d.POKEMON_SHAPE,e,t)}async listPokemonSpecies(e,t){return this.getListResource(d.POKEMON_SPECIES,e,t)}async listStats(e,t){return this.getListResource(d.STAT,e,t)}async listTypes(e,t){return this.getListResource(d.TYPE,e,t)}},se=class extends U{async getLanguageById(e){return this.getResource(d.LANGUAGE,e)}async getLanguageByName(e){return this.getResource(d.LANGUAGE,e)}async getResourceByUrl(e){return this.getResourceByURL(e)}listLanguages(e,t){return this.getListResource(d.LANGUAGE,e,t)}},ce=class{cache;berry;contest;currency;encounter;evolution;game;item;location;machine;move;pokemon;utility;constructor(e){let t=e?.cache??new z,n={...e,cache:t};this.cache=t===!1?void 0:t,this.berry=new W(n),this.contest=new G(n),this.currency=new K(n),this.encounter=new q(n),this.evolution=new J(n),this.game=new Y(n),this.item=new X(n),this.location=new Z(n),this.machine=new Q(n),this.move=new $(n),this.pokemon=new oe(n),this.utility=new se(n)}async clearCache(){await this.cache?.clear?.()}};const le={request(e,t){console.log(`[ Request Config ] ${e.toUpperCase()} | ${t}`)},response(e,t){console.log(`[ Response ] STATUS ${e} | ${t?`CACHED`:`NOT CACHED`}`)},error(e){let{name:t,message:n}=e instanceof Error?e:{name:`UNKNOWN`,message:String(e)};console.error(`[ Response Error ] CODE ${t} | ${n}`)}};exports.BASE_URL=n,exports.BERRIES=r,exports.BERRY_FIRMNESSES=i,exports.BERRY_FLAVORS=a,exports.BerryClient=W,Object.defineProperty(exports,"CONSTANTS",{enumerable:!0,get:function(){return te}}),exports.CONTEST_TYPES=o,exports.CURRENCIES=s,exports.ContestClient=G,exports.CurrencyClient=K,exports.EGG_GROUPS=k,exports.ENCOUNTER_CONDITIONS=l,exports.ENCOUNTER_CONDITION_VALUES=u,exports.ENCOUNTER_METHODS=c,exports.ENDPOINTS=d,exports.EVOLUTION_TRIGGERS=f,exports.EncounterClient=q,exports.EvolutionClient=J,exports.GENDERS=A,exports.GENERATIONS=p,exports.GROWTH_RATES=j,exports.GameClient=Y,exports.ITEM_ATTRIBUTES=_,exports.ITEM_CATEGORIES=v,exports.ITEM_FLING_EFFECTS=y,exports.ITEM_POCKETS=b,exports.ItemClient=X,exports.LANGUAGES=R,exports.LocationClient=Z,exports.MOVE_AILMENTS=C,exports.MOVE_BATTLE_STYLES=w,exports.MOVE_CATEGORIES=T,exports.MOVE_DAMAGE_CLASSES=E,exports.MOVE_LEARN_METHODS=D,exports.MOVE_TARGETS=O,exports.MachineClient=Q,exports.MainClient=ce,exports.MemoryCache=z,exports.MoveClient=$,exports.NATURES=M,exports.PAL_PARK_AREAS=S,exports.POKEATHLON_STATS=N,exports.POKEDEXES=m,exports.POKEMON_COLORS=P,exports.POKEMON_HABITATS=F,exports.POKEMON_SHAPES=ee,exports.PokemonClient=oe,exports.PokenodeError=V,exports.REGIONS=x,exports.STATS=I,exports.TYPES=L,exports.UtilityClient=se,exports.VERSIONS=h,exports.VERSION_GROUPS=g,exports.consoleLogger=le;
1
+ /**
2
+ * _
3
+ * |_) _ | _ _ _ _| _ __ _|_ _
4
+ * | (_) |< (/_ | | (_) (_| (/_ |_ _>
5
+ *
6
+ * pokenode-ts v2.2.0 — A typed PokéAPI client with zero runtime dependencies.
7
+ *
8
+ * Docs: https://pokenode-ts.vercel.app/
9
+ * Author: Gabb-c <https://github.com/Gabb-c>
10
+ * License: MIT
11
+ * Built: 2026-08-21
12
+ *
13
+ * @license MIT
14
+ * @preserve
15
+ */
16
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};const n={CHERI:1,CHESTO:2,PECHA:3,RAWST:4,ASPEAR:5,LEPPA:6,ORAN:7,PERSIM:8,LUM:9,SITRUS:10,FIGY:11,WIKI:12,MAGO:13,AGUAV:14,IAPAPA:15,RAZZ:16,BLUK:17,NANAB:18,WEPEAR:19,PINAP:20,POMEG:21,KELPSY:22,QUALOT:23,HONDEW:24,GREPA:25,TAMATO:26,CORNN:27,MAGOST:28,RABUTA:29,NOMEL:30,SPELON:31,PAMTRE:32,WATMEL:33,DURIN:34,BELUE:35,OCCA:36,PASSHO:37,WACAN:38,RINDO:39,YACHE:40,CHOPLE:41,KEBIA:42,SHUCA:43,COBA:44,PAYAPA:45,TANGA:46,CHARTI:47,KASIB:48,HABAN:49,COLBUR:50,BABIRI:51,CHILAN:52,LIECHI:53,GANLON:54,SALAC:55,PETAYA:56,APICOT:57,LANSAT:58,STARF:59,ENIGMA:60,MICLE:61,CUSTAP:62,JABOCA:63,ROWAP:64},r={VERY_SOFT:1,SOFT:2,HARD:3,VERY_HARD:4,SUPER_HARD:5},i={SPICY:1,DRY:2,SWEET:3,BITTER:4,SOUR:5},a={COOL:1,BEAUTY:2,CUTE:3,SMART:4,TOUGH:5},o={POKE_DOLLAR:1,COIN:2,VOLCANIC_ASH:3,POKE_COUPON:4,BERRY_POWDER:5,BATTLE_POINT:6,SPHERE:7,CASTLE_POINT:8,WATT:9,ATHLETE_POINT:10,DREAM_POINT:11,DREAM_WORLD_BERRY:12,POKE_MILE:13,FESTIVAL_COIN:14,POKE_BEAN:15,HOME_POINT:16,MERIT_POINT:17,LEAGUE_POINT:18,BLUEBERRY_POINT:19},s={WALK:1,OLD_ROD:2,GOOD_ROD:3,SUPER_ROD:4,SURF:5,ROCK_SMASH:6,HEADBUTT:7,DARK_GRASS:8,GRASS_SPOTS:9,CAVE_SPOTS:10,BRIDGE_SPOTS:11,SUPER_ROD_SPOTS:12,SURF_SPOTS:13,YELLOW_FLOWERS:14,PURPLE_FLOWERS:15,RED_FLOWERS:16,ROUGH_TERRAIN:17,GIFT:18,GIFT_EGG:19,ONLY_ONE:20,POKEFLUTE:21,HEADBUTT_LOW:22,HEADBUTT_NORMAL:23,HEADBUT_HIGH:24,SQUIRT_BOTTLE:25,WAILMER_PAIL:26,SEAWEED:27},c={SWARM:1,TIME:2,RADAR:3,SLOT2:4,RADIO:5,SEASON:6,STARTER:7,TV_OPTION:8,STORY_PROGRESS:9,OTHER:10},l={SWARM_YES:1,SWARM_NO:2,TIME_MORNING:3,TIME_DAY:4,TIME_NIGHT:5,RADAR_ON:6,RADAR_OFF:7,SLOT2_NONE:8,SLOT2_RUBY:9,SLOT2_SAPHIRE:10,SLOT2_EMERALD:11,SLOT2_FIRERED:12,SLOT2_LEAFGREEN:13,RADIO_OFF:14,RADIO_HOEN:15,RADIO_SINNOH:16,SEASON_SPRING:17,SEASON_SUMMER:18,SWASON_AUTUMN:19,SEASON_WINTER:20,STARTER_BULBASAUR:21,STARTER_SQUIRTLE:22,STARTER_CHARMANDER:23,STARTER_CHESPIN:24,STARTER_FENNEKIN:25,STARTER_FROAKIE:26,TV_OPTION_BLUE:27,TV_OPTION_RED:28,STORY_PROGRESS_AWAKENED_BEASTS:29,STORY_PROGRESS_BEAT_GALACTIC_CORONET:30,STORY_PROGRESS_OAK_ETERNA_CITY:31,STORY_PROGRESS_OAK_VERMILION_COPYCAT:32,STORY_PROGRESS_MET_TORNADUS_THUNDURUS:33,STORY_PROGRESS_BEAT_ELITE_FOUR_ROUND_TWO:34,STORY_PROGRESS_HALL_OF_FAME:35,STORY_PROGRESS_NONE:36,STORY_PROGRESS_NATIONAL_DEX:37,OTHER_NONE:38,OTHER_SNORLAX_LL_BEAT_LEAGUE:39},u={BERRY:`/berry`,BERRY_FIRMNESS:`/berry-firmness`,BERRY_FLAVOR:`/berry-flavor`,CONTEST_TYPE:`/contest-type`,CONTEST_EFFECT:`/contest-effect`,SUPER_CONTEST_EFFECT:`/super-contest-effect`,CURRENCY:`/currency`,ENCOUNTER_METHOD:`/encounter-method`,ENCOUNTER_CONDITION:`/encounter-condition`,ENCOUNTER_CONDITION_VALUE:`/encounter-condition-value`,EVOLUTION_CHAIN:`/evolution-chain`,EVOLUTION_TRIGGER:`/evolution-trigger`,GENERATION:`/generation`,POKEDEX:`/pokedex`,VERSION:`/version`,VERSION_GROUP:`/version-group`,ITEM:`/item`,ITEM_ATTRIBUTE:`/item-attribute`,ITEM_CATEGORY:`/item-category`,ITEM_FLING_EFFECT:`/item-fling-effect`,ITEM_POCKET:`/item-pocket`,LOCATION:`/location`,LOCATION_AREA:`/location-area`,PALPARK_AREA:`/pal-park-area`,REGION:`/region`,MACHINE:`/machine`,MOVE:`/move`,MOVE_AILMENT:`/move-ailment`,MOVE_BATTLE_STYLE:`/move-battle-style`,MOVE_CATEGORY:`/move-category`,MOVE_DAMAGE_CLASS:`/move-damage-class`,MOVE_LEARN_METHOD:`/move-learn-method`,MOVE_TARGET:`/move-target`,ABILITY:`/ability`,CHARACTERISTIC:`/characteristic`,EGG_GROUP:`/egg-group`,GENDER:`/gender`,GROWTH_RATE:`/growth-rate`,NATURE:`/nature`,POKEATHLON_STAT:`/pokeathlon-stat`,POKEMON:`/pokemon`,POKEMON_COLOR:`/pokemon-color`,POKEMON_FORM:`/pokemon-form`,POKEMON_HABITAT:`/pokemon-habitat`,POKEMON_SHAPE:`/pokemon-shape`,POKEMON_SPECIES:`/pokemon-species`,STAT:`/stat`,TYPE:`/type`,LANGUAGE:`/language`},d={LEVEL_UP:1,TRADE:2,USE_ITEM:3,SHED:4,SPIN:5,TOWER_OF_DARKNESS:6,TOWER_OF_WATER:7,THREE_CRITICAL_HITS:8,TAKE_DAMAGE:9,OTHER:10},f={GENERATION_I:1,GENERATION_II:2,GENERATION_III:3,GENERATION_IV:4,GENERATION_V:5,GENERATION_VI:6,GENERATION_VII:7,GENERATION_VIII:8},p={NATIONAL:1,KANTO:2,ORIGINAL_JOHTO:3,HOENN:4,ORIGINAL_SINNOH:5,EXTENDED_SINNOH:6,UPDATED_JOHTO:7,ORIGINAL_UNOVA:8,UPDATED_UNOVA:9,CONQUEST_GALLERY:11,KALOS_CENTRAL:12,KALOS_COASTAL:13,KALOS_MONTAIN:14,UPDATED_HOENN:15,ORIGINAL_ALOLA:16,ORIGINAL_MELEMELE:17,ORIGINAL_AKALA:18,ORIGINAL_ULAULA:19,ORIGINAL_PONI:20,UPDATED_ALOLA:21,UPDATED_MELEMELE:22,UPDATED_AKALA:23,UPDATED_ULAULA:24,UPDATED_PONI:25,UPDATED_KANTO:26,GALAR:27,ISLE_OF_ARMOR:28,CROWN_TUNDRA:29},m={RED:1,BLUE:2,YELLOW:3,GOLD:4,SILVER:5,CRYSTAL:6,RUBY:7,SAPPHIRE:8,EMERALD:9,FIRERED:10,LEAFGREEN:11,DIAMOND:12,PEARL:13,PLATINUM:14,HEARTGOLD:15,SOULSILVER:16,BLACK:17,WHITE:18,COLOSSEUM:19,XD:20,BLACK_2:21,WHITE_2:22,X:23,Y:24,OMEGA_RUBY:25,ALPHA_SAPPHIRE:26,SUN:27,MOON:28,ULTRA_SUN:29,ULTRA_MOON:30,LETS_GO_PIKACHU:31,LETS_GO_EEVEE:32,SWORD:33,SHIELD:34,THE_ISLE_OF_ARMOR:35,THE_CROWN_TUNDRA:36,BRILLIANT_DIAMOND:37,SHINING_PEARL:38,LEGENDS_ARCEUS:39},h={RED_BLUE:1,YELLOW:2,GOLD_SILVER:3,CRYSTAL:4,RUBY_SAPPHIRE:5,EMERALD:6,FIRERED_LEAFGREEN:7,DIAMOND_PEARL:8,PLATINUM:9,HEARTGOLD_SOULSILVER:10,BLACK_WHITE:11,COLOSSEUM:12,XD:13,BLACK_2_WHITE_2:14,X_Y:15,OMEGA_RUBY_ALPHA_SAPPHIRE:16,SUN_MOON:17,ULTRA_SUN_ULTRA_MOON:18,LETS_GO:19,SWORD_SHIELD:20,THE_ISLE_OF_ARMOR:21,THE_CROWN_TUNDRA:22,BRILLIANT_DIAMOND_AND_SHINING_PEARL:23,LEGENDS_ARCEUS:24},g={COUNTABLE:1,CONSUMABLE:2,USABLE_OVERWORLD:3,USABLE_IN_BATTLE:4,HOLDABLE:5,HOLDABLE_PASSIVE:6,HOLDABLE_ACTIVE:7,UNDERGROUND:8},ee={STAT_BOOSTS:1,EFFORT_DROP:2,MEDICINE:3,OTHER:4,IN_A_PINCH:5,PICKY_HEALING:6,TYPE_PROTECTION:7,BAKING_ONLY:8,COLLECTIBLES:9,EVOLUTION:10,SPELUNKING:11,HELD_ITEMS:12,CHOICE:13,EFFORT_TRAINING:14,BAD_HELD_ITEMS:15,TRAINING:16,PLATES:17,SPECIES_SPECIFIC:18,TYPE_ENHANCEMENT:19,EVENT_ITEMS:20,GAMEPLAY:21,PLOT_ADVANCEMENT:22,UNUSED:23,LOOT:24,ALL_MAIL:25,VITAMINS:26,HEALING:27,PP_RECOVERY:28,REVIVAL:29,STATUS_CURES:30,MULCH:32,SPECIAL_BALLS:33,STANDARD_BALLS:34,DEX_COMPLETION:35,SCARVES:36,ALL_MACHINES:37,FLUTES:38,APRICORN_BALLS:39,APRICORN_BOX:40,DATA_CARDS:41,JEWELS:42,MIRACLE_SHOOTER:43,MEGA_STONES:44,MEMORIES:45,Z_CRYSTALS:46,SPECIES_CANDIES:47,CATCHING_BONUS:48,DYNAMAX_CRISTALS:49,NATURE_MINTS:50,CURRY_INGREDIENTS:51},te={BADLY_POISON:1,BURN:2,BERRY_EFFECT:3,HERB_EFFECT:4,PARALYZE:5,POISON:6,FLINCH:7},ne={MISC:1,MEDICINE:2,POKEBALLS:3,MACHINES:4,BERRIES:5,MAIL:6,BATTLE:7,KEY:8},_={KANTO:1,JOHTO:2,HOENN:3,SINNOH:4,UNOVA:5,KALOS:6,ALOLA:7,GALAR:8,HISUI:9},v={FOREST:1,FIELD:2,MOUNTAIN:3,POND:4,SEA:5},y={UNKNOWN:-1,NONE:0,PARALYSIS:1,SLEEP:2,FREEZE:3,BURN:4,POISON:5,CONFUSION:6,INFATUATION:7,TRAP:8,NIGHTMARE:9,TORMENT:12,DISABLE:13,YAWN:14,HEAL_BLOCK:15,NO_TYPE_IMMUNITY:17,LEECH_SEED:18,EMBARGO:19,PERISH_SONG:20,INGRAIN:21,SILENCE:24,TAR_SHOT:42},b={ATTACK:1,DEFENSE:2,SUPPORT:3},re={DAMAGE:0,AILMENT:1,NET_GOOD_STATS:2,HEAL:3,DAMAGE_AILMENT:4,SWAGGER:5,DAMAGE_LOWER:6,DAMAGE_RAISE:7,DAMAGE_HEAL:8,OHKO:9,WHOLE_FIELD_EFFECT:10,FIELD_EFFECT:11,FORCE_SWITCH:12,UNIQUE:13},x={STATUS:1,PHYSICAL:2,SPECIAL:3},S={LEVEL_UP:1,EGG:2,TUTOR:3,MACHINE:4,STADIUM_SURFING_PIKACHU:5,LIGHT_BALL_EGG:6,COLOSSEUM_PURIFICATION:7,XD_SHADOW:8,XD_PURIFICATION:9,FORM_CHANGE:10},C={SPECIFIC_MOVE:1,SELECTED_POKEMON_ME_FIRST:2,ALLY:3,USERS_FIELD:4,USER_OR_ALLY:5,OPPONENTS_FIELD:6,USER:7,RANDOM_OPPONENT:8,ALL_OTHER_POKEMON:9,SELECTED_POKEMON:10,ALL_OPPONENTS:11,ENTIRE_FIELD:12,USER_AND_ALIES:13,ALL_POKEMON:14,ALL_ALLIES:15},w={MONSTER:1,WATER1:2,BUG:3,FLYING:4,GROUND:5,FAIRY:6,PLANT:7,HUMANSHAPE:8,WATER3:9,MINERAL:10,INDETERMINATE:11,WATER2:12,DITTO:13,DRAGON:14,NO_EGGS:15},T={FEMALE:1,MALE:2,GENDERLESS:3},E={SLOW:1,MEDIUM:2,FAST:3,MEDIUM_SLOW:4,SLOW_THEN_VERY_FAST:5,FAST_THEN_VERY_SLOW:6},D={HARDY:1,BOLD:2,MODEST:3,CALM:4,TIMID:5,LONELY:6,DOCILE:7,MILD:8,GENTLE:9,HASTY:10,ADAMANT:11,IMPISH:12,BASHFUL:13,CAREFUL:14,RASH:15,JOLLY:16,NAUGHTY:17,LAX:18,QUIRKY:19,NAIVE:20,BRAVE:21,RELAXED:22,QUIET:23,SASSY:24,SERIOUS:25},O={SPEED:1,POWER:2,SKILL:3,STAMINA:4,JUMP:5},k={BLACK:1,BLUE:2,BROWN:3,GRAY:4,GREEN:5,PINK:6,PURPLE:7,RED:8,WHITE:9,YELLOW:10},A={CAVE:1,FOREST:2,GRASSLAND:3,MONTAIN:4,RARE:5,ROUGH_TERRAIN:6,SEA:7,URBAN:8,WATERS_EDGE:9},j={BALL:1,SQUIGGLE:2,FISH:3,ARMS:4,BLOB:5,UPRIGHT:6,LEGS:7,QUADRUPED:8,WINGS:9,TENTACLES:10,HEADS:11,HUMANOID:12,BUG_WINGS:13,ARMOR:14},M={HP:1,ATTACK:2,DEFENSE:3,SPECIAL_ATTACK:4,SPECIAL_DEFENSE:5,SPEED:6,ACCURACY:7,EVASION:8},N={NORMAL:1,FIGHTING:2,FLYING:3,POISON:4,GROUND:5,ROCK:6,BUG:7,GHOST:8,STEEL:9,FIRE:10,WATER:11,GRASS:12,ELECTRIC:13,PSYCHIC:14,ICE:15,DRAGON:16,DARK:17,FAIRY:18,UNKNOWN:10001,SHADOW:10002},P={REST:`https://pokeapi.co/api/v2`,SPRITES:`https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites`},F={JA_HRKT:1,JA_ROMA:2,KO:3,ZH_HANT:4,FR:5,DE:6,ES:7,IT:8,EN:9,CS:10,JA:11,ZH_HANS:12,PT_BR:13,ES_419:14};var ie=t({BASE_URL:()=>P,BERRIES:()=>n,BERRY_FIRMNESSES:()=>r,BERRY_FLAVORS:()=>i,CONTEST_TYPES:()=>a,CURRENCIES:()=>o,EGG_GROUPS:()=>w,ENCOUNTER_CONDITIONS:()=>c,ENCOUNTER_CONDITION_VALUES:()=>l,ENCOUNTER_METHODS:()=>s,ENDPOINTS:()=>u,EVOLUTION_TRIGGERS:()=>d,GENDERS:()=>T,GENERATIONS:()=>f,GROWTH_RATES:()=>E,ITEM_ATTRIBUTES:()=>g,ITEM_CATEGORIES:()=>ee,ITEM_FLING_EFFECTS:()=>te,ITEM_POCKETS:()=>ne,LANGUAGES:()=>F,MOVE_AILMENTS:()=>y,MOVE_BATTLE_STYLES:()=>b,MOVE_CATEGORIES:()=>re,MOVE_DAMAGE_CLASSES:()=>x,MOVE_LEARN_METHODS:()=>S,MOVE_TARGETS:()=>C,NATURES:()=>D,PAL_PARK_AREAS:()=>v,POKEATHLON_STATS:()=>O,POKEDEXES:()=>p,POKEMON_COLORS:()=>k,POKEMON_HABITATS:()=>A,POKEMON_SHAPES:()=>j,REGIONS:()=>_,STATS:()=>M,TYPES:()=>N,VERSIONS:()=>m,VERSION_GROUPS:()=>h});const I=3e5,L=(e,t)=>e!==void 0&&Number.isFinite(e)?Math.max(Math.floor(e),0):t;var R=class{entries=new Map;ttl;maxEntries;constructor(e){this.ttl=e?.ttl??I,this.maxEntries=L(e?.maxEntries,500)}get(e){let t=this.entries.get(e);if(t){if(t.expiresAt<=Date.now()){this.entries.delete(e);return}return this.entries.delete(e),this.entries.set(e,t),t.value}}set(e,t){if(this.entries.delete(e),this.maxEntries!==0){if(this.entries.size>=this.maxEntries){let e=this.entries.keys().next();e.done||this.entries.delete(e.value)}this.entries.set(e,{value:t,expiresAt:Date.now()+this.ttl})}}delete(e){this.entries.delete(e)}clear(){this.entries.clear()}},z=class{entries=new Map;maxEntries;constructor(e){this.maxEntries=L(e?.maxEntries,500)}get(e){let t=this.entries.get(e);if(t)return this.entries.delete(e),this.entries.set(e,t),t}set(e,t){if(this.entries.delete(e),this.maxEntries!==0){if(this.entries.size>=this.maxEntries){let e=this.entries.keys().next();e.done||this.entries.delete(e.value)}this.entries.set(e,t)}}clear(){this.entries.clear()}},ae=class{storage;ttl;prefix;constructor(e){this.storage=e.storage,this.ttl=e.ttl??I,this.prefix=e.prefix??`pokenode:`}async get(e){let t=await this.read(this.prefix+e);if(t){if(t.expiresAt<=Date.now()){await this.remove(this.prefix+e);return}return t.value}}async set(e,t){let n=JSON.stringify({value:t,expiresAt:Date.now()+this.ttl});try{await this.storage.setItem(this.prefix+e,n)}catch{await this.evict();try{await this.storage.setItem(this.prefix+e,n)}catch{return}}}async delete(e){await this.storage.removeItem(this.prefix+e)}async clear(){for(let e of await this.ownKeys())await this.remove(e)}async read(e){let t;try{t=await this.storage.getItem(e)}catch{return}if(t!==null)try{return JSON.parse(t)}catch{await this.remove(e);return}}async evict(){let e=await this.ownKeys(),t=await Promise.all(e.map(async e=>({key:e,expiresAt:(await this.read(e))?.expiresAt}))),n=Date.now(),r=t.filter(({expiresAt:e})=>e===void 0||e<=n);if(r.length>0){for(let{key:e}of r)await this.remove(e);return}let i=t.sort((e,t)=>(e.expiresAt??0)-(t.expiresAt??0));for(let{key:e}of i.slice(0,Math.ceil(i.length/4)))await this.remove(e)}async ownKeys(){return(await this.allKeys()).filter(e=>e.startsWith(this.prefix))}async allKeys(){try{if(this.storage.getAllKeys!==void 0)return[...await this.storage.getAllKeys()];let{key:e,length:t}=this.storage;if(e===void 0||t===void 0)return[];let n=[];for(let r=0;r<t;r+=1){let t=e.call(this.storage,r);t!==null&&n.push(t)}return n}catch{return[]}}async remove(e){try{await this.storage.removeItem(e)}catch{}}};const B=`pokenode:http`;var V=class extends Error{name=`PokenodeError`;kind=B;status;statusText;url;body;constructor(e,t,n){super(n??`Request to ${e.url} failed with status ${e.status}`),this.status=e.status,this.statusText=e.statusText,this.url=e.url,this.body=t}static isPokenodeError(e){return typeof e==`object`&&!!e&&`kind`in e&&e.kind===B}};const H=async(e,t)=>{let n;try{n=await e.json()}catch{n=void 0}return new V(e,n,t)},U=e=>({msg:e,message:e}),oe={debug(e){if(e.event===`request`){console.log(`[ Request Config ] ${e.method} | ${e.url}`);return}if(e.event===`retry`){console.log(`[ Retry ] ATTEMPT ${e.attempt} | STATUS ${e.status??`NONE`} | IN ${e.delayMs.toFixed(0)}ms | ${e.url}`);return}if(e.event===`cancelled`){console.log(`[ Cancelled ] ${e.url} | AFTER ${e.durationMs.toFixed(1)}ms`);return}console.log(`[ Response ] STATUS ${e.status} | ${e.source.toUpperCase()} | ${e.durationMs.toFixed(1)}ms`)},error({url:e,err:t}){let{name:n,message:r}=t instanceof Error?t:{name:`UNKNOWN`,message:String(t)};console.error(`[ Response Error ] ${e} | CODE ${n} | ${r}`)}};var se=class{requests=new Map;async share(e,t,n){let r=this.requests.get(e),i=r??this.dispatch(e,t,n);return{value:await this.join(e,i,t),joined:r!==void 0}}dispatch(e,t,n){let r=t?new AbortController:void 0,i={promise:n(r?.signal),controller:r,waiters:0};return i.promise=i.promise.finally(()=>this.release(e,i)),i.promise.catch(()=>{}),this.requests.set(e,i),i}release(e,t){this.requests.get(e)===t&&this.requests.delete(e)}join(e,t,n){return t.waiters+=1,n?new Promise((r,i)=>{let a=()=>{--t.waiters,!(t.waiters>0)&&(this.release(e,t),t.controller?.abort(n.reason))};if(n.aborted){a(),i(n.reason);return}let o=()=>{a(),i(n.reason)};n.addEventListener(`abort`,o,{once:!0}),t.promise.then(e=>{n.removeEventListener(`abort`,o),r(e)},e=>{n.removeEventListener(`abort`,o),i(e)})}):t.promise}};const W=async(e,t,n)=>{let r=Array(e.length),i=0,a=!1,o=async()=>{for(;i<e.length&&!a;){let t=i;i+=1;try{r[t]=await n(e[t])}catch(e){throw a=!0,e}}},s=Number.isFinite(t)?t:4,c=Array.from({length:Math.min(Math.max(s,1),e.length)},()=>o());return await Promise.all(c),r};async function*ce(e,t,n){let r=n?.pageSize??20,i=n?.concurrency??4,a=0;for(;;){let o=await e(a,r);if(o.results.length===0||(n?.resolve?yield*await W(o.results,i,t):yield*o.results,a+=o.results.length,o.results.length<r||a>=o.count))return}}const G=5e3,le=[429,500,502,503,504],ue=e=>{if(!e)return 1;let t=e.attempts??3;return Number.isFinite(t)?Math.max(Math.floor(t),1):3},K=(e,t)=>e!==void 0&&Number.isFinite(e)?Math.max(e,0):t,de=e=>{if(e===null)return;let t=e.trim();if(t===``)return;let n=Number(t);if(Number.isFinite(n))return Math.max(n,0)*1e3;let r=Date.parse(t);return Number.isNaN(r)?void 0:Math.max(r-Date.now(),0)},q=(e,t)=>t?.aborted===!0||e instanceof Error&&(e.name===`AbortError`||e.name===`TimeoutError`),fe=(e,t)=>new Promise((n,r)=>{if(t?.aborted){r(t.reason);return}let i=setTimeout(()=>{t?.removeEventListener(`abort`,a),n()},e);i.unref?.();let a=()=>{clearTimeout(i),r(t?.reason)};t?.addEventListener(`abort`,a,{once:!0})}),pe=async(e,t,n)=>{let r=n?.statuses??le,i=K(n?.maxDelay,G);if(t||!r.includes(e.status))throw await H(e);let a=de(e.headers.get(`Retry-After`));if(a!==void 0&&a>i)throw await H(e);return a},J=async e=>{let{url:t,attempt:n,status:r,retryAfter:i,signal:a,retry:o,logger:s}=e,c=K(o?.initialDelay,300),l=K(o?.maxDelay,G),u=Math.min(c*2**(n-1),l),d=i??u/2+u/2*Math.random();s?.debug({event:`retry`,...U(`pokeapi request failed, retrying`),url:t,attempt:n,delayMs:d,...r===void 0?{}:{status:r}}),await fe(d,a)},Y=e=>{let t=e.length;for(;t>0&&e[t-1]===`/`;)--t;return e.slice(0,t)},me=(e,t,n)=>`${e}?${new URLSearchParams({offset:String(t),limit:String(n)})}`,he=e=>{let t=e.indexOf(`?`);return t===-1?Y(e):Y(e.slice(0,t))+e.slice(t)},ge=/^v\d+$/,X=e=>{try{return decodeURIComponent(e)}catch{return e}},_e=(e,t)=>{let n=`${X(e)}:${X(t)}`,r=new TextEncoder().encode(n),i=``;for(let e of r)i+=String.fromCodePoint(e);return`Basic ${btoa(i)}`},ve=e=>{if(!e.includes(`@`))return{url:e,authorization:void 0};let t;try{t=new URL(e)}catch{return{url:e,authorization:void 0}}if(!t.username&&!t.password)return{url:e,authorization:void 0};let n=_e(t.username,t.password);return t.username=``,t.password=``,{url:t.toString(),authorization:n}},ye=(e,t)=>{let n=new URL(e),r=new URL(t),i=Y(r.pathname);if(n.origin===r.origin&&(n.pathname===i||n.pathname.startsWith(`${i}/`)))return`${n.pathname.slice(i.length)}${n.search}`;let a=n.pathname.split(`/`),o=a.findIndex(e=>ge.test(e));if(o===-1)throw TypeError(`Cannot resolve "${e}" against the base URL "${t}"`);return`/${a.slice(o+1).join(`/`)}${n.search}`},be=(e,t)=>e?`in-flight`:t===!0?`revalidated`:`network`,xe=e=>{if(e)return e===!0?new z:e};var Z=class e{config;state;scope;constructor(e,t,n={}){this.config=e,this.state=t,this.scope=n}static create(t){return new e({baseURL:Y(t?.baseURL??P.REST),fetch:t?.fetch??((e,t)=>globalThis.fetch(e,t)),logger:t?.logger,retry:t?.retry},{cache:t?.cache===!1?void 0:t?.cache??new R,etags:xe(t?.revalidate),inFlight:new se})}get cache(){return this.state.cache}with(t){return new e(this.config,this.state,{...this.scope,...t})}async clear(){await this.state.cache?.clear?.(),this.state.etags?.clear()}async resource(e,...t){let n=t.map(e=>encodeURIComponent(e)).join(`/`);return this.request(n===``?e:`${e}/${n}`)}async byURL(e,t=this.config.baseURL){let n=typeof e==`string`?e:e.url;return this.request(ye(n,t),t)}async list(e,t=0,n=20){return this.request(me(e,t,n))}async resolveAll(e,t=4){return W(e,t,e=>this.byURL(e))}walk(e,t){return ce(e,e=>this.byURL(e),t)}async request(e,t=this.config.baseURL){let n=e.startsWith(`/`)?e:`/${e}`,{url:r,authorization:i}=ve(he(`${Y(t)}${n}`)),a=performance.now();this.config.logger?.debug({event:`request`,...U(`pokeapi request`),method:`GET`,url:r});let o=this.requestSignal();try{if(o?.aborted)throw o.reason;let e=await this.state.cache?.get(r);if(e!==void 0)return this.logResponse(r,200,`cache`,a),e;let{value:t,joined:n}=await this.state.inFlight.share(r,o,e=>this.fetchResource(r,i,e));return this.logResponse(r,t.status,be(n,t.revalidated),a),t.data}catch(e){throw q(e,o)?(this.config.logger?.debug({event:`cancelled`,...U(`pokeapi request cancelled`),url:r,reason:e,durationMs:performance.now()-a}),e):(this.config.logger?.error({event:`error`,...U(`pokeapi request failed`),url:r,err:e,error:e}),e)}}requestSignal(){let{signal:e,timeout:t}=this.scope;if(t===void 0)return e;let n=AbortSignal.timeout(t);return e?AbortSignal.any([e,n]):n}async fetchResource(e,t,n){let r=this.state.etags?.get(e),i={Accept:`application/json`,...t===void 0?{}:{Authorization:t},...r===void 0?{}:{"If-None-Match":r.etag}},a=n?{headers:i,signal:n}:{headers:i},{retry:o,logger:s}=this.config,c=ue(o);for(let t=1;;t+=1){let i=t>=c,l;try{l=await this.config.fetch(e,a)}catch(r){if(i||q(r,n))throw r;await J({url:e,attempt:t,status:void 0,retryAfter:void 0,signal:n,retry:o,logger:s});continue}let u=await this.resolveResponse(e,l,r);if(u!==void 0)return u;let d=await pe(l,i,o);l.body?.cancel().catch(()=>{}),await J({url:e,attempt:t,status:l.status,retryAfter:d,signal:n,retry:o,logger:s})}}async resolveResponse(e,t,n){if(t.status===304){if(n===void 0)throw await H(t,`Request to ${t.url} was answered 304, but this client holds no response to reuse`);let r=t.headers.get(`ETag`);return r!==null&&r!==n.etag&&this.state.etags?.set(e,{etag:r,value:n.value}),await this.state.cache?.set(e,n.value),{data:n.value,status:t.status,revalidated:!0}}if(!t.ok)return;let r=await t.json(),i=t.headers.get(`ETag`);return i!==null&&this.state.etags?.set(e,{etag:i,value:r}),await this.state.cache?.set(e,r),{data:r,status:t.status}}logResponse(e,t,n,r){this.config.logger?.debug({event:`response`,...U(`pokeapi response`),url:e,status:t,source:n,durationMs:performance.now()-r})}},Se=class{#e;constructor(e){this.#e=e instanceof Z?e:Z.create(e)}get cache(){return this.#e.cache}with(e){let t=this.constructor;return new t(this.#e.with(e))}async clearCache(){await this.#e.clear()}async resolve(e){return this.#e.byURL(e)}async resolveAll(e,t){return this.#e.resolveAll(e,t?.concurrency)}async getResource(e,...t){return this.#e.resource(e,...t)}async getResourceByURL(e,t){return this.#e.byURL(e,t)}async getListResource(e,t,n){return this.#e.list(e,t,n)}async getUnnamedListResource(e,t,n){return this.#e.list(e,t,n)}walk(e,t){return this.#e.walk(e,t)}},Q=class extends Se{paginate(e,t){let n=typeof e==`function`?e:(t,n)=>this[e](t,n);return this.walk(n,t)}},Ce=class extends Q{async getBerryByName(e){return this.getResource(u.BERRY,e)}async getBerryById(e){return this.getResource(u.BERRY,e)}async getBerryFirmnessById(e){return this.getResource(u.BERRY_FIRMNESS,e)}async getBerryFirmnessByName(e){return this.getResource(u.BERRY_FIRMNESS,e)}async getBerryFlavorById(e){return this.getResource(u.BERRY_FLAVOR,e)}async getBerryFlavorByName(e){return this.getResource(u.BERRY_FLAVOR,e)}async listBerries(e,t){return this.getListResource(u.BERRY,e,t)}async listBerryFirmnesses(e,t){return this.getListResource(u.BERRY_FIRMNESS,e,t)}async listBerryFlavors(e,t){return this.getListResource(u.BERRY_FLAVOR,e,t)}},we=class extends Q{async getContestTypeByName(e){return this.getResource(u.CONTEST_TYPE,e)}async getContestTypeById(e){return this.getResource(u.CONTEST_TYPE,e)}async getContestEffectById(e){return this.getResource(u.CONTEST_EFFECT,e)}async getSuperContestEffectById(e){return this.getResource(u.SUPER_CONTEST_EFFECT,e)}async listContestTypes(e,t){return this.getListResource(u.CONTEST_TYPE,e,t)}async listContestEffects(e,t){return this.getUnnamedListResource(u.CONTEST_EFFECT,e,t)}async listSuperContestEffects(e,t){return this.getUnnamedListResource(u.SUPER_CONTEST_EFFECT,e,t)}},Te=class extends Q{async getCurrencyByName(e){return this.getResource(u.CURRENCY,e)}async getCurrencyById(e){return this.getResource(u.CURRENCY,e)}async listCurrencies(e,t){return this.getListResource(u.CURRENCY,e,t)}},Ee=class extends Q{async getEncounterMethodByName(e){return this.getResource(u.ENCOUNTER_METHOD,e)}async getEncounterMethodById(e){return this.getResource(u.ENCOUNTER_METHOD,e)}async getEncounterConditionById(e){return this.getResource(u.ENCOUNTER_CONDITION,e)}async getEncounterConditionByName(e){return this.getResource(u.ENCOUNTER_CONDITION,e)}async getEncounterConditionValueByName(e){return this.getResource(u.ENCOUNTER_CONDITION_VALUE,e)}async getEncounterConditionValueById(e){return this.getResource(u.ENCOUNTER_CONDITION_VALUE,e)}async listEncounterMethods(e,t){return this.getListResource(u.ENCOUNTER_METHOD,e,t)}async listEncounterConditions(e,t){return this.getListResource(u.ENCOUNTER_CONDITION,e,t)}async listEncounterConditionValues(e,t){return this.getListResource(u.ENCOUNTER_CONDITION_VALUE,e,t)}},De=class extends Q{async getEvolutionChainById(e){return this.getResource(u.EVOLUTION_CHAIN,e)}async getEvolutionTriggerById(e){return this.getResource(u.EVOLUTION_TRIGGER,e)}async getEvolutionTriggerByName(e){return this.getResource(u.EVOLUTION_TRIGGER,e)}async listEvolutionChains(e,t){return this.getUnnamedListResource(u.EVOLUTION_CHAIN,e,t)}async listEvolutionTriggers(e,t){return this.getListResource(u.EVOLUTION_TRIGGER,e,t)}},$=class extends Q{async getGenerationByName(e){return this.getResource(u.GENERATION,e)}async getGenerationById(e){return this.getResource(u.GENERATION,e)}async getPokedexByName(e){return this.getResource(u.POKEDEX,e)}async getPokedexById(e){return this.getResource(u.POKEDEX,e)}async getVersionByName(e){return this.getResource(u.VERSION,e)}async getVersionById(e){return this.getResource(u.VERSION,e)}async getVersionGroupByName(e){return this.getResource(u.VERSION_GROUP,e)}async getVersionGroupById(e){return this.getResource(u.VERSION_GROUP,e)}async listGenerations(e,t){return this.getListResource(u.GENERATION,e,t)}async listPokedexes(e,t){return this.getListResource(u.POKEDEX,e,t)}async listVersions(e,t){return this.getListResource(u.VERSION,e,t)}async listVersionGroups(e,t){return this.getListResource(u.VERSION_GROUP,e,t)}},Oe=class extends Q{async getItemByName(e){return this.getResource(u.ITEM,e)}async getItemById(e){return this.getResource(u.ITEM,e)}async getItemAttributeByName(e){return this.getResource(u.ITEM_ATTRIBUTE,e)}async getItemAttributeById(e){return this.getResource(u.ITEM_ATTRIBUTE,e)}async getItemCategoryByName(e){return this.getResource(u.ITEM_CATEGORY,e)}async getItemCategoryById(e){return this.getResource(u.ITEM_CATEGORY,e)}async getItemFlingEffectByName(e){return this.getResource(u.ITEM_FLING_EFFECT,e)}async getItemFlingEffectById(e){return this.getResource(u.ITEM_FLING_EFFECT,e)}async getItemPocketByName(e){return this.getResource(u.ITEM_POCKET,e)}async getItemPocketById(e){return this.getResource(u.ITEM_POCKET,e)}async listItems(e,t){return this.getListResource(u.ITEM,e,t)}async listItemAttributes(e,t){return this.getListResource(u.ITEM_ATTRIBUTE,e,t)}async listItemCategories(e,t){return this.getListResource(u.ITEM_CATEGORY,e,t)}async listItemFlingEffects(e,t){return this.getListResource(u.ITEM_FLING_EFFECT,e,t)}async listItemPockets(e,t){return this.getListResource(u.ITEM_POCKET,e,t)}},ke=class extends Q{async getLocationByName(e){return this.getResource(u.LOCATION,e)}async getLocationById(e){return this.getResource(u.LOCATION,e)}async getLocationAreaByName(e){return this.getResource(u.LOCATION_AREA,e)}async getLocationAreaById(e){return this.getResource(u.LOCATION_AREA,e)}async getPalParkAreaByName(e){return this.getResource(u.PALPARK_AREA,e)}async getPalParkAreaById(e){return this.getResource(u.PALPARK_AREA,e)}async getRegionByName(e){return this.getResource(u.REGION,e)}async getRegionById(e){return this.getResource(u.REGION,e)}async listLocations(e,t){return this.getListResource(u.LOCATION,e,t)}async listLocationAreas(e,t){return this.getListResource(u.LOCATION_AREA,e,t)}async listPalParkAreas(e,t){return this.getListResource(u.PALPARK_AREA,e,t)}async listRegions(e,t){return this.getListResource(u.REGION,e,t)}},Ae=class extends Q{async getMachineById(e){return this.getResource(u.MACHINE,e)}async listMachines(e,t){return this.getUnnamedListResource(u.MACHINE,e,t)}},je=class extends Q{async getMoveByName(e){return this.getResource(u.MOVE,e)}async getMoveById(e){return this.getResource(u.MOVE,e)}async getMoveAilmentByName(e){return this.getResource(u.MOVE_AILMENT,e)}async getMoveAilmentById(e){return this.getResource(u.MOVE_AILMENT,e)}async getMoveBattleStyleByName(e){return this.getResource(u.MOVE_BATTLE_STYLE,e)}async getMoveBattleStyleById(e){return this.getResource(u.MOVE_BATTLE_STYLE,e)}async getMoveCategoryByName(e){return this.getResource(u.MOVE_CATEGORY,e)}async getMoveCategoryById(e){return this.getResource(u.MOVE_CATEGORY,e)}async getMoveDamageClassByName(e){return this.getResource(u.MOVE_DAMAGE_CLASS,e)}async getMoveDamageClassById(e){return this.getResource(u.MOVE_DAMAGE_CLASS,e)}async getMoveLearnMethodByName(e){return this.getResource(u.MOVE_LEARN_METHOD,e)}async getMoveLearnMethodById(e){return this.getResource(u.MOVE_LEARN_METHOD,e)}async getMoveTargetByName(e){return this.getResource(u.MOVE_TARGET,e)}async getMoveTargetById(e){return this.getResource(u.MOVE_TARGET,e)}async listMoves(e,t){return this.getListResource(u.MOVE,e,t)}async listMoveAilments(e,t){return this.getListResource(u.MOVE_AILMENT,e,t)}async listMoveBattleStyles(e,t){return this.getListResource(u.MOVE_BATTLE_STYLE,e,t)}async listMoveCategories(e,t){return this.getListResource(u.MOVE_CATEGORY,e,t)}async listMoveDamageClasses(e,t){return this.getListResource(u.MOVE_DAMAGE_CLASS,e,t)}async listMoveLearnMethods(e,t){return this.getListResource(u.MOVE_LEARN_METHOD,e,t)}async listMoveTargets(e,t){return this.getListResource(u.MOVE_TARGET,e,t)}},Me=class extends Q{async getAbilityByName(e){return this.getResource(u.ABILITY,e)}async getAbilityById(e){return this.getResource(u.ABILITY,e)}async getCharacteristicById(e){return this.getResource(u.CHARACTERISTIC,e)}async getEggGroupByName(e){return this.getResource(u.EGG_GROUP,e)}async getEggGroupById(e){return this.getResource(u.EGG_GROUP,e)}async getGenderByName(e){return this.getResource(u.GENDER,e)}async getGenderById(e){return this.getResource(u.GENDER,e)}async getGrowthRateByName(e){return this.getResource(u.GROWTH_RATE,e)}async getGrowthRateById(e){return this.getResource(u.GROWTH_RATE,e)}async getNatureByName(e){return this.getResource(u.NATURE,e)}async getNatureById(e){return this.getResource(u.NATURE,e)}async getPokeathlonStatByName(e){return this.getResource(u.POKEATHLON_STAT,e)}async getPokeathlonStatById(e){return this.getResource(u.POKEATHLON_STAT,e)}async getPokemonByName(e){return this.getResource(u.POKEMON,e)}async getPokemonById(e){return this.getResource(u.POKEMON,e)}async getPokemonLocationAreaById(e){return this.getResource(u.POKEMON,e,`encounters`)}async getPokemonColorByName(e){return this.getResource(u.POKEMON_COLOR,e)}async getPokemonColorById(e){return this.getResource(u.POKEMON_COLOR,e)}async getPokemonFormByName(e){return this.getResource(u.POKEMON_FORM,e)}async getPokemonFormById(e){return this.getResource(u.POKEMON_FORM,e)}async getPokemonHabitatByName(e){return this.getResource(u.POKEMON_HABITAT,e)}async getPokemonHabitatById(e){return this.getResource(u.POKEMON_HABITAT,e)}async getPokemonShapeByName(e){return this.getResource(u.POKEMON_SHAPE,e)}async getPokemonShapeById(e){return this.getResource(u.POKEMON_SHAPE,e)}async getPokemonSpeciesByName(e){return this.getResource(u.POKEMON_SPECIES,e)}async getPokemonSpeciesById(e){return this.getResource(u.POKEMON_SPECIES,e)}async getStatByName(e){return this.getResource(u.STAT,e)}async getStatById(e){return this.getResource(u.STAT,e)}async getTypeByName(e){return this.getResource(u.TYPE,e)}async getTypeById(e){return this.getResource(u.TYPE,e)}async listAbilities(e,t){return this.getListResource(u.ABILITY,e,t)}async listCharacteristics(e,t){return this.getUnnamedListResource(u.CHARACTERISTIC,e,t)}async listEggGroups(e,t){return this.getListResource(u.EGG_GROUP,e,t)}async listGenders(e,t){return this.getListResource(u.GENDER,e,t)}async listGrowthRates(e,t){return this.getListResource(u.GROWTH_RATE,e,t)}async listNatures(e,t){return this.getListResource(u.NATURE,e,t)}async listPokeathlonStats(e,t){return this.getListResource(u.POKEATHLON_STAT,e,t)}async listPokemons(e,t){return this.getListResource(u.POKEMON,e,t)}async listPokemonColors(e,t){return this.getListResource(u.POKEMON_COLOR,e,t)}async listPokemonForms(e,t){return this.getListResource(u.POKEMON_FORM,e,t)}async listPokemonHabitats(e,t){return this.getListResource(u.POKEMON_HABITAT,e,t)}async listPokemonShapes(e,t){return this.getListResource(u.POKEMON_SHAPE,e,t)}async listPokemonSpecies(e,t){return this.getListResource(u.POKEMON_SPECIES,e,t)}async listStats(e,t){return this.getListResource(u.STAT,e,t)}async listTypes(e,t){return this.getListResource(u.TYPE,e,t)}},Ne=class extends Q{async getLanguageById(e){return this.getResource(u.LANGUAGE,e)}async getLanguageByName(e){return this.getResource(u.LANGUAGE,e)}async getResourceByUrl(e){return this.resolve(e)}listLanguages(e,t){return this.getListResource(u.LANGUAGE,e,t)}},Pe=class extends Se{berry;contest;currency;encounter;evolution;game;item;location;machine;move;pokemon;utility;constructor(e){let t=e instanceof Z?e:Z.create(e);super(t),this.berry=new Ce(t),this.contest=new we(t),this.currency=new Te(t),this.encounter=new Ee(t),this.evolution=new De(t),this.game=new $(t),this.item=new Oe(t),this.location=new ke(t),this.machine=new Ae(t),this.move=new je(t),this.pokemon=new Me(t),this.utility=new Ne(t)}};const Fe=(e,t=`en`)=>{let n=t.toLowerCase();return e.find(e=>e.language.name.toLowerCase()===n)},Ie={default:{directory:``,extension:`png`},"official-artwork":{directory:`other/official-artwork`,extension:`png`},home:{directory:`other/home`,extension:`png`},"dream-world":{directory:`other/dream-world`,extension:`svg`},showdown:{directory:`other/showdown`,extension:`gif`}},Le=(e,t={})=>{let{variant:n=`default`,shiny:r=!1,back:i=!1,female:a=!1}=t,{directory:o,extension:s}=Ie[n],c=[o,i&&`back`,r&&`shiny`,a&&`female`];return[P.SPRITES,`pokemon`,...c.filter(Boolean),`${e}.${s}`].join(`/`)};exports.BASE_URL=P,exports.BERRIES=n,exports.BERRY_FIRMNESSES=r,exports.BERRY_FLAVORS=i,exports.BerryClient=Ce,Object.defineProperty(exports,"CONSTANTS",{enumerable:!0,get:function(){return ie}}),exports.CONTEST_TYPES=a,exports.CURRENCIES=o,exports.ContestClient=we,exports.CurrencyClient=Te,exports.EGG_GROUPS=w,exports.ENCOUNTER_CONDITIONS=c,exports.ENCOUNTER_CONDITION_VALUES=l,exports.ENCOUNTER_METHODS=s,exports.ENDPOINTS=u,exports.EVOLUTION_TRIGGERS=d,exports.EncounterClient=Ee,exports.EtagStore=z,exports.EvolutionClient=De,exports.GENDERS=T,exports.GENERATIONS=f,exports.GROWTH_RATES=E,exports.GameClient=$,exports.ITEM_ATTRIBUTES=g,exports.ITEM_CATEGORIES=ee,exports.ITEM_FLING_EFFECTS=te,exports.ITEM_POCKETS=ne,exports.ItemClient=Oe,exports.LANGUAGES=F,exports.LocationClient=ke,exports.MOVE_AILMENTS=y,exports.MOVE_BATTLE_STYLES=b,exports.MOVE_CATEGORIES=re,exports.MOVE_DAMAGE_CLASSES=x,exports.MOVE_LEARN_METHODS=S,exports.MOVE_TARGETS=C,exports.MachineClient=Ae,exports.MainClient=Pe,exports.MemoryCache=R,exports.MoveClient=je,exports.NATURES=D,exports.PAL_PARK_AREAS=v,exports.POKEATHLON_STATS=O,exports.POKEDEXES=p,exports.POKEMON_COLORS=k,exports.POKEMON_HABITATS=A,exports.POKEMON_SHAPES=j,exports.PokemonClient=Me,exports.PokenodeError=V,exports.REGIONS=_,exports.STATS=M,exports.TYPES=N,exports.UtilityClient=Ne,exports.VERSIONS=m,exports.VERSION_GROUPS=h,exports.WebStorageCache=ae,exports.consoleLogger=oe,exports.getPokemonSpriteUrl=Le,exports.localize=Fe;
2
17
  //# sourceMappingURL=index.cjs.map