-- Decompiled with the Synapse X Luau decompiler.

local v1 = {};
local l__UserInputService__2 = game:GetService("UserInputService");
local l__RunService__3 = game:GetService("RunService");
local l__Players__4 = game:GetService("Players");
local l__TextService__5 = game:GetService("TextService");
local v6 = l__Players__4.LocalPlayer;
while not v6 do
	l__Players__4.PlayerAdded:wait();
	v6 = l__Players__4.LocalPlayer;
end;
local l__Chat__7 = game:GetService("Chat");
local l__Parent__8 = script.Parent;
local v9 = require(l__Chat__7:WaitForChild("ClientChatModules"):WaitForChild("ChatSettings"));
local v10 = require(l__Parent__8:WaitForChild("CurveUtil"));
local v11 = require(l__Parent__8:WaitForChild("MessageSender"));
local u1 = nil;
pcall(function()
	u1 = require(game:GetService("Chat").ClientChatModules.ChatLocalization);
end);
if u1 == nil then
	u1 = {
		Get = function(p1, p2, p3)
			return p3;
		end
	};
end;
local v12 = {};
v12.__index = v12;
function v12.CreateGuiObjects(p4, p5)
	p4.ChatBarParentFrame = p5;
	local v13 = Instance.new("Frame");
	v13.Selectable = false;
	v13.Size = UDim2.new(1, 0, 1, 0);
	v13.BackgroundTransparency = 0.6;
	v13.BorderSizePixel = 0;
	v13.BackgroundColor3 = v9.ChatBarBackGroundColor;
	v13.Parent = p5;
	local v14 = Instance.new("Frame");
	v14.Selectable = false;
	v14.Name = "BoxFrame";
	v14.BackgroundTransparency = 0.6;
	v14.BorderSizePixel = 0;
	v14.BackgroundColor3 = v9.ChatBarBoxColor;
	v14.Size = UDim2.new(1, -14, 1, -14);
	v14.Position = UDim2.new(0, 7, 0, 7);
	v14.Parent = v13;
	local v15 = Instance.new("Frame");
	v15.BackgroundTransparency = 1;
	v15.Size = UDim2.new(1, -10, 1, -10);
	v15.Position = UDim2.new(0, 5, 0, 5);
	v15.Parent = v14;
	local v16 = Instance.new("TextBox");
	v16.Selectable = v9.GamepadNavigationEnabled;
	v16.Name = "ChatBar";
	v16.BackgroundTransparency = 1;
	v16.Size = UDim2.new(1, 0, 1, 0);
	v16.Position = UDim2.new(0, 0, 0, 0);
	v16.TextSize = v9.ChatBarTextSize;
	v16.Font = v9.ChatBarFont;
	v16.TextColor3 = v9.ChatBarTextColor;
	v16.TextTransparency = 0.4;
	v16.TextStrokeTransparency = 1;
	v16.ClearTextOnFocus = false;
	v16.TextXAlignment = Enum.TextXAlignment.Left;
	v16.TextYAlignment = Enum.TextYAlignment.Top;
	v16.TextWrapped = true;
	v16.Text = "";
	v16.Parent = v15;
	local v17 = Instance.new("TextButton");
	v17.Selectable = false;
	v17.Name = "MessageMode";
	v17.BackgroundTransparency = 1;
	v17.Position = UDim2.new(0, 0, 0, 0);
	v17.TextSize = v9.ChatBarTextSize;
	v17.Font = v9.ChatBarFont;
	v17.TextXAlignment = Enum.TextXAlignment.Left;
	v17.TextWrapped = true;
	v17.Text = "";
	v17.Size = UDim2.new(0, 0, 0, 0);
	v17.TextYAlignment = Enum.TextYAlignment.Center;
	v17.TextColor3 = p4:GetDefaultChannelNameColor();
	v17.Visible = true;
	v17.Parent = v15;
	local v18 = Instance.new("TextLabel");
	v18.Selectable = false;
	v18.TextWrapped = true;
	v18.BackgroundTransparency = 1;
	v18.Size = v16.Size;
	v18.Position = v16.Position;
	v18.TextSize = v16.TextSize;
	v18.Font = v16.Font;
	v18.TextColor3 = v16.TextColor3;
	v18.TextTransparency = v16.TextTransparency;
	v18.TextStrokeTransparency = v16.TextStrokeTransparency;
	v18.TextXAlignment = v16.TextXAlignment;
	v18.TextYAlignment = v16.TextYAlignment;
	v18.Text = "...";
	v18.Parent = v15;
	p4.GuiObject = v13;
	p4.TextBox = v16;
	p4.TextLabel = v18;
	p4.GuiObjects.BaseFrame = v13;
	p4.GuiObjects.TextBoxFrame = v14;
	p4.GuiObjects.TextBox = v16;
	p4.GuiObjects.TextLabel = v18;
	p4.GuiObjects.MessageModeTextButton = v17;
	p4:AnimGuiObjects();
	p4:SetUpTextBoxEvents(v16, v18, v17);
	if p4.UserHasChatOff then
		p4:DoLockChatBar();
	end;
	p4.eGuiObjectsChanged:Fire();
end;
function v12.DoLockChatBar(p6)
	if p6.TextLabel then
		if v6.UserId > 0 then
			p6.TextLabel.Text = u1:Get("GameChat_ChatMessageValidator_SettingsError", "To chat in game, turn on chat in your Privacy Settings.");
		else
			p6.TextLabel.Text = u1:Get("GameChat_SwallowGuestChat_Message", "Sign up to chat in game.");
		end;
		p6:CalculateSize();
	end;
	if p6.TextBox then
		p6.TextBox.Active = false;
		p6.TextBox.Focused:connect(function()
			p6.TextBox:ReleaseFocus();
		end);
	end;
end;
function v12.SetUpTextBoxEvents(p7, p8, p9, p10)
	for v19, v20 in pairs(p7.TextBoxConnections) do
		v20:disconnect();
		p7.TextBoxConnections[v19] = nil;
	end;
	p7.TextBoxConnections.UserInputBegan = l__UserInputService__2.InputBegan:connect(function(p11, p12)
		if p11.KeyCode == Enum.KeyCode.Backspace and p7:IsFocused() and p8.Text == "" then
			p7:SetChannelTarget(v9.GeneralChannelName);
		end;
	end);
	p7.TextBoxConnections.TextBoxChanged = p8.Changed:connect(function(p13)
		local v21 = nil;
		if p13 == "AbsoluteSize" then
			p7:CalculateSize();
			return;
		end;
		if p13 ~= "Text" then
			return;
		end;
		p7:CalculateSize();
		if v9.MaximumMessageLength < string.len(p8.Text) then
			p8.Text = string.sub(p8.Text, 1, v9.MaximumMessageLength);
			return;
		end;
		if not p7.InCustomState then
			v21 = p7.CommandProcessor:ProcessInProgressChatMessage(p8.Text, p7.ChatWindow, p7);
			if not v21 then
				return;
			end;
		else
			p7.CustomState:TextUpdated();
			return;
		end;
		p7.InCustomState = true;
		p7.CustomState = v21;
	end);
	p7.TextBoxConnections.MessageModeClick = p10.MouseButton1Click:connect(function()
		if p10.Text ~= "" then
			p7:SetChannelTarget(v9.GeneralChannelName);
		end;
	end);
	p7.TextBoxConnections.TextBoxFocused = p8.Focused:connect(function()
		if not p7.UserHasChatOff then
			p7:CalculateSize();
			p9.Visible = false;
		end;
	end);
	p7.TextBoxConnections.TextBoxFocusLost = p8.FocusLost:connect(function(p14, p15)
		p7:CalculateSize();
		if p15 and p15.KeyCode == Enum.KeyCode.Escape then
			p8.Text = "";
		end;
		if p8.Text ~= "" then
			p9.Visible = false;
			return;
		end;
		p9.Visible = true;
	end);
end;
function v12.GetTextBox(p16)
	return p16.TextBox;
end;
function v12.GetMessageModeTextButton(p17)
	return p17.GuiObjects.MessageModeTextButton;
end;
function v12.GetMessageModeTextLabel(p18)
	return p18:GetMessageModeTextButton();
end;
function v12.IsFocused(p19)
	if p19.UserHasChatOff then
		return false;
	end;
	return p19:GetTextBox():IsFocused();
end;
function v12.GetVisible(p20)
	return p20.GuiObject.Visible;
end;
function v12.CaptureFocus(p21)
	if not p21.UserHasChatOff then
		p21:GetTextBox():CaptureFocus();
	end;
end;
function v12.ReleaseFocus(p22, p23)
	p22:GetTextBox():ReleaseFocus(p23);
end;
function v12.ResetText(p24)
	p24:GetTextBox().Text = "";
end;
function v12.SetText(p25, p26)
	p25:GetTextBox().Text = p26;
end;
function v12.GetEnabled(p27)
	return p27.GuiObject.Visible;
end;
function v12.SetEnabled(p28, p29)
	if p28.UserHasChatOff then
		p28.GuiObject.Visible = true;
		return;
	end;
	p28.GuiObject.Visible = p29;
end;
function v12.SetTextLabelText(p30, p31)
	if not p30.UserHasChatOff then
		p30.TextLabel.Text = p31;
	end;
end;
function v12.SetTextBoxText(p32, p33)
	p32.TextBox.Text = p33;
end;
function v12.GetTextBoxText(p34)
	return p34.TextBox.Text;
end;
function v12.ResetSize(p35)
	p35.TargetYSize = 0;
	p35:TweenToTargetYSize();
end;
function v12.CalculateSize(p36)
	if p36.CalculatingSizeLock then
		return;
	end;
	p36.CalculatingSizeLock = true;
	if p36:IsFocused() or p36.TextBox.Text ~= "" then
		local v22 = p36.TextBox.TextSize;
		local l__TextBox__23 = p36.TextBox;
		local v24 = l__TextService__5:GetTextSize(l__TextBox__23.Text, l__TextBox__23.TextSize, l__TextBox__23.Font, Vector2.new(l__TextBox__23.AbsoluteSize.X, 10000)).Y;
	else
		v22 = p36.TextLabel.TextSize;
		local l__TextLabel__25 = p36.TextLabel;
		v24 = l__TextService__5:GetTextSize(l__TextLabel__25.Text, l__TextLabel__25.TextSize, l__TextLabel__25.Font, Vector2.new(l__TextLabel__25.AbsoluteSize.X, 10000)).Y;
	end;
	local v26 = v24 - v22;
	if p36.TargetYSize ~= v26 then
		p36.TargetYSize = v26;
		p36:TweenToTargetYSize();
	end;
	p36.CalculatingSizeLock = false;
end;
function v12.TweenToTargetYSize(p37)
	local v27 = UDim2.new(1, 0, 1, p37.TargetYSize);
	p37.GuiObject.Size = v27;
	p37.GuiObject.Size = p37.GuiObject.Size;
	local u2 = math.min(1, math.abs(p37.GuiObject.AbsoluteSize.Y - p37.GuiObject.AbsoluteSize.Y) * (1 / p37.TweenPixelsPerSecond));
	if not pcall(function()
		p37.GuiObject:TweenSize(v27, Enum.EasingDirection.Out, Enum.EasingStyle.Quad, u2, true);
	end) then
		p37.GuiObject.Size = v27;
	end;
end;
function v12.SetTextSize(p38, p39)
	if not p38:IsInCustomState() then
		if p38.TextBox then
			p38.TextBox.TextSize = p39;
		end;
		if p38.TextLabel then
			p38.TextLabel.TextSize = p39;
		end;
	end;
end;
function v12.GetDefaultChannelNameColor(p40)
	if not v9.DefaultChannelNameColor then
		return Color3.fromRGB(35, 76, 142);
	end;
	return v9.DefaultChannelNameColor;
end;
function v12.SetChannelTarget(p41, p42)
	local l__MessageModeTextButton__28 = p41.GuiObjects.MessageModeTextButton;
	local l__TextBox__29 = p41.TextBox;
	local l__TextLabel__30 = p41.TextLabel;
	p41.TargetChannel = p42;
	if not p41:IsInCustomState() then
		if p42 == v9.GeneralChannelName then
			l__MessageModeTextButton__28.Text = "";
			l__MessageModeTextButton__28.Size = UDim2.new(0, 0, 0, 0);
			l__TextBox__29.Size = UDim2.new(1, 0, 1, 0);
			l__TextBox__29.Position = UDim2.new(0, 0, 0, 0);
			l__TextLabel__30.Size = UDim2.new(1, 0, 1, 0);
			l__TextLabel__30.Position = UDim2.new(0, 0, 0, 0);
			return;
		end;
	else
		return;
	end;
	l__MessageModeTextButton__28.Size = UDim2.new(0, 1000, 1, 0);
	l__MessageModeTextButton__28.Text = string.format("[%s] ", p42);
	local v31 = p41:GetChannelNameColor(p42);
	if v31 then
		l__MessageModeTextButton__28.TextColor3 = v31;
	else
		l__MessageModeTextButton__28.TextColor3 = p41:GetDefaultChannelNameColor();
	end;
	local l__X__32 = l__MessageModeTextButton__28.TextBounds.X;
	l__MessageModeTextButton__28.Size = UDim2.new(0, l__X__32, 1, 0);
	l__TextBox__29.Size = UDim2.new(1, -l__X__32, 1, 0);
	l__TextBox__29.Position = UDim2.new(0, l__X__32, 0, 0);
	l__TextLabel__30.Size = UDim2.new(1, -l__X__32, 1, 0);
	l__TextLabel__30.Position = UDim2.new(0, l__X__32, 0, 0);
end;
function v12.IsInCustomState(p43)
	return p43.InCustomState;
end;
function v12.ResetCustomState(p44)
	if p44.InCustomState then
		p44.CustomState:Destroy();
		p44.CustomState = nil;
		p44.InCustomState = false;
		p44.ChatBarParentFrame:ClearAllChildren();
		p44:CreateGuiObjects(p44.ChatBarParentFrame);
		p44:SetTextLabelText(u1:Get("GameChat_ChatMain_ChatBarText", "To chat click here or press \"/\" key"));
	end;
end;
function v12.GetCustomMessage(p45)
	if not p45.InCustomState then
		return nil;
	end;
	return p45.CustomState:GetMessage();
end;
function v12.CustomStateProcessCompletedMessage(p46, p47)
	if not p46.InCustomState then
		return false;
	end;
	return p46.CustomState:ProcessCompletedMessage();
end;
function v12.FadeOutBackground(p48, p49)
	p48.AnimParams.Background_TargetTransparency = 1;
	p48.AnimParams.Background_NormalizedExptValue = v10:NormalizedDefaultExptValueInSeconds(p49);
	p48:FadeOutText(p49);
end;
function v12.FadeInBackground(p50, p51)
	p50.AnimParams.Background_TargetTransparency = 0.6;
	p50.AnimParams.Background_NormalizedExptValue = v10:NormalizedDefaultExptValueInSeconds(p51);
	p50:FadeInText(p51);
end;
function v12.FadeOutText(p52, p53)
	p52.AnimParams.Text_TargetTransparency = 1;
	p52.AnimParams.Text_NormalizedExptValue = v10:NormalizedDefaultExptValueInSeconds(p53);
end;
function v12.FadeInText(p54, p55)
	p54.AnimParams.Text_TargetTransparency = 0.4;
	p54.AnimParams.Text_NormalizedExptValue = v10:NormalizedDefaultExptValueInSeconds(p55);
end;
function v12.AnimGuiObjects(p56)
	p56.GuiObject.BackgroundTransparency = p56.AnimParams.Background_CurrentTransparency;
	p56.GuiObjects.TextBoxFrame.BackgroundTransparency = p56.AnimParams.Background_CurrentTransparency;
	p56.GuiObjects.TextLabel.TextTransparency = p56.AnimParams.Text_CurrentTransparency;
	p56.GuiObjects.TextBox.TextTransparency = p56.AnimParams.Text_CurrentTransparency;
	p56.GuiObjects.MessageModeTextButton.TextTransparency = p56.AnimParams.Text_CurrentTransparency;
end;
function v12.InitializeAnimParams(p57)
	p57.AnimParams.Text_TargetTransparency = 0.4;
	p57.AnimParams.Text_CurrentTransparency = 0.4;
	p57.AnimParams.Text_NormalizedExptValue = 1;
	p57.AnimParams.Background_TargetTransparency = 0.6;
	p57.AnimParams.Background_CurrentTransparency = 0.6;
	p57.AnimParams.Background_NormalizedExptValue = 1;
end;
function v12.Update(p58, p59)
	p58.AnimParams.Text_CurrentTransparency = v10:Expt(p58.AnimParams.Text_CurrentTransparency, p58.AnimParams.Text_TargetTransparency, p58.AnimParams.Text_NormalizedExptValue, p59);
	p58.AnimParams.Background_CurrentTransparency = v10:Expt(p58.AnimParams.Background_CurrentTransparency, p58.AnimParams.Background_TargetTransparency, p58.AnimParams.Background_NormalizedExptValue, p59);
	p58:AnimGuiObjects();
end;
function v12.SetChannelNameColor(p60, p61, p62)
	p60.ChannelNameColors[p61] = p62;
	if p60.GuiObjects.MessageModeTextButton.Text == p61 then
		p60.GuiObjects.MessageModeTextButton.TextColor3 = p62;
	end;
end;
function v12.GetChannelNameColor(p63, p64)
	return p63.ChannelNameColors[p64];
end;
function v1.new(p65, p66)
	local v33 = setmetatable({}, v12);
	v33.GuiObject = nil;
	v33.ChatBarParentFrame = nil;
	v33.TextBox = nil;
	v33.TextLabel = nil;
	v33.GuiObjects = {};
	v33.eGuiObjectsChanged = Instance.new("BindableEvent");
	v33.GuiObjectsChanged = v33.eGuiObjectsChanged.Event;
	v33.TextBoxConnections = {};
	v33.InCustomState = false;
	v33.CustomState = nil;
	v33.TargetChannel = nil;
	v33.CommandProcessor = p65;
	v33.ChatWindow = p66;
	v33.TweenPixelsPerSecond = 500;
	v33.TargetYSize = 0;
	v33.AnimParams = {};
	v33.CalculatingSizeLock = false;
	v33.ChannelNameColors = {};
	v33.UserHasChatOff = false;
	v33:InitializeAnimParams();
	v9.SettingsChanged:connect(function(p67, p68)
		if p67 == "ChatBarTextSize" then
			v33:SetTextSize(p68);
		end;
	end);
	coroutine.wrap(function()
		local v34, v35 = pcall(function()
			return l__Chat__7:CanUserChatAsync(v6.UserId);
		end);
		if (v34 and (l__RunService__3:IsStudio() and v35)) == false then
			v33.UserHasChatOff = true;
			v33:DoLockChatBar();
		end;
	end)();
	return v33;
end;
return v1;