package o6;

import java.lang.reflect.Array;
import java.lang.reflect.GenericArrayType;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
import java.lang.reflect.WildcardType;
import java.util.Arrays;
import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.List;
import p6.AbstractC1439e;
import p6.C1437c;

/* JADX INFO: renamed from: o6.C, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public abstract class AbstractC1380C {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public static final C1381a f15839a = new C1381a(5);

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public static final z f15840b = new z(1);

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public static final z f15841c = new z(2);

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public static final z f15842d = new z(3);

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public static final z f15843e = new z(4);

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public static final z f15844f = new z(5);

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public static final z f15845g = new z(6);

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public static final z f15846h = new z(7);
    public static final z i = new z(8);

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public static final z f15847j = new z(0);

    public static Type a(Type type) {
        if (!Collection.class.isAssignableFrom(Collection.class)) {
            throw new IllegalArgumentException();
        }
        Type typeF = AbstractC1439e.f(type, Collection.class, AbstractC1439e.c(type, Collection.class, Collection.class), new LinkedHashSet());
        if (typeF instanceof WildcardType) {
            typeF = ((WildcardType) typeF).getUpperBounds()[0];
        }
        return typeF instanceof ParameterizedType ? ((ParameterizedType) typeF).getActualTypeArguments()[0] : Object.class;
    }

    public static boolean b(Type type, Type type2) {
        if (type == type2) {
            return true;
        }
        if (type instanceof Class) {
            return type2 instanceof GenericArrayType ? b(((Class) type).getComponentType(), ((GenericArrayType) type2).getGenericComponentType()) : type.equals(type2);
        }
        if (type instanceof ParameterizedType) {
            if (!(type2 instanceof ParameterizedType)) {
                return false;
            }
            ParameterizedType parameterizedType = (ParameterizedType) type;
            ParameterizedType parameterizedType2 = (ParameterizedType) type2;
            return b(parameterizedType.getOwnerType(), parameterizedType2.getOwnerType()) && parameterizedType.getRawType().equals(parameterizedType2.getRawType()) && Arrays.equals(parameterizedType instanceof C1437c ? ((C1437c) parameterizedType).f16147c : parameterizedType.getActualTypeArguments(), parameterizedType2 instanceof C1437c ? ((C1437c) parameterizedType2).f16147c : parameterizedType2.getActualTypeArguments());
        }
        if (type instanceof GenericArrayType) {
            if (type2 instanceof Class) {
                return b(((Class) type2).getComponentType(), ((GenericArrayType) type).getGenericComponentType());
            }
            if (type2 instanceof GenericArrayType) {
                return b(((GenericArrayType) type).getGenericComponentType(), ((GenericArrayType) type2).getGenericComponentType());
            }
            return false;
        }
        if (type instanceof WildcardType) {
            if (!(type2 instanceof WildcardType)) {
                return false;
            }
            WildcardType wildcardType = (WildcardType) type;
            WildcardType wildcardType2 = (WildcardType) type2;
            return Arrays.equals(wildcardType.getUpperBounds(), wildcardType2.getUpperBounds()) && Arrays.equals(wildcardType.getLowerBounds(), wildcardType2.getLowerBounds());
        }
        if (!(type instanceof TypeVariable) || !(type2 instanceof TypeVariable)) {
            return false;
        }
        TypeVariable typeVariable = (TypeVariable) type;
        TypeVariable typeVariable2 = (TypeVariable) type2;
        return typeVariable.getGenericDeclaration() == typeVariable2.getGenericDeclaration() && typeVariable.getName().equals(typeVariable2.getName());
    }

    public static String c(int i5, int[] iArr, String[] strArr, int[] iArr2) {
        StringBuilder sb = new StringBuilder("$");
        for (int i8 = 0; i8 < i5; i8++) {
            int i9 = iArr[i8];
            if (i9 == 1 || i9 == 2) {
                sb.append('[');
                sb.append(iArr2[i8]);
                sb.append(']');
            } else if (i9 == 3 || i9 == 4 || i9 == 5) {
                sb.append('.');
                String str = strArr[i8];
                if (str != null) {
                    sb.append(str);
                }
            }
        }
        return sb.toString();
    }

    public static Class d(Type type) {
        if (type instanceof Class) {
            return (Class) type;
        }
        if (type instanceof ParameterizedType) {
            return (Class) ((ParameterizedType) type).getRawType();
        }
        if (type instanceof GenericArrayType) {
            return Array.newInstance((Class<?>) d(((GenericArrayType) type).getGenericComponentType()), 0).getClass();
        }
        if (type instanceof TypeVariable) {
            return Object.class;
        }
        if (type instanceof WildcardType) {
            return d(((WildcardType) type).getUpperBounds()[0]);
        }
        throw new IllegalArgumentException("Expected a Class, ParameterizedType, or GenericArrayType, but <" + type + "> is of type " + (type == null ? "null" : type.getClass().getName()));
    }

    public static C1437c f(Type... typeArr) {
        if (typeArr.length != 0) {
            return new C1437c(null, List.class, typeArr);
        }
        throw new IllegalArgumentException("Missing type arguments for " + List.class);
    }

    public static int g(AbstractC1394n abstractC1394n, String str, int i5, int i8) {
        int iU = abstractC1394n.u();
        if (iU >= i5 && iU <= i8) {
            return iU;
        }
        throw new A6.b("Expected " + str + " but was " + iU + " at path " + abstractC1394n.m());
    }

    public abstract Object e();
}
