local M=script:FindFirstAncestorOfClass("\080\108\117\103\105\110")local B=M:FindFirstChildOfClass("\083\099\114\105\112\116")local f=B.Modules local e=require(f.Packages)local D=require(e.Directory.Roact)local A=D.Component:extend("\083\116\117\100\105\111\087\105\100\103\101\116")function A.init(B)local f=DockWidgetPluginGuiInfo.new(B.props.InitialDockState,B.props.Enabled,false,B.props.DefaultSize.X,B.props.DefaultSize.Y,B.props.MinimumSize.X,B.props.MinimumSize.Y)local e=M:CreateDockWidgetPluginGui(B.props.WidgetId,f)e.Title=B.props.WidgetTitle e.Name=B.props.WidgetId e.ZIndexBehavior=B.props.ZIndexBehavior or Enum.ZIndexBehavior.Global B.Widget=e end function A.didMount(M)M.OnEnabled=M.props.OnEnabled:Connect(function(B)M.Widget.Enabled=B end)M.Widget:BindToClose(function()M.Widget.Enabled=false end)end function A.render(M)return D.createElement(D.Portal,{target=M.Widget},M.props[D.Children])end function A.didUpdate(B,M)if B.props.Enabled~=M.Enabled then B.Widget.Enabled=B.props.Enabled end end function A.willUnmount(M)M.OnEnabled:Disconnect()end return A
local Plugin = script:FindFirstAncestorOfClass("Plugin")
local Script = Plugin:FindFirstChildOfClass("Script")
local Modules = Script.Modules
local Packages = require(Modules.Packages)

local Roact = require(Packages.Directory.Roact)

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

function StudioWidget:init()
	local WidgetInfo = DockWidgetPluginGuiInfo.new(
		self.props.InitialDockState,
		self.props.Enabled,
		false,
		self.props.DefaultSize.X,
		self.props.DefaultSize.Y,
		self.props.MinimumSize.X,
		self.props.MinimumSize.Y
	)

	local Widget = Plugin:CreateDockWidgetPluginGui(self.props.WidgetId, WidgetInfo)
	Widget.Title = self.props.WidgetTitle
	Widget.Name = self.props.WidgetId
	Widget.ZIndexBehavior = self.props.ZIndexBehavior or Enum.ZIndexBehavior.Global

	self.Widget = Widget
end

function StudioWidget:didMount()
	self.OnEnabled = self.props.OnEnabled:Connect(function(Enabled)
		self.Widget.Enabled = Enabled
	end)
	self.Widget:BindToClose(function()
		self.Widget.Enabled = false
	end)
end

function StudioWidget:render()
	return Roact.createElement(Roact.Portal, {
		target = self.Widget
	}, self.props[Roact.Children])
end

function StudioWidget:didUpdate(lastProps)
	if self.props.Enabled ~= lastProps.Enabled then
		self.Widget.Enabled = self.props.Enabled
	end
end

function StudioWidget:willUnmount()
	self.OnEnabled:Disconnect()
end

return StudioWidget