local ____lualib = require("lualib_bundle")
local WeakMap = ____lualib.WeakMap
local __TS__ArrayForEach = ____lualib.__TS__ArrayForEach
local ____exports = {}
local ____context = require("hooks.context")
local hookContext = ____context.hookContext
local hookMap = ____context.hookMap
local hooks = ____context.hooks
local oldBeforeRender = hooks.beforeRender
local oldBeforeUnmount = hooks.beforeUnmount
hooks.beforeRender = function(component)
    oldBeforeRender(component)
    hookContext.currentComponent = component
    hookContext.currentIndex = 0
    if not hookMap:has(component) then
        hookMap:set(component, {})
    end
end
hooks.beforeUnmount = function(component)
    oldBeforeUnmount(component)
    local hooks = hookMap:get(component)
    if hooks then
        __TS__ArrayForEach(
            hooks,
            function(____, hook) return hook.type == "effect" and hook.cleanup and hook.cleanup() end
        )
    end
end
return ____exports
