const require_rolldown_runtime = require('../../../../../../../../../_virtual/rolldown_runtime.js');
const require_identity$1 = require('../util/identity.js');
const require_Observable$1 = require('../Observable.js');
const require_OperatorSubscriber$1 = require('../operators/OperatorSubscriber.js');
const require_args$1 = require('../util/args.js');
const require_executeSchedule$1 = require('../util/executeSchedule.js');
const require_from$1 = require('./from.js');
const require_mapOneOrManyArgs$1 = require('../util/mapOneOrManyArgs.js');
const require_argsArgArrayOrObject$1 = require('../util/argsArgArrayOrObject.js');
const require_createObject$1 = require('../util/createObject.js');

//#region ../../node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/dist/cjs/internal/observable/combineLatest.js
var require_combineLatest = /* @__PURE__ */ require_rolldown_runtime.__commonJS({ "../../node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/dist/cjs/internal/observable/combineLatest.js": ((exports) => {
	Object.defineProperty(exports, "__esModule", { value: true });
	var Observable_1 = require_Observable$1.require_Observable();
	var argsArgArrayOrObject_1 = require_argsArgArrayOrObject$1.require_argsArgArrayOrObject();
	var from_1 = require_from$1.require_from();
	var identity_1 = require_identity$1.require_identity();
	var mapOneOrManyArgs_1 = require_mapOneOrManyArgs$1.require_mapOneOrManyArgs();
	var args_1 = require_args$1.require_args();
	var createObject_1 = require_createObject$1.require_createObject();
	var OperatorSubscriber_1 = require_OperatorSubscriber$1.require_OperatorSubscriber();
	var executeSchedule_1 = require_executeSchedule$1.require_executeSchedule();
	function combineLatest() {
		var args = [];
		for (var _i = 0; _i < arguments.length; _i++) args[_i] = arguments[_i];
		var scheduler = args_1.popScheduler(args);
		var resultSelector = args_1.popResultSelector(args);
		var _a = argsArgArrayOrObject_1.argsArgArrayOrObject(args), observables = _a.args, keys = _a.keys;
		if (observables.length === 0) return from_1.from([], scheduler);
		var result = new Observable_1.Observable(combineLatestInit(observables, scheduler, keys ? function(values) {
			return createObject_1.createObject(keys, values);
		} : identity_1.identity));
		return resultSelector ? result.pipe(mapOneOrManyArgs_1.mapOneOrManyArgs(resultSelector)) : result;
	}
	exports.combineLatest = combineLatest;
	function combineLatestInit(observables, scheduler, valueTransform) {
		if (valueTransform === void 0) valueTransform = identity_1.identity;
		return function(subscriber) {
			maybeSchedule(scheduler, function() {
				var length = observables.length;
				var values = new Array(length);
				var active = length;
				var remainingFirstValues = length;
				var _loop_1 = function(i$1) {
					maybeSchedule(scheduler, function() {
						var source = from_1.from(observables[i$1], scheduler);
						var hasFirstValue = false;
						source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function(value) {
							values[i$1] = value;
							if (!hasFirstValue) {
								hasFirstValue = true;
								remainingFirstValues--;
							}
							if (!remainingFirstValues) subscriber.next(valueTransform(values.slice()));
						}, function() {
							if (!--active) subscriber.complete();
						}));
					}, subscriber);
				};
				for (var i = 0; i < length; i++) _loop_1(i);
			}, subscriber);
		};
	}
	exports.combineLatestInit = combineLatestInit;
	function maybeSchedule(scheduler, execute, subscription) {
		if (scheduler) executeSchedule_1.executeSchedule(subscription, scheduler, execute);
		else execute();
	}
}) });

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