const require_rolldown_runtime = require('../../../../../../../../../_virtual/rolldown_runtime.js');
const require_lift$1 = require('../util/lift.js');
const require_OperatorSubscriber$1 = require('./OperatorSubscriber.js');
const require_innerFrom$1 = require('../observable/innerFrom.js');
const require_map$1 = require('./map.js');

//#region ../../node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/dist/cjs/internal/operators/exhaustMap.js
var require_exhaustMap = /* @__PURE__ */ require_rolldown_runtime.__commonJS({ "../../node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/dist/cjs/internal/operators/exhaustMap.js": ((exports) => {
	Object.defineProperty(exports, "__esModule", { value: true });
	var map_1 = require_map$1.require_map();
	var innerFrom_1 = require_innerFrom$1.require_innerFrom();
	var lift_1 = require_lift$1.require_lift();
	var OperatorSubscriber_1 = require_OperatorSubscriber$1.require_OperatorSubscriber();
	function exhaustMap(project, resultSelector) {
		if (resultSelector) return function(source) {
			return source.pipe(exhaustMap(function(a, i) {
				return innerFrom_1.innerFrom(project(a, i)).pipe(map_1.map(function(b, ii) {
					return resultSelector(a, b, i, ii);
				}));
			}));
		};
		return lift_1.operate(function(source, subscriber) {
			var index = 0;
			var innerSub = null;
			var isComplete = false;
			source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function(outerValue) {
				if (!innerSub) {
					innerSub = OperatorSubscriber_1.createOperatorSubscriber(subscriber, void 0, function() {
						innerSub = null;
						isComplete && subscriber.complete();
					});
					innerFrom_1.innerFrom(project(outerValue, index++)).subscribe(innerSub);
				}
			}, function() {
				isComplete = true;
				!innerSub && subscriber.complete();
			}));
		});
	}
	exports.exhaustMap = exhaustMap;
}) });

//#endregion
Object.defineProperty(exports, 'default', {
  enumerable: true,
  get: function () {
    return require_exhaustMap();
  }
});