-- Decompiled with the Synapse X Luau decompiler.


local v1 = require(script.Parent:WaitForChild("BaseCharacterController"));
local v2 = setmetatable({}, v1);
v2.__index = v2;
function v2.new()
	local v3 = setmetatable(v1.new(), v2);
	v3.textFocusReleasedConn = nil;
	v3.textFocusGainedConn = nil;
	v3.windowFocusReleasedConn = nil;
	v3.forwardValue = 0;
	v3.backwardValue = 0;
	v3.leftValue = 0;
	v3.rightValue = 0;
	return v3;
end;
local l__UserInputService__1 = game:GetService("UserInputService");
local u2 = Vector3.new(0, 0, 0);
function v2.Enable(p1, p2)
	if not l__UserInputService__1.KeyboardEnabled then
		return false;
	end;
	if p2 == p1.enabled then
		return true;
	end;
	p1.forwardValue = 0;
	p1.backwardValue = 0;
	p1.leftValue = 0;
	p1.rightValue = 0;
	p1.moveVector = u2;
	p1.isJumping = false;
	if p2 then
		p1:BindContextActions();
		p1:ConnectFocusEventListeners();
	else
		p1:UnbindContextActions();
		p1:DisconnectFocusEventListeners();
	end;
	p1.enabled = p2;
	return true;
end;
function v2.UpdateMovement(p3, p4)
	if p4 == Enum.UserInputState.Cancel then
		p3.moveVector = u2;
		return;
	end;
	p3.moveVector = Vector3.new(p3.leftValue + p3.rightValue, 0, p3.forwardValue + p3.backwardValue);
end;
local l__ContextActionService__3 = game:GetService("ContextActionService");
function v2.BindContextActions(p5)
	l__ContextActionService__3:BindAction("moveForwardAction", function(p6, p7, p8)
		if p7 == Enum.UserInputState.Begin then
			local v4 = -1;
		else
			v4 = 0;
		end;
		p5.forwardValue = v4;
		p5:UpdateMovement(p7);
	end, false, Enum.PlayerActions.CharacterForward);
	l__ContextActionService__3:BindAction("moveBackwardAction", function(p9, p10, p11)
		if p10 == Enum.UserInputState.Begin then
			local v5 = 1;
		else
			v5 = 0;
		end;
		p5.backwardValue = v5;
		p5:UpdateMovement(p10);
	end, false, Enum.PlayerActions.CharacterBackward);
	l__ContextActionService__3:BindAction("moveLeftAction", function(p12, p13, p14)
		if p13 == Enum.UserInputState.Begin then
			local v6 = -1;
		else
			v6 = 0;
		end;
		p5.leftValue = v6;
		p5:UpdateMovement(p13);
	end, false, Enum.PlayerActions.CharacterLeft);
	l__ContextActionService__3:BindAction("moveRightAction", function(p15, p16, p17)
		if p16 == Enum.UserInputState.Begin then
			local v7 = 1;
		else
			v7 = 0;
		end;
		p5.rightValue = v7;
		p5:UpdateMovement(p16);
	end, false, Enum.PlayerActions.CharacterRight);
	l__ContextActionService__3:BindAction("jumpAction", function(p18, p19, p20)
		p5.isJumping = p19 == Enum.UserInputState.Begin;
	end, false, Enum.PlayerActions.CharacterJump);
end;
function v2.UnbindContextActions(p21)
	l__ContextActionService__3:UnbindAction("moveForwardAction");
	l__ContextActionService__3:UnbindAction("moveBackwardAction");
	l__ContextActionService__3:UnbindAction("moveLeftAction");
	l__ContextActionService__3:UnbindAction("moveRightAction");
	l__ContextActionService__3:UnbindAction("jumpAction");
end;
function v2.ConnectFocusEventListeners(p22)
	local function v8()
		p22.moveVector = u2;
		p22.forwardValue = 0;
		p22.backwardValue = 0;
		p22.leftValue = 0;
		p22.rightValue = 0;
		p22.isJumping = false;
	end;
	p22.textFocusReleasedConn = l__UserInputService__1.TextBoxFocusReleased:Connect(v8);
	p22.textFocusGainedConn = l__UserInputService__1.TextBoxFocused:Connect(function(p23)
		p22.isJumping = false;
	end);
	p22.windowFocusReleasedConn = l__UserInputService__1.WindowFocused:Connect(v8);
end;
function v2.DisconnectFocusEventListeners(p24)
	if p24.textFocusReleasedCon then
		p24.textFocusReleasedCon:Disconnect();
		p24.textFocusReleasedCon = nil;
	end;
	if p24.textFocusGainedConn then
		p24.textFocusGainedConn:Disconnect();
		p24.textFocusGainedConn = nil;
	end;
	if p24.windowFocusReleasedConn then
		p24.windowFocusReleasedConn:Disconnect();
		p24.windowFocusReleasedConn = nil;
	end;
end;
return v2;

