Frame.defaultProps={BackgroundTransparency=1;BorderSizePixel=0,Size=UDim2.new(1,0,1,0)}function Frame.render(C)local h=Support.CloneTable(C.props)local g=C.state if h.AspectRatio then local C=new("\085\073\065\115\112\101\099\116\082\097\116\105\111\067\111\110\115\116\114\097\105\110\116",{AspectRatio=h.AspectRatio})h[Roact.Children]=Support.Merge({AspectRatio=C},h[Roact.Children]or{})if h.DominantAxis=="\087\105\100\116\104"then h.SizeConstraint="\082\101\108\097\116\105\118\101\088\088"if typeof(h.Width)=="\085\068\105\109"then h.Height=UDim.new(h.Width.Scale/h.AspectRatio,0)else h.Size=UDim2.new(h.Size.X,UDim.new(h.Size.X.Scale/h.AspectRatio,0))end elseif h.DominantAxis=="\072\101\105\103\104\116"then h.SizeConstraint="\082\101\108\097\116\105\118\101\089\089"if typeof(h.Height)=="\085\068\105\109"then h.Width=UDim.new(h.Height.Scale*h.AspectRatio,0)else h.Size=UDim2.new(UDim.new(h.Size.Y.Scale*h.AspectRatio,0),h.Size.Y)end end end if h.Layout=="\076\105\115\116"then local g=new("\085\073\076\105\115\116\076\097\121\111\117\116",{FillDirection=h.LayoutDirection,Padding=h.LayoutPadding;HorizontalAlignment=h.HorizontalAlignment;VerticalAlignment=h.VerticalAlignment,SortOrder=h.SortOrder or"\076\097\121\111\117\116\079\114\100\101\114",[Roact.Ref]=function(h)C:UpdateContentSize(h)end;[Roact.Change.AbsoluteContentSize]=function(h)C:UpdateContentSize(h)end})h.Size=C:GetSize()h[Roact.Children]=Support.Merge({Layout=g},h[Roact.Children])end h.AspectRatio=nil h.DominantAxis=nil h.Layout=nil h.LayoutDirection=nil h.LayoutPadding=nil h.HorizontalAlignment=nil h.VerticalAlignment=nil h.HorizontalPadding=nil h.VerticalPadding=nil h.SortOrder=nil h.Width=nil h.Height=nil h.ResizeParent=nil return new("\070\114\097\109\101",h)end function Frame.GetSize(h,C)local g=h.props local r=g.Size=="\087\082\065\080\095\067\079\078\084\069\078\084"or g.Width=="\087\082\065\080\095\067\079\078\084\069\078\084"local I=g.Size=="\087\082\065\080\095\067\079\078\084\069\078\084"or g.Height=="\087\082\065\080\095\067\079\078\084\069\078\084"local u=r or I local e=UDim2.new(0,g.HorizontalPadding or 0,0,g.VerticalPadding or 0)return e+UDim2.new((C and r)and UDim.new(0,C.X)or typeof(g.Width)=="\085\068\105\109"and g.Width or g.Size.X,(C and I)and UDim.new(0,C.Y)or typeof(g.Height)=="\085\068\105\109"and g.Height or g.Size.Y)end function Frame.UpdateContentSize(h,C)if not(C and C.Parent)then return end C.Parent.Size=h:GetSize(C.AbsoluteContentSize)local g=h.props.ResizeParent local r=g and C.Parent.Parent if g and r then local h=r.Size.X local I=r.Size.Y if Support.IsInTable(g,"\087\073\068\084\072")then h=UDim.new(0,C.Parent.AbsoluteSize.X)end if Support.IsInTable(g,"\072\069\073\071\072\084")then I=UDim.new(0,C.Parent.AbsoluteSize.Y)end r.Size=UDim2.new(h,I)end end return Frame
-- Set defaults
Frame.defaultProps = {
	BackgroundTransparency = 1,
	BorderSizePixel = 0,
	Size = UDim2.new(1, 0, 1, 0),
}

function Frame:render()
	local props = Support.CloneTable(self.props)
	local state = self.state

	-- Include aspect ratio constraint if specified
	if props.AspectRatio then
		local Constraint = new("UIAspectRatioConstraint", {
			AspectRatio = props.AspectRatio,
		})

		-- Insert constraint into children
		props[Roact.Children] = Support.Merge({ AspectRatio = Constraint }, props[Roact.Children] or {})

		-- Base height off width using the aspect ratio
		if props.DominantAxis == "Width" then
			props.SizeConstraint = "RelativeXX"
			if typeof(props.Width) == "UDim" then
				props.Height = UDim.new(props.Width.Scale / props.AspectRatio, 0)
			else
				props.Size = UDim2.new(props.Size.X, UDim.new(props.Size.X.Scale / props.AspectRatio, 0))
			end

		-- Base width off height using the aspect ratio
		elseif props.DominantAxis == "Height" then
			props.SizeConstraint = "RelativeYY"
			if typeof(props.Height) == "UDim" then
				props.Width = UDim.new(props.Height.Scale * props.AspectRatio, 0)
			else
				props.Size = UDim2.new(UDim.new(props.Size.Y.Scale * props.AspectRatio, 0), props.Size.Y)
			end
		end
	end

	-- Include list layout if specified
	if props.Layout == "List" then
		local Layout = new("UIListLayout", {
			FillDirection = props.LayoutDirection,
			Padding = props.LayoutPadding,
			HorizontalAlignment = props.HorizontalAlignment,
			VerticalAlignment = props.VerticalAlignment,
			SortOrder = props.SortOrder or "LayoutOrder",
			[Roact.Ref] = function(rbx)
				self:UpdateContentSize(rbx)
			end,
			[Roact.Change.AbsoluteContentSize] = function(rbx)
				self:UpdateContentSize(rbx)
			end,
		})

		-- Update size
		props.Size = self:GetSize()

		-- Insert layout into children
		props[Roact.Children] = Support.Merge({ Layout = Layout }, props[Roact.Children])
	end

	-- Filter out custom properties
	props.AspectRatio = nil
	props.DominantAxis = nil
	props.Layout = nil
	props.LayoutDirection = nil
	props.LayoutPadding = nil
	props.HorizontalAlignment = nil
	props.VerticalAlignment = nil
	props.HorizontalPadding = nil
	props.VerticalPadding = nil
	props.SortOrder = nil
	props.Width = nil
	props.Height = nil
	props.ResizeParent = nil

	-- Display component in wrapper
	return new("Frame", props)
end

function Frame:GetSize(ContentSize)
	local props = self.props

	-- Determine dynamic dimensions
	local DynamicWidth = props.Size == "WRAP_CONTENT" or props.Width == "WRAP_CONTENT"
	local DynamicHeight = props.Size == "WRAP_CONTENT" or props.Height == "WRAP_CONTENT"
	local DynamicSize = DynamicWidth or DynamicHeight

	-- Get padding from props
	local Padding = UDim2.new(0, props.HorizontalPadding or 0, 0, props.VerticalPadding or 0)

	-- Calculate size based on content if dynamic
	return Padding
		+ UDim2.new(
			(ContentSize and DynamicWidth) and UDim.new(0, ContentSize.X)
				or (typeof(props.Width) == "UDim" and props.Width or props.Size.X),
			(ContentSize and DynamicHeight) and UDim.new(0, ContentSize.Y)
				or (typeof(props.Height) == "UDim" and props.Height or props.Size.Y)
		)
end

function Frame:UpdateContentSize(Layout)
	if not (Layout and Layout.Parent) then
		return
	end

	-- Set container size based on content
	Layout.Parent.Size = self:GetSize(Layout.AbsoluteContentSize)

	-- Set parent size based on content if specified
	local ResizeParent = self.props.ResizeParent
	local Parent = ResizeParent and Layout.Parent.Parent
	if ResizeParent and Parent then
		local ParentWidth = Parent.Size.X
		local ParentHeight = Parent.Size.Y
		if Support.IsInTable(ResizeParent, "WIDTH") then
			ParentWidth = UDim.new(0, Layout.Parent.AbsoluteSize.X)
		end
		if Support.IsInTable(ResizeParent, "HEIGHT") then
			ParentHeight = UDim.new(0, Layout.Parent.AbsoluteSize.Y)
		end
		Parent.Size = UDim2.new(ParentWidth, ParentHeight)
	end
end

return Frame
