package o;

import java.util.concurrent.ConcurrentHashMap;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.tZ, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C2530tZ {
    public static final C2530tZ c = new C2530tZ();
    public final ConcurrentHashMap b = new ConcurrentHashMap();
    public final OD a = new OD(1);

    public final I40 a(Class cls) {
        I40 i40W;
        Class cls2;
        AbstractC2418sI.a(cls, "messageType");
        ConcurrentHashMap concurrentHashMap = this.b;
        I40 i40 = (I40) concurrentHashMap.get(cls);
        if (i40 != null) {
            return i40;
        }
        OD od = this.a;
        od.getClass();
        Class cls3 = L40.a;
        if (!DD.class.isAssignableFrom(cls) && (cls2 = L40.a) != null && !cls2.isAssignableFrom(cls)) {
            throw new IllegalArgumentException("Message classes must extend GeneratedMessage or GeneratedMessageLite");
        }
        C1059e00 c1059e00A = ((C2423sN) od.m).a(cls);
        int i = c1059e00A.d;
        U u = c1059e00A.a;
        if ((i & 2) == 2) {
            if (DD.class.isAssignableFrom(cls)) {
                i40W = new C2046oP(L40.c, AbstractC2671ux.a, u);
            } else {
                Qh0 qh0 = L40.b;
                C2576tx c2576tx = AbstractC2671ux.b;
                if (c2576tx == null) {
                    throw new IllegalStateException("Protobuf runtime is not correctly loaded.");
                }
                i40W = new C2046oP(qh0, c2576tx, u);
            }
        } else if (DD.class.isAssignableFrom(cls)) {
            C2576tx c2576tx2 = null;
            C1288gS c1288gS = AbstractC1384hS.b;
            JL jl = KL.b;
            Qh0 qh02 = L40.c;
            if (AbstractC2462sn.w(c1059e00A.a()) != 1) {
                c2576tx2 = AbstractC2671ux.a;
            }
            C2576tx c2576tx3 = c2576tx2;
            CN cn = DN.b;
            if (!(c1059e00A instanceof C1059e00)) {
                int[] iArr = C1951nP.n;
                c1059e00A.getClass();
                throw new ClassCastException();
            }
            i40W = C1951nP.w(c1059e00A, c1288gS, jl, qh02, c2576tx3, cn);
        } else {
            C2576tx c2576tx4 = null;
            C1288gS c1288gS2 = AbstractC1384hS.a;
            JL jl2 = KL.a;
            Qh0 qh03 = L40.b;
            if (AbstractC2462sn.w(c1059e00A.a()) != 1 && (c2576tx4 = AbstractC2671ux.b) == null) {
                throw new IllegalStateException("Protobuf runtime is not correctly loaded.");
            }
            C2576tx c2576tx5 = c2576tx4;
            CN cn2 = DN.a;
            if (!(c1059e00A instanceof C1059e00)) {
                int[] iArr2 = C1951nP.n;
                c1059e00A.getClass();
                throw new ClassCastException();
            }
            i40W = C1951nP.w(c1059e00A, c1288gS2, jl2, qh03, c2576tx5, cn2);
        }
        I40 i402 = (I40) concurrentHashMap.putIfAbsent(cls, i40W);
        return i402 != null ? i402 : i40W;
    }
}
