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_Subject$1 = require('../Subject.js');
const require_innerFrom$1 = require('../observable/innerFrom.js');

//#region ../../node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/dist/cjs/internal/operators/retryWhen.js
var require_retryWhen = /* @__PURE__ */ require_rolldown_runtime.__commonJS({ "../../node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/dist/cjs/internal/operators/retryWhen.js": ((exports) => {
	Object.defineProperty(exports, "__esModule", { value: true });
	var innerFrom_1 = require_innerFrom$1.require_innerFrom();
	var Subject_1 = require_Subject$1.require_Subject();
	var lift_1 = require_lift$1.require_lift();
	var OperatorSubscriber_1 = require_OperatorSubscriber$1.require_OperatorSubscriber();
	function retryWhen(notifier) {
		return lift_1.operate(function(source, subscriber) {
			var innerSub;
			var syncResub = false;
			var errors$;
			var subscribeForRetryWhen = function() {
				innerSub = source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, void 0, void 0, function(err) {
					if (!errors$) {
						errors$ = new Subject_1.Subject();
						innerFrom_1.innerFrom(notifier(errors$)).subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function() {
							return innerSub ? subscribeForRetryWhen() : syncResub = true;
						}));
					}
					if (errors$) errors$.next(err);
				}));
				if (syncResub) {
					innerSub.unsubscribe();
					innerSub = null;
					syncResub = false;
					subscribeForRetryWhen();
				}
			};
			subscribeForRetryWhen();
		});
	}
	exports.retryWhen = retryWhen;
}) });

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