package androidx.navigation;

import android.app.Application;
import android.content.Context;
import androidx.lifecycle.EnumC1108q;
import androidx.lifecycle.i0;
import d2.AbstractC1866c;

/* JADX INFO: renamed from: androidx.navigation.k, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C1136k extends kotlin.jvm.internal.p implements J4.a {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ int f12754a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final /* synthetic */ C1137l f12755b;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public /* synthetic */ C1136k(C1137l c1137l, int i6) {
        super(0);
        this.f12754a = i6;
        this.f12755b = c1137l;
    }

    @Override // J4.a
    public final Object invoke() {
        switch (this.f12754a) {
            case 0:
                C1137l c1137l = this.f12755b;
                if (!c1137l.f12764m) {
                    throw new IllegalStateException("You cannot access the NavBackStackEntry's SavedStateHandle until it is added to the NavController's back stack (i.e., the Lifecycle of the NavBackStackEntry reaches the CREATED state).");
                }
                if (c1137l.f12763k.f12191c == EnumC1108q.f12180a) {
                    throw new IllegalStateException("You cannot access the NavBackStackEntry's SavedStateHandle after the NavBackStackEntry is destroyed.");
                }
                C1135j c1135j = new C1135j(c1137l, null);
                i0 store = c1137l.getViewModelStore();
                AbstractC1866c defaultViewModelCreationExtras = c1137l.getDefaultViewModelCreationExtras();
                kotlin.jvm.internal.o.h(store, "store");
                C0.J j4 = new C0.J(store, c1135j, defaultViewModelCreationExtras);
                kotlin.jvm.internal.g gVarA = kotlin.jvm.internal.D.a(NavBackStackEntry$SavedStateViewModel.class);
                String strB = gVarA.b();
                if (strB != null) {
                    return ((NavBackStackEntry$SavedStateViewModel) j4.g(gVarA, "androidx.lifecycle.ViewModelProvider.DefaultKey:".concat(strB))).getHandle();
                }
                throw new IllegalArgumentException("Local and anonymous classes can not be ViewModels");
            default:
                C1137l c1137l2 = this.f12755b;
                Context context = c1137l2.f12756a;
                Context applicationContext = context != null ? context.getApplicationContext() : null;
                return new androidx.lifecycle.Z(applicationContext instanceof Application ? (Application) applicationContext : null, c1137l2, c1137l2.a());
        }
    }
}
