local n=require((script:FindFirstAncestor("\077\097\122\101\071\101\110\101\114\097\116\111\114\080\108\117\103\105\110")).Roact)local Z=require(script.Parent.Parent.Dictionary)local w=n.createElement local i=n.Component:extend("\070\105\116\083\099\114\111\108\108\105\110\103\070\114\097\109\101")function i.init(Z)Z.sizeBinding,Z.setSize=n.createBinding(UDim2.new())end function i.render(i)local X=i.props.containerProps local G=i.props.layoutProps local K=Z.merge(i.props[n.Children],{layout=w("\085\073\076\105\115\116\076\097\121\111\117\116",Z.merge({SortOrder=Enum.SortOrder.LayoutOrder;[n.Change.AbsoluteContentSize]=function(n)i.setSize(UDim2.new(0,0,0,n.AbsoluteContentSize.Y))end},G))})local V=Z.merge(X,{CanvasSize=i.sizeBinding})return w("\083\099\114\111\108\108\105\110\103\070\114\097\109\101",V,K)end return i
local Roact = require(script:FindFirstAncestor('MazeGeneratorPlugin').Roact)

local Dictionary = require(script.Parent.Parent.Dictionary)

local e = Roact.createElement

local FitScrollingFrame = Roact.Component:extend('FitScrollingFrame')

function FitScrollingFrame:init()
	self.sizeBinding, self.setSize = Roact.createBinding(UDim2.new())
end

function FitScrollingFrame:render()
	local containerProps = self.props.containerProps
	local layoutProps = self.props.layoutProps

	local children = Dictionary.merge(self.props[Roact.Children], { layout = e(
		'UIListLayout',
		Dictionary.merge(
			{
				SortOrder = Enum.SortOrder.LayoutOrder,
				[Roact.Change.AbsoluteContentSize] = function(instance)
					self.setSize(UDim2.new(0, 0, 0, instance.AbsoluteContentSize.Y))
				end,
			},
			layoutProps
		)
	) })

	local fullContainerProps = Dictionary.merge(containerProps, { CanvasSize = self.sizeBinding })

	return e('ScrollingFrame', fullContainerProps, children)
end

return FitScrollingFrame