package com.apiguard3.url_matcher;

import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Process;
import android.os.SystemClock;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewConfiguration;
import android.widget.ExpandableListView;
import com.apiguard3.internal.checkCertificates;
import com.apiguard3.internal.getState;
import com.apiguard3.internal.log;
import com.bytedance.covode.number.Covode;
import org.json.JSONArray;

public class MatchConfig {
    public static long AGRequest$Builder = 3836574155578311068L;
    public static char[] getUrl = {43996, 'N', 33235, 876, 'I'};
    public static int method;
    public static int newBuilder = 1;
    public String AGRequest = "";
    public boolean getBody;
    public Match getHeaders = Match.AGRequest;
    public boolean getMethod;

    static {
        Covode.recordClassIndex(2533);
    }

    public String AGRequest() {
        int i = newBuilder + 55;
        int i2 = i % 128;
        method = i2;
        int i3 = i % 2;
        String str = this.AGRequest;
        int i4 = i2 + 69;
        newBuilder = i4 % 128;
        int i5 = i4 % 2;
        return str;
    }

    public Boolean getBody() {
        int i = newBuilder + 29;
        method = i % 128;
        int i2 = i % 2;
        Boolean valueOf = Boolean.valueOf(this.getMethod);
        int i3 = newBuilder + 89;
        method = i3 % 128;
        int i4 = i3 % 2;
        return valueOf;
    }

    public Match getMethod() {
        int i = method + 71;
        int i2 = i % 128;
        newBuilder = i2;
        int i3 = i % 2;
        Match match = this.getHeaders;
        int i4 = i2 + 99;
        method = i4 % 128;
        int i5 = i4 % 2;
        return match;
    }

    public Boolean getUrl() {
        boolean z;
        int i = newBuilder + 73;
        method = i % 128;
        if (i % 2 == 0) {
        }
        Boolean valueOf = Boolean.valueOf(this.getBody);
        int i2 = method + 57;
        newBuilder = i2 % 128;
        if (i2 % 2 != 0) {
            z = false;
        } else {
            z = true;
        }
        if (!z) {
            return valueOf;
        }
        throw new NullPointerException("hashCode");
    }

    public int hashCode() {
        char c;
        int i;
        int i2 = newBuilder + 87;
        method = i2 % 128;
        int i3 = i2 % 2;
        int hashCode = (((this.AGRequest.hashCode() + 527) * 31) + this.getHeaders.hashCode()) * 31;
        if (!this.getMethod) {
            c = 30;
        } else {
            c = 27;
        }
        int i4 = 0;
        if (c != 27) {
            i = 0;
        } else {
            i = 1;
        }
        int i5 = (hashCode + i) * 31;
        if (this.getBody) {
            int i6 = method + 75;
            newBuilder = i6 % 128;
            int i7 = i6 % 2;
            i4 = 1;
        }
        int i8 = i5 + i4;
        int i9 = method + 53;
        newBuilder = i9 % 128;
        int i10 = i9 % 2;
        return i8;
    }

    public enum Match {
        getUrl,
        getHeaders,
        getMethod,
        getBody,
        AGRequest;
        
        public static int AGRequest$Builder;
        public static boolean addHeader;
        public static int get;
        public static boolean newBuilder;
        public static int post;
        public static char[] url;

        public static void getMethod() {
            AGRequest$Builder = 243;
            newBuilder = true;
            addHeader = true;
            url = new char[]{316, 326, 327, 308, 325, 330, 315, 310, 322, 321, 312, 311, 329, 319};
        }

        /* access modifiers changed from: public */
        static {
            int i = get + 35;
            post = i % 128;
            int i2 = i % 2;
        }

        public static Match getMethod(String str) {
            int hashCode = str.hashCode();
            if (hashCode != -1768228930) {
                if (hashCode != -1069493097) {
                    if (hashCode != 2346) {
                        if (hashCode == 215180831 && str.equals(getHeaders(126 - TextUtils.indexOf("", '0', 0), (String) null, (int[]) null, "").intern())) {
                            int i = post + 49;
                            get = i % 128;
                            int i2 = i % 2;
                            return getMethod;
                        }
                    } else if (str.equals(getHeaders(ExpandableListView.getPackedPositionType(0) + 127, (String) null, (int[]) null, "").intern())) {
                        return getUrl;
                    }
                } else if (str.equals(getHeaders(126 - TextUtils.lastIndexOf("", '0', 0, 0), (String) null, (int[]) null, "").intern())) {
                    return getHeaders;
                }
            } else if (str.equals(getHeaders(127 - (ViewConfiguration.getScrollBarSize() >> 8), (String) null, (int[]) null, "").intern())) {
                int i3 = post + 63;
                get = i3 % 128;
                if (i3 % 2 == 0) {
                    return getBody;
                }
            }
            checkCertificates.getMethod(log.getBody.getHeaders, getState.getHeaders.headers);
            return AGRequest;
        }

        /* JADX DEBUG: Multi-variable search result rejected for TypeSearchVarInfo{r9v1, resolved type: byte[]} */
        /* JADX DEBUG: Multi-variable search result rejected for TypeSearchVarInfo{r9v2, resolved type: java.lang.String} */
        /* JADX DEBUG: Multi-variable search result rejected for TypeSearchVarInfo{r7v1, resolved type: char[]} */
        /* JADX DEBUG: Multi-variable search result rejected for TypeSearchVarInfo{r7v2, resolved type: java.lang.String} */
        /* JADX DEBUG: Multi-variable search result rejected for TypeSearchVarInfo{r7v3, resolved type: char[]} */
        /* JADX DEBUG: Multi-variable search result rejected for TypeSearchVarInfo{r9v4, resolved type: java.lang.String} */
        /* JADX DEBUG: Multi-variable search result rejected for TypeSearchVarInfo{r9v5, resolved type: java.lang.String} */
        /* JADX DEBUG: Multi-variable search result rejected for TypeSearchVarInfo{r9v6, resolved type: java.lang.String} */
        /* JADX DEBUG: Multi-variable search result rejected for TypeSearchVarInfo{r7v7, resolved type: java.lang.String} */
        /* JADX DEBUG: Multi-variable search result rejected for TypeSearchVarInfo{r7v9, resolved type: java.lang.String} */
        /* JADX WARNING: Code restructure failed: missing block: B:10:0x0031, code lost:
            r1 = get + 41;
            post = r1 % 128;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:11:0x003b, code lost:
            if ((r1 % 2) != 0) goto L_0x004c;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:12:0x003d, code lost:
            r7 = r7.toCharArray();
         */
        /* JADX WARNING: Code restructure failed: missing block: B:13:0x0041, code lost:
            r1 = post + 61;
            get = r1 % 128;
            r0 = r1 % 2;
            r7 = r7;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:14:0x004c, code lost:
            r7 = r7.toCharArray();
         */
        /* JADX WARNING: Code restructure failed: missing block: B:15:0x0051, code lost:
            if (r9 == null) goto L_0x000e;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:16:0x0053, code lost:
            r9 = r9.getBytes("ISO-8859-1");
         */
        /* JADX WARNING: Code restructure failed: missing block: B:18:0x005f, code lost:
            return new java.lang.String(r1);
         */
        /* JADX WARNING: Code restructure failed: missing block: B:20:0x0063, code lost:
            if (newBuilder != false) goto L_0x007f;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:21:0x0065, code lost:
            r2 = r8.length;
            r1 = new char[r2];
         */
        /* JADX WARNING: Code restructure failed: missing block: B:22:0x0068, code lost:
            if (r3 >= r2) goto L_0x0079;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:23:0x006a, code lost:
            r1[r3] = (char) (r5[r8[(r2 - 1) - r3] - r6] - r4);
            r3 = r3 + 1;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:25:0x007e, code lost:
            return new java.lang.String(r1);
         */
        /* JADX WARNING: Code restructure failed: missing block: B:26:0x007f, code lost:
            r3 = r7.length;
            r2 = new char[r3];
            r1 = 0;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:27:0x0083, code lost:
            if (r1 < r3) goto L_0x008b;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:29:0x008a, code lost:
            return new java.lang.String(r2);
         */
        /* JADX WARNING: Code restructure failed: missing block: B:2:0x000c, code lost:
            if (r9 == null) goto L_0x000e;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:30:0x008b, code lost:
            r2[r1] = (char) (r5[r7[(r3 - 1) - r1] - r6] - r4);
            r1 = r1 + 1;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:3:0x000e, code lost:
            r9 = (byte[]) r9;
            r7 = r7;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:4:0x0010, code lost:
            if (r7 != null) goto L_0x0031;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:5:0x0012, code lost:
            r7 = (char[]) r7;
            r5 = url;
            r4 = AGRequest$Builder;
            r3 = 0;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:6:0x001b, code lost:
            if (addHeader == false) goto L_0x0060;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:7:0x001d, code lost:
            r2 = r9.length;
            r1 = new char[r2];
         */
        /* JADX WARNING: Code restructure failed: missing block: B:8:0x0020, code lost:
            if (r3 >= r2) goto L_0x005a;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:9:0x0022, code lost:
            r1[r3] = (char) (r5[r9[(r2 - 1) - r3] + r6] - r4);
            r3 = r3 + 1;
         */
        /* JADX WARNING: Multi-variable type inference failed */
        /* Code decompiled incorrectly, please refer to instructions dump. */
        public static java.lang.String getHeaders(int r6, java.lang.String r7, int[] r8, java.lang.String r9) {
            /*
                int r0 = post
                int r1 = r0 + 3
                int r0 = r1 % 128
                get = r0
                int r0 = r1 % 2
                if (r0 == 0) goto L_0x0051
                if (r9 != 0) goto L_0x0053
            L_0x000e:
                byte[] r9 = (byte[]) r9
                if (r7 != 0) goto L_0x0031
            L_0x0012:
                char[] r7 = (char[]) r7
                char[] r5 = url
                int r4 = AGRequest$Builder
                boolean r0 = addHeader
                r3 = 0
                if (r0 == 0) goto L_0x0060
                int r2 = r9.length
                char[] r1 = new char[r2]
            L_0x0020:
                if (r3 >= r2) goto L_0x005a
                int r0 = r2 + -1
                int r0 = r0 - r3
                byte r0 = r9[r0]
                int r0 = r0 + r6
                char r0 = r5[r0]
                int r0 = r0 - r4
                char r0 = (char) r0
                r1[r3] = r0
                int r3 = r3 + 1
                goto L_0x0020
            L_0x0031:
                int r0 = get
                int r1 = r0 + 41
                int r0 = r1 % 128
                post = r0
                int r0 = r1 % 2
                if (r0 != 0) goto L_0x004c
                char[] r7 = r7.toCharArray()
            L_0x0041:
                int r0 = post
                int r1 = r0 + 61
                int r0 = r1 % 128
                get = r0
                int r0 = r1 % 2
                goto L_0x0012
            L_0x004c:
                char[] r7 = r7.toCharArray()
                goto L_0x0041
            L_0x0051:
                if (r9 == 0) goto L_0x000e
            L_0x0053:
                java.lang.String r0 = "ISO-8859-1"
                byte[] r9 = r9.getBytes(r0)
                goto L_0x000e
            L_0x005a:
                java.lang.String r0 = new java.lang.String
                r0.<init>(r1)
                return r0
            L_0x0060:
                boolean r1 = newBuilder
                r0 = 1
                if (r1 != 0) goto L_0x007f
                int r2 = r8.length
                char[] r1 = new char[r2]
            L_0x0068:
                if (r3 >= r2) goto L_0x0079
                int r0 = r2 + -1
                int r0 = r0 - r3
                r0 = r8[r0]
                int r0 = r0 - r6
                char r0 = r5[r0]
                int r0 = r0 - r4
                char r0 = (char) r0
                r1[r3] = r0
                int r3 = r3 + 1
                goto L_0x0068
            L_0x0079:
                java.lang.String r0 = new java.lang.String
                r0.<init>(r1)
                return r0
            L_0x007f:
                int r3 = r7.length
                char[] r2 = new char[r3]
                r1 = 0
            L_0x0083:
                if (r1 < r3) goto L_0x008b
                java.lang.String r0 = new java.lang.String
                r0.<init>(r2)
                return r0
            L_0x008b:
                int r0 = r3 + -1
                int r0 = r0 - r1
                char r0 = r7[r0]
                int r0 = r0 - r6
                char r0 = r5[r0]
                int r0 = r0 - r4
                char r0 = (char) r0
                r2[r1] = r0
                int r1 = r1 + 1
                goto L_0x0083
            */
            throw new UnsupportedOperationException("Method not decompiled: com.apiguard3.url_matcher.MatchConfig.Match.getHeaders(int, java.lang.String, int[], java.lang.String):java.lang.String");
        }
    }

    public boolean equals(Object obj) {
        if (this != obj) {
            if (obj != null && getClass() == obj.getClass()) {
                MatchConfig matchConfig = (MatchConfig) obj;
                if (this.AGRequest.equals(matchConfig.AGRequest)) {
                    int i = newBuilder;
                    int i2 = i + 21;
                    method = i2 % 128;
                    if (i2 % 2 != 0 ? this.getHeaders == matchConfig.getHeaders : this.getHeaders == matchConfig.getHeaders) {
                        if (this.getMethod == matchConfig.getMethod && this.getBody == matchConfig.getBody) {
                            int i3 = i + 39;
                            method = i3 % 128;
                            int i4 = i3 % 2;
                            return true;
                        }
                    }
                }
            }
            return false;
        }
        int i5 = method + 33;
        newBuilder = i5 % 128;
        if (i5 % 2 == 0) {
            return false;
        }
        return true;
    }

    public MatchConfig(JSONArray jSONArray) {
        String str = (String) jSONArray.opt(0);
        if (str != null) {
            String[] split = str.split(getUrl(ViewConfiguration.getScrollDefaultDelay() >> 16, (SystemClock.uptimeMillis() > 0 ? 1 : (SystemClock.uptimeMillis() == 0 ? 0 : -1)), (char) (43907 - Color.argb(0, 0, 0, 0))).intern());
            this.getMethod = split[0].equals(getUrl(((Process.getThreadPriority(0) + 20) >> 6) + 1, 3 - (ExpandableListView.getPackedPositionForGroup(0) > 0 ? 1 : (ExpandableListView.getPackedPositionForGroup(0) == 0 ? 0 : -1)), (char) View.MeasureSpec.getSize(0)).intern());
            this.getBody = split[split.length - 1].equals(getUrl((ExpandableListView.getPackedPositionForGroup(0) > 0 ? 1 : (ExpandableListView.getPackedPositionForGroup(0) == 0 ? 0 : -1)) + 4, 1 - Color.argb(0, 0, 0, 0), (char) Drawable.resolveOpacity(0, 0)).intern());
            this.getHeaders = Match.getMethod(split[this.getMethod]);
        }
        String str2 = (String) jSONArray.opt(1);
        if (str2 != null) {
            this.AGRequest = this.getBody ? str2.toLowerCase() : str2;
        }
    }

    public static String getUrl(int i, int i2, char c) {
        char[] cArr = new char[i2];
        int i3 = method + 91;
        newBuilder = i3 % 128;
        int i4 = i3 % 2;
        int i5 = 0;
        while (i5 < i2) {
            int i6 = method + 5;
            newBuilder = i6 % 128;
            if (i6 % 2 == 0) {
                cArr[i5] = (char) ((int) ((((long) getUrl[i % i5]) ^ (((long) i5) - AGRequest$Builder)) & ((long) c)));
                i5 += 28;
            } else {
                cArr[i5] = (char) ((int) ((((long) getUrl[i + i5]) ^ (((long) i5) * AGRequest$Builder)) ^ ((long) c)));
                i5++;
            }
        }
        return new String(cArr);
    }
}
