Initial commit

This commit is contained in:
2025-05-13 19:24:51 +02:00
commit a950f49678
10604 changed files with 932663 additions and 0 deletions

View File

@@ -0,0 +1,101 @@
package com.google.zxing.datamatrix;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.BinaryBitmap;
import com.google.zxing.ChecksumException;
import com.google.zxing.DecodeHintType;
import com.google.zxing.FormatException;
import com.google.zxing.NotFoundException;
import com.google.zxing.Reader;
import com.google.zxing.Result;
import com.google.zxing.ResultMetadataType;
import com.google.zxing.ResultPoint;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.common.DecoderResult;
import com.google.zxing.common.DetectorResult;
import com.google.zxing.datamatrix.decoder.Decoder;
import com.google.zxing.datamatrix.detector.Detector;
import java.util.List;
import java.util.Map;
/* loaded from: classes.dex */
public final class DataMatrixReader implements Reader {
private static final ResultPoint[] b = new ResultPoint[0];
private final Decoder a = new Decoder();
@Override // com.google.zxing.Reader
public Result a(BinaryBitmap binaryBitmap, Map<DecodeHintType, ?> map) throws NotFoundException, ChecksumException, FormatException {
ResultPoint[] b2;
DecoderResult decoderResult;
if (map == null || !map.containsKey(DecodeHintType.PURE_BARCODE)) {
DetectorResult a = new Detector(binaryBitmap.a()).a();
DecoderResult a2 = this.a.a(a.a());
b2 = a.b();
decoderResult = a2;
} else {
decoderResult = this.a.a(a(binaryBitmap.a()));
b2 = b;
}
Result result = new Result(decoderResult.h(), decoderResult.e(), b2, BarcodeFormat.DATA_MATRIX);
List<byte[]> a3 = decoderResult.a();
if (a3 != null) {
result.a(ResultMetadataType.BYTE_SEGMENTS, a3);
}
String b3 = decoderResult.b();
if (b3 != null) {
result.a(ResultMetadataType.ERROR_CORRECTION_LEVEL, b3);
}
return result;
}
@Override // com.google.zxing.Reader
public void reset() {
}
private static BitMatrix a(BitMatrix bitMatrix) throws NotFoundException {
int[] j = bitMatrix.j();
int[] b2 = bitMatrix.b();
if (j != null && b2 != null) {
int a = a(j, bitMatrix);
int i = j[1];
int i2 = b2[1];
int i3 = j[0];
int i4 = ((b2[0] - i3) + 1) / a;
int i5 = ((i2 - i) + 1) / a;
if (i4 > 0 && i5 > 0) {
int i6 = a / 2;
int i7 = i + i6;
int i8 = i3 + i6;
BitMatrix bitMatrix2 = new BitMatrix(i4, i5);
for (int i9 = 0; i9 < i5; i9++) {
int i10 = (i9 * a) + i7;
for (int i11 = 0; i11 < i4; i11++) {
if (bitMatrix.b((i11 * a) + i8, i10)) {
bitMatrix2.c(i11, i9);
}
}
}
return bitMatrix2;
}
throw NotFoundException.getNotFoundInstance();
}
throw NotFoundException.getNotFoundInstance();
}
private static int a(int[] iArr, BitMatrix bitMatrix) throws NotFoundException {
int k = bitMatrix.k();
int i = iArr[0];
int i2 = iArr[1];
while (i < k && bitMatrix.b(i, i2)) {
i++;
}
if (i != k) {
int i3 = i - iArr[0];
if (i3 != 0) {
return i3;
}
throw NotFoundException.getNotFoundInstance();
}
throw NotFoundException.getNotFoundInstance();
}
}

View File

@@ -0,0 +1,130 @@
package com.google.zxing.datamatrix;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.Dimension;
import com.google.zxing.EncodeHintType;
import com.google.zxing.Writer;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.datamatrix.encoder.DefaultPlacement;
import com.google.zxing.datamatrix.encoder.ErrorCorrection;
import com.google.zxing.datamatrix.encoder.HighLevelEncoder;
import com.google.zxing.datamatrix.encoder.SymbolInfo;
import com.google.zxing.datamatrix.encoder.SymbolShapeHint;
import com.google.zxing.qrcode.encoder.ByteMatrix;
import java.util.Map;
/* loaded from: classes.dex */
public final class DataMatrixWriter implements Writer {
@Override // com.google.zxing.Writer
public BitMatrix a(String str, BarcodeFormat barcodeFormat, int i, int i2, Map<EncodeHintType, ?> map) {
Dimension dimension;
if (str.isEmpty()) {
throw new IllegalArgumentException("Found empty contents");
}
if (barcodeFormat != BarcodeFormat.DATA_MATRIX) {
throw new IllegalArgumentException("Can only encode DATA_MATRIX, but got ".concat(String.valueOf(barcodeFormat)));
}
if (i < 0 || i2 < 0) {
throw new IllegalArgumentException("Requested dimensions can't be negative: " + i + 'x' + i2);
}
SymbolShapeHint symbolShapeHint = SymbolShapeHint.FORCE_NONE;
Dimension dimension2 = null;
if (map != null) {
SymbolShapeHint symbolShapeHint2 = (SymbolShapeHint) map.get(EncodeHintType.DATA_MATRIX_SHAPE);
if (symbolShapeHint2 != null) {
symbolShapeHint = symbolShapeHint2;
}
dimension = (Dimension) map.get(EncodeHintType.MIN_SIZE);
if (dimension == null) {
dimension = null;
}
Dimension dimension3 = (Dimension) map.get(EncodeHintType.MAX_SIZE);
if (dimension3 != null) {
dimension2 = dimension3;
}
} else {
dimension = null;
}
String a = HighLevelEncoder.a(str, symbolShapeHint, dimension, dimension2);
SymbolInfo a2 = SymbolInfo.a(a.length(), symbolShapeHint, dimension, dimension2, true);
DefaultPlacement defaultPlacement = new DefaultPlacement(ErrorCorrection.a(a, a2), a2.e(), a2.d());
defaultPlacement.a();
return a(defaultPlacement, a2, i, i2);
}
private static BitMatrix a(DefaultPlacement defaultPlacement, SymbolInfo symbolInfo, int i, int i2) {
int e = symbolInfo.e();
int d = symbolInfo.d();
ByteMatrix byteMatrix = new ByteMatrix(symbolInfo.g(), symbolInfo.f());
int i3 = 0;
for (int i4 = 0; i4 < d; i4++) {
if (i4 % symbolInfo.e == 0) {
int i5 = 0;
for (int i6 = 0; i6 < symbolInfo.g(); i6++) {
byteMatrix.a(i5, i3, i6 % 2 == 0);
i5++;
}
i3++;
}
int i7 = 0;
for (int i8 = 0; i8 < e; i8++) {
if (i8 % symbolInfo.d == 0) {
byteMatrix.a(i7, i3, true);
i7++;
}
byteMatrix.a(i7, i3, defaultPlacement.a(i8, i4));
i7++;
int i9 = symbolInfo.d;
if (i8 % i9 == i9 - 1) {
byteMatrix.a(i7, i3, i4 % 2 == 0);
i7++;
}
}
i3++;
int i10 = symbolInfo.e;
if (i4 % i10 == i10 - 1) {
int i11 = 0;
for (int i12 = 0; i12 < symbolInfo.g(); i12++) {
byteMatrix.a(i11, i3, true);
i11++;
}
i3++;
}
}
return a(byteMatrix, i, i2);
}
private static BitMatrix a(ByteMatrix byteMatrix, int i, int i2) {
BitMatrix bitMatrix;
int c = byteMatrix.c();
int b = byteMatrix.b();
int max = Math.max(i, c);
int max2 = Math.max(i2, b);
int min = Math.min(max / c, max2 / b);
int i3 = (max - (c * min)) / 2;
int i4 = (max2 - (b * min)) / 2;
if (i2 >= b && i >= c) {
bitMatrix = new BitMatrix(i, i2);
} else {
bitMatrix = new BitMatrix(c, b);
i3 = 0;
i4 = 0;
}
bitMatrix.a();
int i5 = 0;
while (i5 < b) {
int i6 = i3;
int i7 = 0;
while (i7 < c) {
if (byteMatrix.a(i7, i5) == 1) {
bitMatrix.a(i6, i4, min, min);
}
i7++;
i6 += min;
}
i5++;
i4 += min;
}
return bitMatrix;
}
}

View File

@@ -0,0 +1,305 @@
package com.google.zxing.datamatrix.decoder;
import com.google.zxing.FormatException;
import com.google.zxing.common.BitMatrix;
/* loaded from: classes.dex */
final class BitMatrixParser {
private final BitMatrix a;
private final BitMatrix b;
private final Version c;
BitMatrixParser(BitMatrix bitMatrix) throws FormatException {
int i = bitMatrix.i();
if (i < 8 || i > 144 || (i & 1) != 0) {
throw FormatException.getFormatInstance();
}
this.c = b(bitMatrix);
this.a = a(bitMatrix);
this.b = new BitMatrix(this.a.k(), this.a.i());
}
private static Version b(BitMatrix bitMatrix) throws FormatException {
return Version.a(bitMatrix.i(), bitMatrix.k());
}
private int c(int i, int i2) {
int i3 = i - 1;
int i4 = (a(i3, 0, i, i2) ? 1 : 0) << 1;
int i5 = i2 - 1;
if (a(i3, i5, i, i2)) {
i4 |= 1;
}
int i6 = i4 << 1;
int i7 = i2 - 3;
if (a(0, i7, i, i2)) {
i6 |= 1;
}
int i8 = i6 << 1;
int i9 = i2 - 2;
if (a(0, i9, i, i2)) {
i8 |= 1;
}
int i10 = i8 << 1;
if (a(0, i5, i, i2)) {
i10 |= 1;
}
int i11 = i10 << 1;
if (a(1, i7, i, i2)) {
i11 |= 1;
}
int i12 = i11 << 1;
if (a(1, i9, i, i2)) {
i12 |= 1;
}
int i13 = i12 << 1;
return a(1, i5, i, i2) ? i13 | 1 : i13;
}
private int d(int i, int i2) {
int i3 = (a(i + (-3), 0, i, i2) ? 1 : 0) << 1;
if (a(i - 2, 0, i, i2)) {
i3 |= 1;
}
int i4 = i3 << 1;
if (a(i - 1, 0, i, i2)) {
i4 |= 1;
}
int i5 = i4 << 1;
if (a(0, i2 - 2, i, i2)) {
i5 |= 1;
}
int i6 = i5 << 1;
int i7 = i2 - 1;
if (a(0, i7, i, i2)) {
i6 |= 1;
}
int i8 = i6 << 1;
if (a(1, i7, i, i2)) {
i8 |= 1;
}
int i9 = i8 << 1;
if (a(2, i7, i, i2)) {
i9 |= 1;
}
int i10 = i9 << 1;
return a(3, i7, i, i2) ? i10 | 1 : i10;
}
Version a() {
return this.c;
}
private boolean a(int i, int i2, int i3, int i4) {
if (i < 0) {
i += i3;
i2 += 4 - ((i3 + 4) & 7);
}
if (i2 < 0) {
i2 += i4;
i += 4 - ((i4 + 4) & 7);
}
this.b.c(i2, i);
return this.a.b(i2, i);
}
private int a(int i, int i2) {
int i3 = i - 1;
int i4 = (a(i3, 0, i, i2) ? 1 : 0) << 1;
if (a(i3, 1, i, i2)) {
i4 |= 1;
}
int i5 = i4 << 1;
if (a(i3, 2, i, i2)) {
i5 |= 1;
}
int i6 = i5 << 1;
if (a(0, i2 - 2, i, i2)) {
i6 |= 1;
}
int i7 = i6 << 1;
int i8 = i2 - 1;
if (a(0, i8, i, i2)) {
i7 |= 1;
}
int i9 = i7 << 1;
if (a(1, i8, i, i2)) {
i9 |= 1;
}
int i10 = i9 << 1;
if (a(2, i8, i, i2)) {
i10 |= 1;
}
int i11 = i10 << 1;
return a(3, i8, i, i2) ? i11 | 1 : i11;
}
byte[] b() throws FormatException {
byte[] bArr = new byte[this.c.f()];
int i = this.a.i();
int k = this.a.k();
int i2 = 4;
int i3 = 0;
boolean z = false;
int i4 = 0;
boolean z2 = false;
boolean z3 = false;
boolean z4 = false;
while (true) {
if (i2 == i && i3 == 0 && !z) {
bArr[i4] = (byte) a(i, k);
i2 -= 2;
i3 += 2;
i4++;
z = true;
} else {
int i5 = i - 2;
if (i2 == i5 && i3 == 0 && (k & 3) != 0 && !z2) {
bArr[i4] = (byte) b(i, k);
i2 -= 2;
i3 += 2;
i4++;
z2 = true;
} else if (i2 == i + 4 && i3 == 2 && (k & 7) == 0 && !z3) {
bArr[i4] = (byte) c(i, k);
i2 -= 2;
i3 += 2;
i4++;
z3 = true;
} else if (i2 == i5 && i3 == 0 && (k & 7) == 4 && !z4) {
bArr[i4] = (byte) d(i, k);
i2 -= 2;
i3 += 2;
i4++;
z4 = true;
} else {
do {
if (i2 < i && i3 >= 0 && !this.b.b(i3, i2)) {
bArr[i4] = (byte) b(i2, i3, i, k);
i4++;
}
i2 -= 2;
i3 += 2;
if (i2 < 0) {
break;
}
} while (i3 < k);
int i6 = i2 + 1;
int i7 = i3 + 3;
do {
if (i6 >= 0 && i7 < k && !this.b.b(i7, i6)) {
bArr[i4] = (byte) b(i6, i7, i, k);
i4++;
}
i6 += 2;
i7 -= 2;
if (i6 >= i) {
break;
}
} while (i7 >= 0);
i2 = i6 + 3;
i3 = i7 + 1;
}
}
if (i2 >= i && i3 >= k) {
break;
}
}
if (i4 == this.c.f()) {
return bArr;
}
throw FormatException.getFormatInstance();
}
private BitMatrix a(BitMatrix bitMatrix) {
int e = this.c.e();
int d = this.c.d();
if (bitMatrix.i() == e) {
int b = this.c.b();
int a = this.c.a();
int i = e / b;
int i2 = d / a;
BitMatrix bitMatrix2 = new BitMatrix(i2 * a, i * b);
for (int i3 = 0; i3 < i; i3++) {
int i4 = i3 * b;
for (int i5 = 0; i5 < i2; i5++) {
int i6 = i5 * a;
for (int i7 = 0; i7 < b; i7++) {
int i8 = ((b + 2) * i3) + 1 + i7;
int i9 = i4 + i7;
for (int i10 = 0; i10 < a; i10++) {
if (bitMatrix.b(((a + 2) * i5) + 1 + i10, i8)) {
bitMatrix2.c(i6 + i10, i9);
}
}
}
}
}
return bitMatrix2;
}
throw new IllegalArgumentException("Dimension of bitMatrix must match the version size");
}
private int b(int i, int i2, int i3, int i4) {
int i5 = i - 2;
int i6 = i2 - 2;
int i7 = (a(i5, i6, i3, i4) ? 1 : 0) << 1;
int i8 = i2 - 1;
if (a(i5, i8, i3, i4)) {
i7 |= 1;
}
int i9 = i7 << 1;
int i10 = i - 1;
if (a(i10, i6, i3, i4)) {
i9 |= 1;
}
int i11 = i9 << 1;
if (a(i10, i8, i3, i4)) {
i11 |= 1;
}
int i12 = i11 << 1;
if (a(i10, i2, i3, i4)) {
i12 |= 1;
}
int i13 = i12 << 1;
if (a(i, i6, i3, i4)) {
i13 |= 1;
}
int i14 = i13 << 1;
if (a(i, i8, i3, i4)) {
i14 |= 1;
}
int i15 = i14 << 1;
return a(i, i2, i3, i4) ? i15 | 1 : i15;
}
private int b(int i, int i2) {
int i3 = (a(i + (-3), 0, i, i2) ? 1 : 0) << 1;
if (a(i - 2, 0, i, i2)) {
i3 |= 1;
}
int i4 = i3 << 1;
if (a(i - 1, 0, i, i2)) {
i4 |= 1;
}
int i5 = i4 << 1;
if (a(0, i2 - 4, i, i2)) {
i5 |= 1;
}
int i6 = i5 << 1;
if (a(0, i2 - 3, i, i2)) {
i6 |= 1;
}
int i7 = i6 << 1;
if (a(0, i2 - 2, i, i2)) {
i7 |= 1;
}
int i8 = i7 << 1;
int i9 = i2 - 1;
if (a(0, i9, i, i2)) {
i8 |= 1;
}
int i10 = i8 << 1;
return a(1, i9, i, i2) ? i10 | 1 : i10;
}
}

View File

@@ -0,0 +1,87 @@
package com.google.zxing.datamatrix.decoder;
import com.google.zxing.datamatrix.decoder.Version;
/* loaded from: classes.dex */
final class DataBlock {
private final int a;
private final byte[] b;
private DataBlock(int i, byte[] bArr) {
this.a = i;
this.b = bArr;
}
static DataBlock[] a(byte[] bArr, Version version) {
Version.ECBlocks c = version.c();
Version.ECB[] a = c.a();
int i = 0;
for (Version.ECB ecb : a) {
i += ecb.a();
}
DataBlock[] dataBlockArr = new DataBlock[i];
int length = a.length;
int i2 = 0;
int i3 = 0;
while (i2 < length) {
Version.ECB ecb2 = a[i2];
int i4 = i3;
int i5 = 0;
while (i5 < ecb2.a()) {
int b = ecb2.b();
dataBlockArr[i4] = new DataBlock(b, new byte[c.b() + b]);
i5++;
i4++;
}
i2++;
i3 = i4;
}
int length2 = dataBlockArr[0].b.length - c.b();
int i6 = length2 - 1;
int i7 = 0;
int i8 = 0;
while (i7 < i6) {
int i9 = i8;
int i10 = 0;
while (i10 < i3) {
dataBlockArr[i10].b[i7] = bArr[i9];
i10++;
i9++;
}
i7++;
i8 = i9;
}
boolean z = version.g() == 24;
int i11 = z ? 8 : i3;
int i12 = i8;
int i13 = 0;
while (i13 < i11) {
dataBlockArr[i13].b[i6] = bArr[i12];
i13++;
i12++;
}
int length3 = dataBlockArr[0].b.length;
while (length2 < length3) {
int i14 = 0;
while (i14 < i3) {
int i15 = z ? (i14 + 8) % i3 : i14;
dataBlockArr[i15].b[(!z || i15 <= 7) ? length2 : length2 - 1] = bArr[i12];
i14++;
i12++;
}
length2++;
}
if (i12 == bArr.length) {
return dataBlockArr;
}
throw new IllegalArgumentException();
}
int b() {
return this.a;
}
byte[] a() {
return this.b;
}
}

View File

@@ -0,0 +1,422 @@
package com.google.zxing.datamatrix.decoder;
import androidx.recyclerview.widget.ItemTouchHelper;
import com.google.zxing.FormatException;
import com.google.zxing.common.BitSource;
import com.google.zxing.common.DecoderResult;
import com.ijm.dataencryption.de.DataDecryptTool;
import com.ubtrobot.jimu.robotapi.PeripheralType;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Collection;
/* loaded from: classes.dex */
final class DecodedBitStreamParser {
private static final char[] a = {'*', '*', '*', ' ', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};
private static final char[] b = {'!', '\"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/', ':', ';', '<', '=', '>', '?', '@', '[', '\\', ']', '^', '_'};
private static final char[] c = {'*', '*', '*', ' ', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
private static final char[] d = b;
private static final char[] e = {'`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '{', '|', '}', '~', 127};
/* renamed from: com.google.zxing.datamatrix.decoder.DecodedBitStreamParser$1, reason: invalid class name */
static /* synthetic */ class AnonymousClass1 {
static final /* synthetic */ int[] a = new int[Mode.values().length];
static {
try {
a[Mode.C40_ENCODE.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
a[Mode.TEXT_ENCODE.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
a[Mode.ANSIX12_ENCODE.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
a[Mode.EDIFACT_ENCODE.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
a[Mode.BASE256_ENCODE.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
}
}
private enum Mode {
PAD_ENCODE,
ASCII_ENCODE,
C40_ENCODE,
TEXT_ENCODE,
ANSIX12_ENCODE,
EDIFACT_ENCODE,
BASE256_ENCODE
}
static DecoderResult a(byte[] bArr) throws FormatException {
BitSource bitSource = new BitSource(bArr);
StringBuilder sb = new StringBuilder(100);
StringBuilder sb2 = new StringBuilder(0);
ArrayList arrayList = new ArrayList(1);
Mode mode = Mode.ASCII_ENCODE;
do {
if (mode == Mode.ASCII_ENCODE) {
mode = a(bitSource, sb, sb2);
} else {
int i = AnonymousClass1.a[mode.ordinal()];
if (i == 1) {
b(bitSource, sb);
} else if (i == 2) {
d(bitSource, sb);
} else if (i == 3) {
a(bitSource, sb);
} else if (i == 4) {
c(bitSource, sb);
} else {
if (i != 5) {
throw FormatException.getFormatInstance();
}
a(bitSource, sb, arrayList);
}
mode = Mode.ASCII_ENCODE;
}
if (mode == Mode.PAD_ENCODE) {
break;
}
} while (bitSource.a() > 0);
if (sb2.length() > 0) {
sb.append((CharSequence) sb2);
}
String sb3 = sb.toString();
if (arrayList.isEmpty()) {
arrayList = null;
}
return new DecoderResult(bArr, sb3, arrayList, null);
}
private static void b(BitSource bitSource, StringBuilder sb) throws FormatException {
int a2;
int[] iArr = new int[3];
boolean z = false;
int i = 0;
while (bitSource.a() != 8 && (a2 = bitSource.a(8)) != 254) {
a(a2, bitSource.a(8), iArr);
boolean z2 = z;
for (int i2 = 0; i2 < 3; i2++) {
int i3 = iArr[i2];
if (i != 0) {
if (i != 1) {
if (i == 2) {
char[] cArr = b;
if (i3 < cArr.length) {
char c2 = cArr[i3];
if (z2) {
sb.append((char) (c2 + 128));
z2 = false;
} else {
sb.append(c2);
}
} else if (i3 == 27) {
sb.append((char) 29);
} else {
if (i3 != 30) {
throw FormatException.getFormatInstance();
}
z2 = true;
}
i = 0;
} else {
if (i != 3) {
throw FormatException.getFormatInstance();
}
if (z2) {
sb.append((char) (i3 + 224));
z2 = false;
i = 0;
} else {
sb.append((char) (i3 + 96));
i = 0;
}
}
} else if (z2) {
sb.append((char) (i3 + PeripheralType.SERVO));
z2 = false;
i = 0;
} else {
sb.append((char) i3);
i = 0;
}
} else if (i3 < 3) {
i = i3 + 1;
} else {
char[] cArr2 = a;
if (i3 >= cArr2.length) {
throw FormatException.getFormatInstance();
}
char c3 = cArr2[i3];
if (z2) {
sb.append((char) (c3 + 128));
z2 = false;
} else {
sb.append(c3);
}
}
}
if (bitSource.a() <= 0) {
return;
} else {
z = z2;
}
}
}
private static void c(BitSource bitSource, StringBuilder sb) {
while (bitSource.a() > 16) {
for (int i = 0; i < 4; i++) {
int a2 = bitSource.a(6);
if (a2 == 31) {
int b2 = 8 - bitSource.b();
if (b2 != 8) {
bitSource.a(b2);
return;
}
return;
}
if ((a2 & 32) == 0) {
a2 |= 64;
}
sb.append((char) a2);
}
if (bitSource.a() <= 0) {
return;
}
}
}
private static void d(BitSource bitSource, StringBuilder sb) throws FormatException {
int a2;
int[] iArr = new int[3];
boolean z = false;
int i = 0;
while (bitSource.a() != 8 && (a2 = bitSource.a(8)) != 254) {
a(a2, bitSource.a(8), iArr);
boolean z2 = z;
for (int i2 = 0; i2 < 3; i2++) {
int i3 = iArr[i2];
if (i != 0) {
if (i != 1) {
if (i == 2) {
char[] cArr = d;
if (i3 < cArr.length) {
char c2 = cArr[i3];
if (z2) {
sb.append((char) (c2 + 128));
z2 = false;
} else {
sb.append(c2);
}
} else if (i3 == 27) {
sb.append((char) 29);
} else {
if (i3 != 30) {
throw FormatException.getFormatInstance();
}
z2 = true;
}
i = 0;
} else {
if (i != 3) {
throw FormatException.getFormatInstance();
}
char[] cArr2 = e;
if (i3 >= cArr2.length) {
throw FormatException.getFormatInstance();
}
char c3 = cArr2[i3];
if (z2) {
sb.append((char) (c3 + 128));
z2 = false;
i = 0;
} else {
sb.append(c3);
i = 0;
}
}
} else if (z2) {
sb.append((char) (i3 + PeripheralType.SERVO));
z2 = false;
i = 0;
} else {
sb.append((char) i3);
i = 0;
}
} else if (i3 < 3) {
i = i3 + 1;
} else {
char[] cArr3 = c;
if (i3 >= cArr3.length) {
throw FormatException.getFormatInstance();
}
char c4 = cArr3[i3];
if (z2) {
sb.append((char) (c4 + 128));
z2 = false;
} else {
sb.append(c4);
}
}
}
if (bitSource.a() <= 0) {
return;
} else {
z = z2;
}
}
}
private static Mode a(BitSource bitSource, StringBuilder sb, StringBuilder sb2) throws FormatException {
boolean z = false;
do {
int a2 = bitSource.a(8);
if (a2 == 0) {
throw FormatException.getFormatInstance();
}
if (a2 > 128) {
if (a2 != 129) {
if (a2 <= 229) {
int i = a2 - 130;
if (i < 10) {
sb.append('0');
}
sb.append(i);
} else {
switch (a2) {
case 230:
return Mode.C40_ENCODE;
case 231:
return Mode.BASE256_ENCODE;
case 232:
sb.append((char) 29);
break;
case 233:
case 234:
case 241:
break;
case 235:
z = true;
break;
case 236:
sb.append("[)>\u001e05\u001d");
sb2.insert(0, "\u001e\u0004");
break;
case 237:
sb.append("[)>\u001e06\u001d");
sb2.insert(0, "\u001e\u0004");
break;
case 238:
return Mode.ANSIX12_ENCODE;
case 239:
return Mode.TEXT_ENCODE;
case 240:
return Mode.EDIFACT_ENCODE;
default:
if (a2 != 254 || bitSource.a() != 0) {
throw FormatException.getFormatInstance();
}
break;
}
}
} else {
return Mode.PAD_ENCODE;
}
} else {
if (z) {
a2 += PeripheralType.SERVO;
}
sb.append((char) (a2 - 1));
return Mode.ASCII_ENCODE;
}
} while (bitSource.a() > 0);
return Mode.ASCII_ENCODE;
}
private static void a(BitSource bitSource, StringBuilder sb) throws FormatException {
int a2;
int[] iArr = new int[3];
while (bitSource.a() != 8 && (a2 = bitSource.a(8)) != 254) {
a(a2, bitSource.a(8), iArr);
for (int i = 0; i < 3; i++) {
int i2 = iArr[i];
if (i2 == 0) {
sb.append('\r');
} else if (i2 == 1) {
sb.append('*');
} else if (i2 == 2) {
sb.append('>');
} else if (i2 == 3) {
sb.append(' ');
} else if (i2 < 14) {
sb.append((char) (i2 + 44));
} else if (i2 < 40) {
sb.append((char) (i2 + 51));
} else {
throw FormatException.getFormatInstance();
}
}
if (bitSource.a() <= 0) {
return;
}
}
}
private static void a(int i, int i2, int[] iArr) {
int i3 = ((i << 8) + i2) - 1;
int i4 = i3 / 1600;
iArr[0] = i4;
int i5 = i3 - (i4 * 1600);
int i6 = i5 / 40;
iArr[1] = i6;
iArr[2] = i5 - (i6 * 40);
}
private static void a(BitSource bitSource, StringBuilder sb, Collection<byte[]> collection) throws FormatException {
int c2 = bitSource.c() + 1;
int i = c2 + 1;
int a2 = a(bitSource.a(8), c2);
if (a2 == 0) {
a2 = bitSource.a() / 8;
} else if (a2 >= 250) {
a2 = ((a2 - 249) * ItemTouchHelper.Callback.DEFAULT_SWIPE_ANIMATION_DURATION) + a(bitSource.a(8), i);
i++;
}
if (a2 >= 0) {
byte[] bArr = new byte[a2];
int i2 = 0;
while (i2 < a2) {
if (bitSource.a() >= 8) {
bArr[i2] = (byte) a(bitSource.a(8), i);
i2++;
i++;
} else {
throw FormatException.getFormatInstance();
}
}
collection.add(bArr);
try {
sb.append(new String(bArr, "ISO8859_1"));
return;
} catch (UnsupportedEncodingException e2) {
throw new IllegalStateException("Platform does not support required encoding: ".concat(String.valueOf(e2)));
}
}
throw FormatException.getFormatInstance();
}
private static int a(int i, int i2) {
int i3 = i - (((i2 * 149) % 255) + 1);
return i3 >= 0 ? i3 : i3 + DataDecryptTool.DECRYPT_ALL_FILE;
}
}

View File

@@ -0,0 +1,51 @@
package com.google.zxing.datamatrix.decoder;
import com.google.zxing.ChecksumException;
import com.google.zxing.FormatException;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.common.DecoderResult;
import com.google.zxing.common.reedsolomon.GenericGF;
import com.google.zxing.common.reedsolomon.ReedSolomonDecoder;
import com.google.zxing.common.reedsolomon.ReedSolomonException;
/* loaded from: classes.dex */
public final class Decoder {
private final ReedSolomonDecoder a = new ReedSolomonDecoder(GenericGF.m);
public DecoderResult a(BitMatrix bitMatrix) throws FormatException, ChecksumException {
BitMatrixParser bitMatrixParser = new BitMatrixParser(bitMatrix);
DataBlock[] a = DataBlock.a(bitMatrixParser.b(), bitMatrixParser.a());
int i = 0;
for (DataBlock dataBlock : a) {
i += dataBlock.b();
}
byte[] bArr = new byte[i];
int length = a.length;
for (int i2 = 0; i2 < length; i2++) {
DataBlock dataBlock2 = a[i2];
byte[] a2 = dataBlock2.a();
int b = dataBlock2.b();
a(a2, b);
for (int i3 = 0; i3 < b; i3++) {
bArr[(i3 * length) + i2] = a2[i3];
}
}
return DecodedBitStreamParser.a(bArr);
}
private void a(byte[] bArr, int i) throws ChecksumException {
int length = bArr.length;
int[] iArr = new int[length];
for (int i2 = 0; i2 < length; i2++) {
iArr[i2] = bArr[i2] & 255;
}
try {
this.a.a(iArr, bArr.length - i);
for (int i3 = 0; i3 < i; i3++) {
bArr[i3] = (byte) iArr[i3];
}
} catch (ReedSolomonException unused) {
throw ChecksumException.getChecksumInstance();
}
}
}

View File

@@ -0,0 +1,145 @@
package com.google.zxing.datamatrix.decoder;
import com.google.zxing.FormatException;
import com.twitter.sdk.android.core.TwitterAuthConfig;
/* loaded from: classes.dex */
public final class Version {
private static final Version[] h = h();
private final int a;
private final int b;
private final int c;
private final int d;
private final int e;
private final ECBlocks f;
private final int g;
static final class ECB {
private final int a;
private final int b;
int a() {
return this.a;
}
int b() {
return this.b;
}
private ECB(int i, int i2) {
this.a = i;
this.b = i2;
}
}
private Version(int i, int i2, int i3, int i4, int i5, ECBlocks eCBlocks) {
this.a = i;
this.b = i2;
this.c = i3;
this.d = i4;
this.e = i5;
this.f = eCBlocks;
int b = eCBlocks.b();
int i6 = 0;
for (ECB ecb : eCBlocks.a()) {
i6 += ecb.a() * (ecb.b() + b);
}
this.g = i6;
}
private static Version[] h() {
int i = 1;
int i2 = 5;
int i3 = 8;
int i4 = 7;
Version version = new Version(3, 14, 14, 12, 12, new ECBlocks(10, new ECB(i, i3)));
int i5 = 2;
int i6 = 12;
int i7 = 18;
Version version2 = new Version(5, 18, 18, 16, 16, new ECBlocks(14, new ECB(i, 18)));
int i8 = 4;
Version version3 = new Version(7, 22, 22, 20, 20, new ECBlocks(20, new ECB(i, 30)));
int i9 = 6;
ECB ecb = new ECB(i, 36);
ECB ecb2 = new ECB(i, 44);
ECB ecb3 = new ECB(i, 62);
ECB ecb4 = new ECB(i, 86);
ECB ecb5 = new ECB(i, 114);
ECB ecb6 = new ECB(i, 144);
int i10 = 56;
ECB ecb7 = new ECB(i, 174);
Version version4 = new Version(15, 52, 52, 24, 24, new ECBlocks(42, new ECB(i5, 102)));
ECB ecb8 = new ECB(i8, 92);
ECB ecb9 = new ECB(i8, 114);
ECB ecb10 = new ECB(i8, 174);
ECB ecb11 = new ECB(i9, 175);
return new Version[]{new Version(1, 10, 10, 8, 8, new ECBlocks(i2, new ECB(i, 3))), new Version(2, 12, 12, 10, 10, new ECBlocks(i4, new ECB(i, i2))), version, new Version(4, 16, 16, 14, 14, new ECBlocks(i6, new ECB(i, i6))), version2, new Version(6, 20, 20, 18, 18, new ECBlocks(i7, new ECB(i, 22))), version3, new Version(8, 24, 24, 22, 22, new ECBlocks(24, ecb)), new Version(9, 26, 26, 24, 24, new ECBlocks(28, ecb2)), new Version(10, 32, 32, 14, 14, new ECBlocks(36, ecb3)), new Version(11, 36, 36, 16, 16, new ECBlocks(42, ecb4)), new Version(12, 40, 40, 18, 18, new ECBlocks(48, ecb5)), new Version(13, 44, 44, 20, 20, new ECBlocks(56, ecb6)), new Version(14, 48, 48, 22, 22, new ECBlocks(68, ecb7)), version4, new Version(16, 64, 64, 14, 14, new ECBlocks(i10, new ECB(i5, TwitterAuthConfig.DEFAULT_AUTH_REQUEST_CODE))), new Version(17, 72, 72, 16, 16, new ECBlocks(36, ecb8)), new Version(18, 80, 80, 18, 18, new ECBlocks(48, ecb9)), new Version(19, 88, 88, 20, 20, new ECBlocks(i10, new ECB(i8, 144))), new Version(20, 96, 96, 22, 22, new ECBlocks(68, ecb10)), new Version(21, 104, 104, 24, 24, new ECBlocks(i10, new ECB(i9, 136))), new Version(22, 120, 120, 18, 18, new ECBlocks(68, ecb11)), new Version(23, 132, 132, 20, 20, new ECBlocks(62, new ECB(i3, 163))), new Version(24, 144, 144, 22, 22, new ECBlocks(62, new ECB(i3, 156), new ECB(i5, 155))), new Version(25, 8, 18, 6, 16, new ECBlocks(i4, new ECB(i, i2))), new Version(26, 8, 32, 6, 14, new ECBlocks(11, new ECB(i, 10))), new Version(27, 12, 26, 10, 24, new ECBlocks(14, new ECB(i, 16))), new Version(28, 12, 36, 10, 16, new ECBlocks(i7, new ECB(i, 22))), new Version(29, 16, 36, 14, 16, new ECBlocks(24, new ECB(i, 32))), new Version(30, 16, 48, 14, 22, new ECBlocks(28, new ECB(i, 49)))};
}
public int a() {
return this.e;
}
public int b() {
return this.d;
}
ECBlocks c() {
return this.f;
}
public int d() {
return this.c;
}
public int e() {
return this.b;
}
public int f() {
return this.g;
}
public int g() {
return this.a;
}
public String toString() {
return String.valueOf(this.a);
}
static final class ECBlocks {
private final int a;
private final ECB[] b;
ECB[] a() {
return this.b;
}
int b() {
return this.a;
}
private ECBlocks(int i, ECB ecb) {
this.a = i;
this.b = new ECB[]{ecb};
}
private ECBlocks(int i, ECB ecb, ECB ecb2) {
this.a = i;
this.b = new ECB[]{ecb, ecb2};
}
}
public static Version a(int i, int i2) throws FormatException {
if ((i & 1) != 0 || (i2 & 1) != 0) {
throw FormatException.getFormatInstance();
}
for (Version version : h) {
if (version.b == i && version.c == i2) {
return version;
}
}
throw FormatException.getFormatInstance();
}
}

View File

@@ -0,0 +1,249 @@
package com.google.zxing.datamatrix.detector;
import com.google.zxing.NotFoundException;
import com.google.zxing.ResultPoint;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.common.DetectorResult;
import com.google.zxing.common.GridSampler;
import com.google.zxing.common.detector.MathUtils;
import com.google.zxing.common.detector.WhiteRectangleDetector;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
/* loaded from: classes.dex */
public final class Detector {
private final BitMatrix a;
private final WhiteRectangleDetector b;
private static final class ResultPointsAndTransitions {
private final ResultPoint a;
private final ResultPoint b;
private final int c;
ResultPoint a() {
return this.a;
}
ResultPoint b() {
return this.b;
}
int c() {
return this.c;
}
public String toString() {
return this.a + "/" + this.b + '/' + this.c;
}
private ResultPointsAndTransitions(ResultPoint resultPoint, ResultPoint resultPoint2, int i) {
this.a = resultPoint;
this.b = resultPoint2;
this.c = i;
}
}
private static final class ResultPointsAndTransitionsComparator implements Serializable, Comparator<ResultPointsAndTransitions> {
private ResultPointsAndTransitionsComparator() {
}
@Override // java.util.Comparator
/* renamed from: a, reason: merged with bridge method [inline-methods] */
public int compare(ResultPointsAndTransitions resultPointsAndTransitions, ResultPointsAndTransitions resultPointsAndTransitions2) {
return resultPointsAndTransitions.c() - resultPointsAndTransitions2.c();
}
}
public Detector(BitMatrix bitMatrix) throws NotFoundException {
this.a = bitMatrix;
this.b = new WhiteRectangleDetector(bitMatrix);
}
private ResultPointsAndTransitions b(ResultPoint resultPoint, ResultPoint resultPoint2) {
int a = (int) resultPoint.a();
int b = (int) resultPoint.b();
int a2 = (int) resultPoint2.a();
int b2 = (int) resultPoint2.b();
int i = 0;
boolean z = Math.abs(b2 - b) > Math.abs(a2 - a);
if (z) {
b = a;
a = b;
b2 = a2;
a2 = b2;
}
int abs = Math.abs(a2 - a);
int abs2 = Math.abs(b2 - b);
int i2 = (-abs) / 2;
int i3 = b < b2 ? 1 : -1;
int i4 = a >= a2 ? -1 : 1;
boolean b3 = this.a.b(z ? b : a, z ? a : b);
while (a != a2) {
boolean b4 = this.a.b(z ? b : a, z ? a : b);
if (b4 != b3) {
i++;
b3 = b4;
}
i2 += abs2;
if (i2 > 0) {
if (b == b2) {
break;
}
b += i3;
i2 -= abs;
}
a += i4;
}
return new ResultPointsAndTransitions(resultPoint, resultPoint2, i);
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r14v3, types: [com.google.zxing.ResultPoint] */
/* JADX WARN: Type inference failed for: r16v3, types: [com.google.zxing.ResultPoint] */
/* JADX WARN: Type inference failed for: r22v0, types: [com.google.zxing.ResultPoint] */
/* JADX WARN: Type inference failed for: r23v0, types: [com.google.zxing.datamatrix.detector.Detector] */
/* JADX WARN: Type inference failed for: r3v3, types: [com.google.zxing.ResultPoint[]] */
/* JADX WARN: Type inference failed for: r4v6, types: [com.google.zxing.ResultPoint[]] */
/* JADX WARN: Type inference failed for: r6v2, types: [com.google.zxing.ResultPoint] */
public DetectorResult a() throws NotFoundException {
ResultPoint resultPoint;
ResultPoint a;
BitMatrix a2;
ResultPoint[] a3 = this.b.a();
ResultPoint resultPoint2 = a3[0];
ResultPoint resultPoint3 = a3[1];
ResultPoint resultPoint4 = a3[2];
ResultPoint resultPoint5 = a3[3];
ArrayList arrayList = new ArrayList(4);
arrayList.add(b(resultPoint2, resultPoint3));
arrayList.add(b(resultPoint2, resultPoint4));
arrayList.add(b(resultPoint3, resultPoint5));
arrayList.add(b(resultPoint4, resultPoint5));
AnonymousClass1 anonymousClass1 = null;
Collections.sort(arrayList, new ResultPointsAndTransitionsComparator());
ResultPointsAndTransitions resultPointsAndTransitions = (ResultPointsAndTransitions) arrayList.get(0);
ResultPointsAndTransitions resultPointsAndTransitions2 = (ResultPointsAndTransitions) arrayList.get(1);
HashMap hashMap = new HashMap();
a(hashMap, resultPointsAndTransitions.a());
a(hashMap, resultPointsAndTransitions.b());
a(hashMap, resultPointsAndTransitions2.a());
a(hashMap, resultPointsAndTransitions2.b());
Object obj = null;
Object obj2 = null;
for (Map.Entry entry : hashMap.entrySet()) {
?? r16 = (ResultPoint) entry.getKey();
if (((Integer) entry.getValue()).intValue() == 2) {
obj = r16;
} else if (anonymousClass1 == null) {
anonymousClass1 = r16;
} else {
obj2 = r16;
}
}
if (anonymousClass1 == null || obj == null || obj2 == null) {
throw NotFoundException.getNotFoundInstance();
}
?? r4 = {anonymousClass1, obj, obj2};
ResultPoint.a(r4);
?? r14 = r4[0];
?? r22 = r4[1];
?? r6 = r4[2];
ResultPoint resultPoint6 = !hashMap.containsKey(resultPoint2) ? resultPoint2 : !hashMap.containsKey(resultPoint3) ? resultPoint3 : !hashMap.containsKey(resultPoint4) ? resultPoint4 : resultPoint5;
int c = b(r6, resultPoint6).c();
int c2 = b(r14, resultPoint6).c();
if ((c & 1) == 1) {
c++;
}
int i = c + 2;
if ((c2 & 1) == 1) {
c2++;
}
int i2 = c2 + 2;
if (i * 4 >= i2 * 7 || i2 * 4 >= i * 7) {
resultPoint = r6;
a = a(r22, r14, r6, resultPoint6, i, i2);
if (a == null) {
a = resultPoint6;
}
int c3 = b(resultPoint, a).c();
int c4 = b(r14, a).c();
if ((c3 & 1) == 1) {
c3++;
}
int i3 = c3;
if ((c4 & 1) == 1) {
c4++;
}
a2 = a(this.a, resultPoint, r22, r14, a, i3, c4);
} else {
a = a(r22, r14, r6, resultPoint6, Math.min(i2, i));
if (a == null) {
a = resultPoint6;
}
int max = Math.max(b(r6, a).c(), b(r14, a).c()) + 1;
if ((max & 1) == 1) {
max++;
}
int i4 = max;
a2 = a(this.a, r6, r22, r14, a, i4, i4);
resultPoint = r6;
}
return new DetectorResult(a2, new ResultPoint[]{resultPoint, r22, r14, a});
}
private ResultPoint a(ResultPoint resultPoint, ResultPoint resultPoint2, ResultPoint resultPoint3, ResultPoint resultPoint4, int i, int i2) {
float a = a(resultPoint, resultPoint2) / i;
float a2 = a(resultPoint3, resultPoint4);
ResultPoint resultPoint5 = new ResultPoint(resultPoint4.a() + (((resultPoint4.a() - resultPoint3.a()) / a2) * a), resultPoint4.b() + (a * ((resultPoint4.b() - resultPoint3.b()) / a2)));
float a3 = a(resultPoint, resultPoint3) / i2;
float a4 = a(resultPoint2, resultPoint4);
ResultPoint resultPoint6 = new ResultPoint(resultPoint4.a() + (((resultPoint4.a() - resultPoint2.a()) / a4) * a3), resultPoint4.b() + (a3 * ((resultPoint4.b() - resultPoint2.b()) / a4)));
if (a(resultPoint5)) {
return (a(resultPoint6) && Math.abs(i - b(resultPoint3, resultPoint5).c()) + Math.abs(i2 - b(resultPoint2, resultPoint5).c()) > Math.abs(i - b(resultPoint3, resultPoint6).c()) + Math.abs(i2 - b(resultPoint2, resultPoint6).c())) ? resultPoint6 : resultPoint5;
}
if (a(resultPoint6)) {
return resultPoint6;
}
return null;
}
private ResultPoint a(ResultPoint resultPoint, ResultPoint resultPoint2, ResultPoint resultPoint3, ResultPoint resultPoint4, int i) {
float f = i;
float a = a(resultPoint, resultPoint2) / f;
float a2 = a(resultPoint3, resultPoint4);
ResultPoint resultPoint5 = new ResultPoint(resultPoint4.a() + (((resultPoint4.a() - resultPoint3.a()) / a2) * a), resultPoint4.b() + (a * ((resultPoint4.b() - resultPoint3.b()) / a2)));
float a3 = a(resultPoint, resultPoint3) / f;
float a4 = a(resultPoint2, resultPoint4);
ResultPoint resultPoint6 = new ResultPoint(resultPoint4.a() + (((resultPoint4.a() - resultPoint2.a()) / a4) * a3), resultPoint4.b() + (a3 * ((resultPoint4.b() - resultPoint2.b()) / a4)));
if (a(resultPoint5)) {
return (a(resultPoint6) && Math.abs(b(resultPoint3, resultPoint5).c() - b(resultPoint2, resultPoint5).c()) > Math.abs(b(resultPoint3, resultPoint6).c() - b(resultPoint2, resultPoint6).c())) ? resultPoint6 : resultPoint5;
}
if (a(resultPoint6)) {
return resultPoint6;
}
return null;
}
private boolean a(ResultPoint resultPoint) {
return resultPoint.a() >= 0.0f && resultPoint.a() < ((float) this.a.k()) && resultPoint.b() > 0.0f && resultPoint.b() < ((float) this.a.i());
}
private static int a(ResultPoint resultPoint, ResultPoint resultPoint2) {
return MathUtils.a(ResultPoint.a(resultPoint, resultPoint2));
}
private static void a(Map<ResultPoint, Integer> map, ResultPoint resultPoint) {
Integer num = map.get(resultPoint);
map.put(resultPoint, Integer.valueOf(num != null ? 1 + num.intValue() : 1));
}
private static BitMatrix a(BitMatrix bitMatrix, ResultPoint resultPoint, ResultPoint resultPoint2, ResultPoint resultPoint3, ResultPoint resultPoint4, int i, int i2) throws NotFoundException {
float f = i - 0.5f;
float f2 = i2 - 0.5f;
return GridSampler.a().a(bitMatrix, i, i2, 0.5f, 0.5f, f, 0.5f, f, f2, 0.5f, f2, resultPoint.a(), resultPoint.b(), resultPoint4.a(), resultPoint4.b(), resultPoint3.a(), resultPoint3.b(), resultPoint2.a(), resultPoint2.b());
}
}

View File

@@ -0,0 +1,64 @@
package com.google.zxing.datamatrix.encoder;
/* loaded from: classes.dex */
final class ASCIIEncoder implements Encoder {
ASCIIEncoder() {
}
public int a() {
return 0;
}
@Override // com.google.zxing.datamatrix.encoder.Encoder
public void a(EncoderContext encoderContext) {
if (HighLevelEncoder.a(encoderContext.d(), encoderContext.f) >= 2) {
encoderContext.a(a(encoderContext.d().charAt(encoderContext.f), encoderContext.d().charAt(encoderContext.f + 1)));
encoderContext.f += 2;
return;
}
char c = encoderContext.c();
int a = HighLevelEncoder.a(encoderContext.d(), encoderContext.f, a());
if (a == a()) {
if (!HighLevelEncoder.c(c)) {
encoderContext.a((char) (c + 1));
encoderContext.f++;
return;
} else {
encoderContext.a((char) 235);
encoderContext.a((char) ((c - 128) + 1));
encoderContext.f++;
return;
}
}
if (a == 1) {
encoderContext.a((char) 230);
encoderContext.b(1);
return;
}
if (a == 2) {
encoderContext.a((char) 239);
encoderContext.b(2);
return;
}
if (a == 3) {
encoderContext.a((char) 238);
encoderContext.b(3);
} else if (a == 4) {
encoderContext.a((char) 240);
encoderContext.b(4);
} else {
if (a != 5) {
throw new IllegalStateException("Illegal mode: ".concat(String.valueOf(a)));
}
encoderContext.a((char) 231);
encoderContext.b(5);
}
}
private static char a(char c, char c2) {
if (HighLevelEncoder.b(c) && HighLevelEncoder.b(c2)) {
return (char) (((c - '0') * 10) + (c2 - '0') + 130);
}
throw new IllegalArgumentException("not digits: " + c + c2);
}
}

View File

@@ -0,0 +1,54 @@
package com.google.zxing.datamatrix.encoder;
import androidx.recyclerview.widget.ItemTouchHelper;
/* loaded from: classes.dex */
final class Base256Encoder implements Encoder {
Base256Encoder() {
}
public int a() {
return 5;
}
@Override // com.google.zxing.datamatrix.encoder.Encoder
public void a(EncoderContext encoderContext) {
StringBuilder sb = new StringBuilder();
sb.append((char) 0);
while (true) {
if (!encoderContext.h()) {
break;
}
sb.append(encoderContext.c());
encoderContext.f++;
if (HighLevelEncoder.a(encoderContext.d(), encoderContext.f, a()) != a()) {
encoderContext.b(0);
break;
}
}
int length = sb.length() - 1;
int a = encoderContext.a() + length + 1;
encoderContext.c(a);
boolean z = encoderContext.g().a() - a > 0;
if (encoderContext.h() || z) {
if (length <= 249) {
sb.setCharAt(0, (char) length);
} else {
if (length > 1555) {
throw new IllegalStateException("Message length not in valid ranges: ".concat(String.valueOf(length)));
}
sb.setCharAt(0, (char) ((length / ItemTouchHelper.Callback.DEFAULT_SWIPE_ANIMATION_DURATION) + 249));
sb.insert(1, (char) (length % ItemTouchHelper.Callback.DEFAULT_SWIPE_ANIMATION_DURATION));
}
}
int length2 = sb.length();
for (int i = 0; i < length2; i++) {
encoderContext.a(a(sb.charAt(i), encoderContext.a() + 1));
}
}
private static char a(char c, int i) {
int i2 = c + ((i * 149) % 255) + 1;
return i2 <= 255 ? (char) i2 : (char) (i2 - 256);
}
}

View File

@@ -0,0 +1,138 @@
package com.google.zxing.datamatrix.encoder;
import com.ijm.dataencryption.de.DataDecryptTool;
/* loaded from: classes.dex */
class C40Encoder implements Encoder {
C40Encoder() {
}
static void b(EncoderContext encoderContext, StringBuilder sb) {
encoderContext.a(a(sb, 0));
sb.delete(0, 3);
}
public int a() {
return 1;
}
@Override // com.google.zxing.datamatrix.encoder.Encoder
public void a(EncoderContext encoderContext) {
StringBuilder sb = new StringBuilder();
while (true) {
if (!encoderContext.h()) {
break;
}
char c = encoderContext.c();
encoderContext.f++;
int a = a(c, sb);
int a2 = encoderContext.a() + ((sb.length() / 3) << 1);
encoderContext.c(a2);
int a3 = encoderContext.g().a() - a2;
if (!encoderContext.h()) {
StringBuilder sb2 = new StringBuilder();
if (sb.length() % 3 == 2 && (a3 < 2 || a3 > 2)) {
a = a(encoderContext, sb, sb2, a);
}
while (sb.length() % 3 == 1 && ((a <= 3 && a3 != 1) || a > 3)) {
a = a(encoderContext, sb, sb2, a);
}
} else if (sb.length() % 3 == 0 && HighLevelEncoder.a(encoderContext.d(), encoderContext.f, a()) != a()) {
encoderContext.b(0);
break;
}
}
a(encoderContext, sb);
}
private int a(EncoderContext encoderContext, StringBuilder sb, StringBuilder sb2, int i) {
int length = sb.length();
sb.delete(length - i, length);
encoderContext.f--;
int a = a(encoderContext.c(), sb2);
encoderContext.j();
return a;
}
void a(EncoderContext encoderContext, StringBuilder sb) {
int length = (sb.length() / 3) << 1;
int length2 = sb.length() % 3;
int a = encoderContext.a() + length;
encoderContext.c(a);
int a2 = encoderContext.g().a() - a;
if (length2 == 2) {
sb.append((char) 0);
while (sb.length() >= 3) {
b(encoderContext, sb);
}
if (encoderContext.h()) {
encoderContext.a((char) 254);
}
} else if (a2 == 1 && length2 == 1) {
while (sb.length() >= 3) {
b(encoderContext, sb);
}
if (encoderContext.h()) {
encoderContext.a((char) 254);
}
encoderContext.f--;
} else if (length2 == 0) {
while (sb.length() >= 3) {
b(encoderContext, sb);
}
if (a2 > 0 || encoderContext.h()) {
encoderContext.a((char) 254);
}
} else {
throw new IllegalStateException("Unexpected case. Please report!");
}
encoderContext.b(0);
}
int a(char c, StringBuilder sb) {
if (c == ' ') {
sb.append((char) 3);
return 1;
}
if (c >= '0' && c <= '9') {
sb.append((char) ((c - '0') + 4));
return 1;
}
if (c >= 'A' && c <= 'Z') {
sb.append((char) ((c - 'A') + 14));
return 1;
}
if (c < ' ') {
sb.append((char) 0);
sb.append(c);
return 2;
}
if (c >= '!' && c <= '/') {
sb.append((char) 1);
sb.append((char) (c - '!'));
return 2;
}
if (c >= ':' && c <= '@') {
sb.append((char) 1);
sb.append((char) ((c - ':') + 15));
return 2;
}
if (c >= '[' && c <= '_') {
sb.append((char) 1);
sb.append((char) ((c - '[') + 22));
return 2;
}
if (c >= '`' && c <= 127) {
sb.append((char) 2);
sb.append((char) (c - '`'));
return 2;
}
sb.append("\u0001\u001e");
return a((char) (c - 128), sb) + 2;
}
private static String a(CharSequence charSequence, int i) {
int charAt = (charSequence.charAt(i) * 1600) + (charSequence.charAt(i + 1) * '(') + charSequence.charAt(i + 2) + 1;
return new String(new char[]{(char) (charAt / DataDecryptTool.DECRYPT_ALL_FILE), (char) (charAt % DataDecryptTool.DECRYPT_ALL_FILE)});
}
}

View File

@@ -0,0 +1,18 @@
package com.google.zxing.datamatrix.encoder;
/* loaded from: classes.dex */
final class DataMatrixSymbolInfo144 extends SymbolInfo {
DataMatrixSymbolInfo144() {
super(false, 1558, 620, 22, 22, 36, -1, 62);
}
@Override // com.google.zxing.datamatrix.encoder.SymbolInfo
public int a(int i) {
return i <= 8 ? 156 : 155;
}
@Override // com.google.zxing.datamatrix.encoder.SymbolInfo
public int c() {
return 10;
}
}

View File

@@ -0,0 +1,165 @@
package com.google.zxing.datamatrix.encoder;
import java.util.Arrays;
/* loaded from: classes.dex */
public class DefaultPlacement {
private final CharSequence a;
private final int b;
private final int c;
private final byte[] d;
public DefaultPlacement(CharSequence charSequence, int i, int i2) {
this.a = charSequence;
this.c = i;
this.b = i2;
this.d = new byte[i * i2];
Arrays.fill(this.d, (byte) -1);
}
private boolean b(int i, int i2) {
return this.d[(i2 * this.c) + i] >= 0;
}
private void c(int i) {
a(this.b - 3, 0, i, 1);
a(this.b - 2, 0, i, 2);
a(this.b - 1, 0, i, 3);
a(0, this.c - 2, i, 4);
a(0, this.c - 1, i, 5);
a(1, this.c - 1, i, 6);
a(2, this.c - 1, i, 7);
a(3, this.c - 1, i, 8);
}
private void d(int i) {
a(this.b - 1, 0, i, 1);
a(this.b - 1, this.c - 1, i, 2);
a(0, this.c - 3, i, 3);
a(0, this.c - 2, i, 4);
a(0, this.c - 1, i, 5);
a(1, this.c - 3, i, 6);
a(1, this.c - 2, i, 7);
a(1, this.c - 1, i, 8);
}
public final boolean a(int i, int i2) {
return this.d[(i2 * this.c) + i] == 1;
}
private void a(int i, int i2, boolean z) {
this.d[(i2 * this.c) + i] = z ? (byte) 1 : (byte) 0;
}
private void b(int i) {
a(this.b - 3, 0, i, 1);
a(this.b - 2, 0, i, 2);
a(this.b - 1, 0, i, 3);
a(0, this.c - 4, i, 4);
a(0, this.c - 3, i, 5);
a(0, this.c - 2, i, 6);
a(0, this.c - 1, i, 7);
a(1, this.c - 1, i, 8);
}
public final void a() {
int i;
int i2;
int i3 = 4;
int i4 = 0;
int i5 = 0;
while (true) {
if (i3 == this.b && i4 == 0) {
a(i5);
i5++;
}
if (i3 == this.b - 2 && i4 == 0 && this.c % 4 != 0) {
b(i5);
i5++;
}
if (i3 == this.b - 2 && i4 == 0 && this.c % 8 == 4) {
c(i5);
i5++;
}
if (i3 == this.b + 4 && i4 == 2 && this.c % 8 == 0) {
d(i5);
i5++;
}
do {
if (i3 < this.b && i4 >= 0 && !b(i4, i3)) {
a(i3, i4, i5);
i5++;
}
i3 -= 2;
i4 += 2;
if (i3 < 0) {
break;
}
} while (i4 < this.c);
int i6 = i3 + 1;
int i7 = i4 + 3;
do {
if (i6 >= 0 && i7 < this.c && !b(i7, i6)) {
a(i6, i7, i5);
i5++;
}
i6 += 2;
i7 -= 2;
if (i6 >= this.b) {
break;
}
} while (i7 >= 0);
i3 = i6 + 3;
i4 = i7 + 1;
i = this.b;
if (i3 >= i && i4 >= (i2 = this.c)) {
break;
}
}
if (b(i2 - 1, i - 1)) {
return;
}
a(this.c - 1, this.b - 1, true);
a(this.c - 2, this.b - 2, true);
}
private void a(int i, int i2, int i3, int i4) {
if (i < 0) {
int i5 = this.b;
i += i5;
i2 += 4 - ((i5 + 4) % 8);
}
if (i2 < 0) {
int i6 = this.c;
i2 += i6;
i += 4 - ((i6 + 4) % 8);
}
a(i2, i, (this.a.charAt(i3) & (1 << (8 - i4))) != 0);
}
private void a(int i, int i2, int i3) {
int i4 = i - 2;
int i5 = i2 - 2;
a(i4, i5, i3, 1);
int i6 = i2 - 1;
a(i4, i6, i3, 2);
int i7 = i - 1;
a(i7, i5, i3, 3);
a(i7, i6, i3, 4);
a(i7, i2, i3, 5);
a(i, i5, i3, 6);
a(i, i6, i3, 7);
a(i, i2, i3, 8);
}
private void a(int i) {
a(this.b - 1, 0, i, 1);
a(this.b - 1, 1, i, 2);
a(this.b - 1, 2, i, 3);
a(0, this.c - 2, i, 4);
a(0, this.c - 1, i, 5);
a(1, this.c - 1, i, 6);
a(2, this.c - 1, i, 7);
a(3, this.c - 1, i, 8);
}
}

View File

@@ -0,0 +1,110 @@
package com.google.zxing.datamatrix.encoder;
/* loaded from: classes.dex */
final class EdifactEncoder implements Encoder {
EdifactEncoder() {
}
public int a() {
return 4;
}
@Override // com.google.zxing.datamatrix.encoder.Encoder
public void a(EncoderContext encoderContext) {
StringBuilder sb = new StringBuilder();
while (true) {
if (!encoderContext.h()) {
break;
}
a(encoderContext.c(), sb);
encoderContext.f++;
if (sb.length() >= 4) {
encoderContext.a(a(sb, 0));
sb.delete(0, 4);
if (HighLevelEncoder.a(encoderContext.d(), encoderContext.f, a()) != a()) {
encoderContext.b(0);
break;
}
}
}
sb.append((char) 31);
a(encoderContext, sb);
}
private static void a(EncoderContext encoderContext, CharSequence charSequence) {
try {
int length = charSequence.length();
if (length == 0) {
return;
}
boolean z = true;
if (length == 1) {
encoderContext.k();
int a = encoderContext.g().a() - encoderContext.a();
int f = encoderContext.f();
if (f > a) {
encoderContext.c(encoderContext.a() + 1);
a = encoderContext.g().a() - encoderContext.a();
}
if (f <= a && a <= 2) {
return;
}
}
if (length <= 4) {
int i = length - 1;
String a2 = a(charSequence, 0);
if (!(!encoderContext.h()) || i > 2) {
z = false;
}
if (i <= 2) {
encoderContext.c(encoderContext.a() + i);
if (encoderContext.g().a() - encoderContext.a() >= 3) {
encoderContext.c(encoderContext.a() + a2.length());
z = false;
}
}
if (z) {
encoderContext.j();
encoderContext.f -= i;
} else {
encoderContext.a(a2);
}
return;
}
throw new IllegalStateException("Count must not exceed 4");
} finally {
encoderContext.b(0);
}
}
private static void a(char c, StringBuilder sb) {
if (c >= ' ' && c <= '?') {
sb.append(c);
} else if (c >= '@' && c <= '^') {
sb.append((char) (c - '@'));
} else {
HighLevelEncoder.a(c);
throw null;
}
}
private static String a(CharSequence charSequence, int i) {
int length = charSequence.length() - i;
if (length != 0) {
int charAt = (charSequence.charAt(i) << 18) + ((length >= 2 ? charSequence.charAt(i + 1) : (char) 0) << '\f') + ((length >= 3 ? charSequence.charAt(i + 2) : (char) 0) << 6) + (length >= 4 ? charSequence.charAt(i + 3) : (char) 0);
char c = (char) ((charAt >> 16) & 255);
char c2 = (char) ((charAt >> 8) & 255);
char c3 = (char) (charAt & 255);
StringBuilder sb = new StringBuilder(3);
sb.append(c);
if (length >= 2) {
sb.append(c2);
}
if (length >= 3) {
sb.append(c3);
}
return sb.toString();
}
throw new IllegalStateException("StringBuilder must not be empty");
}
}

View File

@@ -0,0 +1,6 @@
package com.google.zxing.datamatrix.encoder;
/* loaded from: classes.dex */
interface Encoder {
void a(EncoderContext encoderContext);
}

View File

@@ -0,0 +1,114 @@
package com.google.zxing.datamatrix.encoder;
import com.google.zxing.Dimension;
import java.nio.charset.StandardCharsets;
/* loaded from: classes.dex */
final class EncoderContext {
private final String a;
private SymbolShapeHint b;
private Dimension c;
private Dimension d;
private final StringBuilder e;
int f;
private int g;
private SymbolInfo h;
private int i;
EncoderContext(String str) {
byte[] bytes = str.getBytes(StandardCharsets.ISO_8859_1);
StringBuilder sb = new StringBuilder(bytes.length);
int length = bytes.length;
for (int i = 0; i < length; i++) {
char c = (char) (bytes[i] & 255);
if (c == '?' && str.charAt(i) != '?') {
throw new IllegalArgumentException("Message contains characters outside ISO-8859-1 encoding.");
}
sb.append(c);
}
this.a = sb.toString();
this.b = SymbolShapeHint.FORCE_NONE;
this.e = new StringBuilder(str.length());
this.g = -1;
}
private int l() {
return this.a.length() - this.i;
}
public void a(SymbolShapeHint symbolShapeHint) {
this.b = symbolShapeHint;
}
public StringBuilder b() {
return this.e;
}
public char c() {
return this.a.charAt(this.f);
}
public String d() {
return this.a;
}
public int e() {
return this.g;
}
public int f() {
return l() - this.f;
}
public SymbolInfo g() {
return this.h;
}
public boolean h() {
return this.f < l();
}
public void i() {
this.g = -1;
}
public void j() {
this.h = null;
}
public void k() {
c(a());
}
public void a(Dimension dimension, Dimension dimension2) {
this.c = dimension;
this.d = dimension2;
}
public void b(int i) {
this.g = i;
}
public void c(int i) {
SymbolInfo symbolInfo = this.h;
if (symbolInfo == null || i > symbolInfo.a()) {
this.h = SymbolInfo.a(i, this.b, this.c, this.d, true);
}
}
public void a(int i) {
this.i = i;
}
public void a(String str) {
this.e.append(str);
}
public void a(char c) {
this.e.append(c);
}
public int a() {
return this.e.length();
}
}

View File

@@ -0,0 +1,123 @@
package com.google.zxing.datamatrix.encoder;
import androidx.recyclerview.widget.ItemTouchHelper;
import com.ijm.dataencryption.de.DataDecryptTool;
import com.ubt.jimu.base.entities.Constant;
import com.ubt.jimu.diy.model.DiyPreviewStep;
/* loaded from: classes.dex */
public final class ErrorCorrection {
private static final int[] a = {5, 7, 10, 11, 12, 14, 18, 20, 24, 28, 36, 42, 48, 56, 62, 68};
private static final int[][] b = {new int[]{228, 48, 15, 111, 62}, new int[]{23, 68, 144, 134, 240, 92, 254}, new int[]{28, 24, 185, 166, 223, 248, 116, 255, 110, 61}, new int[]{175, 138, 205, 12, 194, 168, 39, 245, 60, 97, 120}, new int[]{41, 153, 158, 91, 61, 42, 142, 213, 97, 178, 100, 242}, new int[]{156, 97, 192, 252, 95, 9, 157, 119, 138, 45, 18, 186, 83, 185}, new int[]{83, 195, 100, 39, 188, 75, 66, 61, 241, 213, 109, 129, 94, 254, 225, 48, 90, 188}, new int[]{15, 195, 244, 9, 233, 71, 168, 2, 188, 160, 153, 145, 253, 79, 108, 82, 27, 174, 186, 172}, new int[]{52, 190, 88, 205, 109, 39, 176, 21, 155, 197, 251, 223, 155, 21, 5, 172, 254, 124, 12, 181, 184, 96, 50, 193}, new int[]{211, 231, 43, 97, 71, 96, 103, 174, 37, 151, 170, 53, 75, 34, 249, 121, 17, 138, 110, 213, 141, 136, 120, 151, 233, 168, 93, 255}, new int[]{245, 127, 242, 218, 130, ItemTouchHelper.Callback.DEFAULT_SWIPE_ANIMATION_DURATION, 162, 181, 102, 120, 84, 179, 220, 251, 80, 182, 229, 18, 2, 4, 68, 33, 101, 137, 95, 119, 115, 44, 175, 184, 59, 25, 225, 98, 81, 112}, new int[]{77, 193, 137, 31, 19, 38, 22, 153, 247, 105, 122, 2, 245, 133, 242, 8, 175, 95, 100, 9, 167, 105, 214, 111, 57, 121, 21, 1, 253, 57, 54, 101, 248, Constant.Publish.REQUEST_CODE_PICK_FILE, 69, 50, 150, 177, 226, 5, 9, 5}, new int[]{245, 132, 172, 223, 96, 32, 117, 22, 238, 133, 238, 231, 205, 188, 237, 87, 191, 106, 16, 147, 118, 23, 37, 90, 170, 205, 131, 88, 120, 100, 66, 138, 186, 240, 82, 44, 176, 87, 187, 147, 160, 175, 69, 213, 92, 253, 225, 19}, new int[]{175, 9, 223, 238, 12, 17, 220, 208, 100, 29, 175, 170, 230, 192, 215, 235, 150, 159, 36, 223, 38, 200, 132, 54, 228, 146, 218, 234, 117, 203, 29, 232, 144, 238, 22, 150, 201, 117, 62, 207, 164, 13, 137, 245, 127, 67, 247, 28, 155, 43, 203, 107, 233, 53, 143, 46}, new int[]{242, 93, 169, 50, 144, 210, 39, 118, Constant.Publish.REQUEST_CODE_PICK_FILE, 188, 201, 189, 143, 108, 196, 37, 185, 112, 134, 230, 245, 63, 197, 190, ItemTouchHelper.Callback.DEFAULT_SWIPE_ANIMATION_DURATION, 106, 185, 221, 175, 64, 114, 71, 161, 44, 147, 6, 27, 218, 51, 63, 87, 10, 40, 130, 188, 17, 163, 31, 176, 170, 4, 107, 232, 7, 94, 166, 224, 124, 86, 47, 11, 204}, new int[]{220, 228, 173, 89, 251, 149, 159, 56, 89, 33, 147, 244, 154, 36, 73, 127, 213, 136, 248, 180, 234, 197, 158, 177, 68, 122, 93, 213, 15, 160, 227, 236, 66, 139, 153, 185, Constant.Publish.REQUEST_CODE_PICK_FILE, 167, 179, 25, 220, 232, 96, 210, 231, 136, 223, 239, 181, 241, 59, 52, 172, 25, 49, 232, 211, 189, 64, 54, 108, 153, 132, 63, 96, 103, 82, 186}};
private static final int[] c = new int[DataDecryptTool.DECRYPT_ALL_FILE];
private static final int[] d = new int[255];
static {
int i = 1;
for (int i2 = 0; i2 < 255; i2++) {
d[i2] = i;
c[i] = i2;
i <<= 1;
if (i >= 256) {
i ^= DiyPreviewStep.TYPE_PROGRAM;
}
}
}
public static String a(String str, SymbolInfo symbolInfo) {
if (str.length() != symbolInfo.a()) {
throw new IllegalArgumentException("The number of codewords does not match the selected symbol");
}
StringBuilder sb = new StringBuilder(symbolInfo.a() + symbolInfo.b());
sb.append(str);
int c2 = symbolInfo.c();
if (c2 == 1) {
sb.append(a(str, symbolInfo.b()));
} else {
sb.setLength(sb.capacity());
int[] iArr = new int[c2];
int[] iArr2 = new int[c2];
int[] iArr3 = new int[c2];
int i = 0;
while (i < c2) {
int i2 = i + 1;
iArr[i] = symbolInfo.a(i2);
iArr2[i] = symbolInfo.b(i2);
iArr3[i] = 0;
if (i > 0) {
iArr3[i] = iArr3[i - 1] + iArr[i];
}
i = i2;
}
for (int i3 = 0; i3 < c2; i3++) {
StringBuilder sb2 = new StringBuilder(iArr[i3]);
for (int i4 = i3; i4 < symbolInfo.a(); i4 += c2) {
sb2.append(str.charAt(i4));
}
String a2 = a(sb2.toString(), iArr2[i3]);
int i5 = i3;
int i6 = 0;
while (i5 < iArr2[i3] * c2) {
sb.setCharAt(symbolInfo.a() + i5, a2.charAt(i6));
i5 += c2;
i6++;
}
}
}
return sb.toString();
}
private static String a(CharSequence charSequence, int i) {
return a(charSequence, 0, charSequence.length(), i);
}
private static String a(CharSequence charSequence, int i, int i2, int i3) {
int i4 = 0;
while (true) {
int[] iArr = a;
if (i4 >= iArr.length) {
i4 = -1;
break;
}
if (iArr[i4] == i3) {
break;
}
i4++;
}
if (i4 >= 0) {
int[] iArr2 = b[i4];
char[] cArr = new char[i3];
for (int i5 = 0; i5 < i3; i5++) {
cArr[i5] = 0;
}
for (int i6 = i; i6 < i + i2; i6++) {
int i7 = i3 - 1;
int charAt = cArr[i7] ^ charSequence.charAt(i6);
while (i7 > 0) {
if (charAt != 0 && iArr2[i7] != 0) {
char c2 = cArr[i7 - 1];
int[] iArr3 = d;
int[] iArr4 = c;
cArr[i7] = (char) (c2 ^ iArr3[(iArr4[charAt] + iArr4[iArr2[i7]]) % 255]);
} else {
cArr[i7] = cArr[i7 - 1];
}
i7--;
}
if (charAt != 0 && iArr2[0] != 0) {
int[] iArr5 = d;
int[] iArr6 = c;
cArr[0] = (char) iArr5[(iArr6[charAt] + iArr6[iArr2[0]]) % 255];
} else {
cArr[0] = 0;
}
}
char[] cArr2 = new char[i3];
for (int i8 = 0; i8 < i3; i8++) {
cArr2[i8] = cArr[(i3 - i8) - 1];
}
return String.valueOf(cArr2);
}
throw new IllegalArgumentException("Illegal number of error correction codewords specified: ".concat(String.valueOf(i3)));
}
}

View File

@@ -0,0 +1,270 @@
package com.google.zxing.datamatrix.encoder;
import com.google.zxing.Dimension;
import java.util.Arrays;
/* loaded from: classes.dex */
public final class HighLevelEncoder {
private static char a(char c, int i) {
int i2 = c + ((i * 149) % 253) + 1;
if (i2 > 254) {
i2 -= 254;
}
return (char) i2;
}
static boolean b(char c) {
return c >= '0' && c <= '9';
}
static boolean c(char c) {
return c >= 128 && c <= 255;
}
private static boolean d(char c) {
if (c == ' ') {
return true;
}
if (c < '0' || c > '9') {
return c >= 'A' && c <= 'Z';
}
return true;
}
private static boolean e(char c) {
return c >= ' ' && c <= '^';
}
private static boolean f(char c) {
if (c == ' ') {
return true;
}
if (c < '0' || c > '9') {
return c >= 'a' && c <= 'z';
}
return true;
}
private static boolean g(char c) {
if (i(c) || c == ' ') {
return true;
}
if (c < '0' || c > '9') {
return c >= 'A' && c <= 'Z';
}
return true;
}
private static boolean h(char c) {
return false;
}
private static boolean i(char c) {
return c == '\r' || c == '*' || c == '>';
}
public static String a(String str, SymbolShapeHint symbolShapeHint, Dimension dimension, Dimension dimension2) {
int i = 0;
Encoder[] encoderArr = {new ASCIIEncoder(), new C40Encoder(), new TextEncoder(), new X12Encoder(), new EdifactEncoder(), new Base256Encoder()};
EncoderContext encoderContext = new EncoderContext(str);
encoderContext.a(symbolShapeHint);
encoderContext.a(dimension, dimension2);
if (str.startsWith("[)>\u001e05\u001d") && str.endsWith("\u001e\u0004")) {
encoderContext.a((char) 236);
encoderContext.a(2);
encoderContext.f += 7;
} else if (str.startsWith("[)>\u001e06\u001d") && str.endsWith("\u001e\u0004")) {
encoderContext.a((char) 237);
encoderContext.a(2);
encoderContext.f += 7;
}
while (encoderContext.h()) {
encoderArr[i].a(encoderContext);
if (encoderContext.e() >= 0) {
i = encoderContext.e();
encoderContext.i();
}
}
int a = encoderContext.a();
encoderContext.k();
int a2 = encoderContext.g().a();
if (a < a2 && i != 0 && i != 5 && i != 4) {
encoderContext.a((char) 254);
}
StringBuilder b = encoderContext.b();
if (b.length() < a2) {
b.append((char) 129);
}
while (b.length() < a2) {
b.append(a((char) 129, b.length() + 1));
}
return encoderContext.b().toString();
}
static int a(CharSequence charSequence, int i, int i2) {
float[] fArr;
char c;
if (i >= charSequence.length()) {
return i2;
}
if (i2 == 0) {
fArr = new float[]{0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.25f};
} else {
fArr = new float[]{1.0f, 2.0f, 2.0f, 2.0f, 2.0f, 2.25f};
fArr[i2] = 0.0f;
}
int i3 = 0;
while (true) {
int i4 = i + i3;
if (i4 == charSequence.length()) {
byte[] bArr = new byte[6];
int[] iArr = new int[6];
int a = a(fArr, iArr, Integer.MAX_VALUE, bArr);
int a2 = a(bArr);
if (iArr[0] == a) {
return 0;
}
if (a2 == 1 && bArr[5] > 0) {
return 5;
}
if (a2 == 1 && bArr[4] > 0) {
return 4;
}
if (a2 != 1 || bArr[2] <= 0) {
return (a2 != 1 || bArr[3] <= 0) ? 1 : 3;
}
return 2;
}
char charAt = charSequence.charAt(i4);
i3++;
if (b(charAt)) {
fArr[0] = fArr[0] + 0.5f;
} else if (c(charAt)) {
fArr[0] = (float) Math.ceil(fArr[0]);
fArr[0] = fArr[0] + 2.0f;
} else {
fArr[0] = (float) Math.ceil(fArr[0]);
fArr[0] = fArr[0] + 1.0f;
}
if (d(charAt)) {
fArr[1] = fArr[1] + 0.6666667f;
} else if (c(charAt)) {
fArr[1] = fArr[1] + 2.6666667f;
} else {
fArr[1] = fArr[1] + 1.3333334f;
}
if (f(charAt)) {
fArr[2] = fArr[2] + 0.6666667f;
} else if (c(charAt)) {
fArr[2] = fArr[2] + 2.6666667f;
} else {
fArr[2] = fArr[2] + 1.3333334f;
}
if (g(charAt)) {
fArr[3] = fArr[3] + 0.6666667f;
} else if (c(charAt)) {
fArr[3] = fArr[3] + 4.3333335f;
} else {
fArr[3] = fArr[3] + 3.3333333f;
}
if (e(charAt)) {
fArr[4] = fArr[4] + 0.75f;
} else if (c(charAt)) {
fArr[4] = fArr[4] + 4.25f;
} else {
fArr[4] = fArr[4] + 3.25f;
}
if (h(charAt)) {
c = 5;
fArr[5] = fArr[5] + 4.0f;
} else {
c = 5;
fArr[5] = fArr[5] + 1.0f;
}
if (i3 >= 4) {
int[] iArr2 = new int[6];
byte[] bArr2 = new byte[6];
a(fArr, iArr2, Integer.MAX_VALUE, bArr2);
int a3 = a(bArr2);
if (iArr2[0] < iArr2[c] && iArr2[0] < iArr2[1] && iArr2[0] < iArr2[2] && iArr2[0] < iArr2[3] && iArr2[0] < iArr2[4]) {
return 0;
}
if (iArr2[5] < iArr2[0] || bArr2[1] + bArr2[2] + bArr2[3] + bArr2[4] == 0) {
return 5;
}
if (a3 == 1 && bArr2[4] > 0) {
return 4;
}
if (a3 == 1 && bArr2[2] > 0) {
return 2;
}
if (a3 == 1 && bArr2[3] > 0) {
return 3;
}
if (iArr2[1] + 1 < iArr2[0] && iArr2[1] + 1 < iArr2[5] && iArr2[1] + 1 < iArr2[4] && iArr2[1] + 1 < iArr2[2]) {
if (iArr2[1] < iArr2[3]) {
return 1;
}
if (iArr2[1] == iArr2[3]) {
for (int i5 = i + i3 + 1; i5 < charSequence.length(); i5++) {
char charAt2 = charSequence.charAt(i5);
if (i(charAt2)) {
return 3;
}
if (!g(charAt2)) {
break;
}
}
return 1;
}
}
}
}
}
private static int a(float[] fArr, int[] iArr, int i, byte[] bArr) {
Arrays.fill(bArr, (byte) 0);
int i2 = i;
for (int i3 = 0; i3 < 6; i3++) {
iArr[i3] = (int) Math.ceil(fArr[i3]);
int i4 = iArr[i3];
if (i2 > i4) {
Arrays.fill(bArr, (byte) 0);
i2 = i4;
}
if (i2 == i4) {
bArr[i3] = (byte) (bArr[i3] + 1);
}
}
return i2;
}
private static int a(byte[] bArr) {
int i = 0;
for (int i2 = 0; i2 < 6; i2++) {
i += bArr[i2];
}
return i;
}
public static int a(CharSequence charSequence, int i) {
int length = charSequence.length();
int i2 = 0;
if (i < length) {
char charAt = charSequence.charAt(i);
while (b(charAt) && i < length) {
i2++;
i++;
if (i < length) {
charAt = charSequence.charAt(i);
}
}
}
return i2;
}
static void a(char c) {
String hexString = Integer.toHexString(c);
throw new IllegalArgumentException("Illegal character: " + c + " (0x" + ("0000".substring(0, 4 - hexString.length()) + hexString) + ')');
}
}

View File

@@ -0,0 +1,137 @@
package com.google.zxing.datamatrix.encoder;
import com.google.zxing.Dimension;
import com.twitter.sdk.android.core.TwitterAuthConfig;
/* loaded from: classes.dex */
public class SymbolInfo {
private static SymbolInfo[] i = {new SymbolInfo(false, 3, 5, 8, 8, 1), new SymbolInfo(false, 5, 7, 10, 10, 1), new SymbolInfo(true, 5, 7, 16, 6, 1), new SymbolInfo(false, 8, 10, 12, 12, 1), new SymbolInfo(true, 10, 11, 14, 6, 2), new SymbolInfo(false, 12, 12, 14, 14, 1), new SymbolInfo(true, 16, 14, 24, 10, 1), new SymbolInfo(false, 18, 14, 16, 16, 1), new SymbolInfo(false, 22, 18, 18, 18, 1), new SymbolInfo(true, 22, 18, 16, 10, 2), new SymbolInfo(false, 30, 20, 20, 20, 1), new SymbolInfo(true, 32, 24, 16, 14, 2), new SymbolInfo(false, 36, 24, 22, 22, 1), new SymbolInfo(false, 44, 28, 24, 24, 1), new SymbolInfo(true, 49, 28, 22, 14, 2), new SymbolInfo(false, 62, 36, 14, 14, 4), new SymbolInfo(false, 86, 42, 16, 16, 4), new SymbolInfo(false, 114, 48, 18, 18, 4), new SymbolInfo(false, 144, 56, 20, 20, 4), new SymbolInfo(false, 174, 68, 22, 22, 4), new SymbolInfo(false, 204, 84, 24, 24, 4, 102, 42), new SymbolInfo(false, 280, 112, 14, 14, 16, TwitterAuthConfig.DEFAULT_AUTH_REQUEST_CODE, 56), new SymbolInfo(false, 368, 144, 16, 16, 16, 92, 36), new SymbolInfo(false, 456, 192, 18, 18, 16, 114, 48), new SymbolInfo(false, 576, 224, 20, 20, 16, 144, 56), new SymbolInfo(false, 696, 272, 22, 22, 16, 174, 68), new SymbolInfo(false, 816, 336, 24, 24, 16, 136, 56), new SymbolInfo(false, 1050, 408, 18, 18, 36, 175, 68), new SymbolInfo(false, 1304, 496, 20, 20, 36, 163, 62), new DataMatrixSymbolInfo144()};
private final boolean a;
private final int b;
private final int c;
public final int d;
public final int e;
private final int f;
private final int g;
private final int h;
public SymbolInfo(boolean z, int i2, int i3, int i4, int i5, int i6) {
this(z, i2, i3, i4, i5, i6, i2, i3);
}
public static SymbolInfo a(int i2, SymbolShapeHint symbolShapeHint, Dimension dimension, Dimension dimension2, boolean z) {
for (SymbolInfo symbolInfo : i) {
if (!(symbolShapeHint == SymbolShapeHint.FORCE_SQUARE && symbolInfo.a) && ((symbolShapeHint != SymbolShapeHint.FORCE_RECTANGLE || symbolInfo.a) && ((dimension == null || (symbolInfo.g() >= dimension.b() && symbolInfo.f() >= dimension.a())) && ((dimension2 == null || (symbolInfo.g() <= dimension2.b() && symbolInfo.f() <= dimension2.a())) && i2 <= symbolInfo.b)))) {
return symbolInfo;
}
}
if (z) {
throw new IllegalArgumentException("Can't find a symbol arrangement that matches the message. Data codewords: ".concat(String.valueOf(i2)));
}
return null;
}
private int h() {
int i2 = this.f;
int i3 = 1;
if (i2 != 1) {
i3 = 2;
if (i2 != 2 && i2 != 4) {
if (i2 == 16) {
return 4;
}
if (i2 == 36) {
return 6;
}
throw new IllegalStateException("Cannot handle this number of data regions");
}
}
return i3;
}
private int i() {
int i2 = this.f;
if (i2 == 1 || i2 == 2) {
return 1;
}
if (i2 == 4) {
return 2;
}
if (i2 == 16) {
return 4;
}
if (i2 == 36) {
return 6;
}
throw new IllegalStateException("Cannot handle this number of data regions");
}
public final int b() {
return this.c;
}
public int c() {
return this.b / this.g;
}
public final int d() {
return i() * this.e;
}
public final int e() {
return h() * this.d;
}
public final int f() {
return d() + (i() << 1);
}
public final int g() {
return e() + (h() << 1);
}
public final String toString() {
StringBuilder sb = new StringBuilder();
sb.append(this.a ? "Rectangular Symbol:" : "Square Symbol:");
sb.append(" data region ");
sb.append(this.d);
sb.append('x');
sb.append(this.e);
sb.append(", symbol size ");
sb.append(g());
sb.append('x');
sb.append(f());
sb.append(", symbol data size ");
sb.append(e());
sb.append('x');
sb.append(d());
sb.append(", codewords ");
sb.append(this.b);
sb.append('+');
sb.append(this.c);
return sb.toString();
}
SymbolInfo(boolean z, int i2, int i3, int i4, int i5, int i6, int i7, int i8) {
this.a = z;
this.b = i2;
this.c = i3;
this.d = i4;
this.e = i5;
this.f = i6;
this.g = i7;
this.h = i8;
}
public final int b(int i2) {
return this.h;
}
public final int a() {
return this.b;
}
public int a(int i2) {
return this.g;
}
}

View File

@@ -0,0 +1,8 @@
package com.google.zxing.datamatrix.encoder;
/* loaded from: classes.dex */
public enum SymbolShapeHint {
FORCE_NONE,
FORCE_SQUARE,
FORCE_RECTANGLE
}

View File

@@ -0,0 +1,65 @@
package com.google.zxing.datamatrix.encoder;
/* loaded from: classes.dex */
final class TextEncoder extends C40Encoder {
TextEncoder() {
}
@Override // com.google.zxing.datamatrix.encoder.C40Encoder
public int a() {
return 2;
}
@Override // com.google.zxing.datamatrix.encoder.C40Encoder
int a(char c, StringBuilder sb) {
if (c == ' ') {
sb.append((char) 3);
return 1;
}
if (c >= '0' && c <= '9') {
sb.append((char) ((c - '0') + 4));
return 1;
}
if (c >= 'a' && c <= 'z') {
sb.append((char) ((c - 'a') + 14));
return 1;
}
if (c < ' ') {
sb.append((char) 0);
sb.append(c);
return 2;
}
if (c >= '!' && c <= '/') {
sb.append((char) 1);
sb.append((char) (c - '!'));
return 2;
}
if (c >= ':' && c <= '@') {
sb.append((char) 1);
sb.append((char) ((c - ':') + 15));
return 2;
}
if (c >= '[' && c <= '_') {
sb.append((char) 1);
sb.append((char) ((c - '[') + 22));
return 2;
}
if (c == '`') {
sb.append((char) 2);
sb.append((char) (c - '`'));
return 2;
}
if (c >= 'A' && c <= 'Z') {
sb.append((char) 2);
sb.append((char) ((c - 'A') + 1));
return 2;
}
if (c < '{' || c > 127) {
sb.append("\u0001\u001e");
return a((char) (c - 128), sb) + 2;
}
sb.append((char) 2);
sb.append((char) ((c - '{') + 27));
return 2;
}
}

View File

@@ -0,0 +1,67 @@
package com.google.zxing.datamatrix.encoder;
/* loaded from: classes.dex */
final class X12Encoder extends C40Encoder {
X12Encoder() {
}
@Override // com.google.zxing.datamatrix.encoder.C40Encoder
public int a() {
return 3;
}
@Override // com.google.zxing.datamatrix.encoder.C40Encoder, com.google.zxing.datamatrix.encoder.Encoder
public void a(EncoderContext encoderContext) {
StringBuilder sb = new StringBuilder();
while (true) {
if (!encoderContext.h()) {
break;
}
char c = encoderContext.c();
encoderContext.f++;
a(c, sb);
if (sb.length() % 3 == 0) {
C40Encoder.b(encoderContext, sb);
if (HighLevelEncoder.a(encoderContext.d(), encoderContext.f, a()) != a()) {
encoderContext.b(0);
break;
}
}
}
a(encoderContext, sb);
}
@Override // com.google.zxing.datamatrix.encoder.C40Encoder
int a(char c, StringBuilder sb) {
if (c == '\r') {
sb.append((char) 0);
} else if (c == ' ') {
sb.append((char) 3);
} else if (c == '*') {
sb.append((char) 1);
} else if (c == '>') {
sb.append((char) 2);
} else if (c >= '0' && c <= '9') {
sb.append((char) ((c - '0') + 4));
} else if (c >= 'A' && c <= 'Z') {
sb.append((char) ((c - 'A') + 14));
} else {
HighLevelEncoder.a(c);
throw null;
}
return 1;
}
@Override // com.google.zxing.datamatrix.encoder.C40Encoder
void a(EncoderContext encoderContext, StringBuilder sb) {
encoderContext.k();
int a = encoderContext.g().a() - encoderContext.a();
encoderContext.f -= sb.length();
if (encoderContext.f() > 1 || a > 1 || encoderContext.f() != a) {
encoderContext.a((char) 254);
}
if (encoderContext.e() < 0) {
encoderContext.b(0);
}
}
}