local a=Roact.PureComponent:extend(script.Name)function a.init(a)a.Maid=Maid.new()a.PaneSize,a.SetPaneSize=Roact.createBinding(UDim2.new())a:UpdateHistoryState()a.Maid.TrackHistory=a.props.Core.History.Changed:Connect(function()a:UpdateHistoryState()end)a:UpdateSelectionState()a.Maid.TrackSelection=a.props.Core.Selection.Changed:Connect(function()a:UpdateSelectionState()end)a:UpdateExplorerState()a.Maid.TrackExplorer=a.props.Core.ExplorerVisibilityChanged:Connect(function()a:UpdateExplorerState()end)end function a.UpdateHistoryState(a)a:setState({CanUndo=a.props.Core.History.Index>0,CanRedo=a.props.Core.History.Index~=#a.props.Core.History.Stack})end function a.UpdateSelectionState(a)a:setState({IsSelectionEmpty=#a.props.Core.Selection.Items==0})end function a.UpdateExplorerState(a)a:setState({IsExplorerOpen=a.props.Core.ExplorerVisible})end function a.willUnmount(a)a.Maid:Destroy()end function a.render(a)return new("\070\114\097\109\101",{BackgroundTransparency=.7;BackgroundColor3=Color3.fromRGB(0,0,0),BorderSizePixel=0;Size=a.PaneSize,LayoutOrder=a.props.LayoutOrder},{Corners=new("\085\073\067\111\114\110\101\114",{CornerRadius=UDim.new(0,3)}),SizeConstraint=new("\085\073\083\105\122\101\067\111\110\115\116\114\097\105\110\116",{MinSize=Vector2.new(70,0)}),Layout=new("\085\073\071\114\105\100\076\097\121\111\117\116",{CellPadding=UDim2.new(0,0,0,0),CellSize=UDim2.new(0,35,0,35),FillDirection=Enum.FillDirection.Horizontal,FillDirectionMaxCells=0,HorizontalAlignment=Enum.HorizontalAlignment.Left;VerticalAlignment=Enum.VerticalAlignment.Top;SortOrder=Enum.SortOrder.LayoutOrder;StartCorner=Enum.StartCorner.TopLeft;[Roact.Ref]=function(Q)if Q then a.SetPaneSize(UDim2.fromOffset(Q.AbsoluteContentSize.X,Q.AbsoluteContentSize.Y))end end,[Roact.Change.AbsoluteContentSize]=function(Q)a.SetPaneSize(UDim2.fromOffset(Q.AbsoluteContentSize.X,Q.AbsoluteContentSize.Y))end});UndoButton=new(SelectionButton,{LayoutOrder=0;IconAssetId="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\052\049\055\052\049\052\048\056",IsActive=a.state.CanUndo,OnActivated=a.props.Core.History.Undo,TooltipText="\060\098\062\085\078\068\079\060\047\098\062\060\098\114 \047\062\083\104\105\102\116-\090"}),RedoButton=new(SelectionButton,{LayoutOrder=1;IconAssetId="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\052\049\055\052\049\051\050\055",IsActive=a.state.CanRedo;OnActivated=a.props.Core.History.Redo,TooltipText="\060\098\062\082\069\068\079\060\047\098\062\060\098\114 \047\062\083\104\105\102\116-\089"});DeleteButton=new(SelectionButton,{LayoutOrder=2;IconAssetId="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\052\049\056\057\054\050\057\056",IsActive=not a.state.IsSelectionEmpty,OnActivated=a.props.Core.DeleteSelection;TooltipText="\060\098\062\068\069\076\069\084\069\060\047\098\062\060\098\114 \047\062\083\104\105\102\116-\088"});ExportButton=new(SelectionButton,{LayoutOrder=3,IconAssetId="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\052\049\055\052\049\051\051\055",IsActive=not a.state.IsSelectionEmpty,OnActivated=a.props.Core.ExportSelection;TooltipText="\060\098\062\069\088\080\079\082\084\060\047\098\062\060\098\114 \047\062\083\104\105\102\116-\080"}),CloneButton=new(SelectionButton,{LayoutOrder=4,IconAssetId="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\052\050\048\055\051\057\050\054";IsActive=not a.state.IsSelectionEmpty,OnActivated=a.props.Core.CloneSelection;TooltipText="\060\098\062\067\076\079\078\069\060\047\098\062\060\098\114 \047\062\083\104\105\102\116-\067"}),ExplorerButton=new(SelectionButton,{LayoutOrder=5;IconAssetId="\114\098\120\097\115\115\101\116\105\100\058\047\047\050\051\050\054\054\050\049\052\056\053";IsActive=a.state.IsExplorerOpen,OnActivated=a.props.Core.ToggleExplorer,TooltipText="\060\098\062\069\088\080\076\079\082\069\082\060\047\098\062\060\098\114 \047\062\083\104\105\102\116-\072"})})end return a
-- Create component
local SelectionPane = Roact.PureComponent:extend(script.Name)

function SelectionPane:init()
	self.Maid = Maid.new()
	self.PaneSize, self.SetPaneSize = Roact.createBinding(UDim2.new())

	self:UpdateHistoryState()
	self.Maid.TrackHistory = self.props.Core.History.Changed:Connect(function()
		self:UpdateHistoryState()
	end)

	self:UpdateSelectionState()
	self.Maid.TrackSelection = self.props.Core.Selection.Changed:Connect(function()
		self:UpdateSelectionState()
	end)

	self:UpdateExplorerState()
	self.Maid.TrackExplorer = self.props.Core.ExplorerVisibilityChanged:Connect(function()
		self:UpdateExplorerState()
	end)
end

function SelectionPane:UpdateHistoryState()
	self:setState({
		CanUndo = (self.props.Core.History.Index > 0),
		CanRedo = (self.props.Core.History.Index ~= #self.props.Core.History.Stack),
	})
end

function SelectionPane:UpdateSelectionState()
	self:setState({
		IsSelectionEmpty = (#self.props.Core.Selection.Items == 0),
	})
end

function SelectionPane:UpdateExplorerState()
	self:setState({
		IsExplorerOpen = self.props.Core.ExplorerVisible,
	})
end

function SelectionPane:willUnmount()
	self.Maid:Destroy()
end

function SelectionPane:render()
	return new("Frame", {
		BackgroundTransparency = 0.7,
		BackgroundColor3 = Color3.fromRGB(0, 0, 0),
		BorderSizePixel = 0,
		Size = self.PaneSize,
		LayoutOrder = self.props.LayoutOrder,
	}, {
		Corners = new("UICorner", {
			CornerRadius = UDim.new(0, 3),
		}),
		SizeConstraint = new("UISizeConstraint", {
			MinSize = Vector2.new(70, 0),
		}),
		Layout = new("UIGridLayout", {
			CellPadding = UDim2.new(0, 0, 0, 0),
			CellSize = UDim2.new(0, 35, 0, 35),
			FillDirection = Enum.FillDirection.Horizontal,
			FillDirectionMaxCells = 0,
			HorizontalAlignment = Enum.HorizontalAlignment.Left,
			VerticalAlignment = Enum.VerticalAlignment.Top,
			SortOrder = Enum.SortOrder.LayoutOrder,
			StartCorner = Enum.StartCorner.TopLeft,
			[Roact.Ref] = function(rbx)
				if rbx then
					self.SetPaneSize(UDim2.fromOffset(rbx.AbsoluteContentSize.X, rbx.AbsoluteContentSize.Y))
				end
			end,
			[Roact.Change.AbsoluteContentSize] = function(rbx)
				self.SetPaneSize(UDim2.fromOffset(rbx.AbsoluteContentSize.X, rbx.AbsoluteContentSize.Y))
			end,
		}),

		UndoButton = new(SelectionButton, {
			LayoutOrder = 0,
			IconAssetId = "rbxassetid://141741408",
			IsActive = self.state.CanUndo,
			OnActivated = self.props.Core.History.Undo,
			TooltipText = "<b>UNDO</b><br />Shift-Z",
		}),
		RedoButton = new(SelectionButton, {
			LayoutOrder = 1,
			IconAssetId = "rbxassetid://141741327",
			IsActive = self.state.CanRedo,
			OnActivated = self.props.Core.History.Redo,
			TooltipText = "<b>REDO</b><br />Shift-Y",
		}),
		DeleteButton = new(SelectionButton, {
			LayoutOrder = 2,
			IconAssetId = "rbxassetid://141896298",
			IsActive = not self.state.IsSelectionEmpty,
			OnActivated = self.props.Core.DeleteSelection,
			TooltipText = "<b>DELETE</b><br />Shift-X",
		}),
		ExportButton = new(SelectionButton, {
			LayoutOrder = 3,
			IconAssetId = "rbxassetid://141741337",
			IsActive = not self.state.IsSelectionEmpty,
			OnActivated = self.props.Core.ExportSelection,
			TooltipText = "<b>EXPORT</b><br />Shift-P",
		}),
		CloneButton = new(SelectionButton, {
			LayoutOrder = 4,
			IconAssetId = "rbxassetid://142073926",
			IsActive = not self.state.IsSelectionEmpty,
			OnActivated = self.props.Core.CloneSelection,
			TooltipText = "<b>CLONE</b><br />Shift-C",
		}),
		ExplorerButton = new(SelectionButton, {
			LayoutOrder = 5,
			IconAssetId = "rbxassetid://2326621485",
			IsActive = self.state.IsExplorerOpen,
			OnActivated = self.props.Core.ToggleExplorer,
			TooltipText = "<b>EXPLORER</b><br />Shift-H",
		}),
	})
end

return SelectionPane
