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