package f.z.a;

import b.a.a.a.j;
import b.a.a.a.k;
import f.e;
import f.t;
import f.u;
import java.lang.annotation.Annotation;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import javax.annotation.Nullable;

/* JADX INFO: compiled from: RxJava3CallAdapterFactory.java */
/* JADX INFO: loaded from: classes.dex */
public final class h extends e.a {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    @Nullable
    private final j f1790a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    private final boolean f1791b;

    private h(@Nullable j jVar, boolean z) {
        this.f1790a = jVar;
        this.f1791b = z;
    }

    public static h d() {
        return new h(null, true);
    }

    @Override // f.e.a
    @Nullable
    public f.e<?, ?> a(Type type, Annotation[] annotationArr, u uVar) {
        Type typeB;
        boolean z;
        boolean z2;
        Class<?> clsC = e.a.c(type);
        if (clsC == b.a.a.a.b.class) {
            return new g(Void.class, this.f1790a, this.f1791b, false, true, false, false, false, true);
        }
        boolean z3 = clsC == b.a.a.a.d.class;
        boolean z4 = clsC == k.class;
        boolean z5 = clsC == b.a.a.a.e.class;
        if (clsC != b.a.a.a.g.class && !z3 && !z4 && !z5) {
            return null;
        }
        if (!(type instanceof ParameterizedType)) {
            String str = !z3 ? !z4 ? z5 ? "Maybe" : "Observable" : "Single" : "Flowable";
            throw new IllegalStateException(str + " return type must be parameterized as " + str + "<Foo> or " + str + "<? extends Foo>");
        }
        Type typeB2 = e.a.b(0, (ParameterizedType) type);
        Class<?> clsC2 = e.a.c(typeB2);
        if (clsC2 == t.class) {
            if (!(typeB2 instanceof ParameterizedType)) {
                throw new IllegalStateException("Response must be parameterized as Response<Foo> or Response<? extends Foo>");
            }
            typeB = e.a.b(0, (ParameterizedType) typeB2);
            z2 = false;
            z = false;
        } else if (clsC2 != e.class) {
            typeB = typeB2;
            z = true;
            z2 = false;
        } else {
            if (!(typeB2 instanceof ParameterizedType)) {
                throw new IllegalStateException("Result must be parameterized as Result<Foo> or Result<? extends Foo>");
            }
            typeB = e.a.b(0, (ParameterizedType) typeB2);
            z2 = true;
            z = false;
        }
        return new g(typeB, this.f1790a, this.f1791b, z2, z, z3, z4, z5, false);
    }
}
