package androidx.lifecycle;

import android.os.Bundle;
import java.util.Map;

/* JADX INFO: loaded from: classes.dex */
public final class n0 implements i3.e {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final i3.f f2672a;

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

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public Bundle f2674c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final kd.c f2675d;

    public n0(i3.f fVar, final z0 z0Var) {
        nb.g.i(fVar, "savedStateRegistry");
        nb.g.i(z0Var, "viewModelStoreOwner");
        this.f2672a = fVar;
        this.f2675d = kotlin.a.c(new sd.a() { // from class: androidx.lifecycle.SavedStateHandlesProvider$viewModel$2
            {
                super(0);
            }

            @Override // sd.a
            public final Object invoke() {
                return z.d(z0Var);
            }
        });
    }

    @Override // i3.e
    public final Bundle a() {
        Bundle bundle = new Bundle();
        Bundle bundle2 = this.f2674c;
        if (bundle2 != null) {
            bundle.putAll(bundle2);
        }
        for (Map.Entry<String, l0> entry : ((SavedStateHandlesVM) this.f2675d.getValue()).getHandles().entrySet()) {
            String key = entry.getKey();
            Bundle bundleA = entry.getValue().f2667e.a();
            if (!nb.g.c(bundleA, Bundle.EMPTY)) {
                bundle.putBundle(key, bundleA);
            }
        }
        this.f2673b = false;
        return bundle;
    }

    public final void b() {
        if (this.f2673b) {
            return;
        }
        Bundle bundleA = this.f2672a.a("androidx.lifecycle.internal.SavedStateHandlesProvider");
        Bundle bundle = new Bundle();
        Bundle bundle2 = this.f2674c;
        if (bundle2 != null) {
            bundle.putAll(bundle2);
        }
        if (bundleA != null) {
            bundle.putAll(bundleA);
        }
        this.f2674c = bundle;
        this.f2673b = true;
    }
}
