local p=require((game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")):WaitForChild("\078\101\118\101\114\109\111\114\101"))local N=game:GetService("\082\117\110\083\101\114\118\105\099\101")local q=game:GetService("\087\111\114\107\115\112\097\099\101")local k=p("\067\097\109\101\114\097\083\116\097\116\101")local a=p("\083\117\109\109\101\100\067\097\109\101\114\097")local Y={}Y.ClassName="\068\101\102\097\117\108\116\067\097\109\101\114\097"function Y.new()local p=setmetatable({},Y)return p end function Y.__add(N,p)return a.new(N,p)end function Y.OverrideCameraState(N,p)N._cameraState=p or error("\078\111 \067\097\109\101\114\097\083\116\097\116\101")end function Y.BindToRenderStep(p)N:BindToRenderStep("\068\101\102\097\117\108\116\067\097\109\101\114\097\095\080\114\101\117\112\100\097\116\101",Enum.RenderPriority.Camera.Value-1,function()p._cameraState:Set(q.CurrentCamera)end)N:BindToRenderStep("\068\101\102\097\117\108\116\067\097\109\101\114\097\095\080\111\115\116\085\112\100\097\116\101",Enum.RenderPriority.Camera.Value+1,function()p._cameraState=k.new(q.CurrentCamera)end)p._cameraState=k.new(q.CurrentCamera)end function Y.UnbindFromRenderStep(p)N:UnbindFromRenderStep("\068\101\102\097\117\108\116\067\097\109\101\114\097\095\080\114\101\117\112\100\097\116\101")N:UnbindFromRenderStep("\068\101\102\097\117\108\116\067\097\109\101\114\097\095\080\111\115\116\085\112\100\097\116\101")end function Y.__index(N,p)if p=="\083\116\097\116\101"or p=="\067\097\109\101\114\097\083\116\097\116\101"or p=="\067\097\109\101\114\097"then return rawget(N,"\095\099\097\109\101\114\097\083\116\097\116\101")else return Y[p]end end return Y
-- Hack to maintain default camera control by binding before and after the camera update cycle
-- This allows other cameras to build off of the "default" camera while maintaining the same Roblox control scheme
-- @classmod DefaultCamera

local require = require(game:GetService("ReplicatedStorage"):WaitForChild("Nevermore"))

local RunService = game:GetService("RunService")
local Workspace = game:GetService("Workspace")

local CameraState = require("CameraState")
local SummedCamera = require("SummedCamera")

local DefaultCamera = {}
DefaultCamera.ClassName = "DefaultCamera"

function DefaultCamera.new()
	local self = setmetatable({}, DefaultCamera)

	return self
end

function DefaultCamera:__add(other)
	return SummedCamera.new(self, other)
end

function DefaultCamera:OverrideCameraState(cameraState)
	self._cameraState = cameraState or error("No CameraState")
end

function DefaultCamera:BindToRenderStep()
	RunService:BindToRenderStep("DefaultCamera_Preupdate", Enum.RenderPriority.Camera.Value-1, function()
		self._cameraState:Set(Workspace.CurrentCamera)
	end)

	RunService:BindToRenderStep("DefaultCamera_PostUpdate", Enum.RenderPriority.Camera.Value+1, function()
		self._cameraState = CameraState.new(Workspace.CurrentCamera)
	end)

	self._cameraState = CameraState.new(Workspace.CurrentCamera)
end

function DefaultCamera:UnbindFromRenderStep()
	RunService:UnbindFromRenderStep("DefaultCamera_Preupdate")
	RunService:UnbindFromRenderStep("DefaultCamera_PostUpdate")
end

function DefaultCamera:__index(index)
	if index == "State" or index == "CameraState" or index == "Camera" then
		return rawget(self, "_cameraState")
	else
		return DefaultCamera[index]
	end
end

return DefaultCamera