local Z=Vector2.new(math.huge,math.huge)function TextLabel.getSize(y)if not(y.props.Width or y.props.Height or y.props.Size=="\087\082\065\080\095\067\079\078\084\069\078\084")then return y.props.Size end local F,g if typeof(y.props.Width)=="\085\068\105\109"then F=y.props.Width elseif typeof(y.props.Height)=="\085\068\105\109"then g=y.props.Height end local N=y.props.TextSize if y.props.TextScaled and y.AbsoluteSize then N=y.AbsoluteSize.Y end local O=TextService:GetTextSize(y.props.Text,N,y.props.Font,Z)if not F and(y.props.Width=="\087\082\065\080\095\067\079\078\084\069\078\084"or y.props.Size=="\087\082\065\080\095\067\079\078\084\069\078\084")then F=UDim.new(0,O.X)end if not g and(y.props.Height=="\087\082\065\080\095\067\079\078\084\069\078\084"or y.props.Size=="\087\082\065\080\095\067\079\078\084\069\078\084")then g=UDim.new(0,O.Y)end return UDim2.new(F or y.props.Size and y.props.Size.X or UDim.new(),g or y.props.Size and y.props.Size.Y or UDim.new())end function TextLabel.updateSize(Z)if not Z.Mounted then return end local y=Z:getSize()local F=Z.props.TextScaled and(Z.AbsoluteSize and Z.AbsoluteSize.Y)or Z.props.TextSize if Z.state.Size~=y or Z.state.TextSize~=F then Z:setState({Size=y;TextSize=F})end end function TextLabel.init(Z)Z.Updating=true Z.state={Size=UDim2.new(),TextSize=0}end function TextLabel.willUpdate(F,Z,y)F.Updating=true end function TextLabel.render(Z)local y=Support.Merge({},Z.props,{Size=Z.state.Size,TextSize=Z.state.TextSize,TextScaled=false,[Roact.Ref]=function(y)Z.AbsoluteSize=y and y.AbsoluteSize or Z.AbsoluteSize end,[Roact.Change.AbsoluteSize]=function(y)Z.AbsoluteSize=y.AbsoluteSize if not Z.Updating then Z:updateSize()end end})if type(y.TextColor)=="\115\116\114\105\110\103"then local Z,F,g=(y.TextColor:lower()):match("\035\063\040\046\046\041\040\046\046\041\040\046\046\041")y.TextColor3=Color3.fromRGB(tonumber(Z,16),tonumber(F,16),tonumber(g,16))end local F=Support.Merge({},Z.props[Roact.Children])y.Width=nil y.Height=nil y.Bold=nil y.TextColor=nil y.AspectRatio=nil y[Roact.Children]=nil if Z.props.AspectRatio then local y=new("\085\073\065\115\112\101\099\116\082\097\116\105\111\067\111\110\115\116\114\097\105\110\116",{AspectRatio=Z.props.AspectRatio})F.AspectRatio=y end if Z.props.Bold then local Z=Support.CloneTable(y)Z.Size=UDim2.new(1,0,1,0)Z.Position=nil Z.TextScaled=true Z.AnchorPoint=nil F.Bold=new(TextLabel,Z)end return new("\084\101\120\116\076\097\098\101\108",y,F)end function TextLabel.didMount(Z)Z.Updating=nil Z.Mounted=true Z:updateSize()end function TextLabel.willUnmount(Z)Z.Mounted=nil end function TextLabel.didUpdate(F,Z,y)F.Updating=nil F:updateSize()end return TextLabel
-- Constants
local INFINITE_BOUNDS = Vector2.new(math.huge, math.huge)

function TextLabel:getSize()
	-- Return size directly if fixed
	if not (self.props.Width or self.props.Height or self.props.Size == "WRAP_CONTENT") then
		return self.props.Size
	end

	-- Get fixed sizes for individual axes
	local Width, Height
	if typeof(self.props.Width) == "UDim" then
		Width = self.props.Width
	elseif typeof(self.props.Height) == "UDim" then
		Height = self.props.Height
	end

	-- Get text size from height if autoscaled
	local TextSize = self.props.TextSize
	if self.props.TextScaled and self.AbsoluteSize then
		TextSize = self.AbsoluteSize.Y
	end

	-- Calculate content bounds
	local Bounds = TextService:GetTextSize(self.props.Text, TextSize, self.props.Font, INFINITE_BOUNDS)

	-- Set width and height based on content if requested
	if not Width and (self.props.Width == "WRAP_CONTENT" or self.props.Size == "WRAP_CONTENT") then
		Width = UDim.new(0, Bounds.X)
	end
	if not Height and (self.props.Height == "WRAP_CONTENT" or self.props.Size == "WRAP_CONTENT") then
		Height = UDim.new(0, Bounds.Y)
	end

	-- Return the calculated size
	return UDim2.new(
		Width or (self.props.Size and self.props.Size.X) or UDim.new(),
		Height or (self.props.Size and self.props.Size.Y) or UDim.new()
	)
end

function TextLabel:updateSize()
	if not self.Mounted then
		return
	end

	-- Calculate new size
	local Size = self:getSize()
	local TextSize = self.props.TextScaled and (self.AbsoluteSize and self.AbsoluteSize.Y) or self.props.TextSize

	-- Check if state is outdated
	if self.state.Size ~= Size or self.state.TextSize ~= TextSize then
		-- Update state
		self:setState({
			Size = Size,
			TextSize = TextSize,
		})
	end
end

function TextLabel:init()
	self.Updating = true
	self.state = {
		Size = UDim2.new(),
		TextSize = 0,
	}
end

function TextLabel:willUpdate(nextProps, nextState)
	self.Updating = true
end

function TextLabel:render()
	local props = Support.Merge({}, self.props, {

		-- Override size
		Size = self.state.Size,
		TextSize = self.state.TextSize,
		TextScaled = false,

		-- Get initial size
		[Roact.Ref] = function(rbx)
			self.AbsoluteSize = rbx and rbx.AbsoluteSize or self.AbsoluteSize
		end,

		-- Track size changes
		[Roact.Change.AbsoluteSize] = function(rbx)
			self.AbsoluteSize = rbx.AbsoluteSize
			if not self.Updating then
				self:updateSize()
			end
		end,
	})

	-- Parse hex colors
	if type(props.TextColor) == "string" then
		local R, G, B = props.TextColor:lower():match("#?(..)(..)(..)")
		props.TextColor3 = Color3.fromRGB(tonumber(R, 16), tonumber(G, 16), tonumber(B, 16))
	end

	-- Separate children from props
	local children = Support.Merge({}, self.props[Roact.Children])

	-- Clear invalid props
	props.Width = nil
	props.Height = nil
	props.Bold = nil
	props.TextColor = nil
	props.AspectRatio = nil
	props[Roact.Children] = nil

	-- Include aspect ratio constraint if specified
	if self.props.AspectRatio then
		local Constraint = new("UIAspectRatioConstraint", {
			AspectRatio = self.props.AspectRatio,
		})

		-- Insert constraint into children
		children.AspectRatio = Constraint
	end

	-- Add a bold layer if specified
	if self.props.Bold then
		local BoldProps = Support.CloneTable(props)
		BoldProps.Size = UDim2.new(1, 0, 1, 0)
		BoldProps.Position = nil
		BoldProps.TextScaled = true
		BoldProps.AnchorPoint = nil
		children.Bold = new(TextLabel, BoldProps)
	end

	-- Display component in wrapper
	return new("TextLabel", props, children)
end

function TextLabel:didMount()
	self.Updating = nil
	self.Mounted = true
	self:updateSize()
end

function TextLabel:willUnmount()
	self.Mounted = nil
end

function TextLabel:didUpdate(previousProps, previousState)
	self.Updating = nil
	self:updateSize()
end

return TextLabel
