function RxInstanceUtils.observeDescendantsBrio(x,t)assert(typeof(x)=="\073\110\115\116\097\110\099\101","\066\097\100 \112\097\114\101\110\116")assert(type(t)=="\102\117\110\099\116\105\111\110"or t==nil,"\066\097\100 \112\114\101\100\105\099\097\116\101")return Observable.new(function(Z)local o=Maid.new()local function b(x)if not t or t(x)then local t=Brio.new(x)o[x]=t Z:Fire(t)end end o:GiveTask(x.DescendantAdded:Connect(b))o:GiveTask(x.DescendantRemoving:Connect(function(x)o[x]=nil end))for x,t in pairs(x:GetDescendants())do b(t)end return o end)end
--[=[
	Observes all descendants that match a predicate as a brio

	@param parent Instance
	@param predicate ((value: Instance) -> boolean)? -- Optional filter
	@return Observable<Brio<Instance>>
]=]
function RxInstanceUtils.observeDescendantsBrio(parent, predicate)
	assert(typeof(parent) == "Instance", "Bad parent")
	assert(type(predicate) == "function" or predicate == nil, "Bad predicate")

	return Observable.new(function(sub)
		local maid = Maid.new()

		local function handleDescendant(descendant)
			if not predicate or predicate(descendant) then
				local value = Brio.new(descendant)
				maid[descendant] = value
				sub:Fire(value)
			end
		end

		maid:GiveTask(parent.DescendantAdded:Connect(handleDescendant))
		maid:GiveTask(parent.DescendantRemoving:Connect(function(descendant)
			maid[descendant] = nil
		end))

		for _, descendant in pairs(parent:GetDescendants()) do
			handleDescendant(descendant)
		end

		return maid
	end)
end
