package androidx.lifecycle;

import F5.C0115b;
import O1.C0225a;
import android.os.Bundle;
import h0.C0997E;
import java.util.Arrays;
import java.util.Map;

/* JADX INFO: loaded from: classes.dex */
public final class Q implements U1.d {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final C0225a f8802a;

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

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

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final A6.k f8805d;

    public Q(C0225a c0225a, a0 a0Var) {
        P6.g.e(c0225a, "savedStateRegistry");
        this.f8802a = c0225a;
        this.f8805d = new A6.k(new C0115b(7, a0Var));
    }

    @Override // U1.d
    public final Bundle a() {
        Bundle bundleE = W3.b.e((A6.h[]) Arrays.copyOf(new A6.h[0], 0));
        Bundle bundle = this.f8804c;
        if (bundle != null) {
            bundleE.putAll(bundle);
        }
        for (Map.Entry entry : ((S) this.f8805d.getValue()).f8806b.entrySet()) {
            String str = (String) entry.getKey();
            Bundle bundleA = ((C0997E) ((N) entry.getValue()).f8793a.f3556u).a();
            if (!bundleA.isEmpty()) {
                P6.g.e(str, "key");
                bundleE.putBundle(str, bundleA);
            }
        }
        this.f8803b = false;
        return bundleE;
    }

    public final void b() {
        if (this.f8803b) {
            return;
        }
        Bundle bundleH = this.f8802a.h("androidx.lifecycle.internal.SavedStateHandlesProvider");
        Bundle bundleE = W3.b.e((A6.h[]) Arrays.copyOf(new A6.h[0], 0));
        Bundle bundle = this.f8804c;
        if (bundle != null) {
            bundleE.putAll(bundle);
        }
        if (bundleH != null) {
            bundleE.putAll(bundleH);
        }
        this.f8804c = bundleE;
        this.f8803b = true;
    }
}
