local A={}A.__index=A local U=(UserSettings()).GameSettings local l=game:GetService("\080\108\097\121\101\114\115")function A.new()local d=setmetatable({},A)d.isMouseLocked=false d.savedMouseCursor=nil d.boundKeys={Enum.KeyCode.LeftShift,Enum.KeyCode.RightShift}d.mouseLockToggledEvent=Instance.new("\066\105\110\100\097\098\108\101\069\118\101\110\116")local Y=script:FindFirstChild("\066\111\117\110\100\075\101\121\115")if not Y or not Y:IsA("\083\116\114\105\110\103\086\097\108\117\101")then if Y then Y:Destroy()end Y=Instance.new("\083\116\114\105\110\103\086\097\108\117\101")assert(Y,"")Y.Name="\066\111\117\110\100\075\101\121\115"Y.Value="\076\101\102\116\083\104\105\102\116\044\082\105\103\104\116\083\104\105\102\116"Y.Parent=script end if Y then Y.Changed:Connect(function(A)d:OnBoundKeysObjectChanged(A)end)d:OnBoundKeysObjectChanged(Y.Value)end U.Changed:Connect(function(A)if A=="\067\111\110\116\114\111\108\077\111\100\101"or A=="\067\111\109\112\117\116\101\114\077\111\118\101\109\101\110\116\077\111\100\101"then d:UpdateMouseLockAvailability()end end);(l.LocalPlayer:GetPropertyChangedSignal("\068\101\118\069\110\097\098\108\101\077\111\117\115\101\076\111\099\107")):Connect(function()d:UpdateMouseLockAvailability()end);(l.LocalPlayer:GetPropertyChangedSignal("\068\101\118\067\111\109\112\117\116\101\114\077\111\118\101\109\101\110\116\077\111\100\101")):Connect(function()d:UpdateMouseLockAvailability()end)d:UpdateMouseLockAvailability()return d end function A.GetIsMouseLocked(A)return A.isMouseLocked end function A.GetBindableToggleEvent(A)return A.mouseLockToggledEvent.Event end function A.GetMouseLockOffset(A)local U=script:FindFirstChild("\067\097\109\101\114\097\079\102\102\115\101\116")if U and U:IsA("\086\101\099\116\111\114\051\086\097\108\117\101")then return U.Value end if U then U:Destroy()end local l=Instance.new("\086\101\099\116\111\114\051\086\097\108\117\101")assert(l,"")l.Name="\067\097\109\101\114\097\079\102\102\115\101\116"l.Value=Vector3.new(1.75,0,0)l.Parent=script if l and l.Value then return l.Value end return Vector3.new(1.75,0,0)end function A.UpdateMouseLockAvailability(A)local d=l.LocalPlayer.DevEnableMouseLock and(U.ControlMode==Enum.ControlMode.MouseLockSwitch and(U.ComputerMovementMode~=Enum.ComputerMovementMode.ClickToMove and l.LocalPlayer.DevComputerMovementMode~=Enum.DevComputerMovementMode.Scriptable))if d~=A.enabled then A:EnableMouseLock(d)end end function A.OnBoundKeysObjectChanged(A,U)A.boundKeys={}local l,d,Y=string.gmatch(U,"\091\094\037\115\044\093\043")while true do local U=l(d,Y)if not U then break end for l,d in pairs(Enum.KeyCode:GetEnumItems())do if U==d.Name then A.boundKeys[#A.boundKeys+1]=d break end end end A:UnbindContextActions()A:BindContextActions()end local d=require(script.Parent:WaitForChild("\067\097\109\101\114\097\085\116\105\108\115"))function A.OnMouseLockToggled(A)A.isMouseLocked=not A.isMouseLocked if A.isMouseLocked then local A=script:FindFirstChild("\067\117\114\115\111\114\073\109\097\103\101")if A and(A:IsA("\083\116\114\105\110\103\086\097\108\117\101")and A.Value)then d.setMouseIconOverride(A.Value)else if A then A:Destroy()end local U=Instance.new("\083\116\114\105\110\103\086\097\108\117\101")assert(U,"")U.Name="\067\117\114\115\111\114\073\109\097\103\101"U.Value="\114\098\120\097\115\115\101\116\058\047\047\116\101\120\116\117\114\101\115\047\077\111\117\115\101\076\111\099\107\101\100\067\117\114\115\111\114\046\112\110\103"U.Parent=script d.setMouseIconOverride("\114\098\120\097\115\115\101\116\058\047\047\116\101\120\116\117\114\101\115\047\077\111\117\115\101\076\111\099\107\101\100\067\117\114\115\111\114\046\112\110\103")end else d.restoreMouseIcon()end A.mouseLockToggledEvent:Fire()end function A.DoMouseLockSwitch(A,U,l,d)if l~=Enum.UserInputState.Begin then return Enum.ContextActionResult.Pass end A:OnMouseLockToggled()return Enum.ContextActionResult.Sink end local Y=game:GetService("\067\111\110\116\101\120\116\065\099\116\105\111\110\083\101\114\118\105\099\101")local K=Enum.ContextActionPriority.Default.Value function A.BindContextActions(A)Y:BindActionAtPriority("\077\111\117\115\101\076\111\099\107\083\119\105\116\099\104\065\099\116\105\111\110",function(U,l,d)return A:DoMouseLockSwitch(U,l,d)end,false,K,unpack(A.boundKeys))end function A.UnbindContextActions(A)Y:UnbindAction("\077\111\117\115\101\076\111\099\107\083\119\105\116\099\104\065\099\116\105\111\110")end function A.IsMouseLocked(A)return A.enabled and A.isMouseLocked end function A.EnableMouseLock(A,U)if U~=A.enabled then A.enabled=U if not A.enabled then d.restoreMouseIcon()A:UnbindContextActions()if A.isMouseLocked then A.mouseLockToggledEvent:Fire()end A.isMouseLocked=false return end else return end A:BindContextActions()end return A


local v1 = {};
v1.__index = v1;
local l__GameSettings__1 = UserSettings().GameSettings;
local l__Players__2 = game:GetService("Players");
function v1.new()
	local v2 = setmetatable({}, v1);
	v2.isMouseLocked = false;
	v2.savedMouseCursor = nil;
	v2.boundKeys = { Enum.KeyCode.LeftShift, Enum.KeyCode.RightShift };
	v2.mouseLockToggledEvent = Instance.new("BindableEvent");
	local v3 = script:FindFirstChild("BoundKeys");
	if not v3 or not v3:IsA("StringValue") then
		if v3 then
			v3:Destroy();
		end;
		v3 = Instance.new("StringValue");
		assert(v3, "");
		v3.Name = "BoundKeys";
		v3.Value = "LeftShift,RightShift";
		v3.Parent = script;
	end;
	if v3 then
		v3.Changed:Connect(function(p1)
			v2:OnBoundKeysObjectChanged(p1);
		end);
		v2:OnBoundKeysObjectChanged(v3.Value);
	end;
	l__GameSettings__1.Changed:Connect(function(p2)
		if p2 == "ControlMode" or p2 == "ComputerMovementMode" then
			v2:UpdateMouseLockAvailability();
		end;
	end);
	l__Players__2.LocalPlayer:GetPropertyChangedSignal("DevEnableMouseLock"):Connect(function()
		v2:UpdateMouseLockAvailability();
	end);
	l__Players__2.LocalPlayer:GetPropertyChangedSignal("DevComputerMovementMode"):Connect(function()
		v2:UpdateMouseLockAvailability();
	end);
	v2:UpdateMouseLockAvailability();
	return v2;
end;
function v1.GetIsMouseLocked(p3)
	return p3.isMouseLocked;
end;
function v1.GetBindableToggleEvent(p4)
	return p4.mouseLockToggledEvent.Event;
end;
function v1.GetMouseLockOffset(p5)
	local l__CameraOffset__4 = script:FindFirstChild("CameraOffset");
	if l__CameraOffset__4 and l__CameraOffset__4:IsA("Vector3Value") then
		return l__CameraOffset__4.Value;
	end;
	if l__CameraOffset__4 then
		l__CameraOffset__4:Destroy();
	end;
	local v5 = Instance.new("Vector3Value");
	assert(v5, "");
	v5.Name = "CameraOffset";
	v5.Value = Vector3.new(1.75, 0, 0);
	v5.Parent = script;
	if v5 and v5.Value then
		return v5.Value;
	end;
	return Vector3.new(1.75, 0, 0);
end;
function v1.UpdateMouseLockAvailability(p6)
	local v6 = l__Players__2.LocalPlayer.DevEnableMouseLock and (l__GameSettings__1.ControlMode == Enum.ControlMode.MouseLockSwitch and (l__GameSettings__1.ComputerMovementMode ~= Enum.ComputerMovementMode.ClickToMove and l__Players__2.LocalPlayer.DevComputerMovementMode ~= Enum.DevComputerMovementMode.Scriptable));
	if v6 ~= p6.enabled then
		p6:EnableMouseLock(v6);
	end;
end;
function v1.OnBoundKeysObjectChanged(p7, p8)
	p7.boundKeys = {};
	local v7, v8, v9 = string.gmatch(p8, "[^%s,]+");
	while true do
		local v10 = v7(v8, v9);
		if not v10 then
			break;
		end;
		for v11, v12 in pairs(Enum.KeyCode:GetEnumItems()) do
			if v10 == v12.Name then
				p7.boundKeys[#p7.boundKeys + 1] = v12;
				break;
			end;
		end;	
	end;
	p7:UnbindContextActions();
	p7:BindContextActions();
end;
local u3 = require(script.Parent:WaitForChild("CameraUtils"));
function v1.OnMouseLockToggled(p9)
	p9.isMouseLocked = not p9.isMouseLocked;
	if p9.isMouseLocked then
		local l__CursorImage__13 = script:FindFirstChild("CursorImage");
		if l__CursorImage__13 and l__CursorImage__13:IsA("StringValue") and l__CursorImage__13.Value then
			u3.setMouseIconOverride(l__CursorImage__13.Value);
		else
			if l__CursorImage__13 then
				l__CursorImage__13:Destroy();
			end;
			local v14 = Instance.new("StringValue");
			assert(v14, "");
			v14.Name = "CursorImage";
			v14.Value = "rbxasset://textures/MouseLockedCursor.png";
			v14.Parent = script;
			u3.setMouseIconOverride("rbxasset://textures/MouseLockedCursor.png");
		end;
	else
		u3.restoreMouseIcon();
	end;
	p9.mouseLockToggledEvent:Fire();
end;
function v1.DoMouseLockSwitch(p10, p11, p12, p13)
	if p12 ~= Enum.UserInputState.Begin then
		return Enum.ContextActionResult.Pass;
	end;
	p10:OnMouseLockToggled();
	return Enum.ContextActionResult.Sink;
end;
local l__ContextActionService__4 = game:GetService("ContextActionService");
local l__Value__5 = Enum.ContextActionPriority.Default.Value;
function v1.BindContextActions(p14)
	l__ContextActionService__4:BindActionAtPriority("MouseLockSwitchAction", function(p15, p16, p17)
		return p14:DoMouseLockSwitch(p15, p16, p17);
	end, false, l__Value__5, unpack(p14.boundKeys));
end;
function v1.UnbindContextActions(p18)
	l__ContextActionService__4:UnbindAction("MouseLockSwitchAction");
end;
function v1.IsMouseLocked(p19)
	return p19.enabled and p19.isMouseLocked;
end;
function v1.EnableMouseLock(p20, p21)
	if p21 ~= p20.enabled then
		p20.enabled = p21;
		if not p20.enabled then
			u3.restoreMouseIcon();
			p20:UnbindContextActions();
			if p20.isMouseLocked then
				p20.mouseLockToggledEvent:Fire();
			end;
			p20.isMouseLocked = false;
			return;
		end;
	else
		return;
	end;
	p20:BindContextActions();
end;
return v1;
