package E1;

import a.AbstractC0386a;
import java.util.LinkedHashMap;

/* JADX INFO: loaded from: classes.dex */
public final class T {

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public static final LinkedHashMap f2056b = new LinkedHashMap();

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final LinkedHashMap f2057a = new LinkedHashMap();

    public final void a(S s8) {
        P6.g.e(s8, "navigator");
        String strO = AbstractC0386a.o(s8.getClass());
        if (strO.length() <= 0) {
            throw new IllegalArgumentException("navigator name cannot be an empty string");
        }
        LinkedHashMap linkedHashMap = this.f2057a;
        S s9 = (S) linkedHashMap.get(strO);
        if (P6.g.a(s9, s8)) {
            return;
        }
        boolean z8 = false;
        if (s9 != null && s9.f2055b) {
            z8 = true;
        }
        if (z8) {
            throw new IllegalStateException(("Navigator " + s8 + " is replacing an already attached " + s9).toString());
        }
        if (!s8.f2055b) {
            return;
        }
        throw new IllegalStateException(("Navigator " + s8 + " is already attached to another NavController").toString());
    }

    public final S b(String str) {
        P6.g.e(str, "name");
        if (str.length() <= 0) {
            throw new IllegalArgumentException("navigator name cannot be an empty string");
        }
        S s8 = (S) this.f2057a.get(str);
        if (s8 != null) {
            return s8;
        }
        throw new IllegalStateException(I1.a.p("Could not find Navigator with name \"", str, "\". You must call NavController.addNavigator() for each navigation type."));
    }
}
