discord-jadx/app/src/main/java/c/i/e/q/k.java

236 lines
8.2 KiB
Java

package c.i.e.q;
import c.i.e.c;
import c.i.e.d;
import c.i.e.f;
import c.i.e.i;
import c.i.e.j;
import c.i.e.n.a;
import c.i.e.n.h;
import com.google.android.material.snackbar.BaseTransientBottomBar;
import com.google.zxing.ChecksumException;
import com.google.zxing.FormatException;
import com.google.zxing.NotFoundException;
import com.google.zxing.ReaderException;
import com.google.zxing.Result;
import java.util.Arrays;
import java.util.EnumMap;
import java.util.Map;
import java.util.Objects;
/* compiled from: OneDReader */
public abstract class k implements i {
public static float d(int[] iArr, int[] iArr2, float f) {
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 f2 = (float) i;
float f3 = f2 / ((float) i2);
float f4 = f * f3;
float f5 = 0.0f;
for (int i4 = 0; i4 < length; i4++) {
int i5 = iArr[i4];
float f6 = ((float) iArr2[i4]) * f3;
float f7 = (float) i5;
float f8 = f7 > f6 ? f7 - f6 : f6 - f7;
if (f8 > f4) {
return Float.POSITIVE_INFINITY;
}
f5 += f8;
}
return f5 / f2;
}
public static void e(a aVar, int i, int[] iArr) throws NotFoundException {
int length = iArr.length;
int i2 = 0;
Arrays.fill(iArr, 0, length, 0);
int i3 = aVar.j;
if (i < i3) {
boolean z2 = !aVar.b(i);
while (i < i3) {
if (aVar.b(i) == z2) {
i2++;
if (i2 == length) {
break;
}
iArr[i2] = 1;
z2 = !z2;
} else {
iArr[i2] = iArr[i2] + 1;
}
i++;
}
if (i2 == length) {
return;
}
if (i2 != length - 1 || i != i3) {
throw NotFoundException.k;
}
return;
}
throw NotFoundException.k;
}
public static void f(a aVar, int i, int[] iArr) throws NotFoundException {
int length = iArr.length;
boolean b = aVar.b(i);
while (i > 0 && length >= 0) {
i--;
if (aVar.b(i) != b) {
length--;
b = !b;
}
}
if (length < 0) {
e(aVar, i + 1, iArr);
return;
}
throw NotFoundException.k;
}
@Override // c.i.e.i
public Result a(c cVar, Map<d, ?> map) throws NotFoundException, FormatException {
j jVar = j.ORIENTATION;
try {
return c(cVar, map);
} catch (NotFoundException e) {
if (!(map != null && map.containsKey(d.TRY_HARDER)) || !cVar.a.a.c()) {
throw e;
}
f d = cVar.a.a.d();
Objects.requireNonNull((h) cVar.a);
Result c2 = c(new c(new h(d)), map);
Map<j, Object> map2 = c2.e;
int i = 270;
if (map2 != null && map2.containsKey(jVar)) {
i = (((Integer) map2.get(jVar)).intValue() + 270) % 360;
}
c2.b(jVar, Integer.valueOf(i));
c.i.e.k[] kVarArr = c2.f2477c;
if (kVarArr != null) {
int i2 = d.b;
for (int i3 = 0; i3 < kVarArr.length; i3++) {
kVarArr[i3] = new c.i.e.k((((float) i2) - kVarArr[i3].b) - 1.0f, kVarArr[i3].a);
}
}
return c2;
}
}
public abstract Result b(int i, a aVar, Map<d, ?> map) throws NotFoundException, ChecksumException, FormatException;
/* JADX WARNING: Removed duplicated region for block: B:39:0x007d A[Catch:{ ReaderException -> 0x00ba }] */
/* JADX WARNING: Removed duplicated region for block: B:69:0x00b9 A[SYNTHETIC] */
public final Result c(c cVar, Map<d, ?> map) throws NotFoundException {
k kVar;
int i;
Map<d, ?> map2;
c cVar2 = cVar;
EnumMap enumMap = map;
f fVar = cVar2.a.a;
int i2 = fVar.a;
int i3 = fVar.b;
a aVar = new a(i2);
int i4 = 1;
boolean z2 = enumMap != null && enumMap.containsKey(d.TRY_HARDER);
int max = Math.max(1, i3 >> (z2 ? 8 : 5));
int i5 = z2 ? i3 : 15;
int i6 = i3 / 2;
int i7 = 0;
while (i7 < i5) {
int i8 = i7 + 1;
int i9 = i8 / 2;
if (!((i7 & 1) == 0)) {
i9 = -i9;
}
int i10 = (i9 * max) + i6;
if (i10 < 0 || i10 >= i3) {
break;
}
try {
aVar = cVar2.b(i10, aVar);
int i11 = 0;
while (i11 < 2) {
if (i11 == i4) {
aVar.i();
if (enumMap != null) {
d dVar = d.NEED_RESULT_POINT_CALLBACK;
if (enumMap.containsKey(dVar)) {
EnumMap enumMap2 = new EnumMap(d.class);
enumMap2.putAll(enumMap);
enumMap2.remove(dVar);
kVar = this;
enumMap = enumMap2;
Result b = kVar.b(i10, aVar, enumMap);
if (i11 != i4) {
b.b(j.ORIENTATION, Integer.valueOf((int) BaseTransientBottomBar.ANIMATION_FADE_DURATION));
c.i.e.k[] kVarArr = b.f2477c;
if (kVarArr != null) {
float f = (float) i2;
map2 = enumMap;
try {
i = i3;
try {
kVarArr[0] = new c.i.e.k((f - kVarArr[0].a) - 1.0f, kVarArr[0].b);
try {
kVarArr[1] = new c.i.e.k((f - kVarArr[1].a) - 1.0f, kVarArr[1].b);
} catch (ReaderException unused) {
continue;
}
} catch (ReaderException unused2) {
i11++;
enumMap = map2;
i3 = i;
i4 = 1;
}
} catch (ReaderException unused3) {
i = i3;
i11++;
enumMap = map2;
i3 = i;
i4 = 1;
}
}
}
return b;
}
}
}
kVar = this;
try {
Result b = kVar.b(i10, aVar, enumMap);
if (i11 != i4) {
}
return b;
} catch (ReaderException unused4) {
map2 = enumMap;
i = i3;
i11++;
enumMap = map2;
i3 = i;
i4 = 1;
}
}
continue;
} catch (NotFoundException unused5) {
}
cVar2 = cVar;
i7 = i8;
i3 = i3;
i4 = 1;
}
throw NotFoundException.k;
}
@Override // c.i.e.i
public void reset() {
}
}