package k4;

import java.nio.charset.Charset;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.Map;

/* JADX INFO: renamed from: k4.x, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes3.dex */
public final class C2410x {

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public static final E3.h f19978c = new E3.h(String.valueOf(','));

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public static final C2410x f19979d = new C2410x(C2401n.f19897b, false, new C2410x(new C2401n(2), true, new C2410x()));

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final Map f19980a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final byte[] f19981b;

    public C2410x(InterfaceC2402o interfaceC2402o, boolean z6, C2410x c2410x) {
        String strE = interfaceC2402o.e();
        A4.g.l(!strE.contains(","), "Comma is currently not allowed in message encoding");
        int size = c2410x.f19980a.size();
        LinkedHashMap linkedHashMap = new LinkedHashMap(c2410x.f19980a.containsKey(interfaceC2402o.e()) ? size : size + 1);
        for (C2409w c2409w : c2410x.f19980a.values()) {
            String strE2 = c2409w.f19973a.e();
            if (!strE2.equals(strE)) {
                linkedHashMap.put(strE2, new C2409w(c2409w.f19973a, c2409w.f19974b));
            }
        }
        linkedHashMap.put(strE, new C2409w(interfaceC2402o, z6));
        Map mapUnmodifiableMap = Collections.unmodifiableMap(linkedHashMap);
        this.f19980a = mapUnmodifiableMap;
        HashSet hashSet = new HashSet(mapUnmodifiableMap.size());
        for (Map.Entry entry : mapUnmodifiableMap.entrySet()) {
            if (((C2409w) entry.getValue()).f19974b) {
                hashSet.add((String) entry.getKey());
            }
        }
        this.f19981b = f19978c.b(Collections.unmodifiableSet(hashSet)).getBytes(Charset.forName("US-ASCII"));
    }

    public C2410x() {
        this.f19980a = new LinkedHashMap(0);
        this.f19981b = new byte[0];
    }
}
