local p="\077\097\105\100 \100\111\101\115 \110\111\116 \115\117\112\112\111\114\116 \116\121\112\101 \"\037\115\""local r={["\102\117\110\099\116\105\111\110"]=function(p)p()end,RBXScriptConnection=function(p)p:Disconnect()end;Instance=function(p)p:Destroy()end}local E={}E.__index=E E.__type="\077\097\105\100"function E.__tostring(p)return E.__type end function E.new()local p=setmetatable({},E)p.Trash={}return p end function E.Mark(u,E)local Y=typeof(E)if r[Y]then u.Trash[E]=Y else error(p:format(Y),2)end end function E.Unmark(r,p)if p then r.Trash[p]=nil else r.Trash={}end end function E.Sweep(p)for p,E in next,p.Trash do r[E](p)end p.Trash={}end return E
-- CONSTANTS

local FORMAT_STR = "Maid does not support type \"%s\""

local DESTRUCTORS = {
	["function"] = function(item)
		item()
	end;
	["RBXScriptConnection"] = function(item)
		item:Disconnect()
	end;
	["Instance"] = function(item)
		item:Destroy()
	end;
}

-- Class

local MaidClass = {}
MaidClass.__index = MaidClass
MaidClass.__type = "Maid"

function MaidClass:__tostring()
	return MaidClass.__type
end

-- Public Constructors

function MaidClass.new()
	local self = setmetatable({}, MaidClass)
	
	self.Trash = {}
	
	return self
end

-- Public Methods

function MaidClass:Mark(item)
	local tof = typeof(item)
	
	if (DESTRUCTORS[tof]) then
		self.Trash[item] = tof
	else
		error(FORMAT_STR:format(tof), 2)
	end
end

function MaidClass:Unmark(item)
	if (item) then
		self.Trash[item] = nil
	else
		self.Trash = {}
	end
end

function MaidClass:Sweep()
	for item, tof in next, self.Trash do
		DESTRUCTORS[tof](item)
	end
	self.Trash = {}
end

--

return MaidClass