package fp;

import ap.d;
import dp.x;
import dp.y;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import jn.o;
import kotlin.jvm.internal.g0;
import kotlin.jvm.internal.p0;
import kotlin.jvm.internal.t;
import kotlin.jvm.internal.v;
import kotlin.reflect.jvm.internal.impl.protobuf.p;
import mo.r;
import rm.n0;
import sm.c0;
import sm.q0;
import sm.u;
import sm.y0;
import sm.z;
import tn.d1;
import tn.t0;

/* loaded from: classes3.dex */
public abstract class h extends ap.i {

    /* renamed from: f, reason: collision with root package name */
    static final /* synthetic */ kn.l[] f18777f = {p0.h(new g0(p0.b(h.class), "classNames", "getClassNames$deserialization()Ljava/util/Set;")), p0.h(new g0(p0.b(h.class), "classifierNamesLazy", "getClassifierNamesLazy()Ljava/util/Set;"))};

    /* renamed from: b, reason: collision with root package name */
    private final dp.m f18778b;

    /* renamed from: c, reason: collision with root package name */
    private final a f18779c;

    /* renamed from: d, reason: collision with root package name */
    private final gp.i f18780d;

    /* renamed from: e, reason: collision with root package name */
    private final gp.j f18781e;

    /* JADX INFO: Access modifiers changed from: private */
    /* loaded from: classes3.dex */
    public interface a {
        Set a();

        Collection b(ro.f fVar, ao.b bVar);

        Collection c(ro.f fVar, ao.b bVar);

        Set d();

        d1 e(ro.f fVar);

        void f(Collection collection, ap.d dVar, dn.l lVar, ao.b bVar);

        Set g();
    }

    /* JADX INFO: Access modifiers changed from: private */
    /* loaded from: classes3.dex */
    public final class b implements a {

        /* renamed from: o, reason: collision with root package name */
        static final /* synthetic */ kn.l[] f18782o = {p0.h(new g0(p0.b(b.class), "declaredFunctions", "getDeclaredFunctions()Ljava/util/List;")), p0.h(new g0(p0.b(b.class), "declaredProperties", "getDeclaredProperties()Ljava/util/List;")), p0.h(new g0(p0.b(b.class), "allTypeAliases", "getAllTypeAliases()Ljava/util/List;")), p0.h(new g0(p0.b(b.class), "allFunctions", "getAllFunctions()Ljava/util/List;")), p0.h(new g0(p0.b(b.class), "allProperties", "getAllProperties()Ljava/util/List;")), p0.h(new g0(p0.b(b.class), "typeAliasesByName", "getTypeAliasesByName()Ljava/util/Map;")), p0.h(new g0(p0.b(b.class), "functionsByName", "getFunctionsByName()Ljava/util/Map;")), p0.h(new g0(p0.b(b.class), "propertiesByName", "getPropertiesByName()Ljava/util/Map;")), p0.h(new g0(p0.b(b.class), "functionNames", "getFunctionNames()Ljava/util/Set;")), p0.h(new g0(p0.b(b.class), "variableNames", "getVariableNames()Ljava/util/Set;"))};

        /* renamed from: a, reason: collision with root package name */
        private final List f18783a;

        /* renamed from: b, reason: collision with root package name */
        private final List f18784b;

        /* renamed from: c, reason: collision with root package name */
        private final List f18785c;

        /* renamed from: d, reason: collision with root package name */
        private final gp.i f18786d;

        /* renamed from: e, reason: collision with root package name */
        private final gp.i f18787e;

        /* renamed from: f, reason: collision with root package name */
        private final gp.i f18788f;

        /* renamed from: g, reason: collision with root package name */
        private final gp.i f18789g;

        /* renamed from: h, reason: collision with root package name */
        private final gp.i f18790h;

        /* renamed from: i, reason: collision with root package name */
        private final gp.i f18791i;

        /* renamed from: j, reason: collision with root package name */
        private final gp.i f18792j;

        /* renamed from: k, reason: collision with root package name */
        private final gp.i f18793k;

        /* renamed from: l, reason: collision with root package name */
        private final gp.i f18794l;

        /* renamed from: m, reason: collision with root package name */
        private final gp.i f18795m;

        /* renamed from: n, reason: collision with root package name */
        final /* synthetic */ h f18796n;

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

            @Override // dn.a
            /* renamed from: a, reason: merged with bridge method [inline-methods] */
            public final List invoke() {
                List z02;
                z02 = c0.z0(b.this.D(), b.this.t());
                return z02;
            }
        }

        /* renamed from: fp.h$b$b, reason: collision with other inner class name */
        /* loaded from: classes3.dex */
        static final class C0412b extends v implements dn.a {
            C0412b() {
                super(0);
            }

            @Override // dn.a
            /* renamed from: a, reason: merged with bridge method [inline-methods] */
            public final List invoke() {
                List z02;
                z02 = c0.z0(b.this.E(), b.this.u());
                return z02;
            }
        }

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

            @Override // dn.a
            /* renamed from: a, reason: merged with bridge method [inline-methods] */
            public final List invoke() {
                return b.this.z();
            }
        }

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

            @Override // dn.a
            /* renamed from: a, reason: merged with bridge method [inline-methods] */
            public final List invoke() {
                return b.this.v();
            }
        }

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

            @Override // dn.a
            /* renamed from: a, reason: merged with bridge method [inline-methods] */
            public final List invoke() {
                return b.this.y();
            }
        }

        /* loaded from: classes3.dex */
        static final class f extends v implements dn.a {

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

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            f(h hVar) {
                super(0);
                this.f18803q = hVar;
            }

            @Override // dn.a
            /* renamed from: a, reason: merged with bridge method [inline-methods] */
            public final Set invoke() {
                Set k10;
                b bVar = b.this;
                List list = bVar.f18783a;
                LinkedHashSet linkedHashSet = new LinkedHashSet();
                h hVar = bVar.f18796n;
                Iterator it = list.iterator();
                while (it.hasNext()) {
                    linkedHashSet.add(y.b(hVar.p().g(), ((mo.i) ((p) it.next())).Y()));
                }
                k10 = y0.k(linkedHashSet, this.f18803q.t());
                return k10;
            }
        }

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

            @Override // dn.a
            public final Map invoke() {
                List A = b.this.A();
                LinkedHashMap linkedHashMap = new LinkedHashMap();
                for (Object obj : A) {
                    ro.f name = ((tn.y0) obj).getName();
                    t.f(name, "getName(...)");
                    Object obj2 = linkedHashMap.get(name);
                    if (obj2 == null) {
                        obj2 = new ArrayList();
                        linkedHashMap.put(name, obj2);
                    }
                    ((List) obj2).add(obj);
                }
                return linkedHashMap;
            }
        }

        /* renamed from: fp.h$b$h, reason: collision with other inner class name */
        /* loaded from: classes3.dex */
        static final class C0413h extends v implements dn.a {
            C0413h() {
                super(0);
            }

            @Override // dn.a
            public final Map invoke() {
                List B = b.this.B();
                LinkedHashMap linkedHashMap = new LinkedHashMap();
                for (Object obj : B) {
                    ro.f name = ((t0) obj).getName();
                    t.f(name, "getName(...)");
                    Object obj2 = linkedHashMap.get(name);
                    if (obj2 == null) {
                        obj2 = new ArrayList();
                        linkedHashMap.put(name, obj2);
                    }
                    ((List) obj2).add(obj);
                }
                return linkedHashMap;
            }
        }

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

            @Override // dn.a
            public final Map invoke() {
                int v10;
                int d10;
                int d11;
                List C = b.this.C();
                v10 = sm.v.v(C, 10);
                d10 = sm.p0.d(v10);
                d11 = o.d(d10, 16);
                LinkedHashMap linkedHashMap = new LinkedHashMap(d11);
                for (Object obj : C) {
                    ro.f name = ((d1) obj).getName();
                    t.f(name, "getName(...)");
                    linkedHashMap.put(name, obj);
                }
                return linkedHashMap;
            }
        }

        /* loaded from: classes3.dex */
        static final class j extends v implements dn.a {

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

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            j(h hVar) {
                super(0);
                this.f18808q = hVar;
            }

            @Override // dn.a
            /* renamed from: a, reason: merged with bridge method [inline-methods] */
            public final Set invoke() {
                Set k10;
                b bVar = b.this;
                List list = bVar.f18784b;
                LinkedHashSet linkedHashSet = new LinkedHashSet();
                h hVar = bVar.f18796n;
                Iterator it = list.iterator();
                while (it.hasNext()) {
                    linkedHashSet.add(y.b(hVar.p().g(), ((mo.n) ((p) it.next())).X()));
                }
                k10 = y0.k(linkedHashSet, this.f18808q.u());
                return k10;
            }
        }

        public b(h hVar, List functionList, List propertyList, List typeAliasList) {
            t.g(functionList, "functionList");
            t.g(propertyList, "propertyList");
            t.g(typeAliasList, "typeAliasList");
            this.f18796n = hVar;
            this.f18783a = functionList;
            this.f18784b = propertyList;
            this.f18785c = hVar.p().c().g().g() ? typeAliasList : u.k();
            this.f18786d = hVar.p().h().b(new d());
            this.f18787e = hVar.p().h().b(new e());
            this.f18788f = hVar.p().h().b(new c());
            this.f18789g = hVar.p().h().b(new a());
            this.f18790h = hVar.p().h().b(new C0412b());
            this.f18791i = hVar.p().h().b(new i());
            this.f18792j = hVar.p().h().b(new g());
            this.f18793k = hVar.p().h().b(new C0413h());
            this.f18794l = hVar.p().h().b(new f(hVar));
            this.f18795m = hVar.p().h().b(new j(hVar));
        }

        /* JADX INFO: Access modifiers changed from: private */
        public final List A() {
            return (List) gp.m.a(this.f18789g, this, f18782o[3]);
        }

        /* JADX INFO: Access modifiers changed from: private */
        public final List B() {
            return (List) gp.m.a(this.f18790h, this, f18782o[4]);
        }

        /* JADX INFO: Access modifiers changed from: private */
        public final List C() {
            return (List) gp.m.a(this.f18788f, this, f18782o[2]);
        }

        /* JADX INFO: Access modifiers changed from: private */
        public final List D() {
            return (List) gp.m.a(this.f18786d, this, f18782o[0]);
        }

        /* JADX INFO: Access modifiers changed from: private */
        public final List E() {
            return (List) gp.m.a(this.f18787e, this, f18782o[1]);
        }

        private final Map F() {
            return (Map) gp.m.a(this.f18792j, this, f18782o[6]);
        }

        private final Map G() {
            return (Map) gp.m.a(this.f18793k, this, f18782o[7]);
        }

        private final Map H() {
            return (Map) gp.m.a(this.f18791i, this, f18782o[5]);
        }

        /* JADX INFO: Access modifiers changed from: private */
        public final List t() {
            Set t10 = this.f18796n.t();
            ArrayList arrayList = new ArrayList();
            Iterator it = t10.iterator();
            while (it.hasNext()) {
                z.A(arrayList, w((ro.f) it.next()));
            }
            return arrayList;
        }

        /* JADX INFO: Access modifiers changed from: private */
        public final List u() {
            Set u10 = this.f18796n.u();
            ArrayList arrayList = new ArrayList();
            Iterator it = u10.iterator();
            while (it.hasNext()) {
                z.A(arrayList, x((ro.f) it.next()));
            }
            return arrayList;
        }

        /* JADX INFO: Access modifiers changed from: private */
        public final List v() {
            List list = this.f18783a;
            h hVar = this.f18796n;
            ArrayList arrayList = new ArrayList();
            Iterator it = list.iterator();
            while (it.hasNext()) {
                tn.y0 j10 = hVar.p().f().j((mo.i) ((p) it.next()));
                if (!hVar.x(j10)) {
                    j10 = null;
                }
                if (j10 != null) {
                    arrayList.add(j10);
                }
            }
            return arrayList;
        }

        private final List w(ro.f fVar) {
            List D = D();
            h hVar = this.f18796n;
            ArrayList arrayList = new ArrayList();
            for (Object obj : D) {
                if (t.b(((tn.m) obj).getName(), fVar)) {
                    arrayList.add(obj);
                }
            }
            int size = arrayList.size();
            hVar.k(fVar, arrayList);
            return arrayList.subList(size, arrayList.size());
        }

        private final List x(ro.f fVar) {
            List E = E();
            h hVar = this.f18796n;
            ArrayList arrayList = new ArrayList();
            for (Object obj : E) {
                if (t.b(((tn.m) obj).getName(), fVar)) {
                    arrayList.add(obj);
                }
            }
            int size = arrayList.size();
            hVar.l(fVar, arrayList);
            return arrayList.subList(size, arrayList.size());
        }

        /* JADX INFO: Access modifiers changed from: private */
        public final List y() {
            List list = this.f18784b;
            h hVar = this.f18796n;
            ArrayList arrayList = new ArrayList();
            Iterator it = list.iterator();
            while (it.hasNext()) {
                t0 l10 = hVar.p().f().l((mo.n) ((p) it.next()));
                if (l10 != null) {
                    arrayList.add(l10);
                }
            }
            return arrayList;
        }

        /* JADX INFO: Access modifiers changed from: private */
        public final List z() {
            List list = this.f18785c;
            h hVar = this.f18796n;
            ArrayList arrayList = new ArrayList();
            Iterator it = list.iterator();
            while (it.hasNext()) {
                d1 m10 = hVar.p().f().m((r) ((p) it.next()));
                if (m10 != null) {
                    arrayList.add(m10);
                }
            }
            return arrayList;
        }

        @Override // fp.h.a
        public Set a() {
            return (Set) gp.m.a(this.f18794l, this, f18782o[8]);
        }

        @Override // fp.h.a
        public Collection b(ro.f name, ao.b location) {
            List k10;
            List k11;
            t.g(name, "name");
            t.g(location, "location");
            if (!a().contains(name)) {
                k11 = u.k();
                return k11;
            }
            Collection collection = (Collection) F().get(name);
            if (collection != null) {
                return collection;
            }
            k10 = u.k();
            return k10;
        }

        @Override // fp.h.a
        public Collection c(ro.f name, ao.b location) {
            List k10;
            List k11;
            t.g(name, "name");
            t.g(location, "location");
            if (!d().contains(name)) {
                k11 = u.k();
                return k11;
            }
            Collection collection = (Collection) G().get(name);
            if (collection != null) {
                return collection;
            }
            k10 = u.k();
            return k10;
        }

        @Override // fp.h.a
        public Set d() {
            return (Set) gp.m.a(this.f18795m, this, f18782o[9]);
        }

        @Override // fp.h.a
        public d1 e(ro.f name) {
            t.g(name, "name");
            return (d1) H().get(name);
        }

        @Override // fp.h.a
        public void f(Collection result, ap.d kindFilter, dn.l nameFilter, ao.b location) {
            t.g(result, "result");
            t.g(kindFilter, "kindFilter");
            t.g(nameFilter, "nameFilter");
            t.g(location, "location");
            if (kindFilter.a(ap.d.f6107c.i())) {
                for (Object obj : B()) {
                    ro.f name = ((t0) obj).getName();
                    t.f(name, "getName(...)");
                    if (((Boolean) nameFilter.invoke(name)).booleanValue()) {
                        result.add(obj);
                    }
                }
            }
            if (kindFilter.a(ap.d.f6107c.d())) {
                for (Object obj2 : A()) {
                    ro.f name2 = ((tn.y0) obj2).getName();
                    t.f(name2, "getName(...)");
                    if (((Boolean) nameFilter.invoke(name2)).booleanValue()) {
                        result.add(obj2);
                    }
                }
            }
        }

        @Override // fp.h.a
        public Set g() {
            List list = this.f18785c;
            LinkedHashSet linkedHashSet = new LinkedHashSet();
            h hVar = this.f18796n;
            Iterator it = list.iterator();
            while (it.hasNext()) {
                linkedHashSet.add(y.b(hVar.p().g(), ((r) ((p) it.next())).R()));
            }
            return linkedHashSet;
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    /* loaded from: classes3.dex */
    public final class c implements a {

        /* renamed from: j, reason: collision with root package name */
        static final /* synthetic */ kn.l[] f18809j = {p0.h(new g0(p0.b(c.class), "functionNames", "getFunctionNames()Ljava/util/Set;")), p0.h(new g0(p0.b(c.class), "variableNames", "getVariableNames()Ljava/util/Set;"))};

        /* renamed from: a, reason: collision with root package name */
        private final Map f18810a;

        /* renamed from: b, reason: collision with root package name */
        private final Map f18811b;

        /* renamed from: c, reason: collision with root package name */
        private final Map f18812c;

        /* renamed from: d, reason: collision with root package name */
        private final gp.g f18813d;

        /* renamed from: e, reason: collision with root package name */
        private final gp.g f18814e;

        /* renamed from: f, reason: collision with root package name */
        private final gp.h f18815f;

        /* renamed from: g, reason: collision with root package name */
        private final gp.i f18816g;

        /* renamed from: h, reason: collision with root package name */
        private final gp.i f18817h;

        /* renamed from: i, reason: collision with root package name */
        final /* synthetic */ h f18818i;

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

            /* renamed from: p, reason: collision with root package name */
            final /* synthetic */ kotlin.reflect.jvm.internal.impl.protobuf.r f18819p;

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

            /* renamed from: r, reason: collision with root package name */
            final /* synthetic */ h f18821r;

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            public a(kotlin.reflect.jvm.internal.impl.protobuf.r rVar, ByteArrayInputStream byteArrayInputStream, h hVar) {
                super(0);
                this.f18819p = rVar;
                this.f18820q = byteArrayInputStream;
                this.f18821r = hVar;
            }

            @Override // dn.a
            /* renamed from: a, reason: merged with bridge method [inline-methods] */
            public final p invoke() {
                return (p) this.f18819p.c(this.f18820q, this.f18821r.p().c().k());
            }
        }

        /* loaded from: classes3.dex */
        static final class b extends v implements dn.a {

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

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            b(h hVar) {
                super(0);
                this.f18823q = hVar;
            }

            @Override // dn.a
            /* renamed from: a, reason: merged with bridge method [inline-methods] */
            public final Set invoke() {
                Set k10;
                k10 = y0.k(c.this.f18810a.keySet(), this.f18823q.t());
                return k10;
            }
        }

        /* renamed from: fp.h$c$c, reason: collision with other inner class name */
        /* loaded from: classes3.dex */
        static final class C0414c extends v implements dn.l {
            C0414c() {
                super(1);
            }

            @Override // dn.l
            /* renamed from: a, reason: merged with bridge method [inline-methods] */
            public final Collection invoke(ro.f it) {
                t.g(it, "it");
                return c.this.m(it);
            }
        }

        /* loaded from: classes3.dex */
        static final class d extends v implements dn.l {
            d() {
                super(1);
            }

            @Override // dn.l
            /* renamed from: a, reason: merged with bridge method [inline-methods] */
            public final Collection invoke(ro.f it) {
                t.g(it, "it");
                return c.this.n(it);
            }
        }

        /* loaded from: classes3.dex */
        static final class e extends v implements dn.l {
            e() {
                super(1);
            }

            @Override // dn.l
            /* renamed from: a, reason: merged with bridge method [inline-methods] */
            public final d1 invoke(ro.f it) {
                t.g(it, "it");
                return c.this.o(it);
            }
        }

        /* loaded from: classes3.dex */
        static final class f extends v implements dn.a {

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

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            f(h hVar) {
                super(0);
                this.f18828q = hVar;
            }

            @Override // dn.a
            /* renamed from: a, reason: merged with bridge method [inline-methods] */
            public final Set invoke() {
                Set k10;
                k10 = y0.k(c.this.f18811b.keySet(), this.f18828q.u());
                return k10;
            }
        }

        public c(h hVar, List functionList, List propertyList, List typeAliasList) {
            Map i10;
            t.g(functionList, "functionList");
            t.g(propertyList, "propertyList");
            t.g(typeAliasList, "typeAliasList");
            this.f18818i = hVar;
            LinkedHashMap linkedHashMap = new LinkedHashMap();
            for (Object obj : functionList) {
                ro.f b10 = y.b(hVar.p().g(), ((mo.i) ((p) obj)).Y());
                Object obj2 = linkedHashMap.get(b10);
                if (obj2 == null) {
                    obj2 = new ArrayList();
                    linkedHashMap.put(b10, obj2);
                }
                ((List) obj2).add(obj);
            }
            this.f18810a = p(linkedHashMap);
            h hVar2 = this.f18818i;
            LinkedHashMap linkedHashMap2 = new LinkedHashMap();
            for (Object obj3 : propertyList) {
                ro.f b11 = y.b(hVar2.p().g(), ((mo.n) ((p) obj3)).X());
                Object obj4 = linkedHashMap2.get(b11);
                if (obj4 == null) {
                    obj4 = new ArrayList();
                    linkedHashMap2.put(b11, obj4);
                }
                ((List) obj4).add(obj3);
            }
            this.f18811b = p(linkedHashMap2);
            if (this.f18818i.p().c().g().g()) {
                h hVar3 = this.f18818i;
                LinkedHashMap linkedHashMap3 = new LinkedHashMap();
                for (Object obj5 : typeAliasList) {
                    ro.f b12 = y.b(hVar3.p().g(), ((r) ((p) obj5)).R());
                    Object obj6 = linkedHashMap3.get(b12);
                    if (obj6 == null) {
                        obj6 = new ArrayList();
                        linkedHashMap3.put(b12, obj6);
                    }
                    ((List) obj6).add(obj5);
                }
                i10 = p(linkedHashMap3);
            } else {
                i10 = q0.i();
            }
            this.f18812c = i10;
            this.f18813d = this.f18818i.p().h().g(new C0414c());
            this.f18814e = this.f18818i.p().h().g(new d());
            this.f18815f = this.f18818i.p().h().h(new e());
            this.f18816g = this.f18818i.p().h().b(new b(this.f18818i));
            this.f18817h = this.f18818i.p().h().b(new f(this.f18818i));
        }

        /* JADX INFO: Access modifiers changed from: private */
        /* JADX WARN: Removed duplicated region for block: B:9:0x0048  */
        /*
            Code decompiled incorrectly, please refer to instructions dump.
        */
        public final Collection m(ro.f fVar) {
            List k10;
            List<mo.i> list;
            rp.h h10;
            List E;
            Map map = this.f18810a;
            kotlin.reflect.jvm.internal.impl.protobuf.r PARSER = mo.i.L;
            t.f(PARSER, "PARSER");
            h hVar = this.f18818i;
            byte[] bArr = (byte[]) map.get(fVar);
            if (bArr != null) {
                h10 = rp.n.h(new a(PARSER, new ByteArrayInputStream(bArr), this.f18818i));
                E = rp.p.E(h10);
                if (E != null) {
                    list = E;
                    ArrayList arrayList = new ArrayList(list.size());
                    for (mo.i iVar : list) {
                        x f10 = hVar.p().f();
                        t.d(iVar);
                        tn.y0 j10 = f10.j(iVar);
                        if (!hVar.x(j10)) {
                            j10 = null;
                        }
                        if (j10 != null) {
                            arrayList.add(j10);
                        }
                    }
                    hVar.k(fVar, arrayList);
                    return pp.a.c(arrayList);
                }
            }
            k10 = u.k();
            list = k10;
            ArrayList arrayList2 = new ArrayList(list.size());
            while (r4.hasNext()) {
            }
            hVar.k(fVar, arrayList2);
            return pp.a.c(arrayList2);
        }

        /* JADX INFO: Access modifiers changed from: private */
        /* JADX WARN: Removed duplicated region for block: B:9:0x0048  */
        /*
            Code decompiled incorrectly, please refer to instructions dump.
        */
        public final Collection n(ro.f fVar) {
            List k10;
            List<mo.n> list;
            rp.h h10;
            List E;
            Map map = this.f18811b;
            kotlin.reflect.jvm.internal.impl.protobuf.r PARSER = mo.n.L;
            t.f(PARSER, "PARSER");
            h hVar = this.f18818i;
            byte[] bArr = (byte[]) map.get(fVar);
            if (bArr != null) {
                h10 = rp.n.h(new a(PARSER, new ByteArrayInputStream(bArr), this.f18818i));
                E = rp.p.E(h10);
                if (E != null) {
                    list = E;
                    ArrayList arrayList = new ArrayList(list.size());
                    for (mo.n nVar : list) {
                        x f10 = hVar.p().f();
                        t.d(nVar);
                        t0 l10 = f10.l(nVar);
                        if (l10 != null) {
                            arrayList.add(l10);
                        }
                    }
                    hVar.l(fVar, arrayList);
                    return pp.a.c(arrayList);
                }
            }
            k10 = u.k();
            list = k10;
            ArrayList arrayList2 = new ArrayList(list.size());
            while (r4.hasNext()) {
            }
            hVar.l(fVar, arrayList2);
            return pp.a.c(arrayList2);
        }

        /* JADX INFO: Access modifiers changed from: private */
        public final d1 o(ro.f fVar) {
            r i02;
            byte[] bArr = (byte[]) this.f18812c.get(fVar);
            if (bArr == null || (i02 = r.i0(new ByteArrayInputStream(bArr), this.f18818i.p().c().k())) == null) {
                return null;
            }
            return this.f18818i.p().f().m(i02);
        }

        private final Map p(Map map) {
            int d10;
            int v10;
            d10 = sm.p0.d(map.size());
            LinkedHashMap linkedHashMap = new LinkedHashMap(d10);
            for (Map.Entry entry : map.entrySet()) {
                Object key = entry.getKey();
                ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
                Iterable iterable = (Iterable) entry.getValue();
                v10 = sm.v.v(iterable, 10);
                ArrayList arrayList = new ArrayList(v10);
                Iterator it = iterable.iterator();
                while (it.hasNext()) {
                    ((kotlin.reflect.jvm.internal.impl.protobuf.a) it.next()).c(byteArrayOutputStream);
                    arrayList.add(n0.f34904a);
                }
                linkedHashMap.put(key, byteArrayOutputStream.toByteArray());
            }
            return linkedHashMap;
        }

        @Override // fp.h.a
        public Set a() {
            return (Set) gp.m.a(this.f18816g, this, f18809j[0]);
        }

        @Override // fp.h.a
        public Collection b(ro.f name, ao.b location) {
            List k10;
            t.g(name, "name");
            t.g(location, "location");
            if (a().contains(name)) {
                return (Collection) this.f18813d.invoke(name);
            }
            k10 = u.k();
            return k10;
        }

        @Override // fp.h.a
        public Collection c(ro.f name, ao.b location) {
            List k10;
            t.g(name, "name");
            t.g(location, "location");
            if (d().contains(name)) {
                return (Collection) this.f18814e.invoke(name);
            }
            k10 = u.k();
            return k10;
        }

        @Override // fp.h.a
        public Set d() {
            return (Set) gp.m.a(this.f18817h, this, f18809j[1]);
        }

        @Override // fp.h.a
        public d1 e(ro.f name) {
            t.g(name, "name");
            return (d1) this.f18815f.invoke(name);
        }

        @Override // fp.h.a
        public void f(Collection result, ap.d kindFilter, dn.l nameFilter, ao.b location) {
            t.g(result, "result");
            t.g(kindFilter, "kindFilter");
            t.g(nameFilter, "nameFilter");
            t.g(location, "location");
            if (kindFilter.a(ap.d.f6107c.i())) {
                Set<ro.f> d10 = d();
                ArrayList arrayList = new ArrayList();
                for (ro.f fVar : d10) {
                    if (((Boolean) nameFilter.invoke(fVar)).booleanValue()) {
                        arrayList.addAll(c(fVar, location));
                    }
                }
                to.i INSTANCE = to.i.f36455p;
                t.f(INSTANCE, "INSTANCE");
                sm.y.z(arrayList, INSTANCE);
                result.addAll(arrayList);
            }
            if (kindFilter.a(ap.d.f6107c.d())) {
                Set<ro.f> a10 = a();
                ArrayList arrayList2 = new ArrayList();
                for (ro.f fVar2 : a10) {
                    if (((Boolean) nameFilter.invoke(fVar2)).booleanValue()) {
                        arrayList2.addAll(b(fVar2, location));
                    }
                }
                to.i INSTANCE2 = to.i.f36455p;
                t.f(INSTANCE2, "INSTANCE");
                sm.y.z(arrayList2, INSTANCE2);
                result.addAll(arrayList2);
            }
        }

        @Override // fp.h.a
        public Set g() {
            return this.f18812c.keySet();
        }
    }

    /* loaded from: classes3.dex */
    static final class d extends v implements dn.a {

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

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

        @Override // dn.a
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final Set invoke() {
            Set X0;
            X0 = c0.X0((Iterable) this.f18829p.invoke());
            return X0;
        }
    }

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

        @Override // dn.a
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final Set invoke() {
            Set k10;
            Set k11;
            Set s10 = h.this.s();
            if (s10 == null) {
                return null;
            }
            k10 = y0.k(h.this.q(), h.this.f18779c.g());
            k11 = y0.k(k10, s10);
            return k11;
        }
    }

    /* JADX INFO: Access modifiers changed from: protected */
    public h(dp.m c10, List functionList, List propertyList, List typeAliasList, dn.a classNames) {
        t.g(c10, "c");
        t.g(functionList, "functionList");
        t.g(propertyList, "propertyList");
        t.g(typeAliasList, "typeAliasList");
        t.g(classNames, "classNames");
        this.f18778b = c10;
        this.f18779c = n(functionList, propertyList, typeAliasList);
        this.f18780d = c10.h().b(new d(classNames));
        this.f18781e = c10.h().d(new e());
    }

    private final a n(List list, List list2, List list3) {
        return this.f18778b.c().g().a() ? new b(this, list, list2, list3) : new c(this, list, list2, list3);
    }

    private final tn.e o(ro.f fVar) {
        return this.f18778b.c().b(m(fVar));
    }

    private final Set r() {
        return (Set) gp.m.b(this.f18781e, this, f18777f[1]);
    }

    private final d1 v(ro.f fVar) {
        return this.f18779c.e(fVar);
    }

    @Override // ap.i, ap.h
    public Set a() {
        return this.f18779c.a();
    }

    @Override // ap.i, ap.h
    public Collection b(ro.f name, ao.b location) {
        t.g(name, "name");
        t.g(location, "location");
        return this.f18779c.b(name, location);
    }

    @Override // ap.i, ap.h
    public Collection c(ro.f name, ao.b location) {
        t.g(name, "name");
        t.g(location, "location");
        return this.f18779c.c(name, location);
    }

    @Override // ap.i, ap.h
    public Set d() {
        return this.f18779c.d();
    }

    @Override // ap.i, ap.k
    public tn.h e(ro.f name, ao.b location) {
        t.g(name, "name");
        t.g(location, "location");
        if (w(name)) {
            return o(name);
        }
        if (this.f18779c.g().contains(name)) {
            return v(name);
        }
        return null;
    }

    @Override // ap.i, ap.h
    public Set g() {
        return r();
    }

    protected abstract void i(Collection collection, dn.l lVar);

    /* JADX INFO: Access modifiers changed from: protected */
    public final Collection j(ap.d kindFilter, dn.l nameFilter, ao.b location) {
        t.g(kindFilter, "kindFilter");
        t.g(nameFilter, "nameFilter");
        t.g(location, "location");
        ArrayList arrayList = new ArrayList(0);
        d.a aVar = ap.d.f6107c;
        if (kindFilter.a(aVar.g())) {
            i(arrayList, nameFilter);
        }
        this.f18779c.f(arrayList, kindFilter, nameFilter, location);
        if (kindFilter.a(aVar.c())) {
            for (ro.f fVar : q()) {
                if (((Boolean) nameFilter.invoke(fVar)).booleanValue()) {
                    pp.a.a(arrayList, o(fVar));
                }
            }
        }
        if (kindFilter.a(ap.d.f6107c.h())) {
            for (ro.f fVar2 : this.f18779c.g()) {
                if (((Boolean) nameFilter.invoke(fVar2)).booleanValue()) {
                    pp.a.a(arrayList, this.f18779c.e(fVar2));
                }
            }
        }
        return pp.a.c(arrayList);
    }

    protected void k(ro.f name, List functions) {
        t.g(name, "name");
        t.g(functions, "functions");
    }

    protected void l(ro.f name, List descriptors) {
        t.g(name, "name");
        t.g(descriptors, "descriptors");
    }

    protected abstract ro.b m(ro.f fVar);

    /* JADX INFO: Access modifiers changed from: protected */
    public final dp.m p() {
        return this.f18778b;
    }

    public final Set q() {
        return (Set) gp.m.a(this.f18780d, this, f18777f[0]);
    }

    protected abstract Set s();

    protected abstract Set t();

    protected abstract Set u();

    /* JADX INFO: Access modifiers changed from: protected */
    public boolean w(ro.f name) {
        t.g(name, "name");
        return q().contains(name);
    }

    protected boolean x(tn.y0 function) {
        t.g(function, "function");
        return true;
    }
}
