local z=game:GetService("\072\116\116\112\083\101\114\118\105\099\101")local A=(script:FindFirstAncestor("\067\109\100\114\065\100\100\105\116\105\111\110\115")).Packages local Y=require(A.Roact)local m=require(A.Util)local W=require(script.Window)local a=Vector2.new(310,370)local H=Y.Component:extend("\087\105\110\100\111\119\077\097\110\097\103\101\114")function H.init(z) end function H.spawnWindow(Y,A)local m=z:GenerateGUID(false)Y:setState({[m]=A})end function H.render(z)local A={}for H,X in pairs(z.state)do A[H]=Y.createElement(W,m.Dictionary.merge(X,{InitialSize=a,Destroy=function()z:setState({[H]=Y.None})end}))end return Y.createFragment(A)end return H
local HttpService = game:GetService("HttpService")

local Packages = script:FindFirstAncestor("CmdrAdditions").Packages

local Roact = require(Packages.Roact)
local Util = require(Packages.Util)

local Window = require(script.Window)

local DEFAULT_SIZE = Vector2.new(310, 370)

local WindowManager = Roact.Component:extend("WindowManager")

function WindowManager:init()
	--[[self:spawnWindow({
		Title = "Example window",
		Type = "Logs",
		Icon = "CommandLogs",
		Stream = "CommandLogs"
	})]]
end

function WindowManager:spawnWindow(data)
	local windowId = HttpService:GenerateGUID(false)

	self:setState({
		[windowId] = data
	})
end

function WindowManager:render()
	local windows = {}

	for windowId, data in pairs(self.state) do
		windows[windowId] = Roact.createElement(Window, Util.Dictionary.merge(data, {
			InitialSize = DEFAULT_SIZE,
			Destroy = function()
				self:setState({
					[windowId] = Roact.None
				})
			end
		}))
	end

	return Roact.createFragment(windows)
end

return WindowManager