package o; import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.util.Map; /* loaded from: classes2.dex */ public final class YtV extends Ggl { /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public enum IeS { UNCODABLE, ONE_DIGIT, TWO_DIGITS, FNC_1 } @Override // o.Ggl protected final Collection b() { return Collections.singleton(PTS.CODE_128); } @Override // o.Ggl public final boolean[] d(String str) { return d(str, null); } @Override // o.Ggl protected final boolean[] d(String str, Map map) { int e = e(str, map); if (map == null || !map.containsKey(EnumC14826gQH.CODE128_COMPACT) || !Boolean.parseBoolean(map.get(EnumC14826gQH.CODE128_COMPACT).toString())) { return e(str, e); } return new Sts((byte) 0).a(str); } /* JADX WARN: Failed to find 'out' block for switch in B:32:0x0071. Please report as an issue. */ private static int e(String str, Map map) { int length = str.length(); if (length <= 0 || length > 80) { throw new IllegalArgumentException("Contents length should be between 1 and 80 characters, but got ".concat(String.valueOf(length))); } int i = -1; if (map != null && map.containsKey(EnumC14826gQH.FORCE_CODE_SET)) { String obj = map.get(EnumC14826gQH.FORCE_CODE_SET).toString(); obj.hashCode(); switch (obj.hashCode()) { case 65: if (obj.equals("A")) { i = 0; break; } break; case 66: if (obj.equals("B")) { i = 1; break; } break; case 67: if (obj.equals("C")) { i = 2; break; } break; } if (i == 0) { i = 101; } else if (i == 1) { i = 100; } else { if (i != 2) { throw new IllegalArgumentException("Unsupported code set hint: ".concat(String.valueOf(obj))); } i = 99; } } for (int i2 = 0; i2 < length; i2++) { char charAt = str.charAt(i2); switch (charAt) { default: if (charAt > 127) { throw new IllegalArgumentException("Bad character in input: ASCII value=".concat(String.valueOf((int) charAt))); } case 241: case 242: case 243: case 244: switch (i) { case 99: if (charAt < '0' || ((charAt > '9' && charAt <= 127) || charAt == 242 || charAt == 243 || charAt == 244)) { throw new IllegalArgumentException("Bad character in input for forced code set C: ASCII value=".concat(String.valueOf((int) charAt))); } break; break; case 100: if (charAt <= ' ') { throw new IllegalArgumentException("Bad character in input for forced code set B: ASCII value=".concat(String.valueOf((int) charAt))); } break; case 101: if (charAt > '_' && charAt <= 127) { throw new IllegalArgumentException("Bad character in input for forced code set A: ASCII value=".concat(String.valueOf((int) charAt))); } break; } break; } } return i; } /* JADX WARN: Code restructure failed: missing block: B:60:0x0049, code lost: if (r8 <= 244) goto L9; */ /* JADX WARN: Code restructure failed: missing block: B:76:0x0078, code lost: if (e((java.lang.CharSequence) r16, r3 + 3) == o.YtV.IeS.TWO_DIGITS) goto L57; */ /* JADX WARN: Code restructure failed: missing block: B:7:0x0027, code lost: if (r6 == 101) goto L9; */ /* JADX WARN: Code restructure failed: missing block: B:83:0x008c, code lost: if (r15 != o.YtV.IeS.ONE_DIGIT) goto L57; */ /* JADX WARN: Code restructure failed: missing block: B:88:0x009b, code lost: if (r8 == o.YtV.IeS.TWO_DIGITS) goto L57; */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ private static boolean[] e(java.lang.String r16, int r17) { /* Method dump skipped, instructions count: 280 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: o.YtV.e(java.lang.String, int):boolean[]"); } static boolean[] c(Collection collection, int i) { collection.add(fQC.e[i % 103]); collection.add(fQC.e[106]); int i2 = 0; int i3 = 0; for (int[] iArr : collection) { for (int i4 : iArr) { i3 += i4; } } boolean[] zArr = new boolean[i3]; Iterator it = collection.iterator(); while (it.hasNext()) { i2 += b(zArr, i2, it.next(), true); } return zArr; } private static IeS e(CharSequence charSequence, int i) { int length = charSequence.length(); if (i >= length) { return IeS.UNCODABLE; } char charAt = charSequence.charAt(i); if (charAt == 241) { return IeS.FNC_1; } if (charAt < '0' || charAt > '9') { return IeS.UNCODABLE; } int i2 = i + 1; if (i2 >= length) { return IeS.ONE_DIGIT; } char charAt2 = charSequence.charAt(i2); if (charAt2 < '0' || charAt2 > '9') { return IeS.ONE_DIGIT; } return IeS.TWO_DIGITS; } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public static final class Sts { private int[][] d; private EnumC0098Sts[][] e; /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public enum LWm { A, B, C, NONE } /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: o.YtV$Sts$Sts, reason: collision with other inner class name */ /* loaded from: classes2.dex */ public enum EnumC0098Sts { A, B, C, SHIFT, NONE } private Sts() { } /* synthetic */ Sts(byte b) { this(); } final boolean[] a(String str) { this.d = (int[][]) Array.newInstance((Class) Integer.TYPE, 4, str.length()); this.e = (EnumC0098Sts[][]) Array.newInstance((Class) EnumC0098Sts.class, 4, str.length()); d(str, LWm.NONE, 0); ArrayList arrayList = new ArrayList(); int[] iArr = {0}; int[] iArr2 = {1}; int length = str.length(); LWm lWm = LWm.NONE; int i = 0; while (i < length) { EnumC0098Sts enumC0098Sts = this.e[lWm.ordinal()][i]; int i2 = AnonymousClass1.a[enumC0098Sts.ordinal()]; int i3 = 101; if (i2 == 1) { lWm = LWm.A; b(arrayList, i == 0 ? 103 : 101, iArr, iArr2, i); } else if (i2 == 2) { lWm = LWm.B; b(arrayList, i == 0 ? 104 : 100, iArr, iArr2, i); } else if (i2 == 3) { lWm = LWm.C; b(arrayList, i == 0 ? 105 : 99, iArr, iArr2, i); } else if (i2 == 4) { b(arrayList, 98, iArr, iArr2, i); } if (lWm == LWm.C) { if (str.charAt(i) == 241) { b(arrayList, 102, iArr, iArr2, i); } else { b(arrayList, Integer.parseInt(str.substring(i, i + 2)), iArr, iArr2, i); int i4 = i + 1; if (i4 < length) { i = i4; } } } else { switch (str.charAt(i)) { case 241: i3 = 102; break; case 242: i3 = 97; break; case 243: i3 = 96; break; case 244: if ((lWm != LWm.A || enumC0098Sts == EnumC0098Sts.SHIFT) && (lWm != LWm.B || enumC0098Sts != EnumC0098Sts.SHIFT)) { i3 = 100; break; } break; default: i3 = str.charAt(i) - ' '; break; } if (((lWm == LWm.A && enumC0098Sts != EnumC0098Sts.SHIFT) || (lWm == LWm.B && enumC0098Sts == EnumC0098Sts.SHIFT)) && i3 < 0) { i3 += 96; } b(arrayList, i3, iArr, iArr2, i); } i++; } this.d = null; this.e = null; return YtV.c(arrayList, iArr[0]); } private static void b(Collection collection, int i, int[] iArr, int[] iArr2, int i2) { collection.add(fQC.e[i]); if (i2 != 0) { iArr2[0] = iArr2[0] + 1; } iArr[0] = iArr[0] + (i * iArr2[0]); } private static boolean a(CharSequence charSequence, LWm lWm, int i) { int i2; char charAt; char charAt2 = charSequence.charAt(i); int i3 = AnonymousClass1.b[lWm.ordinal()]; if (i3 == 1) { return charAt2 == 241 || charAt2 == 242 || charAt2 == 243 || charAt2 == 244 || " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001fÿ".indexOf(charAt2) >= 0; } if (i3 == 2) { return charAt2 == 241 || charAt2 == 242 || charAt2 == 243 || charAt2 == 244 || " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u007fÿ".indexOf(charAt2) >= 0; } if (i3 != 3) { return false; } return charAt2 == 241 || ((i2 = i + 1) < charSequence.length() && charAt2 >= '0' && charAt2 <= '9' && (charAt = charSequence.charAt(i2)) >= '0' && charAt <= '9'); } private int d(CharSequence charSequence, LWm lWm, int i) { int i2; int i3; int i4 = this.d[lWm.ordinal()][i]; if (i4 > 0) { return i4; } EnumC0098Sts enumC0098Sts = EnumC0098Sts.NONE; int i5 = i + 1; int i6 = 0; boolean z = i5 >= charSequence.length(); LWm[] lWmArr = {LWm.A, LWm.B}; int i7 = Integer.MAX_VALUE; while (true) { if (i6 > 1) { break; } if (a(charSequence, lWmArr[i6], i)) { EnumC0098Sts enumC0098Sts2 = EnumC0098Sts.NONE; LWm lWm2 = lWmArr[i6]; if (lWm != lWm2) { enumC0098Sts2 = EnumC0098Sts.valueOf(lWm2.toString()); i3 = 2; } else { i3 = 1; } if (!z) { i3 += d(charSequence, lWmArr[i6], i5); } if (i3 < i7) { enumC0098Sts = enumC0098Sts2; i7 = i3; } if (lWm == lWmArr[(i6 + 1) % 2]) { EnumC0098Sts enumC0098Sts3 = EnumC0098Sts.SHIFT; int d = z ? 2 : d(charSequence, lWm, i5) + 2; if (d < i7) { i7 = d; enumC0098Sts = enumC0098Sts3; } } } i6++; } if (a(charSequence, LWm.C, i)) { EnumC0098Sts enumC0098Sts4 = EnumC0098Sts.NONE; if (lWm != LWm.C) { enumC0098Sts4 = EnumC0098Sts.C; i2 = 2; } else { i2 = 1; } int i8 = (charSequence.charAt(i) != 241 ? 2 : 1) + i; if (i8 < charSequence.length()) { i2 += d(charSequence, LWm.C, i8); } if (i2 < i7) { enumC0098Sts = enumC0098Sts4; i7 = i2; } } if (i7 == Integer.MAX_VALUE) { StringBuilder sb = new StringBuilder("Bad character in input: ASCII value="); sb.append((int) charSequence.charAt(i)); throw new IllegalArgumentException(sb.toString()); } this.d[lWm.ordinal()][i] = i7; this.e[lWm.ordinal()][i] = enumC0098Sts; return i7; } } /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: o.YtV$1, reason: invalid class name */ /* loaded from: classes2.dex */ public static /* synthetic */ class AnonymousClass1 { static final int[] a; static final int[] b; static { int[] iArr = new int[Sts.LWm.values().length]; b = iArr; try { iArr[Sts.LWm.A.ordinal()] = 1; } catch (NoSuchFieldError unused) { } try { b[Sts.LWm.B.ordinal()] = 2; } catch (NoSuchFieldError unused2) { } try { b[Sts.LWm.C.ordinal()] = 3; } catch (NoSuchFieldError unused3) { } int[] iArr2 = new int[Sts.EnumC0098Sts.values().length]; a = iArr2; try { iArr2[Sts.EnumC0098Sts.A.ordinal()] = 1; } catch (NoSuchFieldError unused4) { } try { a[Sts.EnumC0098Sts.B.ordinal()] = 2; } catch (NoSuchFieldError unused5) { } try { a[Sts.EnumC0098Sts.C.ordinal()] = 3; } catch (NoSuchFieldError unused6) { } try { a[Sts.EnumC0098Sts.SHIFT.ordinal()] = 4; } catch (NoSuchFieldError unused7) { } } } }