package L1;

import com.google.android.gms.internal.measurement.AbstractC0381h2;
import com.google.android.gms.internal.measurement.C0419p0;
import com.google.android.gms.internal.measurement.C0428r0;
import com.google.android.gms.internal.measurement.C0439t1;
import com.google.android.gms.internal.measurement.C0443u0;
import com.google.android.gms.internal.measurement.C0446u3;
import com.google.android.gms.internal.measurement.C0453w0;
import com.google.android.gms.internal.measurement.C0458x0;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;

/* JADX INFO: renamed from: L1.b, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C0083b {

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

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final int f1674b;

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

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public Boolean f1676d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public Long f1677e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public Long f1678f;

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

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public final /* synthetic */ C0086c f1680h;
    public final AbstractC0381h2 i;

    public C0083b(String str, int i) {
        this.f1673a = str;
        this.f1674b = i;
    }

    public static Boolean c(Boolean bool, boolean z5) {
        if (bool == null) {
            return null;
        }
        return Boolean.valueOf(bool.booleanValue() != z5);
    }

    /* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
    public static Boolean d(String str, C0458x0 c0458x0, X x5) {
        List listU;
        s1.z.g(c0458x0);
        if (str != null && c0458x0.p() && c0458x0.x() != 1 && (c0458x0.x() != 7 ? c0458x0.q() : c0458x0.v() != 0)) {
            int iX = c0458x0.x();
            boolean zT = c0458x0.t();
            String strR = (zT || iX == 2 || iX == 7) ? c0458x0.r() : c0458x0.r().toUpperCase(Locale.ENGLISH);
            if (c0458x0.v() == 0) {
                listU = null;
            } else {
                listU = c0458x0.u();
                if (!zT) {
                    ArrayList arrayList = new ArrayList(listU.size());
                    Iterator it = listU.iterator();
                    while (it.hasNext()) {
                        arrayList.add(((String) it.next()).toUpperCase(Locale.ENGLISH));
                    }
                    listU = Collections.unmodifiableList(arrayList);
                }
            }
            String str2 = iX == 2 ? strR : null;
            if (iX != 7 ? strR != null : listU != null && !listU.isEmpty()) {
                if (!zT && iX != 2) {
                    str = str.toUpperCase(Locale.ENGLISH);
                }
                switch (iX - 1) {
                    case 1:
                        if (str2 != null) {
                            try {
                                return Boolean.valueOf(Pattern.compile(str2, true != zT ? 66 : 0).matcher(str).matches());
                            } catch (PatternSyntaxException unused) {
                                if (x5 != null) {
                                    x5.f1626s.c("Invalid regular expression in REGEXP audience filter. expression", str2);
                                }
                            }
                        }
                        break;
                    case 2:
                        return Boolean.valueOf(str.startsWith(strR));
                    case 3:
                        return Boolean.valueOf(str.endsWith(strR));
                    case 4:
                        return Boolean.valueOf(str.contains(strR));
                    case 5:
                        return Boolean.valueOf(str.equals(strR));
                    case 6:
                        if (listU != null) {
                            return Boolean.valueOf(listU.contains(str));
                        }
                        break;
                }
            }
        }
        return null;
    }

    public static Boolean e(long j5, C0443u0 c0443u0) {
        try {
            return f(new BigDecimal(j5), c0443u0, 0.0d);
        } catch (NumberFormatException unused) {
            return null;
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:38:0x0089  */
    /* JADX WARN: Removed duplicated region for block: B:80:0x0107  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    public static java.lang.Boolean f(java.math.BigDecimal r8, com.google.android.gms.internal.measurement.C0443u0 r9, double r10) {
        /*
            Method dump skipped, instruction units count: 280
            To view this dump change 'Code comments level' option to 'DEBUG'
        */
        throw new UnsupportedOperationException("Method not decompiled: L1.C0083b.f(java.math.BigDecimal, com.google.android.gms.internal.measurement.u0, double):java.lang.Boolean");
    }

    /* JADX WARN: Code restructure failed: missing block: B:103:0x0292, code lost:
    
        r16 = r3;
        r17 = r4;
     */
    /* JADX WARN: Code restructure failed: missing block: B:110:0x02b1, code lost:
    
        r16 = r3;
        r17 = r4;
     */
    /* JADX WARN: Removed duplicated region for block: B:56:0x0178  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    public boolean a(java.lang.Long r19, java.lang.Long r20, com.google.android.gms.internal.measurement.C0355c1 r21, long r22, L1.C0133s r24, boolean r25) {
        /*
            Method dump skipped, instruction units count: 1067
            To view this dump change 'Code comments level' option to 'DEBUG'
        */
        throw new UnsupportedOperationException("Method not decompiled: L1.C0083b.a(java.lang.Long, java.lang.Long, com.google.android.gms.internal.measurement.c1, long, L1.s, boolean):boolean");
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference fix 'apply assigned field type' failed
    java.lang.UnsupportedOperationException: ArgType.getObject(), call class: class jadx.core.dex.instructions.args.ArgType$UnknownArg
    	at jadx.core.dex.instructions.args.ArgType.getObject(ArgType.java:593)
    	at jadx.core.dex.attributes.nodes.ClassTypeVarsAttr.getTypeVarsMapFor(ClassTypeVarsAttr.java:35)
    	at jadx.core.dex.nodes.utils.TypeUtils.replaceClassGenerics(TypeUtils.java:177)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.insertExplicitUseCast(FixTypesVisitor.java:397)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.tryFieldTypeWithNewCasts(FixTypesVisitor.java:359)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.applyFieldType(FixTypesVisitor.java:309)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.visit(FixTypesVisitor.java:94)
     */
    public boolean b(Long l5, Long l6, C0439t1 c0439t1, boolean z5) {
        C0446u3.a();
        C0146w0 c0146w0 = (C0146w0) this.f1680h.f29k;
        boolean zU = c0146w0.f2035n.u(this.f1673a, F.f1355D0);
        C0453w0 c0453w0 = (C0453w0) this.i;
        boolean zT = c0453w0.t();
        boolean zU2 = c0453w0.u();
        boolean zW = c0453w0.w();
        Object[] objArr = zT || zU2 || zW;
        Boolean boolC = null;
        boolF = null;
        Boolean boolF = null;
        boolC = null;
        boolC = null;
        boolC = null;
        Boolean boolF2 = null;
        boolC = null;
        X x5 = c0146w0.p;
        if (z5 && objArr != true) {
            C0146w0.l(x5);
            x5.f1631x.d(Integer.valueOf(this.f1674b), c0453w0.p() ? Integer.valueOf(c0453w0.q()) : null, "Property filter already evaluated true and it is not associated with an enhanced audience. audience ID, filter ID");
            return true;
        }
        C0428r0 c0428r0S = c0453w0.s();
        boolean zU3 = c0428r0S.u();
        boolean zU4 = c0439t1.u();
        Q q = c0146w0.f2039t;
        if (zU4) {
            if (c0428r0S.r()) {
                boolC = c(e(c0439t1.v(), c0428r0S.s()), zU3);
            } else {
                C0146w0.l(x5);
                x5.f1626s.c("No number filter for long property. property", q.c(c0439t1.r()));
            }
        } else if (c0439t1.y()) {
            if (c0428r0S.r()) {
                double dZ = c0439t1.z();
                try {
                    boolF = f(new BigDecimal(dZ), c0428r0S.s(), Math.ulp(dZ));
                } catch (NumberFormatException unused) {
                }
                boolC = c(boolF, zU3);
            } else {
                C0146w0.l(x5);
                x5.f1626s.c("No number filter for double property. property", q.c(c0439t1.r()));
            }
        } else if (!c0439t1.s()) {
            C0146w0.l(x5);
            x5.f1626s.c("User property has no value, property", q.c(c0439t1.r()));
        } else if (c0428r0S.p()) {
            String strT = c0439t1.t();
            C0458x0 c0458x0Q = c0428r0S.q();
            C0146w0.l(x5);
            boolC = c(d(strT, c0458x0Q, x5), zU3);
        } else if (!c0428r0S.r()) {
            C0146w0.l(x5);
            x5.f1626s.c("No string or number filter defined. property", q.c(c0439t1.r()));
        } else if (C0084b0.Q(c0439t1.t())) {
            String strT2 = c0439t1.t();
            C0443u0 c0443u0S = c0428r0S.s();
            if (C0084b0.Q(strT2)) {
                try {
                    boolF2 = f(new BigDecimal(strT2), c0443u0S, 0.0d);
                } catch (NumberFormatException unused2) {
                }
            }
            boolC = c(boolF2, zU3);
        } else {
            C0146w0.l(x5);
            x5.f1626s.d(q.c(c0439t1.r()), c0439t1.t(), "Invalid user property value for Numeric number filter. property, value");
        }
        C0146w0.l(x5);
        x5.f1631x.c("Property filter result", boolC == null ? "null" : boolC);
        if (boolC == null) {
            return false;
        }
        this.f1675c = Boolean.TRUE;
        if (!zW || boolC.booleanValue()) {
            if (!z5 || c0453w0.t()) {
                this.f1676d = boolC;
            }
            if (boolC.booleanValue() && objArr != false && c0439t1.p()) {
                long jQ = c0439t1.q();
                if (l5 != null) {
                    jQ = l5.longValue();
                }
                if (zU && c0453w0.t() && !c0453w0.u() && l6 != null) {
                    jQ = l6.longValue();
                }
                if (c0453w0.u()) {
                    this.f1678f = Long.valueOf(jQ);
                } else {
                    this.f1677e = Long.valueOf(jQ);
                }
            }
        }
        return true;
    }

    /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
    public C0083b(C0086c c0086c, String str, int i, C0419p0 c0419p0) {
        this(str, i);
        this.f1679g = 0;
        Objects.requireNonNull(c0086c);
        this.f1680h = c0086c;
        this.i = c0419p0;
    }

    /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
    public C0083b(C0086c c0086c, String str, int i, C0453w0 c0453w0) {
        this(str, i);
        this.f1679g = 1;
        Objects.requireNonNull(c0086c);
        this.f1680h = c0086c;
        this.i = c0453w0;
    }
}
