"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.onAnyEvent = onAnyEvent;
const rxjs_1 = require("rxjs");
/** @internal */
function onAnyEvent(handleEvent) {
    return (observable) => {
        return new rxjs_1.Observable((observer) => {
            const subscription = observable.subscribe({
                next: (value) => {
                    handleEvent({ type: "next", value });
                    observer.next(value);
                },
                error: (error) => {
                    handleEvent({ type: "error", error });
                    observer.error(error);
                },
                complete: () => {
                    handleEvent({ type: "complete" });
                    observer.complete();
                },
            });
            return () => {
                subscription.unsubscribe();
            };
        });
    };
}
//# sourceMappingURL=observables.cjs.map
