local ____lualib = require("lualib_bundle")
local __TS__New = ____lualib.__TS__New
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
local __TS__Spread = ____lualib.__TS__Spread
local Set = ____lualib.Set
local __TS__Iterator = ____lualib.__TS__Iterator
local ____exports = {}
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
local BossID = ____isaac_2Dtypescript_2Ddefinitions.BossID
local LevelStage = ____isaac_2Dtypescript_2Ddefinitions.LevelStage
local StageID = ____isaac_2Dtypescript_2Ddefinitions.StageID
local ____cachedEnumValues = require("arrays.cachedEnumValues")
local BOSS_ID_VALUES = ____cachedEnumValues.BOSS_ID_VALUES
local ____set = require("functions.set")
local combineSets = ____set.combineSets
local ____storyBosses = require("functions.storyBosses")
local isStoryBossID = ____storyBosses.isStoryBossID
local ____ReadonlyMap = require("types.ReadonlyMap")
local ReadonlyMap = ____ReadonlyMap.ReadonlyMap
local ____ReadonlySet = require("types.ReadonlySet")
local ReadonlySet = ____ReadonlySet.ReadonlySet
--- For `StageID.BASEMENT` (1).
local BASEMENT_BOSSES_SET = __TS__New(ReadonlySet, {
    BossID.MONSTRO,
    BossID.LARRY_JR,
    BossID.FAMINE,
    BossID.DUKE_OF_FLIES,
    BossID.GEMINI,
    BossID.STEVEN,
    BossID.HEADLESS_HORSEMAN,
    BossID.FALLEN,
    BossID.DINGLE,
    BossID.GURGLING,
    BossID.LITTLE_HORN,
    BossID.DANGLE,
    BossID.TURDLING,
    BossID.BABY_PLUM
})
--- For `StageID.CELLAR` (2).
local CELLAR_BOSSES_SET = __TS__New(ReadonlySet, {
    BossID.FAMINE,
    BossID.DUKE_OF_FLIES,
    BossID.HEADLESS_HORSEMAN,
    BossID.FALLEN,
    BossID.BLIGHTED_OVUM,
    BossID.WIDOW,
    BossID.PIN,
    BossID.HAUNT,
    BossID.LITTLE_HORN,
    BossID.RAG_MAN,
    BossID.BABY_PLUM
})
--- For `StageID.BURNING_BASEMENT` (3).
local BURNING_BASEMENT_BOSSES_SET = __TS__New(ReadonlySet, {
    BossID.MONSTRO,
    BossID.LARRY_JR,
    BossID.FAMINE,
    BossID.DUKE_OF_FLIES,
    BossID.GEMINI,
    BossID.STEVEN,
    BossID.HEADLESS_HORSEMAN,
    BossID.FALLEN,
    BossID.DINGLE,
    BossID.GURGLING,
    BossID.LITTLE_HORN,
    BossID.RAG_MAN,
    BossID.DANGLE,
    BossID.TURDLING,
    BossID.BABY_PLUM
})
--- For `StageID.DOWNPOUR` (27).
local DOWNPOUR_BOSSES_SET = __TS__New(ReadonlySet, {BossID.LIL_BLUB, BossID.WORMWOOD, BossID.RAINMAKER, BossID.MIN_MIN})
--- For `StageID.DROSS` (28).
local DROSS_BOSSES_SET = __TS__New(ReadonlySet, {
    BossID.LIL_BLUB,
    BossID.WORMWOOD,
    BossID.CLOG,
    BossID.COLOSTOMIA,
    BossID.TURDLET
})
--- The set of unique bosses for Basement, Cellar, Burning Basement, Downpour, and Dross.
local ALL_BASEMENT_BOSSES_SET = combineSets(
    nil,
    BASEMENT_BOSSES_SET,
    CELLAR_BOSSES_SET,
    BURNING_BASEMENT_BOSSES_SET,
    DOWNPOUR_BOSSES_SET,
    DROSS_BOSSES_SET
)
--- For `StageID.CAVES` (4).
local CAVES_BOSSES_SET = __TS__New(ReadonlySet, {
    BossID.CHUB,
    BossID.GURDY,
    BossID.PESTILENCE,
    BossID.PEEP,
    BossID.FISTULA,
    BossID.CHAD,
    BossID.HEADLESS_HORSEMAN,
    BossID.GURDY_JR,
    BossID.MEGA_FATTY,
    BossID.MEGA_MAW,
    BossID.FALLEN,
    BossID.STAIN,
    BossID.RAG_MEGA,
    BossID.BIG_HORN,
    BossID.BUMBINO
})
--- For `StageID.CATACOMBS` (5).
local CATACOMBS_BOSSES_SET = __TS__New(ReadonlySet, {
    BossID.PESTILENCE,
    BossID.PEEP,
    BossID.HEADLESS_HORSEMAN,
    BossID.FALLEN,
    BossID.HOLLOW,
    BossID.CARRION_QUEEN,
    BossID.GURDY_JR,
    BossID.HUSK,
    BossID.WRETCHED,
    BossID.DARK_ONE,
    BossID.POLYCEPHALUS,
    BossID.FORSAKEN,
    BossID.FRAIL,
    BossID.RAG_MEGA,
    BossID.BIG_HORN,
    BossID.BUMBINO
})
--- For `StageID.FLOODED_CAVES` (6).
local FLOODED_CAVES_BOSSES_SET = __TS__New(ReadonlySet, {
    BossID.CHUB,
    BossID.GURDY,
    BossID.PESTILENCE,
    BossID.PEEP,
    BossID.FISTULA,
    BossID.CHAD,
    BossID.HEADLESS_HORSEMAN,
    BossID.FALLEN,
    BossID.GURDY_JR,
    BossID.MEGA_MAW,
    BossID.MEGA_FATTY,
    BossID.STAIN,
    BossID.FORSAKEN,
    BossID.FRAIL,
    BossID.RAG_MEGA,
    BossID.BIG_HORN,
    BossID.BUMBINO
})
--- For `StageID.MINES` (29).
local MINES_BOSSES_SET = __TS__New(ReadonlySet, {BossID.REAP_CREEP, BossID.TUFF_TWINS, BossID.HORNFEL, BossID.GREAT_GIDEON})
--- For `StageID.ASHPIT` (30).
local ASHPIT_BOSSES_SET = __TS__New(ReadonlySet, {
    BossID.PILE,
    BossID.GREAT_GIDEON,
    BossID.SINGE,
    BossID.SHELL,
    BossID.CLUTCH
})
--- The set of unique bosses for Caves, Catacombs, Flooded Caves, Mines, and Ashpit.
local ALL_CAVES_BOSSES_SET = combineSets(
    nil,
    CAVES_BOSSES_SET,
    CATACOMBS_BOSSES_SET,
    FLOODED_CAVES_BOSSES_SET,
    MINES_BOSSES_SET,
    ASHPIT_BOSSES_SET
)
--- For `StageID.DEPTHS` (7).
-- 
-- Note that this set includes Mom, even though they are not technically in the boss pool.
local DEPTHS_BOSSES_SET = __TS__New(ReadonlySet, {
    BossID.MONSTRO_2,
    BossID.MOM,
    BossID.WAR,
    BossID.LOKI,
    BossID.GISH,
    BossID.HEADLESS_HORSEMAN,
    BossID.FALLEN,
    BossID.GATE,
    BossID.CAGE,
    BossID.BROWNIE,
    BossID.SISTERS_VIS,
    BossID.REAP_CREEP
})
--- For `StageID.NECROPOLIS` (8).
-- 
-- Note that this set includes Mom, even though they are not technically in the boss pool.
local NECROPOLIS_BOSSES_SET = __TS__New(ReadonlySet, {
    BossID.MOM,
    BossID.WAR,
    BossID.LOKI,
    BossID.HEADLESS_HORSEMAN,
    BossID.FALLEN,
    BossID.BLOAT,
    BossID.MASK_OF_INFAMY,
    BossID.ADVERSARY,
    BossID.BROWNIE,
    BossID.SISTERS_VIS,
    BossID.PILE
})
--- For `StageID.DANK_DEPTHS` (9).
-- 
-- Note that this set includes Mom, even though they are not technically in the boss pool.
local DANK_DEPTHS_BOSSES_SET = __TS__New(ReadonlySet, {
    BossID.MONSTRO_2,
    BossID.MOM,
    BossID.WAR,
    BossID.LOKI,
    BossID.GISH,
    BossID.HEADLESS_HORSEMAN,
    BossID.FALLEN,
    BossID.GATE,
    BossID.CAGE,
    BossID.BROWNIE,
    BossID.SISTERS_VIS,
    BossID.REAP_CREEP
})
--- For `StageID.MAUSOLEUM` (31).
-- 
-- Note that this set includes Mausoleum Mom, even though they are not technically in the boss pool.
local MAUSOLEUM_BOSSES_SET = __TS__New(ReadonlySet, {BossID.SIREN, BossID.HERETIC, BossID.MAUSOLEUM_MOM})
--- For `StageID.GEHENNA` (32).
-- 
-- Note that this set includes Mausoleum Mom, even though they are not technically in the boss pool.
local GEHENNA_BOSSES_SET = __TS__New(ReadonlySet, {BossID.VISAGE, BossID.MAUSOLEUM_MOM, BossID.HORNY_BOYS})
--- The set of unique bosses for Depths, Necropolis, Dank Depths, Mausoleum, and Gehenna.
local ALL_DEPTHS_BOSSES_SET = combineSets(
    nil,
    DEPTHS_BOSSES_SET,
    NECROPOLIS_BOSSES_SET,
    DANK_DEPTHS_BOSSES_SET,
    MAUSOLEUM_BOSSES_SET,
    GEHENNA_BOSSES_SET
)
--- For `StageID.WOMB` (10).
-- 
-- Note that this set includes Mom's Heart & It Lives, even though they are not technically in the
-- boss pool.
local WOMB_BOSSES_SET = __TS__New(ReadonlySet, {
    BossID.SCOLEX,
    BossID.MOMS_HEART,
    BossID.DEATH,
    BossID.BLASTOCYST,
    BossID.HEADLESS_HORSEMAN,
    BossID.FALLEN,
    BossID.IT_LIVES,
    BossID.LOKII,
    BossID.CONQUEST,
    BossID.MAMA_GURDY,
    BossID.MR_FRED,
    BossID.MATRIARCH
})
--- For `StageID.UTERO` (11).
-- 
-- Note that this set includes Mom's Heart & It Lives, even though they are not technically in the
-- boss pool.
local UTERO_BOSSES_SET = __TS__New(ReadonlySet, {
    BossID.MOMS_HEART,
    BossID.DEATH,
    BossID.HEADLESS_HORSEMAN,
    BossID.FALLEN,
    BossID.IT_LIVES,
    BossID.BLOAT,
    BossID.LOKII,
    BossID.TERATOMA,
    BossID.CONQUEST,
    BossID.DADDY_LONG_LEGS,
    BossID.TRIACHNID
})
--- For `StageID.SCARRED_WOMB` (12).
-- 
-- Note that this set includes Mom's Heart & It Lives, even though they are not technically in the
-- boss pool.
local SCARRED_WOMB_BOSSES_SET = __TS__New(ReadonlySet, {
    BossID.SCOLEX,
    BossID.MOMS_HEART,
    BossID.DEATH,
    BossID.BLASTOCYST,
    BossID.HEADLESS_HORSEMAN,
    BossID.FALLEN,
    BossID.IT_LIVES,
    BossID.LOKII,
    BossID.CONQUEST,
    BossID.TRIACHNID,
    BossID.MAMA_GURDY,
    BossID.MR_FRED,
    BossID.MATRIARCH
})
--- For `StageID.CORPSE` (33).
-- 
-- Note that this set includes Mother, even though she is not technically in the boss pool.
local CORPSE_BOSSES_SET = __TS__New(ReadonlySet, {BossID.SCOURGE, BossID.CHIMERA, BossID.ROTGUT, BossID.MOTHER})
--- The set of unique bosses for Womb, Utero, Scarred Womb, and Corpse.
local ALL_WOMB_BOSSES_SET = combineSets(
    nil,
    WOMB_BOSSES_SET,
    UTERO_BOSSES_SET,
    SCARRED_WOMB_BOSSES_SET,
    CORPSE_BOSSES_SET
)
local BLUE_WOMB_BOSSES_SET = __TS__New(ReadonlySet, {BossID.HUSH})
local SHEOL_BOSSES_SET = __TS__New(ReadonlySet, {BossID.SATAN})
local CATHEDRAL_BOSSES_SET = __TS__New(ReadonlySet, {BossID.ISAAC})
local ALL_STAGE_10_BOSSES_SET = combineSets(nil, SHEOL_BOSSES_SET, CATHEDRAL_BOSSES_SET)
--- Note that this set includes Mega Satan, even though they are not technically in the boss pool.
local DARK_ROOM_BOSSES_SET = __TS__New(ReadonlySet, {BossID.LAMB, BossID.MEGA_SATAN})
--- Note that this set includes Mega Satan, even though they are not technically in the boss pool.
local CHEST_BOSSES_SET = __TS__New(ReadonlySet, {BossID.BLUE_BABY, BossID.MEGA_SATAN})
local ALL_STAGE_11_BOSSES_SET = combineSets(nil, DARK_ROOM_BOSSES_SET, CHEST_BOSSES_SET)
local VOID_BOSSES_SET = __TS__New(ReadonlySet, {BossID.DELIRIUM})
--- Includes Dogma and The Beast. Does not include Ultra Famine, Ultra Pestilence, Ultra War, and
-- Ultra Death (since they do not have boss IDs).
local HOME_BOSSES_SET = __TS__New(ReadonlySet, {BossID.DOGMA, BossID.BEAST})
____exports.STAGE_ID_TO_BOSS_SET_MAP = __TS__New(ReadonlyMap, {
    {StageID.BASEMENT, BASEMENT_BOSSES_SET},
    {StageID.CELLAR, CELLAR_BOSSES_SET},
    {StageID.BURNING_BASEMENT, BURNING_BASEMENT_BOSSES_SET},
    {StageID.DOWNPOUR, DOWNPOUR_BOSSES_SET},
    {StageID.DROSS, DROSS_BOSSES_SET},
    {StageID.CAVES, CAVES_BOSSES_SET},
    {StageID.CATACOMBS, CATACOMBS_BOSSES_SET},
    {StageID.FLOODED_CAVES, FLOODED_CAVES_BOSSES_SET},
    {StageID.MINES, MINES_BOSSES_SET},
    {StageID.ASHPIT, ASHPIT_BOSSES_SET},
    {StageID.DEPTHS, DEPTHS_BOSSES_SET},
    {StageID.NECROPOLIS, NECROPOLIS_BOSSES_SET},
    {StageID.DANK_DEPTHS, DANK_DEPTHS_BOSSES_SET},
    {StageID.MAUSOLEUM, MAUSOLEUM_BOSSES_SET},
    {StageID.GEHENNA, GEHENNA_BOSSES_SET},
    {StageID.WOMB, WOMB_BOSSES_SET},
    {StageID.UTERO, UTERO_BOSSES_SET},
    {StageID.SCARRED_WOMB, SCARRED_WOMB_BOSSES_SET},
    {StageID.CORPSE, CORPSE_BOSSES_SET},
    {StageID.BLUE_WOMB, BLUE_WOMB_BOSSES_SET},
    {StageID.SHEOL, SHEOL_BOSSES_SET},
    {StageID.CATHEDRAL, CATHEDRAL_BOSSES_SET},
    {StageID.DARK_ROOM, DARK_ROOM_BOSSES_SET},
    {StageID.CHEST, CHEST_BOSSES_SET},
    {StageID.VOID, VOID_BOSSES_SET},
    {StageID.HOME, HOME_BOSSES_SET}
})
____exports.STAGE_TO_COMBINED_BOSS_SET_MAP = __TS__New(ReadonlyMap, {
    {LevelStage.BASEMENT_1, ALL_BASEMENT_BOSSES_SET},
    {LevelStage.BASEMENT_2, ALL_BASEMENT_BOSSES_SET},
    {LevelStage.CAVES_1, ALL_CAVES_BOSSES_SET},
    {LevelStage.CAVES_2, ALL_CAVES_BOSSES_SET},
    {LevelStage.DEPTHS_1, ALL_DEPTHS_BOSSES_SET},
    {LevelStage.DEPTHS_2, ALL_DEPTHS_BOSSES_SET},
    {LevelStage.WOMB_1, ALL_WOMB_BOSSES_SET},
    {LevelStage.WOMB_2, ALL_WOMB_BOSSES_SET},
    {LevelStage.BLUE_WOMB, BLUE_WOMB_BOSSES_SET},
    {LevelStage.SHEOL_CATHEDRAL, ALL_STAGE_10_BOSSES_SET},
    {LevelStage.DARK_ROOM_CHEST, ALL_STAGE_11_BOSSES_SET},
    {LevelStage.VOID, VOID_BOSSES_SET},
    {LevelStage.HOME, HOME_BOSSES_SET}
})
____exports.ALL_BOSSES_SET = __TS__New(
    ReadonlySet,
    __TS__ArrayFilter(
        BOSS_ID_VALUES,
        function(____, bossID) return bossID ~= BossID.RAGLICH end
    )
)
____exports.ALL_BOSSES_EXCLUDING_STORY_BOSSES_SET = __TS__New(
    ReadonlySet,
    __TS__ArrayFilter(
        {__TS__Spread(____exports.ALL_BOSSES_SET)},
        function(____, bossID) return not isStoryBossID(nil, bossID) end
    )
)
____exports.BOSS_ID_TO_STAGE_IDS = (function()
    local partialBossIDsToStageIDs = {}
    for ____, bossID in ipairs(BOSS_ID_VALUES) do
        local stageIDs = __TS__New(Set)
        for ____, ____value in __TS__Iterator(____exports.STAGE_ID_TO_BOSS_SET_MAP) do
            local stageID = ____value[1]
            local bossSet = ____value[2]
            if bossSet:has(bossID) then
                stageIDs:add(stageID)
            end
        end
        partialBossIDsToStageIDs[bossID] = stageIDs
    end
    local bossIDsToStageIDs = partialBossIDsToStageIDs
    bossIDsToStageIDs[BossID.ULTRA_GREED]:add(StageID.ULTRA_GREED_GREED_MODE)
    bossIDsToStageIDs[BossID.ULTRA_GREEDIER]:add(StageID.ULTRA_GREED_GREED_MODE)
    bossIDsToStageIDs[BossID.MAUSOLEUM_MOMS_HEART]:add(StageID.MAUSOLEUM)
    bossIDsToStageIDs[BossID.MAUSOLEUM_MOMS_HEART]:add(StageID.GEHENNA)
    return bossIDsToStageIDs
end)(nil)
return ____exports
