local g="\078\101\120\117\115\077\117\108\116\105\067\111\110\115\116\114\097\105\110\116"local A=(require(script.Parent.Parent.Parent.Parent:WaitForChild("\078\101\120\117\115\080\108\117\103\105\110\070\114\097\109\101\119\111\114\107\080\114\111\106\101\099\116"))):GetContext(script)local I=A:GetResource("\085\073\046\067\111\108\108\097\112\115\097\098\108\101\076\105\115\116\046\067\111\110\115\116\114\097\105\110\116\046\078\101\120\117\115\067\111\108\108\097\112\115\097\098\108\101\076\105\115\116\070\114\097\109\101\067\111\110\115\116\114\097\105\110\116")local O=I:Extend()O:SetClassName(g)A:SetContextResource(O)function O.__new(A)A:InitializeSuper()A.Name=g A.__Constraints={}end function O.AddConstraint(A,g)table.insert(A.__Constraints,g)for A,I in pairs(A:GetListFrames())do g:AddListFrame(I,A)end end function O.AddListFrame(I,g,A)I.super:AddListFrame(g,A)for I,O in pairs(I.__Constraints)do O:AddListFrame(g,A)end end function O.RemoveListFrame(A,g)A.super:RemoveListFrame(g)for A,I in pairs(A.__Constraints)do I:RemoveListFrame(g)end end function O.ClearListFrames(g)g.super:ClearListFrames()for g,A in pairs(g.__Constraints)do A:ClearListFrames()end end return O
--[[
TheNexusAvenger

Helper class that applies multiple constraints as one
constraint.
--]]

local CLASS_NAME = "NexusMultiConstraint"



local NexusPluginFramework = require(script.Parent.Parent.Parent.Parent:WaitForChild("NexusPluginFrameworkProject")):GetContext(script)
local NexusCollapsableListFrameConstraint = NexusPluginFramework:GetResource("UI.CollapsableList.Constraint.NexusCollapsableListFrameConstraint")

local NexusMultiConstraint = NexusCollapsableListFrameConstraint:Extend()
NexusMultiConstraint:SetClassName(CLASS_NAME)
NexusPluginFramework:SetContextResource(NexusMultiConstraint)



--[[
Creates a Nexus Collapsable List Frame Multi Constraint object.
--]]
function NexusMultiConstraint:__new()
	self:InitializeSuper()
	self.Name = CLASS_NAME
	self.__Constraints = {}
end

--[[
Adds a constraint.
--]]
function NexusMultiConstraint:AddConstraint(Constraint)
	--Add the constraint.
	table.insert(self.__Constraints,Constraint)
	
	--Add the existing frames.
	for i,Frame in pairs(self:GetListFrames()) do
		Constraint:AddListFrame(Frame,i)
	end
end

--[[
Adds a list frame to the constraint.
--]]
function NexusMultiConstraint:AddListFrame(ListFrame,Index)
	self.super:AddListFrame(ListFrame,Index)
	
	--Add the frame to the constraints.
	for _,Constraint in pairs(self.__Constraints) do
		Constraint:AddListFrame(ListFrame,Index)
	end
end

--[[
Removes a list frame to the constraint.
--]]
function NexusMultiConstraint:RemoveListFrame(ListFrame)
	self.super:RemoveListFrame(ListFrame)
	
	--Remove the frame from the constraints.
	for _,Constraint in pairs(self.__Constraints) do
		Constraint:RemoveListFrame(ListFrame)
	end
end

--[[
Removes all of the list frames to the constraint.
--]]
function NexusMultiConstraint:ClearListFrames()
	self.super:ClearListFrames()
	
	--Clear the frames from the constraints.
	for _,Constraint in pairs(self.__Constraints) do
		Constraint:ClearListFrames()
	end
end



return NexusMultiConstraint