package l;

import android.text.TextUtils;
import com.cvte.va.sdk.baseclass.PairList;
import com.cvte.vman.instance.InvokeCmd;
import io.netty.handler.codec.dns.DnsRecord;
import java.util.Arrays;
import u.g;

/* JADX INFO: loaded from: classes.dex */
public class b {
    public static final PairList.Pair<Integer, Integer> A;
    public static final PairList.Pair<Integer, Integer> B;
    public static final PairList.Pair<Integer, Integer> C;
    public static final PairList.Pair<Integer, Integer> D;
    public static final PairList.Pair<Integer, Integer> E;
    public static final PairList.Pair<Integer, Integer> F;
    public static final PairList.Pair<Integer, Integer> G;
    public static final PairList.Pair<Integer, Integer> H;
    public static final PairList.Pair<Integer, Integer> I;
    public static final PairList.Pair<Integer, Integer> J;
    public static final PairList.Pair<Integer, Integer> K;
    public static final PairList.Pair<Integer, Integer> L;
    public static final PairList.Pair<Integer, Integer> M;
    public static final PairList.Pair<Integer, Integer> N;
    public static final PairList.Pair<Integer, Integer> O;
    public static final PairList.Pair<Integer, Integer> P;
    public static final PairList.Pair<Integer, Integer> Q;
    public static final PairList.Pair<Integer, Integer> R;
    public static final PairList.Pair<Integer, Integer> S;
    public static final PairList.Pair<Integer, Integer> T;
    public static final PairList.Pair<Integer, Integer> U;
    public static final PairList.Pair<Integer, Integer> V;
    public static final PairList.Pair<Integer, Integer> W;
    public static final PairList.Pair<Integer, Integer> X;
    public static final PairList.Pair<Integer, Integer> Y;
    public static final PairList.Pair<Integer, Integer> Z;
    public static final PairList.Pair<Integer, Integer> a = new PairList.Pair<>(32, 6);

    /* JADX INFO: renamed from: a0, reason: collision with root package name */
    public static final PairList.Pair<Integer, Integer> f5914a0;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public static final PairList.Pair<Integer, Integer> f5915b;

    /* JADX INFO: renamed from: b0, reason: collision with root package name */
    public static final PairList.Pair<Integer, Integer> f5916b0;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public static final PairList.Pair<Integer, Integer> f5917c;

    /* JADX INFO: renamed from: c0, reason: collision with root package name */
    public static final PairList.Pair<Integer, Integer> f5918c0;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public static final PairList.Pair<Integer, Integer> f5919d;

    /* JADX INFO: renamed from: d0, reason: collision with root package name */
    public static final PairList.Pair<Integer, Integer> f5920d0;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public static final PairList.Pair<Integer, Integer> f5921e;
    public static final PairList.Pair<Integer, Integer> e0;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public static final PairList.Pair<Integer, Integer> f5922f;
    public static final PairList.Pair<Integer, Integer> f0;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public static final PairList.Pair<Integer, Integer> f5923g;
    public static final PairList.Pair<Integer, Integer> g0;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public static final PairList.Pair<Integer, Integer> f5924h;
    public static final PairList.Pair<Integer, Integer> h0;

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    public static final PairList.Pair<Integer, Integer> f5925i;
    public static final PairList.Pair<Integer, Integer> i0;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public static final PairList.Pair<Integer, Integer> f5926j;
    public static final PairList.Pair<Integer, Integer> j0;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public static final PairList.Pair<Integer, Integer> f5927k;
    public static final PairList.Pair<Integer, Integer> k0;

    /* JADX INFO: renamed from: l, reason: collision with root package name */
    public static final PairList.Pair<Integer, Integer> f5928l;
    public static final PairList.Pair<Integer, Integer> l0;

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public static final PairList.Pair<Integer, Integer> f5929m;
    public static final PairList.Pair<Integer, Integer> m0;

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    public static final PairList.Pair<Integer, Integer> f5930n;
    public static final PairList.Pair<Integer, Integer> n0;

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    public static final PairList.Pair<Integer, Integer> f5931o;
    public static final PairList.Pair<Integer, Integer> o0;

    /* JADX INFO: renamed from: p, reason: collision with root package name */
    public static final PairList.Pair<Integer, Integer> f5932p;
    public static final PairList.Pair<Integer, Integer> p0;

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public static final PairList.Pair<Integer, Integer> f5933q;
    public static final PairList.Pair<Integer, Integer> q0;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public static final PairList.Pair<Integer, Integer> f5934r;
    public static final PairList.Pair<Integer, Integer> r0;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public static final PairList.Pair<Integer, Integer> f5935s;
    public static final PairList.Pair<Integer, Integer> s0;

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public static final PairList.Pair<Integer, Integer> f5936t;
    public static final PairList.Pair<Integer, Integer> t0;

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public static final PairList.Pair<Integer, Integer> f5937u;
    public static final PairList.Pair<Integer, Integer> u0;

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    public static final PairList.Pair<Integer, Integer> f5938v;
    public static final PairList.Pair<Integer, Integer> v0;

    /* JADX INFO: renamed from: w, reason: collision with root package name */
    public static final PairList.Pair<Integer, Integer> f5939w;
    public static final PairList.Pair<Integer, Integer> w0;

    /* JADX INFO: renamed from: x, reason: collision with root package name */
    public static final PairList.Pair<Integer, Integer> f5940x;
    public static final PairList.Pair<Integer, Integer> x0;

    /* JADX INFO: renamed from: y, reason: collision with root package name */
    public static final PairList.Pair<Integer, Integer> f5941y;

    /* JADX INFO: renamed from: z, reason: collision with root package name */
    public static final PairList.Pair<Integer, Integer> f5942z;

    static {
        new PairList.Pair(32, 7);
        f5915b = new PairList.Pair<>(32, 10);
        new PairList.Pair(32, 11);
        f5917c = new PairList.Pair<>(32, 14);
        new PairList.Pair(32, 15);
        new PairList.Pair(32, 20);
        new PairList.Pair(32, 21);
        new PairList.Pair(32, Integer.valueOf(InvokeCmd.CMD_SYSTEMCTRL_GET_USB_CONNECT_STATE));
        new PairList.Pair(32, 133);
        new PairList.Pair(32, 134);
        new PairList.Pair(32, 135);
        new PairList.Pair(32, 16);
        new PairList.Pair(32, 17);
        new PairList.Pair(32, 166);
        new PairList.Pair(32, 167);
        new PairList.Pair(32, 186);
        new PairList.Pair(32, 187);
        new PairList.Pair(36, 1);
        new PairList.Pair(36, 2);
        new PairList.Pair(32, 162);
        new PairList.Pair(32, 163);
        f5919d = new PairList.Pair<>(41, 56);
        new PairList.Pair(41, 57);
        f5921e = new PairList.Pair<>(41, 58);
        new PairList.Pair(41, 59);
        f5922f = new PairList.Pair<>(41, 60);
        new PairList.Pair(41, 61);
        f5923g = new PairList.Pair<>(41, 62);
        new PairList.Pair(41, 63);
        f5924h = new PairList.Pair<>(41, 72);
        new PairList.Pair(41, 73);
        f5925i = new PairList.Pair<>(41, 74);
        new PairList.Pair(41, 75);
        f5926j = new PairList.Pair<>(41, 76);
        new PairList.Pair(41, 77);
        f5927k = new PairList.Pair<>(41, 78);
        new PairList.Pair(41, 79);
        f5928l = new PairList.Pair<>(49, 204);
        new PairList.Pair(49, 205);
        f5929m = new PairList.Pair<>(49, 206);
        new PairList.Pair(49, 207);
        f5930n = new PairList.Pair<>(41, 80);
        new PairList.Pair(41, 81);
        f5931o = new PairList.Pair<>(41, 82);
        new PairList.Pair(41, 83);
        f5932p = new PairList.Pair<>(41, 64);
        new PairList.Pair(41, 65);
        f5933q = new PairList.Pair<>(41, 66);
        new PairList.Pair(41, 67);
        f5934r = new PairList.Pair<>(41, 68);
        new PairList.Pair(41, 69);
        f5935s = new PairList.Pair<>(41, 70);
        new PairList.Pair(41, 71);
        f5936t = new PairList.Pair<>(41, 44);
        new PairList.Pair(41, 45);
        f5937u = new PairList.Pair<>(41, 46);
        new PairList.Pair(41, 47);
        f5938v = new PairList.Pair<>(41, 20);
        new PairList.Pair(41, 21);
        f5939w = new PairList.Pair<>(41, 22);
        new PairList.Pair(41, 23);
        f5940x = new PairList.Pair<>(32, 232);
        new PairList.Pair(32, 233);
        f5941y = new PairList.Pair<>(32, 234);
        new PairList.Pair(32, 235);
        f5942z = new PairList.Pair<>(41, 0);
        new PairList.Pair(41, 1);
        A = new PairList.Pair<>(41, 2);
        new PairList.Pair(41, 3);
        B = new PairList.Pair<>(41, 4);
        new PairList.Pair(41, 5);
        C = new PairList.Pair<>(41, 6);
        new PairList.Pair(41, 7);
        D = new PairList.Pair<>(41, 8);
        new PairList.Pair(41, 9);
        E = new PairList.Pair<>(41, 10);
        new PairList.Pair(41, 11);
        F = new PairList.Pair<>(41, 12);
        new PairList.Pair(41, 13);
        G = new PairList.Pair<>(41, 14);
        new PairList.Pair(41, 15);
        H = new PairList.Pair<>(41, 16);
        new PairList.Pair(41, 17);
        I = new PairList.Pair<>(41, 18);
        new PairList.Pair(41, 19);
        J = new PairList.Pair<>(32, 18);
        new PairList.Pair(32, 19);
        K = new PairList.Pair<>(32, 160);
        L = new PairList.Pair<>(32, 150);
        new PairList.Pair(32, 151);
        M = new PairList.Pair<>(32, 176);
        new PairList.Pair(32, 177);
        N = new PairList.Pair<>(32, 152);
        new PairList.Pair(32, 153);
        O = new PairList.Pair<>(32, 154);
        new PairList.Pair(32, 155);
        P = new PairList.Pair<>(32, 182);
        new PairList.Pair(32, 183);
        Q = new PairList.Pair<>(32, 184);
        new PairList.Pair(32, 185);
        R = new PairList.Pair<>(49, 188);
        new PairList.Pair(49, 189);
        S = new PairList.Pair<>(49, 190);
        new PairList.Pair(49, 191);
        T = new PairList.Pair<>(49, 212);
        new PairList.Pair(49, 213);
        U = new PairList.Pair<>(49, 214);
        new PairList.Pair(49, 215);
        V = new PairList.Pair<>(32, 142);
        new PairList.Pair(32, 143);
        W = new PairList.Pair<>(32, 156);
        new PairList.Pair(32, 157);
        X = new PairList.Pair<>(32, 158);
        new PairList.Pair(32, 159);
        Y = new PairList.Pair<>(49, 38);
        new PairList.Pair(49, 39);
        Z = new PairList.Pair<>(49, 40);
        new PairList.Pair(49, 41);
        f5914a0 = new PairList.Pair<>(49, 4);
        new PairList.Pair(49, 5);
        f5916b0 = new PairList.Pair<>(49, 6);
        new PairList.Pair(49, 7);
        f5918c0 = new PairList.Pair<>(49, Integer.valueOf(DnsRecord.CLASS_NONE));
        new PairList.Pair(49, Integer.valueOf(DnsRecord.CLASS_ANY));
        f5920d0 = new PairList.Pair<>(49, 8);
        new PairList.Pair(49, 9);
        e0 = new PairList.Pair<>(32, 24);
        new PairList.Pair(32, 25);
        f0 = new PairList.Pair<>(32, 186);
        g0 = new PairList.Pair<>(32, 94);
        h0 = new PairList.Pair<>(32, 92);
        i0 = new PairList.Pair<>(32, 108);
        j0 = new PairList.Pair<>(32, 110);
        k0 = new PairList.Pair<>(32, 120);
        l0 = new PairList.Pair<>(32, 118);
        m0 = new PairList.Pair<>(32, 122);
        n0 = new PairList.Pair<>(32, 116);
        o0 = new PairList.Pair<>(32, 98);
        p0 = new PairList.Pair<>(32, 96);
        q0 = new PairList.Pair<>(32, 102);
        r0 = new PairList.Pair<>(32, 100);
        s0 = new PairList.Pair<>(32, 106);
        t0 = new PairList.Pair<>(32, 104);
        u0 = new PairList.Pair<>(32, 90);
        v0 = new PairList.Pair<>(32, 88);
        w0 = new PairList.Pair<>(32, 124);
        x0 = new PairList.Pair<>(32, 126);
        new PairList.Pair(34, 0);
        new PairList.Pair(34, 1);
        new PairList.Pair(34, 2);
        new PairList.Pair(34, 3);
        new PairList.Pair(34, 4);
    }

    public static <T extends Enum<T>> boolean m(Class<T> cls, int i2) {
        return i2 < 0 || i2 >= cls.getEnumConstants().length;
    }

    public String A0(String str, int i2, int i3) {
        if (TextUtils.isEmpty(str) || i3 == 0 || i2 >= i3) {
            return "";
        }
        String[] strArrSplit = str.split(",");
        StringBuilder sb = new StringBuilder();
        for (int i4 = 0; i4 < Integer.parseInt(strArrSplit[5], 16); i4++) {
            try {
                sb.append(strArrSplit[i2 + 7 + i4]);
            } catch (Exception e2) {
                StringBuilder sbF = g.a.a.a.a.F("[cameraResponseIntToString] An error occurred: ");
                sbF.append(e2.getMessage());
                g.c("CameraHIDUtils", sbF.toString());
            }
        }
        return sb.toString();
    }

    public byte[] B0(String str, int i2, int i3) {
        if (TextUtils.isEmpty(str) || i3 == 0 || i2 >= i3) {
            return new byte[0];
        }
        String[] strArrSplit = str.split(",");
        int i4 = Integer.parseInt(strArrSplit[5], 16);
        byte[] bArr = new byte[i4];
        for (int i5 = 0; i5 < i4; i5++) {
            int i6 = i2 + 7 + i5;
            try {
                if (i6 < strArrSplit.length) {
                    bArr[i5] = (byte) Integer.parseInt(strArrSplit[i6], 16);
                }
            } catch (Exception e2) {
                StringBuilder sbG = g.a.a.a.a.G("[cameraResponseToByte] Error parsing byte at index ", i5, ": ");
                sbG.append(e2.getMessage());
                g.c("CameraHIDUtils", sbG.toString());
                bArr[i5] = 0;
            }
        }
        return bArr;
    }

    public int C0(String str, int i2, int i3) {
        if (TextUtils.isEmpty(str) || i3 == 0 || i2 >= i3) {
            return 0;
        }
        String[] strArrSplit = str.split(",");
        int i4 = 0;
        for (int i5 = 0; i5 < i3 - i2; i5++) {
            try {
                i4 |= Integer.parseInt(strArrSplit[(i2 + 7) + i5], 16) << (i5 * 8);
            } catch (Exception e2) {
                StringBuilder sbF = g.a.a.a.a.F("[cameraResponseToInt] An error occurred: ");
                sbF.append(e2.getMessage());
                g.c("CameraHIDUtils", sbF.toString());
            }
        }
        return i4;
    }

    public String l(String str, int i2, int i3) {
        if (TextUtils.isEmpty(str) || i3 == 0 || i2 >= i3) {
            return "";
        }
        String[] strArrSplit = str.split(",");
        StringBuilder sb = new StringBuilder();
        for (int i4 = 0; i4 < Integer.parseInt(strArrSplit[5], 16); i4++) {
            try {
                sb.append((char) Integer.parseInt(strArrSplit[i2 + 7 + i4], 16));
            } catch (Exception e2) {
                StringBuilder sbF = g.a.a.a.a.F("[cameraResponseAsciiToString] An error occurred: ");
                sbF.append(e2.getMessage());
                g.c("CameraHIDUtils", sbF.toString());
            }
        }
        return sb.toString();
    }

    public int[] v(String str, int i2, int i3, int i4) {
        int i5;
        if (TextUtils.isEmpty(str) || i4 == 0 || i2 >= i3 || i3 >= i4) {
            g.d("CameraHIDUtils", "[cameraResponseToIntArrays] num error ");
            return new int[0];
        }
        String[] strArrSplit = str.split(",");
        int i6 = 0;
        for (int i7 = 0; i7 < i3; i7++) {
            try {
                i6 |= Integer.parseInt(strArrSplit[(i2 + 7) + i7], 16) << (i7 * 8);
            } catch (Exception e2) {
                e = e2;
                i5 = 0;
                StringBuilder sbF = g.a.a.a.a.F("[cameraResponseToInt] An error occurred: ");
                sbF.append(e.getMessage());
                g.c("CameraHIDUtils", sbF.toString());
                return new int[]{i6, i5};
            }
        }
        i5 = 0;
        while (i3 < Integer.parseInt(strArrSplit[5], 16)) {
            try {
                i5 |= Integer.parseInt(strArrSplit[(i2 + 7) + i3], 16) << (i3 * 8);
                i3++;
            } catch (Exception e3) {
                e = e3;
                StringBuilder sbF2 = g.a.a.a.a.F("[cameraResponseToInt] An error occurred: ");
                sbF2.append(e.getMessage());
                g.c("CameraHIDUtils", sbF2.toString());
            }
        }
        g.a("CameraHIDUtils", "[cameraResponseToIntArrays] result1 " + i6 + " result2 = " + i5);
        return new int[]{i6, i5};
    }

    public String z0(int i2, int i3, byte[] bArr) {
        byte[] bArr2 = new byte[64];
        boolean z2 = bArr != null && bArr.length > 0;
        Arrays.fill(bArr2, (byte) 0);
        bArr2[0] = -86;
        bArr2[1] = -69;
        bArr2[2] = -52;
        bArr2[3] = (byte) (i2 & DnsRecord.CLASS_ANY);
        bArr2[4] = (byte) (i3 & DnsRecord.CLASS_ANY);
        if (z2) {
            bArr2[5] = (byte) (bArr.length & DnsRecord.CLASS_ANY);
        } else {
            bArr2[5] = 0;
        }
        bArr2[6] = 0;
        if (z2) {
            System.arraycopy(bArr, 0, bArr2, 7, bArr.length);
        }
        u.b.b().c("CameraHIDUtils", bArr2);
        StringBuilder sb = new StringBuilder();
        for (int i4 = 0; i4 < 64; i4++) {
            sb.append(String.format("%02X,", Byte.valueOf(bArr2[i4])));
        }
        String string = sb.toString();
        return string.substring(0, string.length() - 1);
    }
}
