function Blend.mount(y,P)local X=Maid.new()local C=nil local D={}for P,U in pairs(P)do if type(P)=="\115\116\114\105\110\103"then if P=="\080\097\114\101\110\116"then C=U else local C=Blend.toPropertyObservable(U)if C then X:GiveTask(C:Subscribe(function(X)task.spawn(function()y[P]=X end)end))else task.spawn(function()y[P]=U end)end end elseif type(P)=="\102\117\110\099\116\105\111\110"then local X=Blend.toEventObservable(P(y,U))if Observable.isObservable(X)then table.insert(D,{X,U})else warn(("\085\110\097\098\108\101 \116\111 \097\112\112\108\121 \101\118\101\110\116 \108\105\115\116\101\110\101\114 \037\113"):format(tostring(P)))end else warn(("\085\110\097\098\108\101 \116\111 \097\112\112\108\121 \112\114\111\112\101\114\116\121 \037\113"):format(tostring(P)))end end for y,P in pairs(D)do X:GiveTask(P[1]:Subscribe(Blend.toEventHandler(P[2])))end if C then local P=Blend.toPropertyObservable(C)if P then X:GiveTask(P:Subscribe(function(P)y.Parent=P end))else y.Parent=C end end return X end return Blend

function Blend.mount(instance, props)
	local maid = Maid.new()

	local parent = nil
	local dependentObservables = {}

	for key, value in pairs(props) do
		if type(key) == "string" then
			if key == "Parent" then
				parent = value
			else
				local observable = Blend.toPropertyObservable(value)
				if observable then
					maid:GiveTask(observable:Subscribe(function(result)
						task.spawn(function()
							instance[key] = result
						end)
					end))
				else
					task.spawn(function()
						instance[key] = value
					end)
				end
			end
		elseif type(key) == "function" then
			local observable = Blend.toEventObservable(key(instance, value))

			if Observable.isObservable(observable) then
				table.insert(dependentObservables, {observable, value})
			else
				warn(("Unable to apply event listener %q"):format(tostring(key)))
			end
		else
			warn(("Unable to apply property %q"):format(tostring(key)))
		end
	end

	-- Subscribe dependentObservables (which includes adding children)
	for _, event in pairs(dependentObservables) do
		maid:GiveTask(event[1]:Subscribe(Blend.toEventHandler(event[2])))
	end

	if parent then
		local observable = Blend.toPropertyObservable(parent)
		if observable then
			maid:GiveTask(observable:Subscribe(function(result)
				instance.Parent = result
			end))
		else
			instance.Parent = parent
		end
	end

	return maid
end


return Blend
