local f=Roact.PureComponent:extend(script.Name)function f.init(f)f.FrameSize,f.SetFrameSize=Roact.createBinding(UDim2.new())f:UpdateTextBounds(f.props.Text)end function f.willUpdate(K,f)if K.props.Text~=f.Text then K:UpdateTextBounds(f.Text)end end function f.UpdateTextBounds(K,f)K.TextBounds=TextService:GetTextSize((f:gsub("\060\098\114 \047\062","\n")):gsub("\060\046-\062",""),10,Enum.Font.Gotham,Vector2.new(math.huge,math.huge))end function f.render(f)return new("\070\114\097\109\101",{AnchorPoint=Vector2.new(.5,0),BackgroundColor3=Color3.fromRGB(58,58,58),BackgroundTransparency=0,BorderSizePixel=0,Position=UDim2.new(.5,0,1,2),Size=UDim2.fromOffset(f.TextBounds.X+20,f.TextBounds.Y+8),ZIndex=2;Visible=f.props.IsVisible},{Corners=new("\085\073\067\111\114\110\101\114",{CornerRadius=UDim.new(0,3)});Arrow=new("\070\114\097\109\101",{AnchorPoint=Vector2.new(.5,.5);BackgroundColor3=Color3.fromRGB(58,58,58);BackgroundTransparency=0,BorderSizePixel=0,Position=UDim2.new(.5,0,0,0);Size=UDim2.new(0,6,0,6);ZIndex=2}),Text=new("\084\101\120\116\076\097\098\101\108",{BackgroundTransparency=1,Size=UDim2.new(1,0,1,0);ZIndex=2;Font=Enum.Font.Gotham,RichText=true;Text=f.props.Text;TextColor3=Color3.fromRGB(255,255,255);TextSize=10;TextXAlignment=Enum.TextXAlignment.Center,TextYAlignment=Enum.TextYAlignment.Center})})end return f
-- Create component
local Tooltip = Roact.PureComponent:extend(script.Name)

function Tooltip:init()
	self.FrameSize, self.SetFrameSize = Roact.createBinding(UDim2.new())
	self:UpdateTextBounds(self.props.Text)
end

function Tooltip:willUpdate(nextProps)
	if self.props.Text ~= nextProps.Text then
		self:UpdateTextBounds(nextProps.Text)
	end
end

function Tooltip:UpdateTextBounds(Text)
	self.TextBounds = TextService:GetTextSize(
		Text:gsub("<br />", "\n"):gsub("<.->", ""),
		10,
		Enum.Font.Gotham,
		Vector2.new(math.huge, math.huge)
	)
end

function Tooltip:render()
	return new("Frame", {
		AnchorPoint = Vector2.new(0.5, 0),
		BackgroundColor3 = Color3.fromRGB(58, 58, 58),
		BackgroundTransparency = 0,
		BorderSizePixel = 0,
		Position = UDim2.new(0.5, 0, 1, 2),
		Size = UDim2.fromOffset(self.TextBounds.X + 20, self.TextBounds.Y + 8),
		ZIndex = 2,
		Visible = self.props.IsVisible,
	}, {
		Corners = new("UICorner", {
			CornerRadius = UDim.new(0, 3),
		}),
		Arrow = new("Frame", {
			AnchorPoint = Vector2.new(0.5, 0.5),
			BackgroundColor3 = Color3.fromRGB(58, 58, 58),
			BackgroundTransparency = 0,
			BorderSizePixel = 0,
			Position = UDim2.new(0.5, 0, 0, 0),
			Size = UDim2.new(0, 6, 0, 6),
			ZIndex = 2,
		}),
		Text = new("TextLabel", {
			BackgroundTransparency = 1,
			Size = UDim2.new(1, 0, 1, 0),
			ZIndex = 2,
			Font = Enum.Font.Gotham,
			RichText = true,
			Text = self.props.Text,
			TextColor3 = Color3.fromRGB(255, 255, 255),
			TextSize = 10,
			TextXAlignment = Enum.TextXAlignment.Center,
			TextYAlignment = Enum.TextYAlignment.Center,
		}),
	})
end

return Tooltip
