local U=Cheer.CreateComponent("\066\084\084\111\111\108\073\110\102\111\114\109\097\116\105\111\110\077\097\110\097\103\101\114",View)function U.Start(Z)(getfenv(1)).Core=Z return U end function U.RegisterSection(Z)local f=U.GetSection(Z)Cheer.Bind(f.MouseEnter,function()if U.CurrentSection==f then U.CurrentFadeTimer=false end end)Cheer.Bind(f.MouseLeave,function()U.StartFadeTimer(true)end)end function U.StartFadeTimer(Z)if U.CurrentFadeTimer==false and not Z then return end local f=HttpService:GenerateGUID()U.CurrentFadeTimer=f Delay(2,function()if U.CurrentFadeTimer==f then U.HideCurrentSection()end end)end function U.StartShowTimer(Z)if U.LastTrigger=="\067\108\105\099\107"then return end local f=HttpService:GenerateGUID()U.CurrentShowTimer=f Delay(.25,function()if U.CurrentShowTimer==f then U.ShowSection(Z,"\072\111\118\101\114")U.StartFadeTimer()end end)end function U.ProcessHover(Z,f)if U.LastTrigger=="\067\108\105\099\107"then return end wait()U.StartShowTimer(f)end function U.ShowSection(Z,f)U.HideCurrentSection()local Q=U.GetSection(Z)U.CurrentSection=Q U.LastTrigger=f Q.Visible=true end function U.ProcessUnhover(Z,f)U.CurrentShowTimer=nil if U.LastTrigger=="\067\108\105\099\107"then return end local Q=U.GetSection(f)if U.CurrentSection==Q then U.StartFadeTimer()end end function U.ProcessClick(Z,f)U.ShowSection(f,"\067\108\105\099\107")U.StartFadeTimer()end function U.HideCurrentSection()if not U.CurrentSection then return end U.CurrentSection.Visible=false U.CurrentFadeTimer=nil U.CurrentSection=nil U.LastTrigger=nil end function U.GetSection(U)return View:FindFirstChild(U)end return U
-- Create component
local Component = Cheer.CreateComponent("BTToolInformationManager", View)

function Component.Start(Core)
	-- Save reference to core API
	getfenv(1).Core = Core

	-- Return component for chaining
	return Component
end

function Component.RegisterSection(SectionName)
	-- Registers triggers for the given section

	-- Get section
	local Section = Component.GetSection(SectionName)

	-- Reset fade timer on hover
	Cheer.Bind(Section.MouseEnter, function()
		if Component.CurrentSection == Section then
			Component.CurrentFadeTimer = false
		end
	end)

	-- Start fade time on unhover
	Cheer.Bind(Section.MouseLeave, function()
		Component.StartFadeTimer(true)
	end)
end

function Component.StartFadeTimer(Override)
	-- Creates timer to disappear current section after 2 seconds unless overridden

	if Component.CurrentFadeTimer == false and not Override then
		return
	end

	-- Generate unique trigger ID
	local TriggerId = HttpService:GenerateGUID()

	-- Register timer
	Component.CurrentFadeTimer = TriggerId

	-- Start timer
	Delay(2, function()
		if Component.CurrentFadeTimer == TriggerId then
			Component.HideCurrentSection()
		end
	end)
end

function Component.StartShowTimer(SectionName)
	-- Creates timer to show content after hovering for over half a second

	-- Only override current section if also triggered by hover
	if Component.LastTrigger == "Click" then
		return
	end

	-- Generate unique trigger ID
	local TriggerId = HttpService:GenerateGUID()

	-- Register timer
	Component.CurrentShowTimer = TriggerId

	-- Start timer
	Delay(0.25, function()
		if Component.CurrentShowTimer == TriggerId then
			Component.ShowSection(SectionName, "Hover")
			Component.StartFadeTimer()
		end
	end)
end

function Component.ProcessHover(Tool, SectionName)
	-- Only override current section if also triggered by hover
	if Component.LastTrigger == "Click" then
		return
	end

	wait()

	-- Start a show timer
	Component.StartShowTimer(SectionName)
end

function Component.ShowSection(SectionName, TriggerType)
	-- Hide any current section
	Component.HideCurrentSection()

	-- Get section
	local Section = Component.GetSection(SectionName)

	-- Set new current section
	Component.CurrentSection = Section
	Component.LastTrigger = TriggerType

	-- Show the new section
	Section.Visible = true
end

function Component.ProcessUnhover(Tool, SectionName)
	-- Clear any other show timer
	Component.CurrentShowTimer = nil

	-- Only override current section if triggered by a hover
	if Component.LastTrigger == "Click" then
		return
	end

	-- Get section
	local Section = Component.GetSection(SectionName)

	-- Disappear after 2 seconds unless overridden
	if Component.CurrentSection == Section then
		Component.StartFadeTimer()
	end
end

function Component.ProcessClick(Tool, SectionName)
	-- Show the new section
	Component.ShowSection(SectionName, "Click")

	-- Disappear after 2 seconds unless overridden
	Component.StartFadeTimer()
end

function Component.HideCurrentSection()
	-- Ensure there is a current section
	if not Component.CurrentSection then
		return
	end

	-- Hide section
	Component.CurrentSection.Visible = false

	-- Disable section fade timer if any
	Component.CurrentFadeTimer = nil

	-- Unregister current section
	Component.CurrentSection = nil
	Component.LastTrigger = nil
end

function Component.GetSection(SectionName)
	-- Return the information section with the given name
	return View:FindFirstChild(SectionName)
end

return Component
