local ____lualib = require("lualib_bundle")
local __TS__New = ____lualib.__TS__New
local __TS__Class = ____lualib.__TS__Class
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
local ____exports = {}
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
local ____shouldFire = require("shouldFire")
local shouldFireNPC = ____shouldFire.shouldFireNPC
local ____DefaultMap = require("classes.DefaultMap")
local DefaultMap = ____DefaultMap.DefaultMap
local ____CustomCallback = require("classes.private.CustomCallback")
local CustomCallback = ____CustomCallback.CustomCallback
local v = {run = {stateMap = __TS__New(
    DefaultMap,
    function(____, state) return state end
)}}
____exports.PostNPCStateChanged = __TS__Class()
local PostNPCStateChanged = ____exports.PostNPCStateChanged
PostNPCStateChanged.name = "PostNPCStateChanged"
__TS__ClassExtends(PostNPCStateChanged, CustomCallback)
function PostNPCStateChanged.prototype.____constructor(self)
    CustomCallback.prototype.____constructor(self)
    self.v = v
    self.shouldFire = shouldFireNPC
    self.postNPCUpdate = function(____, npc)
        local ptrHash = GetPtrHash(npc)
        local previousState = v.run.stateMap:getAndSetDefault(ptrHash, npc.State)
        local currentState = npc.State
        v.run.stateMap:set(ptrHash, currentState)
        if previousState ~= currentState then
            self:fire(npc, previousState, currentState)
        end
    end
    self.callbacksUsed = {{ModCallback.POST_NPC_UPDATE, self.postNPCUpdate}}
end
return ____exports
