package nn;

import hp.h1;
import hp.p1;
import hp.t1;
import java.lang.reflect.GenericArrayType;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.lang.reflect.WildcardType;
import java.util.ArrayList;
import java.util.List;
import nn.j0;
import tn.d1;
import tn.e1;

/* loaded from: classes3.dex */
public final class e0 implements kotlin.jvm.internal.u {

    /* renamed from: t, reason: collision with root package name */
    static final /* synthetic */ kn.l[] f30163t = {kotlin.jvm.internal.p0.h(new kotlin.jvm.internal.g0(kotlin.jvm.internal.p0.b(e0.class), "classifier", "getClassifier()Lkotlin/reflect/KClassifier;")), kotlin.jvm.internal.p0.h(new kotlin.jvm.internal.g0(kotlin.jvm.internal.p0.b(e0.class), "arguments", "getArguments()Ljava/util/List;"))};

    /* renamed from: p, reason: collision with root package name */
    private final hp.e0 f30164p;

    /* renamed from: q, reason: collision with root package name */
    private final j0.a f30165q;

    /* renamed from: r, reason: collision with root package name */
    private final j0.a f30166r;

    /* renamed from: s, reason: collision with root package name */
    private final j0.a f30167s;

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes3.dex */
    public static final class a extends kotlin.jvm.internal.v implements dn.a {

        /* renamed from: q, reason: collision with root package name */
        final /* synthetic */ dn.a f30169q;

        /* JADX INFO: Access modifiers changed from: package-private */
        /* renamed from: nn.e0$a$a, reason: collision with other inner class name */
        /* loaded from: classes3.dex */
        public static final class C0692a extends kotlin.jvm.internal.v implements dn.a {

            /* renamed from: p, reason: collision with root package name */
            final /* synthetic */ e0 f30170p;

            /* renamed from: q, reason: collision with root package name */
            final /* synthetic */ int f30171q;

            /* renamed from: r, reason: collision with root package name */
            final /* synthetic */ rm.o f30172r;

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            C0692a(e0 e0Var, int i10, rm.o oVar) {
                super(0);
                this.f30170p = e0Var;
                this.f30171q = i10;
                this.f30172r = oVar;
            }

            @Override // dn.a
            /* renamed from: a, reason: merged with bridge method [inline-methods] */
            public final Type invoke() {
                Object T;
                Object S;
                Type m10 = this.f30170p.m();
                if (m10 instanceof Class) {
                    Class cls = (Class) m10;
                    Class componentType = cls.isArray() ? cls.getComponentType() : Object.class;
                    kotlin.jvm.internal.t.d(componentType);
                    return componentType;
                }
                if (m10 instanceof GenericArrayType) {
                    if (this.f30171q == 0) {
                        Type genericComponentType = ((GenericArrayType) m10).getGenericComponentType();
                        kotlin.jvm.internal.t.d(genericComponentType);
                        return genericComponentType;
                    }
                    throw new h0("Array type has been queried for a non-0th argument: " + this.f30170p);
                }
                if (!(m10 instanceof ParameterizedType)) {
                    throw new h0("Non-generic type has been queried for arguments: " + this.f30170p);
                }
                Type type = (Type) a.c(this.f30172r).get(this.f30171q);
                if (type instanceof WildcardType) {
                    WildcardType wildcardType = (WildcardType) type;
                    Type[] lowerBounds = wildcardType.getLowerBounds();
                    kotlin.jvm.internal.t.f(lowerBounds, "getLowerBounds(...)");
                    T = sm.p.T(lowerBounds);
                    Type type2 = (Type) T;
                    if (type2 == null) {
                        Type[] upperBounds = wildcardType.getUpperBounds();
                        kotlin.jvm.internal.t.f(upperBounds, "getUpperBounds(...)");
                        S = sm.p.S(upperBounds);
                        type = (Type) S;
                    } else {
                        type = type2;
                    }
                }
                kotlin.jvm.internal.t.d(type);
                return type;
            }
        }

        /* loaded from: classes3.dex */
        public /* synthetic */ class b {

            /* renamed from: a, reason: collision with root package name */
            public static final /* synthetic */ int[] f30173a;

            static {
                int[] iArr = new int[t1.values().length];
                try {
                    iArr[t1.INVARIANT.ordinal()] = 1;
                } catch (NoSuchFieldError unused) {
                }
                try {
                    iArr[t1.IN_VARIANCE.ordinal()] = 2;
                } catch (NoSuchFieldError unused2) {
                }
                try {
                    iArr[t1.OUT_VARIANCE.ordinal()] = 3;
                } catch (NoSuchFieldError unused3) {
                }
                f30173a = iArr;
            }
        }

        /* JADX INFO: Access modifiers changed from: package-private */
        /* loaded from: classes3.dex */
        public static final class c extends kotlin.jvm.internal.v implements dn.a {

            /* renamed from: p, reason: collision with root package name */
            final /* synthetic */ e0 f30174p;

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            c(e0 e0Var) {
                super(0);
                this.f30174p = e0Var;
            }

            @Override // dn.a
            /* renamed from: a, reason: merged with bridge method [inline-methods] */
            public final List invoke() {
                Type m10 = this.f30174p.m();
                kotlin.jvm.internal.t.d(m10);
                return yn.d.d(m10);
            }
        }

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        a(dn.a aVar) {
            super(0);
            this.f30169q = aVar;
        }

        /* JADX INFO: Access modifiers changed from: private */
        public static final List c(rm.o oVar) {
            return (List) oVar.getValue();
        }

        @Override // dn.a
        /* renamed from: b, reason: merged with bridge method [inline-methods] */
        public final List invoke() {
            rm.o b10;
            int v10;
            kn.r d10;
            List k10;
            List I0 = e0.this.k().I0();
            if (I0.isEmpty()) {
                k10 = sm.u.k();
                return k10;
            }
            b10 = rm.q.b(rm.s.PUBLICATION, new c(e0.this));
            List list = I0;
            dn.a aVar = this.f30169q;
            e0 e0Var = e0.this;
            v10 = sm.v.v(list, 10);
            ArrayList arrayList = new ArrayList(v10);
            int i10 = 0;
            for (Object obj : list) {
                int i11 = i10 + 1;
                if (i10 < 0) {
                    sm.u.u();
                }
                h1 h1Var = (h1) obj;
                if (h1Var.b()) {
                    d10 = kn.r.f26031c.c();
                } else {
                    hp.e0 type = h1Var.getType();
                    kotlin.jvm.internal.t.f(type, "getType(...)");
                    e0 e0Var2 = new e0(type, aVar == null ? null : new C0692a(e0Var, i10, b10));
                    int i12 = b.f30173a[h1Var.a().ordinal()];
                    if (i12 == 1) {
                        d10 = kn.r.f26031c.d(e0Var2);
                    } else if (i12 == 2) {
                        d10 = kn.r.f26031c.a(e0Var2);
                    } else {
                        if (i12 != 3) {
                            throw new rm.t();
                        }
                        d10 = kn.r.f26031c.b(e0Var2);
                    }
                }
                arrayList.add(d10);
                i10 = i11;
            }
            return arrayList;
        }
    }

    /* loaded from: classes3.dex */
    static final class b extends kotlin.jvm.internal.v implements dn.a {
        b() {
            super(0);
        }

        @Override // dn.a
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final kn.e invoke() {
            e0 e0Var = e0.this;
            return e0Var.j(e0Var.k());
        }
    }

    public e0(hp.e0 type, dn.a aVar) {
        kotlin.jvm.internal.t.g(type, "type");
        this.f30164p = type;
        j0.a aVar2 = null;
        j0.a aVar3 = aVar instanceof j0.a ? (j0.a) aVar : null;
        if (aVar3 != null) {
            aVar2 = aVar3;
        } else if (aVar != null) {
            aVar2 = j0.b(aVar);
        }
        this.f30165q = aVar2;
        this.f30166r = j0.b(new b());
        this.f30167s = j0.b(new a(aVar));
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final kn.e j(hp.e0 e0Var) {
        Object F0;
        hp.e0 type;
        tn.h p10 = e0Var.K0().p();
        if (!(p10 instanceof tn.e)) {
            if (p10 instanceof e1) {
                return new f0(null, (e1) p10);
            }
            if (!(p10 instanceof d1)) {
                return null;
            }
            throw new rm.u("An operation is not implemented: Type alias classifiers are not yet supported");
        }
        Class q10 = p0.q((tn.e) p10);
        if (q10 == null) {
            return null;
        }
        if (!q10.isArray()) {
            if (p1.l(e0Var)) {
                return new o(q10);
            }
            Class e10 = yn.d.e(q10);
            if (e10 != null) {
                q10 = e10;
            }
            return new o(q10);
        }
        F0 = sm.c0.F0(e0Var.I0());
        h1 h1Var = (h1) F0;
        if (h1Var == null || (type = h1Var.getType()) == null) {
            return new o(q10);
        }
        kn.e j10 = j(type);
        if (j10 != null) {
            return new o(p0.f(cn.a.b(mn.b.a(j10))));
        }
        throw new h0("Cannot determine classifier for array element type: " + this);
    }

    @Override // kn.p
    public List b() {
        Object b10 = this.f30167s.b(this, f30163t[1]);
        kotlin.jvm.internal.t.f(b10, "getValue(...)");
        return (List) b10;
    }

    @Override // kn.p
    public kn.e c() {
        return (kn.e) this.f30166r.b(this, f30163t[0]);
    }

    public boolean equals(Object obj) {
        if (obj instanceof e0) {
            e0 e0Var = (e0) obj;
            if (kotlin.jvm.internal.t.b(this.f30164p, e0Var.f30164p) && kotlin.jvm.internal.t.b(c(), e0Var.c()) && kotlin.jvm.internal.t.b(b(), e0Var.b())) {
                return true;
            }
        }
        return false;
    }

    public int hashCode() {
        int hashCode = this.f30164p.hashCode() * 31;
        kn.e c10 = c();
        return ((hashCode + (c10 != null ? c10.hashCode() : 0)) * 31) + b().hashCode();
    }

    public final hp.e0 k() {
        return this.f30164p;
    }

    @Override // kotlin.jvm.internal.u
    public Type m() {
        j0.a aVar = this.f30165q;
        if (aVar != null) {
            return (Type) aVar.invoke();
        }
        return null;
    }

    public String toString() {
        return l0.f30202a.h(this.f30164p);
    }

    public /* synthetic */ e0(hp.e0 e0Var, dn.a aVar, int i10, kotlin.jvm.internal.k kVar) {
        this(e0Var, (i10 & 2) != 0 ? null : aVar);
    }
}
