package g0;

import android.os.Bundle;
import androidx.lifecycle.g;
import androidx.savedstate.Recreator;
import w1.g;

/* JADX INFO: compiled from: SavedStateRegistryController.kt */
/* JADX INFO: loaded from: classes.dex */
public final class d {

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public static final a f4653d = new a(null);

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    private final e f4654a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    private final c f4655b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    private boolean f4656c;

    /* JADX INFO: compiled from: SavedStateRegistryController.kt */
    public static final class a {
        private a() {
        }

        public /* synthetic */ a(w1.e eVar) {
            this();
        }

        public final d a(e eVar) {
            g.e(eVar, "owner");
            return new d(eVar, null);
        }
    }

    private d(e eVar) {
        this.f4654a = eVar;
        this.f4655b = new c();
    }

    public /* synthetic */ d(e eVar, w1.e eVar2) {
        this(eVar);
    }

    public static final d a(e eVar) {
        return f4653d.a(eVar);
    }

    public final c b() {
        return this.f4655b;
    }

    public final void c() {
        androidx.lifecycle.g gVarA = this.f4654a.a();
        g.d(gVarA, "owner.lifecycle");
        if (!(gVarA.b() == g.c.INITIALIZED)) {
            throw new IllegalStateException("Restarter must be created only during owner's initialization stage".toString());
        }
        gVarA.a(new Recreator(this.f4654a));
        this.f4655b.e(gVarA);
        this.f4656c = true;
    }

    public final void d(Bundle bundle) {
        if (!this.f4656c) {
            c();
        }
        androidx.lifecycle.g gVarA = this.f4654a.a();
        w1.g.d(gVarA, "owner.lifecycle");
        if (!gVarA.b().isAtLeast(g.c.STARTED)) {
            this.f4655b.f(bundle);
            return;
        }
        throw new IllegalStateException(("performRestore cannot be called when owner is " + gVarA.b()).toString());
    }

    public final void e(Bundle bundle) {
        w1.g.e(bundle, "outBundle");
        this.f4655b.g(bundle);
    }
}
