package tn;

import com.google.firebase.messaging.Constants;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.ServiceLoader;
import java.util.Set;
import mp.l;
import tn.l1;

/* loaded from: classes3.dex */
public abstract class t {

    /* renamed from: a, reason: collision with root package name */
    public static final u f36410a;

    /* renamed from: b, reason: collision with root package name */
    public static final u f36411b;

    /* renamed from: c, reason: collision with root package name */
    public static final u f36412c;

    /* renamed from: d, reason: collision with root package name */
    public static final u f36413d;

    /* renamed from: e, reason: collision with root package name */
    public static final u f36414e;

    /* renamed from: f, reason: collision with root package name */
    public static final u f36415f;

    /* renamed from: g, reason: collision with root package name */
    public static final u f36416g;

    /* renamed from: h, reason: collision with root package name */
    public static final u f36417h;

    /* renamed from: i, reason: collision with root package name */
    public static final u f36418i;

    /* renamed from: j, reason: collision with root package name */
    public static final Set f36419j;

    /* renamed from: k, reason: collision with root package name */
    private static final Map f36420k;

    /* renamed from: l, reason: collision with root package name */
    public static final u f36421l;

    /* renamed from: m, reason: collision with root package name */
    private static final bp.g f36422m;

    /* renamed from: n, reason: collision with root package name */
    public static final bp.g f36423n;

    /* renamed from: o, reason: collision with root package name */
    public static final bp.g f36424o;

    /* renamed from: p, reason: collision with root package name */
    private static final mp.l f36425p;

    /* renamed from: q, reason: collision with root package name */
    private static final Map f36426q;

    /* loaded from: classes3.dex */
    static class a implements bp.g {
        a() {
        }

        @Override // bp.g
        public hp.e0 getType() {
            throw new IllegalStateException("This method should not be called");
        }
    }

    /* loaded from: classes3.dex */
    static class b implements bp.g {
        b() {
        }

        @Override // bp.g
        public hp.e0 getType() {
            throw new IllegalStateException("This method should not be called");
        }
    }

    /* loaded from: classes3.dex */
    static class c implements bp.g {
        c() {
        }

        @Override // bp.g
        public hp.e0 getType() {
            throw new IllegalStateException("This method should not be called");
        }
    }

    /* loaded from: classes3.dex */
    static class d extends r {
        d(m1 m1Var) {
            super(m1Var);
        }

        private static /* synthetic */ void g(int i10) {
            Object[] objArr = new Object[3];
            if (i10 == 1) {
                objArr[0] = "what";
            } else if (i10 != 2) {
                objArr[0] = "descriptor";
            } else {
                objArr[0] = Constants.MessagePayloadKeys.FROM;
            }
            objArr[1] = "kotlin/reflect/jvm/internal/impl/descriptors/DescriptorVisibilities$1";
            if (i10 == 1 || i10 == 2) {
                objArr[2] = "isVisible";
            } else {
                objArr[2] = "hasContainingSourceFile";
            }
            throw new IllegalArgumentException(String.format("Argument for @NotNull parameter '%s' of %s.%s must not be null", objArr));
        }

        private boolean h(m mVar) {
            if (mVar == null) {
                g(0);
            }
            return to.f.j(mVar) != a1.f36365a;
        }

        /* JADX WARN: Multi-variable type inference failed */
        /* JADX WARN: Type inference failed for: r3v0, types: [tn.q, tn.m] */
        /* JADX WARN: Type inference failed for: r3v1, types: [tn.m] */
        /* JADX WARN: Type inference failed for: r3v2, types: [tn.m] */
        /* JADX WARN: Type inference failed for: r3v4, types: [tn.m] */
        @Override // tn.u
        public boolean e(bp.g gVar, q qVar, m mVar, boolean z10) {
            if (qVar == 0) {
                g(1);
            }
            if (mVar == null) {
                g(2);
            }
            if (to.f.J(qVar) && h(mVar)) {
                return t.f(qVar, mVar);
            }
            if (qVar instanceof tn.l) {
                tn.i b10 = ((tn.l) qVar).b();
                if (z10 && to.f.G(b10) && to.f.J(b10) && (mVar instanceof tn.l) && to.f.J(mVar.b()) && t.f(qVar, mVar)) {
                    return true;
                }
            }
            while (qVar != 0) {
                qVar = qVar.b();
                if (((qVar instanceof tn.e) && !to.f.x(qVar)) || (qVar instanceof k0)) {
                    break;
                }
            }
            if (qVar == 0) {
                return false;
            }
            while (mVar != null) {
                if (qVar == mVar) {
                    return true;
                }
                if (mVar instanceof k0) {
                    return (qVar instanceof k0) && qVar.d().equals(((k0) mVar).d()) && to.f.b(mVar, qVar);
                }
                mVar = mVar.b();
            }
            return false;
        }
    }

    /* loaded from: classes3.dex */
    static class e extends r {
        e(m1 m1Var) {
            super(m1Var);
        }

        private static /* synthetic */ void g(int i10) {
            Object[] objArr = new Object[3];
            if (i10 != 1) {
                objArr[0] = "what";
            } else {
                objArr[0] = Constants.MessagePayloadKeys.FROM;
            }
            objArr[1] = "kotlin/reflect/jvm/internal/impl/descriptors/DescriptorVisibilities$2";
            objArr[2] = "isVisible";
            throw new IllegalArgumentException(String.format("Argument for @NotNull parameter '%s' of %s.%s must not be null", objArr));
        }

        @Override // tn.u
        public boolean e(bp.g gVar, q qVar, m mVar, boolean z10) {
            m q10;
            if (qVar == null) {
                g(0);
            }
            if (mVar == null) {
                g(1);
            }
            if (!t.f36410a.e(gVar, qVar, mVar, z10)) {
                return false;
            }
            if (gVar == t.f36423n) {
                return true;
            }
            if (gVar == t.f36422m || (q10 = to.f.q(qVar, tn.e.class)) == null || !(gVar instanceof bp.h)) {
                return false;
            }
            return ((bp.h) gVar).p().a().equals(q10.a());
        }
    }

    /* loaded from: classes3.dex */
    static class f extends r {
        f(m1 m1Var) {
            super(m1Var);
        }

        private static /* synthetic */ void g(int i10) {
            Object[] objArr = new Object[3];
            if (i10 == 1) {
                objArr[0] = Constants.MessagePayloadKeys.FROM;
            } else if (i10 == 2) {
                objArr[0] = "whatDeclaration";
            } else if (i10 != 3) {
                objArr[0] = "what";
            } else {
                objArr[0] = "fromClass";
            }
            objArr[1] = "kotlin/reflect/jvm/internal/impl/descriptors/DescriptorVisibilities$3";
            if (i10 == 2 || i10 == 3) {
                objArr[2] = "doesReceiverFitForProtectedVisibility";
            } else {
                objArr[2] = "isVisible";
            }
            throw new IllegalArgumentException(String.format("Argument for @NotNull parameter '%s' of %s.%s must not be null", objArr));
        }

        private boolean h(bp.g gVar, q qVar, tn.e eVar) {
            if (qVar == null) {
                g(2);
            }
            if (eVar == null) {
                g(3);
            }
            if (gVar == t.f36424o) {
                return false;
            }
            if (!(qVar instanceof tn.b) || (qVar instanceof tn.l) || gVar == t.f36423n) {
                return true;
            }
            if (gVar == t.f36422m || gVar == null) {
                return false;
            }
            hp.e0 type = gVar.getType();
            return to.f.I(type, eVar) || hp.u.a(type);
        }

        @Override // tn.u
        public boolean e(bp.g gVar, q qVar, m mVar, boolean z10) {
            tn.e eVar;
            if (qVar == null) {
                g(0);
            }
            if (mVar == null) {
                g(1);
            }
            tn.e eVar2 = (tn.e) to.f.q(qVar, tn.e.class);
            tn.e eVar3 = (tn.e) to.f.r(mVar, tn.e.class, false);
            if (eVar3 == null) {
                return false;
            }
            if (eVar2 != null && to.f.x(eVar2) && (eVar = (tn.e) to.f.q(eVar2, tn.e.class)) != null && to.f.H(eVar3, eVar)) {
                return true;
            }
            q M = to.f.M(qVar);
            tn.e eVar4 = (tn.e) to.f.q(M, tn.e.class);
            if (eVar4 == null) {
                return false;
            }
            if (to.f.H(eVar3, eVar4) && h(gVar, M, eVar3)) {
                return true;
            }
            return e(gVar, qVar, eVar3.b(), z10);
        }
    }

    /* loaded from: classes3.dex */
    static class g extends r {
        g(m1 m1Var) {
            super(m1Var);
        }

        private static /* synthetic */ void g(int i10) {
            Object[] objArr = new Object[3];
            if (i10 != 1) {
                objArr[0] = "what";
            } else {
                objArr[0] = Constants.MessagePayloadKeys.FROM;
            }
            objArr[1] = "kotlin/reflect/jvm/internal/impl/descriptors/DescriptorVisibilities$4";
            objArr[2] = "isVisible";
            throw new IllegalArgumentException(String.format("Argument for @NotNull parameter '%s' of %s.%s must not be null", objArr));
        }

        @Override // tn.u
        public boolean e(bp.g gVar, q qVar, m mVar, boolean z10) {
            if (qVar == null) {
                g(0);
            }
            if (mVar == null) {
                g(1);
            }
            if (to.f.g(mVar).a0(to.f.g(qVar))) {
                return t.f36425p.a(qVar, mVar);
            }
            return false;
        }
    }

    /* loaded from: classes3.dex */
    static class h extends r {
        h(m1 m1Var) {
            super(m1Var);
        }

        private static /* synthetic */ void g(int i10) {
            Object[] objArr = new Object[3];
            if (i10 != 1) {
                objArr[0] = "what";
            } else {
                objArr[0] = Constants.MessagePayloadKeys.FROM;
            }
            objArr[1] = "kotlin/reflect/jvm/internal/impl/descriptors/DescriptorVisibilities$5";
            objArr[2] = "isVisible";
            throw new IllegalArgumentException(String.format("Argument for @NotNull parameter '%s' of %s.%s must not be null", objArr));
        }

        @Override // tn.u
        public boolean e(bp.g gVar, q qVar, m mVar, boolean z10) {
            if (qVar == null) {
                g(0);
            }
            if (mVar == null) {
                g(1);
            }
            return true;
        }
    }

    /* loaded from: classes3.dex */
    static class i extends r {
        i(m1 m1Var) {
            super(m1Var);
        }

        private static /* synthetic */ void g(int i10) {
            Object[] objArr = new Object[3];
            if (i10 != 1) {
                objArr[0] = "what";
            } else {
                objArr[0] = Constants.MessagePayloadKeys.FROM;
            }
            objArr[1] = "kotlin/reflect/jvm/internal/impl/descriptors/DescriptorVisibilities$6";
            objArr[2] = "isVisible";
            throw new IllegalArgumentException(String.format("Argument for @NotNull parameter '%s' of %s.%s must not be null", objArr));
        }

        @Override // tn.u
        public boolean e(bp.g gVar, q qVar, m mVar, boolean z10) {
            if (qVar == null) {
                g(0);
            }
            if (mVar == null) {
                g(1);
            }
            throw new IllegalStateException("This method shouldn't be invoked for LOCAL visibility");
        }
    }

    /* loaded from: classes3.dex */
    static class j extends r {
        j(m1 m1Var) {
            super(m1Var);
        }

        private static /* synthetic */ void g(int i10) {
            Object[] objArr = new Object[3];
            if (i10 != 1) {
                objArr[0] = "what";
            } else {
                objArr[0] = Constants.MessagePayloadKeys.FROM;
            }
            objArr[1] = "kotlin/reflect/jvm/internal/impl/descriptors/DescriptorVisibilities$7";
            objArr[2] = "isVisible";
            throw new IllegalArgumentException(String.format("Argument for @NotNull parameter '%s' of %s.%s must not be null", objArr));
        }

        @Override // tn.u
        public boolean e(bp.g gVar, q qVar, m mVar, boolean z10) {
            if (qVar == null) {
                g(0);
            }
            if (mVar == null) {
                g(1);
            }
            throw new IllegalStateException("Visibility is unknown yet");
        }
    }

    /* loaded from: classes3.dex */
    static class k extends r {
        k(m1 m1Var) {
            super(m1Var);
        }

        private static /* synthetic */ void g(int i10) {
            Object[] objArr = new Object[3];
            if (i10 != 1) {
                objArr[0] = "what";
            } else {
                objArr[0] = Constants.MessagePayloadKeys.FROM;
            }
            objArr[1] = "kotlin/reflect/jvm/internal/impl/descriptors/DescriptorVisibilities$8";
            objArr[2] = "isVisible";
            throw new IllegalArgumentException(String.format("Argument for @NotNull parameter '%s' of %s.%s must not be null", objArr));
        }

        @Override // tn.u
        public boolean e(bp.g gVar, q qVar, m mVar, boolean z10) {
            if (qVar == null) {
                g(0);
            }
            if (mVar == null) {
                g(1);
            }
            return false;
        }
    }

    /* loaded from: classes3.dex */
    static class l extends r {
        l(m1 m1Var) {
            super(m1Var);
        }

        private static /* synthetic */ void g(int i10) {
            Object[] objArr = new Object[3];
            if (i10 != 1) {
                objArr[0] = "what";
            } else {
                objArr[0] = Constants.MessagePayloadKeys.FROM;
            }
            objArr[1] = "kotlin/reflect/jvm/internal/impl/descriptors/DescriptorVisibilities$9";
            objArr[2] = "isVisible";
            throw new IllegalArgumentException(String.format("Argument for @NotNull parameter '%s' of %s.%s must not be null", objArr));
        }

        @Override // tn.u
        public boolean e(bp.g gVar, q qVar, m mVar, boolean z10) {
            if (qVar == null) {
                g(0);
            }
            if (mVar == null) {
                g(1);
            }
            return false;
        }
    }

    static {
        Set h10;
        d dVar = new d(l1.e.f36396c);
        f36410a = dVar;
        e eVar = new e(l1.f.f36397c);
        f36411b = eVar;
        f fVar = new f(l1.g.f36398c);
        f36412c = fVar;
        g gVar = new g(l1.b.f36393c);
        f36413d = gVar;
        h hVar = new h(l1.h.f36399c);
        f36414e = hVar;
        i iVar = new i(l1.d.f36395c);
        f36415f = iVar;
        j jVar = new j(l1.a.f36392c);
        f36416g = jVar;
        k kVar = new k(l1.c.f36394c);
        f36417h = kVar;
        l lVar = new l(l1.i.f36400c);
        f36418i = lVar;
        h10 = sm.x0.h(dVar, eVar, gVar, iVar);
        f36419j = Collections.unmodifiableSet(h10);
        HashMap e10 = pp.a.e(4);
        e10.put(eVar, 0);
        e10.put(dVar, 0);
        e10.put(gVar, 1);
        e10.put(fVar, 1);
        e10.put(hVar, 2);
        f36420k = Collections.unmodifiableMap(e10);
        f36421l = hVar;
        f36422m = new a();
        f36423n = new b();
        f36424o = new c();
        Iterator it = ServiceLoader.load(mp.l.class, mp.l.class.getClassLoader()).iterator();
        f36425p = it.hasNext() ? (mp.l) it.next() : l.a.f29594a;
        f36426q = new HashMap();
        i(dVar);
        i(eVar);
        i(fVar);
        i(gVar);
        i(hVar);
        i(iVar);
        i(jVar);
        i(kVar);
        i(lVar);
    }

    /* JADX WARN: Removed duplicated region for block: B:18:0x0042  */
    /* JADX WARN: Removed duplicated region for block: B:20:0x004a  */
    /* JADX WARN: Removed duplicated region for block: B:21:0x004f  */
    /* JADX WARN: Removed duplicated region for block: B:22:0x0052  */
    /* JADX WARN: Removed duplicated region for block: B:23:0x0057  */
    /* JADX WARN: Removed duplicated region for block: B:24:0x005c  */
    /* JADX WARN: Removed duplicated region for block: B:25:0x0061  */
    /* JADX WARN: Removed duplicated region for block: B:26:0x0066  */
    /* JADX WARN: Removed duplicated region for block: B:27:0x006b  */
    /* JADX WARN: Removed duplicated region for block: B:28:0x0070  */
    /* JADX WARN: Removed duplicated region for block: B:31:0x007a  */
    /* JADX WARN: Removed duplicated region for block: B:34:0x0080  */
    /* JADX WARN: Removed duplicated region for block: B:36:0x0045  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    private static /* synthetic */ void a(int i10) {
        String str = i10 != 16 ? "Argument for @NotNull parameter '%s' of %s.%s must not be null" : "@NotNull method %s.%s must not return null";
        Object[] objArr = new Object[i10 != 16 ? 3 : 2];
        if (i10 != 1 && i10 != 3 && i10 != 5 && i10 != 7) {
            switch (i10) {
                case 9:
                    break;
                case 10:
                case 12:
                    objArr[0] = "first";
                    break;
                case 11:
                case 13:
                    objArr[0] = "second";
                    break;
                case 14:
                case 15:
                    objArr[0] = "visibility";
                    break;
                case 16:
                    objArr[0] = "kotlin/reflect/jvm/internal/impl/descriptors/DescriptorVisibilities";
                    break;
                default:
                    objArr[0] = "what";
                    break;
            }
            if (i10 == 16) {
                objArr[1] = "kotlin/reflect/jvm/internal/impl/descriptors/DescriptorVisibilities";
            } else {
                objArr[1] = "toDescriptorVisibility";
            }
            switch (i10) {
                case 2:
                case 3:
                    objArr[2] = "isVisibleIgnoringReceiver";
                    break;
                case 4:
                case 5:
                    objArr[2] = "isVisibleWithAnyReceiver";
                    break;
                case 6:
                case 7:
                    objArr[2] = "inSameFile";
                    break;
                case 8:
                case 9:
                    objArr[2] = "findInvisibleMember";
                    break;
                case 10:
                case 11:
                    objArr[2] = "compareLocal";
                    break;
                case 12:
                case 13:
                    objArr[2] = "compare";
                    break;
                case 14:
                    objArr[2] = "isPrivate";
                    break;
                case 15:
                    objArr[2] = "toDescriptorVisibility";
                    break;
                case 16:
                    break;
                default:
                    objArr[2] = "isVisible";
                    break;
            }
            String format = String.format(str, objArr);
            if (i10 != 16) {
                throw new IllegalStateException(format);
            }
            throw new IllegalArgumentException(format);
        }
        objArr[0] = Constants.MessagePayloadKeys.FROM;
        if (i10 == 16) {
        }
        switch (i10) {
        }
        String format2 = String.format(str, objArr);
        if (i10 != 16) {
        }
    }

    public static Integer d(u uVar, u uVar2) {
        if (uVar == null) {
            a(12);
        }
        if (uVar2 == null) {
            a(13);
        }
        Integer a10 = uVar.a(uVar2);
        if (a10 != null) {
            return a10;
        }
        Integer a11 = uVar2.a(uVar);
        if (a11 != null) {
            return Integer.valueOf(-a11.intValue());
        }
        return null;
    }

    public static q e(bp.g gVar, q qVar, m mVar, boolean z10) {
        q e10;
        if (qVar == null) {
            a(8);
        }
        if (mVar == null) {
            a(9);
        }
        for (q qVar2 = (q) qVar.a(); qVar2 != null && qVar2.getVisibility() != f36415f; qVar2 = (q) to.f.q(qVar2, q.class)) {
            if (!qVar2.getVisibility().e(gVar, qVar2, mVar, z10)) {
                return qVar2;
            }
        }
        if (!(qVar instanceof vn.i0) || (e10 = e(gVar, ((vn.i0) qVar).j0(), mVar, z10)) == null) {
            return null;
        }
        return e10;
    }

    public static boolean f(m mVar, m mVar2) {
        if (mVar == null) {
            a(6);
        }
        if (mVar2 == null) {
            a(7);
        }
        a1 j10 = to.f.j(mVar2);
        if (j10 != a1.f36365a) {
            return j10.equals(to.f.j(mVar));
        }
        return false;
    }

    public static boolean g(u uVar) {
        if (uVar == null) {
            a(14);
        }
        return uVar == f36410a || uVar == f36411b;
    }

    public static boolean h(q qVar, m mVar, boolean z10) {
        if (qVar == null) {
            a(2);
        }
        if (mVar == null) {
            a(3);
        }
        return e(f36423n, qVar, mVar, z10) == null;
    }

    private static void i(u uVar) {
        f36426q.put(uVar.b(), uVar);
    }

    public static u j(m1 m1Var) {
        if (m1Var == null) {
            a(15);
        }
        u uVar = (u) f36426q.get(m1Var);
        if (uVar != null) {
            return uVar;
        }
        throw new IllegalArgumentException("Inapplicable visibility: " + m1Var);
    }
}
