package o; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.zxing.NotFoundException; import java.util.ArrayList; import java.util.Arrays; import org.bouncycastle.crypto.tls.CipherSuite; /* renamed from: o.uon, reason: case insensitive filesystem */ /* loaded from: classes2.dex */ public final class C17210uon { private static final int[] c = {0, 4, 1, 5}; private static final int[] d = {6, 2, 7, 3}; private static final int[] e = {8, 1, 1, 1, 1, 1, 1, 3}; private static final int[] a = {7, 1, 1, 3, 1, 1, 1, 2, 1}; private static final int[] b = {0, CipherSuite.TLS_DHE_PSK_WITH_NULL_SHA256, 270, 90}; public static mZe b(BKc bKc) throws NotFoundException { C8902dZc c8902dZc; int i; int i2; if (bKc.b == null) { bKc.b = bKc.a.d(); } C8902dZc c8902dZc2 = bKc.b; for (int i3 : b) { int i4 = i3 % 360; if (i4 != 0) { C8902dZc c2 = c8902dZc2.c(); if (i4 != 0) { if (i4 == 90) { c2.b(); } else if (i4 == 180) { c2.d(); } else if (i4 == 270) { c2.b(); c2.d(); } else { throw new IllegalArgumentException("degrees must be a multiple of 0, 90, 180, or 270"); } } c8902dZc = c2; } else { c8902dZc = c8902dZc2; } ArrayList arrayList = new ArrayList(); if (c8902dZc.c > 0) { int i5 = c8902dZc.c; int i6 = c8902dZc.e; qCz[] qczArr = new qCz[8]; qCz[] e2 = e(c8902dZc, i5, i6, 0, 0, e); int[] iArr = c; for (int i7 = 0; i7 < iArr.length; i7++) { qczArr[iArr[i7]] = e2[i7]; } qCz qcz = qczArr[4]; if (qcz != null) { int i8 = (int) qcz.a; i = (int) qczArr[4].e; i2 = i8; } else { i = 0; i2 = 0; } qCz[] e3 = e(c8902dZc, i5, i6, i, i2, a); int[] iArr2 = d; for (int i9 = 0; i9 < iArr2.length; i9++) { qczArr[iArr2[i9]] = e3[i9]; } if (qczArr[0] != null || qczArr[3] != null) { arrayList.add(qczArr); } } if (!arrayList.isEmpty()) { return new mZe(c8902dZc, arrayList, i3); } } return new mZe(c8902dZc2, new ArrayList(), 0); } private static qCz[] e(C8902dZc c8902dZc, int i, int i2, int i3, int i4, int[] iArr) { boolean z; qCz[] qczArr = new qCz[4]; int[] iArr2 = new int[iArr.length]; int i5 = i3; while (true) { if (i5 >= i) { z = false; break; } int[] a2 = a(c8902dZc, i4, i5, i2, iArr, iArr2); if (a2 != null) { int i6 = i5; int[] iArr3 = a2; while (i6 > 0) { int i7 = i6 - 1; int[] a3 = a(c8902dZc, i4, i7, i2, iArr, iArr2); if (a3 == null) { break; } iArr3 = a3; i6 = i7; } float f = i6; qczArr[0] = new qCz(iArr3[0], f); qczArr[1] = new qCz(iArr3[1], f); z = true; i5 = i6; } else { i5 += 5; } } int i8 = i5 + 1; if (z) { int[] iArr4 = {(int) qczArr[0].a, (int) qczArr[1].a}; int i9 = i8; int i10 = 0; while (i9 < i) { int[] a4 = a(c8902dZc, iArr4[0], i9, i2, iArr, iArr2); if (a4 != null && Math.abs(iArr4[0] - a4[0]) < 5 && Math.abs(iArr4[1] - a4[1]) < 5) { iArr4 = a4; i10 = 0; } else { if (i10 > 25) { break; } i10++; } i9++; } i8 = i9 - (i10 + 1); float f2 = i8; qczArr[2] = new qCz(iArr4[0], f2); qczArr[3] = new qCz(iArr4[1], f2); } if (i8 - i5 < 10) { Arrays.fill(qczArr, (Object) null); } return qczArr; } private static int[] a(C8902dZc c8902dZc, int i, int i2, int i3, int[] iArr, int[] iArr2) { Arrays.fill(iArr2, 0, iArr2.length, 0); for (int i4 = 0; c8902dZc.b(i, i2) && i > 0 && i4 < 3; i4++) { i--; } int length = iArr.length; int i5 = i; int i6 = 0; boolean z = false; while (i < i3) { if (c8902dZc.b(i, i2) != z) { iArr2[i6] = iArr2[i6] + 1; } else { if (i6 != length - 1) { i6++; } else { if (c(iArr2, iArr) < 0.42f) { return new int[]{i5, i}; } i5 += iArr2[0] + iArr2[1]; int i7 = i6 - 1; System.arraycopy(iArr2, 2, iArr2, 0, i7); iArr2[i7] = 0; iArr2[i6] = 0; i6--; } iArr2[i6] = 1; z = !z; } i++; } if (i6 != length - 1 || c(iArr2, iArr) >= 0.42f) { return null; } return new int[]{i5, i - 1}; } private static float c(int[] iArr, int[] iArr2) { int length = iArr.length; int i = 0; int i2 = 0; for (int i3 = 0; i3 < length; i3++) { i += iArr[i3]; i2 += iArr2[i3]; } if (i < i2) { return Float.POSITIVE_INFINITY; } float f = i; float f2 = f / i2; float f3 = BitmapDescriptorFactory.HUE_RED; for (int i4 = 0; i4 < length; i4++) { float f4 = iArr2[i4] * f2; float f5 = iArr[i4]; float f6 = f5 > f4 ? f5 - f4 : f4 - f5; if (f6 > 0.8f * f2) { return Float.POSITIVE_INFINITY; } f3 += f6; } return f3 / f; } }