package hp;

import hp.o;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

/* loaded from: classes3.dex */
public abstract class q0 {
    public static final a a(e0 e0Var) {
        kotlin.jvm.internal.t.g(e0Var, "<this>");
        s1 N0 = e0Var.N0();
        if (N0 instanceof a) {
            return (a) N0;
        }
        return null;
    }

    public static final m0 b(e0 e0Var) {
        kotlin.jvm.internal.t.g(e0Var, "<this>");
        a a10 = a(e0Var);
        if (a10 != null) {
            return a10.W0();
        }
        return null;
    }

    public static final boolean c(e0 e0Var) {
        kotlin.jvm.internal.t.g(e0Var, "<this>");
        return e0Var.N0() instanceof o;
    }

    private static final d0 d(d0 d0Var) {
        int v10;
        e0 e0Var;
        Collection n10 = d0Var.n();
        v10 = sm.v.v(n10, 10);
        ArrayList arrayList = new ArrayList(v10);
        Iterator it = n10.iterator();
        boolean z10 = false;
        while (true) {
            e0Var = null;
            if (!it.hasNext()) {
                break;
            }
            e0 e0Var2 = (e0) it.next();
            if (p1.l(e0Var2)) {
                e0Var2 = f(e0Var2.N0(), false, 1, null);
                z10 = true;
            }
            arrayList.add(e0Var2);
        }
        if (!z10) {
            return null;
        }
        e0 c10 = d0Var.c();
        if (c10 != null) {
            if (p1.l(c10)) {
                c10 = f(c10.N0(), false, 1, null);
            }
            e0Var = c10;
        }
        return new d0(arrayList).g(e0Var);
    }

    public static final s1 e(s1 s1Var, boolean z10) {
        kotlin.jvm.internal.t.g(s1Var, "<this>");
        o c10 = o.a.c(o.f21989s, s1Var, z10, false, 4, null);
        if (c10 != null) {
            return c10;
        }
        m0 g10 = g(s1Var);
        return g10 != null ? g10 : s1Var.O0(false);
    }

    public static /* synthetic */ s1 f(s1 s1Var, boolean z10, int i10, Object obj) {
        if ((i10 & 1) != 0) {
            z10 = false;
        }
        return e(s1Var, z10);
    }

    private static final m0 g(e0 e0Var) {
        d0 d10;
        d1 K0 = e0Var.K0();
        d0 d0Var = K0 instanceof d0 ? (d0) K0 : null;
        if (d0Var == null || (d10 = d(d0Var)) == null) {
            return null;
        }
        return d10.b();
    }

    public static final m0 h(m0 m0Var, boolean z10) {
        kotlin.jvm.internal.t.g(m0Var, "<this>");
        o c10 = o.a.c(o.f21989s, m0Var, z10, false, 4, null);
        if (c10 != null) {
            return c10;
        }
        m0 g10 = g(m0Var);
        return g10 == null ? m0Var.O0(false) : g10;
    }

    public static /* synthetic */ m0 i(m0 m0Var, boolean z10, int i10, Object obj) {
        if ((i10 & 1) != 0) {
            z10 = false;
        }
        return h(m0Var, z10);
    }

    public static final m0 j(m0 m0Var, m0 abbreviatedType) {
        kotlin.jvm.internal.t.g(m0Var, "<this>");
        kotlin.jvm.internal.t.g(abbreviatedType, "abbreviatedType");
        return g0.a(m0Var) ? m0Var : new a(m0Var, abbreviatedType);
    }

    public static final kotlin.reflect.jvm.internal.impl.types.checker.i k(kotlin.reflect.jvm.internal.impl.types.checker.i iVar) {
        kotlin.jvm.internal.t.g(iVar, "<this>");
        return new kotlin.reflect.jvm.internal.impl.types.checker.i(iVar.T0(), iVar.K0(), iVar.V0(), iVar.J0(), iVar.L0(), true);
    }
}
