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

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
