package androidx.navigation;

import C0.C0109j;
import android.content.Context;
import android.content.res.Resources;
import android.os.Parcelable;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;

/* JADX INFO: renamed from: androidx.navigation.f, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public abstract class AbstractC1131f {
    public static String a(Context context, int i6) {
        String strValueOf;
        kotlin.jvm.internal.o.h(context, "context");
        if (i6 <= 16777215) {
            return String.valueOf(i6);
        }
        try {
            strValueOf = context.getResources().getResourceName(i6);
        } catch (Resources.NotFoundException unused) {
            strValueOf = String.valueOf(i6);
        }
        kotlin.jvm.internal.o.g(strValueOf, "try {\n                  …tring()\n                }");
        return strValueOf;
    }

    public static R4.k b(B b5) {
        kotlin.jvm.internal.o.h(b5, "<this>");
        return R4.n.a0(C1127b.f12742k, b5);
    }

    public static String c(Class cls) {
        LinkedHashMap linkedHashMap = Y.f12732b;
        String strValue = (String) linkedHashMap.get(cls);
        if (strValue == null) {
            W w6 = (W) cls.getAnnotation(W.class);
            strValue = w6 != null ? w6.value() : null;
            if (strValue == null || strValue.length() <= 0) {
                throw new IllegalArgumentException("No @Navigator.Name annotation found for ".concat(cls.getSimpleName()).toString());
            }
            linkedHashMap.put(cls, strValue);
        }
        kotlin.jvm.internal.o.e(strValue);
        return strValue;
    }

    public static final ArrayList d(Map map, J4.c cVar) {
        kotlin.jvm.internal.o.h(map, "<this>");
        LinkedHashMap linkedHashMap = new LinkedHashMap();
        for (Map.Entry entry : map.entrySet()) {
            C1132g c1132g = (C1132g) entry.getValue();
            Boolean bool = c1132g != null ? Boolean.FALSE : null;
            kotlin.jvm.internal.o.e(bool);
            if (!bool.booleanValue() && !c1132g.f12749b) {
                linkedHashMap.put(entry.getKey(), entry.getValue());
            }
        }
        Set setKeySet = linkedHashMap.keySet();
        ArrayList arrayList = new ArrayList();
        for (Object obj : setKeySet) {
            if (((Boolean) cVar.invoke((String) obj)).booleanValue()) {
                arrayList.add(obj);
            }
        }
        return arrayList;
    }

    /* JADX WARN: Removed duplicated region for block: B:43:0x009c  */
    /* JADX WARN: Removed duplicated region for block: B:48:0x00cc  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public static final C1130e e(String str, J4.c cVar) {
        U q6;
        C1133h c1133h = new C1133h();
        cVar.invoke(c1133h);
        C0109j c0109j = c1133h.f12751a;
        U u6 = (U) c0109j.f607c;
        if (u6 == null) {
            Object obj = c0109j.f608d;
            if (obj instanceof Integer) {
                u6 = U.f12720a;
            } else if (obj instanceof int[]) {
                u6 = U.f12721b;
            } else if (obj instanceof Long) {
                u6 = U.f12722c;
            } else if (obj instanceof long[]) {
                u6 = U.f12723d;
            } else if (obj instanceof Float) {
                u6 = U.f12724e;
            } else if (obj instanceof float[]) {
                u6 = U.f12725f;
            } else if (obj instanceof Boolean) {
                u6 = U.f12726g;
            } else if (obj instanceof boolean[]) {
                u6 = U.f12727h;
            } else if ((obj instanceof String) || obj == null) {
                u6 = U.f12728i;
            } else if ((obj instanceof Object[]) && (((Object[]) obj) instanceof String[])) {
                u6 = U.f12729j;
            } else if (obj.getClass().isArray()) {
                Class<?> componentType = obj.getClass().getComponentType();
                kotlin.jvm.internal.o.e(componentType);
                if (Parcelable.class.isAssignableFrom(componentType)) {
                    Class<?> componentType2 = obj.getClass().getComponentType();
                    kotlin.jvm.internal.o.f(componentType2, "null cannot be cast to non-null type java.lang.Class<android.os.Parcelable>");
                    q6 = new P(componentType2);
                } else if (obj.getClass().isArray()) {
                    Class<?> componentType3 = obj.getClass().getComponentType();
                    kotlin.jvm.internal.o.e(componentType3);
                    if (Serializable.class.isAssignableFrom(componentType3)) {
                        Class<?> componentType4 = obj.getClass().getComponentType();
                        kotlin.jvm.internal.o.f(componentType4, "null cannot be cast to non-null type java.lang.Class<java.io.Serializable>");
                        q6 = new S(componentType4);
                    } else {
                        q6 = obj instanceof Parcelable ? new Q(obj.getClass()) : obj instanceof Enum ? new O(obj.getClass()) : new T(obj.getClass());
                    }
                }
                u6 = q6;
            }
        }
        return new C1130e(str, new C1132g(u6, c0109j.f608d, c0109j.f606b));
    }

    public static final K f(J4.c cVar) {
        L l = new L();
        cVar.invoke(l);
        boolean z6 = l.f12708b;
        J j4 = l.f12707a;
        boolean z7 = l.f12709c;
        String str = l.f12711e;
        if (str != null) {
            boolean z8 = l.f12712f;
            boolean z9 = l.f12713g;
            j4.f12694b = str;
            j4.f12693a = -1;
            j4.f12695c = z8;
            j4.f12696d = z9;
        } else {
            int i6 = l.f12710d;
            boolean z10 = l.f12712f;
            boolean z11 = l.f12713g;
            j4.f12693a = i6;
            j4.f12694b = null;
            j4.f12695c = z10;
            j4.f12696d = z11;
        }
        String str2 = j4.f12694b;
        if (str2 == null) {
            return new K(z6, z7, j4.f12693a, j4.f12695c, j4.f12696d, j4.f12697e, j4.f12698f);
        }
        boolean z12 = j4.f12695c;
        boolean z13 = j4.f12696d;
        int i7 = j4.f12697e;
        int i8 = j4.f12698f;
        int i9 = B.l;
        K k6 = new K(z6, z7, "android-app://androidx.navigation/".concat(str2).hashCode(), z12, z13, i7, i8);
        k6.f12706h = str2;
        return k6;
    }
}
