package defpackage;

import androidx.media3.container.NalUnitUtil;
import defpackage.pi8;
import java.lang.annotation.Annotation;
import java.util.Iterator;
import kotlin.Metadata;

/* JADX INFO: loaded from: classes3.dex */
@Metadata(d1 = {"\u0000\u0002\n\u0000¨\u0006\u0000"}, d2 = {"kotlinx-serialization-json"}, k = 2, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
@vx8
public final class fc7 {

    @Metadata(k = 3, mv = {2, 0, 0}, xi = 176)
    public /* synthetic */ class a {
        static {
            int[] iArr = new int[k01.values().length];
            try {
                iArr[0] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                k01 k01Var = k01.a;
                iArr[2] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                k01 k01Var2 = k01.a;
                iArr[1] = 3;
            } catch (NoSuchFieldError unused3) {
            }
        }
    }

    public static final void a(yi8 yi8Var, yi8 yi8Var2, String str) {
        if (yi8Var instanceof vc8) {
            bi8 descriptor = yi8Var2.getDescriptor();
            cr4.g(descriptor, "<this>");
            if (r87.a(descriptor).contains(str)) {
                StringBuilder sbM = fi7.m("Sealed class '", yi8Var2.getDescriptor().getA(), "' cannot be serialized as base class '", ((vc8) yi8Var).getDescriptor().getA(), "' because it has property name that conflicts with JSON class discriminator '");
                sbM.append(str);
                sbM.append("'. You can either change class discriminator in JsonConfiguration, rename property with @SerialName annotation or fall back to array polymorphism");
                throw new IllegalStateException(sbM.toString().toString());
            }
        }
    }

    public static final void b(pi8 pi8Var) {
        cr4.g(pi8Var, "kind");
        if (pi8Var instanceof pi8.b) {
            throw new IllegalStateException("Enums cannot be serialized polymorphically with 'type' parameter. You can use 'JsonBuilder.useArrayPolymorphism' instead");
        }
        if (pi8Var instanceof nh7) {
            throw new IllegalStateException("Primitives cannot be serialized polymorphically with 'type' parameter. You can use 'JsonBuilder.useArrayPolymorphism' instead");
        }
        if (pi8Var instanceof ec7) {
            throw new IllegalStateException("Actual serializer for polymorphic cannot be polymorphic itself");
        }
    }

    public static final String c(dy4 dy4Var, bi8 bi8Var) {
        cr4.g(bi8Var, "<this>");
        cr4.g(dy4Var, "json");
        Iterator it = bi8Var.getD().iterator();
        while (it.hasNext()) {
            if (((Annotation) it.next()) instanceof jy4) {
                return null;
            }
        }
        return dy4Var.a.g;
    }

    public static final void d(wy4 wy4Var, String str) {
        StringBuilder sbS = vw2.s("Class with serial name ", str, " cannot be serialized polymorphically because it is represented as ");
        sbS.append(iw7.a.getOrCreateKotlinClass(wy4Var.getClass()).getSimpleName());
        sbS.append(". Make sure that its JsonTransformingSerializer returns JsonObject, so class discriminator can be added to it.");
        throw new fz4(sbS.toString());
    }
}
