"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.skipUntil = void 0;
const Observable_js_1 = require("../Observable.js");
const noop_js_1 = require("../util/noop.js");
function skipUntil(notifier) {
    return (source) => new Observable_js_1.Observable((destination) => {
        let taking = false;
        const skipSubscriber = (0, Observable_js_1.operate)({
            destination,
            next: () => {
                skipSubscriber?.unsubscribe();
                taking = true;
            },
            complete: noop_js_1.noop,
        });
        (0, Observable_js_1.from)(notifier).subscribe(skipSubscriber);
        source.subscribe((0, Observable_js_1.operate)({ destination, next: (value) => taking && destination.next(value) }));
    });
}
exports.skipUntil = skipUntil;