package androidx.navigation;

import java.util.ArrayList;
import n.e0;

/* JADX INFO: loaded from: classes.dex */
public final class F extends C {

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

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

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

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public F(Y provider) {
        super(provider.b(AbstractC1131f.c(G.class)), null);
        kotlin.jvm.internal.o.h(provider, "provider");
        this.f12662h = new ArrayList();
        this.f12660f = provider;
        this.f12661g = "splash";
    }

    public final E c() {
        int iHashCode;
        E e6 = (E) super.a();
        ArrayList<B> nodes = this.f12662h;
        kotlin.jvm.internal.o.h(nodes, "nodes");
        for (B b5 : nodes) {
            if (b5 != null) {
                int i6 = b5.f12644f;
                String str = b5.f12645j;
                if (i6 == 0 && str == null) {
                    throw new IllegalArgumentException("Destinations must have an id or route. Call setId(), setRoute(), or include an android:id or app:route in your navigation XML.");
                }
                String str2 = e6.f12645j;
                if (str2 != null && kotlin.jvm.internal.o.c(str, str2)) {
                    throw new IllegalArgumentException(("Destination " + b5 + " cannot have the same route as graph " + e6).toString());
                }
                if (i6 == e6.f12644f) {
                    throw new IllegalArgumentException(("Destination " + b5 + " cannot have the same id as graph " + e6).toString());
                }
                e0 e0Var = e6.f12656m;
                B b6 = (B) e0Var.b(i6);
                if (b6 == b5) {
                    continue;
                } else {
                    if (b5.f12640b != null) {
                        throw new IllegalStateException("Destination already has a parent set. Call NavGraph.remove() to remove the previous parent.");
                    }
                    if (b6 != null) {
                        b6.f12640b = null;
                    }
                    b5.f12640b = e6;
                    e0Var.d(b5.f12644f, b5);
                }
            }
        }
        String str3 = this.f12661g;
        if (str3 == null) {
            if (this.f12648b != null) {
                throw new IllegalStateException("You must set a start destination route");
            }
            throw new IllegalStateException("You must set a start destination id");
        }
        if (str3 == null) {
            iHashCode = 0;
        } else {
            if (str3.equals(e6.f12645j)) {
                throw new IllegalArgumentException(("Start destination " + str3 + " cannot use the same route as the graph " + e6).toString());
            }
            if (S4.p.Q0(str3)) {
                throw new IllegalArgumentException("Cannot have an empty start destination route");
            }
            iHashCode = "android-app://androidx.navigation/".concat(str3).hashCode();
        }
        e6.f12657n = iHashCode;
        e6.f12659p = str3;
        return e6;
    }
}
