package rn;

import hp.e0;
import hp.m0;
import hp.m1;
import hp.t1;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import kotlin.jvm.internal.k;
import kotlin.jvm.internal.t;
import mp.q;
import sm.c0;
import sm.h0;
import sm.u;
import sm.v;
import tn.b;
import tn.d0;
import tn.e1;
import tn.i1;
import tn.m;
import tn.w0;
import tn.y;
import tn.z0;
import vn.g0;
import vn.l0;
import vn.p;

/* loaded from: classes3.dex */
public final class e extends g0 {
    public static final a T = new a(null);

    /* loaded from: classes3.dex */
    public static final class a {
        private a() {
        }

        public /* synthetic */ a(k kVar) {
            this();
        }

        private final i1 b(e eVar, int i10, e1 e1Var) {
            String lowerCase;
            String e10 = e1Var.getName().e();
            t.f(e10, "asString(...)");
            if (t.b(e10, "T")) {
                lowerCase = "instance";
            } else if (t.b(e10, "E")) {
                lowerCase = "receiver";
            } else {
                lowerCase = e10.toLowerCase(Locale.ROOT);
                t.f(lowerCase, "toLowerCase(...)");
            }
            kotlin.reflect.jvm.internal.impl.descriptors.annotations.g b10 = kotlin.reflect.jvm.internal.impl.descriptors.annotations.g.f26219f.b();
            ro.f s10 = ro.f.s(lowerCase);
            t.f(s10, "identifier(...)");
            m0 q10 = e1Var.q();
            t.f(q10, "getDefaultType(...)");
            z0 NO_SOURCE = z0.f36441a;
            t.f(NO_SOURCE, "NO_SOURCE");
            return new l0(eVar, null, i10, b10, s10, q10, false, false, false, null, NO_SOURCE);
        }

        public final e a(b functionClass, boolean z10) {
            List k10;
            List k11;
            Iterable<h0> a12;
            int v10;
            Object o02;
            t.g(functionClass, "functionClass");
            List s10 = functionClass.s();
            e eVar = new e(functionClass, null, b.a.DECLARATION, z10, null);
            w0 G0 = functionClass.G0();
            k10 = u.k();
            k11 = u.k();
            ArrayList arrayList = new ArrayList();
            for (Object obj : s10) {
                if (!(((e1) obj).l() == t1.IN_VARIANCE)) {
                    break;
                }
                arrayList.add(obj);
            }
            a12 = c0.a1(arrayList);
            v10 = v.v(a12, 10);
            ArrayList arrayList2 = new ArrayList(v10);
            for (h0 h0Var : a12) {
                arrayList2.add(e.T.b(eVar, h0Var.c(), (e1) h0Var.d()));
            }
            o02 = c0.o0(s10);
            eVar.O0(null, G0, k10, k11, arrayList2, ((e1) o02).q(), d0.ABSTRACT, tn.t.f36414e);
            eVar.W0(true);
            return eVar;
        }
    }

    public /* synthetic */ e(m mVar, e eVar, b.a aVar, boolean z10, k kVar) {
        this(mVar, eVar, aVar, z10);
    }

    private final y m1(List list) {
        int v10;
        ro.f fVar;
        List b12;
        boolean z10;
        int size = i().size() - list.size();
        boolean z11 = true;
        if (size == 0) {
            List i10 = i();
            t.f(i10, "getValueParameters(...)");
            b12 = c0.b1(list, i10);
            List<rm.v> list2 = b12;
            if (!(list2 instanceof Collection) || !list2.isEmpty()) {
                for (rm.v vVar : list2) {
                    if (!t.b((ro.f) vVar.a(), ((i1) vVar.b()).getName())) {
                        z10 = false;
                        break;
                    }
                }
            }
            z10 = true;
            if (z10) {
                return this;
            }
        }
        List i11 = i();
        t.f(i11, "getValueParameters(...)");
        List<i1> list3 = i11;
        v10 = v.v(list3, 10);
        ArrayList arrayList = new ArrayList(v10);
        for (i1 i1Var : list3) {
            ro.f name = i1Var.getName();
            t.f(name, "getName(...)");
            int index = i1Var.getIndex();
            int i12 = index - size;
            if (i12 >= 0 && (fVar = (ro.f) list.get(i12)) != null) {
                name = fVar;
            }
            arrayList.add(i1Var.d0(this, name, index));
        }
        p.c P0 = P0(m1.f21980b);
        List list4 = list;
        if (!(list4 instanceof Collection) || !list4.isEmpty()) {
            Iterator it = list4.iterator();
            while (it.hasNext()) {
                if (((ro.f) it.next()) == null) {
                    break;
                }
            }
        }
        z11 = false;
        p.c m10 = P0.G(z11).d(arrayList).m(a());
        t.f(m10, "setOriginal(...)");
        y J0 = super.J0(m10);
        t.d(J0);
        return J0;
    }

    @Override // vn.g0, vn.p
    protected p I0(m newOwner, y yVar, b.a kind, ro.f fVar, kotlin.reflect.jvm.internal.impl.descriptors.annotations.g annotations, z0 source) {
        t.g(newOwner, "newOwner");
        t.g(kind, "kind");
        t.g(annotations, "annotations");
        t.g(source, "source");
        return new e(newOwner, (e) yVar, kind, isSuspend());
    }

    /* JADX INFO: Access modifiers changed from: protected */
    @Override // vn.p
    public y J0(p.c configuration) {
        int v10;
        t.g(configuration, "configuration");
        e eVar = (e) super.J0(configuration);
        if (eVar == null) {
            return null;
        }
        List i10 = eVar.i();
        t.f(i10, "getValueParameters(...)");
        List list = i10;
        boolean z10 = true;
        if (!(list instanceof Collection) || !list.isEmpty()) {
            Iterator it = list.iterator();
            while (true) {
                if (!it.hasNext()) {
                    break;
                }
                e0 type = ((i1) it.next()).getType();
                t.f(type, "getType(...)");
                if (qn.f.d(type) != null) {
                    z10 = false;
                    break;
                }
            }
        }
        if (z10) {
            return eVar;
        }
        List i11 = eVar.i();
        t.f(i11, "getValueParameters(...)");
        List list2 = i11;
        v10 = v.v(list2, 10);
        ArrayList arrayList = new ArrayList(v10);
        Iterator it2 = list2.iterator();
        while (it2.hasNext()) {
            e0 type2 = ((i1) it2.next()).getType();
            t.f(type2, "getType(...)");
            arrayList.add(qn.f.d(type2));
        }
        return eVar.m1(arrayList);
    }

    @Override // vn.p, tn.y
    public boolean L() {
        return false;
    }

    @Override // vn.p, tn.c0
    public boolean isExternal() {
        return false;
    }

    @Override // vn.p, tn.y
    public boolean isInline() {
        return false;
    }

    private e(m mVar, e eVar, b.a aVar, boolean z10) {
        super(mVar, eVar, kotlin.reflect.jvm.internal.impl.descriptors.annotations.g.f26219f.b(), q.f29614i, aVar, z0.f36441a);
        c1(true);
        e1(z10);
        V0(false);
    }
}
