package p5;

import a5.C0405d;
import android.content.SharedPreferences;
import g6.o;
import o6.x;

/* JADX INFO: loaded from: classes.dex */
public final class i {

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

    public i(C0405d c0405d) {
        P6.g.e(c0405d, "encryptedPreference");
        this.f16140a = c0405d;
    }

    public final A6.h a(A6.h hVar, boolean z8) {
        if (z8) {
            o oVar = o.f12958a;
            String strN = oVar.N();
            C0405d c0405d = this.f16140a;
            SharedPreferences.Editor editorEdit = c0405d.f7619a.edit();
            Object obj = hVar.f446q;
            boolean z9 = obj instanceof String;
            x xVar = c0405d.f7620b;
            if (z9) {
                editorEdit.putString(strN, (String) obj);
            } else if (obj instanceof Float) {
                editorEdit.putFloat(strN, ((Number) obj).floatValue());
            } else if (obj instanceof Integer) {
                editorEdit.putInt(strN, ((Number) obj).intValue());
            } else if (obj instanceof Long) {
                editorEdit.putLong(strN, ((Number) obj).longValue());
            } else if (obj instanceof Boolean) {
                editorEdit.putBoolean(strN, ((Boolean) obj).booleanValue());
            } else {
                editorEdit.putString(strN, xVar.a(String.class).d(obj));
            }
            editorEdit.apply();
            String strH = oVar.H();
            SharedPreferences.Editor editorEdit2 = c0405d.f7619a.edit();
            Object obj2 = hVar.f447r;
            if (obj2 instanceof String) {
                editorEdit2.putString(strH, (String) obj2);
            } else if (obj2 instanceof Float) {
                editorEdit2.putFloat(strH, ((Number) obj2).floatValue());
            } else if (obj2 instanceof Integer) {
                editorEdit2.putInt(strH, ((Number) obj2).intValue());
            } else if (obj2 instanceof Long) {
                editorEdit2.putLong(strH, ((Number) obj2).longValue());
            } else if (obj2 instanceof Boolean) {
                editorEdit2.putBoolean(strH, ((Boolean) obj2).booleanValue());
            } else {
                editorEdit2.putString(strH, xVar.a(String.class).d(obj2));
            }
            editorEdit2.apply();
        }
        o oVar2 = o.f12958a;
        return new A6.h(oVar2.N(), oVar2.H());
    }
}
