package defpackage;

import java.util.Iterator;

/* renamed from: ᵸᵯʾⁱ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C4998 implements Iterator, InterfaceC3996 {

    /* renamed from: ᵡⁱᵥ, reason: contains not printable characters */
    public final /* synthetic */ Object f18550;

    /* renamed from: ᵢˇᵭ, reason: contains not printable characters */
    public int f18551;

    /* renamed from: ᵤᵙᵷ, reason: contains not printable characters */
    public Object f18552;

    /* renamed from: ᵧᵾˀˈ, reason: contains not printable characters */
    public final /* synthetic */ int f18553;

    /* renamed from: ᵾᵬ, reason: contains not printable characters */
    public int f18554;

    /* renamed from: ᵿʗᵝʽ, reason: contains not printable characters */
    public int f18555;

    public C4998(C4540 c4540) {
        this.f18553 = 0;
        this.f18550 = c4540;
        this.f18551 = -1;
        int i = ᵕˏᵛ.ˏˋٴ(0, ((CharSequence) c4540.f16891).length());
        this.f18555 = i;
        this.f18554 = i;
    }

    public C4998(C5148 c5148) {
        this.f18553 = 1;
        this.f18550 = c5148;
        this.f18555 = c5148.f19163;
        this.f18554 = c5148.f19164;
    }

    @Override // java.util.Iterator
    public final boolean hasNext() {
        switch (this.f18553) {
            case 0:
                if (this.f18551 == -1) {
                    m10453();
                }
                return this.f18551 == 1;
            default:
                int i = this.f18551;
                if (i == 0) {
                    return m10454();
                }
                if (i == 1) {
                    return true;
                }
                if (i != 2) {
                    ᵹˉᵞ.ˌᵜᵹᵩ("hasNext called when the iterator is in the FAILED state.");
                }
                return false;
        }
    }

    @Override // java.util.Iterator
    public final Object next() {
        switch (this.f18553) {
            case 0:
                if (this.f18551 == -1) {
                    m10453();
                }
                if (this.f18551 == 0) {
                    C0190.m1427();
                    break;
                } else {
                    C1521 c1521 = (C1521) this.f18552;
                    this.f18552 = null;
                    this.f18551 = -1;
                    break;
                }
            default:
                int i = this.f18551;
                if (i != 1) {
                    if (i != 2 && m10454()) {
                        this.f18551 = 0;
                        break;
                    } else {
                        C0190.m1427();
                        break;
                    }
                } else {
                    this.f18551 = 0;
                    break;
                }
                break;
        }
        return null;
    }

    @Override // java.util.Iterator
    public final void remove() {
        switch (this.f18553) {
            case 0:
                throw new UnsupportedOperationException("Operation is not supported for read-only collection");
            default:
                throw new UnsupportedOperationException("Operation is not supported for read-only collection");
        }
    }

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public void m10453() {
        C2836 c2836;
        C4540 c4540 = (C4540) this.f18550;
        CharSequence charSequence = (CharSequence) c4540.f16891;
        int i = this.f18554;
        if (i < 0) {
            this.f18551 = 0;
            this.f18552 = null;
            return;
        }
        if (i <= charSequence.length() && (c2836 = (C2836) ((InterfaceC3759) c4540.f16889).mo1246(charSequence, Integer.valueOf(this.f18554))) != null) {
            int iIntValue = ((Number) c2836.f10917).intValue();
            int iIntValue2 = ((Number) c2836.f10916).intValue();
            this.f18552 = ᵕˏᵛ.ˌᵹᵨˑ(this.f18555, iIntValue);
            int i2 = iIntValue + iIntValue2;
            this.f18555 = i2;
            this.f18554 = i2 + (iIntValue2 == 0 ? 1 : 0);
        } else {
            this.f18552 = new C1521(this.f18555, AbstractC1789.m5086(charSequence), 1);
            this.f18554 = -1;
        }
        this.f18551 = 1;
    }

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public boolean m10454() {
        this.f18551 = 3;
        int i = this.f18555;
        if (i == 0) {
            this.f18551 = 2;
        } else {
            C5148 c5148 = (C5148) this.f18550;
            Object[] objArr = c5148.f19162;
            int i2 = this.f18554;
            this.f18552 = objArr[i2];
            this.f18551 = 1;
            this.f18554 = (i2 + 1) % c5148.f19161;
            this.f18555 = i - 1;
        }
        return this.f18551 == 1;
    }
}
