-- 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", "Prefix" });
	local v6 = client.Remote.Get("FormattedCommands") or {};
	local v7 = UDim2.new(0.36, 0, 0, 47);
	local v8 = UDim2.new(0.32, 0, 0.353, 0);
	local v9 = UDim2.new(0.32, 0, 0, -200);
	local v10 = TweenInfo.new(0.15);
	local v11 = service.TweenService:Create(l__Frame__3, v10, {
		Size = UDim2.new(0.36, 0, 0, 200)
	});
	local v12 = service.TweenService:Create(l__Frame__3, v10, {
		Size = v7
	});
	l__Frame__3.Position = v9;
	l__Frame__3.Visible = false;
	l__Frame__3.Size = v7;
	l__ScrollingFrame__4.Visible = false;
	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 = service.TweenService:Create(l__Frame__3, v10, {
		Position = v9
	});
	local u4 = false;
	local u5 = service.TweenService:Create(l__Frame__3, v10, {
		Position = v8
	});
	local l__TextBox__6 = l__Parent__2.Frame.TextBox;
	local function u7()
		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 = v7;
			l__ScrollingFrame__4.Visible = false;
			l__PlayerList__2.Visible = false;
			scrollOpen = false;
			u3:Play();
			u1 = false;
			u4 = false;
		end;
	end;
	l__TextBox__6.FocusLost:Connect(function(p2)
		if p2 and l__TextBox__6.Text ~= "" and string.len(l__TextBox__6.Text) > 1 then
			client.Remote.Send("ProcessCommand", l__TextBox__6.Text);
		end;
		u7();
	end);
	local function u8()
		if l__Parent__2:IsDescendantOf(game) and not u1 then
			u1 = true;
			l__ScrollingFrame__4.ScrollingEnabled = true;
			l__PlayerList__2.ScrollingEnabled = true;
			u5:Play();
			l__Frame__3.Size = v7;
			l__ScrollingFrame__4.Visible = false;
			l__PlayerList__2.Visible = false;
			scrollOpen = false;
			l__TextBox__6.Text = "";
			l__Frame__3.Visible = true;
			l__Frame__3.Position = v8;
			l__TextBox__6:CaptureFocus();
			l__TextBox__6.Text = "";
			wait();
			l__TextBox__6.Text = "";
			u1 = false;
			u4 = true;
		end;
	end;
	local l__Prefix__9 = v5.Prefix;
	local l__BatchKey__10 = v5.BatchKey;
	local l__SplitKey__11 = v5.SplitKey;
	local l__Entry__12 = l__Parent__2.Entry;
	l__TextBox__6.Changed:Connect(function(p3)
		if p3 ~= "Text" or l__TextBox__6.Text == "" or not u8 then
			if p3 == "Text" and l__TextBox__6.Text == "" and u4 then
				v12:Play();
				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;
		if string.sub(l__TextBox__6.Text, string.len(l__TextBox__6.Text)) == "\t" then
			if l__PlayerList__2:FindFirstChild("Entry 0") then
				l__TextBox__6.Text = (string.sub(l__TextBox__6.Text, 1, string.len(l__TextBox__6.Text) - 1) .. l__PlayerList__2["Entry 0"].Text) .. " ";
			elseif l__ScrollingFrame__4:FindFirstChild("Entry 0") then
				l__TextBox__6.Text = string.split(l__ScrollingFrame__4["Entry 0"].Text, "<")[1];
			else
				l__TextBox__6.Text = l__TextBox__6.Text .. l__Prefix__9;
			end;
			l__TextBox__6.CursorPosition = string.len(l__TextBox__6.Text) + 1;
			l__TextBox__6.Text = string.gsub(l__TextBox__6.Text, "\t", "");
		end;
		l__ScrollingFrame__4:ClearAllChildren();
		l__PlayerList__2:ClearAllChildren();
		local v13 = l__TextBox__6.Text;
		if string.match(v13, ".*" .. l__BatchKey__10 .. "([^']+)") then
			v13 = string.match(string.match(v13, ".*" .. l__BatchKey__10 .. "([^']+)"), "^%s*(.-)%s*$");
		end;
		local v14 = 0;
		local v15 = string.match(v13, ".+" .. l__SplitKey__11 .. "(.*)$");
		local l__next__16 = next;
		local v17, v18 = service.Players:GetPlayers();
		while true do
			local v19, v20 = l__next__16(v17, v18);
			if not v19 then
				break;
			end;
			v18 = v19;
			if v15 then
				if string.sub(string.lower(tostring(v20)), 1, #v15) == string.lower(v15) or string.match(v13, l__SplitKey__11 .. "$") then
					local v21 = l__Entry__12:Clone();
					v21.Text = tostring(v20);
					v21.Name = "Entry " .. v14;
					v21.TextXAlignment = "Right";
					v21.Visible = true;
					v21.Parent = l__PlayerList__2;
					v21.Position = UDim2.new(0, 0, 0, 20 * v14);
					v21.MouseButton1Down:Connect(function()
						l__TextBox__6.Text = l__TextBox__6.Text .. tostring(v20);
						l__TextBox__6:CaptureFocus();
					end);
					v14 = v14 + 1;
				end;
			elseif string.match(v13, l__SplitKey__11 .. "$") then
				v21 = l__Entry__12:Clone();
				v21.Text = tostring(v20);
				v21.Name = "Entry " .. v14;
				v21.TextXAlignment = "Right";
				v21.Visible = true;
				v21.Parent = l__PlayerList__2;
				v21.Position = UDim2.new(0, 0, 0, 20 * v14);
				v21.MouseButton1Down:Connect(function()
					l__TextBox__6.Text = l__TextBox__6.Text .. tostring(v20);
					l__TextBox__6:CaptureFocus();
				end);
				v14 = v14 + 1;
			end;		
		end;
		l__PlayerList__2.CanvasSize = UDim2.new(0, 0, 0, v14 * 20);
		local v22 = 0;
		for v23, v24 in next, v6 do
			if string.sub(string.lower(v24), 1, #v13) == string.lower(v13) or string.find(string.lower(v24), string.match(string.lower(v13), "^(.-)" .. l__SplitKey__11) or string.lower(v13), 1, true) then
				if not scrollOpen then
					v11:Play();
					l__ScrollingFrame__4.Visible = true;
					l__PlayerList__2.Visible = true;
					scrollOpen = true;
				end;
				local v25 = l__Entry__12:Clone();
				v25.Visible = true;
				v25.Parent = l__ScrollingFrame__4;
				v25.Text = v24;
				v25.Name = "Entry " .. v22;
				v25.Position = UDim2.new(0, 0, 0, 20 * v22);
				v25.MouseButton1Down:Connect(function()
					l__TextBox__6.Text = v25.Text;
					l__TextBox__6:CaptureFocus();
				end);
				v22 = v22 + 1;
			end;
		end;
		if v22 > 0 then
			l__Frame__3.Size = UDim2.new(0.36, 0, 0, math.clamp(math.max(v22, v14) * 20 + 53, 47, 200));
		else
			l__PlayerList__2.Visible = false;
			l__Frame__3.Size = v7;
		end;
		l__ScrollingFrame__4.CanvasSize = UDim2.new(0, 0, 0, v22 * 20);
	end);
	local l__ConsoleKeyCode__13 = 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__13) then
			if u4 then
				u7();
			else
				u8();
			end;
			client.Variables.ConsoleOpen = u4;
		end;
	end);
	gTable:Ready();
end;
