local m=script.Parent.Parent return function(Y)local n=require(m.Bundles)local k=n.data local h=n.themeSystem local P=n.Fusion local A=P.New local L=P.Children local u=P.Value local K=P.Observer local X=P.OnEvent local V=require(m.utilities)local S=V.get local s=V.animate local g=V.typecheck local p=V.customFont local c=require(m.simpleElements)local O=c.UIListLayout local l=c.UIPadding local o=c.UICorner local G=Enum.SortOrder local b=Enum.FillDirection local J=Enum.HorizontalAlignment local N=Enum.VerticalAlignment local t,j=g(Y,{Name="";Image=""},{Y.Image and""or"\073\109\097\103\101"})assert(t,table.concat(j,"\n"))local a=k.find("\115\101\108\101\099\116\101\100\084\097\098")local F=k.find("\105\115\070\105\114\115\116")local U=k.add(Y)local E=Y.Parent local v=Y.Name local z,B=nil,u(false)if Y.Image then z=Y.Image B:set(true)end local e=u(false);(K(a.string)):onChange(function()local m=S(a.string)e:set(m==U.uid)end);(A("\084\101\120\116\066\117\116\116\111\110"))({Name=U.uid;Parent=E,Size=UDim2.new(1,0,0,36);BackgroundColor3=s(function()return S(e)and h.get("\115\101\108\101\099\116\101\100\084\097\098")or h.get("\098\097\099\107\103\114\111\117\110\100\050")end,40,1),[X("\065\099\116\105\118\097\116\101\100")]=function()a:update("\115\116\114\105\110\103",U.uid)end,[L]={o(4),l(6);O(G.LayoutOrder,b.Horizontal,J.Left,N.Center,UDim.new(0,4));(A("\073\109\097\103\101\076\097\098\101\108"))({Visible=B,BackgroundTransparency=1,Size=UDim2.fromOffset(24,24);ImageColor3=h.text2;Image=z;ImageTransparency=s(function()return S(e)and 0 or.6 end,40,1)}),(A("\084\101\120\116\076\097\098\101\108"))({Size=S(B)and UDim2.new(1,-28,1)or UDim2.fromScale(1,1),FontFace=p("\077\111\110\116\115\101\114\114\097\116",Enum.FontWeight.Bold),TextColor3=h.text2,TextScaled=true;Text=v,BackgroundTransparency=1,TextXAlignment=Enum.TextXAlignment.Left,TextTransparency=s(function()return S(e)and 0 or.6 end,40,1),[L]={(A("\085\073\084\101\120\116\083\105\122\101\067\111\110\115\116\114\097\105\110\116"))({MinTextSize=1,MaxTextSize=16})}})}})if not S(F.boolean)then F:update("\098\111\111\108\101\097\110",true)a:update("\115\116\114\105\110\103",U.uid)end return U end
local darius = script.Parent.Parent
return function(property)
	local Bundles = require(darius.Bundles)
	local data = Bundles.data
	local theme = Bundles.themeSystem
	local Fusion = Bundles.Fusion
		local new = Fusion.New
		local children = Fusion.Children
		local value = Fusion.Value
		local observe = Fusion.Observer
		local onevent = Fusion.OnEvent

	local utilities = require(darius.utilities)
	local get = utilities.get
	local animate = utilities.animate
	local typecheck = utilities.typecheck
	local customFont = utilities.customFont

	local simpleElements = require(darius.simpleElements)
	local UIListLayout = simpleElements.UIListLayout
	local UIPadding = simpleElements.UIPadding
	local UICorner = simpleElements.UICorner
	local SO = Enum.SortOrder
	local FD = Enum.FillDirection
	local HA = Enum.HorizontalAlignment
	local VA = Enum.VerticalAlignment

	-- Typecheck

	local didPass, failedItems = typecheck(property, {
		Name = "",
		Image = ""
	},{
		property.Image and "" or "Image"
	})

	assert(didPass, table.concat(failedItems, "\n"))

	-- Data

	local selectedTab = data.find("selectedTab")
	local isFirst = data.find("isFirst")
	local tab = data.add(property)

	-- Properties

	local _parent = property.Parent
	local name = property.Name
	local image, hasImage = nil, value(false)
	if property.Image then
		image = property.Image
		hasImage:set(true)
	end

	-- Variables

	local isSelected = value(false)
	observe(selectedTab.string):onChange(function()
		local _selectedTab = get(selectedTab.string)
		isSelected:set(_selectedTab == tab.uid)
	end)

	-- Instance

	new "TextButton" {
		Name = tab.uid,
		Parent = _parent,
		Size = UDim2.new(1,0,0,36),
		BackgroundColor3 = animate(function()
			return get(isSelected) and theme.get("selectedTab") or theme.get("background2")
		end,40,1),

		[onevent "Activated"] = function()
			selectedTab:update("string", tab.uid)
		end,

		[children] = {
			UICorner(4),
			UIPadding(6),
			UIListLayout(SO.LayoutOrder,FD.Horizontal,HA.Left,VA.Center,UDim.new(0,4)),
			new "ImageLabel" {
				Visible = hasImage,
				BackgroundTransparency = 1,
				Size = UDim2.fromOffset(24,24),
				ImageColor3 = theme.text2,
				Image = image,
				ImageTransparency = animate(function()
					return get(isSelected) and 0 or 0.6
				end,40,1)
			},
			new "TextLabel" {
				Size = get(hasImage) and UDim2.new(1,-28,1) or UDim2.fromScale(1,1),
				FontFace = customFont("Montserrat", Enum.FontWeight.Bold),
				TextColor3 = theme.text2,
				TextScaled = true,
				Text = name,
				BackgroundTransparency = 1,
				TextXAlignment = Enum.TextXAlignment.Left,
				TextTransparency = animate(function()
					return get(isSelected) and 0 or 0.6
				end,40,1),

				[children] = {
					new "UITextSizeConstraint" {
						MinTextSize = 1,
						MaxTextSize = 16
					}
				}
			}
		}
	}
	if not get(isFirst.boolean) then
		isFirst:update("boolean", true)
		selectedTab:update("string", tab.uid)
	end
	return tab
end