local v=require((game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")):WaitForChild("\078\101\118\101\114\109\111\114\101"))local E=v("\077\097\105\100")local F=v("\083\105\103\110\097\108")local N={}function N.Add(E,v)assert(v)assert(not v.Enable)assert(not v.Disable)assert(not v.SetEnabled)assert(not v.IsEnabled)assert(not v.InitEnabledMixin)v.IsEnabled=E.IsEnabled v.Enable=E.Enable v.Disable=E.Disable v.SetEnabled=E.SetEnabled v.InitEnabledMixin=E.InitEnabledMixin end function N.InitEnabledMixin(E,v)v=v or E._maid assert(v,"\077\117\115\116 \104\097\118\101 \109\097\105\100")E._enabledMaidReference=v E._enabled=false E.EnabledChanged=F.new()E._enabledMaidReference:GiveTask(E.EnabledChanged)end function N.IsEnabled(v)return v._enabled end function N.Enable(E,v)E:SetEnabled(true,v)end function N.Disable(E,v)E:SetEnabled(false,v)end function N.SetEnabled(N,v,F)assert(type(v)=="\098\111\111\108\101\097\110")if N._enabled~=v then N._enabled=v local Q=E.new()N._enabledMaidReference._enabledMaid=Q N.EnabledChanged:Fire(v,F,Q)end end return N
--- Adds Enabled/Disabled state to class
-- @module EnabledMixin

local require = require(game:GetService("ReplicatedStorage"):WaitForChild("Nevermore"))

local Maid = require("Maid")
local Signal = require("Signal")

local EnabledMixin = {}

function EnabledMixin:Add(class)
	assert(class)
	assert(not class.Enable)
	assert(not class.Disable)
	assert(not class.SetEnabled)
	assert(not class.IsEnabled)
	assert(not class.InitEnabledMixin)

	-- Inject methods
	class.IsEnabled = self.IsEnabled
	class.Enable = self.Enable
	class.Disable = self.Disable
	class.SetEnabled = self.SetEnabled
	class.InitEnabledMixin = self.InitEnabledMixin
end

-- Initialize EnabledMixin
function EnabledMixin:InitEnabledMixin(maid)
	maid = maid or self._maid
	assert(maid, "Must have maid")

	self._enabledMaidReference = maid

	self._enabled = false
	self.EnabledChanged = Signal.new() -- :Fire(isEnabled, doNotAnimate, enabledMaid)
	self._enabledMaidReference:GiveTask(self.EnabledChanged)
end

function EnabledMixin:IsEnabled()
	return self._enabled
end

function EnabledMixin:Enable(doNotAnimate)
	self:SetEnabled(true, doNotAnimate)
end

function EnabledMixin:Disable(doNotAnimate)
	self:SetEnabled(false, doNotAnimate)
end

function EnabledMixin:SetEnabled(isEnabled, doNotAnimate)
	assert(type(isEnabled) == "boolean")

	if self._enabled ~= isEnabled then
		self._enabled = isEnabled

		local enabledMaid = Maid.new()
		self._enabledMaidReference._enabledMaid = enabledMaid

		self.EnabledChanged:Fire(isEnabled, doNotAnimate, enabledMaid)
	end
end

return EnabledMixin