local ____lualib = require("lualib_bundle")
local __TS__New = ____lualib.__TS__New
local __TS__Class = ____lualib.__TS__Class
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
local __TS__DecorateLegacy = ____lualib.__TS__DecorateLegacy
local __TS__ArrayAt = ____lualib.__TS__ArrayAt
local ____exports = {}
local ____decorators = require("decorators")
local Exported = ____decorators.Exported
local ____ModCallbackCustom = require("enums.ModCallbackCustom")
local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
local ____array = require("functions.array")
local arrayRemoveInPlace = ____array.arrayRemoveInPlace
local ____collectibles = require("functions.collectibles")
local isActiveCollectible = ____collectibles.isActiveCollectible
local ____playerDataStructures = require("functions.playerDataStructures")
local defaultMapGetPlayer = ____playerDataStructures.defaultMapGetPlayer
local ____DefaultMap = require("classes.DefaultMap")
local DefaultMap = ____DefaultMap.DefaultMap
local ____Feature = require("classes.private.Feature")
local Feature = ____Feature.Feature
local v = {run = {playersCollectibleTypes = __TS__New(
    DefaultMap,
    function() return {} end
)}}
____exports.PlayerCollectibleTracking = __TS__Class()
local PlayerCollectibleTracking = ____exports.PlayerCollectibleTracking
PlayerCollectibleTracking.name = "PlayerCollectibleTracking"
__TS__ClassExtends(PlayerCollectibleTracking, Feature)
function PlayerCollectibleTracking.prototype.____constructor(self)
    Feature.prototype.____constructor(self)
    self.v = v
    self.postPlayerCollectibleAdded = function(____, player, collectibleType)
        local collectibleTypes = defaultMapGetPlayer(nil, v.run.playersCollectibleTypes, player, player)
        collectibleTypes[#collectibleTypes + 1] = collectibleType
    end
    self.postPlayerCollectibleRemoved = function(____, player, collectibleType)
        local collectibleTypes = defaultMapGetPlayer(nil, v.run.playersCollectibleTypes, player, player)
        arrayRemoveInPlace(nil, collectibleTypes, collectibleType)
    end
    self.customCallbacksUsed = {{ModCallbackCustom.POST_PLAYER_COLLECTIBLE_ADDED, self.postPlayerCollectibleAdded}, {ModCallbackCustom.POST_PLAYER_COLLECTIBLE_REMOVED, self.postPlayerCollectibleRemoved}}
end
function PlayerCollectibleTracking.prototype.getPlayerCollectibleTypes(self, player, includeActiveCollectibles)
    if includeActiveCollectibles == nil then
        includeActiveCollectibles = true
    end
    local collectibleTypes = defaultMapGetPlayer(nil, v.run.playersCollectibleTypes, player, player)
    if includeActiveCollectibles then
        return collectibleTypes
    end
    return __TS__ArrayFilter(
        collectibleTypes,
        function(____, collectibleType) return not isActiveCollectible(nil, collectibleType) end
    )
end
__TS__DecorateLegacy({Exported}, PlayerCollectibleTracking.prototype, "getPlayerCollectibleTypes", true)
function PlayerCollectibleTracking.prototype.getPlayerLastPassiveCollectibleType(self, player)
    local collectibleTypes = self:getPlayerCollectibleTypes(player, false)
    return __TS__ArrayAt(collectibleTypes, -1)
end
__TS__DecorateLegacy({Exported}, PlayerCollectibleTracking.prototype, "getPlayerLastPassiveCollectibleType", true)
return ____exports
