package androidx.navigation;

import android.net.Uri;
import android.os.Bundle;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import kotlin.jvm.internal.C2439b;
import n.e0;
import q.AbstractC2761L;
import x4.AbstractC3251q;

/* JADX INFO: loaded from: classes.dex */
public abstract class B {
    public static final /* synthetic */ int l = 0;

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

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public E f12640b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final ArrayList f12641c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final e0 f12642d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final LinkedHashMap f12643e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public int f12644f;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public String f12645j;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public w4.p f12646k;

    static {
        new LinkedHashMap();
    }

    public B(X navigator) {
        kotlin.jvm.internal.o.h(navigator, "navigator");
        LinkedHashMap linkedHashMap = Y.f12732b;
        this.f12639a = AbstractC1131f.c(navigator.getClass());
        this.f12641c = new ArrayList();
        this.f12642d = new e0(0);
        this.f12643e = new LinkedHashMap();
    }

    /* JADX WARN: Removed duplicated region for block: B:22:0x0065  */
    /* JADX WARN: Removed duplicated region for block: B:34:0x00a9  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public boolean equals(Object obj) {
        boolean z6;
        int size;
        LinkedHashMap linkedHashMap;
        boolean z7;
        if (this != obj) {
            if (obj != null && (obj instanceof B)) {
                B b5 = (B) obj;
                boolean zC = kotlin.jvm.internal.o.c(this.f12641c, b5.f12641c);
                e0 e0Var = this.f12642d;
                int iE = e0Var.e();
                e0 e0Var2 = b5.f12642d;
                if (iE == e0Var2.e()) {
                    Iterator it = ((R4.a) R4.n.X(new C2439b(e0Var))).iterator();
                    while (it.hasNext()) {
                        int iIntValue = ((Number) it.next()).intValue();
                        if (!kotlin.jvm.internal.o.c(e0Var.b(iIntValue), e0Var2.b(iIntValue))) {
                        }
                    }
                    z6 = true;
                    LinkedHashMap linkedHashMap2 = this.f12643e;
                    size = linkedHashMap2.size();
                    linkedHashMap = b5.f12643e;
                    if (size == linkedHashMap.size()) {
                        for (Map.Entry entry : (Iterable) AbstractC3251q.W(linkedHashMap2.entrySet()).f2102b) {
                            if (!linkedHashMap.containsKey(entry.getKey()) || !kotlin.jvm.internal.o.c(linkedHashMap.get(entry.getKey()), entry.getValue())) {
                            }
                        }
                        z7 = true;
                        if (this.f12644f == b5.f12644f || !kotlin.jvm.internal.o.c(this.f12645j, b5.f12645j) || !zC || !z6 || !z7) {
                        }
                    }
                    z7 = false;
                    if (this.f12644f == b5.f12644f) {
                    }
                }
                z6 = false;
                LinkedHashMap linkedHashMap22 = this.f12643e;
                size = linkedHashMap22.size();
                linkedHashMap = b5.f12643e;
                if (size == linkedHashMap.size()) {
                }
                z7 = false;
                if (this.f12644f == b5.f12644f) {
                }
            }
            return false;
        }
        return true;
    }

    public final Bundle g(Bundle bundle) {
        Object obj;
        LinkedHashMap linkedHashMap = this.f12643e;
        if (bundle == null && linkedHashMap.isEmpty()) {
            return null;
        }
        Bundle bundle2 = new Bundle();
        for (Map.Entry entry : linkedHashMap.entrySet()) {
            String name = (String) entry.getKey();
            C1132g c1132g = (C1132g) entry.getValue();
            c1132g.getClass();
            kotlin.jvm.internal.o.h(name, "name");
            if (c1132g.f12749b && (obj = c1132g.f12750c) != null) {
                c1132g.f12748a.e(bundle2, name, obj);
            }
        }
        if (bundle != null) {
            bundle2.putAll(bundle);
            for (Map.Entry entry2 : linkedHashMap.entrySet()) {
                String name2 = (String) entry2.getKey();
                C1132g c1132g2 = (C1132g) entry2.getValue();
                c1132g2.getClass();
                kotlin.jvm.internal.o.h(name2, "name");
                boolean zContainsKey = bundle2.containsKey(name2);
                U u6 = c1132g2.f12748a;
                if (!zContainsKey || bundle2.get(name2) != null) {
                    try {
                        u6.a(bundle2, name2);
                    } catch (ClassCastException unused) {
                    }
                }
                StringBuilder sbS = com.google.android.recaptcha.internal.a.s("Wrong argument type for '", name2, "' in argument bundle. ");
                sbS.append(u6.b());
                sbS.append(" expected.");
                throw new IllegalArgumentException(sbS.toString().toString());
            }
        }
        return bundle2;
    }

    public C1150z h(C4.f fVar) {
        ArrayList<C1149y> arrayList = this.f12641c;
        if (arrayList.isEmpty()) {
            return null;
        }
        C1150z c1150z = null;
        for (C1149y c1149y : arrayList) {
            LinkedHashMap arguments = this.f12643e;
            Uri uri = (Uri) fVar.f741b;
            Bundle bundleD = uri != null ? c1149y.d(uri, arguments) : null;
            int iB = c1149y.b(uri);
            String str = (String) fVar.f742c;
            boolean z6 = str != null && str.equals(null);
            if (bundleD == null) {
                if (z6) {
                    kotlin.jvm.internal.o.h(arguments, "arguments");
                    Bundle bundle = new Bundle();
                    if (uri != null) {
                        Pattern pattern = (Pattern) c1149y.f12807d.getValue();
                        Matcher matcher = pattern != null ? pattern.matcher(uri.toString()) : null;
                        if (matcher != null && matcher.matches()) {
                            c1149y.e(matcher, bundle, arguments);
                            if (((Boolean) c1149y.f12808e.getValue()).booleanValue()) {
                                c1149y.f(uri, bundle, arguments);
                            }
                        }
                    }
                    if (AbstractC1131f.d(arguments, new C1148x(1, bundle)).isEmpty()) {
                    }
                }
            }
            C1150z c1150z2 = new C1150z(this, bundleD, c1149y.l, iB, z6);
            if (c1150z == null || c1150z2.compareTo(c1150z) > 0) {
                c1150z = c1150z2;
            }
        }
        return c1150z;
    }

    public int hashCode() {
        int i6 = this.f12644f * 31;
        String str = this.f12645j;
        int iHashCode = i6 + (str != null ? str.hashCode() : 0);
        Iterator it = this.f12641c.iterator();
        while (it.hasNext()) {
            iHashCode = (((C1149y) it.next()).f12804a.hashCode() + (iHashCode * 31)) * 961;
        }
        e0 e0Var = this.f12642d;
        kotlin.jvm.internal.o.h(e0Var, "<this>");
        if (e0Var.e() > 0) {
            e0Var.f(0).getClass();
            throw new ClassCastException();
        }
        LinkedHashMap linkedHashMap = this.f12643e;
        for (String str2 : linkedHashMap.keySet()) {
            int iB = AbstractC2761L.b(iHashCode * 31, 31, str2);
            Object obj = linkedHashMap.get(str2);
            iHashCode = iB + (obj != null ? obj.hashCode() : 0);
        }
        return iHashCode;
    }

    public final C1150z j(String route) {
        C1149y c1149y;
        kotlin.jvm.internal.o.h(route, "route");
        w4.p pVar = this.f12646k;
        if (pVar == null || (c1149y = (C1149y) pVar.getValue()) == null) {
            return null;
        }
        Uri uri = Uri.parse("android-app://androidx.navigation/".concat(route));
        kotlin.jvm.internal.o.d(uri);
        Bundle bundleD = c1149y.d(uri, this.f12643e);
        if (bundleD == null) {
            return null;
        }
        return new C1150z(this, bundleD, c1149y.l, c1149y.b(uri), false);
    }

    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append("(0x");
        sb.append(Integer.toHexString(this.f12644f));
        sb.append(")");
        String str = this.f12645j;
        if (str != null && !S4.p.Q0(str)) {
            sb.append(" route=");
            sb.append(this.f12645j);
        }
        String string = sb.toString();
        kotlin.jvm.internal.o.g(string, "sb.toString()");
        return string;
    }
}
