package io.reactivex.internal.operators.mixed; import android.Manifest; import io.reactivex.CompletableObserver; import io.reactivex.CompletableSource; import io.reactivex.MaybeSource; import io.reactivex.Observer; import io.reactivex.SingleSource; import io.reactivex.exceptions.Exceptions; import io.reactivex.functions.Function; import io.reactivex.internal.disposables.EmptyDisposable; import io.reactivex.internal.functions.ObjectHelper; import io.reactivex.internal.operators.maybe.MaybeToObservable; import io.reactivex.internal.operators.single.SingleToObservable; import java.util.concurrent.Callable; /* loaded from: classes2.dex */ final class ScalarXMapZHelper { static boolean a(Object obj, Function function, CompletableObserver completableObserver) { if (!(obj instanceof Callable)) { return false; } CompletableSource completableSource = null; try { Manifest manifest = (Object) ((Callable) obj).call(); if (manifest != null) { CompletableSource apply = function.apply(manifest); ObjectHelper.a(apply, "The mapper returned a null CompletableSource"); completableSource = apply; } if (completableSource == null) { EmptyDisposable.complete(completableObserver); } else { completableSource.a(completableObserver); } return true; } catch (Throwable th) { Exceptions.b(th); EmptyDisposable.error(th, completableObserver); return true; } } static boolean b(Object obj, Function> function, Observer observer) { if (!(obj instanceof Callable)) { return false; } SingleSource singleSource = null; try { Manifest manifest = (Object) ((Callable) obj).call(); if (manifest != null) { SingleSource apply = function.apply(manifest); ObjectHelper.a(apply, "The mapper returned a null SingleSource"); singleSource = apply; } if (singleSource == null) { EmptyDisposable.complete(observer); } else { singleSource.a(SingleToObservable.a(observer)); } return true; } catch (Throwable th) { Exceptions.b(th); EmptyDisposable.error(th, observer); return true; } } static boolean a(Object obj, Function> function, Observer observer) { if (!(obj instanceof Callable)) { return false; } MaybeSource maybeSource = null; try { Manifest manifest = (Object) ((Callable) obj).call(); if (manifest != null) { MaybeSource apply = function.apply(manifest); ObjectHelper.a(apply, "The mapper returned a null MaybeSource"); maybeSource = apply; } if (maybeSource == null) { EmptyDisposable.complete(observer); } else { maybeSource.a(MaybeToObservable.a(observer)); } return true; } catch (Throwable th) { Exceptions.b(th); EmptyDisposable.error(th, observer); return true; } } }