-- Decompiled with the Synapse X Luau decompiler.

local l__ContextActionService__1 = game:GetService("ContextActionService");
local l__UserInputService__2 = game:GetService("UserInputService");
local l__RunService__3 = game:GetService("RunService");
local l__UserGameSettings__4 = UserSettings():GetService("UserGameSettings");
local l__LocalPlayer__5 = game:GetService("Players").LocalPlayer;
local v6 = math.rad(120);
local v7 = Vector2.new(1, 0.77) * math.rad(0.5);
local v8 = Vector2.new(1, 0.77) * math.rad(7);
local v9 = Vector2.new(1, 0.66) * math.rad(1);
local v10 = Vector2.new(1, 0.77) * math.rad(4);
local v11 = Instance.new("BindableEvent");
local v12 = Instance.new("BindableEvent");
local u1 = v11;
l__UserInputService__2.InputBegan:Connect(function(p1, p2)
	if not p2 and p1.UserInputType == Enum.UserInputType.MouseButton2 then
		u1:Fire();
	end;
end);
local u2 = v12;
l__UserInputService__2.InputEnded:Connect(function(p3, p4)
	if p3.UserInputType == Enum.UserInputType.MouseButton2 then
		u2:Fire();
	end;
end);
u1 = nil;
u1 = function(p5)
	return math.sign(p5) * math.clamp((math.exp(2 * ((math.abs(p5) - 0.1) / 0.9)) - 1) / (math.exp(2) - 1), 0, 1);
end;
u2 = function(p6)
	local l__CurrentCamera__13 = workspace.CurrentCamera;
	if not l__CurrentCamera__13 then
		return p6;
	end;
	local v14 = l__CurrentCamera__13.CFrame:ToEulerAnglesYXZ();
	if p6.Y * v14 >= 0 then
		return p6;
	end;
	return Vector2.new(1, (1 - (2 * math.abs(v14) / math.pi) ^ 0.75) * 0.75 + 0.25) * p6;
end;
local u3 = 0.016666666666666666;
l__RunService__3.Stepped:Connect(function(p7, p8)
	u3 = p8;
end);
local v15 = {};
local u4 = 0;
local v16 = Instance.new("BindableEvent");
v15.gamepadZoomPress = v16.Event;
local u5 = {
	Thumbstick2 = Vector2.new()
};
function v15.getRotationActivated()
	local v17 = true;
	if not (u4 > 0) then
		v17 = u5.Thumbstick2.Magnitude > 0;
	end;
	return v17;
end;
local u6 = {
	Left = 0, 
	Right = 0, 
	I = 0, 
	O = 0
};
local u7 = {
	Movement = Vector2.new(), 
	Wheel = 0, 
	Pan = Vector2.new(), 
	Pinch = 0
};
local u8 = {
	Move = Vector2.new(), 
	Pinch = 0
};
function v15.getRotation(p9)
	local v18 = Vector2.new(1, l__UserGameSettings__4:GetCameraYInvertValue());
	local v19 = Vector2.new(u6.Right - u6.Left, 0) * u3;
	if p9 then
		v19 = Vector2.new();
	end;
	return (v19 * v6 + u5.Thumbstick2 * v10 + u7.Movement * v7 + u7.Pan * v8 + u2(u8.Move) * v9) * v18;
end;
function v15.getZoomDelta()
	return (u6.O - u6.I) * 0.1 + (-u7.Wheel + u7.Pinch) * 1 + -u8.Pinch * 0.04;
end;
local u9 = nil;
local function u10(p10)
	local v20 = l__LocalPlayer__5:FindFirstChildOfClass("PlayerGui");
	local v21 = v20 and v20:FindFirstChild("TouchGui");
	local v22 = v21 and v21:FindFirstChild("TouchControlFrame");
	local v23 = v22 and v22:FindFirstChild("DynamicThumbstickFrame");
	if not v23 then
		return false;
	end;
	if not v21.Enabled then
		return false;
	end;
	local l__AbsolutePosition__24 = v23.AbsolutePosition;
	local v25 = l__AbsolutePosition__24 + v23.AbsoluteSize;
	local v26 = false;
	if l__AbsolutePosition__24.X <= p10.X then
		v26 = false;
		if l__AbsolutePosition__24.Y <= p10.Y then
			v26 = false;
			if p10.X <= v25.X then
				v26 = p10.Y <= v25.Y;
			end;
		end;
	end;
	return v26;
end;
local function u11()
	u4 = math.max(0, u4 + 1);
end;
local u12 = {};
local u13 = nil;
local function u14()
	u4 = math.max(0, u4 - 1);
end;
local function u15(p11, p12)
	assert(p11.UserInputType == Enum.UserInputType.Touch);
	assert(p11.UserInputState == Enum.UserInputState.Begin);
	if u9 == nil and u10(p11.Position) and not p12 then
		u9 = p11;
		return;
	end;
	if not p12 then
		u11();
	end;
	u12[p11] = p12;
end;
local function u16(p13, p14)
	assert(p13.UserInputType == Enum.UserInputType.Touch);
	assert(p13.UserInputState == Enum.UserInputState.Change);
	if p13 == u9 then
		return;
	end;
	if u12[p13] == nil then
		u12[p13] = p14;
	end;
	local v27 = {};
	for v28, v29 in pairs(u12) do
		if not v29 then
			table.insert(v27, v28);
		end;
	end;
	if #v27 == 1 and u12[p13] == false then
		local l__Delta__30 = p13.Delta;
		u8.Move = Vector2.new(l__Delta__30.X, l__Delta__30.Y);
	end;
	if #v27 ~= 2 then
		u13 = nil;
		return;
	end;
	local l__Magnitude__31 = (v27[1].Position - v27[2].Position).Magnitude;
	if u13 then
		u8.Pinch = l__Magnitude__31 - u13;
	end;
	u13 = l__Magnitude__31;
end;
local function u17(p15)
	local l__Delta__32 = p15.Delta;
	u7.Movement = Vector2.new(l__Delta__32.X, l__Delta__32.Y);
end;
local function u18(p16, p17)
	assert(p16.UserInputType == Enum.UserInputType.Touch);
	assert(p16.UserInputState == Enum.UserInputState.End);
	if p16 == u9 then
		u9 = nil;
	end;
	if u12[p16] == false then
		u13 = nil;
		u14();
	end;
	u12[p16] = nil;
end;
local u19 = false;
local function u20()
	for v33, v34 in pairs({ u5, u6, u7, u8 }) do
		for v35, v36 in pairs(v34) do
			if type(v36) == "boolean" then
				v34[v35] = false;
			else
				v34[v35] = v34[v35] * 0;
			end;
		end;
	end;
end;
local function u21()
	u12 = {};
	u9 = nil;
	u13 = nil;
end;
local function u22(p18, p19, p20)
	local l__Position__37 = p20.Position;
	u5[p20.KeyCode.Name] = Vector2.new(u1(l__Position__37.X), -u1(l__Position__37.Y));
end;
local l__Value__23 = Enum.ContextActionPriority.Default.Value;
local function u24(p21, p22, p23)
	if p22 == Enum.UserInputState.Begin then
		local v38 = 1;
	else
		v38 = 0;
	end;
	u6[p23.KeyCode.Name] = v38;
end;
local function u25(p24, p25, p26)
	if p25 == Enum.UserInputState.Begin then
		v16:Fire();
	end;
end;
local u26 = {};
local function u27(p27, p28)
	if p27.UserInputType == Enum.UserInputType.Touch then
		u15(p27, p28);
		return;
	end;
	if p27.UserInputType == Enum.UserInputType.MouseButton2 and not p28 then
		u11();
	end;
end;
local function u28(p29, p30)
	if p29.UserInputType == Enum.UserInputType.Touch then
		u16(p29, p30);
		return;
	end;
	if p29.UserInputType == Enum.UserInputType.MouseMovement then
		u17(p29);
	end;
end;
local function u29(p31, p32)
	if p31.UserInputType == Enum.UserInputType.Touch then
		u18(p31, p32);
		return;
	end;
	if p31.UserInputType == Enum.UserInputType.MouseButton2 then
		u14();
	end;
end;
local function u30(p33, p34, p35, p36)
	if not p36 then
		u7.Wheel = p33;
		u7.Pan = p34;
		u7.Pinch = -p35;
	end;
end;
function v15.setInputEnabled(p37)
	if u19 == p37 then
		return;
	end;
	u19 = p37;
	u20();
	u21();
	if not u19 then
		l__ContextActionService__1:UnbindAction("RbxCameraThumbstick");
		l__ContextActionService__1:UnbindAction("RbxCameraMouseMove");
		l__ContextActionService__1:UnbindAction("RbxCameraMouseWheel");
		l__ContextActionService__1:UnbindAction("RbxCameraKeypress");
		for v39, v40 in pairs(u26) do
			v40:Disconnect();
		end;
		u26 = {};
		return;
	end;
	l__ContextActionService__1:BindActionAtPriority("RbxCameraThumbstick", u22, false, l__Value__23, Enum.KeyCode.Thumbstick2);
	l__ContextActionService__1:BindActionAtPriority("RbxCameraKeypress", u24, false, l__Value__23, Enum.KeyCode.Left, Enum.KeyCode.Right, Enum.KeyCode.I, Enum.KeyCode.O);
	l__ContextActionService__1:BindAction("RbxCameraGamepadZoom", u25, false, Enum.KeyCode.ButtonR3);
	table.insert(u26, l__UserInputService__2.InputBegan:Connect(u27));
	table.insert(u26, l__UserInputService__2.InputChanged:Connect(u28));
	table.insert(u26, l__UserInputService__2.InputEnded:Connect(u29));
	table.insert(u26, l__UserInputService__2.PointerAction:Connect(u30));
end;
function v15.getInputEnabled()
	return u19;
end;
function v15.resetInputForFrameEnd()
	u7.Movement = Vector2.new();
	u8.Move = Vector2.new();
	u8.Pinch = 0;
	u7.Wheel = 0;
	u7.Pan = Vector2.new();
	u7.Pinch = 0;
end;
l__UserInputService__2.WindowFocused:Connect(u20);
l__UserInputService__2.WindowFocusReleased:Connect(u20);
local u31 = false;
function v15.getHoldPan()
	return u31;
end;
local u32 = false;
function v15.getTogglePan()
	return u32;
end;
function v15.getPanning()
	return u32 or u31;
end;
function v15.setTogglePan(p38)
	u32 = p38;
end;
local u33 = false;
local u34 = nil;
local u35 = nil;
local l__Event__36 = v11.Event;
local u37 = 0;
local l__Event__38 = v12.Event;
function v15.enableCameraToggleInput()
	if u33 then
		return;
	end;
	u33 = true;
	u31 = false;
	u32 = false;
	if u34 then
		u34:Disconnect();
	end;
	if u35 then
		u35:Disconnect();
	end;
	u34 = l__Event__36:Connect(function()
		u31 = true;
		u37 = tick();
	end);
	u35 = l__Event__38:Connect(function()
		u31 = false;
		if tick() - u37 < 0.3 and (u32 or l__UserInputService__2:GetMouseDelta().Magnitude < 2) then
			u32 = not u32;
		end;
	end);
end;
function v15.disableCameraToggleInput()
	if not u33 then
		return;
	end;
	u33 = false;
	if u34 then
		u34:Disconnect();
		u34 = nil;
	end;
	if u35 then
		u35:Disconnect();
		u35 = nil;
	end;
end;
return v15;