// Path: rxlifecycle/src/main/java/com/trello/rxlifecycle4/LifecycleTransformer.java
// @ParametersAreNonnullByDefault
// public final class LifecycleTransformer<T> implements ObservableTransformer<T, T>,
//                                                       FlowableTransformer<T, T>,
//                                                       SingleTransformer<T, T>,
//                                                       MaybeTransformer<T, T>,
//                                                       CompletableTransformer
// {
//     final Observable<?> observable;
// 
//     LifecycleTransformer(Observable<?> observable) {
//         checkNotNull(observable, "observable == null");
//         this.observable = observable;
//     }
// 
//     @Override
//     public ObservableSource<T> apply(Observable<T> upstream) {
//         return upstream.takeUntil(observable);
//     }
// 
//     @Override
//     public Publisher<T> apply(Flowable<T> upstream) {
//         return upstream.takeUntil(observable.toFlowable(BackpressureStrategy.LATEST));
//     }
// 
//     @Override
//     public SingleSource<T> apply(Single<T> upstream) {
//         return upstream.takeUntil(observable.firstOrError());
//     }
// 
//     @Override
//     public MaybeSource<T> apply(Maybe<T> upstream) {
//         return upstream.takeUntil(observable.firstElement());
//     }
// 
//     @Override
//     public CompletableSource apply(Completable upstream) {
//         return Completable.ambArray(upstream, observable.flatMapCompletable(Functions.CANCEL_COMPLETABLE));
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         if (this == o) { return true; }
//         if (o == null || getClass() != o.getClass()) { return false; }
// 
//         LifecycleTransformer<?> that = (LifecycleTransformer<?>) o;
// 
//         return observable.equals(that.observable);
//     }
// 
//     @Override
//     public int hashCode() {
//         return observable.hashCode();
//     }
// 
//     @Override
//     public String toString() {
//         return "LifecycleTransformer{" +
//             "observable=" + observable +
//             '}';
//     }
// }
// 
// Path: rxlifecycle/src/main/java/com/trello/rxlifecycle4/OutsideLifecycleException.java
// public class OutsideLifecycleException extends IllegalStateException {
// 
//     public OutsideLifecycleException(@Nullable String detailMessage) {
//         super(detailMessage);
//     }
// }
// 
// Path: rxlifecycle/src/main/java/com/trello/rxlifecycle4/RxLifecycle.java
// @Nonnull
// @CheckReturnValue
// public static <T, R> LifecycleTransformer<T> bind(@Nonnull final Observable<R> lifecycle) {
//     return new LifecycleTransformer<>(lifecycle);
// }
// 
// Path: rxlifecycle/src/main/java/com/trello/rxlifecycle4/internal/Preconditions.java
// public static <T> T checkNotNull(T value, String message) {
//     if (value == null) {
//         throw new NullPointerException(message);
//     }
//     return value;
// }


import android.view.View;
import com.trello.rxlifecycle4.LifecycleTransformer;
import com.trello.rxlifecycle4.OutsideLifecycleException;
import androidx.annotation.CheckResult;
import androidx.annotation.NonNull;
import io.reactivex.rxjava3.core.Observable;
import io.reactivex.rxjava3.functions.Function;
import static com.trello.rxlifecycle4.RxLifecycle.bind;
import static com.trello.rxlifecycle4.internal.Preconditions.checkNotNull;
    }

    // Figures out which corresponding next lifecycle event in which to unsubscribe, for Activities
    private static final Function<ActivityEvent, ActivityEvent> ACTIVITY_LIFECYCLE =
        new Function<ActivityEvent, ActivityEvent>() {
            @Override
            public ActivityEvent apply(ActivityEvent lastEvent) throws Exception {
                switch (lastEvent) {
                    case CREATE:
                        return ActivityEvent.DESTROY;
                    case START:
                        return ActivityEvent.STOP;
                    case RESUME:
                        return ActivityEvent.PAUSE;
                    case PAUSE:
                        return ActivityEvent.STOP;
                    case STOP:
                        return ActivityEvent.DESTROY;
                    case DESTROY:
                        throw new OutsideLifecycleException("Cannot bind to Activity lifecycle when outside of it.");
                    default:
                        throw new UnsupportedOperationException("Binding to " + lastEvent + " not yet implemented");
                }
            }
        };

    // Figures out which corresponding next lifecycle event in which to unsubscribe, for Fragments
    private static final Function<FragmentEvent, FragmentEvent> FRAGMENT_LIFECYCLE =
        new Function<FragmentEvent, FragmentEvent>() {
            @Override
// Path: rxlifecycle/src/main/java/com/trello/rxlifecycle4/LifecycleTransformer.java
// @ParametersAreNonnullByDefault
// public final class LifecycleTransformer<T> implements ObservableTransformer<T, T>,
//                                                       FlowableTransformer<T, T>,
//                                                       SingleTransformer<T, T>,
//                                                       MaybeTransformer<T, T>,
//                                                       CompletableTransformer
// {
//     final Observable<?> observable;
// 
//     LifecycleTransformer(Observable<?> observable) {
//         checkNotNull(observable, "observable == null");
//         this.observable = observable;
//     }
// 
//     @Override
//     public ObservableSource<T> apply(Observable<T> upstream) {
//         return upstream.takeUntil(observable);
//     }
// 
//     @Override
//     public Publisher<T> apply(Flowable<T> upstream) {
//         return upstream.takeUntil(observable.toFlowable(BackpressureStrategy.LATEST));
//     }
// 
//     @Override
//     public SingleSource<T> apply(Single<T> upstream) {
//         return upstream.takeUntil(observable.firstOrError());
//     }
// 
//     @Override
//     public MaybeSource<T> apply(Maybe<T> upstream) {
//         return upstream.takeUntil(observable.firstElement());
//     }
// 
//     @Override
//     public CompletableSource apply(Completable upstream) {
//         return Completable.ambArray(upstream, observable.flatMapCompletable(Functions.CANCEL_COMPLETABLE));
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         if (this == o) { return true; }
//         if (o == null || getClass() != o.getClass()) { return false; }
// 
//         LifecycleTransformer<?> that = (LifecycleTransformer<?>) o;
// 
//         return observable.equals(that.observable);
//     }
// 
//     @Override
//     public int hashCode() {
//         return observable.hashCode();
//     }
// 
//     @Override
//     public String toString() {
//         return "LifecycleTransformer{" +
//             "observable=" + observable +
//             '}';
//     }
// }
// 
// Path: rxlifecycle/src/main/java/com/trello/rxlifecycle4/OutsideLifecycleException.java
// public class OutsideLifecycleException extends IllegalStateException {
// 
//     public OutsideLifecycleException(@Nullable String detailMessage) {
//         super(detailMessage);
//     }
// }
// 
// Path: rxlifecycle/src/main/java/com/trello/rxlifecycle4/RxLifecycle.java
// @Nonnull
// @CheckReturnValue
// public static <T, R> LifecycleTransformer<T> bind(@Nonnull final Observable<R> lifecycle) {
//     return new LifecycleTransformer<>(lifecycle);
// }
// 
// Path: rxlifecycle/src/main/java/com/trello/rxlifecycle4/internal/Preconditions.java
// public static <T> T checkNotNull(T value, String message) {
//     if (value == null) {
//         throw new NullPointerException(message);
//     }
//     return value;
// }


// Path: rxlifecycle-android/src/main/java/com/trello/rxlifecycle4/android/RxLifecycleAndroid.java
import android.view.View;
import com.trello.rxlifecycle4.LifecycleTransformer;
import com.trello.rxlifecycle4.OutsideLifecycleException;
import androidx.annotation.CheckResult;
import androidx.annotation.NonNull;
import io.reactivex.rxjava3.core.Observable;
import io.reactivex.rxjava3.functions.Function;
import static com.trello.rxlifecycle4.RxLifecycle.bind;
import static com.trello.rxlifecycle4.internal.Preconditions.checkNotNull;

    }

    // Figures out which corresponding next lifecycle event in which to unsubscribe, for Activities
    private static final Function<ActivityEvent, ActivityEvent> ACTIVITY_LIFECYCLE =
        new Function<ActivityEvent, ActivityEvent>() {
            @Override
            public ActivityEvent apply(ActivityEvent lastEvent) throws Exception {
                switch (lastEvent) {
                    case CREATE:
                        return ActivityEvent.DESTROY;
                    case START:
                        return ActivityEvent.STOP;
                    case RESUME:
                        return ActivityEvent.PAUSE;
                    case PAUSE:
                        return ActivityEvent.STOP;
                    case STOP:
                        return ActivityEvent.DESTROY;
                    case DESTROY:
                        throw new OutsideLifecycleException("Cannot bind to Activity lifecycle when outside of it.");
                    default:
                        throw new UnsupportedOperationException("Binding to " + lastEvent + " not yet implemented");
                }
            }
        };

    // Figures out which corresponding next lifecycle event in which to unsubscribe, for Fragments
    private static final Function<FragmentEvent, FragmentEvent> FRAGMENT_LIFECYCLE =
        new Function<FragmentEvent, FragmentEvent>() {
            @Override
            public FragmentEvent apply(FragmentEvent lastEvent) throws Exception {