package pl;

import java.util.Collection;
import java.util.Collections;

/* loaded from: classes3.dex */
public class h extends s {
    private static int h(boolean[] zArr, int i10, int i11) {
        for (int i12 = 0; i12 < 9; i12++) {
            boolean z10 = true;
            int i13 = i10 + i12;
            if (((1 << (8 - i12)) & i11) == 0) {
                z10 = false;
            }
            zArr[i13] = z10;
        }
        return 9;
    }

    private static int i(String str, int i10) {
        int i11 = 0;
        int i12 = 1;
        for (int length = str.length() - 1; length >= 0; length--) {
            i11 += "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%abcd*".indexOf(str.charAt(length)) * i12;
            i12++;
            if (i12 > i10) {
                i12 = 1;
            }
        }
        return i11 % 47;
    }

    static String j(String str) {
        int length = str.length();
        StringBuilder sb2 = new StringBuilder(length << 1);
        for (int i10 = 0; i10 < length; i10++) {
            char charAt = str.charAt(i10);
            if (charAt == 0) {
                sb2.append("bU");
            } else if (charAt <= 26) {
                sb2.append('a');
                sb2.append((char) ((charAt + 'A') - 1));
            } else if (charAt <= 31) {
                sb2.append('b');
                sb2.append((char) ((charAt + 'A') - 27));
            } else if (charAt == ' ' || charAt == '$' || charAt == '%' || charAt == '+') {
                sb2.append(charAt);
            } else if (charAt <= ',') {
                sb2.append('c');
                sb2.append((char) ((charAt + 'A') - 33));
            } else if (charAt <= '9') {
                sb2.append(charAt);
            } else if (charAt == ':') {
                sb2.append("cZ");
            } else if (charAt <= '?') {
                sb2.append('b');
                sb2.append((char) ((charAt + 'F') - 59));
            } else if (charAt == '@') {
                sb2.append("bV");
            } else if (charAt <= 'Z') {
                sb2.append(charAt);
            } else if (charAt <= '_') {
                sb2.append('b');
                sb2.append((char) ((charAt + 'K') - 91));
            } else if (charAt == '`') {
                sb2.append("bW");
            } else if (charAt <= 'z') {
                sb2.append('d');
                sb2.append((char) ((charAt + 'A') - 97));
            } else {
                if (charAt > 127) {
                    throw new IllegalArgumentException("Requested content contains a non-encodable character: '" + charAt + "'");
                }
                sb2.append('b');
                sb2.append((char) ((charAt + 'P') - 123));
            }
        }
        return sb2.toString();
    }

    @Override // pl.s
    public boolean[] d(String str) {
        String j10 = j(str);
        int length = j10.length();
        if (length > 80) {
            throw new IllegalArgumentException("Requested contents should be less than 80 digits long after converting to extended encoding, but got ".concat(String.valueOf(length)));
        }
        boolean[] zArr = new boolean[((j10.length() + 2 + 2) * 9) + 1];
        int h10 = h(zArr, 0, g.f32888e);
        for (int i10 = 0; i10 < length; i10++) {
            h10 += h(zArr, h10, g.f32887d["0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%abcd*".indexOf(j10.charAt(i10))]);
        }
        int i11 = i(j10, 20);
        int[] iArr = g.f32887d;
        int h11 = h10 + h(zArr, h10, iArr[i11]);
        int h12 = h11 + h(zArr, h11, iArr[i(j10 + "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%abcd*".charAt(i11), 15)]);
        zArr[h12 + h(zArr, h12, g.f32888e)] = true;
        return zArr;
    }

    @Override // pl.s
    protected Collection f() {
        return Collections.singleton(yk.a.CODE_93);
    }
}
