package d.m;

import android.os.Binder;
import android.os.Bundle;
import android.os.Parcelable;
import android.util.Size;
import android.util.SizeF;
import android.util.SparseArray;
import d.q.a;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Set;

/* JADX INFO: loaded from: classes.dex */
public final class q {
    public static final Class[] a = {Boolean.TYPE, boolean[].class, Double.TYPE, double[].class, Integer.TYPE, int[].class, Long.TYPE, long[].class, String.class, String[].class, Binder.class, Bundle.class, Byte.TYPE, byte[].class, Character.TYPE, char[].class, CharSequence.class, CharSequence[].class, ArrayList.class, Float.TYPE, float[].class, Parcelable.class, Parcelable[].class, Serializable.class, Short.TYPE, short[].class, SparseArray.class, Size.class, SizeF.class};

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final Map<String, Object> f3199b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final Map<String, a.b> f3200c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final Map<String, ?> f3201d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final a.b f3202e;

    public class a implements a.b {
        public a() {
        }

        @Override // d.q.a.b
        public Bundle a() {
            for (Map.Entry entry : new HashMap(q.this.f3200c).entrySet()) {
                Bundle bundleA = ((a.b) entry.getValue()).a();
                q qVar = q.this;
                String str = (String) entry.getKey();
                Objects.requireNonNull(qVar);
                if (bundleA != null) {
                    for (Class cls : q.a) {
                        if (!cls.isInstance(bundleA)) {
                        }
                    }
                    StringBuilder sbF = g.a.a.a.a.F("Can't put value with type ");
                    sbF.append(bundleA.getClass());
                    sbF.append(" into saved state");
                    throw new IllegalArgumentException(sbF.toString());
                }
                m mVar = (m) qVar.f3201d.get(str);
                if (mVar != null) {
                    mVar.g(bundleA);
                } else {
                    qVar.f3199b.put(str, bundleA);
                }
            }
            Set<String> setKeySet = q.this.f3199b.keySet();
            ArrayList<? extends Parcelable> arrayList = new ArrayList<>(setKeySet.size());
            ArrayList<? extends Parcelable> arrayList2 = new ArrayList<>(arrayList.size());
            for (String str2 : setKeySet) {
                arrayList.add(str2);
                arrayList2.add(q.this.f3199b.get(str2));
            }
            Bundle bundle = new Bundle();
            bundle.putParcelableArrayList("keys", arrayList);
            bundle.putParcelableArrayList("values", arrayList2);
            return bundle;
        }
    }

    public q() {
        this.f3200c = new HashMap();
        this.f3201d = new HashMap();
        this.f3202e = new a();
        this.f3199b = new HashMap();
    }

    public q(Map<String, Object> map) {
        this.f3200c = new HashMap();
        this.f3201d = new HashMap();
        this.f3202e = new a();
        this.f3199b = new HashMap(map);
    }
}
