local a=require(script.Parent:WaitForChild("\116"))local L={deprecatedWarning="\037\115 \105\115 \100\101\112\114\101\099\097\116\101\100\046 \037\115"}function L.DEPRECATED(a,I,R)warn(L.deprecatedWarning:format(I,R))return a end function L.TryCatch(a,L)local I,R=pcall(a)if not I then return L(R)end return I end function L.xpcall(a,L)local I,R=pcall(a)if not I then L(R)end end L._maybeCallCheck=a.union(a.callback,a.none)function L.MaybeCall(a,...)assert(L._maybeCallCheck(a))if type(a)=="\102\117\110\099\116\105\111\110"then return a(...)end end function L.WithCoolDown(a,L)local I=function(a,L)local I=a local R=true local X=function(...)if R then L(...)R=false wait(I)R=true end end return X end return I(a,L)end return L

local t = require(script.Parent:WaitForChild("t"))

local module = {
    deprecatedWarning = "%s is deprecated. %s"
}

 function module.DEPRECATED(func, funcName, reason)
	warn(module.deprecatedWarning:format(funcName, reason))
	return func
end

function module.TryCatch(funcTry, catch)
	local succ, err = pcall(funcTry)
	
	if not succ then
		return catch(err)
    end
    return succ
end

function module.xpcall(call, handler)
    local succ, err = pcall(call)
    
    if not succ then
        handler(err)
    end
end

--[[
	Calls the given function if it actually exists.

	Useful in Roact components where a callback passed as a prop is optional, so
	you don't always know if you want to run it.

	Usage:

		maybeCall(nil) -- does nothing

		maybeCall(function()
			print("Hello!") -- prints hello
		end)
]]

module._maybeCallCheck = t.union(t.callback, t.none)
function module.MaybeCall(callback, ...)
	assert(module._maybeCallCheck(callback))

	if type(callback) == "function" then
		return callback(...)
	end
end


function module.WithCoolDown( coolDownTime, func )
    local generatedClosure = function(innerCoolDownTime, wrappedFunction)
        local innerCoolDown = innerCoolDownTime
        local canExecute = true

        local innerExecutableFunc = function(...)
            if canExecute then
                wrappedFunction(...)
                canExecute = false
                wait(innerCoolDown)
                canExecute = true
            end

        end

        return innerExecutableFunc

    end

    return generatedClosure(coolDownTime, func)
end

return module