package xk;

import com.fasterxml.jackson.core.JsonFactory;
import com.google.firebase.crashlytics.internal.metadata.UserMetadata;
import java.io.Closeable;
import java.io.EOFException;
import java.io.IOException;
import java.io.Reader;
import java.util.Arrays;
import uk.e;

/* loaded from: classes3.dex */
public class a implements Closeable {
    private int[] A;
    private String[] C;
    private int[] D;

    /* renamed from: p, reason: collision with root package name */
    private final Reader f50882p;

    /* renamed from: x, reason: collision with root package name */
    private long f50890x;

    /* renamed from: y, reason: collision with root package name */
    private int f50891y;

    /* renamed from: z, reason: collision with root package name */
    private String f50892z;

    /* renamed from: q, reason: collision with root package name */
    private boolean f50883q = false;

    /* renamed from: r, reason: collision with root package name */
    private final char[] f50884r = new char[UserMetadata.MAX_ATTRIBUTE_SIZE];

    /* renamed from: s, reason: collision with root package name */
    private int f50885s = 0;

    /* renamed from: t, reason: collision with root package name */
    private int f50886t = 0;

    /* renamed from: u, reason: collision with root package name */
    private int f50887u = 0;

    /* renamed from: v, reason: collision with root package name */
    private int f50888v = 0;

    /* renamed from: w, reason: collision with root package name */
    int f50889w = 0;
    private int B = 0 + 1;

    /* renamed from: xk.a$a, reason: collision with other inner class name */
    /* loaded from: classes3.dex */
    class C1019a extends e {
        C1019a() {
        }

        @Override // uk.e
        public void a(a aVar) {
            if (aVar instanceof com.google.gson.internal.bind.b) {
                ((com.google.gson.internal.bind.b) aVar).q0();
                return;
            }
            int i10 = aVar.f50889w;
            if (i10 == 0) {
                i10 = aVar.e();
            }
            if (i10 == 13) {
                aVar.f50889w = 9;
                return;
            }
            if (i10 == 12) {
                aVar.f50889w = 8;
                return;
            }
            if (i10 == 14) {
                aVar.f50889w = 10;
                return;
            }
            throw new IllegalStateException("Expected a name but was " + aVar.L() + aVar.t());
        }
    }

    static {
        e.f37279a = new C1019a();
    }

    public a(Reader reader) {
        int[] iArr = new int[32];
        this.A = iArr;
        iArr[0] = 6;
        this.C = new String[32];
        this.D = new int[32];
        if (reader == null) {
            throw new NullPointerException("in == null");
        }
        this.f50882p = reader;
    }

    private int C(boolean z10) {
        char[] cArr = this.f50884r;
        int i10 = this.f50885s;
        int i11 = this.f50886t;
        while (true) {
            if (i10 == i11) {
                this.f50885s = i10;
                if (!h(1)) {
                    if (!z10) {
                        return -1;
                    }
                    throw new EOFException("End of input" + t());
                }
                i10 = this.f50885s;
                i11 = this.f50886t;
            }
            int i12 = i10 + 1;
            char c10 = cArr[i10];
            if (c10 == '\n') {
                this.f50887u++;
                this.f50888v = i12;
            } else if (c10 != ' ' && c10 != '\r' && c10 != '\t') {
                if (c10 == '/') {
                    this.f50885s = i12;
                    if (i12 == i11) {
                        this.f50885s = i12 - 1;
                        boolean h10 = h(2);
                        this.f50885s++;
                        if (!h10) {
                            return c10;
                        }
                    }
                    c();
                    int i13 = this.f50885s;
                    char c11 = cArr[i13];
                    if (c11 == '*') {
                        this.f50885s = i13 + 1;
                        if (!Y("*/")) {
                            throw j0("Unterminated comment");
                        }
                        i10 = this.f50885s + 2;
                        i11 = this.f50886t;
                    } else {
                        if (c11 != '/') {
                            return c10;
                        }
                        this.f50885s = i13 + 1;
                        a0();
                        i10 = this.f50885s;
                        i11 = this.f50886t;
                    }
                } else {
                    if (c10 != '#') {
                        this.f50885s = i12;
                        return c10;
                    }
                    this.f50885s = i12;
                    c();
                    a0();
                    i10 = this.f50885s;
                    i11 = this.f50886t;
                }
            }
            i10 = i12;
        }
    }

    /* JADX WARN: Code restructure failed: missing block: B:32:0x005c, code lost:
    
        if (r1 != null) goto L27;
     */
    /* JADX WARN: Code restructure failed: missing block: B:33:0x005e, code lost:
    
        r1 = new java.lang.StringBuilder(java.lang.Math.max((r2 - r3) * 2, 16));
     */
    /* JADX WARN: Code restructure failed: missing block: B:34:0x006c, code lost:
    
        r1.append(r0, r3, r2 - r3);
        r9.f50885s = r2;
     */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    private String I(char c10) {
        char[] cArr = this.f50884r;
        StringBuilder sb2 = null;
        do {
            int i10 = this.f50885s;
            int i11 = this.f50886t;
            while (true) {
                int i12 = i11;
                int i13 = i10;
                while (i10 < i12) {
                    int i14 = i10 + 1;
                    char c11 = cArr[i10];
                    if (c11 == c10) {
                        this.f50885s = i14;
                        int i15 = (i14 - i13) - 1;
                        if (sb2 == null) {
                            return new String(cArr, i13, i15);
                        }
                        sb2.append(cArr, i13, i15);
                        return sb2.toString();
                    }
                    if (c11 == '\\') {
                        this.f50885s = i14;
                        int i16 = (i14 - i13) - 1;
                        if (sb2 == null) {
                            sb2 = new StringBuilder(Math.max((i16 + 1) * 2, 16));
                        }
                        sb2.append(cArr, i13, i16);
                        sb2.append(T());
                        i10 = this.f50885s;
                        i11 = this.f50886t;
                    } else {
                        if (c11 == '\n') {
                            this.f50887u++;
                            this.f50888v = i14;
                        }
                        i10 = i14;
                    }
                }
                break;
            }
        } while (h(1));
        throw j0("Unterminated string");
    }

    /* JADX WARN: Code restructure failed: missing block: B:58:0x004a, code lost:
    
        c();
     */
    /* JADX WARN: Failed to find 'out' block for switch in B:54:0x0044. Please report as an issue. */
    /* JADX WARN: Removed duplicated region for block: B:13:0x0080  */
    /* JADX WARN: Removed duplicated region for block: B:17:0x008a  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    private String K() {
        String sb2;
        StringBuilder sb3 = null;
        int i10 = 0;
        do {
            int i11 = 0;
            while (true) {
                int i12 = this.f50885s;
                if (i12 + i11 < this.f50886t) {
                    char c10 = this.f50884r[i12 + i11];
                    if (c10 != '\t' && c10 != '\n' && c10 != '\f' && c10 != '\r' && c10 != ' ') {
                        if (c10 != '#') {
                            if (c10 != ',') {
                                if (c10 != '/' && c10 != '=') {
                                    if (c10 != '{' && c10 != '}' && c10 != ':') {
                                        if (c10 != ';') {
                                            switch (c10) {
                                                case '[':
                                                case ']':
                                                    break;
                                                case '\\':
                                                    break;
                                                default:
                                                    i11++;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                } else if (i11 >= this.f50884r.length) {
                    if (sb3 == null) {
                        sb3 = new StringBuilder(Math.max(i11, 16));
                    }
                    sb3.append(this.f50884r, this.f50885s, i11);
                    this.f50885s += i11;
                } else if (h(i11 + 1)) {
                }
            }
            i10 = i11;
            if (sb3 != null) {
                sb2 = new String(this.f50884r, this.f50885s, i10);
            } else {
                sb3.append(this.f50884r, this.f50885s, i10);
                sb2 = sb3.toString();
            }
            this.f50885s += i10;
            return sb2;
        } while (h(1));
        if (sb3 != null) {
        }
        this.f50885s += i10;
        return sb2;
    }

    private int N() {
        String str;
        String str2;
        int i10;
        char c10 = this.f50884r[this.f50885s];
        if (c10 == 't' || c10 == 'T') {
            str = "true";
            str2 = "TRUE";
            i10 = 5;
        } else if (c10 == 'f' || c10 == 'F') {
            str = "false";
            str2 = "FALSE";
            i10 = 6;
        } else {
            if (c10 != 'n' && c10 != 'N') {
                return 0;
            }
            str = "null";
            str2 = "NULL";
            i10 = 7;
        }
        int length = str.length();
        for (int i11 = 1; i11 < length; i11++) {
            if (this.f50885s + i11 >= this.f50886t && !h(i11 + 1)) {
                return 0;
            }
            char c11 = this.f50884r[this.f50885s + i11];
            if (c11 != str.charAt(i11) && c11 != str2.charAt(i11)) {
                return 0;
            }
        }
        if ((this.f50885s + length < this.f50886t || h(length + 1)) && s(this.f50884r[this.f50885s + length])) {
            return 0;
        }
        this.f50885s += length;
        this.f50889w = i10;
        return i10;
    }

    /* JADX WARN: Code restructure failed: missing block: B:10:0x0093, code lost:
    
        if (r9 != 2) goto L68;
     */
    /* JADX WARN: Code restructure failed: missing block: B:11:0x0095, code lost:
    
        if (r10 == false) goto L68;
     */
    /* JADX WARN: Code restructure failed: missing block: B:13:0x009b, code lost:
    
        if (r11 != Long.MIN_VALUE) goto L60;
     */
    /* JADX WARN: Code restructure failed: missing block: B:14:0x009d, code lost:
    
        if (r13 == false) goto L68;
     */
    /* JADX WARN: Code restructure failed: missing block: B:16:0x00a3, code lost:
    
        if (r11 != 0) goto L63;
     */
    /* JADX WARN: Code restructure failed: missing block: B:17:0x00a5, code lost:
    
        if (r13 != false) goto L68;
     */
    /* JADX WARN: Code restructure failed: missing block: B:18:0x00a7, code lost:
    
        if (r13 == false) goto L65;
     */
    /* JADX WARN: Code restructure failed: missing block: B:19:0x00aa, code lost:
    
        r11 = -r11;
     */
    /* JADX WARN: Code restructure failed: missing block: B:20:0x00ab, code lost:
    
        r18.f50890x = r11;
        r18.f50885s += r8;
        r18.f50889w = 15;
     */
    /* JADX WARN: Code restructure failed: missing block: B:21:0x00b6, code lost:
    
        return 15;
     */
    /* JADX WARN: Code restructure failed: missing block: B:23:0x00b7, code lost:
    
        if (r9 == 2) goto L76;
     */
    /* JADX WARN: Code restructure failed: missing block: B:25:0x00ba, code lost:
    
        if (r9 == 4) goto L76;
     */
    /* JADX WARN: Code restructure failed: missing block: B:27:0x00bd, code lost:
    
        if (r9 != 7) goto L74;
     */
    /* JADX WARN: Code restructure failed: missing block: B:28:0x00c0, code lost:
    
        return 0;
     */
    /* JADX WARN: Code restructure failed: missing block: B:29:0x00c2, code lost:
    
        r18.f50891y = r8;
        r18.f50889w = 16;
     */
    /* JADX WARN: Code restructure failed: missing block: B:30:0x00c8, code lost:
    
        return 16;
     */
    /* JADX WARN: Code restructure failed: missing block: B:75:0x0091, code lost:
    
        if (s(r14) != false) goto L78;
     */
    /* JADX WARN: Code restructure failed: missing block: B:76:0x00c9, code lost:
    
        return 0;
     */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    private int Q() {
        char c10;
        char[] cArr = this.f50884r;
        int i10 = this.f50885s;
        int i11 = this.f50886t;
        int i12 = 0;
        int i13 = 0;
        char c11 = 0;
        boolean z10 = false;
        boolean z11 = true;
        long j10 = 0;
        while (true) {
            if (i10 + i13 == i11) {
                if (i13 == cArr.length) {
                    return i12;
                }
                if (!h(i13 + 1)) {
                    break;
                }
                i10 = this.f50885s;
                i11 = this.f50886t;
            }
            char c12 = cArr[i10 + i13];
            if (c12 != '+') {
                if (c12 == 'E' || c12 == 'e') {
                    i12 = 0;
                    if (c11 != 2 && c11 != 4) {
                        return 0;
                    }
                    c11 = 5;
                } else if (c12 != '-') {
                    c10 = 3;
                    if (c12 == '.') {
                        i12 = 0;
                        if (c11 != 2) {
                            return 0;
                        }
                    } else {
                        if (c12 < '0' || c12 > '9') {
                            break;
                        }
                        if (c11 == 1 || c11 == 0) {
                            j10 = -(c12 - '0');
                            c11 = 2;
                        } else if (c11 == 2) {
                            if (j10 == 0) {
                                return 0;
                            }
                            long j11 = (10 * j10) - (c12 - '0');
                            z11 &= j10 > -922337203685477580L || (j10 == -922337203685477580L && j11 < j10);
                            j10 = j11;
                        } else if (c11 == 3) {
                            i12 = 0;
                            c11 = 4;
                        } else if (c11 == 5 || c11 == 6) {
                            i12 = 0;
                            c11 = 7;
                        }
                        i12 = 0;
                    }
                } else {
                    c10 = 6;
                    i12 = 0;
                    if (c11 == 0) {
                        c11 = 1;
                        z10 = true;
                    } else if (c11 != 5) {
                        return 0;
                    }
                }
                i13++;
            } else {
                c10 = 6;
                i12 = 0;
                if (c11 != 5) {
                    return 0;
                }
            }
            c11 = c10;
            i13++;
        }
    }

    private void S(int i10) {
        int i11 = this.B;
        int[] iArr = this.A;
        if (i11 == iArr.length) {
            int i12 = i11 * 2;
            this.A = Arrays.copyOf(iArr, i12);
            this.D = Arrays.copyOf(this.D, i12);
            this.C = (String[]) Arrays.copyOf(this.C, i12);
        }
        int[] iArr2 = this.A;
        int i13 = this.B;
        this.B = i13 + 1;
        iArr2[i13] = i10;
    }

    private char T() {
        int i10;
        int i11;
        if (this.f50885s == this.f50886t && !h(1)) {
            throw j0("Unterminated escape sequence");
        }
        char[] cArr = this.f50884r;
        int i12 = this.f50885s;
        int i13 = i12 + 1;
        this.f50885s = i13;
        char c10 = cArr[i12];
        if (c10 == '\n') {
            this.f50887u++;
            this.f50888v = i13;
        } else if (c10 != '\"' && c10 != '\'' && c10 != '/' && c10 != '\\') {
            if (c10 == 'b') {
                return '\b';
            }
            if (c10 == 'f') {
                return '\f';
            }
            if (c10 == 'n') {
                return '\n';
            }
            if (c10 == 'r') {
                return '\r';
            }
            if (c10 == 't') {
                return '\t';
            }
            if (c10 != 'u') {
                throw j0("Invalid escape sequence");
            }
            if (i13 + 4 > this.f50886t && !h(4)) {
                throw j0("Unterminated escape sequence");
            }
            int i14 = this.f50885s;
            int i15 = i14 + 4;
            char c11 = 0;
            while (i14 < i15) {
                char c12 = this.f50884r[i14];
                char c13 = (char) (c11 << 4);
                if (c12 < '0' || c12 > '9') {
                    if (c12 >= 'a' && c12 <= 'f') {
                        i10 = c12 - 'a';
                    } else {
                        if (c12 < 'A' || c12 > 'F') {
                            throw new NumberFormatException("\\u" + new String(this.f50884r, this.f50885s, 4));
                        }
                        i10 = c12 - 'A';
                    }
                    i11 = i10 + 10;
                } else {
                    i11 = c12 - '0';
                }
                c11 = (char) (c13 + i11);
                i14++;
            }
            this.f50885s += 4;
            return c11;
        }
        return c10;
    }

    private void X(char c10) {
        char[] cArr = this.f50884r;
        do {
            int i10 = this.f50885s;
            int i11 = this.f50886t;
            while (i10 < i11) {
                int i12 = i10 + 1;
                char c11 = cArr[i10];
                if (c11 == c10) {
                    this.f50885s = i12;
                    return;
                }
                if (c11 == '\\') {
                    this.f50885s = i12;
                    T();
                    i10 = this.f50885s;
                    i11 = this.f50886t;
                } else {
                    if (c11 == '\n') {
                        this.f50887u++;
                        this.f50888v = i12;
                    }
                    i10 = i12;
                }
            }
            this.f50885s = i10;
        } while (h(1));
        throw j0("Unterminated string");
    }

    private boolean Y(String str) {
        int length = str.length();
        while (true) {
            if (this.f50885s + length > this.f50886t && !h(length)) {
                return false;
            }
            char[] cArr = this.f50884r;
            int i10 = this.f50885s;
            if (cArr[i10] != '\n') {
                for (int i11 = 0; i11 < length; i11++) {
                    if (this.f50884r[this.f50885s + i11] != str.charAt(i11)) {
                        break;
                    }
                }
                return true;
            }
            this.f50887u++;
            this.f50888v = i10 + 1;
            this.f50885s++;
        }
    }

    private void a0() {
        char c10;
        do {
            if (this.f50885s >= this.f50886t && !h(1)) {
                return;
            }
            char[] cArr = this.f50884r;
            int i10 = this.f50885s;
            int i11 = i10 + 1;
            this.f50885s = i11;
            c10 = cArr[i10];
            if (c10 == '\n') {
                this.f50887u++;
                this.f50888v = i11;
                return;
            }
        } while (c10 != '\r');
    }

    private void c() {
        if (!this.f50883q) {
            throw j0("Use JsonReader.setLenient(true) to accept malformed JSON");
        }
    }

    private void d() {
        C(true);
        int i10 = this.f50885s - 1;
        this.f50885s = i10;
        if (i10 + 5 <= this.f50886t || h(5)) {
            int i11 = this.f50885s;
            char[] cArr = this.f50884r;
            if (cArr[i11] == ')' && cArr[i11 + 1] == ']' && cArr[i11 + 2] == '}' && cArr[i11 + 3] == '\'' && cArr[i11 + 4] == '\n') {
                this.f50885s = i11 + 5;
            }
        }
    }

    /*  JADX ERROR: JadxRuntimeException in pass: RegionMakerVisitor
        jadx.core.utils.exceptions.JadxRuntimeException: Failed to find switch 'out' block (already processed)
        	at jadx.core.dex.visitors.regions.RegionMaker.calcSwitchOut(RegionMaker.java:923)
        	at jadx.core.dex.visitors.regions.RegionMaker.processSwitch(RegionMaker.java:797)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverse(RegionMaker.java:157)
        	at jadx.core.dex.visitors.regions.RegionMaker.makeRegion(RegionMaker.java:91)
        	at jadx.core.dex.visitors.regions.RegionMaker.processIf(RegionMaker.java:735)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverse(RegionMaker.java:152)
        	at jadx.core.dex.visitors.regions.RegionMaker.makeRegion(RegionMaker.java:91)
        	at jadx.core.dex.visitors.regions.RegionMaker.processIf(RegionMaker.java:735)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverse(RegionMaker.java:152)
        	at jadx.core.dex.visitors.regions.RegionMaker.makeRegion(RegionMaker.java:91)
        	at jadx.core.dex.visitors.regions.RegionMaker.processIf(RegionMaker.java:735)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverse(RegionMaker.java:152)
        	at jadx.core.dex.visitors.regions.RegionMaker.makeRegion(RegionMaker.java:91)
        	at jadx.core.dex.visitors.regions.RegionMaker.processIf(RegionMaker.java:740)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverse(RegionMaker.java:152)
        	at jadx.core.dex.visitors.regions.RegionMaker.makeRegion(RegionMaker.java:91)
        	at jadx.core.dex.visitors.regions.RegionMaker.processIf(RegionMaker.java:740)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverse(RegionMaker.java:152)
        	at jadx.core.dex.visitors.regions.RegionMaker.makeRegion(RegionMaker.java:91)
        	at jadx.core.dex.visitors.regions.RegionMaker.processIf(RegionMaker.java:735)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverse(RegionMaker.java:152)
        	at jadx.core.dex.visitors.regions.RegionMaker.makeRegion(RegionMaker.java:91)
        	at jadx.core.dex.visitors.regions.RegionMaker.processIf(RegionMaker.java:735)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverse(RegionMaker.java:152)
        	at jadx.core.dex.visitors.regions.RegionMaker.makeRegion(RegionMaker.java:91)
        	at jadx.core.dex.visitors.regions.RegionMaker.makeEndlessLoop(RegionMaker.java:411)
        	at jadx.core.dex.visitors.regions.RegionMaker.processLoop(RegionMaker.java:201)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverse(RegionMaker.java:135)
        	at jadx.core.dex.visitors.regions.RegionMaker.makeRegion(RegionMaker.java:91)
        	at jadx.core.dex.visitors.regions.RegionMaker.processLoop(RegionMaker.java:242)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverse(RegionMaker.java:135)
        	at jadx.core.dex.visitors.regions.RegionMaker.makeRegion(RegionMaker.java:91)
        	at jadx.core.dex.visitors.regions.RegionMakerVisitor.visit(RegionMakerVisitor.java:52)
        */
    private void e0() {
        /*
            r4 = this;
        L0:
            r0 = 0
        L1:
            int r1 = r4.f50885s
            int r2 = r1 + r0
            int r3 = r4.f50886t
            if (r2 >= r3) goto L51
            char[] r2 = r4.f50884r
            int r1 = r1 + r0
            char r1 = r2[r1]
            r2 = 9
            if (r1 == r2) goto L4b
            r2 = 10
            if (r1 == r2) goto L4b
            r2 = 12
            if (r1 == r2) goto L4b
            r2 = 13
            if (r1 == r2) goto L4b
            r2 = 32
            if (r1 == r2) goto L4b
            r2 = 35
            if (r1 == r2) goto L48
            r2 = 44
            if (r1 == r2) goto L4b
            r2 = 47
            if (r1 == r2) goto L48
            r2 = 61
            if (r1 == r2) goto L48
            r2 = 123(0x7b, float:1.72E-43)
            if (r1 == r2) goto L4b
            r2 = 125(0x7d, float:1.75E-43)
            if (r1 == r2) goto L4b
            r2 = 58
            if (r1 == r2) goto L4b
            r2 = 59
            if (r1 == r2) goto L48
            switch(r1) {
                case 91: goto L4b;
                case 92: goto L48;
                case 93: goto L4b;
                default: goto L45;
            }
        L45:
            int r0 = r0 + 1
            goto L1
        L48:
            r4.c()
        L4b:
            int r1 = r4.f50885s
            int r1 = r1 + r0
            r4.f50885s = r1
            return
        L51:
            int r1 = r1 + r0
            r4.f50885s = r1
            r0 = 1
            boolean r0 = r4.h(r0)
            if (r0 != 0) goto L0
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: xk.a.e0():void");
    }

    private boolean h(int i10) {
        int i11;
        int i12;
        char[] cArr = this.f50884r;
        int i13 = this.f50888v;
        int i14 = this.f50885s;
        this.f50888v = i13 - i14;
        int i15 = this.f50886t;
        if (i15 != i14) {
            int i16 = i15 - i14;
            this.f50886t = i16;
            System.arraycopy(cArr, i14, cArr, 0, i16);
        } else {
            this.f50886t = 0;
        }
        this.f50885s = 0;
        do {
            Reader reader = this.f50882p;
            int i17 = this.f50886t;
            int read = reader.read(cArr, i17, cArr.length - i17);
            if (read == -1) {
                return false;
            }
            i11 = this.f50886t + read;
            this.f50886t = i11;
            if (this.f50887u == 0 && (i12 = this.f50888v) == 0 && i11 > 0 && cArr[0] == 65279) {
                this.f50885s++;
                this.f50888v = i12 + 1;
                i10++;
            }
        } while (i11 < i10);
        return true;
    }

    private String j(boolean z10) {
        StringBuilder sb2 = new StringBuilder();
        sb2.append('$');
        int i10 = 0;
        while (true) {
            int i11 = this.B;
            if (i10 >= i11) {
                return sb2.toString();
            }
            int i12 = this.A[i10];
            if (i12 == 1 || i12 == 2) {
                int i13 = this.D[i10];
                if (z10 && i13 > 0 && i10 == i11 - 1) {
                    i13--;
                }
                sb2.append('[');
                sb2.append(i13);
                sb2.append(']');
            } else if (i12 == 3 || i12 == 4 || i12 == 5) {
                sb2.append('.');
                String str = this.C[i10];
                if (str != null) {
                    sb2.append(str);
                }
            }
            i10++;
        }
    }

    private IOException j0(String str) {
        throw new d(str + t());
    }

    private boolean s(char c10) {
        if (c10 == '\t' || c10 == '\n' || c10 == '\f' || c10 == '\r' || c10 == ' ') {
            return false;
        }
        if (c10 != '#') {
            if (c10 == ',') {
                return false;
            }
            if (c10 != '/' && c10 != '=') {
                if (c10 == '{' || c10 == '}' || c10 == ':') {
                    return false;
                }
                if (c10 != ';') {
                    switch (c10) {
                        case '[':
                        case ']':
                            return false;
                        case '\\':
                            break;
                        default:
                            return true;
                    }
                }
            }
        }
        c();
        return false;
    }

    public String A() {
        String I;
        int i10 = this.f50889w;
        if (i10 == 0) {
            i10 = e();
        }
        if (i10 == 14) {
            I = K();
        } else if (i10 == 12) {
            I = I('\'');
        } else {
            if (i10 != 13) {
                throw new IllegalStateException("Expected a name but was " + L() + t());
            }
            I = I(JsonFactory.DEFAULT_QUOTE_CHAR);
        }
        this.f50889w = 0;
        this.C[this.B - 1] = I;
        return I;
    }

    public void G() {
        int i10 = this.f50889w;
        if (i10 == 0) {
            i10 = e();
        }
        if (i10 == 7) {
            this.f50889w = 0;
            int[] iArr = this.D;
            int i11 = this.B - 1;
            iArr[i11] = iArr[i11] + 1;
            return;
        }
        throw new IllegalStateException("Expected null but was " + L() + t());
    }

    public String J() {
        String str;
        int i10 = this.f50889w;
        if (i10 == 0) {
            i10 = e();
        }
        if (i10 == 10) {
            str = K();
        } else if (i10 == 8) {
            str = I('\'');
        } else if (i10 == 9) {
            str = I(JsonFactory.DEFAULT_QUOTE_CHAR);
        } else if (i10 == 11) {
            str = this.f50892z;
            this.f50892z = null;
        } else if (i10 == 15) {
            str = Long.toString(this.f50890x);
        } else {
            if (i10 != 16) {
                throw new IllegalStateException("Expected a string but was " + L() + t());
            }
            str = new String(this.f50884r, this.f50885s, this.f50891y);
            this.f50885s += this.f50891y;
        }
        this.f50889w = 0;
        int[] iArr = this.D;
        int i11 = this.B - 1;
        iArr[i11] = iArr[i11] + 1;
        return str;
    }

    public b L() {
        int i10 = this.f50889w;
        if (i10 == 0) {
            i10 = e();
        }
        switch (i10) {
            case 1:
                return b.BEGIN_OBJECT;
            case 2:
                return b.END_OBJECT;
            case 3:
                return b.BEGIN_ARRAY;
            case 4:
                return b.END_ARRAY;
            case 5:
            case 6:
                return b.BOOLEAN;
            case 7:
                return b.NULL;
            case 8:
            case 9:
            case 10:
            case 11:
                return b.STRING;
            case 12:
            case 13:
            case 14:
                return b.NAME;
            case 15:
            case 16:
                return b.NUMBER;
            case 17:
                return b.END_DOCUMENT;
            default:
                throw new AssertionError();
        }
    }

    public final void V(boolean z10) {
        this.f50883q = z10;
    }

    public void a() {
        int i10 = this.f50889w;
        if (i10 == 0) {
            i10 = e();
        }
        if (i10 == 3) {
            S(1);
            this.D[this.B - 1] = 0;
            this.f50889w = 0;
        } else {
            throw new IllegalStateException("Expected BEGIN_ARRAY but was " + L() + t());
        }
    }

    public void b() {
        int i10 = this.f50889w;
        if (i10 == 0) {
            i10 = e();
        }
        if (i10 == 1) {
            S(3);
            this.f50889w = 0;
        } else {
            throw new IllegalStateException("Expected BEGIN_OBJECT but was " + L() + t());
        }
    }

    @Override // java.io.Closeable, java.lang.AutoCloseable
    public void close() {
        this.f50889w = 0;
        this.A[0] = 8;
        this.B = 1;
        this.f50882p.close();
    }

    int e() {
        int C;
        int[] iArr = this.A;
        int i10 = this.B;
        int i11 = iArr[i10 - 1];
        if (i11 == 1) {
            iArr[i10 - 1] = 2;
        } else if (i11 == 2) {
            int C2 = C(true);
            if (C2 != 44) {
                if (C2 != 59) {
                    if (C2 != 93) {
                        throw j0("Unterminated array");
                    }
                    this.f50889w = 4;
                    return 4;
                }
                c();
            }
        } else {
            if (i11 == 3 || i11 == 5) {
                iArr[i10 - 1] = 4;
                if (i11 == 5 && (C = C(true)) != 44) {
                    if (C != 59) {
                        if (C != 125) {
                            throw j0("Unterminated object");
                        }
                        this.f50889w = 2;
                        return 2;
                    }
                    c();
                }
                int C3 = C(true);
                if (C3 == 34) {
                    this.f50889w = 13;
                    return 13;
                }
                if (C3 == 39) {
                    c();
                    this.f50889w = 12;
                    return 12;
                }
                if (C3 == 125) {
                    if (i11 == 5) {
                        throw j0("Expected name");
                    }
                    this.f50889w = 2;
                    return 2;
                }
                c();
                this.f50885s--;
                if (!s((char) C3)) {
                    throw j0("Expected name");
                }
                this.f50889w = 14;
                return 14;
            }
            if (i11 == 4) {
                iArr[i10 - 1] = 5;
                int C4 = C(true);
                if (C4 != 58) {
                    if (C4 != 61) {
                        throw j0("Expected ':'");
                    }
                    c();
                    if (this.f50885s < this.f50886t || h(1)) {
                        char[] cArr = this.f50884r;
                        int i12 = this.f50885s;
                        if (cArr[i12] == '>') {
                            this.f50885s = i12 + 1;
                        }
                    }
                }
            } else if (i11 == 6) {
                if (this.f50883q) {
                    d();
                }
                this.A[this.B - 1] = 7;
            } else if (i11 == 7) {
                if (C(false) == -1) {
                    this.f50889w = 17;
                    return 17;
                }
                c();
                this.f50885s--;
            } else if (i11 == 8) {
                throw new IllegalStateException("JsonReader is closed");
            }
        }
        int C5 = C(true);
        if (C5 == 34) {
            this.f50889w = 9;
            return 9;
        }
        if (C5 == 39) {
            c();
            this.f50889w = 8;
            return 8;
        }
        if (C5 != 44 && C5 != 59) {
            if (C5 == 91) {
                this.f50889w = 3;
                return 3;
            }
            if (C5 != 93) {
                if (C5 == 123) {
                    this.f50889w = 1;
                    return 1;
                }
                this.f50885s--;
                int N = N();
                if (N != 0) {
                    return N;
                }
                int Q = Q();
                if (Q != 0) {
                    return Q;
                }
                if (!s(this.f50884r[this.f50885s])) {
                    throw j0("Expected value");
                }
                c();
                this.f50889w = 10;
                return 10;
            }
            if (i11 == 1) {
                this.f50889w = 4;
                return 4;
            }
        }
        if (i11 != 1 && i11 != 2) {
            throw j0("Unexpected value");
        }
        c();
        this.f50885s--;
        this.f50889w = 7;
        return 7;
    }

    public void f() {
        int i10 = this.f50889w;
        if (i10 == 0) {
            i10 = e();
        }
        if (i10 != 4) {
            throw new IllegalStateException("Expected END_ARRAY but was " + L() + t());
        }
        int i11 = this.B - 1;
        this.B = i11;
        int[] iArr = this.D;
        int i12 = i11 - 1;
        iArr[i12] = iArr[i12] + 1;
        this.f50889w = 0;
    }

    public void g() {
        int i10 = this.f50889w;
        if (i10 == 0) {
            i10 = e();
        }
        if (i10 != 2) {
            throw new IllegalStateException("Expected END_OBJECT but was " + L() + t());
        }
        int i11 = this.B - 1;
        this.B = i11;
        this.C[i11] = null;
        int[] iArr = this.D;
        int i12 = i11 - 1;
        iArr[i12] = iArr[i12] + 1;
        this.f50889w = 0;
    }

    public void g0() {
        int i10 = 0;
        do {
            int i11 = this.f50889w;
            if (i11 == 0) {
                i11 = e();
            }
            if (i11 == 3) {
                S(1);
            } else if (i11 == 1) {
                S(3);
            } else {
                if (i11 == 4) {
                    this.B--;
                } else if (i11 == 2) {
                    this.B--;
                } else {
                    if (i11 == 14 || i11 == 10) {
                        e0();
                    } else if (i11 == 8 || i11 == 12) {
                        X('\'');
                    } else if (i11 == 9 || i11 == 13) {
                        X(JsonFactory.DEFAULT_QUOTE_CHAR);
                    } else if (i11 == 16) {
                        this.f50885s += this.f50891y;
                    }
                    this.f50889w = 0;
                }
                i10--;
                this.f50889w = 0;
            }
            i10++;
            this.f50889w = 0;
        } while (i10 != 0);
        int[] iArr = this.D;
        int i12 = this.B;
        int i13 = i12 - 1;
        iArr[i13] = iArr[i13] + 1;
        this.C[i12 - 1] = "null";
    }

    public String getPath() {
        return j(false);
    }

    public String m() {
        return j(true);
    }

    public boolean p() {
        int i10 = this.f50889w;
        if (i10 == 0) {
            i10 = e();
        }
        return (i10 == 2 || i10 == 4 || i10 == 17) ? false : true;
    }

    public final boolean r() {
        return this.f50883q;
    }

    String t() {
        return " at line " + (this.f50887u + 1) + " column " + ((this.f50885s - this.f50888v) + 1) + " path " + getPath();
    }

    public String toString() {
        return getClass().getSimpleName() + t();
    }

    public boolean v() {
        int i10 = this.f50889w;
        if (i10 == 0) {
            i10 = e();
        }
        if (i10 == 5) {
            this.f50889w = 0;
            int[] iArr = this.D;
            int i11 = this.B - 1;
            iArr[i11] = iArr[i11] + 1;
            return true;
        }
        if (i10 == 6) {
            this.f50889w = 0;
            int[] iArr2 = this.D;
            int i12 = this.B - 1;
            iArr2[i12] = iArr2[i12] + 1;
            return false;
        }
        throw new IllegalStateException("Expected a boolean but was " + L() + t());
    }

    public double w() {
        int i10 = this.f50889w;
        if (i10 == 0) {
            i10 = e();
        }
        if (i10 == 15) {
            this.f50889w = 0;
            int[] iArr = this.D;
            int i11 = this.B - 1;
            iArr[i11] = iArr[i11] + 1;
            return this.f50890x;
        }
        if (i10 == 16) {
            this.f50892z = new String(this.f50884r, this.f50885s, this.f50891y);
            this.f50885s += this.f50891y;
        } else if (i10 == 8 || i10 == 9) {
            this.f50892z = I(i10 == 8 ? '\'' : JsonFactory.DEFAULT_QUOTE_CHAR);
        } else if (i10 == 10) {
            this.f50892z = K();
        } else if (i10 != 11) {
            throw new IllegalStateException("Expected a double but was " + L() + t());
        }
        this.f50889w = 11;
        double parseDouble = Double.parseDouble(this.f50892z);
        if (!this.f50883q && (Double.isNaN(parseDouble) || Double.isInfinite(parseDouble))) {
            throw new d("JSON forbids NaN and infinities: " + parseDouble + t());
        }
        this.f50892z = null;
        this.f50889w = 0;
        int[] iArr2 = this.D;
        int i12 = this.B - 1;
        iArr2[i12] = iArr2[i12] + 1;
        return parseDouble;
    }

    public int y() {
        int i10 = this.f50889w;
        if (i10 == 0) {
            i10 = e();
        }
        if (i10 == 15) {
            long j10 = this.f50890x;
            int i11 = (int) j10;
            if (j10 == i11) {
                this.f50889w = 0;
                int[] iArr = this.D;
                int i12 = this.B - 1;
                iArr[i12] = iArr[i12] + 1;
                return i11;
            }
            throw new NumberFormatException("Expected an int but was " + this.f50890x + t());
        }
        if (i10 == 16) {
            this.f50892z = new String(this.f50884r, this.f50885s, this.f50891y);
            this.f50885s += this.f50891y;
        } else {
            if (i10 != 8 && i10 != 9 && i10 != 10) {
                throw new IllegalStateException("Expected an int but was " + L() + t());
            }
            if (i10 == 10) {
                this.f50892z = K();
            } else {
                this.f50892z = I(i10 == 8 ? '\'' : JsonFactory.DEFAULT_QUOTE_CHAR);
            }
            try {
                int parseInt = Integer.parseInt(this.f50892z);
                this.f50889w = 0;
                int[] iArr2 = this.D;
                int i13 = this.B - 1;
                iArr2[i13] = iArr2[i13] + 1;
                return parseInt;
            } catch (NumberFormatException unused) {
            }
        }
        this.f50889w = 11;
        double parseDouble = Double.parseDouble(this.f50892z);
        int i14 = (int) parseDouble;
        if (i14 != parseDouble) {
            throw new NumberFormatException("Expected an int but was " + this.f50892z + t());
        }
        this.f50892z = null;
        this.f50889w = 0;
        int[] iArr3 = this.D;
        int i15 = this.B - 1;
        iArr3[i15] = iArr3[i15] + 1;
        return i14;
    }

    public long z() {
        int i10 = this.f50889w;
        if (i10 == 0) {
            i10 = e();
        }
        if (i10 == 15) {
            this.f50889w = 0;
            int[] iArr = this.D;
            int i11 = this.B - 1;
            iArr[i11] = iArr[i11] + 1;
            return this.f50890x;
        }
        if (i10 == 16) {
            this.f50892z = new String(this.f50884r, this.f50885s, this.f50891y);
            this.f50885s += this.f50891y;
        } else {
            if (i10 != 8 && i10 != 9 && i10 != 10) {
                throw new IllegalStateException("Expected a long but was " + L() + t());
            }
            if (i10 == 10) {
                this.f50892z = K();
            } else {
                this.f50892z = I(i10 == 8 ? '\'' : JsonFactory.DEFAULT_QUOTE_CHAR);
            }
            try {
                long parseLong = Long.parseLong(this.f50892z);
                this.f50889w = 0;
                int[] iArr2 = this.D;
                int i12 = this.B - 1;
                iArr2[i12] = iArr2[i12] + 1;
                return parseLong;
            } catch (NumberFormatException unused) {
            }
        }
        this.f50889w = 11;
        double parseDouble = Double.parseDouble(this.f50892z);
        long j10 = (long) parseDouble;
        if (j10 != parseDouble) {
            throw new NumberFormatException("Expected a long but was " + this.f50892z + t());
        }
        this.f50892z = null;
        this.f50889w = 0;
        int[] iArr3 = this.D;
        int i13 = this.B - 1;
        iArr3[i13] = iArr3[i13] + 1;
        return j10;
    }
}
