local z="\066\097\115\101\070\114\097\109\101"local y="\066\097\115\101\077\101\115\115\097\103\101"local H="\085\112\100\097\116\101\084\101\120\116\070\117\110\099\116\105\111\110"local d="\071\101\116\072\101\105\103\104\116\070\117\110\099\116\105\111\110"local m="\070\097\100\101\073\110\070\117\110\099\116\105\111\110"local X="\070\097\100\101\079\117\116\070\117\110\099\116\105\111\110"local b="\085\112\100\097\116\101\065\110\105\109\070\117\110\099\116\105\111\110"local q=game:GetService("\080\108\097\121\101\114\115")local i=q.LocalPlayer while not i do q.ChildAdded:wait()i=q.LocalPlayer end local U=script.Parent.Parent local N=require(U:WaitForChild("\067\104\097\116\083\101\116\116\105\110\103\115"))local j={}local M={}M.__index=M local P=Instance.new("\084\101\120\116\076\097\098\101\108")P.Selectable=false P.TextWrapped=true P.Position=UDim2.new(1,0,1,0)function WaitUntilParentedCorrectly()while not P:IsDescendantOf(i)do P.AncestryChanged:wait()end end local C={}function M.GetStringTextBounds(m,z,y,H,d)WaitUntilParentedCorrectly()d=d or false if not C[z]then C[z]={}end if not C[z][y]then C[z][y]={}end if not C[z][y][d]then C[z][y][d]={}end if not C[z][y][d][H]then P.Text=z P.Font=y P.TextSize=H if d then P.TextWrapped=true P.Size=d else P.TextWrapped=false end C[z][y][d][H]=P.TextBounds end return C[z][y][d][H]end

local KEY_BASE_FRAME = "BaseFrame"
local KEY_BASE_MESSAGE = "BaseMessage"
local KEY_UPDATE_TEXT_FUNC = "UpdateTextFunction"
local KEY_GET_HEIGHT = "GetHeightFunction"
local KEY_FADE_IN = "FadeInFunction"
local KEY_FADE_OUT = "FadeOutFunction"
local KEY_UPDATE_ANIMATION = "UpdateAnimFunction"

local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
while not LocalPlayer do
	Players.ChildAdded:wait()
	LocalPlayer = Players.LocalPlayer
end

local clientChatModules = script.Parent.Parent
local ChatSettings = require(clientChatModules:WaitForChild("ChatSettings"))

local module = {}
local methods = {}
methods.__index = methods

local testLabel = Instance.new("TextLabel")
testLabel.Selectable = false
testLabel.TextWrapped = true
testLabel.Position = UDim2.new(1, 0, 1, 0)

function WaitUntilParentedCorrectly()
	while not testLabel:IsDescendantOf(LocalPlayer) do
		testLabel.AncestryChanged:wait()
	end
end

local TextSizeCache = {}
function methods:GetStringTextBounds(text, font, textSize, sizeBounds)
	WaitUntilParentedCorrectly()
	sizeBounds = sizeBounds or false
	if not TextSizeCache[text] then
		TextSizeCache[text] = {}
	end
	if not TextSizeCache[text][font] then
		TextSizeCache[text][font] = {}
	end
	if not TextSizeCache[text][font][sizeBounds] then
		TextSizeCache[text][font][sizeBounds] = {}
	end
	if not TextSizeCache[text][font][sizeBounds][textSize] then
		testLabel.Text = text
		testLabel.Font = font
		testLabel.TextSize = textSize
		if sizeBounds then
			testLabel.TextWrapped = true;
			testLabel.Size = sizeBounds
		else
			testLabel.TextWrapped = false;
		end
		TextSizeCache[text][font][sizeBounds][textSize] = testLabel.TextBounds
	end
	return TextSizeCache[text][font][sizeBounds][textSize]
end