import { Observable } from "rxjs";
/** @internal */
export function onAnyEvent(handleEvent) {
    return (observable) => {
        return new 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.js.map
