Rabbit-R1/android (non root)/java/sources/androidx/navigation/NavController.java
2024-05-21 17:08:36 -04:00

2427 lines
135 KiB
Java
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package androidx.navigation;
import android.app.Activity;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Parcelable;
import android.util.Log;
import androidx.activity.OnBackPressedCallback;
import androidx.activity.OnBackPressedDispatcher;
import androidx.core.os.BundleKt;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleEventObserver;
import androidx.lifecycle.LifecycleObserver;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.ViewModelStore;
import androidx.lifecycle.ViewModelStoreOwner;
import androidx.navigation.NavBackStackEntry;
import androidx.navigation.NavDeepLinkRequest;
import androidx.navigation.NavDestination;
import androidx.navigation.Navigator;
import io.sentry.SentryBaseEvent;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicInteger;
import kotlin.Lazy;
import kotlin.LazyKt;
import kotlin.Metadata;
import kotlin.TuplesKt;
import kotlin.Unit;
import kotlin.collections.ArrayDeque;
import kotlin.collections.ArraysKt;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.JvmStatic;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.ArrayIteratorKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Ref;
import kotlin.jvm.internal.TypeIntrinsics;
import kotlin.sequences.SequencesKt;
import kotlinx.coroutines.channels.BufferOverflow;
import kotlinx.coroutines.flow.Flow;
import kotlinx.coroutines.flow.FlowKt;
import kotlinx.coroutines.flow.MutableSharedFlow;
import kotlinx.coroutines.flow.MutableStateFlow;
import kotlinx.coroutines.flow.SharedFlowKt;
import kotlinx.coroutines.flow.StateFlow;
import kotlinx.coroutines.flow.StateFlowKt;
/* compiled from: NavController.kt */
@Metadata(d1 = {"\u0000È\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010!\n\u0000\n\u0002\u0010%\n\u0002\u0010\b\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0011\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0002\b\f\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u000b\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\r\n\u0002\u0018\u0002\n\u0002\b\f\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u0015\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u0012\n\u0002\u0018\u0002\n\u0002\b\r\b\u0016\u0018\u0000 Ê\u00012\u00020\u0001:\u0006Ê\u0001Ë\u0001Ì\u0001B\r\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004J2\u0010q\u001a\u00020\u00172\u0006\u0010r\u001a\u0002052\b\u0010s\u001a\u0004\u0018\u00010_2\u0006\u0010\u0016\u001a\u00020\b2\u000e\b\u0002\u0010t\u001a\b\u0012\u0004\u0012\u00020\b0\u0007H\u0002J\u0010\u0010u\u001a\u00020\u00172\u0006\u0010v\u001a\u00020fH\u0016J\u0012\u0010w\u001a\u0002092\b\b\u0001\u0010x\u001a\u00020\u001eH\u0007J\u0010\u0010w\u001a\u0002092\u0006\u0010y\u001a\u00020\u001fH\u0007J\u0012\u0010z\u001a\u0002092\b\b\u0001\u0010x\u001a\u00020\u001eH\u0003J\u0010\u0010z\u001a\u0002092\u0006\u0010y\u001a\u00020\u001fH\u0003J\b\u0010{\u001a\u00020|H\u0016J\b\u0010}\u001a\u000209H\u0002J\u0010\u0010~\u001a\u00020\u00172\u0006\u0010\u007f\u001a\u000209H\u0017J7\u0010\u0080\u0001\u001a\u0002092\u0011\u0010\u0081\u0001\u001a\f\u0012\b\u0012\u0006\u0012\u0002\b\u00030\\0\u00072\u0007\u0010\u0082\u0001\u001a\u0002052\u0007\u0010\u0083\u0001\u001a\u0002092\u0007\u0010\u0084\u0001\u001a\u000209H\u0002J;\u0010\u0085\u0001\u001a\u0002092\r\u0010\u0086\u0001\u001a\b\u0012\u0004\u0012\u00020\b0\u00072\t\u0010\u0087\u0001\u001a\u0004\u0018\u00010_2\n\u0010\u0088\u0001\u001a\u0005\u0018\u00010\u0089\u00012\n\u0010\u008a\u0001\u001a\u0005\u0018\u00010\u008b\u0001H\u0002J\u0015\u0010\u008c\u0001\u001a\u0004\u0018\u0001052\b\b\u0001\u0010x\u001a\u00020\u001eH\u0007J\u0013\u0010\u008c\u0001\u001a\u0004\u0018\u0001052\u0006\u0010y\u001a\u00020\u001fH\u0007J\u0015\u0010\u008d\u0001\u001a\u0004\u0018\u00010\u001f2\b\u0010\u008e\u0001\u001a\u00030\u008f\u0001H\u0002J\u0013\u0010\u0090\u0001\u001a\u00020\b2\b\b\u0001\u0010x\u001a\u00020\u001eH\u0016J\u000f\u0010\u0090\u0001\u001a\u00020\b2\u0006\u0010y\u001a\u00020\u001fJ\u0015\u0010\u0091\u0001\u001a\u00030\u0092\u00012\t\b\u0001\u0010\u0093\u0001\u001a\u00020\u001eH\u0016J\u0015\u0010\u0094\u0001\u001a\u0002092\n\u0010\u0095\u0001\u001a\u0005\u0018\u00010\u0096\u0001H\u0017J \u0010\u0097\u0001\u001a\b\u0012\u0004\u0012\u00020\b0\u00072\u000f\u0010\u0098\u0001\u001a\n\u0012\u0004\u0012\u00020!\u0018\u00010\u0019H\u0002J\u001c\u0010\u0099\u0001\u001a\u0002092\u0006\u0010r\u001a\u0002052\t\u0010\u0087\u0001\u001a\u0004\u0018\u00010_H\u0002J\u001b\u0010\u009a\u0001\u001a\u00020\u00172\u0007\u0010\u009b\u0001\u001a\u00020\b2\u0007\u0010\u009c\u0001\u001a\u00020\bH\u0002J\u0013\u0010\u009d\u0001\u001a\u00020\u00172\b\u0010\u008e\u0001\u001a\u00030\u009e\u0001H\u0017J\u001f\u0010\u009d\u0001\u001a\u00020\u00172\b\u0010\u008e\u0001\u001a\u00030\u009e\u00012\n\u0010\u0088\u0001\u001a\u0005\u0018\u00010\u0089\u0001H\u0017J+\u0010\u009d\u0001\u001a\u00020\u00172\b\u0010\u008e\u0001\u001a\u00030\u009e\u00012\n\u0010\u0088\u0001\u001a\u0005\u0018\u00010\u0089\u00012\n\u0010\u008a\u0001\u001a\u0005\u0018\u00010\u008b\u0001H\u0017J\u0013\u0010\u009d\u0001\u001a\u00020\u00172\b\u0010\u009f\u0001\u001a\u00030 \u0001H\u0017J\u001f\u0010\u009d\u0001\u001a\u00020\u00172\b\u0010\u009f\u0001\u001a\u00030 \u00012\n\u0010\u0088\u0001\u001a\u0005\u0018\u00010\u0089\u0001H\u0017J+\u0010\u009d\u0001\u001a\u00020\u00172\b\u0010\u009f\u0001\u001a\u00030 \u00012\n\u0010\u0088\u0001\u001a\u0005\u0018\u00010\u0089\u00012\n\u0010\u008a\u0001\u001a\u0005\u0018\u00010\u008b\u0001H\u0017J4\u0010\u009d\u0001\u001a\u00020\u00172\u0006\u0010r\u001a\u0002052\t\u0010\u0087\u0001\u001a\u0004\u0018\u00010_2\n\u0010\u0088\u0001\u001a\u0005\u0018\u00010\u0089\u00012\n\u0010\u008a\u0001\u001a\u0005\u0018\u00010\u008b\u0001H\u0003J\u0013\u0010\u009d\u0001\u001a\u00020\u00172\b\u0010¡\u0001\u001a\u00030¢\u0001H\u0017J\u001f\u0010\u009d\u0001\u001a\u00020\u00172\b\u0010¡\u0001\u001a\u00030¢\u00012\n\u0010\u0088\u0001\u001a\u0005\u0018\u00010\u0089\u0001H\u0017J\u001d\u0010\u009d\u0001\u001a\u00020\u00172\b\u0010¡\u0001\u001a\u00030¢\u00012\b\u0010\u008a\u0001\u001a\u00030\u008b\u0001H\u0017J\u0014\u0010\u009d\u0001\u001a\u00020\u00172\t\b\u0001\u0010£\u0001\u001a\u00020\u001eH\u0017J\u001f\u0010\u009d\u0001\u001a\u00020\u00172\t\b\u0001\u0010£\u0001\u001a\u00020\u001e2\t\u0010\u0087\u0001\u001a\u0004\u0018\u00010_H\u0017J+\u0010\u009d\u0001\u001a\u00020\u00172\t\b\u0001\u0010£\u0001\u001a\u00020\u001e2\t\u0010\u0087\u0001\u001a\u0004\u0018\u00010_2\n\u0010\u0088\u0001\u001a\u0005\u0018\u00010\u0089\u0001H\u0017J7\u0010\u009d\u0001\u001a\u00020\u00172\t\b\u0001\u0010£\u0001\u001a\u00020\u001e2\t\u0010\u0087\u0001\u001a\u0004\u0018\u00010_2\n\u0010\u0088\u0001\u001a\u0005\u0018\u00010\u0089\u00012\n\u0010\u008a\u0001\u001a\u0005\u0018\u00010\u008b\u0001H\u0017J-\u0010\u009d\u0001\u001a\u00020\u00172\u0006\u0010y\u001a\u00020\u001f2\f\b\u0002\u0010\u0088\u0001\u001a\u0005\u0018\u00010\u0089\u00012\f\b\u0002\u0010\u008a\u0001\u001a\u0005\u0018\u00010\u008b\u0001H\u0007J-\u0010\u009d\u0001\u001a\u00020\u00172\u0006\u0010y\u001a\u00020\u001f2\u001a\u0010¤\u0001\u001a\u0015\u0012\u0005\u0012\u00030¥\u0001\u0012\u0004\u0012\u00020\u00170\u0013¢\u0006\u0003\\u0001H\u0007J\t\u0010§\u0001\u001a\u000209H\u0017J\u0014\u0010¨\u0001\u001a\u00020\u00172\t\u0010©\u0001\u001a\u0004\u0018\u00010_H\u0003J\t\u0010ª\u0001\u001a\u000209H\u0017J\u001c\u0010ª\u0001\u001a\u0002092\b\b\u0001\u0010x\u001a\u00020\u001e2\u0007\u0010\u0083\u0001\u001a\u000209H\u0017J%\u0010ª\u0001\u001a\u0002092\b\b\u0001\u0010x\u001a\u00020\u001e2\u0007\u0010\u0083\u0001\u001a\u0002092\u0007\u0010\u0084\u0001\u001a\u000209H\u0017J%\u0010ª\u0001\u001a\u0002092\u0006\u0010y\u001a\u00020\u001f2\u0007\u0010\u0083\u0001\u001a\u0002092\t\b\u0002\u0010\u0084\u0001\u001a\u000209H\u0007J'\u0010«\u0001\u001a\u00020\u00172\u0006\u0010j\u001a\u00020\b2\u000e\u0010¬\u0001\u001a\t\u0012\u0004\u0012\u00020\u00170\u00ad\u0001H\u0000¢\u0006\u0003\\u0001J'\u0010¯\u0001\u001a\u0002092\b\b\u0001\u0010x\u001a\u00020\u001e2\u0007\u0010\u0083\u0001\u001a\u0002092\t\b\u0002\u0010\u0084\u0001\u001a\u000209H\u0003J#\u0010¯\u0001\u001a\u0002092\u0006\u0010y\u001a\u00020\u001f2\u0007\u0010\u0083\u0001\u001a\u0002092\u0007\u0010\u0084\u0001\u001a\u000209H\u0002J-\u0010°\u0001\u001a\u00020\u00172\u0006\u0010j\u001a\u00020\b2\t\b\u0002\u0010\u0084\u0001\u001a\u0002092\u000f\b\u0002\u0010±\u0001\u001a\b\u0012\u0004\u0012\u00020!0\u0019H\u0002J\u0015\u0010²\u0001\u001a\b\u0012\u0004\u0012\u00020\b0\u0007H\u0000¢\u0006\u0003\\u0001J\u0011\u0010´\u0001\u001a\u00020\u00172\u0006\u0010v\u001a\u00020fH\u0016J\u0014\u0010µ\u0001\u001a\u00020\u00172\t\u0010¶\u0001\u001a\u0004\u0018\u00010_H\u0017J5\u0010·\u0001\u001a\u0002092\u0007\u0010¸\u0001\u001a\u00020\u001e2\t\u0010\u0087\u0001\u001a\u0004\u0018\u00010_2\n\u0010\u0088\u0001\u001a\u0005\u0018\u00010\u0089\u00012\n\u0010\u008a\u0001\u001a\u0005\u0018\u00010\u008b\u0001H\u0002J\u0011\u0010·\u0001\u001a\u0002092\u0006\u0010y\u001a\u00020\u001fH\u0002J\u000b\u0010\u0084\u0001\u001a\u0004\u0018\u00010_H\u0017J\u001b\u0010C\u001a\u00020\u00172\u0006\u0010@\u001a\u00020\f2\t\u0010©\u0001\u001a\u0004\u0018\u00010_H\u0017J\u0013\u0010C\u001a\u00020\u00172\t\b\u0001\u0010¹\u0001\u001a\u00020\u001eH\u0017J\u001e\u0010C\u001a\u00020\u00172\t\b\u0001\u0010¹\u0001\u001a\u00020\u001e2\t\u0010©\u0001\u001a\u0004\u0018\u00010_H\u0017J\u0012\u0010º\u0001\u001a\u00020\u00172\u0007\u0010»\u0001\u001a\u00020PH\u0017J\u0012\u0010¼\u0001\u001a\u00020\u00172\u0007\u0010½\u0001\u001a\u00020cH\u0017J\u0013\u0010¾\u0001\u001a\u00020\u00172\b\u0010¿\u0001\u001a\u00030À\u0001H\u0017J\t\u0010Á\u0001\u001a\u000209H\u0002J\t\u0010Â\u0001\u001a\u000209H\u0002J\u001a\u0010Ã\u0001\u001a\u0004\u0018\u00010\b2\u0007\u0010\u009b\u0001\u001a\u00020\bH\u0000¢\u0006\u0003\\u0001J\u000f\u0010Å\u0001\u001a\u00020\u0017H\u0000¢\u0006\u0003\\u0001J\t\u0010Ç\u0001\u001a\u00020\u0017H\u0002J\u0019\u0010\u008c\u0001\u001a\u0004\u0018\u000105*\u0002052\b\b\u0001\u0010x\u001a\u00020\u001eH\u0002Jb\u0010È\u0001\u001a\u00020\u0017*\n\u0012\u0006\b\u0001\u0012\u0002050\\2\r\u0010\u0086\u0001\u001a\b\u0012\u0004\u0012\u00020\b0\u00072\n\u0010\u0088\u0001\u001a\u0005\u0018\u00010\u0089\u00012\n\u0010\u008a\u0001\u001a\u0005\u0018\u00010\u008b\u00012$\b\u0002\u0010É\u0001\u001a\u001d\u0012\u0013\u0012\u00110\\u0006\f\b\u0014\u0012\b\b\u0015\u0012\u0004\b\b(\u0016\u0012\u0004\u0012\u00020\u00170\u0013H\u0002JL\u0010¯\u0001\u001a\u00020\u0017*\n\u0012\u0006\b\u0001\u0012\u0002050\\2\u0006\u0010j\u001a\u00020\b2\u0007\u0010\u0084\u0001\u001a\u0002092$\b\u0002\u0010É\u0001\u001a\u001d\u0012\u0013\u0012\u00110\\u0006\f\b\u0014\u0012\b\b\u0015\u0012\u0004\b\b(j\u0012\u0004\u0012\u00020\u00170\u0013H\u0002R\u001a\u0010\u0005\u001a\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u00020\b0\u00070\u0006X\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\t\u001a\b\u0012\u0004\u0012\u00020\b0\nX\u0082\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\u000b\u001a\u0004\u0018\u00010\fX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\r\u001a\u00020\u000eX\u0082\u000e¢\u0006\u0002\n\u0000R\u001a\u0010\u000f\u001a\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u00020\b0\u00070\u0006X\u0082\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\u0010\u001a\u0004\u0018\u00010\u0011X\u0082\u000e¢\u0006\u0002\n\u0000R+\u0010\u0012\u001a\u001f\u0012\u0013\u0012\u00110\\u0006\f\b\u0014\u0012\b\b\u0015\u0012\u0004\b\b(\u0016\u0012\u0004\u0012\u00020\u0017\u0018\u00010\u0013X\u0082\u000e¢\u0006\u0002\n\u0000R\u0014\u0010\u0018\u001a\b\u0012\u0004\u0012\u00020\b0\u0019X\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\u001a\u001a\b\u0012\u0004\u0012\u00020\b0\u001bX\u0082\u0004¢\u0006\u0002\n\u0000R\u001c\u0010\u001c\u001a\u0010\u0012\u0004\u0012\u00020\u001e\u0012\u0006\u0012\u0004\u0018\u00010\u001f0\u001dX\u0082\u0004¢\u0006\u0002\n\u0000R \u0010 \u001a\u0014\u0012\u0004\u0012\u00020\u001f\u0012\n\u0012\b\u0012\u0004\u0012\u00020!0\u00190\u001dX\u0082\u0004¢\u0006\u0002\n\u0000R\u0018\u0010\"\u001a\n\u0012\u0004\u0012\u00020$\u0018\u00010#X\u0082\u000e¢\u0006\u0004\n\u0002\u0010%R\u001a\u0010&\u001a\u000e\u0012\u0004\u0012\u00020\b\u0012\u0004\u0012\u00020\b0\u001dX\u0082\u0004¢\u0006\u0002\n\u0000R\u0013\u0010\u0002\u001a\u00020\u00038\u0007¢\u0006\b\n\u0000\u001a\u0004\b'\u0010(R\"\u0010)\u001a\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u00020\b0\u00070*8GX\u0087\u0004¢\u0006\b\n\u0000\u001a\u0004\b+\u0010,R\u0016\u0010-\u001a\u0004\u0018\u00010\b8VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b.\u0010/R\u0017\u00100\u001a\b\u0012\u0004\u0012\u00020\b01¢\u0006\b\n\u0000\u001a\u0004\b2\u00103R\u0016\u00104\u001a\u0004\u0018\u0001058VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b6\u00107R\u000e\u00108\u001a\u000209X\u0082\u000e¢\u0006\u0002\n\u0000R\u0014\u0010:\u001a\u00020\u001e8BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b;\u0010<R\u000e\u0010=\u001a\u00020\u001eX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010>\u001a\u000209X\u0082\u000e¢\u0006\u0002\n\u0000R\u001a\u0010?\u001a\u000e\u0012\u0004\u0012\u00020\b\u0012\u0004\u0012\u0002090\u001dX\u0082\u0004¢\u0006\u0002\n\u0000R$\u0010@\u001a\u00020\f2\u0006\u0010@\u001a\u00020\f8W@WX\u0096\u000e¢\u0006\f\u001a\u0004\bA\u0010B\"\u0004\bC\u0010DR\u001c\u0010E\u001a\u00020F8@X\u0080\u000e¢\u0006\u000e\n\u0000\u001a\u0004\bG\u0010H\"\u0004\bI\u0010JR\u0010\u0010K\u001a\u0004\u0018\u00010LX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010M\u001a\u00020NX\u0082\u0004¢\u0006\u0002\n\u0000R\u0010\u0010O\u001a\u0004\u0018\u00010PX\u0082\u000e¢\u0006\u0002\n\u0000R\u001b\u0010Q\u001a\u00020L8VX\u0096\u0084\u0002¢\u0006\f\n\u0004\bT\u0010U\u001a\u0004\bR\u0010SR$\u0010V\u001a\u00020\u000e2\u0006\u0010V\u001a\u00020\u000e8V@WX\u0096\u000e¢\u0006\f\u001a\u0004\bW\u0010X\"\u0004\bY\u0010ZR&\u0010[\u001a\u001a\u0012\f\u0012\n\u0012\u0006\b\u0001\u0012\u0002050\\\u0012\b\u0012\u00060]R\u00020\u00000\u001dX\u0082\u0004¢\u0006\u0002\n\u0000R\u0010\u0010^\u001a\u0004\u0018\u00010_X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010`\u001a\u00020aX\u0082\u0004¢\u0006\u0002\n\u0000R\u0010\u0010b\u001a\u0004\u0018\u00010cX\u0082\u000e¢\u0006\u0002\n\u0000R\u0014\u0010d\u001a\b\u0012\u0004\u0012\u00020f0eX\u0082\u0004¢\u0006\u0002\n\u0000R\u001a\u0010g\u001a\u000e\u0012\u0004\u0012\u00020\b\u0012\u0004\u0012\u00020h0\u001dX\u0082\u0004¢\u0006\u0002\n\u0000R+\u0010i\u001a\u001f\u0012\u0013\u0012\u00110\\u0006\f\b\u0014\u0012\b\b\u0015\u0012\u0004\b\b(j\u0012\u0004\u0012\u00020\u0017\u0018\u00010\u0013X\u0082\u000e¢\u0006\u0002\n\u0000R\u0016\u0010k\u001a\u0004\u0018\u00010\b8VX\u0096\u0004¢\u0006\u0006\u001a\u0004\bl\u0010/R\u0010\u0010m\u001a\u0004\u0018\u00010nX\u0082\u000e¢\u0006\u0002\n\u0000R\u001d\u0010o\u001a\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u00020\b0\u00070*¢\u0006\b\n\u0000\u001a\u0004\bp\u0010,¨\u0006Í\u0001"}, d2 = {"Landroidx/navigation/NavController;", "", "context", "Landroid/content/Context;", "(Landroid/content/Context;)V", "_currentBackStack", "Lkotlinx/coroutines/flow/MutableStateFlow;", "", "Landroidx/navigation/NavBackStackEntry;", "_currentBackStackEntryFlow", "Lkotlinx/coroutines/flow/MutableSharedFlow;", "_graph", "Landroidx/navigation/NavGraph;", "_navigatorProvider", "Landroidx/navigation/NavigatorProvider;", "_visibleEntries", "activity", "Landroid/app/Activity;", "addToBackStackHandler", "Lkotlin/Function1;", "Lkotlin/ParameterName;", "name", "backStackEntry", "", "backQueue", "Lkotlin/collections/ArrayDeque;", "backStackEntriesToDispatch", "", "backStackMap", "", "", "", "backStackStates", "Landroidx/navigation/NavBackStackEntryState;", "backStackToRestore", "", "Landroid/os/Parcelable;", "[Landroid/os/Parcelable;", "childToParentEntries", "getContext", "()Landroid/content/Context;", "currentBackStack", "Lkotlinx/coroutines/flow/StateFlow;", "getCurrentBackStack", "()Lkotlinx/coroutines/flow/StateFlow;", "currentBackStackEntry", "getCurrentBackStackEntry", "()Landroidx/navigation/NavBackStackEntry;", "currentBackStackEntryFlow", "Lkotlinx/coroutines/flow/Flow;", "getCurrentBackStackEntryFlow", "()Lkotlinx/coroutines/flow/Flow;", "currentDestination", "Landroidx/navigation/NavDestination;", "getCurrentDestination", "()Landroidx/navigation/NavDestination;", "deepLinkHandled", "", "destinationCountOnBackStack", "getDestinationCountOnBackStack", "()I", "dispatchReentrantCount", "enableOnBackPressedCallback", "entrySavedState", "graph", "getGraph", "()Landroidx/navigation/NavGraph;", "setGraph", "(Landroidx/navigation/NavGraph;)V", "hostLifecycleState", "Landroidx/lifecycle/Lifecycle$State;", "getHostLifecycleState$navigation_runtime_release", "()Landroidx/lifecycle/Lifecycle$State;", "setHostLifecycleState$navigation_runtime_release", "(Landroidx/lifecycle/Lifecycle$State;)V", "inflater", "Landroidx/navigation/NavInflater;", "lifecycleObserver", "Landroidx/lifecycle/LifecycleObserver;", "lifecycleOwner", "Landroidx/lifecycle/LifecycleOwner;", "navInflater", "getNavInflater", "()Landroidx/navigation/NavInflater;", "navInflater$delegate", "Lkotlin/Lazy;", "navigatorProvider", "getNavigatorProvider", "()Landroidx/navigation/NavigatorProvider;", "setNavigatorProvider", "(Landroidx/navigation/NavigatorProvider;)V", "navigatorState", "Landroidx/navigation/Navigator;", "Landroidx/navigation/NavController$NavControllerNavigatorState;", "navigatorStateToRestore", "Landroid/os/Bundle;", "onBackPressedCallback", "Landroidx/activity/OnBackPressedCallback;", "onBackPressedDispatcher", "Landroidx/activity/OnBackPressedDispatcher;", "onDestinationChangedListeners", "Ljava/util/concurrent/CopyOnWriteArrayList;", "Landroidx/navigation/NavController$OnDestinationChangedListener;", "parentToChildCount", "Ljava/util/concurrent/atomic/AtomicInteger;", "popFromBackStackHandler", "popUpTo", "previousBackStackEntry", "getPreviousBackStackEntry", "viewModel", "Landroidx/navigation/NavControllerViewModel;", "visibleEntries", "getVisibleEntries", "addEntryToBackStack", "node", "finalArgs", "restoredEntries", "addOnDestinationChangedListener", "listener", "clearBackStack", "destinationId", "route", "clearBackStackInternal", "createDeepLink", "Landroidx/navigation/NavDeepLinkBuilder;", "dispatchOnDestinationChanged", "enableOnBackPressed", "enabled", "executePopOperations", "popOperations", "foundDestination", "inclusive", "saveState", "executeRestoreState", "entries", "args", "navOptions", "Landroidx/navigation/NavOptions;", "navigatorExtras", "Landroidx/navigation/Navigator$Extras;", "findDestination", "findInvalidDestinationDisplayNameInDeepLink", "deepLink", "", "getBackStackEntry", "getViewModelStoreOwner", "Landroidx/lifecycle/ViewModelStoreOwner;", "navGraphId", "handleDeepLink", "intent", "Landroid/content/Intent;", "instantiateBackStack", "backStackState", "launchSingleTopInternal", "linkChildToParent", "child", "parent", "navigate", "Landroid/net/Uri;", SentryBaseEvent.JsonKeys.REQUEST, "Landroidx/navigation/NavDeepLinkRequest;", "directions", "Landroidx/navigation/NavDirections;", "resId", "builder", "Landroidx/navigation/NavOptionsBuilder;", "Lkotlin/ExtensionFunctionType;", "navigateUp", "onGraphCreated", "startDestinationArgs", "popBackStack", "popBackStackFromNavigator", "onComplete", "Lkotlin/Function0;", "popBackStackFromNavigator$navigation_runtime_release", "popBackStackInternal", "popEntryFromBackStack", "savedState", "populateVisibleEntries", "populateVisibleEntries$navigation_runtime_release", "removeOnDestinationChangedListener", "restoreState", "navState", "restoreStateInternal", "id", "graphResId", "setLifecycleOwner", "owner", "setOnBackPressedDispatcher", "dispatcher", "setViewModelStore", "viewModelStore", "Landroidx/lifecycle/ViewModelStore;", "tryRelaunchUpToExplicitStack", "tryRelaunchUpToGeneratedStack", "unlinkChildFromParent", "unlinkChildFromParent$navigation_runtime_release", "updateBackStackLifecycle", "updateBackStackLifecycle$navigation_runtime_release", "updateOnBackPressedCallbackEnabled", "navigateInternal", "handler", "Companion", "NavControllerNavigatorState", "OnDestinationChangedListener", "navigation-runtime_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes2.dex */
public class NavController {
private static final String KEY_BACK_STACK = "android-support-nav:controller:backStack";
private static final String KEY_BACK_STACK_DEST_IDS = "android-support-nav:controller:backStackDestIds";
private static final String KEY_BACK_STACK_IDS = "android-support-nav:controller:backStackIds";
private static final String KEY_BACK_STACK_STATES_IDS = "android-support-nav:controller:backStackStates";
private static final String KEY_BACK_STACK_STATES_PREFIX = "android-support-nav:controller:backStackStates:";
public static final String KEY_DEEP_LINK_ARGS = "android-support-nav:controller:deepLinkArgs";
public static final String KEY_DEEP_LINK_EXTRAS = "android-support-nav:controller:deepLinkExtras";
public static final String KEY_DEEP_LINK_HANDLED = "android-support-nav:controller:deepLinkHandled";
public static final String KEY_DEEP_LINK_IDS = "android-support-nav:controller:deepLinkIds";
public static final String KEY_DEEP_LINK_INTENT = "android-support-nav:controller:deepLinkIntent";
private static final String KEY_NAVIGATOR_STATE = "android-support-nav:controller:navigatorState";
private static final String KEY_NAVIGATOR_STATE_NAMES = "android-support-nav:controller:navigatorState:names";
private static final String TAG = "NavController";
private final MutableStateFlow<List<NavBackStackEntry>> _currentBackStack;
private final MutableSharedFlow<NavBackStackEntry> _currentBackStackEntryFlow;
private NavGraph _graph;
private NavigatorProvider _navigatorProvider;
private final MutableStateFlow<List<NavBackStackEntry>> _visibleEntries;
private Activity activity;
private Function1<? super NavBackStackEntry, Unit> addToBackStackHandler;
private final ArrayDeque<NavBackStackEntry> backQueue;
private final List<NavBackStackEntry> backStackEntriesToDispatch;
private final Map<Integer, String> backStackMap;
private final Map<String, ArrayDeque<NavBackStackEntryState>> backStackStates;
private Parcelable[] backStackToRestore;
private final Map<NavBackStackEntry, NavBackStackEntry> childToParentEntries;
private final Context context;
private final StateFlow<List<NavBackStackEntry>> currentBackStack;
private final Flow<NavBackStackEntry> currentBackStackEntryFlow;
private boolean deepLinkHandled;
private int dispatchReentrantCount;
private boolean enableOnBackPressedCallback;
private final Map<NavBackStackEntry, Boolean> entrySavedState;
private Lifecycle.State hostLifecycleState;
private NavInflater inflater;
private final LifecycleObserver lifecycleObserver;
private LifecycleOwner lifecycleOwner;
/* renamed from: navInflater$delegate, reason: from kotlin metadata */
private final Lazy navInflater;
private final Map<Navigator<? extends NavDestination>, NavControllerNavigatorState> navigatorState;
private Bundle navigatorStateToRestore;
private final OnBackPressedCallback onBackPressedCallback;
private OnBackPressedDispatcher onBackPressedDispatcher;
private final CopyOnWriteArrayList<OnDestinationChangedListener> onDestinationChangedListeners;
private final Map<NavBackStackEntry, AtomicInteger> parentToChildCount;
private Function1<? super NavBackStackEntry, Unit> popFromBackStackHandler;
private NavControllerViewModel viewModel;
private final StateFlow<List<NavBackStackEntry>> visibleEntries;
/* renamed from: Companion, reason: from kotlin metadata */
public static final Companion INSTANCE = new Companion(null);
private static boolean deepLinkSaveState = true;
/* compiled from: NavController.kt */
@Metadata(d1 = {"\u0000\"\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\\u0080\u0001\u0018\u00002\u00020\u0001J\"\u0010\u0002\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u00052\u0006\u0010\u0006\u001a\u00020\u00072\b\u0010\b\u001a\u0004\u0018\u00010\tH&ø\u0001\u0000\u0082\u0002\u0006\n\u0004\b!0\u0001¨\u0006\\u0006\u0001"}, d2 = {"Landroidx/navigation/NavController$OnDestinationChangedListener;", "", "onDestinationChanged", "", "controller", "Landroidx/navigation/NavController;", "destination", "Landroidx/navigation/NavDestination;", "arguments", "Landroid/os/Bundle;", "navigation-runtime_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes2.dex */
public interface OnDestinationChangedListener {
void onDestinationChanged(NavController controller, NavDestination destination, Bundle arguments);
}
@JvmStatic
@NavDeepLinkSaveStateControl
public static final void enableDeepLinkSaveState(boolean z) {
INSTANCE.enableDeepLinkSaveState(z);
}
public final Context getContext() {
return this.context;
}
public final StateFlow<List<NavBackStackEntry>> getCurrentBackStack() {
return this.currentBackStack;
}
public final Flow<NavBackStackEntry> getCurrentBackStackEntryFlow() {
return this.currentBackStackEntryFlow;
}
/* renamed from: getNavigatorProvider, reason: from getter */
public NavigatorProvider get_navigatorProvider() {
return this._navigatorProvider;
}
public final StateFlow<List<NavBackStackEntry>> getVisibleEntries() {
return this.visibleEntries;
}
public final void navigate(String route) {
Intrinsics.checkNotNullParameter(route, "route");
navigate$default(this, route, null, null, 6, null);
}
public final void navigate(String route, NavOptions navOptions) {
Intrinsics.checkNotNullParameter(route, "route");
navigate$default(this, route, navOptions, null, 4, null);
}
public final boolean popBackStack(String route, boolean z) {
Intrinsics.checkNotNullParameter(route, "route");
return popBackStack$default(this, route, z, false, 4, null);
}
public final void setHostLifecycleState$navigation_runtime_release(Lifecycle.State state) {
Intrinsics.checkNotNullParameter(state, "<set-?>");
this.hostLifecycleState = state;
}
public NavController(Context context) {
Object obj;
Intrinsics.checkNotNullParameter(context, "context");
this.context = context;
Iterator it = SequencesKt.generateSequence(context, new Function1<Context, Context>() { // from class: androidx.navigation.NavController$activity$1
@Override // kotlin.jvm.functions.Function1
public final Context invoke(Context it2) {
Intrinsics.checkNotNullParameter(it2, "it");
if (it2 instanceof ContextWrapper) {
return ((ContextWrapper) it2).getBaseContext();
}
return null;
}
}).iterator();
while (true) {
if (!it.hasNext()) {
obj = null;
break;
} else {
obj = it.next();
if (((Context) obj) instanceof Activity) {
break;
}
}
}
this.activity = (Activity) obj;
this.backQueue = new ArrayDeque<>();
MutableStateFlow<List<NavBackStackEntry>> MutableStateFlow = StateFlowKt.MutableStateFlow(CollectionsKt.emptyList());
this._currentBackStack = MutableStateFlow;
this.currentBackStack = FlowKt.asStateFlow(MutableStateFlow);
MutableStateFlow<List<NavBackStackEntry>> MutableStateFlow2 = StateFlowKt.MutableStateFlow(CollectionsKt.emptyList());
this._visibleEntries = MutableStateFlow2;
this.visibleEntries = FlowKt.asStateFlow(MutableStateFlow2);
this.childToParentEntries = new LinkedHashMap();
this.parentToChildCount = new LinkedHashMap();
this.backStackMap = new LinkedHashMap();
this.backStackStates = new LinkedHashMap();
this.onDestinationChangedListeners = new CopyOnWriteArrayList<>();
this.hostLifecycleState = Lifecycle.State.INITIALIZED;
this.lifecycleObserver = new LifecycleEventObserver() { // from class: androidx.navigation.NavController$$ExternalSyntheticLambda0
@Override // androidx.lifecycle.LifecycleEventObserver
public final void onStateChanged(LifecycleOwner lifecycleOwner, Lifecycle.Event event) {
NavController.lifecycleObserver$lambda$2(NavController.this, lifecycleOwner, event);
}
};
this.onBackPressedCallback = new OnBackPressedCallback() { // from class: androidx.navigation.NavController$onBackPressedCallback$1
/* JADX INFO: Access modifiers changed from: package-private */
{
super(false);
}
@Override // androidx.activity.OnBackPressedCallback
public void handleOnBackPressed() {
NavController.this.popBackStack();
}
};
this.enableOnBackPressedCallback = true;
this._navigatorProvider = new NavigatorProvider();
this.navigatorState = new LinkedHashMap();
this.entrySavedState = new LinkedHashMap();
this._navigatorProvider.addNavigator(new NavGraphNavigator(this._navigatorProvider));
this._navigatorProvider.addNavigator(new ActivityNavigator(this.context));
this.backStackEntriesToDispatch = new ArrayList();
this.navInflater = LazyKt.lazy(new Function0<NavInflater>() { // from class: androidx.navigation.NavController$navInflater$2
/* JADX INFO: Access modifiers changed from: package-private */
{
super(0);
}
/* JADX WARN: Can't rename method to resolve collision */
@Override // kotlin.jvm.functions.Function0
public final NavInflater invoke() {
NavInflater navInflater;
navInflater = NavController.this.inflater;
return navInflater == null ? new NavInflater(NavController.this.getContext(), NavController.this._navigatorProvider) : navInflater;
}
});
MutableSharedFlow<NavBackStackEntry> MutableSharedFlow$default = SharedFlowKt.MutableSharedFlow$default(1, 0, BufferOverflow.DROP_OLDEST, 2, null);
this._currentBackStackEntryFlow = MutableSharedFlow$default;
this.currentBackStackEntryFlow = FlowKt.asSharedFlow(MutableSharedFlow$default);
}
public NavGraph getGraph() {
NavGraph navGraph = this._graph;
if (navGraph == null) {
throw new IllegalStateException("You must call setGraph() before calling getGraph()".toString());
}
Intrinsics.checkNotNull(navGraph, "null cannot be cast to non-null type androidx.navigation.NavGraph");
return navGraph;
}
public void setGraph(NavGraph graph) {
Intrinsics.checkNotNullParameter(graph, "graph");
setGraph(graph, (Bundle) null);
}
private final void linkChildToParent(NavBackStackEntry child, NavBackStackEntry parent) {
this.childToParentEntries.put(child, parent);
if (this.parentToChildCount.get(parent) == null) {
this.parentToChildCount.put(parent, new AtomicInteger(0));
}
AtomicInteger atomicInteger = this.parentToChildCount.get(parent);
Intrinsics.checkNotNull(atomicInteger);
atomicInteger.incrementAndGet();
}
public final NavBackStackEntry unlinkChildFromParent$navigation_runtime_release(NavBackStackEntry child) {
Intrinsics.checkNotNullParameter(child, "child");
NavBackStackEntry remove = this.childToParentEntries.remove(child);
if (remove == null) {
return null;
}
AtomicInteger atomicInteger = this.parentToChildCount.get(remove);
Integer valueOf = atomicInteger != null ? Integer.valueOf(atomicInteger.decrementAndGet()) : null;
if (valueOf != null && valueOf.intValue() == 0) {
NavControllerNavigatorState navControllerNavigatorState = this.navigatorState.get(this._navigatorProvider.getNavigator(remove.getDestination().getNavigatorName()));
if (navControllerNavigatorState != null) {
navControllerNavigatorState.markTransitionComplete(remove);
}
this.parentToChildCount.remove(remove);
}
return remove;
}
public final Lifecycle.State getHostLifecycleState$navigation_runtime_release() {
return this.lifecycleOwner == null ? Lifecycle.State.CREATED : this.hostLifecycleState;
}
/* JADX INFO: Access modifiers changed from: private */
public static final void lifecycleObserver$lambda$2(NavController this$0, LifecycleOwner lifecycleOwner, Lifecycle.Event event) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
Intrinsics.checkNotNullParameter(lifecycleOwner, "<anonymous parameter 0>");
Intrinsics.checkNotNullParameter(event, "event");
this$0.hostLifecycleState = event.getTargetState();
if (this$0._graph != null) {
Iterator it = this$0.backQueue.iterator();
while (it.hasNext()) {
((NavBackStackEntry) it.next()).handleLifecycleEvent(event);
}
}
}
public void setNavigatorProvider(NavigatorProvider navigatorProvider) {
Intrinsics.checkNotNullParameter(navigatorProvider, "navigatorProvider");
if (!this.backQueue.isEmpty()) {
throw new IllegalStateException("NavigatorProvider must be set before setGraph call".toString());
}
this._navigatorProvider = navigatorProvider;
}
static /* synthetic */ void navigateInternal$default(NavController navController, Navigator navigator, List list, NavOptions navOptions, Navigator.Extras extras, Function1 function1, int i, Object obj) {
if (obj != null) {
throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: navigateInternal");
}
if ((i & 8) != 0) {
function1 = new Function1<NavBackStackEntry, Unit>() { // from class: androidx.navigation.NavController$navigateInternal$1
/* renamed from: invoke, reason: avoid collision after fix types in other method */
public final void invoke2(NavBackStackEntry it) {
Intrinsics.checkNotNullParameter(it, "it");
}
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Unit invoke(NavBackStackEntry navBackStackEntry) {
invoke2(navBackStackEntry);
return Unit.INSTANCE;
}
};
}
navController.navigateInternal(navigator, list, navOptions, extras, function1);
}
private final void navigateInternal(Navigator<? extends NavDestination> navigator, List<NavBackStackEntry> list, NavOptions navOptions, Navigator.Extras extras, Function1<? super NavBackStackEntry, Unit> function1) {
this.addToBackStackHandler = function1;
navigator.navigate(list, navOptions, extras);
this.addToBackStackHandler = null;
}
/* JADX WARN: Multi-variable type inference failed */
static /* synthetic */ void popBackStackInternal$default(NavController navController, Navigator navigator, NavBackStackEntry navBackStackEntry, boolean z, Function1 function1, int i, Object obj) {
if (obj != null) {
throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: popBackStackInternal");
}
if ((i & 4) != 0) {
function1 = new Function1<NavBackStackEntry, Unit>() { // from class: androidx.navigation.NavController$popBackStackInternal$1
/* renamed from: invoke, reason: avoid collision after fix types in other method */
public final void invoke2(NavBackStackEntry it) {
Intrinsics.checkNotNullParameter(it, "it");
}
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Unit invoke(NavBackStackEntry navBackStackEntry2) {
invoke2(navBackStackEntry2);
return Unit.INSTANCE;
}
};
}
navController.popBackStackInternal(navigator, navBackStackEntry, z, function1);
}
private final void popBackStackInternal(Navigator<? extends NavDestination> navigator, NavBackStackEntry navBackStackEntry, boolean z, Function1<? super NavBackStackEntry, Unit> function1) {
this.popFromBackStackHandler = function1;
navigator.popBackStack(navBackStackEntry, z);
this.popFromBackStackHandler = null;
}
/* JADX INFO: Access modifiers changed from: private */
/* compiled from: NavController.kt */
@Metadata(d1 = {"\u00004\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u000b\n\u0002\b\u0004\b\u0082\u0004\u0018\u00002\u00020\u0001B\u0015\u0012\u000e\u0010\u0002\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00040\u0003¢\u0006\u0002\u0010\u0005J\u000e\u0010\b\u001a\u00020\t2\u0006\u0010\n\u001a\u00020\u000bJ\u001a\u0010\f\u001a\u00020\u000b2\u0006\u0010\r\u001a\u00020\u00042\b\u0010\u000e\u001a\u0004\u0018\u00010\u000fH\u0016J\u0010\u0010\u0010\u001a\u00020\t2\u0006\u0010\u0011\u001a\u00020\u000bH\u0016J\u0018\u0010\u0012\u001a\u00020\t2\u0006\u0010\u0013\u001a\u00020\u000b2\u0006\u0010\u0014\u001a\u00020\u0015H\u0016J\u0018\u0010\u0016\u001a\u00020\t2\u0006\u0010\u0013\u001a\u00020\u000b2\u0006\u0010\u0014\u001a\u00020\u0015H\u0016J\u0010\u0010\u0017\u001a\u00020\t2\u0006\u0010\u0011\u001a\u00020\u000bH\u0016J\u0010\u0010\u0018\u001a\u00020\t2\u0006\u0010\n\u001a\u00020\u000bH\u0016R\u0019\u0010\u0002\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00040\u0003¢\u0006\b\n\u0000\u001a\u0004\b\u0006\u0010\u0007¨\u0006\u0019"}, d2 = {"Landroidx/navigation/NavController$NavControllerNavigatorState;", "Landroidx/navigation/NavigatorState;", "navigator", "Landroidx/navigation/Navigator;", "Landroidx/navigation/NavDestination;", "(Landroidx/navigation/NavController;Landroidx/navigation/Navigator;)V", "getNavigator", "()Landroidx/navigation/Navigator;", "addInternal", "", "backStackEntry", "Landroidx/navigation/NavBackStackEntry;", "createBackStackEntry", "destination", "arguments", "Landroid/os/Bundle;", "markTransitionComplete", "entry", "pop", "popUpTo", "saveState", "", "popWithTransition", "prepareForTransition", "push", "navigation-runtime_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes2.dex */
public final class NavControllerNavigatorState extends NavigatorState {
private final Navigator<? extends NavDestination> navigator;
final /* synthetic */ NavController this$0;
public final Navigator<? extends NavDestination> getNavigator() {
return this.navigator;
}
public NavControllerNavigatorState(NavController navController, Navigator<? extends NavDestination> navigator) {
Intrinsics.checkNotNullParameter(navigator, "navigator");
this.this$0 = navController;
this.navigator = navigator;
}
@Override // androidx.navigation.NavigatorState
public void push(NavBackStackEntry backStackEntry) {
Intrinsics.checkNotNullParameter(backStackEntry, "backStackEntry");
Navigator navigator = this.this$0._navigatorProvider.getNavigator(backStackEntry.getDestination().getNavigatorName());
if (Intrinsics.areEqual(navigator, this.navigator)) {
Function1 function1 = this.this$0.addToBackStackHandler;
if (function1 != null) {
function1.invoke(backStackEntry);
addInternal(backStackEntry);
return;
} else {
Log.i(NavController.TAG, "Ignoring add of destination " + backStackEntry.getDestination() + " outside of the call to navigate(). ");
return;
}
}
Object obj = this.this$0.navigatorState.get(navigator);
if (obj == null) {
throw new IllegalStateException(("NavigatorBackStack for " + backStackEntry.getDestination().getNavigatorName() + " should already be created").toString());
}
((NavControllerNavigatorState) obj).push(backStackEntry);
}
public final void addInternal(NavBackStackEntry backStackEntry) {
Intrinsics.checkNotNullParameter(backStackEntry, "backStackEntry");
super.push(backStackEntry);
}
@Override // androidx.navigation.NavigatorState
public NavBackStackEntry createBackStackEntry(NavDestination destination, Bundle arguments) {
Intrinsics.checkNotNullParameter(destination, "destination");
return NavBackStackEntry.Companion.create$default(NavBackStackEntry.INSTANCE, this.this$0.getContext(), destination, arguments, this.this$0.getHostLifecycleState$navigation_runtime_release(), this.this$0.viewModel, null, null, 96, null);
}
@Override // androidx.navigation.NavigatorState
public void pop(final NavBackStackEntry popUpTo, final boolean saveState) {
Intrinsics.checkNotNullParameter(popUpTo, "popUpTo");
Navigator navigator = this.this$0._navigatorProvider.getNavigator(popUpTo.getDestination().getNavigatorName());
if (Intrinsics.areEqual(navigator, this.navigator)) {
Function1 function1 = this.this$0.popFromBackStackHandler;
if (function1 != null) {
function1.invoke(popUpTo);
super.pop(popUpTo, saveState);
return;
} else {
this.this$0.popBackStackFromNavigator$navigation_runtime_release(popUpTo, new Function0<Unit>() { // from class: androidx.navigation.NavController$NavControllerNavigatorState$pop$1
/* JADX INFO: Access modifiers changed from: package-private */
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(0);
}
@Override // kotlin.jvm.functions.Function0
public /* bridge */ /* synthetic */ Unit invoke() {
invoke2();
return Unit.INSTANCE;
}
/* renamed from: invoke, reason: avoid collision after fix types in other method */
public final void invoke2() {
super/*androidx.navigation.NavigatorState*/.pop(popUpTo, saveState);
}
});
return;
}
}
Object obj = this.this$0.navigatorState.get(navigator);
Intrinsics.checkNotNull(obj);
((NavControllerNavigatorState) obj).pop(popUpTo, saveState);
}
@Override // androidx.navigation.NavigatorState
public void popWithTransition(NavBackStackEntry popUpTo, boolean saveState) {
Intrinsics.checkNotNullParameter(popUpTo, "popUpTo");
super.popWithTransition(popUpTo, saveState);
this.this$0.entrySavedState.put(popUpTo, Boolean.valueOf(saveState));
}
@Override // androidx.navigation.NavigatorState
public void markTransitionComplete(NavBackStackEntry entry) {
NavControllerViewModel navControllerViewModel;
Intrinsics.checkNotNullParameter(entry, "entry");
boolean areEqual = Intrinsics.areEqual(this.this$0.entrySavedState.get(entry), (Object) true);
super.markTransitionComplete(entry);
this.this$0.entrySavedState.remove(entry);
if (!this.this$0.backQueue.contains(entry)) {
this.this$0.unlinkChildFromParent$navigation_runtime_release(entry);
if (entry.getLifecycle().getState().isAtLeast(Lifecycle.State.CREATED)) {
entry.setMaxLifecycle(Lifecycle.State.DESTROYED);
}
ArrayDeque arrayDeque = this.this$0.backQueue;
if (!(arrayDeque instanceof Collection) || !arrayDeque.isEmpty()) {
Iterator<E> it = arrayDeque.iterator();
while (it.hasNext()) {
if (Intrinsics.areEqual(((NavBackStackEntry) it.next()).getId(), entry.getId())) {
break;
}
}
}
if (!areEqual && (navControllerViewModel = this.this$0.viewModel) != null) {
navControllerViewModel.clear(entry.getId());
}
this.this$0.updateBackStackLifecycle$navigation_runtime_release();
this.this$0._visibleEntries.tryEmit(this.this$0.populateVisibleEntries$navigation_runtime_release());
return;
}
if (getIsNavigating()) {
return;
}
this.this$0.updateBackStackLifecycle$navigation_runtime_release();
this.this$0._currentBackStack.tryEmit(CollectionsKt.toMutableList((Collection) this.this$0.backQueue));
this.this$0._visibleEntries.tryEmit(this.this$0.populateVisibleEntries$navigation_runtime_release());
}
@Override // androidx.navigation.NavigatorState
public void prepareForTransition(NavBackStackEntry entry) {
Intrinsics.checkNotNullParameter(entry, "entry");
super.prepareForTransition(entry);
if (this.this$0.backQueue.contains(entry)) {
entry.setMaxLifecycle(Lifecycle.State.STARTED);
return;
}
throw new IllegalStateException("Cannot transition entry that is not in the back stack");
}
}
public void addOnDestinationChangedListener(OnDestinationChangedListener listener) {
Intrinsics.checkNotNullParameter(listener, "listener");
this.onDestinationChangedListeners.add(listener);
if (!this.backQueue.isEmpty()) {
NavBackStackEntry last = this.backQueue.last();
listener.onDestinationChanged(this, last.getDestination(), last.getArguments());
}
}
public void removeOnDestinationChangedListener(OnDestinationChangedListener listener) {
Intrinsics.checkNotNullParameter(listener, "listener");
this.onDestinationChangedListeners.remove(listener);
}
public boolean popBackStack() {
if (this.backQueue.isEmpty()) {
return false;
}
NavDestination currentDestination = getCurrentDestination();
Intrinsics.checkNotNull(currentDestination);
return popBackStack(currentDestination.getId(), true);
}
public boolean popBackStack(int destinationId, boolean inclusive) {
return popBackStack(destinationId, inclusive, false);
}
public boolean popBackStack(int destinationId, boolean inclusive, boolean saveState) {
return popBackStackInternal(destinationId, inclusive, saveState) && dispatchOnDestinationChanged();
}
public static /* synthetic */ boolean popBackStack$default(NavController navController, String str, boolean z, boolean z2, int i, Object obj) {
if (obj != null) {
throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: popBackStack");
}
if ((i & 4) != 0) {
z2 = false;
}
return navController.popBackStack(str, z, z2);
}
public final boolean popBackStack(String route, boolean inclusive, boolean saveState) {
Intrinsics.checkNotNullParameter(route, "route");
return popBackStackInternal(route, inclusive, saveState) && dispatchOnDestinationChanged();
}
static /* synthetic */ boolean popBackStackInternal$default(NavController navController, int i, boolean z, boolean z2, int i2, Object obj) {
if (obj != null) {
throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: popBackStackInternal");
}
if ((i2 & 4) != 0) {
z2 = false;
}
return navController.popBackStackInternal(i, z, z2);
}
private final boolean popBackStackInternal(int destinationId, boolean inclusive, boolean saveState) {
NavDestination navDestination;
if (this.backQueue.isEmpty()) {
return false;
}
ArrayList arrayList = new ArrayList();
Iterator it = CollectionsKt.reversed(this.backQueue).iterator();
while (true) {
if (!it.hasNext()) {
navDestination = null;
break;
}
navDestination = ((NavBackStackEntry) it.next()).getDestination();
Navigator navigator = this._navigatorProvider.getNavigator(navDestination.getNavigatorName());
if (inclusive || navDestination.getId() != destinationId) {
arrayList.add(navigator);
}
if (navDestination.getId() == destinationId) {
break;
}
}
if (navDestination == null) {
Log.i(TAG, "Ignoring popBackStack to destination " + NavDestination.INSTANCE.getDisplayName(this.context, destinationId) + " as it was not found on the current back stack");
return false;
}
return executePopOperations(arrayList, navDestination, inclusive, saveState);
}
private final boolean popBackStackInternal(String route, boolean inclusive, boolean saveState) {
NavBackStackEntry navBackStackEntry;
if (this.backQueue.isEmpty()) {
return false;
}
ArrayList arrayList = new ArrayList();
ArrayDeque<NavBackStackEntry> arrayDeque = this.backQueue;
ListIterator<NavBackStackEntry> listIterator = arrayDeque.listIterator(arrayDeque.size());
while (true) {
if (!listIterator.hasPrevious()) {
navBackStackEntry = null;
break;
}
navBackStackEntry = listIterator.previous();
NavBackStackEntry navBackStackEntry2 = navBackStackEntry;
boolean hasRoute = navBackStackEntry2.getDestination().hasRoute(route, navBackStackEntry2.getArguments());
if (inclusive || !hasRoute) {
arrayList.add(this._navigatorProvider.getNavigator(navBackStackEntry2.getDestination().getNavigatorName()));
}
if (hasRoute) {
break;
}
}
NavBackStackEntry navBackStackEntry3 = navBackStackEntry;
NavDestination destination = navBackStackEntry3 != null ? navBackStackEntry3.getDestination() : null;
if (destination == null) {
Log.i(TAG, "Ignoring popBackStack to route " + route + " as it was not found on the current back stack");
return false;
}
return executePopOperations(arrayList, destination, inclusive, saveState);
}
private final boolean executePopOperations(List<? extends Navigator<?>> popOperations, NavDestination foundDestination, boolean inclusive, final boolean saveState) {
final Ref.BooleanRef booleanRef = new Ref.BooleanRef();
final ArrayDeque<NavBackStackEntryState> arrayDeque = new ArrayDeque<>();
Iterator<? extends Navigator<?>> it = popOperations.iterator();
while (it.hasNext()) {
Navigator<? extends NavDestination> navigator = (Navigator) it.next();
final Ref.BooleanRef booleanRef2 = new Ref.BooleanRef();
popBackStackInternal(navigator, this.backQueue.last(), saveState, new Function1<NavBackStackEntry, Unit>() { // from class: androidx.navigation.NavController$executePopOperations$1
/* JADX INFO: Access modifiers changed from: package-private */
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(1);
}
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Unit invoke(NavBackStackEntry navBackStackEntry) {
invoke2(navBackStackEntry);
return Unit.INSTANCE;
}
/* renamed from: invoke, reason: avoid collision after fix types in other method */
public final void invoke2(NavBackStackEntry entry) {
Intrinsics.checkNotNullParameter(entry, "entry");
Ref.BooleanRef.this.element = true;
booleanRef.element = true;
this.popEntryFromBackStack(entry, saveState, arrayDeque);
}
});
if (!booleanRef2.element) {
break;
}
}
if (saveState) {
if (!inclusive) {
for (NavDestination navDestination : SequencesKt.takeWhile(SequencesKt.generateSequence(foundDestination, new Function1<NavDestination, NavDestination>() { // from class: androidx.navigation.NavController$executePopOperations$2
@Override // kotlin.jvm.functions.Function1
public final NavDestination invoke(NavDestination destination) {
Intrinsics.checkNotNullParameter(destination, "destination");
NavGraph parent = destination.getParent();
if (parent == null || parent.getStartDestId() != destination.getId()) {
return null;
}
return destination.getParent();
}
}), new Function1<NavDestination, Boolean>() { // from class: androidx.navigation.NavController$executePopOperations$3
/* JADX INFO: Access modifiers changed from: package-private */
{
super(1);
}
@Override // kotlin.jvm.functions.Function1
public final Boolean invoke(NavDestination destination) {
Map map;
Intrinsics.checkNotNullParameter(destination, "destination");
map = NavController.this.backStackMap;
return Boolean.valueOf(!map.containsKey(Integer.valueOf(destination.getId())));
}
})) {
Map<Integer, String> map = this.backStackMap;
Integer valueOf = Integer.valueOf(navDestination.getId());
NavBackStackEntryState firstOrNull = arrayDeque.firstOrNull();
map.put(valueOf, firstOrNull != null ? firstOrNull.getId() : null);
}
}
if (!arrayDeque.isEmpty()) {
NavBackStackEntryState first = arrayDeque.first();
Iterator it2 = SequencesKt.takeWhile(SequencesKt.generateSequence(findDestination(first.getDestinationId()), new Function1<NavDestination, NavDestination>() { // from class: androidx.navigation.NavController$executePopOperations$5
@Override // kotlin.jvm.functions.Function1
public final NavDestination invoke(NavDestination destination) {
Intrinsics.checkNotNullParameter(destination, "destination");
NavGraph parent = destination.getParent();
if (parent == null || parent.getStartDestId() != destination.getId()) {
return null;
}
return destination.getParent();
}
}), new Function1<NavDestination, Boolean>() { // from class: androidx.navigation.NavController$executePopOperations$6
/* JADX INFO: Access modifiers changed from: package-private */
{
super(1);
}
@Override // kotlin.jvm.functions.Function1
public final Boolean invoke(NavDestination destination) {
Map map2;
Intrinsics.checkNotNullParameter(destination, "destination");
map2 = NavController.this.backStackMap;
return Boolean.valueOf(!map2.containsKey(Integer.valueOf(destination.getId())));
}
}).iterator();
while (it2.hasNext()) {
this.backStackMap.put(Integer.valueOf(((NavDestination) it2.next()).getId()), first.getId());
}
this.backStackStates.put(first.getId(), arrayDeque);
}
}
updateOnBackPressedCallbackEnabled();
return booleanRef.element;
}
public final void popBackStackFromNavigator$navigation_runtime_release(NavBackStackEntry popUpTo, Function0<Unit> onComplete) {
Intrinsics.checkNotNullParameter(popUpTo, "popUpTo");
Intrinsics.checkNotNullParameter(onComplete, "onComplete");
int indexOf = this.backQueue.indexOf(popUpTo);
if (indexOf < 0) {
Log.i(TAG, "Ignoring pop of " + popUpTo + " as it was not found on the current back stack");
return;
}
int i = indexOf + 1;
if (i != this.backQueue.size()) {
popBackStackInternal(this.backQueue.get(i).getDestination().getId(), true, false);
}
popEntryFromBackStack$default(this, popUpTo, false, null, 6, null);
onComplete.invoke();
updateOnBackPressedCallbackEnabled();
dispatchOnDestinationChanged();
}
/* JADX WARN: Multi-variable type inference failed */
static /* synthetic */ void popEntryFromBackStack$default(NavController navController, NavBackStackEntry navBackStackEntry, boolean z, ArrayDeque arrayDeque, int i, Object obj) {
if (obj != null) {
throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: popEntryFromBackStack");
}
if ((i & 2) != 0) {
z = false;
}
if ((i & 4) != 0) {
arrayDeque = new ArrayDeque();
}
navController.popEntryFromBackStack(navBackStackEntry, z, arrayDeque);
}
/* JADX INFO: Access modifiers changed from: private */
public final void popEntryFromBackStack(NavBackStackEntry popUpTo, boolean saveState, ArrayDeque<NavBackStackEntryState> savedState) {
NavControllerViewModel navControllerViewModel;
StateFlow<Set<NavBackStackEntry>> transitionsInProgress;
Set<NavBackStackEntry> value;
NavBackStackEntry last = this.backQueue.last();
if (!Intrinsics.areEqual(last, popUpTo)) {
throw new IllegalStateException(("Attempted to pop " + popUpTo.getDestination() + ", which is not the top of the back stack (" + last.getDestination() + ')').toString());
}
this.backQueue.removeLast();
NavControllerNavigatorState navControllerNavigatorState = this.navigatorState.get(get_navigatorProvider().getNavigator(last.getDestination().getNavigatorName()));
boolean z = true;
if ((navControllerNavigatorState == null || (transitionsInProgress = navControllerNavigatorState.getTransitionsInProgress()) == null || (value = transitionsInProgress.getValue()) == null || !value.contains(last)) && !this.parentToChildCount.containsKey(last)) {
z = false;
}
if (last.getLifecycle().getState().isAtLeast(Lifecycle.State.CREATED)) {
if (saveState) {
last.setMaxLifecycle(Lifecycle.State.CREATED);
savedState.addFirst(new NavBackStackEntryState(last));
}
if (!z) {
last.setMaxLifecycle(Lifecycle.State.DESTROYED);
unlinkChildFromParent$navigation_runtime_release(last);
} else {
last.setMaxLifecycle(Lifecycle.State.CREATED);
}
}
if (saveState || z || (navControllerViewModel = this.viewModel) == null) {
return;
}
navControllerViewModel.clear(last.getId());
}
public final boolean clearBackStack(String route) {
Intrinsics.checkNotNullParameter(route, "route");
return clearBackStackInternal(route) && dispatchOnDestinationChanged();
}
public final boolean clearBackStack(int destinationId) {
return clearBackStackInternal(destinationId) && dispatchOnDestinationChanged();
}
private final boolean clearBackStackInternal(int destinationId) {
Iterator<T> it = this.navigatorState.values().iterator();
while (it.hasNext()) {
((NavControllerNavigatorState) it.next()).setNavigating(true);
}
boolean restoreStateInternal = restoreStateInternal(destinationId, null, NavOptionsBuilderKt.navOptions(new Function1<NavOptionsBuilder, Unit>() { // from class: androidx.navigation.NavController$clearBackStackInternal$restored$1
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Unit invoke(NavOptionsBuilder navOptionsBuilder) {
invoke2(navOptionsBuilder);
return Unit.INSTANCE;
}
/* renamed from: invoke, reason: avoid collision after fix types in other method */
public final void invoke2(NavOptionsBuilder navOptions) {
Intrinsics.checkNotNullParameter(navOptions, "$this$navOptions");
navOptions.setRestoreState(true);
}
}), null);
Iterator<T> it2 = this.navigatorState.values().iterator();
while (it2.hasNext()) {
((NavControllerNavigatorState) it2.next()).setNavigating(false);
}
return restoreStateInternal && popBackStackInternal(destinationId, true, false);
}
private final boolean clearBackStackInternal(String route) {
Iterator<T> it = this.navigatorState.values().iterator();
while (it.hasNext()) {
((NavControllerNavigatorState) it.next()).setNavigating(true);
}
boolean restoreStateInternal = restoreStateInternal(route);
Iterator<T> it2 = this.navigatorState.values().iterator();
while (it2.hasNext()) {
((NavControllerNavigatorState) it2.next()).setNavigating(false);
}
return restoreStateInternal && popBackStackInternal(route, true, false);
}
public boolean navigateUp() {
Intent intent;
if (getDestinationCountOnBackStack() == 1) {
Activity activity = this.activity;
Bundle extras = (activity == null || (intent = activity.getIntent()) == null) ? null : intent.getExtras();
if ((extras != null ? extras.getIntArray(KEY_DEEP_LINK_IDS) : null) != null) {
return tryRelaunchUpToExplicitStack();
}
return tryRelaunchUpToGeneratedStack();
}
return popBackStack();
}
private final boolean tryRelaunchUpToExplicitStack() {
int i = 0;
if (!this.deepLinkHandled) {
return false;
}
Activity activity = this.activity;
Intrinsics.checkNotNull(activity);
Intent intent = activity.getIntent();
Bundle extras = intent.getExtras();
Intrinsics.checkNotNull(extras);
int[] intArray = extras.getIntArray(KEY_DEEP_LINK_IDS);
Intrinsics.checkNotNull(intArray);
List<Integer> mutableList = ArraysKt.toMutableList(intArray);
ArrayList parcelableArrayList = extras.getParcelableArrayList(KEY_DEEP_LINK_ARGS);
int intValue = ((Number) CollectionsKt.removeLast(mutableList)).intValue();
if (parcelableArrayList != null) {
}
if (mutableList.isEmpty()) {
return false;
}
NavDestination findDestination = findDestination(getGraph(), intValue);
if (findDestination instanceof NavGraph) {
intValue = NavGraph.INSTANCE.findStartDestination((NavGraph) findDestination).getId();
}
NavDestination currentDestination = getCurrentDestination();
if (currentDestination == null || intValue != currentDestination.getId()) {
return false;
}
NavDeepLinkBuilder createDeepLink = createDeepLink();
Bundle bundleOf = BundleKt.bundleOf(TuplesKt.to(KEY_DEEP_LINK_INTENT, intent));
Bundle bundle = extras.getBundle(KEY_DEEP_LINK_EXTRAS);
if (bundle != null) {
bundleOf.putAll(bundle);
}
createDeepLink.setArguments(bundleOf);
for (Object obj : mutableList) {
int i2 = i + 1;
if (i < 0) {
CollectionsKt.throwIndexOverflow();
}
createDeepLink.addDestination(((Number) obj).intValue(), parcelableArrayList != null ? (Bundle) parcelableArrayList.get(i) : null);
i = i2;
}
createDeepLink.createTaskStackBuilder().startActivities();
Activity activity2 = this.activity;
if (activity2 != null) {
activity2.finish();
}
return true;
}
private final boolean tryRelaunchUpToGeneratedStack() {
NavDestination currentDestination = getCurrentDestination();
Intrinsics.checkNotNull(currentDestination);
int id = currentDestination.getId();
for (NavGraph parent = currentDestination.getParent(); parent != null; parent = parent.getParent()) {
if (parent.getStartDestId() != id) {
Bundle bundle = new Bundle();
Activity activity = this.activity;
if (activity != null) {
Intrinsics.checkNotNull(activity);
if (activity.getIntent() != null) {
Activity activity2 = this.activity;
Intrinsics.checkNotNull(activity2);
if (activity2.getIntent().getData() != null) {
Activity activity3 = this.activity;
Intrinsics.checkNotNull(activity3);
bundle.putParcelable(KEY_DEEP_LINK_INTENT, activity3.getIntent());
NavGraph navGraph = this._graph;
Intrinsics.checkNotNull(navGraph);
Activity activity4 = this.activity;
Intrinsics.checkNotNull(activity4);
Intent intent = activity4.getIntent();
Intrinsics.checkNotNullExpressionValue(intent, "activity!!.intent");
NavDestination.DeepLinkMatch matchDeepLink = navGraph.matchDeepLink(new NavDeepLinkRequest(intent));
if ((matchDeepLink != null ? matchDeepLink.getMatchingArgs() : null) != null) {
bundle.putAll(matchDeepLink.getDestination().addInDefaultArgs(matchDeepLink.getMatchingArgs()));
}
}
}
}
NavDeepLinkBuilder.setDestination$default(new NavDeepLinkBuilder(this), parent.getId(), (Bundle) null, 2, (Object) null).setArguments(bundle).createTaskStackBuilder().startActivities();
Activity activity5 = this.activity;
if (activity5 == null) {
return true;
}
activity5.finish();
return true;
}
id = parent.getId();
}
return false;
}
private final int getDestinationCountOnBackStack() {
ArrayDeque<NavBackStackEntry> arrayDeque = this.backQueue;
int i = 0;
if (!(arrayDeque instanceof Collection) || !arrayDeque.isEmpty()) {
Iterator<NavBackStackEntry> it = arrayDeque.iterator();
while (it.hasNext()) {
if ((!(it.next().getDestination() instanceof NavGraph)) && (i = i + 1) < 0) {
CollectionsKt.throwCountOverflow();
}
}
}
return i;
}
private final boolean dispatchOnDestinationChanged() {
while (!this.backQueue.isEmpty() && (this.backQueue.last().getDestination() instanceof NavGraph)) {
popEntryFromBackStack$default(this, this.backQueue.last(), false, null, 6, null);
}
NavBackStackEntry lastOrNull = this.backQueue.lastOrNull();
if (lastOrNull != null) {
this.backStackEntriesToDispatch.add(lastOrNull);
}
this.dispatchReentrantCount++;
updateBackStackLifecycle$navigation_runtime_release();
int i = this.dispatchReentrantCount - 1;
this.dispatchReentrantCount = i;
if (i == 0) {
List<NavBackStackEntry> mutableList = CollectionsKt.toMutableList((Collection) this.backStackEntriesToDispatch);
this.backStackEntriesToDispatch.clear();
for (NavBackStackEntry navBackStackEntry : mutableList) {
Iterator<OnDestinationChangedListener> it = this.onDestinationChangedListeners.iterator();
while (it.hasNext()) {
it.next().onDestinationChanged(this, navBackStackEntry.getDestination(), navBackStackEntry.getArguments());
}
this._currentBackStackEntryFlow.tryEmit(navBackStackEntry);
}
this._currentBackStack.tryEmit(CollectionsKt.toMutableList((Collection) this.backQueue));
this._visibleEntries.tryEmit(populateVisibleEntries$navigation_runtime_release());
}
return lastOrNull != null;
}
public final void updateBackStackLifecycle$navigation_runtime_release() {
NavGraph navGraph;
AtomicInteger atomicInteger;
StateFlow<Set<NavBackStackEntry>> transitionsInProgress;
Set<NavBackStackEntry> value;
List<NavBackStackEntry> mutableList = CollectionsKt.toMutableList((Collection) this.backQueue);
if (mutableList.isEmpty()) {
return;
}
NavGraph destination = ((NavBackStackEntry) CollectionsKt.last(mutableList)).getDestination();
if (destination instanceof FloatingWindow) {
Iterator it = CollectionsKt.reversed(mutableList).iterator();
while (it.hasNext()) {
navGraph = ((NavBackStackEntry) it.next()).getDestination();
if (!(navGraph instanceof NavGraph) && !(navGraph instanceof FloatingWindow)) {
break;
}
}
}
navGraph = null;
HashMap hashMap = new HashMap();
for (NavBackStackEntry navBackStackEntry : CollectionsKt.reversed(mutableList)) {
Lifecycle.State maxLifecycle = navBackStackEntry.getMaxLifecycle();
NavDestination destination2 = navBackStackEntry.getDestination();
if (destination != null && destination2.getId() == destination.getId()) {
if (maxLifecycle != Lifecycle.State.RESUMED) {
NavControllerNavigatorState navControllerNavigatorState = this.navigatorState.get(get_navigatorProvider().getNavigator(navBackStackEntry.getDestination().getNavigatorName()));
if (!Intrinsics.areEqual((Object) ((navControllerNavigatorState == null || (transitionsInProgress = navControllerNavigatorState.getTransitionsInProgress()) == null || (value = transitionsInProgress.getValue()) == null) ? null : Boolean.valueOf(value.contains(navBackStackEntry))), (Object) true) && ((atomicInteger = this.parentToChildCount.get(navBackStackEntry)) == null || atomicInteger.get() != 0)) {
hashMap.put(navBackStackEntry, Lifecycle.State.RESUMED);
} else {
hashMap.put(navBackStackEntry, Lifecycle.State.STARTED);
}
}
destination = destination.getParent();
} else if (navGraph != null && destination2.getId() == navGraph.getId()) {
if (maxLifecycle == Lifecycle.State.RESUMED) {
navBackStackEntry.setMaxLifecycle(Lifecycle.State.STARTED);
} else if (maxLifecycle != Lifecycle.State.STARTED) {
hashMap.put(navBackStackEntry, Lifecycle.State.STARTED);
}
navGraph = navGraph.getParent();
} else {
navBackStackEntry.setMaxLifecycle(Lifecycle.State.CREATED);
}
}
for (NavBackStackEntry navBackStackEntry2 : mutableList) {
Lifecycle.State state = (Lifecycle.State) hashMap.get(navBackStackEntry2);
if (state != null) {
navBackStackEntry2.setMaxLifecycle(state);
} else {
navBackStackEntry2.updateState();
}
}
}
public final List<NavBackStackEntry> populateVisibleEntries$navigation_runtime_release() {
ArrayList arrayList = new ArrayList();
Iterator<T> it = this.navigatorState.values().iterator();
while (it.hasNext()) {
ArrayList arrayList2 = arrayList;
Set<NavBackStackEntry> value = ((NavControllerNavigatorState) it.next()).getTransitionsInProgress().getValue();
ArrayList arrayList3 = new ArrayList();
for (Object obj : value) {
NavBackStackEntry navBackStackEntry = (NavBackStackEntry) obj;
if (!arrayList.contains(navBackStackEntry) && !navBackStackEntry.getMaxLifecycle().isAtLeast(Lifecycle.State.STARTED)) {
arrayList3.add(obj);
}
}
CollectionsKt.addAll(arrayList2, arrayList3);
}
ArrayList arrayList4 = arrayList;
ArrayDeque<NavBackStackEntry> arrayDeque = this.backQueue;
ArrayList arrayList5 = new ArrayList();
for (NavBackStackEntry navBackStackEntry2 : arrayDeque) {
NavBackStackEntry navBackStackEntry3 = navBackStackEntry2;
if (!arrayList.contains(navBackStackEntry3) && navBackStackEntry3.getMaxLifecycle().isAtLeast(Lifecycle.State.STARTED)) {
arrayList5.add(navBackStackEntry2);
}
}
CollectionsKt.addAll(arrayList4, arrayList5);
ArrayList arrayList6 = new ArrayList();
for (Object obj2 : arrayList) {
if (!(((NavBackStackEntry) obj2).getDestination() instanceof NavGraph)) {
arrayList6.add(obj2);
}
}
return arrayList6;
}
public NavInflater getNavInflater() {
return (NavInflater) this.navInflater.getValue();
}
public void setGraph(int graphResId) {
setGraph(getNavInflater().inflate(graphResId), (Bundle) null);
}
public void setGraph(int graphResId, Bundle startDestinationArgs) {
setGraph(getNavInflater().inflate(graphResId), startDestinationArgs);
}
public void setGraph(NavGraph graph, Bundle startDestinationArgs) {
Intrinsics.checkNotNullParameter(graph, "graph");
if (!Intrinsics.areEqual(this._graph, graph)) {
NavGraph navGraph = this._graph;
if (navGraph != null) {
for (Integer id : new ArrayList(this.backStackMap.keySet())) {
Intrinsics.checkNotNullExpressionValue(id, "id");
clearBackStackInternal(id.intValue());
}
popBackStackInternal$default(this, navGraph.getId(), true, false, 4, null);
}
this._graph = graph;
onGraphCreated(startDestinationArgs);
return;
}
int size = graph.getNodes().size();
for (int i = 0; i < size; i++) {
NavDestination valueAt = graph.getNodes().valueAt(i);
NavGraph navGraph2 = this._graph;
Intrinsics.checkNotNull(navGraph2);
int keyAt = navGraph2.getNodes().keyAt(i);
NavGraph navGraph3 = this._graph;
Intrinsics.checkNotNull(navGraph3);
navGraph3.getNodes().replace(keyAt, valueAt);
}
for (NavBackStackEntry navBackStackEntry : this.backQueue) {
List<NavDestination> asReversed = CollectionsKt.asReversed(SequencesKt.toList(NavDestination.INSTANCE.getHierarchy(navBackStackEntry.getDestination())));
NavDestination navDestination = this._graph;
Intrinsics.checkNotNull(navDestination);
for (NavDestination navDestination2 : asReversed) {
navDestination = navDestination;
if (!Intrinsics.areEqual(navDestination2, this._graph) || !Intrinsics.areEqual(navDestination, graph)) {
if (navDestination instanceof NavGraph) {
navDestination = ((NavGraph) navDestination).findNode(navDestination2.getId());
Intrinsics.checkNotNull(navDestination);
}
}
}
navBackStackEntry.setDestination(navDestination);
}
}
private final void onGraphCreated(Bundle startDestinationArgs) {
Activity activity;
ArrayList<String> stringArrayList;
Bundle bundle = this.navigatorStateToRestore;
if (bundle != null && (stringArrayList = bundle.getStringArrayList(KEY_NAVIGATOR_STATE_NAMES)) != null) {
Iterator<String> it = stringArrayList.iterator();
while (it.hasNext()) {
String name = it.next();
NavigatorProvider navigatorProvider = this._navigatorProvider;
Intrinsics.checkNotNullExpressionValue(name, "name");
Navigator navigator = navigatorProvider.getNavigator(name);
Bundle bundle2 = bundle.getBundle(name);
if (bundle2 != null) {
navigator.onRestoreState(bundle2);
}
}
}
Parcelable[] parcelableArr = this.backStackToRestore;
if (parcelableArr != null) {
for (Parcelable parcelable : parcelableArr) {
Intrinsics.checkNotNull(parcelable, "null cannot be cast to non-null type androidx.navigation.NavBackStackEntryState");
NavBackStackEntryState navBackStackEntryState = (NavBackStackEntryState) parcelable;
NavDestination findDestination = findDestination(navBackStackEntryState.getDestinationId());
if (findDestination == null) {
throw new IllegalStateException("Restoring the Navigation back stack failed: destination " + NavDestination.INSTANCE.getDisplayName(this.context, navBackStackEntryState.getDestinationId()) + " cannot be found from the current destination " + getCurrentDestination());
}
NavBackStackEntry instantiate = navBackStackEntryState.instantiate(this.context, findDestination, getHostLifecycleState$navigation_runtime_release(), this.viewModel);
Navigator<? extends NavDestination> navigator2 = this._navigatorProvider.getNavigator(findDestination.getNavigatorName());
Map<Navigator<? extends NavDestination>, NavControllerNavigatorState> map = this.navigatorState;
NavControllerNavigatorState navControllerNavigatorState = map.get(navigator2);
if (navControllerNavigatorState == null) {
navControllerNavigatorState = new NavControllerNavigatorState(this, navigator2);
map.put(navigator2, navControllerNavigatorState);
}
this.backQueue.add(instantiate);
navControllerNavigatorState.addInternal(instantiate);
NavGraph parent = instantiate.getDestination().getParent();
if (parent != null) {
linkChildToParent(instantiate, getBackStackEntry(parent.getId()));
}
}
updateOnBackPressedCallbackEnabled();
this.backStackToRestore = null;
}
Collection<Navigator<? extends NavDestination>> values = this._navigatorProvider.getNavigators().values();
ArrayList<Navigator<? extends NavDestination>> arrayList = new ArrayList();
for (Object obj : values) {
if (!((Navigator) obj).getIsAttached()) {
arrayList.add(obj);
}
}
for (Navigator<? extends NavDestination> navigator3 : arrayList) {
Map<Navigator<? extends NavDestination>, NavControllerNavigatorState> map2 = this.navigatorState;
NavControllerNavigatorState navControllerNavigatorState2 = map2.get(navigator3);
if (navControllerNavigatorState2 == null) {
navControllerNavigatorState2 = new NavControllerNavigatorState(this, navigator3);
map2.put(navigator3, navControllerNavigatorState2);
}
navigator3.onAttach(navControllerNavigatorState2);
}
if (this._graph != null && this.backQueue.isEmpty()) {
if (!this.deepLinkHandled && (activity = this.activity) != null) {
Intrinsics.checkNotNull(activity);
if (handleDeepLink(activity.getIntent())) {
return;
}
}
NavGraph navGraph = this._graph;
Intrinsics.checkNotNull(navGraph);
navigate(navGraph, startDestinationArgs, (NavOptions) null, (Navigator.Extras) null);
return;
}
dispatchOnDestinationChanged();
}
/* JADX WARN: Removed duplicated region for block: B:12:0x003f */
/* JADX WARN: Removed duplicated region for block: B:14:0x0049 */
/* JADX WARN: Removed duplicated region for block: B:92:0x0062 */
/* JADX WARN: Removed duplicated region for block: B:96:0x0046 */
/* JADX WARN: Removed duplicated region for block: B:97:0x0037 */
/* JADX WARN: Removed duplicated region for block: B:9:0x0030 */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public boolean handleDeepLink(android.content.Intent r20) {
/*
Method dump skipped, instructions count: 502
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.navigation.NavController.handleDeepLink(android.content.Intent):boolean");
}
private final String findInvalidDestinationDisplayNameInDeepLink(int[] deepLink) {
NavGraph findNode;
NavGraph navGraph;
NavGraph navGraph2 = this._graph;
int length = deepLink.length;
int i = 0;
while (true) {
if (i >= length) {
return null;
}
int i2 = deepLink[i];
if (i == 0) {
NavGraph navGraph3 = this._graph;
Intrinsics.checkNotNull(navGraph3);
findNode = navGraph3.getId() == i2 ? this._graph : null;
} else {
Intrinsics.checkNotNull(navGraph2);
findNode = navGraph2.findNode(i2);
}
if (findNode == null) {
return NavDestination.INSTANCE.getDisplayName(this.context, i2);
}
if (i != deepLink.length - 1 && (findNode instanceof NavGraph)) {
while (true) {
navGraph = (NavGraph) findNode;
Intrinsics.checkNotNull(navGraph);
if (!(navGraph.findNode(navGraph.getStartDestId()) instanceof NavGraph)) {
break;
}
findNode = navGraph.findNode(navGraph.getStartDestId());
}
navGraph2 = navGraph;
}
i++;
}
}
public NavDestination getCurrentDestination() {
NavBackStackEntry currentBackStackEntry = getCurrentBackStackEntry();
if (currentBackStackEntry != null) {
return currentBackStackEntry.getDestination();
}
return null;
}
public final NavDestination findDestination(int destinationId) {
NavGraph navGraph;
NavGraph navGraph2 = this._graph;
if (navGraph2 == null) {
return null;
}
Intrinsics.checkNotNull(navGraph2);
if (navGraph2.getId() == destinationId) {
return this._graph;
}
NavBackStackEntry lastOrNull = this.backQueue.lastOrNull();
if (lastOrNull == null || (navGraph = lastOrNull.getDestination()) == null) {
NavGraph navGraph3 = this._graph;
Intrinsics.checkNotNull(navGraph3);
navGraph = navGraph3;
}
return findDestination(navGraph, destinationId);
}
private final NavDestination findDestination(NavDestination navDestination, int i) {
NavGraph parent;
if (navDestination.getId() == i) {
return navDestination;
}
if (navDestination instanceof NavGraph) {
parent = (NavGraph) navDestination;
} else {
parent = navDestination.getParent();
Intrinsics.checkNotNull(parent);
}
return parent.findNode(i);
}
public final NavDestination findDestination(String route) {
NavGraph navGraph;
NavGraph parent;
Intrinsics.checkNotNullParameter(route, "route");
NavGraph navGraph2 = this._graph;
if (navGraph2 == null) {
return null;
}
Intrinsics.checkNotNull(navGraph2);
if (!Intrinsics.areEqual(navGraph2.getRoute(), route)) {
NavGraph navGraph3 = this._graph;
Intrinsics.checkNotNull(navGraph3);
if (navGraph3.matchDeepLink(route) == null) {
NavBackStackEntry lastOrNull = this.backQueue.lastOrNull();
if (lastOrNull == null || (navGraph = lastOrNull.getDestination()) == null) {
NavGraph navGraph4 = this._graph;
Intrinsics.checkNotNull(navGraph4);
navGraph = navGraph4;
}
if (navGraph instanceof NavGraph) {
parent = navGraph;
} else {
parent = navGraph.getParent();
Intrinsics.checkNotNull(parent);
}
return parent.findNode(route);
}
}
return this._graph;
}
public void navigate(int resId) {
navigate(resId, (Bundle) null);
}
public void navigate(int resId, Bundle args) {
navigate(resId, args, (NavOptions) null);
}
public void navigate(int resId, Bundle args, NavOptions navOptions) {
navigate(resId, args, navOptions, (Navigator.Extras) null);
}
public void navigate(int resId, Bundle args, NavOptions navOptions, Navigator.Extras navigatorExtras) {
NavGraph destination;
int i;
if (this.backQueue.isEmpty()) {
destination = this._graph;
} else {
destination = this.backQueue.last().getDestination();
}
if (destination == null) {
throw new IllegalStateException("no current navigation node");
}
NavAction action = destination.getAction(resId);
Bundle bundle = null;
if (action != null) {
if (navOptions == null) {
navOptions = action.getNavOptions();
}
i = action.getDestinationId();
Bundle defaultArguments = action.getDefaultArguments();
if (defaultArguments != null) {
bundle = new Bundle();
bundle.putAll(defaultArguments);
}
} else {
i = resId;
}
if (args != null) {
if (bundle == null) {
bundle = new Bundle();
}
bundle.putAll(args);
}
if (i == 0 && navOptions != null && navOptions.getPopUpToId() != -1) {
popBackStack(navOptions.getPopUpToId(), navOptions.getPopUpToInclusive());
return;
}
if (i == 0) {
throw new IllegalArgumentException("Destination id == 0 can only be used in conjunction with a valid navOptions.popUpTo".toString());
}
NavDestination findDestination = findDestination(i);
if (findDestination == null) {
String displayName = NavDestination.INSTANCE.getDisplayName(this.context, i);
if (action != null) {
throw new IllegalArgumentException(("Navigation destination " + displayName + " referenced from action " + NavDestination.INSTANCE.getDisplayName(this.context, resId) + " cannot be found from the current destination " + destination).toString());
}
throw new IllegalArgumentException("Navigation action/destination " + displayName + " cannot be found from the current destination " + destination);
}
navigate(findDestination, bundle, navOptions, navigatorExtras);
}
public void navigate(Uri deepLink) {
Intrinsics.checkNotNullParameter(deepLink, "deepLink");
navigate(new NavDeepLinkRequest(deepLink, null, null));
}
public void navigate(Uri deepLink, NavOptions navOptions) {
Intrinsics.checkNotNullParameter(deepLink, "deepLink");
navigate(new NavDeepLinkRequest(deepLink, null, null), navOptions, (Navigator.Extras) null);
}
public void navigate(Uri deepLink, NavOptions navOptions, Navigator.Extras navigatorExtras) {
Intrinsics.checkNotNullParameter(deepLink, "deepLink");
navigate(new NavDeepLinkRequest(deepLink, null, null), navOptions, navigatorExtras);
}
public void navigate(NavDeepLinkRequest request) {
Intrinsics.checkNotNullParameter(request, "request");
navigate(request, (NavOptions) null);
}
public void navigate(NavDeepLinkRequest request, NavOptions navOptions) {
Intrinsics.checkNotNullParameter(request, "request");
navigate(request, navOptions, (Navigator.Extras) null);
}
public void navigate(NavDeepLinkRequest request, NavOptions navOptions, Navigator.Extras navigatorExtras) {
Intrinsics.checkNotNullParameter(request, "request");
NavGraph navGraph = this._graph;
Intrinsics.checkNotNull(navGraph);
NavDestination.DeepLinkMatch matchDeepLink = navGraph.matchDeepLink(request);
if (matchDeepLink != null) {
Bundle addInDefaultArgs = matchDeepLink.getDestination().addInDefaultArgs(matchDeepLink.getMatchingArgs());
if (addInDefaultArgs == null) {
addInDefaultArgs = new Bundle();
}
NavDestination destination = matchDeepLink.getDestination();
Intent intent = new Intent();
intent.setDataAndType(request.getUri(), request.getMimeType());
intent.setAction(request.getAction());
addInDefaultArgs.putParcelable(KEY_DEEP_LINK_INTENT, intent);
navigate(destination, addInDefaultArgs, navOptions, navigatorExtras);
return;
}
throw new IllegalArgumentException("Navigation destination that matches request " + request + " cannot be found in the navigation graph " + this._graph);
}
private final void navigate(final NavDestination node, Bundle args, NavOptions navOptions, Navigator.Extras navigatorExtras) {
boolean z;
Iterator<T> it = this.navigatorState.values().iterator();
while (it.hasNext()) {
((NavControllerNavigatorState) it.next()).setNavigating(true);
}
final Ref.BooleanRef booleanRef = new Ref.BooleanRef();
boolean popBackStackInternal = (navOptions == null || navOptions.getPopUpToId() == -1) ? false : popBackStackInternal(navOptions.getPopUpToId(), navOptions.getPopUpToInclusive(), navOptions.getPopUpToSaveState());
final Bundle addInDefaultArgs = node.addInDefaultArgs(args);
if (navOptions != null && navOptions.getRestoreState() && this.backStackMap.containsKey(Integer.valueOf(node.getId()))) {
booleanRef.element = restoreStateInternal(node.getId(), addInDefaultArgs, navOptions, navigatorExtras);
z = false;
} else {
z = navOptions != null && navOptions.getSingleTop() && launchSingleTopInternal(node, args);
if (!z) {
navigateInternal(this._navigatorProvider.getNavigator(node.getNavigatorName()), CollectionsKt.listOf(NavBackStackEntry.Companion.create$default(NavBackStackEntry.INSTANCE, this.context, node, addInDefaultArgs, getHostLifecycleState$navigation_runtime_release(), this.viewModel, null, null, 96, null)), navOptions, navigatorExtras, new Function1<NavBackStackEntry, Unit>() { // from class: androidx.navigation.NavController$navigate$4
/* JADX INFO: Access modifiers changed from: package-private */
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(1);
}
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Unit invoke(NavBackStackEntry navBackStackEntry) {
invoke2(navBackStackEntry);
return Unit.INSTANCE;
}
/* renamed from: invoke, reason: avoid collision after fix types in other method */
public final void invoke2(NavBackStackEntry it2) {
Intrinsics.checkNotNullParameter(it2, "it");
Ref.BooleanRef.this.element = true;
NavController.addEntryToBackStack$default(this, node, addInDefaultArgs, it2, null, 8, null);
}
});
}
}
updateOnBackPressedCallbackEnabled();
Iterator<T> it2 = this.navigatorState.values().iterator();
while (it2.hasNext()) {
((NavControllerNavigatorState) it2.next()).setNavigating(false);
}
if (popBackStackInternal || booleanRef.element || z) {
dispatchOnDestinationChanged();
} else {
updateBackStackLifecycle$navigation_runtime_release();
}
}
private final boolean launchSingleTopInternal(NavDestination node, Bundle args) {
NavDestination destination;
int i;
NavBackStackEntry currentBackStackEntry = getCurrentBackStackEntry();
int id = node instanceof NavGraph ? NavGraph.INSTANCE.findStartDestination((NavGraph) node).getId() : node.getId();
if (currentBackStackEntry == null || (destination = currentBackStackEntry.getDestination()) == null || id != destination.getId()) {
return false;
}
ArrayDeque arrayDeque = new ArrayDeque();
ArrayDeque<NavBackStackEntry> arrayDeque2 = this.backQueue;
ListIterator<NavBackStackEntry> listIterator = arrayDeque2.listIterator(arrayDeque2.size());
while (true) {
if (!listIterator.hasPrevious()) {
i = -1;
break;
}
if (listIterator.previous().getDestination() == node) {
i = listIterator.nextIndex();
break;
}
}
while (CollectionsKt.getLastIndex(this.backQueue) >= i) {
NavBackStackEntry removeLast = this.backQueue.removeLast();
unlinkChildFromParent$navigation_runtime_release(removeLast);
arrayDeque.addFirst(new NavBackStackEntry(removeLast, removeLast.getDestination().addInDefaultArgs(args)));
}
ArrayDeque<NavBackStackEntry> arrayDeque3 = arrayDeque;
for (NavBackStackEntry navBackStackEntry : arrayDeque3) {
NavGraph parent = navBackStackEntry.getDestination().getParent();
if (parent != null) {
linkChildToParent(navBackStackEntry, getBackStackEntry(parent.getId()));
}
this.backQueue.add(navBackStackEntry);
}
for (NavBackStackEntry navBackStackEntry2 : arrayDeque3) {
this._navigatorProvider.getNavigator(navBackStackEntry2.getDestination().getNavigatorName()).onLaunchSingleTop(navBackStackEntry2);
}
return true;
}
private final boolean restoreStateInternal(int id, Bundle args, NavOptions navOptions, Navigator.Extras navigatorExtras) {
if (!this.backStackMap.containsKey(Integer.valueOf(id))) {
return false;
}
final String str = this.backStackMap.get(Integer.valueOf(id));
CollectionsKt.removeAll(this.backStackMap.values(), new Function1<String, Boolean>() { // from class: androidx.navigation.NavController$restoreStateInternal$1
/* JADX INFO: Access modifiers changed from: package-private */
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(1);
}
@Override // kotlin.jvm.functions.Function1
public final Boolean invoke(String str2) {
return Boolean.valueOf(Intrinsics.areEqual(str2, str));
}
});
return executeRestoreState(instantiateBackStack((ArrayDeque) TypeIntrinsics.asMutableMap(this.backStackStates).remove(str)), args, navOptions, navigatorExtras);
}
private final boolean restoreStateInternal(String route) {
NavBackStackEntryState firstOrNull;
int hashCode = NavDestination.INSTANCE.createRoute(route).hashCode();
if (this.backStackMap.containsKey(Integer.valueOf(hashCode))) {
return restoreStateInternal(hashCode, null, null, null);
}
NavDestination findDestination = findDestination(route);
if (findDestination == null) {
throw new IllegalStateException(("Restore State failed: route " + route + " cannot be found from the current destination " + getCurrentDestination()).toString());
}
final String str = this.backStackMap.get(Integer.valueOf(findDestination.getId()));
CollectionsKt.removeAll(this.backStackMap.values(), new Function1<String, Boolean>() { // from class: androidx.navigation.NavController$restoreStateInternal$3
/* JADX INFO: Access modifiers changed from: package-private */
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(1);
}
@Override // kotlin.jvm.functions.Function1
public final Boolean invoke(String str2) {
return Boolean.valueOf(Intrinsics.areEqual(str2, str));
}
});
ArrayDeque<NavBackStackEntryState> arrayDeque = (ArrayDeque) TypeIntrinsics.asMutableMap(this.backStackStates).remove(str);
NavDestination.DeepLinkMatch matchDeepLink = findDestination.matchDeepLink(route);
Intrinsics.checkNotNull(matchDeepLink);
if (matchDeepLink.hasMatchingArgs((arrayDeque == null || (firstOrNull = arrayDeque.firstOrNull()) == null) ? null : firstOrNull.getArgs())) {
return executeRestoreState(instantiateBackStack(arrayDeque), null, null, null);
}
return false;
}
private final boolean executeRestoreState(final List<NavBackStackEntry> entries, final Bundle args, NavOptions navOptions, Navigator.Extras navigatorExtras) {
NavBackStackEntry navBackStackEntry;
NavDestination destination;
ArrayList<List<NavBackStackEntry>> arrayList = new ArrayList();
ArrayList<NavBackStackEntry> arrayList2 = new ArrayList();
for (Object obj : entries) {
if (!(((NavBackStackEntry) obj).getDestination() instanceof NavGraph)) {
arrayList2.add(obj);
}
}
for (NavBackStackEntry navBackStackEntry2 : arrayList2) {
List list = (List) CollectionsKt.lastOrNull((List) arrayList);
if (Intrinsics.areEqual((list == null || (navBackStackEntry = (NavBackStackEntry) CollectionsKt.last(list)) == null || (destination = navBackStackEntry.getDestination()) == null) ? null : destination.getNavigatorName(), navBackStackEntry2.getDestination().getNavigatorName())) {
list.add(navBackStackEntry2);
} else {
arrayList.add(CollectionsKt.mutableListOf(navBackStackEntry2));
}
}
final Ref.BooleanRef booleanRef = new Ref.BooleanRef();
for (List<NavBackStackEntry> list2 : arrayList) {
Navigator<? extends NavDestination> navigator = this._navigatorProvider.getNavigator(((NavBackStackEntry) CollectionsKt.first((List) list2)).getDestination().getNavigatorName());
final Ref.IntRef intRef = new Ref.IntRef();
navigateInternal(navigator, list2, navOptions, navigatorExtras, new Function1<NavBackStackEntry, Unit>() { // from class: androidx.navigation.NavController$executeRestoreState$3
/* JADX INFO: Access modifiers changed from: package-private */
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(1);
}
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Unit invoke(NavBackStackEntry navBackStackEntry3) {
invoke2(navBackStackEntry3);
return Unit.INSTANCE;
}
/* renamed from: invoke, reason: avoid collision after fix types in other method */
public final void invoke2(NavBackStackEntry entry) {
List<NavBackStackEntry> emptyList;
Intrinsics.checkNotNullParameter(entry, "entry");
Ref.BooleanRef.this.element = true;
int indexOf = entries.indexOf(entry);
if (indexOf != -1) {
int i = indexOf + 1;
emptyList = entries.subList(intRef.element, i);
intRef.element = i;
} else {
emptyList = CollectionsKt.emptyList();
}
this.addEntryToBackStack(entry.getDestination(), args, entry, emptyList);
}
});
}
return booleanRef.element;
}
private final List<NavBackStackEntry> instantiateBackStack(ArrayDeque<NavBackStackEntryState> backStackState) {
NavGraph graph;
ArrayList arrayList = new ArrayList();
NavBackStackEntry lastOrNull = this.backQueue.lastOrNull();
if (lastOrNull == null || (graph = lastOrNull.getDestination()) == null) {
graph = getGraph();
}
if (backStackState != null) {
for (NavBackStackEntryState navBackStackEntryState : backStackState) {
NavDestination findDestination = findDestination(graph, navBackStackEntryState.getDestinationId());
if (findDestination == null) {
throw new IllegalStateException(("Restore State failed: destination " + NavDestination.INSTANCE.getDisplayName(this.context, navBackStackEntryState.getDestinationId()) + " cannot be found from the current destination " + graph).toString());
}
arrayList.add(navBackStackEntryState.instantiate(this.context, findDestination, getHostLifecycleState$navigation_runtime_release(), this.viewModel));
graph = findDestination;
}
}
return arrayList;
}
/* JADX INFO: Access modifiers changed from: package-private */
/* JADX WARN: Multi-variable type inference failed */
public static /* synthetic */ void addEntryToBackStack$default(NavController navController, NavDestination navDestination, Bundle bundle, NavBackStackEntry navBackStackEntry, List list, int i, Object obj) {
if (obj != null) {
throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: addEntryToBackStack");
}
if ((i & 8) != 0) {
list = CollectionsKt.emptyList();
}
navController.addEntryToBackStack(navDestination, bundle, navBackStackEntry, list);
}
/* JADX INFO: Access modifiers changed from: private */
/* JADX WARN: Code restructure failed: missing block: B:100:0x026d, code lost:
r0 = r11.iterator();
*/
/* JADX WARN: Code restructure failed: missing block: B:102:0x0278, code lost:
if (r0.hasNext() == false) goto L134;
*/
/* JADX WARN: Code restructure failed: missing block: B:103:0x027a, code lost:
r1 = (androidx.navigation.NavBackStackEntry) r0.next();
r2 = r32.navigatorState.get(r32._navigatorProvider.getNavigator(r1.getDestination().getNavigatorName()));
*/
/* JADX WARN: Code restructure failed: missing block: B:104:0x0294, code lost:
if (r2 == null) goto L133;
*/
/* JADX WARN: Code restructure failed: missing block: B:105:0x0296, code lost:
r2.addInternal(r1);
*/
/* JADX WARN: Code restructure failed: missing block: B:108:0x02be, code lost:
throw new java.lang.IllegalStateException(("NavigatorBackStack for " + r33.getNavigatorName() + " should already be created").toString());
*/
/* JADX WARN: Code restructure failed: missing block: B:111:0x02bf, code lost:
r5 = r11;
r32.backQueue.addAll(r5);
r32.backQueue.add(r8);
r0 = kotlin.collections.CollectionsKt.plus((java.util.Collection<? extends androidx.navigation.NavBackStackEntry>) r5, r8).iterator();
*/
/* JADX WARN: Code restructure failed: missing block: B:113:0x02da, code lost:
if (r0.hasNext() == false) goto L136;
*/
/* JADX WARN: Code restructure failed: missing block: B:114:0x02dc, code lost:
r1 = (androidx.navigation.NavBackStackEntry) r0.next();
r2 = r1.getDestination().getParent();
*/
/* JADX WARN: Code restructure failed: missing block: B:115:0x02ea, code lost:
if (r2 == null) goto L138;
*/
/* JADX WARN: Code restructure failed: missing block: B:117:0x02ec, code lost:
linkChildToParent(r1, getBackStackEntry(r2.getId()));
*/
/* JADX WARN: Code restructure failed: missing block: B:122:0x02f8, code lost:
return;
*/
/* JADX WARN: Code restructure failed: missing block: B:123:0x0206, code lost:
r0 = null;
*/
/* JADX WARN: Code restructure failed: missing block: B:126:0x019c, code lost:
r12 = ((androidx.navigation.NavBackStackEntry) r11.first()).getDestination();
*/
/* JADX WARN: Code restructure failed: missing block: B:128:0x011a, code lost:
r12 = ((androidx.navigation.NavBackStackEntry) r11.first()).getDestination();
*/
/* JADX WARN: Code restructure failed: missing block: B:130:0x00ee, code lost:
r13 = r0;
r14 = r2;
r9 = r3;
r10 = r4;
r11 = r5;
*/
/* JADX WARN: Code restructure failed: missing block: B:131:0x00b2, code lost:
r20 = r12;
r0 = r13;
r8 = r14;
r2 = r15;
*/
/* JADX WARN: Code restructure failed: missing block: B:134:0x007c, code lost:
r1 = null;
*/
/* JADX WARN: Code restructure failed: missing block: B:135:0x00f4, code lost:
r9 = r3;
r10 = r4;
r11 = r5;
r20 = r12;
r8 = r14;
r14 = r15;
*/
/* JADX WARN: Code restructure failed: missing block: B:136:0x010b, code lost:
r10 = true;
r11 = r5;
r20 = r12;
r8 = r14;
r14 = r15;
*/
/* JADX WARN: Code restructure failed: missing block: B:13:0x0046, code lost:
r5 = new kotlin.collections.ArrayDeque();
r4 = true;
r18 = null;
*/
/* JADX WARN: Code restructure failed: missing block: B:14:0x0050, code lost:
if ((r33 instanceof androidx.navigation.NavGraph) == false) goto L38;
*/
/* JADX WARN: Code restructure failed: missing block: B:15:0x0052, code lost:
r0 = r12;
*/
/* JADX WARN: Code restructure failed: missing block: B:16:0x0053, code lost:
kotlin.jvm.internal.Intrinsics.checkNotNull(r0);
r3 = r0.getParent();
*/
/* JADX WARN: Code restructure failed: missing block: B:17:0x005a, code lost:
if (r3 == null) goto L32;
*/
/* JADX WARN: Code restructure failed: missing block: B:18:0x005c, code lost:
r0 = r13.listIterator(r36.size());
*/
/* JADX WARN: Code restructure failed: missing block: B:20:0x0068, code lost:
if (r0.hasPrevious() == false) goto L115;
*/
/* JADX WARN: Code restructure failed: missing block: B:21:0x006a, code lost:
r1 = r0.previous();
*/
/* JADX WARN: Code restructure failed: missing block: B:22:0x0079, code lost:
if (kotlin.jvm.internal.Intrinsics.areEqual(r1.getDestination(), r3) == false) goto L117;
*/
/* JADX WARN: Code restructure failed: missing block: B:24:0x007e, code lost:
r1 = r1;
*/
/* JADX WARN: Code restructure failed: missing block: B:25:0x0080, code lost:
if (r1 != null) goto L25;
*/
/* JADX WARN: Code restructure failed: missing block: B:26:0x0082, code lost:
r20 = r12;
r0 = r13;
r2 = r15;
r8 = r14;
r1 = androidx.navigation.NavBackStackEntry.Companion.create$default(androidx.navigation.NavBackStackEntry.INSTANCE, r32.context, r3, r34, getHostLifecycleState$navigation_runtime_release(), r32.viewModel, null, null, 96, null);
*/
/* JADX WARN: Code restructure failed: missing block: B:27:0x00b7, code lost:
r5.addFirst(r1);
*/
/* JADX WARN: Code restructure failed: missing block: B:28:0x00c3, code lost:
if ((r32.backQueue.isEmpty() ^ r4) == false) goto L31;
*/
/* JADX WARN: Code restructure failed: missing block: B:2:0x0010, code lost:
if ((r12 instanceof androidx.navigation.FloatingWindow) == false) goto L4;
*/
/* JADX WARN: Code restructure failed: missing block: B:30:0x00d1, code lost:
if (r32.backQueue.last().getDestination() != r3) goto L31;
*/
/* JADX WARN: Code restructure failed: missing block: B:31:0x00d3, code lost:
r13 = r0;
r14 = r2;
r9 = r3;
r10 = r4;
r11 = r5;
popEntryFromBackStack$default(r32, r32.backQueue.last(), false, null, 6, null);
*/
/* JADX WARN: Code restructure failed: missing block: B:32:0x00fb, code lost:
r0 = r9;
*/
/* JADX WARN: Code restructure failed: missing block: B:33:0x00fe, code lost:
if (r0 == null) goto L114;
*/
/* JADX WARN: Code restructure failed: missing block: B:34:0x0100, code lost:
if (r0 != r33) goto L37;
*/
/* JADX WARN: Code restructure failed: missing block: B:35:0x0103, code lost:
r4 = r10;
r5 = r11;
r15 = r14;
r12 = r20;
r14 = r8;
*/
/* JADX WARN: Code restructure failed: missing block: B:38:0x0115, code lost:
if (r11.isEmpty() == false) goto L42;
*/
/* JADX WARN: Code restructure failed: missing block: B:39:0x0117, code lost:
r12 = r20;
*/
/* JADX WARN: Code restructure failed: missing block: B:41:0x0124, code lost:
if (r12 == null) goto L118;
*/
/* JADX WARN: Code restructure failed: missing block: B:43:0x012e, code lost:
if (findDestination(r12.getId()) == r12) goto L119;
*/
/* JADX WARN: Code restructure failed: missing block: B:44:0x0130, code lost:
r0 = r12.getParent();
*/
/* JADX WARN: Code restructure failed: missing block: B:45:0x0134, code lost:
if (r0 == null) goto L121;
*/
/* JADX WARN: Code restructure failed: missing block: B:46:0x0136, code lost:
if (r14 == null) goto L52;
*/
/* JADX WARN: Code restructure failed: missing block: B:48:0x013c, code lost:
if (r34.isEmpty() != r10) goto L52;
*/
/* JADX WARN: Code restructure failed: missing block: B:49:0x013e, code lost:
r15 = null;
*/
/* JADX WARN: Code restructure failed: missing block: B:4:0x0018, code lost:
if (r32.backQueue.isEmpty() != false) goto L111;
*/
/* JADX WARN: Code restructure failed: missing block: B:50:0x0142, code lost:
r1 = r13.listIterator(r36.size());
*/
/* JADX WARN: Code restructure failed: missing block: B:52:0x014e, code lost:
if (r1.hasPrevious() == false) goto L123;
*/
/* JADX WARN: Code restructure failed: missing block: B:53:0x0150, code lost:
r2 = r1.previous();
*/
/* JADX WARN: Code restructure failed: missing block: B:54:0x015f, code lost:
if (kotlin.jvm.internal.Intrinsics.areEqual(r2.getDestination(), r0) == false) goto L125;
*/
/* JADX WARN: Code restructure failed: missing block: B:56:0x0164, code lost:
r2 = r2;
*/
/* JADX WARN: Code restructure failed: missing block: B:57:0x0166, code lost:
if (r2 != null) goto L63;
*/
/* JADX WARN: Code restructure failed: missing block: B:58:0x0168, code lost:
r2 = androidx.navigation.NavBackStackEntry.Companion.create$default(androidx.navigation.NavBackStackEntry.INSTANCE, r32.context, r0, r0.addInDefaultArgs(r15), getHostLifecycleState$navigation_runtime_release(), r32.viewModel, null, null, 96, null);
*/
/* JADX WARN: Code restructure failed: missing block: B:59:0x018c, code lost:
r11.addFirst(r2);
*/
/* JADX WARN: Code restructure failed: missing block: B:61:0x018f, code lost:
r12 = r0;
*/
/* JADX WARN: Code restructure failed: missing block: B:64:0x0162, code lost:
r2 = null;
*/
/* JADX WARN: Code restructure failed: missing block: B:65:0x0141, code lost:
r15 = r14;
*/
/* JADX WARN: Code restructure failed: missing block: B:69:0x0197, code lost:
if (r11.isEmpty() == false) goto L68;
*/
/* JADX WARN: Code restructure failed: missing block: B:6:0x0028, code lost:
if ((r32.backQueue.last().getDestination() instanceof androidx.navigation.FloatingWindow) == false) goto L110;
*/
/* JADX WARN: Code restructure failed: missing block: B:70:0x0199, code lost:
r12 = r20;
*/
/* JADX WARN: Code restructure failed: missing block: B:73:0x01ac, code lost:
if (r32.backQueue.isEmpty() != false) goto L128;
*/
/* JADX WARN: Code restructure failed: missing block: B:75:0x01bc, code lost:
if ((r32.backQueue.last().getDestination() instanceof androidx.navigation.NavGraph) == false) goto L127;
*/
/* JADX WARN: Code restructure failed: missing block: B:76:0x01be, code lost:
r0 = r32.backQueue.last().getDestination();
kotlin.jvm.internal.Intrinsics.checkNotNull(r0, "null cannot be cast to non-null type androidx.navigation.NavGraph");
*/
/* JADX WARN: Code restructure failed: missing block: B:77:0x01da, code lost:
if (((androidx.navigation.NavGraph) r0).findNode(r12.getId(), false) != null) goto L126;
*/
/* JADX WARN: Code restructure failed: missing block: B:78:0x01dc, code lost:
popEntryFromBackStack$default(r32, r32.backQueue.last(), false, null, 6, null);
*/
/* JADX WARN: Code restructure failed: missing block: B:80:0x01ef, code lost:
r0 = r32.backQueue.firstOrNull();
*/
/* JADX WARN: Code restructure failed: missing block: B:81:0x01f7, code lost:
if (r0 != null) goto L79;
*/
/* JADX WARN: Code restructure failed: missing block: B:82:0x01f9, code lost:
r0 = (androidx.navigation.NavBackStackEntry) r11.firstOrNull();
*/
/* JADX WARN: Code restructure failed: missing block: B:83:0x01ff, code lost:
if (r0 == null) goto L81;
*/
/* JADX WARN: Code restructure failed: missing block: B:84:0x0201, code lost:
r0 = r0.getDestination();
*/
/* JADX WARN: Code restructure failed: missing block: B:86:0x020e, code lost:
if (kotlin.jvm.internal.Intrinsics.areEqual(r0, r32._graph) != false) goto L94;
*/
/* JADX WARN: Code restructure failed: missing block: B:87:0x0210, code lost:
r0 = r13.listIterator(r36.size());
*/
/* JADX WARN: Code restructure failed: missing block: B:89:0x021c, code lost:
if (r0.hasPrevious() == false) goto L131;
*/
/* JADX WARN: Code restructure failed: missing block: B:8:0x0044, code lost:
if (popBackStackInternal$default(r32, r32.backQueue.last().getDestination().getId(), true, false, 4, null) != false) goto L112;
*/
/* JADX WARN: Code restructure failed: missing block: B:90:0x021e, code lost:
r1 = r0.previous();
r2 = r1.getDestination();
r3 = r32._graph;
kotlin.jvm.internal.Intrinsics.checkNotNull(r3);
*/
/* JADX WARN: Code restructure failed: missing block: B:91:0x0232, code lost:
if (kotlin.jvm.internal.Intrinsics.areEqual(r2, r3) == false) goto L132;
*/
/* JADX WARN: Code restructure failed: missing block: B:93:0x0234, code lost:
r18 = r1;
*/
/* JADX WARN: Code restructure failed: missing block: B:94:0x0236, code lost:
r18 = r18;
*/
/* JADX WARN: Code restructure failed: missing block: B:95:0x0238, code lost:
if (r18 != null) goto L93;
*/
/* JADX WARN: Code restructure failed: missing block: B:96:0x023a, code lost:
r19 = androidx.navigation.NavBackStackEntry.INSTANCE;
r0 = r32.context;
r1 = r32._graph;
kotlin.jvm.internal.Intrinsics.checkNotNull(r1);
r21 = r1;
r1 = r32._graph;
kotlin.jvm.internal.Intrinsics.checkNotNull(r1);
r18 = androidx.navigation.NavBackStackEntry.Companion.create$default(r19, r0, r21, r1.addInDefaultArgs(r14), getHostLifecycleState$navigation_runtime_release(), r32.viewModel, null, null, 96, null);
*/
/* JADX WARN: Code restructure failed: missing block: B:97:0x0268, code lost:
r11.addFirst(r18);
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final void addEntryToBackStack(androidx.navigation.NavDestination r33, android.os.Bundle r34, androidx.navigation.NavBackStackEntry r35, java.util.List<androidx.navigation.NavBackStackEntry> r36) {
/*
Method dump skipped, instructions count: 761
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.navigation.NavController.addEntryToBackStack(androidx.navigation.NavDestination, android.os.Bundle, androidx.navigation.NavBackStackEntry, java.util.List):void");
}
public void navigate(NavDirections directions) {
Intrinsics.checkNotNullParameter(directions, "directions");
navigate(directions.getActionId(), directions.getArguments(), (NavOptions) null);
}
public void navigate(NavDirections directions, NavOptions navOptions) {
Intrinsics.checkNotNullParameter(directions, "directions");
navigate(directions.getActionId(), directions.getArguments(), navOptions);
}
public void navigate(NavDirections directions, Navigator.Extras navigatorExtras) {
Intrinsics.checkNotNullParameter(directions, "directions");
Intrinsics.checkNotNullParameter(navigatorExtras, "navigatorExtras");
navigate(directions.getActionId(), directions.getArguments(), (NavOptions) null, navigatorExtras);
}
public final void navigate(String route, Function1<? super NavOptionsBuilder, Unit> builder) {
Intrinsics.checkNotNullParameter(route, "route");
Intrinsics.checkNotNullParameter(builder, "builder");
navigate$default(this, route, NavOptionsBuilderKt.navOptions(builder), null, 4, null);
}
public static /* synthetic */ void navigate$default(NavController navController, String str, NavOptions navOptions, Navigator.Extras extras, int i, Object obj) {
if (obj != null) {
throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: navigate");
}
if ((i & 2) != 0) {
navOptions = null;
}
if ((i & 4) != 0) {
extras = null;
}
navController.navigate(str, navOptions, extras);
}
public final void navigate(String route, NavOptions navOptions, Navigator.Extras navigatorExtras) {
Intrinsics.checkNotNullParameter(route, "route");
NavDeepLinkRequest.Builder.Companion companion = NavDeepLinkRequest.Builder.INSTANCE;
Uri parse = Uri.parse(NavDestination.INSTANCE.createRoute(route));
Intrinsics.checkExpressionValueIsNotNull(parse, "Uri.parse(this)");
navigate(companion.fromUri(parse).build(), navOptions, navigatorExtras);
}
public NavDeepLinkBuilder createDeepLink() {
return new NavDeepLinkBuilder(this);
}
public Bundle saveState() {
Bundle bundle;
ArrayList<String> arrayList = new ArrayList<>();
Bundle bundle2 = new Bundle();
for (Map.Entry<String, Navigator<? extends NavDestination>> entry : this._navigatorProvider.getNavigators().entrySet()) {
String key = entry.getKey();
Bundle onSaveState = entry.getValue().onSaveState();
if (onSaveState != null) {
arrayList.add(key);
bundle2.putBundle(key, onSaveState);
}
}
if (!arrayList.isEmpty()) {
bundle = new Bundle();
bundle2.putStringArrayList(KEY_NAVIGATOR_STATE_NAMES, arrayList);
bundle.putBundle(KEY_NAVIGATOR_STATE, bundle2);
} else {
bundle = null;
}
if (!this.backQueue.isEmpty()) {
if (bundle == null) {
bundle = new Bundle();
}
Parcelable[] parcelableArr = new Parcelable[this.backQueue.size()];
Iterator it = this.backQueue.iterator();
int i = 0;
while (it.hasNext()) {
parcelableArr[i] = new NavBackStackEntryState((NavBackStackEntry) it.next());
i++;
}
bundle.putParcelableArray(KEY_BACK_STACK, parcelableArr);
}
if (!this.backStackMap.isEmpty()) {
if (bundle == null) {
bundle = new Bundle();
}
int[] iArr = new int[this.backStackMap.size()];
ArrayList<String> arrayList2 = new ArrayList<>();
int i2 = 0;
for (Map.Entry<Integer, String> entry2 : this.backStackMap.entrySet()) {
int intValue = entry2.getKey().intValue();
String value = entry2.getValue();
iArr[i2] = intValue;
arrayList2.add(value);
i2++;
}
bundle.putIntArray(KEY_BACK_STACK_DEST_IDS, iArr);
bundle.putStringArrayList(KEY_BACK_STACK_IDS, arrayList2);
}
if (!this.backStackStates.isEmpty()) {
if (bundle == null) {
bundle = new Bundle();
}
ArrayList<String> arrayList3 = new ArrayList<>();
for (Map.Entry<String, ArrayDeque<NavBackStackEntryState>> entry3 : this.backStackStates.entrySet()) {
String key2 = entry3.getKey();
ArrayDeque<NavBackStackEntryState> value2 = entry3.getValue();
arrayList3.add(key2);
Parcelable[] parcelableArr2 = new Parcelable[value2.size()];
int i3 = 0;
for (NavBackStackEntryState navBackStackEntryState : value2) {
int i4 = i3 + 1;
if (i3 < 0) {
CollectionsKt.throwIndexOverflow();
}
parcelableArr2[i3] = navBackStackEntryState;
i3 = i4;
}
bundle.putParcelableArray(KEY_BACK_STACK_STATES_PREFIX + key2, parcelableArr2);
}
bundle.putStringArrayList(KEY_BACK_STACK_STATES_IDS, arrayList3);
}
if (this.deepLinkHandled) {
if (bundle == null) {
bundle = new Bundle();
}
bundle.putBoolean(KEY_DEEP_LINK_HANDLED, this.deepLinkHandled);
}
return bundle;
}
public void restoreState(Bundle navState) {
if (navState == null) {
return;
}
navState.setClassLoader(this.context.getClassLoader());
this.navigatorStateToRestore = navState.getBundle(KEY_NAVIGATOR_STATE);
this.backStackToRestore = navState.getParcelableArray(KEY_BACK_STACK);
this.backStackStates.clear();
int[] intArray = navState.getIntArray(KEY_BACK_STACK_DEST_IDS);
ArrayList<String> stringArrayList = navState.getStringArrayList(KEY_BACK_STACK_IDS);
if (intArray != null && stringArrayList != null) {
int length = intArray.length;
int i = 0;
int i2 = 0;
while (i < length) {
this.backStackMap.put(Integer.valueOf(intArray[i]), stringArrayList.get(i2));
i++;
i2++;
}
}
ArrayList<String> stringArrayList2 = navState.getStringArrayList(KEY_BACK_STACK_STATES_IDS);
if (stringArrayList2 != null) {
for (String id : stringArrayList2) {
Parcelable[] parcelableArray = navState.getParcelableArray(KEY_BACK_STACK_STATES_PREFIX + id);
if (parcelableArray != null) {
Map<String, ArrayDeque<NavBackStackEntryState>> map = this.backStackStates;
Intrinsics.checkNotNullExpressionValue(id, "id");
ArrayDeque<NavBackStackEntryState> arrayDeque = new ArrayDeque<>(parcelableArray.length);
Iterator it = ArrayIteratorKt.iterator(parcelableArray);
while (it.hasNext()) {
Parcelable parcelable = (Parcelable) it.next();
Intrinsics.checkNotNull(parcelable, "null cannot be cast to non-null type androidx.navigation.NavBackStackEntryState");
arrayDeque.add((NavBackStackEntryState) parcelable);
}
map.put(id, arrayDeque);
}
}
}
this.deepLinkHandled = navState.getBoolean(KEY_DEEP_LINK_HANDLED);
}
public void setLifecycleOwner(LifecycleOwner owner) {
Lifecycle lifecycle;
Intrinsics.checkNotNullParameter(owner, "owner");
if (Intrinsics.areEqual(owner, this.lifecycleOwner)) {
return;
}
LifecycleOwner lifecycleOwner = this.lifecycleOwner;
if (lifecycleOwner != null && (lifecycle = lifecycleOwner.getLifecycle()) != null) {
lifecycle.removeObserver(this.lifecycleObserver);
}
this.lifecycleOwner = owner;
owner.getLifecycle().addObserver(this.lifecycleObserver);
}
public void setOnBackPressedDispatcher(OnBackPressedDispatcher dispatcher) {
Intrinsics.checkNotNullParameter(dispatcher, "dispatcher");
if (Intrinsics.areEqual(dispatcher, this.onBackPressedDispatcher)) {
return;
}
LifecycleOwner lifecycleOwner = this.lifecycleOwner;
if (lifecycleOwner == null) {
throw new IllegalStateException("You must call setLifecycleOwner() before calling setOnBackPressedDispatcher()".toString());
}
this.onBackPressedCallback.remove();
this.onBackPressedDispatcher = dispatcher;
dispatcher.addCallback(lifecycleOwner, this.onBackPressedCallback);
Lifecycle lifecycle = lifecycleOwner.getLifecycle();
lifecycle.removeObserver(this.lifecycleObserver);
lifecycle.addObserver(this.lifecycleObserver);
}
public void enableOnBackPressed(boolean enabled) {
this.enableOnBackPressedCallback = enabled;
updateOnBackPressedCallbackEnabled();
}
/* JADX WARN: Code restructure failed: missing block: B:4:0x000b, code lost:
if (getDestinationCountOnBackStack() > 1) goto L8;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private final void updateOnBackPressedCallbackEnabled() {
/*
r2 = this;
androidx.activity.OnBackPressedCallback r0 = r2.onBackPressedCallback
boolean r1 = r2.enableOnBackPressedCallback
if (r1 == 0) goto Le
int r2 = r2.getDestinationCountOnBackStack()
r1 = 1
if (r2 <= r1) goto Le
goto Lf
Le:
r1 = 0
Lf:
r0.setEnabled(r1)
return
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.navigation.NavController.updateOnBackPressedCallbackEnabled():void");
}
public void setViewModelStore(ViewModelStore viewModelStore) {
Intrinsics.checkNotNullParameter(viewModelStore, "viewModelStore");
if (Intrinsics.areEqual(this.viewModel, NavControllerViewModel.INSTANCE.getInstance(viewModelStore))) {
return;
}
if (!this.backQueue.isEmpty()) {
throw new IllegalStateException("ViewModelStore should be set before setGraph call".toString());
}
this.viewModel = NavControllerViewModel.INSTANCE.getInstance(viewModelStore);
}
public ViewModelStoreOwner getViewModelStoreOwner(int navGraphId) {
if (this.viewModel == null) {
throw new IllegalStateException("You must call setViewModelStore() before calling getViewModelStoreOwner().".toString());
}
NavBackStackEntry backStackEntry = getBackStackEntry(navGraphId);
if (!(backStackEntry.getDestination() instanceof NavGraph)) {
throw new IllegalArgumentException(("No NavGraph with ID " + navGraphId + " is on the NavController's back stack").toString());
}
return backStackEntry;
}
public NavBackStackEntry getBackStackEntry(int destinationId) {
NavBackStackEntry navBackStackEntry;
ArrayDeque<NavBackStackEntry> arrayDeque = this.backQueue;
ListIterator<NavBackStackEntry> listIterator = arrayDeque.listIterator(arrayDeque.size());
while (true) {
if (!listIterator.hasPrevious()) {
navBackStackEntry = null;
break;
}
navBackStackEntry = listIterator.previous();
if (navBackStackEntry.getDestination().getId() == destinationId) {
break;
}
}
NavBackStackEntry navBackStackEntry2 = navBackStackEntry;
if (navBackStackEntry2 != null) {
return navBackStackEntry2;
}
throw new IllegalArgumentException(("No destination with ID " + destinationId + " is on the NavController's back stack. The current destination is " + getCurrentDestination()).toString());
}
public final NavBackStackEntry getBackStackEntry(String route) {
NavBackStackEntry navBackStackEntry;
Intrinsics.checkNotNullParameter(route, "route");
ArrayDeque<NavBackStackEntry> arrayDeque = this.backQueue;
ListIterator<NavBackStackEntry> listIterator = arrayDeque.listIterator(arrayDeque.size());
while (true) {
if (!listIterator.hasPrevious()) {
navBackStackEntry = null;
break;
}
navBackStackEntry = listIterator.previous();
NavBackStackEntry navBackStackEntry2 = navBackStackEntry;
if (navBackStackEntry2.getDestination().hasRoute(route, navBackStackEntry2.getArguments())) {
break;
}
}
NavBackStackEntry navBackStackEntry3 = navBackStackEntry;
if (navBackStackEntry3 != null) {
return navBackStackEntry3;
}
throw new IllegalArgumentException(("No destination with route " + route + " is on the NavController's back stack. The current destination is " + getCurrentDestination()).toString());
}
public NavBackStackEntry getCurrentBackStackEntry() {
return this.backQueue.lastOrNull();
}
public NavBackStackEntry getPreviousBackStackEntry() {
Object obj;
Iterator it = CollectionsKt.reversed(this.backQueue).iterator();
if (it.hasNext()) {
it.next();
}
Iterator it2 = SequencesKt.asSequence(it).iterator();
while (true) {
if (!it2.hasNext()) {
obj = null;
break;
}
obj = it2.next();
if (!(((NavBackStackEntry) obj).getDestination() instanceof NavGraph)) {
break;
}
}
return (NavBackStackEntry) obj;
}
/* compiled from: NavController.kt */
@Metadata(d1 = {"\u0000\"\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u000e\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0010\u0010\u0014\u001a\u00020\u00152\u0006\u0010\u0016\u001a\u00020\u0013H\u0007R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000R\u000e\u0010\u0005\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000R\u000e\u0010\u0007\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000R\u000e\u0010\b\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000R\u0010\u0010\t\u001a\u00020\u00048\u0006X\u0087T¢\u0006\u0002\n\u0000R\u0016\u0010\n\u001a\u00020\u00048\u0006X\u0087T¢\u0006\b\n\u0000\u0012\u0004\b\u000b\u0010\u0002R\u0010\u0010\f\u001a\u00020\u00048\u0006X\u0087T¢\u0006\u0002\n\u0000R\u0010\u0010\r\u001a\u00020\u00048\u0006X\u0087T¢\u0006\u0002\n\u0000R\u000e\u0010\u000e\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u000f\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000R\u000e\u0010\u0010\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000R\u000e\u0010\u0011\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000R\u000e\u0010\u0012\u001a\u00020\u0013X\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006\u0017"}, d2 = {"Landroidx/navigation/NavController$Companion;", "", "()V", "KEY_BACK_STACK", "", "KEY_BACK_STACK_DEST_IDS", "KEY_BACK_STACK_IDS", "KEY_BACK_STACK_STATES_IDS", "KEY_BACK_STACK_STATES_PREFIX", "KEY_DEEP_LINK_ARGS", "KEY_DEEP_LINK_EXTRAS", "getKEY_DEEP_LINK_EXTRAS$annotations", "KEY_DEEP_LINK_HANDLED", "KEY_DEEP_LINK_IDS", "KEY_DEEP_LINK_INTENT", "KEY_NAVIGATOR_STATE", "KEY_NAVIGATOR_STATE_NAMES", "TAG", "deepLinkSaveState", "", "enableDeepLinkSaveState", "", "saveState", "navigation-runtime_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes2.dex */
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public static /* synthetic */ void getKEY_DEEP_LINK_EXTRAS$annotations() {
}
private Companion() {
}
@JvmStatic
@NavDeepLinkSaveStateControl
public final void enableDeepLinkSaveState(boolean saveState) {
NavController.deepLinkSaveState = saveState;
}
}
}