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

162 lines
6.2 KiB
Java

package c.i.e.q;
import c.i.e.d;
import c.i.e.k;
import c.i.e.n.a;
import com.google.zxing.ChecksumException;
import com.google.zxing.FormatException;
import com.google.zxing.NotFoundException;
import com.google.zxing.Result;
import java.util.Arrays;
import java.util.Map;
/* compiled from: Code39Reader */
public final class c extends k {
public static final int[] a = {52, 289, 97, 352, 49, 304, 112, 37, 292, 100, 265, 73, 328, 25, 280, 88, 13, 268, 76, 28, 259, 67, 322, 19, 274, 82, 7, 262, 70, 22, 385, 193, 448, 145, 400, 208, 133, 388, 196, 168, 162, 138, 42};
public final boolean b;
/* renamed from: c reason: collision with root package name */
public final StringBuilder f1419c = new StringBuilder(20);
public final int[] d = new int[9];
public c(boolean z2) {
this.b = z2;
}
public static int g(int[] iArr) {
int length = iArr.length;
int i = 0;
while (true) {
int i2 = Integer.MAX_VALUE;
for (int i3 : iArr) {
if (i3 < i2 && i3 > i) {
i2 = i3;
}
}
int i4 = 0;
int i5 = 0;
int i6 = 0;
for (int i7 = 0; i7 < length; i7++) {
int i8 = iArr[i7];
if (i8 > i2) {
i5 |= 1 << ((length - 1) - i7);
i4++;
i6 += i8;
}
}
if (i4 == 3) {
for (int i9 = 0; i9 < length && i4 > 0; i9++) {
int i10 = iArr[i9];
if (i10 > i2) {
i4--;
if ((i10 << 1) >= i6) {
return -1;
}
}
}
return i5;
} else if (i4 <= 3) {
return -1;
} else {
i = i2;
}
}
}
@Override // c.i.e.q.k
public Result b(int i, a aVar, Map<d, ?> map) throws NotFoundException, ChecksumException, FormatException {
char c2;
int[] iArr = this.d;
Arrays.fill(iArr, 0);
StringBuilder sb = this.f1419c;
sb.setLength(0);
int i2 = aVar.j;
int f = aVar.f(0);
int length = iArr.length;
int i3 = f;
boolean z2 = false;
int i4 = 0;
while (f < i2) {
if (aVar.b(f) != z2) {
iArr[i4] = iArr[i4] + 1;
} else {
if (i4 != length - 1) {
i4++;
} else if (g(iArr) != 148 || !aVar.h(Math.max(0, i3 - ((f - i3) / 2)), i3, false)) {
i3 += iArr[0] + iArr[1];
int i5 = i4 - 1;
System.arraycopy(iArr, 2, iArr, 0, i5);
iArr[i5] = 0;
iArr[i4] = 0;
i4 = i5;
} else {
int[] iArr2 = {i3, f};
int f2 = aVar.f(iArr2[1]);
int i6 = aVar.j;
while (true) {
k.e(aVar, f2, iArr);
int g = g(iArr);
if (g >= 0) {
int i7 = 0;
while (true) {
int[] iArr3 = a;
if (i7 < iArr3.length) {
if (iArr3[i7] == g) {
c2 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%".charAt(i7);
break;
}
i7++;
} else if (g == 148) {
c2 = '*';
} else {
throw NotFoundException.k;
}
}
sb.append(c2);
int i8 = f2;
for (int i9 : iArr) {
i8 += i9;
}
int f3 = aVar.f(i8);
if (c2 == '*') {
sb.setLength(sb.length() - 1);
int i10 = 0;
for (int i11 : iArr) {
i10 += i11;
}
int i12 = (f3 - f2) - i10;
if (f3 == i6 || (i12 << 1) >= i10) {
if (this.b) {
int length2 = sb.length() - 1;
int i13 = 0;
for (int i14 = 0; i14 < length2; i14++) {
i13 += "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%".indexOf(this.f1419c.charAt(i14));
}
if (sb.charAt(length2) == "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%".charAt(i13 % 43)) {
sb.setLength(length2);
} else {
throw ChecksumException.a();
}
}
if (sb.length() != 0) {
float f4 = (float) i;
return new Result(sb.toString(), null, new k[]{new k(((float) (iArr2[1] + iArr2[0])) / 2.0f, f4), new k((((float) i10) / 2.0f) + ((float) f2), f4)}, c.i.e.a.CODE_39);
}
throw NotFoundException.k;
}
throw NotFoundException.k;
}
f2 = f3;
} else {
throw NotFoundException.k;
}
}
}
iArr[i4] = 1;
z2 = !z2;
}
f++;
}
throw NotFoundException.k;
}
}