package E1;

import android.os.Bundle;
import c7.InterfaceC0591B;
import java.util.List;
import java.util.ListIterator;

/* JADX INFO: loaded from: classes.dex */
public abstract class S {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public C0107n f2054a;

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

    public abstract A a();

    public final C0107n b() {
        C0107n c0107n = this.f2054a;
        if (c0107n != null) {
            return c0107n;
        }
        throw new IllegalStateException("You cannot access the Navigator's state until the Navigator is attached");
    }

    public void d(List list, H h8) {
        W6.e eVar = new W6.e(W6.j.F(new W6.f(new B6.r(0, list), new C0108o(this, 1, h8), 3)));
        while (eVar.hasNext()) {
            b().e((C0103j) eVar.next());
        }
    }

    public void e(C0107n c0107n) {
        this.f2054a = c0107n;
        this.f2055b = true;
    }

    public void f(C0103j c0103j) {
        A a3 = c0103j.f2087r;
        if (!(a3 != null)) {
            a3 = null;
        }
        if (a3 == null) {
            return;
        }
        I i = new I();
        i.f2034b = true;
        boolean z8 = i.f2034b;
        A7.a aVar = i.f2033a;
        c(a3, null, new H(z8, false, i.f2035c, false, i.f2036d, aVar.f460a, aVar.f461b, -1, -1));
        b().b(c0103j);
    }

    public Bundle h() {
        return null;
    }

    public void i(C0103j c0103j, boolean z8) {
        P6.g.e(c0103j, "popUpTo");
        List list = (List) ((c7.K) ((InterfaceC0591B) b().f2107e.f9369r)).e();
        if (!list.contains(c0103j)) {
            throw new IllegalStateException(("popBackStack was called with " + c0103j + " which does not exist in back stack " + list).toString());
        }
        ListIterator listIterator = list.listIterator(list.size());
        C0103j c0103j2 = null;
        while (j()) {
            c0103j2 = (C0103j) listIterator.previous();
            if (P6.g.a(c0103j2, c0103j)) {
                break;
            }
        }
        if (c0103j2 != null) {
            b().c(c0103j2);
        }
    }

    public boolean j() {
        return true;
    }

    public void g(Bundle bundle) {
    }

    public A c(A a3, Bundle bundle, H h8) {
        return a3;
    }
}
