local g="\078\101\120\117\115\067\111\110\116\101\110\116\115\080\114\111\112\101\114\116\121\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("\078\101\120\117\115\073\110\115\116\097\110\099\101\046\069\118\101\110\116\046\078\101\120\117\115\069\118\101\110\116\067\114\101\097\116\111\114")local O=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 Y=O:Extend()Y:SetClassName(g)A:SetContextResource(Y)function Y.__new(A)A:InitializeSuper()A.Name=g local I={}local function O(g)local A,I=g.Selected,g.Disabled for g,O in pairs((g:GetMainContainer()):GetDescendants())do if O:IsA("\078\101\120\117\115\087\114\097\112\112\101\100\073\110\115\116\097\110\099\101")then O.Selected=A O.Disabled=I end end end local function Y(g)local A={}local Y={}table.insert(Y,(g:GetCollapsableContainer()).DescendantAdded:Connect(function(g)if g:IsA("\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")then local I={}table.insert(I,(g:GetMainContainer()).ChildAdded:Connect(function()O(g)end))table.insert(I,(g:GetPropertyChangedSignal("\068\105\115\097\098\108\101\100")):Connect(function()O(g)end))table.insert(I,(g:GetPropertyChangedSignal("\083\101\108\101\099\116\101\100")):Connect(function()O(g)end))A[g]=I O(g)end end))table.insert(Y,(g:GetCollapsableContainer()).DescendantRemoving:Connect(function(g)local I=A[g]if I then A[g]=nil for g,A in pairs(I)do A:Disconnect()end end end))table.insert(Y,(g:GetMainContainer()).ChildAdded:Connect(function()O(g)end))table.insert(Y,(g:GetPropertyChangedSignal("\068\105\115\097\098\108\101\100")):Connect(function()O(g)end))table.insert(Y,(g:GetPropertyChangedSignal("\083\101\108\101\099\116\101\100")):Connect(function()O(g)end))I[g]=Y O(g)end local function z(g)local A=I[g]if A then I[g]=nil for g,A in pairs(A)do A:Disconnect()end end end A.ListFrameAdded:Connect(Y)A.ListFrameRemoved:Connect(z)end return Y
--[[
TheNexusAvenger

Constraint that passes through certain properties (Disabled
and Selected) to the frames parented to the main contents frame
of list frames.
--]]

local CLASS_NAME = "NexusContentsPropertyConstraint"



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

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



--[[
Creates a Nexus Collapsable List Frame Contents Property Constraint object.
--]]
function NexusContentsPropertyConstraint:__new()
	self:InitializeSuper()
	self.Name = CLASS_NAME
	
	local GlobalListFrameConnections = {}
	
	--[[
	Updates the properties of the contents of the contents of a list frame.
	--]]
	local function UpdateListFrameContainerPrperties(ListFrame)
		local Selected,Disabled = ListFrame.Selected,ListFrame.Disabled
		for _,Frame in pairs(ListFrame:GetMainContainer():GetDescendants()) do
			if Frame:IsA("NexusWrappedInstance") then
				Frame.Selected = Selected
				Frame.Disabled = Disabled
			end
		end
	end
	
	--[[
	Handles a list frame being added.
	--]]
	local function ListFrameAdded(ListFrame)
		local ListFrameConnections = {}
		
		--Connect the events.
		local Events = {}
		table.insert(Events,ListFrame:GetCollapsableContainer().DescendantAdded:Connect(function(ListFrame)
			if ListFrame:IsA("NexusCollapsableListFrame") then
				--Connect the events.
				local Events = {}
				table.insert(Events,ListFrame:GetMainContainer().ChildAdded:Connect(function()
					UpdateListFrameContainerPrperties(ListFrame)
				end))
				table.insert(Events,ListFrame:GetPropertyChangedSignal("Disabled"):Connect(function()
					UpdateListFrameContainerPrperties(ListFrame)
				end))
				table.insert(Events,ListFrame:GetPropertyChangedSignal("Selected"):Connect(function()
					UpdateListFrameContainerPrperties(ListFrame)
				end))
				
				--Store the events.
				ListFrameConnections[ListFrame] = Events
				
				--Update the list frame properties.
				UpdateListFrameContainerPrperties(ListFrame)
			end
		end))
		table.insert(Events,ListFrame:GetCollapsableContainer().DescendantRemoving:Connect(function(ListFrame)
			local Events = ListFrameConnections[ListFrame]
			if Events then
				ListFrameConnections[ListFrame] = nil
				for _,Event in pairs(Events) do
					Event:Disconnect()
				end
			end
		end))
		table.insert(Events,ListFrame:GetMainContainer().ChildAdded:Connect(function()
			UpdateListFrameContainerPrperties(ListFrame)
		end))
		table.insert(Events,ListFrame:GetPropertyChangedSignal("Disabled"):Connect(function()
			UpdateListFrameContainerPrperties(ListFrame)
		end))
		table.insert(Events,ListFrame:GetPropertyChangedSignal("Selected"):Connect(function()
			UpdateListFrameContainerPrperties(ListFrame)
		end))
		
		--Store the events.
		GlobalListFrameConnections[ListFrame] = Events
		
		--Update the list frame properties.
		UpdateListFrameContainerPrperties(ListFrame)
	end
	
	--[[
	Handles a list frame being removed.
	--]]
	local function ListFrameRemoved(ListFrame)
		local Events = GlobalListFrameConnections[ListFrame]
		if Events then
			GlobalListFrameConnections[ListFrame] = nil
			for _,Event in pairs(Events) do
				Event:Disconnect()
			end
		end
	end
	
	--Connect the events.
	self.ListFrameAdded:Connect(ListFrameAdded)
	self.ListFrameRemoved:Connect(ListFrameRemoved)
end



return NexusContentsPropertyConstraint