package l.h0.a;

import f.a.i;
import f.a.o;
import f.a.p;
import java.lang.annotation.Annotation;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import javax.annotation.Nullable;
import l.b0;
import l.c;
import l.c0;
import l.g0;

/* JADX INFO: compiled from: RxJava2CallAdapterFactory.java */
/* JADX INFO: loaded from: classes.dex */
public final class g extends c.a {
    public g(@Nullable o oVar, boolean z) {
    }

    @Override // l.c.a
    @Nullable
    public l.c<?, ?> a(Type type, Annotation[] annotationArr, c0 c0Var) {
        Type typeE;
        boolean z;
        boolean z2;
        Class<?> clsF = g0.f(type);
        if (clsF == f.a.b.class) {
            return new f(Void.class, null, false, false, true, false, false, false, true);
        }
        boolean z3 = clsF == f.a.e.class;
        boolean z4 = clsF == p.class;
        boolean z5 = clsF == f.a.f.class;
        if (clsF != i.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 typeE2 = g0.e(0, (ParameterizedType) type);
        Class<?> clsF2 = g0.f(typeE2);
        if (clsF2 == b0.class) {
            if (!(typeE2 instanceof ParameterizedType)) {
                throw new IllegalStateException("Response must be parameterized as Response<Foo> or Response<? extends Foo>");
            }
            typeE = g0.e(0, (ParameterizedType) typeE2);
            z2 = false;
            z = false;
        } else if (clsF2 != d.class) {
            typeE = typeE2;
            z = true;
            z2 = false;
        } else {
            if (!(typeE2 instanceof ParameterizedType)) {
                throw new IllegalStateException("Result must be parameterized as Result<Foo> or Result<? extends Foo>");
            }
            typeE = g0.e(0, (ParameterizedType) typeE2);
            z2 = true;
            z = false;
        }
        return new f(typeE, null, false, z2, z, z3, z4, z5, false);
    }
}
