package S4;

import java.util.Iterator;
import java.util.NoSuchElementException;

/* JADX INFO: loaded from: classes3.dex */
public final class b implements Iterator, K4.a {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public int f6260a = -1;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public int f6261b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public int f6262c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public P4.g f6263d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public int f6264e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public final /* synthetic */ c f6265f;

    public b(c cVar) {
        this.f6265f = cVar;
        cVar.getClass();
        int iV = L4.a.v(0, 0, cVar.f6266a.length());
        this.f6261b = iV;
        this.f6262c = iV;
    }

    /* JADX WARN: Removed duplicated region for block: B:10:0x001a  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void a() {
        w4.k kVar;
        int i6 = this.f6262c;
        if (i6 < 0) {
            this.f6260a = 0;
            this.f6263d = null;
            return;
        }
        c cVar = this.f6265f;
        int i7 = cVar.f6267b;
        if (i7 > 0) {
            int i8 = this.f6264e + 1;
            this.f6264e = i8;
            if (i8 >= i7) {
                this.f6263d = new P4.g(this.f6261b, p.K0(cVar.f6266a), 1);
                this.f6262c = -1;
            } else if (i6 <= cVar.f6266a.length() && (kVar = (w4.k) cVar.f6268c.invoke(cVar.f6266a, Integer.valueOf(this.f6262c))) != null) {
                int iIntValue = ((Number) kVar.f25469a).intValue();
                int iIntValue2 = ((Number) kVar.f25470b).intValue();
                this.f6263d = L4.a.l0(this.f6261b, iIntValue);
                int i9 = iIntValue + iIntValue2;
                this.f6261b = i9;
                this.f6262c = i9 + (iIntValue2 == 0 ? 1 : 0);
            } else {
                this.f6263d = new P4.g(this.f6261b, p.K0(cVar.f6266a), 1);
                this.f6262c = -1;
            }
        }
        this.f6260a = 1;
    }

    @Override // java.util.Iterator
    public final boolean hasNext() {
        if (this.f6260a == -1) {
            a();
        }
        return this.f6260a == 1;
    }

    @Override // java.util.Iterator
    public final Object next() {
        if (this.f6260a == -1) {
            a();
        }
        if (this.f6260a == 0) {
            throw new NoSuchElementException();
        }
        P4.g gVar = this.f6263d;
        kotlin.jvm.internal.o.f(gVar, "null cannot be cast to non-null type kotlin.ranges.IntRange");
        this.f6263d = null;
        this.f6260a = -1;
        return gVar;
    }

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