function RxBrioUtils.reemitLastBrioOnDeath()return function(J)return Observable.new(function(v)local L=Maid.new()L:GiveTask(J:Subscribe(function(J)L._conn=nil if not Brio.isBrio(J)then warn(("\091\082\120\066\114\105\111\085\116\105\108\115\046\114\101\101\109\105\116\076\097\115\116\066\114\105\111\079\110\068\101\097\116\104\093 - \078\111\116 \097 \098\114\105\111\044 \037\113"):format(tostring(J)))v:Fail("\078\111\116 \097 \098\114\105\111")return end if J:IsDead()then v:Fire(J)return end L._conn=(J:GetDiedSignal()):Connect(function()v:Fire(J)end)v:Fire(J)end,function(...)v:Fail(...)end,function(...)v:Complete(...)end))return L end)end end
--[=[
	Whenever the last brio dies, reemit it as a dead brio

	@return (source Observable<Brio<T>>) -> Observable<Brio<T>>
]=]
function RxBrioUtils.reemitLastBrioOnDeath()
	return function(source)
		return Observable.new(function(sub)
			local maid = Maid.new()

			maid:GiveTask(source:Subscribe(function(brio)
				maid._conn = nil

				if not Brio.isBrio(brio) then
					warn(("[RxBrioUtils.reemitLastBrioOnDeath] - Not a brio, %q"):format(tostring(brio)))
					sub:Fail("Not a brio")
					return
				end

				if brio:IsDead() then
					sub:Fire(brio)
					return
				end

				-- Setup conn!
				maid._conn = brio:GetDiedSignal():Connect(function()
					sub:Fire(brio)
				end)

				sub:Fire(brio)
			end, function(...)
				sub:Fail(...)
			end, function(...)
				sub:Complete(...)
			end))

			return maid
		end)
	end
end
