function Rx.delay(d)assert(type(d)=="\110\117\109\098\101\114","\066\097\100 \115\101\099\111\110\100\115")return function(y)assert(Observable.isObservable(y),"\066\097\100 \111\098\115\101\114\118\097\098\108\101")return Observable.new(function(I)local t=Maid.new()t:GiveTask(y:Subscribe(function(...)local y=table.pack(...)t[y]=cancellableDelay(d,function()t[y]=nil I:Fire(table.unpack(y,1,y.n))end)end,I:GetFailComplete()))return t end)end end
--[=[
	Shift the emissions from an Observable forward in time by a particular amount.

	@param seconds number
	@return (source: Observable<T>) -> Observable<T>
]=]
function Rx.delay(seconds)
	assert(type(seconds) == "number", "Bad seconds")

	return function(source)
		assert(Observable.isObservable(source), "Bad observable")

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

			maid:GiveTask(source:Subscribe(function(...)
				local args = table.pack(...)

				maid[args] = cancellableDelay(seconds, function()
					maid[args] = nil
					sub:Fire(table.unpack(args, 1, args.n))
				end)
			end, sub:GetFailComplete()))

			return maid
		end)
	end
end
