local v=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 E=v("\080\114\111\109\105\115\101")local F=v("\077\097\105\100")return function(v,N)if N.Value then local F=v:Get(N.Value)if F then return E.resolved(F)end end local Q=F.new()local c=E.new()Q:GiveTask(N.Changed:Connect(function()local E=v:Get(N.Value)if E then c:Resolve(E)end end))Q:GiveTask((v:GetClassAddedSignal()):Connect(function(v,E)if E==N.Value then c:Resolve(v)end end))c:Finally(function()Q:Destroy()end)return c end
---
-- @function promiseBoundLinkedClass

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

local Promise = require("Promise")
local Maid = require("Maid")

return function(binder, objValue)
	if objValue.Value then
		local class = binder:Get(objValue.Value)
		if class then
			return Promise.resolved(class)
		end
	end

	local maid = Maid.new()
	local promise = Promise.new()

	maid:GiveTask(objValue.Changed:Connect(function()
		local class = binder:Get(objValue.Value)
		if class then
			promise:Resolve(class)
		end
	end))

	maid:GiveTask(binder:GetClassAddedSignal():Connect(function(class, instance)
		if instance == objValue.Value then
			promise:Resolve(class)
		end
	end))

	promise:Finally(function()
		maid:Destroy()
	end)

	return promise
end