package androidx.navigation;

import android.app.Application;
import android.content.Context;
import android.os.Bundle;
import androidx.lifecycle.C1115y;
import androidx.lifecycle.EnumC1108q;
import androidx.lifecycle.InterfaceC1102k;
import androidx.lifecycle.InterfaceC1113w;
import androidx.lifecycle.c0;
import androidx.lifecycle.d0;
import androidx.lifecycle.i0;
import androidx.lifecycle.j0;
import d2.AbstractC1866c;
import d2.C1867d;
import d3.C1931v0;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Set;
import n2.C2616g;
import n2.C2617h;
import n2.InterfaceC2618i;
import p2.C2720a;

/* JADX INFO: renamed from: androidx.navigation.l, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C1137l implements InterfaceC1113w, j0, InterfaceC1102k, InterfaceC2618i {

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

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

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

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public EnumC1108q f12759d;

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

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

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public final Bundle f12762j;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public final C1115y f12763k = new C1115y(this, true);
    public final C2617h l = new C2617h(new C2720a(this, new C1931v0(this, 9)));

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public boolean f12764m;

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    public EnumC1108q f12765n;

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    public final androidx.lifecycle.Z f12766o;

    public C1137l(Context context, B b5, Bundle bundle, EnumC1108q enumC1108q, V v3, String str, Bundle bundle2) {
        this.f12756a = context;
        this.f12757b = b5;
        this.f12758c = bundle;
        this.f12759d = enumC1108q;
        this.f12760e = v3;
        this.f12761f = str;
        this.f12762j = bundle2;
        w4.p pVarK = m1.g.k(new C1136k(this, 1));
        m1.g.k(new C1136k(this, 0));
        this.f12765n = EnumC1108q.f12181b;
        this.f12766o = (androidx.lifecycle.Z) pVarK.getValue();
    }

    public final Bundle a() {
        Bundle bundle = this.f12758c;
        if (bundle == null) {
            return null;
        }
        return new Bundle(bundle);
    }

    public final void b(EnumC1108q maxState) {
        kotlin.jvm.internal.o.h(maxState, "maxState");
        this.f12765n = maxState;
        c();
    }

    public final void c() {
        if (!this.f12764m) {
            C2617h c2617h = this.l;
            c2617h.a();
            this.f12764m = true;
            if (this.f12760e != null) {
                androidx.lifecycle.X.d(this);
            }
            c2617h.b(this.f12762j);
        }
        int iOrdinal = this.f12759d.ordinal();
        int iOrdinal2 = this.f12765n.ordinal();
        C1115y c1115y = this.f12763k;
        if (iOrdinal < iOrdinal2) {
            c1115y.e(this.f12759d);
        } else {
            c1115y.e(this.f12765n);
        }
    }

    public final boolean equals(Object obj) {
        Set<String> setKeySet;
        if (obj != null && (obj instanceof C1137l)) {
            C1137l c1137l = (C1137l) obj;
            if (kotlin.jvm.internal.o.c(this.f12761f, c1137l.f12761f) && kotlin.jvm.internal.o.c(this.f12757b, c1137l.f12757b) && kotlin.jvm.internal.o.c(this.f12763k, c1137l.f12763k) && kotlin.jvm.internal.o.c(this.l.f21615b, c1137l.l.f21615b)) {
                Bundle bundle = this.f12758c;
                Bundle bundle2 = c1137l.f12758c;
                if (kotlin.jvm.internal.o.c(bundle, bundle2)) {
                    return true;
                }
                if (bundle != null && (setKeySet = bundle.keySet()) != null) {
                    Set<String> set = setKeySet;
                    if ((set instanceof Collection) && set.isEmpty()) {
                        return true;
                    }
                    for (String str : set) {
                        if (!kotlin.jvm.internal.o.c(bundle.get(str), bundle2 != null ? bundle2.get(str) : null)) {
                        }
                    }
                    return true;
                }
            }
        }
        return false;
    }

    @Override // androidx.lifecycle.InterfaceC1102k
    public final AbstractC1866c getDefaultViewModelCreationExtras() {
        C1867d c1867d = new C1867d(0);
        Context context = this.f12756a;
        Context applicationContext = context != null ? context.getApplicationContext() : null;
        Application application = applicationContext instanceof Application ? (Application) applicationContext : null;
        LinkedHashMap linkedHashMap = c1867d.f15010a;
        if (application != null) {
            linkedHashMap.put(c0.f12161c, application);
        }
        linkedHashMap.put(androidx.lifecycle.X.f12140a, this);
        linkedHashMap.put(androidx.lifecycle.X.f12141b, this);
        Bundle bundleA = a();
        if (bundleA != null) {
            linkedHashMap.put(androidx.lifecycle.X.f12142c, bundleA);
        }
        return c1867d;
    }

    @Override // androidx.lifecycle.InterfaceC1102k
    public final d0 getDefaultViewModelProviderFactory() {
        return this.f12766o;
    }

    @Override // androidx.lifecycle.InterfaceC1113w
    public final androidx.lifecycle.r getLifecycle() {
        return this.f12763k;
    }

    @Override // n2.InterfaceC2618i
    public final C2616g getSavedStateRegistry() {
        return this.l.f21615b;
    }

    @Override // androidx.lifecycle.j0
    public final i0 getViewModelStore() {
        if (!this.f12764m) {
            throw new IllegalStateException("You cannot access the NavBackStackEntry's ViewModels until it is added to the NavController's back stack (i.e., the Lifecycle of the NavBackStackEntry reaches the CREATED state).");
        }
        if (this.f12763k.f12191c == EnumC1108q.f12180a) {
            throw new IllegalStateException("You cannot access the NavBackStackEntry's ViewModels after the NavBackStackEntry is destroyed.");
        }
        V v3 = this.f12760e;
        if (v3 != null) {
            return v3.getViewModelStore(this.f12761f);
        }
        throw new IllegalStateException("You must call setViewModelStore() on your NavHostController before accessing the ViewModelStore of a navigation graph.");
    }

    public final int hashCode() {
        Set<String> setKeySet;
        int iHashCode = this.f12757b.hashCode() + (this.f12761f.hashCode() * 31);
        Bundle bundle = this.f12758c;
        if (bundle != null && (setKeySet = bundle.keySet()) != null) {
            Iterator<T> it = setKeySet.iterator();
            while (it.hasNext()) {
                int i6 = iHashCode * 31;
                Object obj = bundle.get((String) it.next());
                iHashCode = i6 + (obj != null ? obj.hashCode() : 0);
            }
        }
        return this.l.f21615b.hashCode() + ((this.f12763k.hashCode() + (iHashCode * 31)) * 31);
    }

    public final String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(C1137l.class.getSimpleName());
        sb.append("(" + this.f12761f + ')');
        sb.append(" destination=");
        sb.append(this.f12757b);
        String string = sb.toString();
        kotlin.jvm.internal.o.g(string, "sb.toString()");
        return string;
    }
}
