package kotlin.jvm.internal;

import java.util.List;
import java.util.Map;

/* JADX INFO: loaded from: classes.dex */
public abstract class z {
    public static List a(Object obj) {
        if (obj instanceof z1.a) {
            i(obj, "kotlin.collections.MutableList");
        }
        return c(obj);
    }

    public static Object b(Object obj, int i2) {
        if (obj != null && !e(obj, i2)) {
            i(obj, "kotlin.jvm.functions.Function" + i2);
        }
        return obj;
    }

    public static List c(Object obj) {
        try {
            return (List) obj;
        } catch (ClassCastException e2) {
            throw h(e2);
        }
    }

    public static int d(Object obj) {
        if (obj instanceof h) {
            return ((h) obj).getArity();
        }
        if (obj instanceof y1.a) {
            return 0;
        }
        if (obj instanceof y1.l) {
            return 1;
        }
        if (obj instanceof y1.p) {
            return 2;
        }
        if (obj instanceof y1.q) {
            return 3;
        }
        return obj instanceof y1.r ? 4 : -1;
    }

    public static boolean e(Object obj, int i2) {
        return (obj instanceof n1.c) && d(obj) == i2;
    }

    public static boolean f(Object obj) {
        return (obj instanceof Map) && !(obj instanceof z1.a);
    }

    private static Throwable g(Throwable th) {
        return l.k(th, z.class.getName());
    }

    public static ClassCastException h(ClassCastException classCastException) {
        throw ((ClassCastException) g(classCastException));
    }

    public static void i(Object obj, String str) {
        j((obj == null ? "null" : obj.getClass().getName()) + " cannot be cast to " + str);
    }

    public static void j(String str) {
        throw h(new ClassCastException(str));
    }
}
