-- Decompiled with the Synapse X Luau decompiler.


client = nil;
cPcall = nil;
Pcall = nil;
Routine = nil;
service = nil;
gTable = nil;
return function(p1)
	local l__PlayerGui__1 = service.Players.LocalPlayer.PlayerGui;
	local l__Parent__2 = script.Parent.Parent;
	local l__Frame__3 = l__Parent__2.Frame;
	local l__ScrollingFrame__4 = l__Parent__2.Frame.ScrollingFrame;
	local v5 = client.Remote.Get("Setting", { "SplitKey", "ConsoleKeyCode", "BatchKey" });
	local v6 = client.Remote.Get("FormattedCommands") or {};
	l__Frame__3.Position = UDim2.new(0, 0, 0, -200);
	l__Frame__3.Visible = false;
	l__Frame__3.Size = UDim2.new(1, 0, 0, 40);
	l__ScrollingFrame__4.Visible = false;
	if client.Variables.ConsoleOpen then
		if client.Variables.ChatEnabled then
			service.StarterGui:SetCoreGuiEnabled("Chat", true);
		end;
		if client.Variables.PlayerListEnabled then
			service.StarterGui:SetCoreGuiEnabled("PlayerList", true);
		end;
		if client.UI.Get("Notif") then
			client.UI.Get("Notif", nil, true).Object.LABEL.Visible = true;
		end;
		local v7 = client.UI.Get("Chat", nil, true);
		if v7 then
			v7.Object.Drag.Visible = true;
		end;
		local v8 = client.UI.Get("PlayerList", nil, true);
		if v8 then
			v8.Object.Drag.Visible = true;
		end;
		local v9 = client.UI.Get("HintHolder", nil, true);
		if v9 then
			v9.Object.Frame.Visible = true;
		end;
	end;
	client.Variables.ChatEnabled = service.StarterGui:GetCoreGuiEnabled("Chat");
	client.Variables.PlayerListEnabled = service.StarterGui:GetCoreGuiEnabled("PlayerList");
	local u1 = false;
	local l__PlayerList__2 = l__Parent__2.Frame.PlayerList;
	local u3 = false;
	local l__TextBox__4 = l__Parent__2.Frame.TextBox;
	local function u5()
		if l__Parent__2:IsDescendantOf(game) and not u1 then
			u1 = true;
			l__ScrollingFrame__4:ClearAllChildren();
			l__ScrollingFrame__4.CanvasSize = UDim2.new(0, 0, 0, 0);
			l__ScrollingFrame__4.ScrollingEnabled = false;
			l__Frame__3.Size = UDim2.new(1, 0, 0, 40);
			l__ScrollingFrame__4.Visible = false;
			l__PlayerList__2.Visible = false;
			scrollOpen = false;
			if client.Variables.ChatEnabled then
				service.StarterGui:SetCoreGuiEnabled("Chat", true);
			end;
			if client.Variables.PlayerListEnabled then
				service.StarterGui:SetCoreGuiEnabled("PlayerList", true);
			end;
			if client.UI.Get("Notif") then
				client.UI.Get("Notif", nil, true).Object.LABEL.Visible = true;
			end;
			local v10 = client.UI.Get("Chat", nil, true);
			if v10 then
				v10.Object.Drag.Visible = true;
			end;
			local v11 = client.UI.Get("PlayerList", nil, true);
			if v11 then
				v11.Object.Drag.Visible = true;
			end;
			local v12 = client.UI.Get("HintHolder", nil, true);
			if v12 then
				v12.Object.Frame.Visible = true;
			end;
			service.SafeTweenPos(l__Frame__3, UDim2.new(0, 0, 0, -200), "Out", "Linear", 0.2, true);
			u1 = false;
			u3 = false;
		end;
	end;
	l__TextBox__4.FocusLost:connect(function(p2)
		if p2 and l__TextBox__4.Text ~= "" and string.len(l__TextBox__4.Text) > 1 then
			client.Remote.Send("ProcessCommand", l__TextBox__4.Text);
		end;
		u5();
	end);
	local function u6()
		if l__Parent__2:IsDescendantOf(game) and not u1 then
			u1 = true;
			client.Variables.ChatEnabled = service.StarterGui:GetCoreGuiEnabled("Chat");
			client.Variables.PlayerListEnabled = service.StarterGui:GetCoreGuiEnabled("PlayerList");
			service.StarterGui:SetCoreGuiEnabled("Chat", false);
			service.StarterGui:SetCoreGuiEnabled("PlayerList", false);
			l__ScrollingFrame__4.ScrollingEnabled = true;
			l__PlayerList__2.ScrollingEnabled = true;
			if client.UI.Get("Notif") then
				client.UI.Get("Notif", nil, true).Object.LABEL.Visible = false;
			end;
			local v13 = client.UI.Get("Chat", nil, true);
			if v13 then
				v13.Object.Drag.Visible = false;
			end;
			local v14 = client.UI.Get("PlayerList", nil, true);
			if v14 then
				v14.Object.Drag.Visible = false;
			end;
			local v15 = client.UI.Get("HintHolder", nil, true);
			if v15 then
				v15.Object.Frame.Visible = false;
			end;
			l__Frame__3.Size = UDim2.new(1, 0, 0, 40);
			l__ScrollingFrame__4.Visible = false;
			l__PlayerList__2.Visible = false;
			scrollOpen = false;
			l__TextBox__4.Text = "";
			l__Frame__3.Visible = true;
			l__Frame__3.Position = UDim2.new(0, 0, 0, 0);
			l__TextBox__4:CaptureFocus();
			l__TextBox__4.Text = "";
			wait();
			l__TextBox__4.Text = "";
			u1 = false;
			u3 = true;
		end;
	end;
	local l__BatchKey__7 = v5.BatchKey;
	local l__SplitKey__8 = v5.SplitKey;
	local l__Entry__9 = l__Parent__2.Entry;
	l__TextBox__4.Changed:connect(function(p3)
		if p3 ~= "Text" or l__TextBox__4.Text == "" or not u6 then
			if p3 == "Text" and l__TextBox__4.Text == "" and u3 then
				service.SafeTweenSize(l__Frame__3, UDim2.new(1, 0, 0, 40), nil, nil, 0.3, nil, function()
					if scrollOpen then
						l__Frame__3.Size = UDim2.new(1, 0, 0, 140);
					end;
				end);
				l__ScrollingFrame__4.Visible = false;
				l__PlayerList__2.Visible = false;
				scrollOpen = false;
				l__ScrollingFrame__4:ClearAllChildren();
				l__ScrollingFrame__4.CanvasSize = UDim2.new(0, 0, 0, 0);
			end;
			return;
		end;
		l__ScrollingFrame__4:ClearAllChildren();
		l__PlayerList__2:ClearAllChildren();
		local v16 = l__TextBox__4.Text;
		if string.match(v16, ".*" .. l__BatchKey__7 .. "([^']+)") then
			v16 = string.match(string.match(v16, ".*" .. l__BatchKey__7 .. "([^']+)"), "^%s*(.-)%s*$");
		end;
		local v17 = 0;
		local v18 = string.match(v16, ".+" .. l__SplitKey__8 .. "(.*)$");
		local l__next__19 = next;
		local v20, v21 = service.Players:GetChildren();
		while true do
			local v22, v23 = l__next__19(v20, v21);
			if not v22 then
				break;
			end;
			v21 = v22;
			if v18 then
				if string.sub(string.lower(tostring(v23)), 1, #v18) == string.lower(v18) or string.match(v16, l__SplitKey__8 .. "$") then
					local v24 = l__Entry__9:Clone();
					v24.Text = tostring(v23);
					v24.TextXAlignment = "Right";
					v24.Visible = true;
					v24.Parent = l__PlayerList__2;
					v24.Position = UDim2.new(0, 0, 0, 20 * v17);
					v24.MouseButton1Down:connect(function()
						l__TextBox__4.Text = l__TextBox__4.Text .. tostring(v23);
						l__TextBox__4:CaptureFocus();
					end);
					v17 = v17 + 1;
				end;
			elseif string.match(v16, l__SplitKey__8 .. "$") then
				v24 = l__Entry__9:Clone();
				v24.Text = tostring(v23);
				v24.TextXAlignment = "Right";
				v24.Visible = true;
				v24.Parent = l__PlayerList__2;
				v24.Position = UDim2.new(0, 0, 0, 20 * v17);
				v24.MouseButton1Down:connect(function()
					l__TextBox__4.Text = l__TextBox__4.Text .. tostring(v23);
					l__TextBox__4:CaptureFocus();
				end);
				v17 = v17 + 1;
			end;		
		end;
		l__PlayerList__2.CanvasSize = UDim2.new(0, 0, 0, v17 * 20);
		local v25 = 0;
		for v26, v27 in next, v6 do
			if string.sub(string.lower(v27), 1, #v16) == string.lower(v16) or string.find(string.lower(v27), string.match(string.lower(v16), "^(.-)" .. l__SplitKey__8) or string.lower(v16)) then
				if not scrollOpen then
					l__Frame__3.Size = UDim2.new(1, 0, 0, 140);
					l__ScrollingFrame__4.Visible = true;
					l__PlayerList__2.Visible = true;
					scrollOpen = true;
				end;
				local v28 = l__Entry__9:clone();
				v28.Visible = true;
				v28.Parent = l__ScrollingFrame__4;
				v28.Text = v27;
				v28.Position = UDim2.new(0, 0, 0, 20 * v25);
				v28.MouseButton1Down:connect(function()
					l__TextBox__4.Text = v28.Text;
					l__TextBox__4:CaptureFocus();
				end);
				v25 = v25 + 1;
			end;
		end;
		l__ScrollingFrame__4.CanvasSize = UDim2.new(0, 0, 0, v25 * 20);
	end);
	local l__ConsoleKeyCode__10 = v5.ConsoleKeyCode;
	gTable.BindEvent(service.UserInputService.InputBegan, function(p4)
		if not service.UserInputService:GetFocusedTextBox() and rawequal(p4.UserInputType, Enum.UserInputType.Keyboard) and p4.KeyCode.Name == (client.Variables.CustomConsoleKey or l__ConsoleKeyCode__10) then
			if u3 then
				u5();
			else
				u6();
			end;
			client.Variables.ConsoleOpen = u3;
		end;
	end);
	gTable:Ready();
end;
