package com.google.android.gms.internal.measurement;

/* JADX INFO: loaded from: classes2.dex */
public final class h5 extends d5 {

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public final /* synthetic */ int f20218k;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public /* synthetic */ h5(i5 i5Var, String str, Object obj, int i10) {
        super(i5Var, str, obj);
        this.f20218k = i10;
    }

    @Override // com.google.android.gms.internal.measurement.d5
    public final Object c(Object obj) {
        i5 i5Var = this.f20157a;
        switch (this.f20218k) {
            case 0:
                if (obj instanceof Long) {
                    return (Long) obj;
                }
                if (obj instanceof String) {
                    try {
                        return Long.valueOf(Long.parseLong((String) obj));
                    } catch (NumberFormatException unused) {
                    }
                }
                String str = i5Var.f20229d;
                if (str != null) {
                    str.isEmpty();
                }
                String.valueOf(obj);
                return null;
            case 1:
                if (obj instanceof Double) {
                    return (Double) obj;
                }
                if (obj instanceof Float) {
                    return Double.valueOf(((Float) obj).doubleValue());
                }
                if (obj instanceof String) {
                    try {
                        return Double.valueOf(Double.parseDouble((String) obj));
                    } catch (NumberFormatException unused2) {
                    }
                }
                String str2 = i5Var.f20229d;
                if (str2 != null) {
                    str2.isEmpty();
                }
                String.valueOf(obj);
                return null;
            case 2:
                if (obj instanceof Boolean) {
                    return (Boolean) obj;
                }
                if (obj instanceof String) {
                    String str3 = (String) obj;
                    if (n4.f20334c.matcher(str3).matches()) {
                        return Boolean.TRUE;
                    }
                    if (n4.f20335d.matcher(str3).matches()) {
                        return Boolean.FALSE;
                    }
                }
                String str4 = i5Var.f20229d;
                if (str4 != null) {
                    str4.isEmpty();
                }
                String.valueOf(obj);
                return null;
            default:
                if (obj instanceof String) {
                    return (String) obj;
                }
                return null;
        }
    }
}
